Fix display list offset values and unhandled opcodes (#4618)

* Fix display list offset values and unhandled opcodes

* fix unknown opcodes on custom chest textures
This commit is contained in:
Archez 2024-12-05 11:00:39 -05:00 committed by GitHub
parent c3e4579cba
commit 276db580e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 2 deletions

View File

@ -179,7 +179,8 @@ void func_808BA2CC(BgTokiHikari* this, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10);
// SOH [Port] Index adjust 11 -> 14 (for LUS marker and gsSPVertex) to account for our extraction size changes
gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10 + 2 + 1);
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -737,6 +737,8 @@ void EnBox_CreateExtraChestTextures() {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasGreenTreasureChestSideAndTopTex),
};
Gfx gNoOp[] = { gsDPNoOp() };
Gfx* frontCmd = ResourceMgr_LoadGfxByName(gTreasureChestChestFrontDL);
int frontIndex = 0;
while (frontCmd->words.w0 >> 24 != G_ENDDL) {
@ -745,6 +747,20 @@ void EnBox_CreateExtraChestTextures() {
gKeyTreasureChestChestFrontDL[frontIndex] = *frontCmd;
gChristmasRedTreasureChestChestFrontDL[frontIndex] = *frontCmd;
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = *frontCmd;
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
// OTR filepath opcode below
if (frontCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
frontIndex++;
++frontCmd;
gSkullTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gGoldTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gKeyTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gChristmasRedTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
}
frontIndex++;
++frontCmd;
}
@ -783,6 +799,20 @@ void EnBox_CreateExtraChestTextures() {
gKeyTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
// OTR filepath opcode below
if (sideCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
sideIndex++;
++sideCmd;
gSkullTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gGoldTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gKeyTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
}
sideIndex++;
++sideCmd;
}

View File

@ -108,7 +108,8 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_XLU_DISP++, sMaterial2DL);
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1,
scroll * (-1), scroll, 32, 32));
gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11);
// SOH [Port] Index adjust 11 -> 14 (for LUS marker and load texture) to account for our extraction size changes
gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11 + 2 + 1);
CLOSE_DISPS(play->state.gfxCtx);
}