mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +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:
parent
29acf96db2
commit
feac688313
15 changed files with 832 additions and 103 deletions
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue