Fix: Various PAL1.1 asset offsets and Main Menu options screen (#3045)

* fix pal11 ganondorf falling platform offsets

* fix pal11 dins fire offsets

* add game region and platform methods

* fix pal11 file menu options

* move
This commit is contained in:
Adam Bird 2023-07-03 10:29:06 -04:00 committed by GitHub
parent 531b346fc9
commit b7dca5d5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 104 additions and 20 deletions

View File

@ -1,8 +1,8 @@
<Root> <Root>
<File Name="ovl_Bg_Ganon_Otyuka" BaseAddress="0x80A54D80" RangeStart="0x1100" RangeEnd="0x259C"> <File Name="ovl_Bg_Ganon_Otyuka" BaseAddress="0x80A54D80" RangeStart="0x1110" RangeEnd="0x24EC">
<Texture Name="sPlatformTex" OutName="platform_tex" Format="rgba16" Width="32" Height="32" Offset="0x1100"/> <Texture Name="sPlatformTex" OutName="platform_tex" Format="rgba16" Width="32" Height="32" Offset="0x1110"/>
<Array Name="sPlatformTopVtx" Count="4" Offset="0x1908"> <Array Name="sPlatformTopVtx" Count="4" Offset="0x1918">
<Vtx/> <Vtx/>
</Array> </Array>
<DList Name="sPlatformMaterialDL" Offset="0x1958"/> <DList Name="sPlatformMaterialDL" Offset="0x1958"/>

View File

@ -3,18 +3,20 @@
<Array Name="D_80811BB0" Count="24" Offset="0xF120" Static="Off"> <Array Name="D_80811BB0" Count="24" Offset="0xF120" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array>
<Array Name="D_80811D30" Count="16" Offset="0xF2A0" Static="Off"> <!-- German vertices are combined into one array -->
<Array Name="D_80811D30" Count="24" Offset="0xF2A0" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array>
<Array Name="D_80811E30" Count="16" Offset="0xF3A0" Static="Off"> <!-- <Array Name="D_80811E30" Count="16" Offset="0xF3A0" Static="Off">
<Vtx/>
</Array> -->
<!-- German vertices are combined into one array -->
<Array Name="D_80811F30" Count="40" Offset="0xF420" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array>
<Array Name="D_80811F30" Count="32" Offset="0xF4A0" Static="Off"> <!-- <Array Name="D_80812130" Count="32" Offset="0xF6A0" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array> -->
<Array Name="D_80812130" Count="32" Offset="0xF6A0" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerTopVtx" Count="4" Offset="0xF8A0" Static="Off"> <Array Name="gOptionsDividerTopVtx" Count="4" Offset="0xF8A0" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array>
@ -24,5 +26,6 @@
<Array Name="gOptionsDividerBottomVtx" Count="4" Offset="0xF920" Static="Off"> <Array Name="gOptionsDividerBottomVtx" Count="4" Offset="0xF920" Static="Off">
<Vtx/> <Vtx/>
</Array> </Array>
<!-- OTRTODO: Vertices for Choose Language header, options, and divider -->
</File> </File>
</Root> </Root>

View File

@ -1,10 +1,10 @@
<Root> <Root>
<File Name="ovl_Magic_Fire" BaseAddress="0x8095E690" RangeStart="0x600" RangeEnd="0x21E0"> <File Name="ovl_Magic_Fire" BaseAddress="0x8095E690" RangeStart="0xB20" RangeEnd="0x2170">
<Texture Name="sTex" OutName="dins_fire" Format="i8" Width="64" Height="64" Offset="0xB50"/> <Texture Name="sTex" OutName="dins_fire" Format="i8" Width="64" Height="64" Offset="0xB20"/>
<Array Name="sSphereVtx" Count="76" Offset="0x1B50"> <Array Name="sSphereVtx" Count="76" Offset="0x1B20">
<Vtx/> <Vtx/>
</Array> </Array>
<DList Name="sMaterialDL" Offset="0x2010"/> <DList Name="sMaterialDL" Offset="0x1FE0"/>
<DList Name="sModelDL" Offset="0x2038"/> <DList Name="sModelDL" Offset="0x2008"/>
</File> </File>
</Root> </Root>

View File

@ -1030,6 +1030,52 @@ extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index];
} }
extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index];
switch (version) {
case OOT_NTSC_US_10:
case OOT_NTSC_US_11:
case OOT_NTSC_US_12:
case OOT_PAL_10:
case OOT_PAL_11:
return GAME_PLATFORM_N64;
case OOT_NTSC_JP_GC:
case OOT_NTSC_US_GC:
case OOT_PAL_GC:
case OOT_NTSC_JP_MQ:
case OOT_NTSC_US_MQ:
case OOT_PAL_MQ:
case OOT_PAL_GC_DBG1:
case OOT_PAL_GC_DBG2:
case OOT_PAL_GC_MQ_DBG:
return GAME_PLATFORM_GC;
}
}
extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index];
switch (version) {
case OOT_NTSC_US_10:
case OOT_NTSC_US_11:
case OOT_NTSC_US_12:
case OOT_NTSC_JP_GC:
case OOT_NTSC_US_GC:
case OOT_NTSC_JP_MQ:
case OOT_NTSC_US_MQ:
return GAME_REGION_NTSC;
case OOT_PAL_10:
case OOT_PAL_11:
case OOT_PAL_GC:
case OOT_PAL_MQ:
case OOT_PAL_GC_DBG1:
case OOT_PAL_GC_DBG2:
case OOT_PAL_GC_MQ_DBG:
return GAME_REGION_PAL;
}
}
uint32_t IsSceneMasterQuest(s16 sceneNum) { uint32_t IsSceneMasterQuest(s16 sceneNum) {
uint32_t value = 0; uint32_t value = 0;
uint8_t mqMode = CVarGetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_OFF); uint8_t mqMode = CVarGetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_OFF);

