diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2023-11-14 08:46:22 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 22:46:22 +1100 |
| commit | 3d150f3e1d84259b05f2831be35fa6fd38e43232 (patch) | |
| tree | e737c09137a04cdac7b15d0e190d6ca3b3fd0503 /src/overlays | |
| parent | 60ddc5891e1cdef2e32f695c96e60344d7a51c26 (diff) | |
Misc fixes 1 (#1491)
* Some low-hanging UB
* document bug on z_file_nameset_NES.c
* ALIGNED on audio data
* document bug on decode
* document bugs on Message_Decode
* Format
* More ALIGNED
* Put the ALIGNED macro at the right like the other uses in the repo
* review
* fix Message Decode
(cherry picked from commit abfbc7068816756f7ea3fa4a36ee0fe664c54c72)
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
* remove comments
* Update src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
* format
---------
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'src/overlays')
5 files changed, 13 insertions, 9 deletions
diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c index c2c08bfe6..88c049633 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c @@ -110,7 +110,7 @@ s32 func_80A50E40(EnDnh* this, PlayState* play) { return 1; } -s32 func_80A50EC0(EnDnh* this) { +void func_80A50EC0(EnDnh* this) { if (DECR(this->blinkTimer) == 0) { this->eyeTexIndex++; if (this->eyeTexIndex >= ARRAY_COUNT(sEyeTextures)) { diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index c667753e6..3993a9c91 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -261,6 +261,8 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { } break; } + + //! @bug: sp32 may be used uninitialized Matrix_RotateYS(sp32, MTXMODE_NEW); Matrix_MultVecZ(this->actor.speed, &this->actor.velocity); this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 12.0f; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 4fa177013..5386d415e 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -274,7 +274,7 @@ s32 D_80A41D5C; s32 D_80A41D60; s32 D_80A41D64; s32 D_80A41D68; -Vec3f* D_80A41D6C; +Vec3f* sKafeiCurBodyPartPos; s32 func_80A3E7E0(EnTest3* this, EnTest3ActionFunc actionFunc) { if (actionFunc == this->unk_D94) { @@ -1098,7 +1098,7 @@ s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnTest3* this = THIS; if (limbIndex == KAFEI_LIMB_ROOT) { - D_80A41D6C = &this->player.bodyPartsPos[-1]; + sKafeiCurBodyPartPos = &this->player.bodyPartsPos[0] - 1; if (!(this->player.skelAnime.moveFlags & ANIM_FLAG_4) || (this->player.skelAnime.moveFlags & ANIM_FLAG_1)) { pos->x *= this->player.ageProperties->unk_08; pos->z *= this->player.ageProperties->unk_08; @@ -1118,7 +1118,7 @@ s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* } } else { if (*dList != NULL) { - D_80A41D6C++; + sKafeiCurBodyPartPos++; } if (D_80A418C8) { *dList = NULL; @@ -1153,13 +1153,13 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL EnTest3* this = THIS; if (*dList2 != NULL) { - Matrix_MultZero(D_80A41D6C); + Matrix_MultZero(sKafeiCurBodyPartPos); } if (limbIndex == KAFEI_LIMB_LEFT_HAND) { MtxF curMtxF; Actor* leftHandActor; - Math_Vec3f_Copy(&this->player.leftHandWorld.pos, D_80A41D6C); + Math_Vec3f_Copy(&this->player.leftHandWorld.pos, sKafeiCurBodyPartPos); if (*dList1 != NULL) { func_80128640(play, &this->player, *dList1); if (this->player.stateFlags3 & PLAYER_STATE3_20000000) { diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 9ec0a396f..fa1edaf6b 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -2452,9 +2452,9 @@ void FileSelect_InitContext(GameState* thisx) { this->nameBoxAlpha[2] = this->nameAlpha[0] = this->nameAlpha[1] = this->nameAlpha[2] = this->connectorAlpha[0] = this->connectorAlpha[1] = this->connectorAlpha[2] = this->fileInfoAlpha[0] = this->fileInfoAlpha[1] = this->fileInfoAlpha[2] = this->actionButtonAlpha[FS_BTN_ACTION_COPY] = - this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->actionButtonAlpha[2] = - this->actionButtonAlpha[3] = this->optionButtonAlpha = this->nameEntryBoxAlpha = - this->controlsAlpha = this->emptyFileTextAlpha = 0; + this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->confirmButtonAlpha[FS_BTN_CONFIRM_YES] = + this->confirmButtonAlpha[FS_BTN_CONFIRM_QUIT] = this->optionButtonAlpha = + this->nameEntryBoxAlpha = this->controlsAlpha = this->emptyFileTextAlpha = 0; this->windowPosX = 6; this->actionTimer = 4; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index e61512695..005fc7eb9 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -1027,6 +1027,8 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } + //! @bug the gOptionsMenuHeaders usage here will produce an OoB read for i == 5. It reads the first element of + //! `gOptionsMenuSettings` gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuSettings[i].texture, G_IM_FMT_IA, G_IM_SIZ_8b, gOptionsMenuSettings[i].width, gOptionsMenuHeaders[i].height, 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); |
