Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc Fixes #1778

Merged
merged 8 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/audio/lib/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,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) {
Expand All @@ -458,7 +459,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
if (instrument->normalRangeHi != 0x7F) {
return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId);
}
// TODO: is this missing return UB?
//! @bug Missing return, but the return value is never used so it's fine.
} else if (instId == 0x7F) {
Drum* drum = AudioPlayback_GetDrum(fontId, drumId);

Expand All @@ -468,7 +469,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
AudioLoad_SyncLoadSample(drum->tunedSample.sample, fontId);
return 0;
}
// TODO: is this missing return UB?
//! @bug Missing return, but the return value is never used so it's fine.
}

void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
Expand Down Expand Up @@ -561,10 +562,10 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2) {

gAudioCtx.seqPlayers[playerIndex].skipTicks = 0;
AudioLoad_SyncInitSeqPlayerInternal(playerIndex, 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 playerIndex, s32 seqId, s32 skipTicks) {
Expand All @@ -574,7 +575,7 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTic

gAudioCtx.seqPlayers[playerIndex].skipTicks = skipTicks;
AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, 0);
// Missing return, see above.
//! @bug Missing return, see comment in AudioLoad_SyncInitSeqPlayer above.
}

s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) {
Expand Down
2 changes: 1 addition & 1 deletion src/audio/voice_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16
}

// Unused
s32 func_801A541C(s32 analog, s32 digital) {
void func_801A541C(s32 analog, s32 digital) {
s32 errorCode;
OSMesgQueue* serialEventQueue;

Expand Down
4 changes: 2 additions & 2 deletions src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2161,7 +2161,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) {
(GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) &&
(GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) {

if ((gSaveContext.buttonStatus[i] == BTN_ENABLED)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
restoreHudVisibility = true;
gSaveContext.buttonStatus[i] = BTN_DISABLED;
}
Expand All @@ -2176,7 +2176,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) {
(GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) &&
(GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) {

if ((gSaveContext.buttonStatus[i] == BTN_DISABLED)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
restoreHudVisibility = true;
gSaveContext.buttonStatus[i] = BTN_ENABLED;
}
Expand Down
23 changes: 11 additions & 12 deletions src/overlays/actors/ovl_En_Test7/z_en_test7.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ void EnTest7_UpdateFeatherType2(PlayState* play, OwlWarpFeather* feather) {
}

void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7* this, s32 arg3, s32 arg4) {
s32 pad[4];
OwlWarpFeather* feather;
s16 phi_s1;
s32 pad;
s32 i;
f32 temp_f28;
Vec3f sp8C;
f32 temp_f0;
f32 temp_f22;
f32 temp_f24;
f32 temp_f26;
f32 temp_f2;
Vec3f sp8C;
OwlWarpFeather* feather;
s16 phi_s1;

for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather));
i += sizeof(OwlWarpFeather), feather++) {
for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) {
feather = &feathers[i];

if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) {
continue;
Expand Down Expand Up @@ -306,12 +306,8 @@ void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7*
}

void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) {
s32 pad[3];
PlayState* play = play2;
Mtx* mtx;
OwlWarpFeather* feather;
s32 i;
MtxF sp6C;

OPEN_DISPS(play->state.gfxCtx);

Expand All @@ -322,8 +318,11 @@ void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255);

for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather));
i += sizeof(OwlWarpFeather), feather++) {
for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) {
Mtx* mtx;
MtxF sp6C;
OwlWarpFeather* feather = &feathers[i];

if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) {
continue;
}
Expand Down
18 changes: 5 additions & 13 deletions src/overlays/actors/ovl_Obj_Um/z_obj_um.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,10 +1876,10 @@ void ObjUm_SpawnFragments(PlayState* play, Vec3f* potPos) {
}
}

void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
void ObjUm_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
PlayState* play = play2;
ObjUm* this = (ObjUm*)thisx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
Mtx* mtx;
GraphicsContext* gfxCtx = play2->state.gfxCtx;
Gfx* spFC[] = {
NULL, gUmBrokenMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, object_um_DL_0067C0
};
Expand All @@ -1905,15 +1905,11 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
}

if (limbIndex == UM_LIMB_WAGON_CART_BED) {
Vec3f* potPos;
Mtx* mtx;
Vec3f sp88;
Vec3s sp80;
s32 i;
f32 sp70[] = { 2000.0f, 0.0f, -2000.0f };
s32 pad;

//! FAKE:
if (i) {}

sp80.x = 0;
sp80.z = 0;
Expand All @@ -1934,9 +1930,8 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Matrix_Push();
Matrix_TranslateRotateZYX(&sp88, &sp80);
mtx = Matrix_Finalize(gfxCtx);
potPos = &this->potPos[i];
Matrix_MultVec3f(&spC0, &calcPotPos);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, potPos, &spB0);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, &this->potPos[i], &spB0);

if (this->wasPotHit[i]) {
this->wasPotHit[i] = false;
Expand All @@ -1953,9 +1948,6 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
return;
}

//! FAKE:
if (play) {}

gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

if (spFC[this->potsLife[i]] != NULL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) {
// Find the region that player is currently in
// Loop over region (n) and regionIndex (j)
while (true) {
if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) {
if (gSceneIdsPerRegion[n][j] == 0xFFFF) {
n++;
j = 0;
if (n == REGION_MAX) {
Expand Down