diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/db_camera.c | 4 | ||||
| -rw-r--r-- | src/code/fault_gc.c | 4 | ||||
| -rw-r--r-- | src/code/fault_n64.c | 4 | ||||
| -rw-r--r-- | src/code/game.c | 4 | ||||
| -rw-r--r-- | src/code/sys_cfb.c | 2 | ||||
| -rw-r--r-- | src/code/ucode_disas.c | 4 | ||||
| -rw-r--r-- | src/code/z_actor.c | 3 | ||||
| -rw-r--r-- | src/code/z_actor_dlftbls.c | 4 | ||||
| -rw-r--r-- | src/code/z_bgcheck.c | 2 | ||||
| -rw-r--r-- | src/code/z_camera.c | 42 | ||||
| -rw-r--r-- | src/code/z_jpeg.c | 2 | ||||
| -rw-r--r-- | src/code/z_lights.c | 3 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 2 | ||||
| -rw-r--r-- | src/code/z_play.c | 3 | ||||
| -rw-r--r-- | src/code/z_view.c | 2 | ||||
| -rw-r--r-- | src/code/z_vimode.c | 8 | ||||
| -rw-r--r-- | src/code/z_vismono.c | 2 |
17 files changed, 52 insertions, 43 deletions
diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 242609295..7d81dafc9 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,5 +1,7 @@ #include "global.h" +#if DEBUG_FEATURES + #define DEBUG_CAM_CONTROLLER_PORT 2 static PlayState* sPlay; @@ -2366,3 +2368,5 @@ void func_800BB060(void) { int func_800BB06C(void) { return sDebugCamPtr->unk_00 == 2 && sDebugCamAnim.unk_0A != 0; } + +#endif diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index e9b7de4b6..13dfb670a 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -1327,9 +1327,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { // Since the above line triggers an exception and transfers execution to the fault handler // this function does not return and the rest of the function is unreachable. -#ifdef __GNUC__ - __builtin_unreachable(); -#endif + UNREACHABLE(); } /** diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index ae8e7b8bb..7ea68abeb 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -822,7 +822,7 @@ void Fault_Init(void) { osStartThread(&gFaultMgr.thread); } -void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { +NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { gFaultMsgId = 4; osSyncPrintf("HungUp on Thread %d", osGetThreadId(NULL)); osSyncPrintf("%s\n", exp1 != NULL ? exp1 : "(NULL)"); @@ -843,7 +843,7 @@ void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { } while (true); } -void Fault_AddHungupAndCrash(const char* file, int line) { +NORETURN void Fault_AddHungupAndCrash(const char* file, int line) { char msg[256]; sprintf(msg, "HungUp %s:%d", file, line); diff --git a/src/code/game.c b/src/code/game.c index 8aad6bf00..bf7a4ce7c 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -452,8 +452,8 @@ void GameState_Realloc(GameState* gameState, size_t size) { } void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) { - OSTime startTime; - OSTime endTime; + UNUSED_NDEBUG OSTime startTime; + UNUSED_NDEBUG OSTime endTime; PRINTF(T("game コンストラクタ開始\n", "game constructor start\n")); gameState->gfxCtx = gfxCtx; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index c7e2933be..cbde146fa 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -8,7 +8,7 @@ uintptr_t sSysCfbEnd; void SysCfb_Init(s32 n64dd) { u32 screenSize; - uintptr_t tmpFbEnd; + UNUSED_NDEBUG uintptr_t tmpFbEnd; if (osMemSize >= 0x800000) { PRINTF(T("8Mバイト以上のメモリが搭載されています\n", "8MB or more memory is installed\n")); diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index e2e782e71..ecfc7d7ac 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,6 +1,8 @@ #include "global.h" #include "ucode_disas.h" +#if DEBUG_FEATURES + typedef struct F3dzexConst { /* 0x00 */ u32 value; /* 0x04 */ const char* name; @@ -1244,3 +1246,5 @@ void UCodeDisas_RegisterUCode(UCodeDisas* this, s32 count, UCodeInfo* ucodeArray void UCodeDisas_SetCurUCode(UCodeDisas* this, void* ptr) { UCodeDisas_SetCurUCodeImpl(this, ptr); } + +#endif diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b96801fc4..7c4293689 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3204,7 +3204,7 @@ Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayStat } Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { - char* name; + UNUSED_NDEBUG char* name; Player* player; Actor* newHead; ActorOverlay* overlayEntry; @@ -4041,6 +4041,7 @@ void func_8003424C(PlayState* play, Vec3f* arg1) { } void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration) { + //! @bug This first comparison is always false as COLORFILTER_COLORFLAG_GRAY is out of range of an s16. if ((colorFlag == COLORFILTER_COLORFLAG_GRAY) && !(colorIntensityMax & COLORFILTER_INTENSITY_FLAG)) { Actor_PlaySfx(actor, NA_SE_EN_LIGHT_ARROW_HIT); } diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 65b118efd..52d8ad855 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -100,8 +100,8 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { u32 overlaySize; uintptr_t ramStart; uintptr_t ramEnd; - u32 offset; #if PLATFORM_N64 + u32 offset; uintptr_t pc = gFaultFaultedThread != NULL ? gFaultFaultedThread->context.pc : 0; uintptr_t ra = gFaultFaultedThread != NULL ? gFaultFaultedThread->context.ra : 0; u32 i; @@ -125,7 +125,9 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart; ramStart = (uintptr_t)overlayEntry->loadedRamAddr; ramEnd = ramStart + overlaySize; +#if PLATFORM_N64 offset = (uintptr_t)overlayEntry->vramStart - ramStart; +#endif if (ramStart != 0) { #if PLATFORM_N64 Fault_Printf("%3d %08x-%08x %08x", i, ramStart, ramEnd, offset); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 37d839dff..129900bdb 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1541,7 +1541,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader }; u32 tblMax; u32 memSize; - u32 lookupTblMemSize; + UNUSED_NDEBUG u32 lookupTblMemSize; s32 customNodeListMax; SSNodeList* nodeList; u32 customMemSize; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index aca9f4487..1ddc538dc 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -612,10 +612,10 @@ Vec3s* Camera_GetBgCamFuncData(Camera* camera) { */ s32 Camera_GetBgCamIndex(Camera* camera, s32* bgId, CollisionPoly* poly) { s32 bgCamIndex; - PosRot playerPosRot; + UNUSED PosRot playerPosRot; s32 ret; - playerPosRot = Actor_GetWorldPosShapeRot(&camera->player->actor); // unused. + playerPosRot = Actor_GetWorldPosShapeRot(&camera->player->actor); bgCamIndex = SurfaceType_GetBgCamIndex(&camera->play->colCtx, poly, *bgId); if (BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, bgCamIndex, *bgId) == CAM_SET_NONE) { @@ -947,7 +947,7 @@ void Camera_UpdateInterface(s16 interfaceField) { Vec3f Camera_BGCheckCorner(Vec3f* linePointA, Vec3f* linePointB, CamColChk* pointAColChk, CamColChk* pointBColChk) { Vec3f closestPoint; - bool result; + UNUSED_NDEBUG bool result; result = func_800427B4(pointAColChk->poly, pointBColChk->poly, linePointA, linePointB, &closestPoint); #if DEBUG_FEATURES @@ -2302,7 +2302,7 @@ s32 Camera_Parallel1(Camera* camera) { camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, camera->fovUpdateRate, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5, 0xA); camera->atLERPStepScale = Camera_ClampLERPScale(camera, sp6A ? roData->unk_1C : roData->unk_14); - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Parallel2(Camera* camera) { @@ -2321,7 +2321,7 @@ s32 Camera_Parallel3(Camera* camera) { if (interfaceField & PARALLEL3_FLAG_1) { camera->stateFlags |= CAM_STATE_CAM_FUNC_FINISH; } - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Parallel4(Camera* camera) { @@ -2347,7 +2347,7 @@ s32 Camera_Jump1(Camera* camera) { VecGeo eyeDiffGeo; VecGeo eyeDiffTarget; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerhead; + UNUSED PosRot playerhead; s16 tangle; Jump1ReadOnlyData* roData = &camera->paramData.jump1.roData; Jump1ReadWriteData* rwData = &camera->paramData.jump1.rwData; @@ -2371,7 +2371,6 @@ s32 Camera_Jump1(Camera* camera) { CAM_DEBUG_RELOAD_PREG(camera); - // playerhead never gets used. playerhead = Actor_GetFocus(&camera->player->actor); eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); @@ -2490,7 +2489,7 @@ s32 Camera_Jump2(Camera* camera) { VecGeo adjAtToEyeDir; VecGeo bgChkPara; VecGeo atToEyeNextDir; - VecGeo atToEyeDir; + UNUSED VecGeo atToEyeDir; f32 temp_f14; f32 temp_f16; f32 sp90; @@ -3121,6 +3120,7 @@ s32 Camera_Battle1(Camera* camera) { : 1.0f) * (fov - ((fov * 0.05f) * distRatio)), camera->fov, camera->fovUpdateRate, 1.0f); + //! @bug Missing return, but the return value is not used. } s32 Camera_Battle2(Camera* camera) { @@ -3467,13 +3467,13 @@ s32 Camera_KeepOn3(Camera* camera) { Actor* colChkActors[2]; VecGeo targetToPlayerDir; VecGeo atToEyeAdj; - VecGeo atToEyeDir; + UNUSED VecGeo atToEyeDir; VecGeo atToEyeNextDir; s32 i; s32 angleCnt; s16 sp82; s16 sp80; - PosRot playerPosRot; + UNUSED PosRot playerPosRot; PosRot* camPlayerPosRot = &camera->playerPosRot; KeepOn3ReadOnlyData* roData = &camera->paramData.keep3.roData; KeepOn3ReadWriteData* rwData = &camera->paramData.keep3.rwData; @@ -3653,7 +3653,7 @@ s32 Camera_KeepOn4(Camera* camera) { f32 temp_f0_2; CollisionPoly* spC0; VecGeo spB8; - VecGeo spB0; + UNUSED VecGeo spB0; VecGeo spA8; s16* temp_s0 = &camera->data2; s16 spA2; @@ -3952,6 +3952,7 @@ s32 Camera_KeepOn4(Camera* camera) { Camera_BGCheck(camera, at, eye); camera->fov = Camera_LERPCeilF(roData->unk_18, camera->fov, camera->fovUpdateRate, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA); + //! @bug Missing return, but the return value is not used. } /** @@ -4188,7 +4189,7 @@ s32 Camera_Fixed3(Camera* camera) { Vec3f* eyeNext = &camera->eyeNext; VecGeo atGeo; BgCamFuncData* bgCamFuncData; - VecGeo eyeAtOffset; + UNUSED VecGeo eyeAtOffset; Fixed3ReadOnlyData* roData = &camera->paramData.fixd3.roData; Fixed3ReadWriteData* rwData = &camera->paramData.fixd3.rwData; s32 pad; @@ -4346,7 +4347,7 @@ s32 Camera_Subj3(Camera* camera) { Vec3f* at = &camera->at; Vec3f* eyeNext = &camera->eyeNext; Vec3f sp98; - Vec3f sp8C; + UNUSED Vec3f sp8C; VecGeo sp84; VecGeo sp7C; VecGeo tGeo; @@ -4741,7 +4742,7 @@ s32 Camera_Unique1(Camera* camera) { VecGeo eyeAtOffset; VecGeo eyeNextAtOffset; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerhead; + UNUSED PosRot playerhead; Unique1ReadOnlyData* roData = &camera->paramData.uniq1.roData; Unique1ReadWriteData* rwData = &camera->paramData.uniq1.rwData; s32 pad; @@ -4784,7 +4785,7 @@ s32 Camera_Unique1(Camera* camera) { camera->animState++; } - playerhead = Actor_GetFocus(&camera->player->actor); // unused + playerhead = Actor_GetFocus(&camera->player->actor); camera->yawUpdateRateInv = Camera_LERPCeilF(100.0f, camera->yawUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->pitchUpdateRateInv = @@ -6719,7 +6720,7 @@ s32 Camera_Demo7(Camera* camera) { camera->stateFlags |= CAM_STATE_DEMO7; camera->animState++; } - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Demo8(Camera* camera) { @@ -6975,7 +6976,7 @@ s32 Camera_Special5(Camera* camera) { CamColChk sp7C; VecGeo sp74; VecGeo sp6C; - VecGeo sp64; + UNUSED VecGeo sp64; VecGeo sp5C; PosRot* playerPosRot = &camera->playerPosRot; Special5ReadOnlyData* roData = &camera->paramData.spec5.roData; @@ -7177,7 +7178,7 @@ s32 Camera_Special6(Camera* camera) { Vec3f eyePosCalc; Vec3f eyeAnim; Vec3f atAnim; - VecGeo eyeAtOffset; + UNUSED VecGeo eyeAtOffset; PosRot* playerPosRot = &camera->playerPosRot; BgCamFuncData* bgCamFuncData; Vec3s bgCamRot; @@ -7876,7 +7877,7 @@ s32 Camera_UpdateWater(Camera* camera) { } Audio_SetExtraFilter(0); } - //! @bug: doesn't always return a value, but sometimes does. + //! @bug Missing return, but the return value is not used. } s32 Camera_UpdateHotRoom(Camera* camera) { @@ -8617,8 +8618,7 @@ s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { #endif return 0x80000000 | requestedBgCamIndex; } - - //! @note: no return here, but return is unused + //! @bug Missing return, but the return value is not used. } Vec3s Camera_GetInputDir(Camera* camera) { diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index deee31dfd..83ec5aafd 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -240,7 +240,7 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize) { JpegDecoder decoder; JpegDecoderState state; JpegWork* workBuff; - OSTime diff; + UNUSED_NDEBUG OSTime diff; OSTime time; OSTime curTime; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 1d04a59a8..5ee208f70 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -182,8 +182,7 @@ LightNode* Lights_FindBufSlot(void) { return node; } -// return type must not be void to match -s32 Lights_FreeNode(LightNode* light) { +BAD_RETURN(s32) Lights_FreeNode(LightNode* light) { if (light != NULL) { sLightsBuffer.numOccupied--; light->info = NULL; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 74b0ef5ee..e6e451ee3 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2211,7 +2211,7 @@ void Interface_LoadActionLabelB(PlayState* play, u16 action) { */ s32 Health_ChangeBy(PlayState* play, s16 amount) { u16 heartCount; - u16 healthLevel; + UNUSED_NDEBUG u16 healthLevel; PRINTF(T("***** 増減=%d (now=%d, max=%d) ***", "***** Fluctuation=%d (now=%d, max=%d) ***"), amount, gSaveContext.save.info.playerData.health, gSaveContext.save.info.playerData.healthCapacity); diff --git a/src/code/z_play.c b/src/code/z_play.c index 84c80119a..dc37ab27a 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1068,6 +1068,7 @@ void Play_Update(PlayState* this) { skip: PLAY_LOG(3801); + //! @bug If frame advancing or during tile transitions, isPaused will be used uninitialized. if (!isPaused || gDebugCamEnabled) { s32 i; @@ -1545,7 +1546,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { SceneTableEntry* scene; - u32 size; + UNUSED_NDEBUG u32 size; #if PLATFORM_N64 if ((B_80121220 != NULL) && (B_80121220->unk_48 != NULL)) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 5395f3855..37e8ac9b0 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -201,7 +201,7 @@ void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ) { view->distortionScale.z = scaleZ; } -s32 View_SetDistortionSpeed(View* view, f32 speed) { +BAD_RETURN(s32) View_SetDistortionSpeed(View* view, f32 speed) { view->distortionSpeed = speed; } diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index a97181075..59fa5df2d 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -149,15 +149,15 @@ void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antia viMode->customViMode.comRegs.hSync += HSYNC(1, 4); } if (tvType == OS_TV_MPAL) { - viMode->customViMode.comRegs.leap += LEAP((u16)-4, (u16)-2); + viMode->customViMode.comRegs.leap += LEAP(-4, -2); } } else { - viMode->customViMode.fldRegs[0].vStart += START((u16)-3, (u16)-2); + viMode->customViMode.fldRegs[0].vStart += START(-3, -2); if (tvType == OS_TV_MPAL) { - viMode->customViMode.fldRegs[0].vBurst += BURST((u8)-2, (u8)-1, 12, -1); + viMode->customViMode.fldRegs[0].vBurst += BURST(-2, -1, 12, -1); } if (tvType == OS_TV_PAL) { - viMode->customViMode.fldRegs[1].vBurst += BURST((u8)-2, (u8)-1, 2, 0); + viMode->customViMode.fldRegs[1].vBurst += BURST(-2, -1, 2, 0); } } diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index b169f5b02..aac4fa84f 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -183,7 +183,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) { } void VisMono_DrawOld(VisMono* this) { - Gfx* dListEnd; + UNUSED_NDEBUG Gfx* dListEnd; if (this->tlut == NULL) { this->tlut = SYSTEM_ARENA_MALLOC(256 * G_IM_SIZ_16b_BYTES, "../z_vismono.c", 283); |
