From fa3d9e77db269723cee52633be463f63a944ea75 Mon Sep 17 00:00:00 2001 From: jaburns Date: Fri, 30 Oct 2020 12:11:26 -0600 Subject: [PATCH] Fix all warnings --- src/debug_print.h | 3 +- src/decomp/game/behavior_actions.c | 1 + src/decomp/game/interaction.c | 82 +++++++-------- src/decomp/game/mario.c | 4 + src/decomp/game/mario_actions_automatic.c | 21 ++-- src/decomp/game/mario_actions_cutscene.c | 120 +++++++++++----------- src/decomp/game/mario_actions_moving.c | 2 +- src/decomp/game/mario_misc.c | 5 +- src/decomp/game/object_stuff.c | 1 - src/decomp/game/rendering_graph_node.c | 39 +++---- src/decomp/include/PR/gbi.h | 4 +- src/decomp/include/types.h | 2 +- src/decomp/shim.h | 62 +++++------ src/gfx_adapter.c | 4 +- src/gfx_adapter.h | 6 -- src/libsm64.c | 5 +- src/load_anim_data.c | 8 +- src/load_surfaces.c | 3 +- src/load_tex_data.c | 3 +- 19 files changed, 189 insertions(+), 186 deletions(-) diff --git a/src/debug_print.h b/src/debug_print.h index b2eaa7e..987cc31 100644 --- a/src/debug_print.h +++ b/src/debug_print.h @@ -1,6 +1,7 @@ #pragma once #include "libsm64.h" +#include extern SM64DebugPrintFunctionPtr g_debug_print_func; @@ -10,4 +11,4 @@ extern SM64DebugPrintFunctionPtr g_debug_print_func; sprintf( debugStr, __VA_ARGS__ ); \ g_debug_print_func( debugStr ); \ } \ -} while(0) \ No newline at end of file +} while(0) diff --git a/src/decomp/game/behavior_actions.c b/src/decomp/game/behavior_actions.c index 2445c2b..2f07389 100644 --- a/src/decomp/game/behavior_actions.c +++ b/src/decomp/game/behavior_actions.c @@ -1,5 +1,6 @@ #include "behavior_actions.h" #include "rendering_graph_node.h" +#include "object_stuff.h" #include "../shim.h" // not sure what this is doing here. not in a behavior file. diff --git a/src/decomp/game/interaction.c b/src/decomp/game/interaction.c index d538c47..458620f 100644 --- a/src/decomp/game/interaction.c +++ b/src/decomp/game/interaction.c @@ -369,10 +369,10 @@ struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType) u32 mario_check_object_grab(struct MarioState *m) { u32 result = FALSE; - const BehaviorScript *script; +// const BehaviorScript *script; if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) { - script = virtual_to_segmented(0x13, m->interactObj->behavior); +// script = virtual_to_segmented(0x13, m->interactObj->behavior); // if (script == bhvBowser) { // s16 facingDYaw = m->faceAngle[1] - m->interactObj->oMoveAngleYaw; @@ -478,35 +478,35 @@ void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) { set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW); } -static u32 unused_determine_knockback_action(struct MarioState *m) { - u32 bonkAction; - s16 angleToObject = mario_obj_angle_to_object(m, m->interactObj); - s16 facingDYaw = angleToObject - m->faceAngle[1]; - - if (m->forwardVel < 16.0f) { - m->forwardVel = 16.0f; - } - - m->faceAngle[1] = angleToObject; - - if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000) { - m->forwardVel *= -1.0f; - if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { - bonkAction = ACT_BACKWARD_AIR_KB; - } else { - bonkAction = ACT_SOFT_BACKWARD_GROUND_KB; - } - } else { - m->faceAngle[1] += 0x8000; - if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { - bonkAction = ACT_FORWARD_AIR_KB; - } else { - bonkAction = ACT_SOFT_FORWARD_GROUND_KB; - } - } - - return bonkAction; -} +// static u32 unused_determine_knockback_action(struct MarioState *m) { +// u32 bonkAction; +// s16 angleToObject = mario_obj_angle_to_object(m, m->interactObj); +// s16 facingDYaw = angleToObject - m->faceAngle[1]; +// +// if (m->forwardVel < 16.0f) { +// m->forwardVel = 16.0f; +// } +// +// m->faceAngle[1] = angleToObject; +// +// if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000) { +// m->forwardVel *= -1.0f; +// if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { +// bonkAction = ACT_BACKWARD_AIR_KB; +// } else { +// bonkAction = ACT_SOFT_BACKWARD_GROUND_KB; +// } +// } else { +// m->faceAngle[1] += 0x8000; +// if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { +// bonkAction = ACT_FORWARD_AIR_KB; +// } else { +// bonkAction = ACT_SOFT_FORWARD_GROUND_KB; +// } +// } +// +// return bonkAction; +// } u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) { u32 bonkAction; @@ -630,16 +630,16 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) { } u32 take_damage_from_interact_object(struct MarioState *m) { - s32 shake; +// s32 shake; s32 damage = m->interactObj->oDamageOrCoinValue; - if (damage >= 4) { - shake = SHAKE_LARGE_DAMAGE; - } else if (damage >= 2) { - shake = SHAKE_MED_DAMAGE; - } else { - shake = SHAKE_SMALL_DAMAGE; - } +// if (damage >= 4) { +// shake = SHAKE_LARGE_DAMAGE; +// } else if (damage >= 2) { +// shake = SHAKE_MED_DAMAGE; +// } else { +// shake = SHAKE_SMALL_DAMAGE; +// } if (!(m->flags & MARIO_CAP_ON_HEAD)) { damage += (damage + 1) / 2; @@ -654,7 +654,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) { #ifdef VERSION_SH queue_rumble_data(5, 80); #endif - set_camera_shake_from_hit(shake); +// set_camera_shake_from_hit(shake); return damage; } @@ -908,7 +908,7 @@ void mario_handle_special_floors(struct MarioState *m) { break; case SURFACE_WARP: - level_trigger_warp(m, WARP_OP_WARP_FLOOR); +// level_trigger_warp(m, WARP_OP_WARP_FLOOR); break; case SURFACE_TIMER_START: diff --git a/src/decomp/game/mario.c b/src/decomp/game/mario.c index 4b7eef8..8501ffb 100644 --- a/src/decomp/game/mario.c +++ b/src/decomp/game/mario.c @@ -40,6 +40,9 @@ #include "../../load_anim_data.h" +static f32 gDefaultSoundArgs[3] = { 0.0f, 0.0f, 0.0f }; + + /************************************************** * ANIMATIONS * **************************************************/ @@ -1455,6 +1458,7 @@ void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) { } } + /** * Both increments and decrements Mario's HP. */ diff --git a/src/decomp/game/mario_actions_automatic.c b/src/decomp/game/mario_actions_automatic.c index c23692c..f6d4a29 100644 --- a/src/decomp/game/mario_actions_automatic.c +++ b/src/decomp/game/mario_actions_automatic.c @@ -49,17 +49,16 @@ void add_tree_leaf_particles(struct MarioState *m) { void play_climbing_sounds(struct MarioState *m, s32 b) { // s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree)); - s32 isOnTree = FALSE; - if (b == 1) { - if (is_anim_past_frame(m, 1)) { - play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE, - m->marioObj->header.gfx.cameraToObject); - } - } else { - play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE, - m->marioObj->header.gfx.cameraToObject); - } +// if (b == 1) { +// if (is_anim_past_frame(m, 1)) { +// play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE, +// m->marioObj->header.gfx.cameraToObject); +// } +// } else { +// play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE, +// m->marioObj->header.gfx.cameraToObject); +// } } s32 set_pole_position(struct MarioState *m, f32 offsetY) { @@ -150,7 +149,7 @@ s32 act_holding_pole(struct MarioState *m) { if (m->controller->stickY > 16.0f) { f32 poleTop = m->usedObj->hitboxHeight - 100.0f; - const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior); +// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior); if (marioObj->oMarioPolePos < poleTop - 0.4f) { return set_mario_action(m, ACT_CLIMBING_POLE, 0); diff --git a/src/decomp/game/mario_actions_cutscene.c b/src/decomp/game/mario_actions_cutscene.c index 45aa681..102d6a2 100644 --- a/src/decomp/game/mario_actions_cutscene.c +++ b/src/decomp/game/mario_actions_cutscene.c @@ -62,7 +62,7 @@ static struct Object *sIntroWarpPipeObj; static struct Object *sEndPeachObj; //static struct Object *sEndRightToadObj; //static struct Object *sEndLeftToadObj; -static struct Object *sEndJumboStarObj; +//static struct Object *sEndJumboStarObj; static UNUSED s32 sUnused; static s16 sEndPeachAnimation; //static s16 sEndToadAnims[2]; @@ -71,7 +71,7 @@ static Vp sEndCutsceneVp = { { { 640, 480, 511, 0 }, { 640, 480, 511, 0 } } }; //static struct CreditsEntry *sDispCreditsEntry = NULL; // related to peach gfx? -static s8 D_8032CBE4 = 0; +//static s8 D_8032CBE4 = 0; //static s8 D_8032CBE8 = 0; //static s8 D_8032CBEC[7] = { 2, 3, 2, 1, 2, 3, 2 }; @@ -2065,22 +2065,22 @@ static void end_peach_cutscene_mario_landing(struct MarioState *m) { // raise hand animation, lower hand animation, do some special effects static void end_peach_cutscene_summon_jumbo_star(struct MarioState *m) { - set_mario_animation(m, m->actionState == 0 ? MARIO_ANIM_CREDITS_RAISE_HAND - : MARIO_ANIM_CREDITS_LOWER_HAND); +// set_mario_animation(m, m->actionState == 0 ? MARIO_ANIM_CREDITS_RAISE_HAND +// : MARIO_ANIM_CREDITS_LOWER_HAND); - if (m->actionState == 0 && is_anim_past_end(m)) { - m->actionState++; - } - if (m->actionTimer == 90) { - play_cutscene_music(SEQUENCE_ARGS(0, SEQ_EVENT_CUTSCENE_ENDING)); - } - if (m->actionTimer == 255) { - advance_cutscene_step(m); - } +// if (m->actionState == 0 && is_anim_past_end(m)) { +// m->actionState++; +// } +// if (m->actionTimer == 90) { +// play_cutscene_music(SEQUENCE_ARGS(0, SEQ_EVENT_CUTSCENE_ENDING)); +// } +// if (m->actionTimer == 255) { +// advance_cutscene_step(m); +// } - sEndJumboStarObj->oFaceAngleYaw += 0x0400; - generate_yellow_sparkles(0, 2528, -1800, 250.0f); - play_sound(SOUND_AIR_PEACH_TWINKLE, sEndJumboStarObj->header.gfx.cameraToObject); +// sEndJumboStarObj->oFaceAngleYaw += 0x0400; +// generate_yellow_sparkles(0, 2528, -1800, 250.0f); +// play_sound(SOUND_AIR_PEACH_TWINKLE, sEndJumboStarObj->header.gfx.cameraToObject); } #ifdef VERSION_EU @@ -2362,50 +2362,50 @@ static void end_peach_cutscene_kiss_from_peach(struct MarioState *m) { } static void end_peach_cutscene_star_dance(struct MarioState *m) { - s32 animFrame = set_mario_animation(m, MARIO_ANIM_CREDITS_PEACE_SIGN); - - if (animFrame == 77) { - cutscene_put_cap_on(m); - } - if (animFrame == 88) { - play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); - } - if (animFrame >= 98) { - m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN; - } - - if (m->actionTimer < 52) { - m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED; - } - - switch (m->actionTimer) { - case 70: - D_8032CBE4 = 1; - break; - - case 86: - D_8032CBE4 = 2; - break; - - case 90: - D_8032CBE4 = 3; - break; - - case 120: - D_8032CBE4 = 0; - break; - - case 140: -#ifndef VERSION_JP -// sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); -#endif - play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_CREDITS)); - break; - - case 142: - advance_cutscene_step(m); - break; - } +// s32 animFrame = set_mario_animation(m, MARIO_ANIM_CREDITS_PEACE_SIGN); +// +// if (animFrame == 77) { +// cutscene_put_cap_on(m); +// } +// if (animFrame == 88) { +// play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); +// } +// if (animFrame >= 98) { +// m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN; +// } +// +// if (m->actionTimer < 52) { +// m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED; +// } +// +// switch (m->actionTimer) { +// case 70: +// D_8032CBE4 = 1; +// break; +// +// case 86: +// D_8032CBE4 = 2; +// break; +// +// case 90: +// D_8032CBE4 = 3; +// break; +// +// case 120: +// D_8032CBE4 = 0; +// break; +// +// case 140: +//#ifndef VERSION_JP +//// sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); +//#endif +// play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_CREDITS)); +// break; +// +// case 142: +// advance_cutscene_step(m); +// break; +// } } // dialog 3 diff --git a/src/decomp/game/mario_actions_moving.c b/src/decomp/game/mario_actions_moving.c index 62c9c0e..22d86c4 100644 --- a/src/decomp/game/mario_actions_moving.c +++ b/src/decomp/game/mario_actions_moving.c @@ -92,7 +92,7 @@ void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2) { void align_with_floor(struct MarioState *m) { m->pos[1] = m->floorHeight; mtxf_align_terrain_triangle(g_state->msFloorAlignMatrix, m->pos, m->faceAngle[1], 40.0f); - m->marioObj->header.gfx.throwMatrix = g_state->msFloorAlignMatrix; + m->marioObj->header.gfx.throwMatrix = &g_state->msFloorAlignMatrix; } s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) { diff --git a/src/decomp/game/mario_misc.c b/src/decomp/game/mario_misc.c index aaf4bb0..db63906 100644 --- a/src/decomp/game/mario_misc.c +++ b/src/decomp/game/mario_misc.c @@ -28,10 +28,7 @@ #include "../include/object_fields.h" #include "../include/mario_geo_switch_case_ids.h" - -static Vec3f gVec3fZero = {0,0,0}; static Vec3s gVec3sZero = {0,0,0}; -static Vec3f gVec3fOne = {1,1,1}; #define TOAD_STAR_1_REQUIREMENT 12 #define TOAD_STAR_2_REQUIREMENT 25 @@ -627,7 +624,7 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat // } // break; // } -// return NULL; + return NULL; } /** diff --git a/src/decomp/game/object_stuff.c b/src/decomp/game/object_stuff.c index d7b77dd..f5e1bdc 100644 --- a/src/decomp/game/object_stuff.c +++ b/src/decomp/game/object_stuff.c @@ -59,7 +59,6 @@ static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f }; static Vec3s gVec3sZero = { 0, 0, 0 }; -static Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f }; static struct Object *try_allocate_object(void) { struct ObjectNode *nextObj; diff --git a/src/decomp/game/rendering_graph_node.c b/src/decomp/game/rendering_graph_node.c index 49bf7e9..97bfed4 100644 --- a/src/decomp/game/rendering_graph_node.c +++ b/src/decomp/game/rendering_graph_node.c @@ -153,8 +153,8 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) { struct DisplayListNode *currList; s32 i; s32 enableZBuffer = (node->node.flags & GRAPH_RENDER_Z_BUFFER) != 0; - struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer]; - struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer]; +// struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer]; +// struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer]; // @bug This is where the LookAt values should be calculated but aren't. // As a result, environment mapping is broken on Fast3DEX2 without the @@ -169,12 +169,13 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) { gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER); } - // HACK - // Mario ends up in the second master list for some reason, and the first item in that list is an invalid pointer. + // libsm64 HACK + // Mario ends up in the second master list for some reason. + // The first item in the list is the projection matrix that is uninitialized, so just skip it. int xx = FALSE; for (i = 1; i < GFX_NUM_MASTER_LISTS; i++) { if ((currList = node->listHeads[i]) != NULL) { - gDPSetRenderMode(gDisplayListHead++, modeList->modes[i], mode2List->modes[i]); +// gDPSetRenderMode(gDisplayListHead++, modeList->modes[i], mode2List->modes[i]); while (currList != NULL) { if( !xx ) { xx = TRUE; @@ -245,13 +246,13 @@ static void geo_process_master_list(struct GraphNodeMasterList *node) { static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node) { if (node->node.children != NULL) { Mtx *mtx = alloc_display_list(sizeof(*mtx)); - f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale; - f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale; - f32 top = (gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f * node->scale; - f32 bottom = (gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f * node->scale; +// f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale; +// f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale; +// f32 top = (gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f * node->scale; +// f32 bottom = (gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f * node->scale; - guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f); - gSPPerspNormalize(gDisplayListHead++, 0xFFFF); +// guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f); +// gSPPerspNormalize(gDisplayListHead++, 0xFFFF); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH); geo_process_node_and_siblings(node->node.children); @@ -266,17 +267,17 @@ static void geo_process_perspective(struct GraphNodePerspective *node) { node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]); } if (node->fnNode.node.children != NULL) { - u16 perspNorm; +// u16 perspNorm; Mtx *mtx = alloc_display_list(sizeof(*mtx)); -#ifdef VERSION_EU - f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f; -#else - f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height; -#endif +// #ifdef VERSION_EU +// f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f; +// #else +// f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height; +// #endif - guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f); - gSPPerspNormalize(gDisplayListHead++, perspNorm); +// guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f); +// gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH); diff --git a/src/decomp/include/PR/gbi.h b/src/decomp/include/PR/gbi.h index 7bd7a70..4ff5de7 100644 --- a/src/decomp/include/PR/gbi.h +++ b/src/decomp/include/PR/gbi.h @@ -2901,7 +2901,7 @@ typedef union { #endif #ifndef F3D_OLD -//# define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s)) +# define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s)) # define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s)) #else # define gSPPerspNormalize(pkt, s) \ @@ -3127,11 +3127,9 @@ typedef union { #define gsDPSetDepthSource(src) \ gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) -/* #define gDPSetRenderMode(pkt, c0, c1) \ gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ (c0) | (c1)) -*/ #define gsDPSetRenderMode(c0, c1) \ gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ (c0) | (c1)) diff --git a/src/decomp/include/types.h b/src/decomp/include/types.h index 07e827b..71686b2 100644 --- a/src/decomp/include/types.h +++ b/src/decomp/include/types.h @@ -294,7 +294,7 @@ struct MarioAnimDmaRelatedThing struct MarioAnimation { struct MarioAnimDmaRelatedThing *animDmaTable; - u8 *currentAnimAddr; + u32 currentAnimAddr; // libsm64: type change struct Animation *targetAnim; u8 padding[4]; }; diff --git a/src/decomp/shim.h b/src/decomp/shim.h index 6d116df..c0df3ab 100644 --- a/src/decomp/shim.h +++ b/src/decomp/shim.h @@ -15,34 +15,6 @@ #define LEVEL_CASTLE 95 #define LEVEL_THI 94 -#define play_sound(a,b) {} -#define enable_time_stop() {} -#define disable_time_stop() {} -#define play_cutscene_music(a) {} -#define segmented_to_virtual(addr) ((void*)(addr)) -#define virtual_to_segmented(seg,addr) ((void*)(addr)) -#define func_80320A4C(bankIndex, arg1) {} -#define raise_background_noise(a) {} -#define lower_background_noise(a) {} -#define set_camera_mode(c, mode, frames) {} -#define print_text_fmt_int(x, y, str, n) {} -#define level_trigger_warp(m, warpOp) 0 -#define play_cap_music(seqArgs) {} -#define fadeout_cap_music() {} -#define stop_cap_music() {} -#define play_infinite_stairs_music() {} -#define spawn_wind_particles(pitch, yaw) {} -#define set_camera_shake_from_hit(shake) {} -#define load_level_init_text(arg) {} -#define spawn_default_star(sp20, sp24, sp28) {} -#define play_shell_music() {} -#define stop_shell_music() {} -#define level_control_timer(timerOp) 0 -#define save_file_get_flags() 0 -#define save_file_set_flags(flags) {} -#define save_file_clear_flags(flags) {} -#define save_file_get_total_star_count(fileIndex, minCourse, maxCourse) 0 - #define gGlobalTimer (g_state->mgGlobalTimer) #define gSpecialTripleJump (g_state->mgSpecialTripleJump) #define gCurrLevelNum (g_state->mgCurrLevelNum) @@ -59,4 +31,36 @@ #define gMarioObject (g_state->mgMarioObject) #define D_80339D10 (g_state->mD_80339D10) #define gMarioState (&g_state->mgMarioStateVal) -#define gAreaUpdateCounter (g_state->mgAreaUpdateCounter) \ No newline at end of file +#define gAreaUpdateCounter (g_state->mgAreaUpdateCounter) + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + +static void play_sound(s32 soundBits, f32 *pos) {} +static void enable_time_stop() {} +static void disable_time_stop() {} +static void *segmented_to_virtual(const void *addr) { return (void*)addr; } +static void *virtual_to_segmented(u32 segment, const void *addr) { return (void*)addr; } +static void func_80320A4C(u8 bankIndex, u8 arg1) {} +static void raise_background_noise(s32 a) {} +static void lower_background_noise(s32 a) {} +static void set_camera_mode(struct Camera *c, s16 mode, s16 frames) {} +static void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n) {} +static s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { return 0; } +static void play_cap_music(u16 seqArgs) {} +static void fadeout_cap_music(void) {} +static void stop_cap_music(void) {} +static void play_infinite_stairs_music(void) {} +static s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse) { return 0; } +static u32 save_file_get_flags(void) { return 0; } +static void save_file_set_flags(u32 flags) {} +static void save_file_clear_flags(u32 flags) {} +static void spawn_wind_particles(s16 pitch, s16 yaw) {} +static void set_camera_shake_from_hit(s16 shake) {} +static void load_level_init_text(u32 arg) {} +static void spawn_default_star(f32 sp20, f32 sp24, f32 sp28) {} +static void play_shell_music(void) {} +static void stop_shell_music(void) {} +static u16 level_control_timer(s32 timerOp) { return 0; } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/src/gfx_adapter.c b/src/gfx_adapter.c index 54d562a..9265b0e 100644 --- a/src/gfx_adapter.c +++ b/src/gfx_adapter.c @@ -171,8 +171,8 @@ static void process_display_list( void *dl ) { int64_t uls = *ptr++; int64_t ult = *ptr++; - int64_t lrs = *ptr++; - int64_t lrt = *ptr++; + ptr++; // lrs + ptr++; // lrt s_uls = (uint16_t)uls; s_ult = (uint16_t)ult; diff --git a/src/gfx_adapter.h b/src/gfx_adapter.h index 4b97be3..5d1ef49 100644 --- a/src/gfx_adapter.h +++ b/src/gfx_adapter.h @@ -6,16 +6,10 @@ // Commented out in gbi.h - Replaced here #define gDPPipeSync(pkt) ({}) #define gSPSetGeometryMode(pkt, word) ({}) -#define gDPSetRenderMode(pkt, c0, c1) ({}) #define gSPClearGeometryMode(pkt, word) ({}) -#define gSPPerspNormalize(pkt, s) ({}) #define gDPFillRectangle(pkt, ulx, uly, lrx, lry) ({}) #define gSPViewport(pkt, v) ({}) extern void gSPMatrix( void *pkt, Mtx *m, uint8_t flags ); extern void gSPDisplayList( void *pkt, struct DisplayListNode *dl ); -// from lib/src/gu*.c -#define guOrtho(mtx, left, right, bottom, top, a, b, c) ({}) -#define guPerspective(mtx, perspNorm, fov, aspect, near, far, a) ({}) - extern void gfx_adapter_bind_output_buffers( struct SM64MarioGeometryBuffers *outBuffers ); \ No newline at end of file diff --git a/src/libsm64.c b/src/libsm64.c index dd1f199..5ebd593 100644 --- a/src/libsm64.c +++ b/src/libsm64.c @@ -1,4 +1,7 @@ -#define SM64_LIB_EXPORT +#ifndef SM64_LIB_EXPORT + #define SM64_LIB_EXPORT +#endif + #include "libsm64.h" #include diff --git a/src/load_anim_data.c b/src/load_anim_data.c index 3c652d6..7b6b352 100644 --- a/src/load_anim_data.c +++ b/src/load_anim_data.c @@ -31,8 +31,8 @@ static uint32_t read_u32_be( uint8_t *p ) void load_mario_anims_from_rom( uint8_t *rom ) { - #define GET_OFFSET( n ) (read_u32_be(&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->offset)) - #define GET_SIZE( n ) (read_u32_be(&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->size )) + #define GET_OFFSET( n ) (read_u32_be((uint8_t*)&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->offset)) + #define GET_SIZE( n ) (read_u32_be((uint8_t*)&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->size )) uint8_t *read_ptr = rom + ANIM_DATA_ADDRESS; s_num_entries = read_u32_be( read_ptr ); @@ -82,8 +82,8 @@ void load_mario_anims_from_rom( uint8_t *rom ) void load_mario_animation(struct MarioAnimation *a, u32 index) { - if ((u32)a->currentAnimAddr != 1 + index) { - a->currentAnimAddr = (u8*)(1 + index); + if (a->currentAnimAddr != 1 + index) { + a->currentAnimAddr = 1 + index; a->targetAnim = &s_libsm64_mario_animations[index]; } } diff --git a/src/load_surfaces.c b/src/load_surfaces.c index ab8ad25..7e9f87a 100644 --- a/src/load_surfaces.c +++ b/src/load_surfaces.c @@ -2,6 +2,7 @@ #include #include +#include #include "decomp/include/types.h" #include "decomp/include/surface_terrains.h" @@ -88,7 +89,7 @@ static s32 surface_has_force(s16 surfaceType) { return hasForce; } -static void engine_surface_from_lib_surface( struct Surface *surface, const struct SM64Surface *libSurf, const struct SurfaceObjectTransform *transform ) +static void engine_surface_from_lib_surface( struct Surface *surface, const struct SM64Surface *libSurf, struct SurfaceObjectTransform *transform ) { int16_t type = libSurf->type; int16_t force = libSurf->force; diff --git a/src/load_tex_data.c b/src/load_tex_data.c index 37f8c95..2ebe875 100644 --- a/src/load_tex_data.c +++ b/src/load_tex_data.c @@ -1,6 +1,7 @@ #include "load_tex_data.h" #include +#include #include #include "libsm64.h" @@ -34,7 +35,7 @@ void load_mario_textures_from_rom( uint8_t *rom, uint8_t *outTexture ) mio0_decode_header( in_buf, &head ); uint8_t *out_buf = malloc( head.dest_size ); - int bytes_read = mio0_decode( in_buf, out_buf, NULL ); + mio0_decode( in_buf, out_buf, NULL ); for( int i = 0; i < NUM_USED_TEXTURES; ++i ) {