1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-01 23:36:00 +00:00

avoid_ub in DmaMgr_GetFileNameImpl

This commit is contained in:
fig02 2022-02-11 20:38:22 -05:00
parent 7e0b72998d
commit cbddf7146d
3 changed files with 11 additions and 8 deletions

View file

@ -210,6 +210,9 @@ const char* DmaMgr_GetFileNameImpl(u32 vrom) {
}
//! @bug Since there is no return, in case the file isn't found, the return value will be a pointer to the end
// of gDmaDataTable
#ifdef AVOID_UB
return (const char*)iter;
#endif
}
const char* DmaMgr_GetFileName(u32 vrom) {

View file

@ -712,21 +712,21 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
eyeIndex = sEyeMouthIndexes[face][0];
}
#ifdef AVOID_UB
#ifdef AVOID_UB
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[gSaveContext.linkAge][eyeIndex]));
#else
#else
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyeIndex]));
#endif
#endif
if (mouthIndex < 0) {
mouthIndex = sEyeMouthIndexes[face][1];
}
#ifdef AVOID_UB
#ifdef AVOID_UB
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[gSaveContext.linkAge][mouthIndex]));
#else
#else
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[mouthIndex]));
#endif
#endif
color = &sTunicColors[tunic];
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);

View file

@ -457,10 +457,10 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, G
//! is section padding between .text and .data, so 0 gets read as a float.
//! Other compilers can shift things and result in a crash. Defining `AVOID_UB` will remove these function calls
//! entirely as they are dead code and do not have any effect.
#ifndef AVOID_UB
#ifndef AVOID_UB
Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[nextPlatform]);
Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[altNextPlatform]);
#endif
#endif
if (altNextPlatform > 0) {
s16 nextPlatformToPlayerYaw =