View File

@ -6,6 +6,12 @@
#include "SaveManager.h" #include "SaveManager.h"
#include <soh/Enhancements/item-tables/ItemTableTypes.h> #include <soh/Enhancements/item-tables/ItemTableTypes.h>
#define GAME_REGION_NTSC 0
#define GAME_REGION_PAL 1
#define GAME_PLATFORM_N64 0
#define GAME_PLATFORM_GC 1
#ifdef __cplusplus #ifdef __cplusplus
#include <Context.h> #include <Context.h>
#include "Enhancements/savestates.h" #include "Enhancements/savestates.h"
@ -59,6 +65,8 @@ uint32_t ResourceMgr_GameHasMasterQuest();
uint32_t ResourceMgr_GameHasOriginal(); uint32_t ResourceMgr_GameHasOriginal();
uint32_t ResourceMgr_GetNumGameVersions(); uint32_t ResourceMgr_GetNumGameVersions();
uint32_t ResourceMgr_GetGameVersion(int index); uint32_t ResourceMgr_GetGameVersion(int index);
uint32_t ResourceMgr_GetGamePlatform(int index);
uint32_t ResourceMgr_GetGameRegion(int index);
void ResourceMgr_LoadDirectory(const char* resName); void ResourceMgr_LoadDirectory(const char* resName);
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize); char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
uint8_t ResourceMgr_FileExists(const char* resName); uint8_t ResourceMgr_FileExists(const char* resName);

View File

@ -909,7 +909,13 @@ void FileChoose_DrawOptionsImpl(GameState* thisx) {
} }
} }
if (gSaveContext.language == LANGUAGE_GER) { uint8_t versionIndex = ResourceMgr_GameHasMasterQuest() && ResourceMgr_GameHasOriginal();
uint8_t isPalN64 = ResourceMgr_GetGameRegion(versionIndex) == GAME_REGION_PAL &&
ResourceMgr_GetGamePlatform(versionIndex) == GAME_PLATFORM_N64;
uint8_t isPalGC = ResourceMgr_GetGameRegion(versionIndex) == GAME_REGION_PAL &&
ResourceMgr_GetGamePlatform(versionIndex) == GAME_PLATFORM_GC;
if (gSaveContext.language == LANGUAGE_GER && isPalGC) {
gSPVertex(POLY_OPA_DISP++, D_80811E30, 32, 0); gSPVertex(POLY_OPA_DISP++, D_80811E30, 32, 0);
} else { } else {
gSPVertex(POLY_OPA_DISP++, D_80811D30, 32, 0); gSPVertex(POLY_OPA_DISP++, D_80811D30, 32, 0);
@ -926,14 +932,25 @@ void FileChoose_DrawOptionsImpl(GameState* thisx) {
G_IM_SIZ_8b, gOptionsMenuHeaders[i].width[gSaveContext.language], G_IM_SIZ_8b, gOptionsMenuHeaders[i].width[gSaveContext.language],
gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 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); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (i == 2 && gSaveContext.language == LANGUAGE_GER && isPalN64) {
// Pal N64 German vertex for Z target header are offset by 12 vertices
gSP1Quadrangle(POLY_OPA_DISP++, vtx + 12, vtx + 2 + 12, vtx + 3 + 12, vtx + 1 + 12, 0);
} else {
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
} }
}
if (gSaveContext.language == LANGUAGE_GER) { if (gSaveContext.language == LANGUAGE_GER && isPalGC) {
gSPVertex(POLY_OPA_DISP++, D_80812130, 32, 0); gSPVertex(POLY_OPA_DISP++, D_80812130, 32, 0);
} else {
// PAL N64 has extra german vertices combined in the regular array instead of a dedicated array
if (isPalN64) {
gSPVertex(POLY_OPA_DISP++, D_80811F30, 40, 0);
} else { } else {
gSPVertex(POLY_OPA_DISP++, D_80811F30, 32, 0); gSPVertex(POLY_OPA_DISP++, D_80811F30, 32, 0);
} }
}
for (i = 0, vtx = 0; i < 4; i++, vtx += 4) { for (i = 0, vtx = 0; i < 4; i++, vtx += 4) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
@ -979,8 +996,18 @@ void FileChoose_DrawOptionsImpl(GameState* thisx) {
G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language], G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language],
gOptionsMenuSettings[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, gOptionsMenuSettings[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); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
// Pal N64 German vertices for z target options are offset an by 8
if (gSaveContext.language == LANGUAGE_GER && isPalN64) {
gSP1Quadrangle(POLY_OPA_DISP++, vtx + 8, vtx + 2 + 8, vtx + 3 + 8, vtx + 1 + 8, 0);
} else {
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
} }
}
// Pal N64 needs to skip over the extra german vertices to get to brightness vertices
if (isPalN64) {
vtx += 8;
}
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);