mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-05 01:06:37 +00:00
Fix some more GCC warnings, mark some bugs based on GCC warnings (#2309)
* Fix some more GCC warnings, mark some bugs based on GCC warnings * Weird formatting * Suggested changes * More weird indentation I guess * UNREACHABLE() macro, add missing NORETURNs to fault_n64.c * AVOID_UB for PAL path in z_file_nameset.c * Remove comments about return types * Remove temp no longer needed
This commit is contained in:
parent
6199634ffb
commit
3f703a39d9
39 changed files with 156 additions and 83 deletions
|
@ -1,6 +1,8 @@
|
|||
#ifndef ATTRIBUTES_H
|
||||
#define ATTRIBUTES_H
|
||||
|
||||
#include "versions.h"
|
||||
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
@ -11,4 +13,17 @@
|
|||
#define NO_REORDER __attribute__((no_reorder))
|
||||
#define SECTION_DATA __attribute__((section(".data")))
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
#else
|
||||
#define UNREACHABLE()
|
||||
#endif
|
||||
|
||||
// Variables may be unused in retail versions but used in debug versions
|
||||
#if DEBUG_FEATURES
|
||||
#define UNUSED_NDEBUG
|
||||
#else
|
||||
#define UNUSED_NDEBUG UNUSED
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "ultra64.h"
|
||||
|
||||
extern s32 B_80008EE0;
|
||||
extern u32 B_80008EE0;
|
||||
|
||||
void func_800014E8(void);
|
||||
void CIC6105_AddFaultClient(void);
|
||||
|
|
|
@ -17,21 +17,23 @@
|
|||
// For use in initializing OSViMode structures
|
||||
|
||||
#define BURST(hsync_width, color_width, vsync_width, color_start) \
|
||||
(hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20))
|
||||
#define WIDTH(v) v
|
||||
#define VSYNC(v) v
|
||||
#define HSYNC(duration, leap) (duration | (leap << 16))
|
||||
#define LEAP(upper, lower) ((upper << 16) | lower)
|
||||
#define START(start, end) ((start << 16) | end)
|
||||
|
||||
#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1))
|
||||
((((u8)(hsync_width) & 0xFF) << 0) | \
|
||||
(((u8)(color_width) & 0xFF) << 8) | \
|
||||
(((u8)(vsync_width) & 0xF) << 16) | \
|
||||
(((u16)(color_start) & 0xFFF) << 20))
|
||||
#define WIDTH(v) (v)
|
||||
#define VSYNC(v) (v)
|
||||
#define HSYNC(duration, leap) (((u16)(leap) << 16) | (u16)(duration))
|
||||
#define LEAP(upper, lower) (((u16)(upper) << 16) | (u16)(lower))
|
||||
#define START(start, end) (((u16)(start) << 16) | (u16)(end))
|
||||
|
||||
#define FTOFIX(val, i, f) ((u32)((val) * (f32)(1 << (f))) & ((1 << ((i) + (f))) - 1))
|
||||
#define F210(val) FTOFIX(val, 2, 10)
|
||||
#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16))
|
||||
#define SCALE(scaleup, off) (F210(1.0f / (f32)(scaleup)) | (F210((f32)(off)) << 16))
|
||||
|
||||
#define VCURRENT(v) v
|
||||
#define ORIGIN(v) v
|
||||
#define VINTR(v) v
|
||||
#define HSTART START
|
||||
#define VCURRENT(v) (v)
|
||||
#define ORIGIN(v) (v)
|
||||
#define VINTR(v) (v)
|
||||
#define HSTART(start, end) START(start, end)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -81,7 +81,7 @@ void View_SetViewport(View* view, Viewport* viewport);
|
|||
void View_GetViewport(View* view, Viewport* viewport);
|
||||
void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
|
||||
void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
|
||||
s32 View_SetDistortionSpeed(View* view, f32 speed);
|
||||
BAD_RETURN(s32) View_SetDistortionSpeed(View* view, f32 speed);
|
||||
void View_InitDistortion(View* view);
|
||||
void View_ClearDistortion(View* view);
|
||||
void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);
|
||||
|
|
|
@ -410,6 +410,7 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
|
|||
sample->sampleAddr = sampleAddr;
|
||||
}
|
||||
}
|
||||
//! @bug Missing return, but the return value is never used so it's fine.
|
||||
}
|
||||
|
||||
s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
||||
|
@ -426,6 +427,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
|||
if (instrument->normalRangeHi != 0x7F) {
|
||||
return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId);
|
||||
}
|
||||
//! @bug Missing return, but the return value is never used so it's fine.
|
||||
} else if (instId == 0x7F) {
|
||||
Drum* drum = Audio_GetDrum(fontId, drumId);
|
||||
|
||||
|
@ -508,10 +510,10 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
|
||||
gAudioCtx.seqPlayers[playerIdx].skipTicks = 0;
|
||||
AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, arg2);
|
||||
// Intentionally missing return. Returning the result of the above function
|
||||
// call matches but is UB because it too is missing a return, and using the
|
||||
// result of a non-void function that has failed to return a value is UB.
|
||||
// The callers of this function do not use the return value, so it's fine.
|
||||
//! @bug Missing return. Returning the result of the above function call
|
||||
//! matches but is UB because it too is missing a return, and using the
|
||||
//! result of a non-void function that has failed to return a value is UB.
|
||||
//! The callers of this function do not use the return value, so it's fine.
|
||||
}
|
||||
|
||||
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) {
|
||||
|
@ -521,7 +523,7 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks
|
|||
|
||||
gAudioCtx.seqPlayers[playerIdx].skipTicks = skipTicks;
|
||||
AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, 0);
|
||||
// Missing return, see above.
|
||||
//! @bug Missing return, see comment in AudioLoad_SyncInitSeqPlayer above.
|
||||
}
|
||||
|
||||
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
||||
|
|
|
@ -10,11 +10,11 @@ OSTask D_800067C0_unknown = {
|
|||
4, 0, rspbootTextStart, 0x3E8, cic6105TextStart, 0x20, (u64*)gBuildCreator, 8, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
|
||||
};
|
||||
|
||||
s32 B_80008EE0;
|
||||
s32 B_80008EE4;
|
||||
u32 B_80008EE0;
|
||||
u32 B_80008EE4;
|
||||
FaultClient sCIC6105FaultClient;
|
||||
s32 B_80008EF8;
|
||||
s32 B_80008EFC;
|
||||
u32 B_80008EF8;
|
||||
u32 B_80008EFC;
|
||||
|
||||
void func_800014D0(void) {
|
||||
R_AUDIOMGR_DEBUG_LEVEL = AUDIOMGR_DEBUG_LEVEL_NO_RSP;
|
||||
|
|
|
@ -367,7 +367,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
|
|||
size_t romSize;
|
||||
u8 found = false;
|
||||
DmaEntry* iter;
|
||||
const char* filename;
|
||||
UNUSED_NDEBUG const char* filename;
|
||||
s32 i = 0;
|
||||
|
||||
#if DEBUG_FEATURES
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) {
|
||||
OSPiHandle* driveRomHandle;
|
||||
OSPiHandle* leoDiskHandle;
|
||||
UNUSED OSPiHandle* leoDiskHandle;
|
||||
volatile LEOCmdInquiry cmdBlockInq;
|
||||
volatile LEOCmd cmdBlockID;
|
||||
LEODiskID thisID;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) {
|
||||
OSPiHandle* driveRomHandle;
|
||||
OSPiHandle* leoDiskHandle;
|
||||
UNUSED OSPiHandle* leoDiskHandle;
|
||||
volatile LEOCmdInquiry cmdBlockInq;
|
||||
volatile LEOCmd cmdBlockID;
|
||||
LEODiskID thisID;
|
||||
|
|
|
@ -52,6 +52,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) {
|
|||
if (asic_cmd == 0x80000) {
|
||||
return 0;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case 43:
|
||||
if (!(asic_cur_status & 0x800000)) {
|
||||
if (asic_cmd == 0x90000) {
|
||||
|
@ -65,6 +66,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) {
|
|||
return 37;
|
||||
}
|
||||
}
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
@ -72,7 +74,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) {
|
|||
if (asic_cmd & 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 21:
|
||||
return 0;
|
||||
}
|
||||
|
@ -265,6 +267,7 @@ u32 leoChk_err_retry(u32 sense) {
|
|||
switch (sense) {
|
||||
case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED:
|
||||
unit_atten |= 2;
|
||||
FALLTHROUGH;
|
||||
case LEO_SENSE_DIAGNOSTIC_FAILURE:
|
||||
case LEO_SENSE_COMMAND_PHASE_ERROR:
|
||||
case LEO_SENSE_WAITING_NMI:
|
||||
|
@ -278,8 +281,10 @@ u32 leoChk_err_retry(u32 sense) {
|
|||
switch (sense) {
|
||||
case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED:
|
||||
unit_atten |= 2;
|
||||
FALLTHROUGH;
|
||||
case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED:
|
||||
unit_atten |= 1;
|
||||
FALLTHROUGH;
|
||||
case LEO_SENSE_DIAGNOSTIC_FAILURE:
|
||||
case LEO_SENSE_COMMAND_PHASE_ERROR:
|
||||
case LEO_SENSE_WAITING_NMI:
|
||||
|
|
|
@ -78,6 +78,7 @@ void leoSetTimer(void) {
|
|||
LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION;
|
||||
return;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case 1:
|
||||
// Month value cannot be 0
|
||||
if (temp == 0) {
|
||||
|
@ -85,6 +86,7 @@ void leoSetTimer(void) {
|
|||
LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION;
|
||||
return;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
// Verify max value of each time info
|
||||
if (ymdupper[ymd] < temp) {
|
||||
|
|
|
@ -58,7 +58,7 @@ void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlReloc
|
|||
u32 dbg;
|
||||
s32 relocOffset = 0;
|
||||
u32 relocatedValue = 0;
|
||||
uintptr_t unrelocatedAddress = 0;
|
||||
UNUSED_NDEBUG uintptr_t unrelocatedAddress = 0;
|
||||
uintptr_t relocatedAddress = 0;
|
||||
uintptr_t vramu32 = (uintptr_t)vramStart;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ u32 StackCheck_Check(StackEntry* entry) {
|
|||
return ret;
|
||||
} else {
|
||||
u32* last;
|
||||
u32 used;
|
||||
UNUSED_NDEBUG u32 used;
|
||||
u32 free;
|
||||
u32 ret;
|
||||
|
||||
|
@ -143,7 +143,7 @@ u32 StackCheck_Check(StackEntry* entry) {
|
|||
|
||||
u32 StackCheck_GetState(StackEntry* entry) {
|
||||
u32* last;
|
||||
u32 used;
|
||||
UNUSED_NDEBUG u32 used;
|
||||
u32 free;
|
||||
u32 ret;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) {
|
||||
OSTime time;
|
||||
UNUSED OSTime time;
|
||||
#if !PLATFORM_N64
|
||||
OSTimer* next;
|
||||
u32 count;
|
||||
|
|
|
@ -1146,6 +1146,8 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) {
|
|||
sKillBari++;
|
||||
if ((this->actor.colorFilterTimer != 0) && !(this->actor.colorFilterParams & 0x4000)) {
|
||||
this->invincibilityTimer = this->actor.colorFilterTimer - 5;
|
||||
//! @bug This condition is always false as this->invincibilityTimer is an s8 so can never
|
||||
//! be larger than 160.
|
||||
if (this->invincibilityTimer > 160) {
|
||||
this->invincibilityTimer = 0;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,8 @@ s32 DemoGj_FindGanon(DemoGj* this, PlayState* play) {
|
|||
PRINTF("Demo_Gj_Search_Boss_Ganon %d:ガノン発見出来ず\n", this->dyna.actor.params);
|
||||
return false;
|
||||
}
|
||||
//! @bug: Missing return value when `this->ganon` is already set.
|
||||
//! @bug Missing return value when `this->ganon` is already set. No caller uses the return value
|
||||
//! so it doesn't matter.
|
||||
}
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
|
|
|
@ -834,6 +834,8 @@ s32 EnKo_ChildStart(EnKo* this, PlayState* play) {
|
|||
case ENKO_TYPE_CHILD_FADO:
|
||||
return func_80A97E18(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
s32 EnKo_ChildStone(EnKo* this, PlayState* play) {
|
||||
|
@ -865,6 +867,8 @@ s32 EnKo_ChildStone(EnKo* this, PlayState* play) {
|
|||
case ENKO_TYPE_CHILD_FADO:
|
||||
return func_80A97E18(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
s32 EnKo_ChildSaria(EnKo* this, PlayState* play) {
|
||||
|
@ -896,6 +900,8 @@ s32 EnKo_ChildSaria(EnKo* this, PlayState* play) {
|
|||
case ENKO_TYPE_CHILD_FADO:
|
||||
return func_80A97E18(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) {
|
||||
|
@ -927,6 +933,8 @@ s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) {
|
|||
case ENKO_TYPE_CHILD_FADO:
|
||||
return func_80A97E18(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
s32 EnKo_AdultSaved(EnKo* this, PlayState* play) {
|
||||
|
@ -958,7 +966,10 @@ s32 EnKo_AdultSaved(EnKo* this, PlayState* play) {
|
|||
case ENKO_TYPE_CHILD_FADO:
|
||||
return func_80A97E18(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void func_80A9877C(EnKo* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
|
@ -1136,6 +1147,8 @@ s32 func_80A98ECC(EnKo* this, PlayState* play) {
|
|||
case ENKO_FQS_ADULT_SAVED:
|
||||
return EnKo_AdultSaved(this, play);
|
||||
}
|
||||
// Note this function assumes the kokiri type is valid
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void EnKo_Init(Actor* thisx, PlayState* play) {
|
||||
|
|
|
@ -563,7 +563,9 @@ s32 EnSt_DecrStunTimer(EnSt* this) {
|
|||
if (this->stunTimer == 0) {
|
||||
return 0;
|
||||
}
|
||||
this->stunTimer--; //! @bug no return but v0 ends up being stunTimer before decrement
|
||||
this->stunTimer--;
|
||||
//! @bug No return, v0 ends up being stunTimer before decrement.
|
||||
//! The return value is not used so it doesn't matter.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,7 +111,7 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) {
|
|||
this->unk_3D8.zw = 0.0f;
|
||||
this->unk_3D8.ww = 1.0f;
|
||||
Matrix_MtxFToYXZRotS(&this->unk_3D8, &this->actor.world.rot, 0);
|
||||
//! @bug: Does not return.
|
||||
//! @bug Does not return, but the return value is not used by any caller so it doesn't matter.
|
||||
}
|
||||
|
||||
CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) {
|
||||
|
|
|
@ -651,7 +651,7 @@ void EnfHG_Retreat(EnfHG* this, PlayState* play) {
|
|||
BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent;
|
||||
s16 paintingIdxReal;
|
||||
s16 paintingIdxFake;
|
||||
Actor* child;
|
||||
UNUSED_NDEBUG Actor* child;
|
||||
|
||||
if (this->actor.params != GND_REAL_BOSS) {
|
||||
this->killActor = true;
|
||||
|
|
|
@ -1700,7 +1700,6 @@ BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) {
|
|||
this->speedXZ = 0.0f;
|
||||
}
|
||||
|
||||
// return type can't be void due to regalloc in func_8083F72C
|
||||
BAD_RETURN(s32) func_80832224(Player* this) {
|
||||
Player_ZeroSpeedXZ(this);
|
||||
this->unk_6AD = 0;
|
||||
|
@ -12117,7 +12116,9 @@ void Player_Update(Actor* thisx, PlayState* play) {
|
|||
|
||||
Player_UpdateCommon(this, play, &input);
|
||||
|
||||
#if DEBUG_FEATURES
|
||||
skip_update:;
|
||||
#endif
|
||||
{
|
||||
s32 pad;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void FileSelect_SetKeyboardVtx(GameState* thisx) {
|
|||
phi_s1 = 0x26;
|
||||
|
||||
#if OOT_NTSC
|
||||
for (phi_t2 = 0, phi_s2 = 0, phi_t3 = 0; phi_s2 < 5; phi_s2++) {
|
||||
for (phi_s2 = 0, phi_t3 = 0; phi_s2 < 5; phi_s2++) {
|
||||
for (phi_t0 = -0x60, phi_t1 = 0; phi_t1 < 13; phi_t1++, phi_t3 += 4) {
|
||||
this->keyboardVtx[phi_t3].v.ob[0] = this->keyboardVtx[phi_t3 + 2].v.ob[0] = phi_t0;
|
||||
this->keyboardVtx[phi_t3 + 1].v.ob[0] = this->keyboardVtx[phi_t3 + 3].v.ob[0] = phi_t0 + 12;
|
||||
|
@ -1747,13 +1747,21 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
|
|||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
|
||||
}
|
||||
|
||||
#ifndef AVOID_UB
|
||||
//! @bug Mistakenly using sOptionsMenuHeaders instead of sOptionsMenuSettings for the height.
|
||||
//! This is also an OOB read that happens to access the height of the first two elements in
|
||||
//! sOptionsMenuSettings, and since all heights are 16, it works out anyway.
|
||||
#define sOptionsMenuSettingsBug sOptionsMenuHeaders
|
||||
#else
|
||||
// Avoid UB: Use the correct array for the heights to avoid reading out of bounds memory that may not
|
||||
// happen to work out nicely.
|
||||
#define sOptionsMenuSettingsBug sOptionsMenuSettings
|
||||
#endif
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
|
||||
G_IM_SIZ_8b, OPTIONS_MENU_TEXTURE_WIDTH(sOptionsMenuSettings[i]),
|
||||
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuSettingsBug[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
#undef sOptionsMenuSettingsBug
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
|
||||
}
|
||||
#else
|
||||
|
@ -1786,10 +1794,21 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
|
|||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
|
||||
}
|
||||
|
||||
#ifndef AVOID_UB
|
||||
//! @bug Mistakenly using sOptionsMenuHeaders instead of sOptionsMenuSettings for the height.
|
||||
//! This is also an OOB read that happens to access the height of up to the first three elements
|
||||
//! in sOptionsMenuSettings, and since all heights are 16, it works out anyway.
|
||||
#define sOptionsMenuSettingsBug sOptionsMenuHeaders
|
||||
#else
|
||||
// Avoid UB: Use the correct array for the heights to avoid reading out of bounds memory that may not
|
||||
// happen to work out nicely.
|
||||
#define sOptionsMenuSettingsBug sOptionsMenuSettings
|
||||
#endif
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
|
||||
G_IM_SIZ_8b, sZTargetSettingWidths[j][gSaveContext.language],
|
||||
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuSettingsBug[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
#undef sOptionsMenuSettingsBug
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue