1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 01:34:18 +00:00

Match NTSC file select (#1998)

* Match NTSC file select

Co-authored-by: inspectredc <inspectredc@gmail.com>

* nes -> eng in macros

* Duplicate more code but use less #ifs

* Format

---------

Co-authored-by: inspectredc <inspectredc@gmail.com>
This commit is contained in:
cadmic 2024-08-07 21:27:02 -07:00 committed by GitHub
parent 29acf96db2
commit feac688313
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 832 additions and 103 deletions

View file

@ -3,25 +3,31 @@
<Array Name="D_80811BB0" Count="24" Offset="0x0" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811D30" Count="16" Offset="0x180" Static="Off">
<Array Name="gCharPageHira" Count="65" Offset="0x180" Static="Off">
<Scalar Type="s16"/>
</Array>
<Array Name="gCharPageKata" Count="65" Offset="0x204" Static="Off">
<Scalar Type="s16"/>
</Array>
<Array Name="gCharPageEng" Count="65" Offset="0x288" Static="Off">
<Scalar Type="s16"/>
</Array>
<Array Name="gNextCharPage" Count="9" Offset="0x30C" Static="Off">
<Scalar Type="s16"/>
</Array>
<Array Name="D_80811D30" Count="16" Offset="0x320" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811E30" Count="16" Offset="0x280" Static="Off">
<Array Name="D_80811F30" Count="32" Offset="0x420" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811F30" Count="32" Offset="0x380" Static="Off">
<Array Name="gOptionsDividerTopVtx" Count="4" Offset="0x620" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80812130" Count="32" Offset="0x580" Static="Off">
<Array Name="gOptionsDividerMiddleVtx" Count="4" Offset="0x660" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerTopVtx" Count="4" Offset="0x780" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerMiddleVtx" Count="4" Offset="0x7C0" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerBottomVtx" Count="4" Offset="0x800" Static="Off">
<Array Name="gOptionsDividerBottomVtx" Count="4" Offset="0x6A0" Static="Off">
<Vtx/>
</Array>
</File>

View file

@ -0,0 +1,31 @@
<Root>
<File Name="ovl_file_choose">
<Array Name="D_80811BB0" Count="24" Offset="0x0" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811D30" Count="16" Offset="0x180" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811E30" Count="16" Offset="0x280" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80811F30" Count="32" Offset="0x380" Static="Off">
<Vtx/>
</Array>
<Array Name="D_80812130" Count="32" Offset="0x580" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerTopVtx" Count="4" Offset="0x780" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerMiddleVtx" Count="4" Offset="0x7C0" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerBottomVtx" Count="4" Offset="0x800" Static="Off">
<Vtx/>
</Array>
<Array Name="gCharPageEng" Count="65" Offset="0x840" Static="Off">
<Scalar Type="s16"/>
</Array>
</File>
</Root>

View file

@ -956,9 +956,9 @@ assets:
start_offset: 0x780
end_offset: 0x4128
- name: overlays/ovl_file_choose
xml_path: assets/xml/overlays/ovl_file_choose.xml
xml_path: assets/xml/overlays/ovl_file_choose_pal.xml
start_offset: 0xDE70
end_offset: 0xE6B0
end_offset: 0xE740
- name: overlays/ovl_Magic_Dark
xml_path: assets/xml/overlays/ovl_Magic_Dark.xml
start_offset: 0xD10

View file

@ -940,9 +940,9 @@ assets:
start_offset: 0x6E0
end_offset: 0x4088
- name: overlays/ovl_file_choose
xml_path: assets/xml/overlays/ovl_file_choose.xml
xml_path: assets/xml/overlays/ovl_file_choose_pal.xml
start_offset: 0xD740
end_offset: 0xDF80
end_offset: 0xE010
- name: overlays/ovl_Magic_Dark
xml_path: assets/xml/overlays/ovl_Magic_Dark.xml
start_offset: 0xC90

View file

@ -940,9 +940,9 @@ assets:
start_offset: 0x6E0
end_offset: 0x4088
- name: overlays/ovl_file_choose
xml_path: assets/xml/overlays/ovl_file_choose.xml
xml_path: assets/xml/overlays/ovl_file_choose_pal.xml
start_offset: 0xD740
end_offset: 0xDF80
end_offset: 0xE010
- name: overlays/ovl_Magic_Dark
xml_path: assets/xml/overlays/ovl_Magic_Dark.xml
start_offset: 0xC90

View file

@ -940,8 +940,8 @@ assets:
end_offset: 0x4088
- name: overlays/ovl_file_choose
xml_path: assets/xml/overlays/ovl_file_choose.xml
start_offset: 0xD740
end_offset: 0xDF80
start_offset: 0xEC40
end_offset: 0xF320
- name: overlays/ovl_Magic_Dark
xml_path: assets/xml/overlays/ovl_Magic_Dark.xml
start_offset: 0xC90

View file

@ -17,6 +17,7 @@ def SignalHandler(sig, frame):
# Don't exit immediately to update the extracted assets file.
def ExtractFile(assetConfig: version_config.AssetConfig, outputPath: Path, outputSourcePath: Path):
name = assetConfig.name
xmlPath = assetConfig.xml_path
version = globalVersionConfig.version
if globalAbort.is_set():
@ -31,15 +32,15 @@ def ExtractFile(assetConfig: version_config.AssetConfig, outputPath: Path, outpu
execStr = f"{zapdPath} e -eh -i {xmlPath} -b extracted/{version}/baserom -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}"
if "code" in xmlPath.parts or "overlays" in xmlPath.parts:
if name.startswith("code/") or name.startswith("overlays/"):
assert assetConfig.start_offset is not None
assert assetConfig.end_offset is not None
execStr += f" --start-offset 0x{assetConfig.start_offset:X}"
execStr += f" --end-offset 0x{assetConfig.end_offset:X}"
if "overlays" in xmlPath.parts:
overlayName = xmlPath.stem
if name.startswith("overlays/"):
overlayName = name.split("/")[1]
baseAddress = globalVersionConfig.dmadata_segments[overlayName].vram + assetConfig.start_offset
execStr += f" --base-address 0x{baseAddress:X}"

View file

@ -249,9 +249,9 @@ extern struct GraphicsContext* __gfxCtx;
#endif /* OOT_DEBUG */
#if OOT_NTSC
#define LANGUAGE_ARRAY(jpn, nes, ger, fra) { jpn, nes }
#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { jpn, eng }
#else
#define LANGUAGE_ARRAY(jpn, nes, ger, fra) { nes, ger, fra }
#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { eng, ger, fra }
#endif
/**

View file

@ -207,7 +207,9 @@ typedef struct {
/* 0x000A4 */ Vtx* windowVtx;
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
#if OOT_PAL
/* 0x000B0 */ char unk_B0[0x8];
#endif
/* 0x000B8 */ View view;
/* 0x001E0 */ SramContext sramCtx;
/* 0x001E4 */ char unk_1E4[0x4];
@ -226,7 +228,9 @@ typedef struct {
/* 0x1CA1C */ u32 questItems[3];
/* 0x1CA28 */ s16 n64ddFlags[3];
/* 0x1CA2E */ s8 defense[3];
#if OOT_PAL
/* 0x1CA32 */ u16 health[3];
#endif
/* 0x1CA38 */ s16 buttonIndex;
/* 0x1CA3A */ s16 confirmButtonIndex; // 0: yes, 1: quit
/* 0x1CA3C */ s16 menuMode;

View file

@ -10,7 +10,9 @@
#define HEALTH_CAP offsetof(SaveContext, save.info.playerData.healthCapacity)
#define QUEST offsetof(SaveContext, save.info.inventory.questItems)
#define DEFENSE offsetof(SaveContext, save.info.inventory.defenseHearts)
#if OOT_PAL
#define HEALTH offsetof(SaveContext, save.info.playerData.health)
#endif
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
@ -726,13 +728,17 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
MemCpy(&fileSelect->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE, sizeof(fileSelect->defense[0]));
MemCpy(&fileSelect->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE, sizeof(fileSelect->defense[0]));
#if OOT_PAL
MemCpy(&fileSelect->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileSelect->health[0]));
MemCpy(&fileSelect->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileSelect->health[0]));
MemCpy(&fileSelect->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileSelect->health[0]));
#endif
PRINTF("f_64dd=%d, %d, %d\n", fileSelect->n64ddFlags[0], fileSelect->n64ddFlags[1], fileSelect->n64ddFlags[2]);
PRINTF("heart_status=%d, %d, %d\n", fileSelect->defense[0], fileSelect->defense[1], fileSelect->defense[2]);
#if OOT_PAL
PRINTF("now_life=%d, %d, %d\n", fileSelect->health[0], fileSelect->health[1], fileSelect->health[2]);
#endif
}
void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
@ -821,11 +827,15 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
MemCpy(&fileSelect->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD,
sizeof(fileSelect->n64ddFlags[0]));
MemCpy(&fileSelect->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE, sizeof(fileSelect->defense[0]));
#if OOT_PAL
MemCpy(&fileSelect->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH, sizeof(fileSelect->health[0]));
#endif
PRINTF("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]);
PRINTF("heart_status[%d]=%d\n", gSaveContext.fileNum, fileSelect->defense[gSaveContext.fileNum]);
#if OOT_PAL
PRINTF("now_life[%d]=%d\n", gSaveContext.fileNum, fileSelect->health[gSaveContext.fileNum]);
#endif
}
void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx) {
@ -879,8 +889,10 @@ void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) {
sizeof(fileSelect->n64ddFlags[0]));
MemCpy(&fileSelect->defense[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE,
sizeof(fileSelect->defense[0]));
#if OOT_PAL
MemCpy(&fileSelect->health[fileSelect->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH,
sizeof(fileSelect->health[0]));
#endif
PRINTF("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]);
PRINTF("heart_status[%d]=%d\n", gSaveContext.fileNum, fileSelect->defense[gSaveContext.fileNum]);
@ -903,22 +915,30 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
PRINTF("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
#if OOT_PAL
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
#endif
MemCpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
#if OOT_PAL
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
#endif
Sram_WriteSramHeader(sramCtx);
}
}
gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3;
gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1;
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
#if OOT_PAL
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = LANGUAGE_ENG;
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
}
#endif
#if OOT_DEBUG
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {

View file

@ -157,7 +157,13 @@ typedef enum {
typedef enum {
/* 0 */ FS_CHAR_PAGE_HIRA,
/* 1 */ FS_CHAR_PAGE_KATA,
/* 2 */ FS_CHAR_PAGE_ENG
/* 2 */ FS_CHAR_PAGE_ENG,
/* 3 */ FS_CHAR_PAGE_HIRA_TO_KATA,
/* 4 */ FS_CHAR_PAGE_KATA_TO_HIRA,
/* 5 */ FS_CHAR_PAGE_HIRA_TO_ENG,
/* 6 */ FS_CHAR_PAGE_ENG_TO_HIRA,
/* 7 */ FS_CHAR_PAGE_KATA_TO_ENG,
/* 8 */ FS_CHAR_PAGE_ENG_TO_KATA
} CharPage;
typedef enum {
@ -214,6 +220,4 @@ void FileSelect_DrawOptions(GameState* thisx);
void FileSelect_DrawNameEntry(GameState* thisx);
void FileSelect_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
extern s16 D_808123F0[];
#endif

View file

@ -189,7 +189,16 @@ void FileSelect_UpdateMainMenu(GameState* thisx) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->kbdButton = FS_KBD_BTN_NONE;
#if OOT_NTSC
this->charPage = FS_CHAR_PAGE_HIRA;
if (gSaveContext.language != LANGUAGE_JPN) {
this->charPage = FS_CHAR_PAGE_ENG;
}
#else
this->charPage = FS_CHAR_PAGE_ENG;
#endif
this->kbdX = 0;
this->kbdY = 0;
this->charIndex = 0;
@ -224,7 +233,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) {
this->nextTitleLabel = FS_TITLE_ERASE_FILE;
} else {
this->configMode = CM_MAIN_TO_OPTIONS;
this->kbdButton = 0;
this->kbdButton = FS_KBD_BTN_HIRA;
this->kbdX = 0;
this->kbdY = 0;
this->charBgAlpha = 0;
@ -798,6 +807,11 @@ static s16 sQuestItemRed[] = { 255, 255, 255, 0, 255, 0, 255, 200, 200 };
static s16 sQuestItemGreen[] = { 255, 255, 255, 255, 60, 100, 130, 50, 200 };
static s16 sQuestItemBlue[] = { 255, 255, 255, 0, 0, 255, 0, 255, 0 };
static s16 sQuestItemFlags[] = { 0x0012, 0x0013, 0x0014, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005 };
#if OOT_NTSC
static void* sSaveXTextures[] = { gFileSelSaveXJPNTex, gFileSelSaveXENGTex };
#endif
static s16 sNamePrimColors[2][3] = { { 255, 255, 255 }, { 100, 100, 100 } };
static void* sHeartTextures[] = { gHeartFullTex, gDefenseHeartFullTex };
static s16 sHeartPrimColors[2][3] = { { 255, 70, 50 }, { 200, 0, 0 } };
@ -1729,9 +1743,11 @@ void FileSelect_Main(GameState* thisx) {
void FileSelect_InitContext(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
EnvironmentContext* envCtx = &this->envCtx;
#if OOT_PAL
SramContext* sramCtx = &this->sramCtx;
#endif
Sram_Alloc(&this->state, sramCtx);
Sram_Alloc(&this->state, &this->sramCtx);
ZREG(7) = 32;
ZREG(8) = 22;
@ -1888,6 +1904,7 @@ void FileSelect_InitContext(GameState* thisx) {
this->n64ddFlags[0] = this->n64ddFlags[1] = this->n64ddFlags[2] = this->defense[0] = this->defense[1] =
this->defense[2] = 0;
#if OOT_PAL
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
@ -1895,6 +1912,7 @@ void FileSelect_InitContext(GameState* thisx) {
if (gSaveContext.language >= LANGUAGE_MAX) {
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG;
}
#endif
}
void FileSelect_Destroy(GameState* thisx) {

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1 @@
#include "file_select.h"
#include "assets/overlays/ovl_file_choose/ovl_file_choose.c"
s16 D_808123F0[] = {
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016,
0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023,
0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030,
0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D,
0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000, 0x0040, 0x003F, 0x003E,
};

View file

@ -3150,9 +3150,12 @@ FileSelect_EraseAnim2 = 0x808061A4; // type:func
FileSelect_EraseAnim3 = 0x80806268; // type:func
FileSelect_ExitEraseToMain = 0x808064D4; // type:func
FileSelect_DrawCharacter = 0x80806670; // type:func
FileSelect_DrawCharacterTransition = 0x808067A8; // type:func
FileSelect_SetKeyboardVtx = 0x80806988; // type:func
FileSelect_SetNameEntryVtx = 0x80806C4C; // type:func
FileSelect_DrawKeyboard = 0x80807930; // type:func
FileSelect_ApplyDiacriticToCharacter = 0x808081F4; // type:func
FileSelect_ApplyDiacriticToFilename = 0x808083FC; // type:func
FileSelect_DrawNameEntry = 0x8080847C; // type:func
FileSelect_StartNameEntry = 0x808098E0; // type:func
FileSelect_UpdateKeyboardCursor = 0x80809994; // type:func