1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Fix misc 21 (#1573)

* Make `sNew` in (unused) `code_800FC620.c` a string

It is passed as a filename to `__osMallocDebug` so should be a nul-terminated string, not a char[3] missing an explicit \0

* Fix gcc warning in `JpegDecoder_ParseNextSymbol` about SLL on negative value

-1U is an unsigned value, aka 0xFFFFFFFF
I keep -1 because it seems that's what a jpeg standard has too

References:
https://stackoverflow.com/questions/40508958/shifting-a-negative-signed-value-is-undefined
https://www.w3.org/Graphics/JPEG/itu-t81.pdf (page 105, figure F.12)

* Small cleanup

* Fix few mistakes (thanks gcc warnings)

* Add `@bug` in file select settings draw code, using the wrong array

* format

* format main

* rename arg for a happy formatter

* Move important function call out of a printf
This commit is contained in:
Dragorn421 2023-11-12 22:59:52 +01:00 committed by GitHub
parent dc323052c3
commit 4c75260097
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 47 additions and 39 deletions

View file

@ -84,7 +84,7 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) {
curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params);
this->actor.child = NULL;
if (&curCobraInfo->cobra->dyna.actor == NULL) {
if (curCobraInfo->cobra == NULL) {
// "Cobra generation failed"
osSyncPrintf("Error : コブラ発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 221);
}

View file

@ -2522,8 +2522,8 @@ s32 BossGanon2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
}
if (limbIndex >= GANON_LIMB_TAIL1) {
rot->x += this->unk_2F4[limbIndex] + this->unk_346;
rot->y += this->unk_2FE[limbIndex];
rot->x += this->unk_348[limbIndex - GANON_LIMB_TAIL1] + this->unk_346;
rot->y += this->unk_352[limbIndex - GANON_LIMB_TAIL1];
if (this->unk_342 & 1) {
gDPSetEnvColor(POLY_OPA_DISP++, 255, 0, 0, 255);

View file

@ -152,7 +152,7 @@ static InitChainEntry sInitChain[] = {
};
// possibly color data
static s32 sUnused[] = { 0xFFFFFFFF, 0x969696FF };
static u32 sUnused[] = { 0xFFFFFFFF, 0x969696FF };
void EnBigokuta_Init(Actor* thisx, PlayState* play) {
EnBigokuta* this = (EnBigokuta*)thisx;

View file

@ -776,19 +776,19 @@ void EnFr_CheckOcarinaInputFrogSong(u8 ocarinaNote) {
s32 frogIndex;
switch (ocarinaNote) {
case 0:
case OCARINA_BTN_A:
frogIndexButterfly = FROG_BLUE;
break;
case 1:
case OCARINA_BTN_C_DOWN:
frogIndexButterfly = FROG_YELLOW;
break;
case 2:
case OCARINA_BTN_C_RIGHT:
frogIndexButterfly = FROG_RED;
break;
case 3:
case OCARINA_BTN_C_LEFT:
frogIndexButterfly = FROG_PURPLE;
break;
case 4:
case OCARINA_BTN_C_UP:
frogIndexButterfly = FROG_WHITE;
}
// Turn on or off butterfly above frog

View file

@ -435,7 +435,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) {
tmp = this->unk_1A0[0].y;
if (tmp > 0) {
tmp += 0xFFFF0000;
tmp -= 0x10000;
}
this->unk_1E8 = tmp;
@ -446,7 +446,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) {
if (this->unk_19F == 5) {
tmp = this->unk_1A0[0].y;
if (tmp > 0) {
tmp += 0xFFFF0001;
tmp -= 0xFFFF;
}
this->unk_1E8 = tmp;
tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, 3640.0f, 0.001f);

View file

@ -1275,9 +1275,9 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve
if (limbIndex == 1 && (this->unk_199 & 0x40)) {
if (this->unk_19A >= 284) {
rot->x += (this->unk_19A * 0x1000) + 0xFFEE4000;
rot->x += (this->unk_19A * 0x1000) - 0x11C000;
} else {
rot->x += (this->unk_19A * 0x1000) + 0xFFFF1000;
rot->x += (this->unk_19A * 0x1000) - 0xF000;
}
}
if (this->unk_22E.a == 0 || limbIndex == 8 || (this->actionFunc == func_80ADAFC0 && this->unk_19A >= 8)) {

View file

@ -917,6 +917,8 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
//! @bug Mistakenly using sOptionsMenuHeaders instead of sOptionsMenuSettings for the height.
//! This works out anyway because all heights are 16.
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language],
sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
@ -941,6 +943,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
//! @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.
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language],
sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,