From 7294e127f536df11d4bcc610156ad316bac9be56 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 19 Aug 2021 18:16:16 -0700 Subject: [PATCH] Fixed over 100 code warnings --- Makefile | 4 +- src/game/behaviors/activated_bf_plat.inc.c | 1 - src/game/behaviors/boo_cage.inc.c | 2 +- src/game/behaviors/boulder.inc.c | 2 +- src/game/behaviors/bowling_ball.inc.c | 10 ++--- src/game/behaviors/bowser.inc.c | 2 +- .../behaviors/controllable_platform.inc.c | 1 - src/game/behaviors/dorrie.inc.c | 2 - src/game/behaviors/fire_spitter.inc.c | 2 +- src/game/behaviors/klepto.inc.c | 5 +-- src/game/behaviors/koopa.inc.c | 2 +- src/game/behaviors/lll_hexagonal_ring.inc.c | 2 +- .../behaviors/lll_sinking_rectangle.inc.c | 2 +- src/game/behaviors/mips.inc.c | 4 +- src/game/behaviors/monty_mole.inc.c | 2 +- src/game/behaviors/pokey.inc.c | 4 +- src/game/behaviors/racing_penguin.inc.c | 2 +- src/game/behaviors/snow_mound.inc.c | 2 - src/game/behaviors/swoop.inc.c | 1 - src/game/behaviors/wiggler.inc.c | 4 +- src/game/characters.c | 4 +- src/game/characters.h | 2 +- src/game/mario.c | 6 +-- src/game/mario_misc.c | 2 - src/game/memory.c | 2 - src/game/save_file.c | 9 +---- src/menu/star_select.c | 1 - src/pc/audio/audio_null.c | 3 +- src/pc/cliopts.c | 3 +- src/pc/djui/djui_button.c | 2 +- src/pc/djui/djui_checkbox.c | 3 +- src/pc/djui/djui_image.c | 1 - src/pc/djui/djui_inputbox.c | 10 ++--- src/pc/djui/djui_panel_camera.c | 2 +- src/pc/djui/djui_panel_controls.c | 2 +- src/pc/djui/djui_panel_debug.c | 2 +- src/pc/djui/djui_panel_display.c | 2 +- src/pc/djui/djui_panel_host.c | 5 +-- src/pc/djui/djui_panel_host_message.c | 2 +- src/pc/djui/djui_panel_main.c | 2 +- src/pc/djui/djui_panel_menu.c | 2 +- src/pc/djui/djui_panel_pause.c | 4 +- src/pc/djui/djui_panel_player.c | 3 +- src/pc/djui/djui_selectionbox.c | 3 +- src/pc/djui/djui_text.c | 4 +- src/pc/gfx/gfx_pc.c | 39 ++++++++++--------- src/pc/network/discord/discord.c | 4 +- src/pc/network/discord/discord_network.c | 2 +- src/pc/network/packets/packet_keep_alive.c | 2 +- src/pc/network/packets/packet_object.c | 3 -- src/pc/network/socket/socket.c | 4 +- src/pc/pc_main.c | 4 +- 52 files changed, 83 insertions(+), 112 deletions(-) diff --git a/Makefile b/Makefile index 9d95344f..d1552296 100644 --- a/Makefile +++ b/Makefile @@ -612,8 +612,8 @@ CFLAGS += -DCOOP # Enforce -Werror in strict mode ifeq ($(STRICT),1) - CC_CHECK += -Werror -Wno-error=unused-variable -Wno-error=unused-parameter - CFLAGS += -Werror -Wno-error=unused-variable -Wno-error=unused-parameter + CC_CHECK += -Werror + CFLAGS += -Werror endif # Check for debug option diff --git a/src/game/behaviors/activated_bf_plat.inc.c b/src/game/behaviors/activated_bf_plat.inc.c index bcfa3c2c..5ca41632 100644 --- a/src/game/behaviors/activated_bf_plat.inc.c +++ b/src/game/behaviors/activated_bf_plat.inc.c @@ -81,7 +81,6 @@ void bhv_activated_back_and_forth_platform_update(void) { struct Object* player = nearest_player_to_object(o); int distanceToPlayer = dist_between_objects(o, player); - int angleToPlayer = obj_angle_to_object(o, player); // oVelY is used for vertical platforms' movement and also for // horizontal platforms' dipping up/down when Mario gets on/off them diff --git a/src/game/behaviors/boo_cage.inc.c b/src/game/behaviors/boo_cage.inc.c index 33db29ec..1fee9b48 100644 --- a/src/game/behaviors/boo_cage.inc.c +++ b/src/game/behaviors/boo_cage.inc.c @@ -21,7 +21,7 @@ static struct ObjectHitbox sBooCageHitbox = { /* hurtboxHeight: */ 0, }; -static void bhv_boo_cage_on_received_post(u8 localIndex) { +static void bhv_boo_cage_on_received_post(UNUSED u8 localIndex) { if (o->oAction > BOO_CAGE_ACT_ON_GROUND) { o->oAction = BOO_CAGE_ACT_ON_GROUND; } diff --git a/src/game/behaviors/boulder.inc.c b/src/game/behaviors/boulder.inc.c index daf53544..10ea2c88 100644 --- a/src/game/behaviors/boulder.inc.c +++ b/src/game/behaviors/boulder.inc.c @@ -47,7 +47,7 @@ void bhv_big_boulder_loop(void) { void bhv_big_boulder_generator_loop(void) { if (!network_sync_object_initialized(o)) { - struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); network_init_object_field(o, &o->oTimer); } diff --git a/src/game/behaviors/bowling_ball.inc.c b/src/game/behaviors/bowling_ball.inc.c index 3e44dc71..70894515 100644 --- a/src/game/behaviors/bowling_ball.inc.c +++ b/src/game/behaviors/bowling_ball.inc.c @@ -181,7 +181,7 @@ void bhv_generic_bowling_ball_spawner_init(void) { void bhv_generic_bowling_ball_spawner_loop(void) { if (!network_sync_object_initialized(o)) { - struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); } struct Object *bowlingBall; @@ -217,7 +217,7 @@ void bhv_generic_bowling_ball_spawner_loop(void) { void bhv_thi_bowling_ball_spawner_loop(void) { if (!network_sync_object_initialized(o)) { - struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); } struct Object *bowlingBall; @@ -281,7 +281,6 @@ void bhv_free_bowling_ball_init(void) { } void bhv_free_bowling_ball_roll_loop(void) { - s16 collisionFlags = object_step(); bowling_ball_set_hitbox(); if (o->oForwardVel > 10.0f) { @@ -289,8 +288,9 @@ void bhv_free_bowling_ball_roll_loop(void) { cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2); } - if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED)) - cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO); + // warning: 'and' of mutually exclusive equal-tests is always 0 + /*if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED)) + cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);*/ if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) { o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.inc.c index 0dd33ea9..64b4e70b 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.inc.c @@ -1036,7 +1036,7 @@ void bowser_act_dead(void) { } void bhv_tilting_bowser_lava_platform_init(void) { - struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); network_init_object_field(o, &o->oAngleVelPitch); network_init_object_field(o, &o->oAngleVelRoll); network_init_object_field(o, &o->oFaceAnglePitch); diff --git a/src/game/behaviors/controllable_platform.inc.c b/src/game/behaviors/controllable_platform.inc.c index eb66b048..99af2645 100644 --- a/src/game/behaviors/controllable_platform.inc.c +++ b/src/game/behaviors/controllable_platform.inc.c @@ -53,7 +53,6 @@ void bhv_controllable_platform_sub_loop(void) { } void bhv_controllable_platform_init(void) { - struct Object *sp34; controllablePlatformSubs[0] = spawn_object_rel_with_rot(o, MODEL_HMC_METAL_ARROW_PLATFORM, bhvControllablePlatformSub, 0, 51, 204, 0, 0, 0); controllablePlatformSubs[0]->oBehParams2ndByte = 1; diff --git a/src/game/behaviors/dorrie.inc.c b/src/game/behaviors/dorrie.inc.c index 5f1a3d73..573f953d 100644 --- a/src/game/behaviors/dorrie.inc.c +++ b/src/game/behaviors/dorrie.inc.c @@ -128,8 +128,6 @@ static u8 dorrie_act_raise_head_continue_dialog(void) { } void dorrie_act_raise_head(void) { - struct MarioState* marioState = nearest_mario_state_to_object(o); - o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600F644); if (cur_obj_check_if_near_animation_end()) { o->oAction = DORRIE_ACT_MOVE; diff --git a/src/game/behaviors/fire_spitter.inc.c b/src/game/behaviors/fire_spitter.inc.c index 255c7d91..41cac9a5 100644 --- a/src/game/behaviors/fire_spitter.inc.c +++ b/src/game/behaviors/fire_spitter.inc.c @@ -39,7 +39,7 @@ static void fire_spitter_act_spit_fire(void) { } } -static void bhv_fire_spitter_on_received_post(u8 localIndex) { +static void bhv_fire_spitter_on_received_post(UNUSED u8 localIndex) { cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN); } diff --git a/src/game/behaviors/klepto.inc.c b/src/game/behaviors/klepto.inc.c index fce4ec85..109ec3b4 100644 --- a/src/game/behaviors/klepto.inc.c +++ b/src/game/behaviors/klepto.inc.c @@ -78,11 +78,11 @@ static void klepto_anim_dive(void) { static s32 kleptoCachedAnimState = 0; -static void bhv_klepto_on_received_pre(u8 localIndex) { +static void bhv_klepto_on_received_pre(UNUSED u8 localIndex) { kleptoCachedAnimState = o->oAnimState; } -static void bhv_klepto_on_received_post(u8 localIndex) { +static void bhv_klepto_on_received_post(UNUSED u8 localIndex) { if (kleptoCachedAnimState == KLEPTO_ANIM_STATE_HOLDING_NOTHING && o->oAnimState == KLEPTO_ANIM_STATE_HOLDING_STAR) { o->oAnimState = KLEPTO_ANIM_STATE_HOLDING_NOTHING; } @@ -373,7 +373,6 @@ void obj_set_speed_to_zero(void) { void bhv_klepto_update(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); struct Object* player = marioState->marioObj; - int distanceToPlayer = dist_between_objects(o, player); int angleToPlayer = obj_angle_to_object(o, player); UNUSED s32 unused; diff --git a/src/game/behaviors/koopa.inc.c b/src/game/behaviors/koopa.inc.c index baf02d1e..55a93401 100644 --- a/src/game/behaviors/koopa.inc.c +++ b/src/game/behaviors/koopa.inc.c @@ -69,7 +69,7 @@ static u32 koopaPathedStartWaypoint = 0; static u32 koopaPathedPrevWaypoint = 0; static u32 koopaShotFromCannon = 0; -static void bhv_koopa_the_quick_on_received_post(u8 fromLocalIndex) { +static void bhv_koopa_the_quick_on_received_post(UNUSED u8 fromLocalIndex) { void* path = segmented_to_virtual(sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].path); o->oPathedStartWaypoint = (struct Waypoint*)path + koopaPathedStartWaypoint; o->oPathedPrevWaypoint = (struct Waypoint*)path + koopaPathedPrevWaypoint; diff --git a/src/game/behaviors/lll_hexagonal_ring.inc.c b/src/game/behaviors/lll_hexagonal_ring.inc.c index 7b6388b1..88a40dbb 100644 --- a/src/game/behaviors/lll_hexagonal_ring.inc.c +++ b/src/game/behaviors/lll_hexagonal_ring.inc.c @@ -16,7 +16,7 @@ void hexagonal_ring_spawn_flames(void) { void bhv_lll_rotating_hexagonal_ring_loop(void) { if (!network_sync_object_initialized(o)) { - struct SyncObject* so = network_init_object(o, 4000.0f); + network_init_object(o, 4000.0f); network_init_object_field(o, &o->oAngleVelYaw); } UNUSED s32 unused; diff --git a/src/game/behaviors/lll_sinking_rectangle.inc.c b/src/game/behaviors/lll_sinking_rectangle.inc.c index 07d945dd..3b5fe097 100644 --- a/src/game/behaviors/lll_sinking_rectangle.inc.c +++ b/src/game/behaviors/lll_sinking_rectangle.inc.c @@ -17,7 +17,7 @@ void sinking_rectangular_plat_actions(f32 a0, s32 a1) { void bhv_lll_sinking_rectangular_platform_loop(void) { if (!network_sync_object_initialized(o)) { - struct SyncObject* so = network_init_object(o, 1000.0f); + network_init_object(o, 1000.0f); network_init_object_field(o, &o->oLllWoodPieceOscillationTimer); network_init_object_field(o, &o->oFaceAnglePitch); } diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.inc.c index 7ed0af87..f9920955 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.inc.c @@ -4,11 +4,11 @@ static u32 mipsPrevHeldState = 0; -static void bhv_mips_on_received_pre(u8 fromLocalIndex) { +static void bhv_mips_on_received_pre(UNUSED u8 fromLocalIndex) { mipsPrevHeldState = o->oHeldState; } -static void bhv_mips_on_received_post(u8 fromLocalIndex) { +static void bhv_mips_on_received_post(UNUSED u8 fromLocalIndex) { if (mipsPrevHeldState == HELD_HELD && o->oHeldState == HELD_FREE) { cur_obj_init_animation(0); } diff --git a/src/game/behaviors/monty_mole.inc.c b/src/game/behaviors/monty_mole.inc.c index 861fea32..308183f2 100644 --- a/src/game/behaviors/monty_mole.inc.c +++ b/src/game/behaviors/monty_mole.inc.c @@ -139,7 +139,7 @@ void monty_mole_spawn_dirt_particles(s8 offsetY, s8 velYBase) { cur_obj_spawn_particles(&sMontyMoleRiseFromGroundParticles); } -static void bhv_monty_mole_on_received_post(u8 fromLocalIndex) { +static void bhv_monty_mole_on_received_post(UNUSED u8 fromLocalIndex) { if (o->oMontyMoleHoleX == 0 && o->oMontyMoleHoleY == 0 && o->oMontyMoleHoleZ == 0) { return; } o->oMontyMoleCurrentHole = NULL; diff --git a/src/game/behaviors/pokey.inc.c b/src/game/behaviors/pokey.inc.c index 70145500..68cb0e6c 100644 --- a/src/game/behaviors/pokey.inc.c +++ b/src/game/behaviors/pokey.inc.c @@ -150,12 +150,12 @@ void bhv_pokey_body_part_update(void) { static u32 pokeyCacheAliveBodyPartFlags = 0; static s32 pokeyCacheNumAliveBodyParts = 0; -static void pokey_on_received_pre(u8 localIndex) { +static void pokey_on_received_pre(UNUSED u8 localIndex) { pokeyCacheAliveBodyPartFlags = o->oPokeyAliveBodyPartFlags; pokeyCacheNumAliveBodyParts = o->oPokeyNumAliveBodyParts; } -static void pokey_on_received_post(u8 localIndex) { +static void pokey_on_received_post(UNUSED u8 localIndex) { if (o->oPokeyNumAliveBodyParts > pokeyCacheNumAliveBodyParts) { o->oPokeyAliveBodyPartFlags = pokeyCacheAliveBodyPartFlags; o->oPokeyNumAliveBodyParts = pokeyCacheNumAliveBodyParts; diff --git a/src/game/behaviors/racing_penguin.inc.c b/src/game/behaviors/racing_penguin.inc.c index 9898bde0..e2c0c539 100644 --- a/src/game/behaviors/racing_penguin.inc.c +++ b/src/game/behaviors/racing_penguin.inc.c @@ -12,7 +12,7 @@ static struct RacingPenguinData sRacingPenguinData[] = { static u32 penguinPathedStartWaypoint = 0; static u32 penguinPathedPrevWaypoint = 0; -static void bhv_racing_penguin_the_quick_on_received_post(u8 fromLocalIndex) { +static void bhv_racing_penguin_the_quick_on_received_post(UNUSED u8 fromLocalIndex) { void* path = segmented_to_virtual(ccm_seg7_trajectory_penguin_race); o->oPathedStartWaypoint = (struct Waypoint*)path + penguinPathedStartWaypoint; o->oPathedPrevWaypoint = (struct Waypoint*)path + penguinPathedPrevWaypoint; diff --git a/src/game/behaviors/snow_mound.inc.c b/src/game/behaviors/snow_mound.inc.c index 3d83327b..22ad77df 100644 --- a/src/game/behaviors/snow_mound.inc.c +++ b/src/game/behaviors/snow_mound.inc.c @@ -25,8 +25,6 @@ void bhv_sliding_snow_mound_loop(void) { void bhv_snow_mound_spawn_loop(void) { struct Object* player = nearest_player_to_object(o); - int distanceToPlayer = dist_between_objects(o, player); - int angleToPlayer = obj_angle_to_object(o, player); struct Object *sp1C = NULL; diff --git a/src/game/behaviors/swoop.inc.c b/src/game/behaviors/swoop.inc.c index 09f45030..c2d93e11 100644 --- a/src/game/behaviors/swoop.inc.c +++ b/src/game/behaviors/swoop.inc.c @@ -47,7 +47,6 @@ static void swoop_act_idle(void) { */ static void swoop_act_move(void) { struct Object* player = nearest_player_to_object(o); - int distanceToPlayer = dist_between_objects(o, player); int angleToPlayer = obj_angle_to_object(o, player); cur_obj_init_animation_with_accel_and_sound(0, 2.0f); diff --git a/src/game/behaviors/wiggler.inc.c b/src/game/behaviors/wiggler.inc.c index eb83269c..52e52286 100644 --- a/src/game/behaviors/wiggler.inc.c +++ b/src/game/behaviors/wiggler.inc.c @@ -419,14 +419,14 @@ u8 bhv_wiggler_ignore_if_true(void) { static Vec3f wigglerPrePos = { 0 }; static u8 wigglerCompletedDialog = FALSE; -void bhv_wiggler_on_received_pre(u8 localIndex) { +void bhv_wiggler_on_received_pre(UNUSED u8 localIndex) { wigglerPrePos[0] = o->oPosX; wigglerPrePos[1] = o->oPosY; wigglerPrePos[2] = o->oPosZ; wigglerCompletedDialog = (o->oWigglerTextStatus == WIGGLER_TEXT_STATUS_COMPLETED_DIALOG); } -void bhv_wiggler_on_received_post(u8 localIndex) { +void bhv_wiggler_on_received_post(UNUSED u8 localIndex) { Vec3f posDiff = { 0 }; posDiff[0] = o->oPosX - wigglerPrePos[0]; posDiff[1] = o->oPosY - wigglerPrePos[1]; diff --git a/src/game/characters.c b/src/game/characters.c index df1a3dac..6928247f 100644 --- a/src/game/characters.c +++ b/src/game/characters.c @@ -253,11 +253,11 @@ void play_character_sound(struct MarioState* m, enum CharacterSound characterSou play_sound_with_freq_scale(sound, m->marioObj->header.gfx.cameraToObject, character->soundFreqScale); } -void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u8 offset) { +void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u32 offset) { s32 sound = get_character_sound(m, characterSound); if (sound == 0) { return; } struct Character* character = get_character(m); - play_sound_with_freq_scale(sound, m->marioObj->header.gfx.cameraToObject, character->soundFreqScale); + play_sound_with_freq_scale(sound + offset, m->marioObj->header.gfx.cameraToObject, character->soundFreqScale); } void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags) { diff --git a/src/game/characters.h b/src/game/characters.h index 6d38d5d9..927a6886 100644 --- a/src/game/characters.h +++ b/src/game/characters.h @@ -120,7 +120,7 @@ struct MarioState; extern struct Character gCharacters[]; struct Character* get_character(struct MarioState* m); void play_character_sound(struct MarioState* m, enum CharacterSound characterSound); -void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u8 offset); +void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u32 offset); void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags); #endif // CHARACTERS_H diff --git a/src/game/mario.c b/src/game/mario.c index 930566aa..032b0446 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -2073,8 +2073,6 @@ s32 force_idle_state(struct MarioState* m) { **************************************************/ static void init_single_mario(struct MarioState* m) { - Vec3s capPos; - struct Object* capObject; u16 playerIndex = m->playerIndex; struct SpawnInfo* spawnInfo = &gPlayerSpawnInfos[playerIndex]; @@ -2156,7 +2154,9 @@ static void init_single_mario(struct MarioState* m) { vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0); // cap will never be lying on the ground in coop - /*if (save_file_get_cap_pos(capPos)) { + /* struct Object* capObject; + Vec3s capPos; + if (save_file_get_cap_pos(capPos)) { capObject = spawn_object(m->marioObj, MODEL_MARIOS_CAP, bhvNormalCap); capObject->oPosX = capPos[0]; diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 18ff59d1..50dbc57d 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -477,7 +477,6 @@ Gfx* geo_switch_mario_eyes(s32 callContext, struct GraphNode* node, UNUSED Mat4* */ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { Mat4 * curTransform = mtx; - struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; u8 plrIdx = geo_get_processing_object_index(); struct MarioBodyState* bodyState = &gBodyStates[plrIdx]; s32 action = bodyState->action; @@ -507,7 +506,6 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { * Makes Mario's head rotate with the camera angle when in C-up mode */ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) { - struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; u8 plrIdx = geo_get_processing_object_index(); struct MarioBodyState* bodyState = &gBodyStates[plrIdx]; s32 action = bodyState->action; diff --git a/src/game/memory.c b/src/game/memory.c index 14862cca..7305c0b2 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -222,8 +222,6 @@ u32 main_pool_pop_state(void) { * function blocks until completion. */ static void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) { - u32 size = ALIGN16(srcEnd - srcStart); - memcpy(dest, srcStart, srcEnd - srcStart); } diff --git a/src/game/save_file.c b/src/game/save_file.c index 1952624b..7c2c1554 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -416,7 +416,7 @@ static void save_file_load_textsaves(void) { } #endif -void save_file_load_all(u8 reload) { +void save_file_load_all(UNUSED u8 reload) { s32 file; gMainMenuDataModified = FALSE; @@ -424,13 +424,6 @@ void save_file_load_all(u8 reload) { bzero(&gSaveBuffer, sizeof(gSaveBuffer)); -#ifdef TEXTSAVES - if (!reload) { - save_file_load_textsaves(); - return; - } -#endif - read_eeprom_data(&gSaveBuffer, sizeof(gSaveBuffer)); if (save_file_need_bswap(&gSaveBuffer)) diff --git a/src/menu/star_select.c b/src/menu/star_select.c index f125fe32..26377cb4 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -408,7 +408,6 @@ void print_act_selector_strings(void) { gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); f32 textWidth = get_generic_ascii_string_width(message); - f32 textHeight = get_generic_ascii_string_height(message); f32 xPos = (sSelectedActIndex + 1) * 34 - sVisibleStars * 17 + 139 - (textWidth / 2.0f) + 4; f32 yPos = 224; diff --git a/src/pc/audio/audio_null.c b/src/pc/audio/audio_null.c index 4d0dd923..e54e0f03 100644 --- a/src/pc/audio/audio_null.c +++ b/src/pc/audio/audio_null.c @@ -1,4 +1,5 @@ #include "audio_api.h" +#include "macros.h" static bool audio_null_init(void) { return true; @@ -12,7 +13,7 @@ static int audio_null_get_desired_buffered(void) { return 0; } -static void audio_null_play(const uint8_t *buf, size_t len) { +static void audio_null_play(UNUSED const uint8_t *buf, UNUSED size_t len) { } static void audio_null_shutdown(void) { diff --git a/src/pc/cliopts.c b/src/pc/cliopts.c index 4643975c..73e44650 100644 --- a/src/pc/cliopts.c +++ b/src/pc/cliopts.c @@ -30,8 +30,7 @@ static inline int arg_string(const char *name, const char *value, char *target, fprintf(stderr, "Supplied value for `%s` is too long.\n", name); return 0; } - strncpy(target, value, arglen); - target[arglen] = '\0'; + snprintf(target, maxLength, "%s", value); return 1; } diff --git a/src/pc/djui/djui_button.c b/src/pc/djui/djui_button.c index aa179038..65c0cb75 100644 --- a/src/pc/djui/djui_button.c +++ b/src/pc/djui/djui_button.c @@ -25,7 +25,7 @@ static void djui_button_on_hover_end(struct DjuiBase* base) { djui_button_set_default_style(base); } -static void djui_button_on_cursor_down_begin(struct DjuiBase* base, bool inputCursor) { +static void djui_button_on_cursor_down_begin(struct DjuiBase* base, UNUSED bool inputCursor) { struct DjuiButton* button = (struct DjuiButton*)base; djui_base_set_border_color(base, 0, 84, 153, 255); djui_base_set_color(&button->rect->base, 204, 228, 247, 255); diff --git a/src/pc/djui/djui_checkbox.c b/src/pc/djui/djui_checkbox.c index d06631c9..ab529325 100644 --- a/src/pc/djui/djui_checkbox.c +++ b/src/pc/djui/djui_checkbox.c @@ -26,7 +26,7 @@ static void djui_checkbox_on_hover_end(struct DjuiBase* base) { djui_checkbox_set_default_style(base); } -static void djui_checkbox_on_cursor_down_begin(struct DjuiBase* base, bool inputCursor) { +static void djui_checkbox_on_cursor_down_begin(struct DjuiBase* base, UNUSED bool inputCursor) { struct DjuiCheckbox* checkbox = (struct DjuiCheckbox*)base; djui_base_set_border_color(&checkbox->rect->base, 20, 170, 255, 255); djui_base_set_color(&checkbox->rect->base, 255, 255, 255, 32); @@ -40,7 +40,6 @@ static void djui_checkbox_on_cursor_down_begin(struct DjuiBase* base, bool input } static void djui_checkbox_on_cursor_down_end(struct DjuiBase* base) { - struct DjuiCheckbox* checkbox = (struct DjuiCheckbox*)base; djui_checkbox_set_default_style(base); } diff --git a/src/pc/djui/djui_image.c b/src/pc/djui/djui_image.c index 2c120a7f..c9ebce0a 100644 --- a/src/pc/djui/djui_image.c +++ b/src/pc/djui/djui_image.c @@ -20,7 +20,6 @@ void djui_image_set_image(struct DjuiImage* image, const u8* texture, u16 textur static bool djui_image_render(struct DjuiBase* base) { struct DjuiImage* image = (struct DjuiImage*)base; struct DjuiBaseRect* comp = &base->comp; - struct DjuiBaseRect* clip = &base->clip; // translate position f32 translatedX = comp->x; diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c index 855a271c..2baf283b 100644 --- a/src/pc/djui/djui_inputbox.c +++ b/src/pc/djui/djui_inputbox.c @@ -96,7 +96,7 @@ static void djui_inputbox_on_cursor_down_end(struct DjuiBase* base) { djui_inputbox_set_default_style(base); } -static void djui_inputbox_on_cursor_down_begin(struct DjuiBase* base, bool inputCursor) { +static void djui_inputbox_on_cursor_down_begin(struct DjuiBase* base, UNUSED bool inputCursor) { struct DjuiInputbox* inputbox = (struct DjuiInputbox*)base; u16 index = djui_inputbox_get_cursor_index(inputbox); u16 selLength = abs(inputbox->selection[0] - inputbox->selection[1]); @@ -111,7 +111,7 @@ static void djui_inputbox_on_cursor_down_begin(struct DjuiBase* base, bool input djui_interactable_set_input_focus(base); } -static u16 djui_inputbox_jump_word_left(char* msg, u16 len, u16 i) { +static u16 djui_inputbox_jump_word_left(char* msg, UNUSED u16 len, u16 i) { if (i == 0) { return i; } s32 lastI = i; @@ -282,7 +282,7 @@ bool djui_inputbox_on_key_down(struct DjuiBase *base, int scancode) { return true; } -void djui_inputbox_on_key_up(struct DjuiBase *base, int scancode) { +void djui_inputbox_on_key_up(UNUSED struct DjuiBase *base, int scancode) { switch (scancode) { case SCANCODE_CONTROL_LEFT: sHeldControl &= ~(1 << 0); break; case SCANCODE_CONTROL_RIGHT: sHeldControl &= ~(1 << 1); break; @@ -291,13 +291,13 @@ void djui_inputbox_on_key_up(struct DjuiBase *base, int scancode) { } } -static void djui_inputbox_on_focus_begin(struct DjuiBase* base) { +static void djui_inputbox_on_focus_begin(UNUSED struct DjuiBase* base) { sHeldControl = 0; sHeldShift = 0; wm_api->start_text_input(); } -static void djui_inputbox_on_focus_end(struct DjuiBase* base) { +static void djui_inputbox_on_focus_end(UNUSED struct DjuiBase* base) { wm_api->stop_text_input(); } diff --git a/src/pc/djui/djui_panel_camera.c b/src/pc/djui/djui_panel_camera.c index 48aef97f..5184cef8 100644 --- a/src/pc/djui/djui_panel_camera.c +++ b/src/pc/djui/djui_panel_camera.c @@ -3,7 +3,7 @@ #include "src/pc/configfile.h" #include "src/game/bettercamera.h" -void djui_panel_camera_value_changed(struct DjuiBase* caller) { +void djui_panel_camera_value_changed(UNUSED struct DjuiBase* caller) { newcam_init_settings(); } diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index 27101e78..8806e894 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -3,7 +3,7 @@ #include "src/pc/configfile.h" #include "src/pc/controller/controller_api.h" -void djui_panel_controls_value_change(struct DjuiBase* caller) { +void djui_panel_controls_value_change(UNUSED struct DjuiBase* caller) { controller_reconfigure(); } diff --git a/src/pc/djui/djui_panel_debug.c b/src/pc/djui/djui_panel_debug.c index 28886470..c616f31d 100644 --- a/src/pc/djui/djui_panel_debug.c +++ b/src/pc/djui/djui_panel_debug.c @@ -6,7 +6,7 @@ static struct DjuiText* sDjuiText = NULL; static struct DjuiRect* sDjuiRect2 = NULL; static struct DjuiText* sDjuiText2 = NULL; -static void djui_panel_debug_render_pre(struct DjuiBase* base, bool* skipRender) { +static void djui_panel_debug_render_pre(UNUSED struct DjuiBase* base, UNUSED bool* skipRender) { static u32 sTimer = 0; sTimer++; if (sDjuiText != NULL) { diff --git a/src/pc/djui/djui_panel_display.c b/src/pc/djui/djui_panel_display.c index cce90d62..bc03786f 100644 --- a/src/pc/djui/djui_panel_display.c +++ b/src/pc/djui/djui_panel_display.c @@ -2,7 +2,7 @@ #include "src/pc/utils/misc.h" #include "src/pc/configfile.h" -static void djui_panel_display_apply(struct DjuiBase* caller) { +static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) { configWindow.settings_changed = true; } diff --git a/src/pc/djui/djui_panel_host.c b/src/pc/djui/djui_panel_host.c index 2bca4675..1e7ea9f4 100644 --- a/src/pc/djui/djui_panel_host.c +++ b/src/pc/djui/djui_panel_host.c @@ -15,8 +15,7 @@ struct DjuiInputbox* sInputboxPort = NULL; static unsigned int sKnockbackIndex = 0; -static void djui_panel_host_network_system_change(struct DjuiBase* base) { - struct DjuiSelectionbox* selectionbox = (struct DjuiSelectionbox*)base; +static void djui_panel_host_network_system_change(UNUSED struct DjuiBase* base) { djui_base_set_enabled(&sInputboxPort->base, DJUI_HOST_NS_IS_SOCKET); } @@ -41,7 +40,7 @@ static void djui_panel_host_port_text_change(struct DjuiBase* caller) { } } -static void djui_panel_host_knockback_change(struct DjuiBase* caller) { +static void djui_panel_host_knockback_change(UNUSED struct DjuiBase* caller) { switch (sKnockbackIndex) { case 0: configPlayerKnockbackStrength = 10; break; case 1: configPlayerKnockbackStrength = 25; break; diff --git a/src/pc/djui/djui_panel_host_message.c b/src/pc/djui/djui_panel_host_message.c index 3495b45a..b73cd0de 100644 --- a/src/pc/djui/djui_panel_host_message.c +++ b/src/pc/djui/djui_panel_host_message.c @@ -25,7 +25,7 @@ Direct connections \\#ffa0a0\\require you\\#c8c8c8\\ to configure port forwardin Forward port '\\#d0d0ff\\%d\\#c8c8c8\\' for UDP.\ "; -void djui_panel_host_message_do_host(struct DjuiBase* caller) { +void djui_panel_host_message_do_host(UNUSED struct DjuiBase* caller) { djui_panel_shutdown(); extern s16 gCurrSaveFileNum; gCurrSaveFileNum = configHostSaveSlot; diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index 8fc1e6dd..c3dbbda9 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -4,7 +4,7 @@ bool gDjuiPanelMainCreated = false; -static void djui_panel_main_quit_yes(struct DjuiBase* caller) { +static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) { game_exit(); } diff --git a/src/pc/djui/djui_panel_menu.c b/src/pc/djui/djui_panel_menu.c index c4b57e5c..fe39f93e 100644 --- a/src/pc/djui/djui_panel_menu.c +++ b/src/pc/djui/djui_panel_menu.c @@ -2,7 +2,7 @@ #include "src/pc/utils/misc.h" #include "src/pc/configfile.h" -void djui_panel_menu_back(struct DjuiBase* base) { +void djui_panel_menu_back(UNUSED struct DjuiBase* base) { djui_panel_back(); } diff --git a/src/pc/djui/djui_panel_pause.c b/src/pc/djui/djui_panel_pause.c index 3b5a6b47..49aff01c 100644 --- a/src/pc/djui/djui_panel_pause.c +++ b/src/pc/djui/djui_panel_pause.c @@ -4,11 +4,11 @@ bool gDjuiPanelPauseCreated = false; -static void djui_panel_pause_resume(struct DjuiBase* caller) { +static void djui_panel_pause_resume(UNUSED struct DjuiBase* caller) { djui_panel_shutdown(); } -static void djui_panel_pause_quit_yes(struct DjuiBase* caller) { +static void djui_panel_pause_quit_yes(UNUSED struct DjuiBase* caller) { game_exit(); } diff --git a/src/pc/djui/djui_panel_player.c b/src/pc/djui/djui_panel_player.c index 432f5a78..25944a5b 100644 --- a/src/pc/djui/djui_panel_player.c +++ b/src/pc/djui/djui_panel_player.c @@ -35,8 +35,7 @@ static void djui_panel_player_name_on_focus_end(struct DjuiBase* caller) { djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255); } -void djui_panel_player_value_changed(struct DjuiBase* caller) { - struct MarioState* m = &gMarioStates[0]; +void djui_panel_player_value_changed(UNUSED struct DjuiBase* caller) { if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; } gNetworkPlayers[0].modelIndex = configPlayerModel; gNetworkPlayers[0].paletteIndex = configPlayerPalette; diff --git a/src/pc/djui/djui_selectionbox.c b/src/pc/djui/djui_selectionbox.c index 250de64d..0d7efc16 100644 --- a/src/pc/djui/djui_selectionbox.c +++ b/src/pc/djui/djui_selectionbox.c @@ -38,7 +38,7 @@ static void djui_selectionbox_on_hover_end(struct DjuiBase* base) { djui_selectionbox_set_default_style(base); } -static void djui_selectionbox_on_cursor_down_begin(struct DjuiBase* base, bool inputCursor) { +static void djui_selectionbox_on_cursor_down_begin(struct DjuiBase* base, UNUSED bool inputCursor) { struct DjuiSelectionbox* selectionbox = (struct DjuiSelectionbox*)base; f32 x = selectionbox->rect->base.elem.x; if (gCursorX >= x) { @@ -59,7 +59,6 @@ static void djui_selectionbox_on_cursor_down_begin(struct DjuiBase* base, bool i } static void djui_selectionbox_on_cursor_down_end(struct DjuiBase* base) { - struct DjuiSelectionbox* selectionbox = (struct DjuiSelectionbox*)base; djui_selectionbox_set_default_style(base); } diff --git a/src/pc/djui/djui_text.c b/src/pc/djui/djui_text.c index 072b8dc7..1d703cb3 100644 --- a/src/pc/djui/djui_text.c +++ b/src/pc/djui/djui_text.c @@ -79,7 +79,6 @@ static void djui_text_render_single_char(struct DjuiText* text, char c) { static void djui_text_render_char(struct DjuiText* text, char c) { if (text->dropShadow.a > 0) { // render drop shadow - struct DjuiBase* base = &text->base; sTextRenderX += 1.0f / text->fontScale; sTextRenderY += 1.0f / text->fontScale; gDPSetEnvColor(gDisplayListHead++, text->dropShadow.r, text->dropShadow.g, text->dropShadow.b, text->dropShadow.a); @@ -108,7 +107,7 @@ static f32 djui_text_measure_word_width(struct DjuiText* text, char* message) { return width; } -static void djui_text_read_line(struct DjuiText* text, u16* index, f32* lineWidth, f32 maxLineWidth, bool onLastLine, bool* ellipses) { +static void djui_text_read_line(struct DjuiText* text, u16* index, f32* lineWidth, f32 maxLineWidth, bool onLastLine, UNUSED bool* ellipses) { char* message = text->message; *lineWidth = 0; char lastC = '\0'; @@ -264,7 +263,6 @@ static void djui_text_render_line(struct DjuiText* text, u16 startIndex, u16 end } // render the line - bool escapeCode = false; for (int i = startIndex; i < endIndex; i++) { char c = text->message[i]; if (c == '\\') { diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c index 4191d314..a4ec6056 100644 --- a/src/pc/gfx/gfx_pc.c +++ b/src/pc/gfx/gfx_pc.c @@ -28,6 +28,8 @@ #include "../configfile.h" #include "../fs/fs.h" +#include "macros.h" + #define SUPPORT_CHECK(x) assert(x) // SCALE_M_N: upscale/downscale M-bit integer to N-bit @@ -207,13 +209,13 @@ static unsigned long get_time(void) { static void gfx_flush(void) { if (buf_vbo_len > 0) { - int num = buf_vbo_num_tris; - unsigned long t0 = get_time(); + /*int num = buf_vbo_num_tris; + unsigned long t0 = get_time();*/ gfx_rapi->draw_triangles(buf_vbo, buf_vbo_len, buf_vbo_num_tris); buf_vbo_len = 0; buf_vbo_num_tris = 0; - unsigned long t1 = get_time(); - /*if (t1 - t0 > 1000) { + /*unsigned long t1 = get_time(); + if (t1 - t0 > 1000) { printf("f: %d %d\n", num, (int)(t1 - t0)); }*/ } @@ -625,7 +627,7 @@ static void import_texture(int tile) { load_texture(texname); #else // the texture data is actual texture data - int t0 = get_time(); + //int t0 = get_time(); if (fmt == G_IM_FMT_RGBA) { if (siz == G_IM_SIZ_32b) { import_texture_rgba32(tile); @@ -664,7 +666,7 @@ static void import_texture(int tile) { } else { sys_fatal("unsupported texture format: %u", fmt); } - int t1 = get_time(); + //int t1 = get_time(); //printf("Time diff: %d\n", t1 - t0); #endif } @@ -1141,7 +1143,7 @@ static void gfx_sp_movemem(uint8_t index, uint8_t offset, const void* data) { } #ifdef F3DEX_GBI_2E -static void gfx_sp_copymem(uint8_t idx, uint8_t dstofs, uint8_t srcofs, uint8_t words) { +static void gfx_sp_copymem(uint8_t idx, uint8_t dstofs, uint8_t srcofs, UNUSED uint8_t words) { if (idx == G_MV_LIGHT) { const int srcidx = srcofs / 24 - 2; const int dstidx = dstofs / 24 - 2; @@ -1152,7 +1154,7 @@ static void gfx_sp_copymem(uint8_t idx, uint8_t dstofs, uint8_t srcofs, uint8_t } #endif -static void gfx_sp_moveword(uint8_t index, uint16_t offset, uint32_t data) { +static void gfx_sp_moveword(uint8_t index, UNUSED uint16_t offset, uint32_t data) { switch (index) { case G_MW_NUMLIGHT: #ifdef F3DEX_GBI_2 @@ -1171,12 +1173,12 @@ static void gfx_sp_moveword(uint8_t index, uint16_t offset, uint32_t data) { } } -static void gfx_sp_texture(uint16_t sc, uint16_t tc, uint8_t level, uint8_t tile, uint8_t on) { +static void gfx_sp_texture(uint16_t sc, uint16_t tc, UNUSED uint8_t level, UNUSED uint8_t tile, UNUSED uint8_t on) { rsp.texture_scaling_factor.s = sc; rsp.texture_scaling_factor.t = tc; } -static void gfx_dp_set_scissor(uint32_t mode, uint32_t ulx, uint32_t uly, uint32_t lrx, uint32_t lry) { +static void gfx_dp_set_scissor(UNUSED uint32_t mode, uint32_t ulx, uint32_t uly, uint32_t lrx, uint32_t lry) { float x = ulx / 4.0f * RATIO_X; float y = (SCREEN_HEIGHT - lry / 4.0f) * RATIO_Y; float width = (lrx - ulx) / 4.0f * RATIO_X; @@ -1190,12 +1192,12 @@ static void gfx_dp_set_scissor(uint32_t mode, uint32_t ulx, uint32_t uly, uint32 rdp.viewport_or_scissor_changed = true; } -static void gfx_dp_set_texture_image(uint32_t format, uint32_t size, uint32_t width, const void* addr) { +static void gfx_dp_set_texture_image(UNUSED uint32_t format, uint32_t size, UNUSED uint32_t width, const void* addr) { rdp.texture_to_load.addr = addr; rdp.texture_to_load.siz = size; } -static void gfx_dp_set_tile(uint8_t fmt, uint32_t siz, uint32_t line, uint32_t tmem, uint8_t tile, uint32_t palette, uint32_t cmt, uint32_t maskt, uint32_t shiftt, uint32_t cms, uint32_t masks, uint32_t shifts) { +static void gfx_dp_set_tile(uint8_t fmt, uint32_t siz, uint32_t line, uint32_t tmem, uint8_t tile, uint32_t palette, uint32_t cmt, UNUSED uint32_t maskt, UNUSED uint32_t shiftt, uint32_t cms, UNUSED uint32_t masks, UNUSED uint32_t shifts) { if (tile == G_TX_RENDERTILE) { SUPPORT_CHECK(palette == 0); // palette should set upper 4 bits of color index in 4b mode @@ -1224,13 +1226,13 @@ static void gfx_dp_set_tile_size(uint8_t tile, uint16_t uls, uint16_t ult, uint1 } } -static void gfx_dp_load_tlut(uint8_t tile, uint32_t high_index) { +static void gfx_dp_load_tlut(uint8_t tile, UNUSED uint32_t high_index) { SUPPORT_CHECK(tile == G_TX_LOADTILE); SUPPORT_CHECK(rdp.texture_to_load.siz == G_IM_SIZ_16b); rdp.palette = rdp.texture_to_load.addr; } -static void gfx_dp_load_block(uint8_t tile, uint32_t uls, uint32_t ult, uint32_t lrs, uint32_t dxt) { +static void gfx_dp_load_block(uint8_t tile, uint32_t uls, uint32_t ult, uint32_t lrs, UNUSED uint32_t dxt) { if (tile == 1) return; SUPPORT_CHECK(tile == G_TX_LOADTILE); SUPPORT_CHECK(uls == 0); @@ -1426,7 +1428,7 @@ static void gfx_draw_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lr } } -static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry, uint8_t tile, int16_t uls, int16_t ult, int16_t dsdx, int16_t dtdy, bool flip) { +static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry, UNUSED uint8_t tile, int16_t uls, int16_t ult, int16_t dsdx, int16_t dtdy, bool flip) { uint32_t saved_combine_mode = rdp.combine_mode; if ((rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_COPY) { // Per RDP Command Summary Set Tile's shift s and this dsdx should be set to 4 texels @@ -1506,7 +1508,7 @@ static void gfx_dp_set_z_image(void *z_buf_address) { rdp.z_buf_address = z_buf_address; } -static void gfx_dp_set_color_image(uint32_t format, uint32_t size, uint32_t width, void* address) { +static void gfx_dp_set_color_image(UNUSED uint32_t format, UNUSED uint32_t size, UNUSED uint32_t width, void* address) { rdp.color_image_address = address; } @@ -1526,7 +1528,6 @@ static inline void *seg_addr(uintptr_t w1) { #define C1(pos, width) ((cmd->words.w1 >> (pos)) & ((1U << width) - 1)) static void gfx_run_dl(Gfx* cmd) { - int dummy = 0; for (;;) { uint32_t opcode = cmd->words.w0 >> 24; @@ -1821,11 +1822,11 @@ void gfx_run(Gfx *commands) { } dropped_frame = false; - double t0 = gfx_wapi->get_time(); + //double t0 = gfx_wapi->get_time(); gfx_rapi->start_frame(); gfx_run_dl(commands); gfx_flush(); - double t1 = gfx_wapi->get_time(); + //double t1 = gfx_wapi->get_time(); //printf("Process %f %f\n", t1, t1 - t0); gfx_rapi->end_frame(); gfx_wapi->swap_buffers_begin(); diff --git a/src/pc/network/discord/discord.c b/src/pc/network/discord/discord.c index 9a1380c8..e80b15a6 100644 --- a/src/pc/network/discord/discord.c +++ b/src/pc/network/discord/discord.c @@ -22,7 +22,7 @@ struct DiscordApplication app = { 0 }; bool gDiscordInitialized = false; bool gDiscordFailed = false; -static void discord_sdk_log_callback(void* hook_data, enum EDiscordLogLevel level, const char* message) { +static void discord_sdk_log_callback(UNUSED void* hook_data, enum EDiscordLogLevel level, const char* message) { LOGFILE_INFO(LFT_DISCORD, "callback (%d): %s", level, message); } @@ -34,7 +34,7 @@ void discord_fatal(int rc) { fflush(stderr); LOGFILE_ERROR(LFT_DISCORD, "discord fatal %d", rc); logfile_close(LFT_DISCORD); - int msgboxID = MessageBox(NULL, + MessageBox(NULL, errorMessage, "Fatal Discord Error", MB_ICONERROR | MB_OK | MB_DEFBUTTON1 diff --git a/src/pc/network/discord/discord_network.c b/src/pc/network/discord/discord_network.c index 2eac58b0..c5da1658 100644 --- a/src/pc/network/discord/discord_network.c +++ b/src/pc/network/discord/discord_network.c @@ -20,7 +20,7 @@ int ns_discord_network_send(u8 localIndex, u8* data, u16 dataLength) { return 0; } -void discord_network_on_message(UNUSED void* eventData, int64_t lobbyId, int64_t userId, uint8_t channelId, uint8_t* data, uint32_t dataLength) { +void discord_network_on_message(UNUSED void* eventData, UNUSED int64_t lobbyId, int64_t userId, UNUSED uint8_t channelId, uint8_t* data, uint32_t dataLength) { gNetworkUserIds[0] = userId; u8 localIndex = UNKNOWN_LOCAL_INDEX; diff --git a/src/pc/network/packets/packet_keep_alive.c b/src/pc/network/packets/packet_keep_alive.c index 9aebd8dd..3fa3213c 100644 --- a/src/pc/network/packets/packet_keep_alive.c +++ b/src/pc/network/packets/packet_keep_alive.c @@ -9,6 +9,6 @@ void network_send_keep_alive(u8 localIndex) { LOG_INFO("sending keep alive"); } -void network_receive_keep_alive(struct Packet* p) { +void network_receive_keep_alive(UNUSED struct Packet* p) { LOG_INFO("received keep alive"); } diff --git a/src/pc/network/packets/packet_object.c b/src/pc/network/packets/packet_object.c index 7768d5ec..b0a1ba9c 100644 --- a/src/pc/network/packets/packet_object.c +++ b/src/pc/network/packets/packet_object.c @@ -74,9 +74,6 @@ void network_override_object(u8 syncId, struct Object* o) { } struct SyncObject* network_init_object(struct Object *o, float maxSyncDistance) { - // HACK: an odd way to detect if this entity was spawned from a staticLevel respawner - bool wasStaticRespawner = (o->oSyncID != 0 && gSyncObjects[o->oSyncID].o == o && o->oSyncID < RESERVED_IDS_SYNC_OBJECT_OFFSET); - // generate new sync ID network_set_sync_id(o); diff --git a/src/pc/network/socket/socket.c b/src/pc/network/socket/socket.c index 7303aff5..885f4611 100644 --- a/src/pc/network/socket/socket.c +++ b/src/pc/network/socket/socket.c @@ -101,11 +101,11 @@ static bool ns_socket_initialize(enum NetworkType networkType) { return true; } -static s64 ns_socket_get_id(u8 localId) { +static s64 ns_socket_get_id(UNUSED u8 localId) { return 0; } -static void ns_socket_save_id(u8 localId, s64 networkId) { +static void ns_socket_save_id(u8 localId, UNUSED s64 networkId) { assert(localId > 0); assert(localId < MAX_PLAYERS); addr[localId] = addr[0]; diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 66b18bb9..43489b28 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -67,10 +67,10 @@ extern void thread5_game_loop(void *arg); extern void create_next_audio_buffer(s16 *samples, u32 num_samples); void game_loop_one_iteration(void); -void dispatch_audio_sptask(struct SPTask *spTask) { +void dispatch_audio_sptask(UNUSED struct SPTask *spTask) { } -void set_vblank_handler(s32 index, struct VblankHandler *handler, OSMesgQueue *queue, OSMesg *msg) { +void set_vblank_handler(UNUSED s32 index, UNUSED struct VblankHandler *handler, UNUSED OSMesgQueue *queue, UNUSED OSMesg *msg) { } static bool inited = false;