File Select (z_file_choose) OK (#1012)

* matching split

* migrate progress

* split done and rodata migrated

* all data migrated to c

* start init

* progress

* progress

* progress

* progress

* progress

* progress

* copy done

* progress

* erase and settings done

* progress

* progress

* progress

* start keyboard

* progress

* progress

* progress

* progress

* Minor progress

* fix z_magic_dark issue

* func_80806F34 decomp'd

* verified equivalence

* one fix

* format

* merge petries work

* reorganizing

* lots of reorganizing and wraning fixing

* rename file

* remove language enum

* unwanted changes

* some symbol replacement, organization, and some names

* all symbols replaced, some organization

* some more cleanup

* continue docs

* Match the remaining functions in file_choose

* merge master

* select mode documented, all functions in file_choose.c named

* nameset functions named, some other cleaning

* some more general cleanup

* stub comments for cm, name a few things

* fix data and sizeof

* copy/erase functions and modes named

* rename assets, format

* change some struct members

* fixes

* review1

* fix maching error

* extract VTX data

* re add werror to ZAPD

* review 2

* fix

* remove file boundary padding

* remove zeroes

* review3

* change skybox stuff

* changes to  vs  etc

Co-authored-by: KrimtonZ <krimtonz@gmail.com>
Co-authored-by: Thar0 <17233964+Thar0@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
Co-authored-by: Louis <louist103@gmail.com>
This commit is contained in:
fig02
2021-11-15 16:33:44 -05:00
committed by GitHub
parent 768f0c2c88
commit a3b4dcf388
101 changed files with 4513 additions and 15899 deletions
+4 -4
View File
@@ -519,15 +519,15 @@ void func_800EC960(u8 custom) {
void Audio_GetOcaInput(void) {
Input inputs[4];
Input* controller1 = &inputs[0];
Input* input = &inputs[0];
u32 sp18;
sp18 = sCurOcarinaBtnPress;
PadMgr_RequestPadData(&gPadMgr, inputs, 0);
sCurOcarinaBtnPress = controller1->cur.button;
sCurOcarinaBtnPress = input->cur.button;
sPrevOcarinaBtnPress = sp18;
sCurOcaStick.x = controller1->rel.stick_x;
sCurOcaStick.y = controller1->rel.stick_y;
sCurOcaStick.x = input->rel.stick_x;
sCurOcaStick.y = input->rel.stick_y;
}
f32 Audio_OcaAdjStick(s8 inp) {
+1 -1
View File
@@ -116,7 +116,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
if (gameStateInitFunc == Opening_Init) {
return &gGameStateOverlayTable[4];
}
if (gameStateInitFunc == func_80811A20) {
if (gameStateInitFunc == FileChoose_Init) {
return &gGameStateOverlayTable[5];
}
+3 -3
View File
@@ -148,16 +148,16 @@ void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) {
}
void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
Input* pad1 = &globalCtx->state.input[0];
Input* input = &globalCtx->state.input[0];
if (CHECK_BTN_ALL(pad1->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) &&
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) &&
(gSaveContext.sceneSetupIndex >= 4)) {
D_8015FCC8 = 0;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
}
if (CHECK_BTN_ALL(pad1->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) &&
if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) &&
(gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) {
D_8015FCC8 = 1;
gSaveContext.cutsceneIndex = 0xFFFD;
+1 -1
View File
@@ -14,5 +14,5 @@ GameStateOverlay gGameStateOverlayTable[] = {
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
GAMESTATE_OVERLAY_INTERNAL(Gameplay_Init, Gameplay_Destroy, sizeof(GlobalContext)),
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
GAMESTATE_OVERLAY(file_choose, func_80811A20, func_80811A18, 0x1CAE0),
GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
};
+4 -4
View File
@@ -3796,15 +3796,15 @@ void Interface_Update(GlobalContext* globalCtx) {
s16 alpha;
s16 alpha1;
u16 action;
Input* input = &globalCtx->state.input[2];
Input* debugInput = &globalCtx->state.input[2];
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
gSaveContext.language = 0;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
} else if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) {
gSaveContext.language = 1;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
} else if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) {
gSaveContext.language = 2;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
}
+2 -2
View File
@@ -584,7 +584,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
gSaveContext.minigameState = 3;
}
} else {
SET_NEXT_GAMESTATE(&globalCtx->state, func_80811A20, char[0x1CAE0]);
SET_NEXT_GAMESTATE(&globalCtx->state, FileChoose_Init, FileChooseContext);
}
} else {
globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx);
@@ -1439,7 +1439,7 @@ void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
}
void Gameplay_InitEnvironment(GlobalContext* globalCtx, s16 skyboxId) {
Skybox_Init(globalCtx, &globalCtx->skyboxCtx, skyboxId);
Skybox_Init(&globalCtx->state, &globalCtx->skyboxCtx, skyboxId);
Environment_Init(globalCtx, &globalCtx->envCtx, 0);
}
+61 -59
View File
@@ -82,7 +82,7 @@ typedef struct {
#define DEFENSE OFFSETOF(SaveContext, inventory.defenseHearts)
#define HEALTH OFFSETOF(SaveContext, health)
#define SLOT_OFFSET(idx) (SLOT_SIZE * idx + 0x20)
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
u16 gSramSlotOffsets[] = {
SLOT_OFFSET(0),
@@ -102,7 +102,7 @@ static SavePlayerData sNewSavePlayerData = {
{ 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName
0, // n64ddFlag
0x30, // healthCapacity
0x30, // heartStatus
0x30, // defense
0, // magicLevel
0x30, // magic
0, // rupees
@@ -381,10 +381,10 @@ void Sram_OpenSave(SramContext* sramCtx) {
osSyncPrintf(VT_FGCOL(BLUE));
osSyncPrintf("\n====================================================================\n");
MemCopy(gScarecrowCustomSongPtr, &gSaveContext.scarecrowCustomSong, 0x360);
MemCopy(gScarecrowCustomSongPtr, &gSaveContext.scarecrowCustomSong, sizeof(gSaveContext.scarecrowCustomSong));
ptr = (u8*)gScarecrowCustomSongPtr;
for (i = 0; i < 0x360; i++, ptr++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowCustomSong); i++, ptr++) {
osSyncPrintf("%d, ", *ptr);
}
@@ -396,10 +396,10 @@ void Sram_OpenSave(SramContext* sramCtx) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("\n====================================================================\n");
MemCopy(gScarecrowSpawnSongPtr, &gSaveContext.scarecrowSpawnSong, 0x80);
MemCopy(gScarecrowSpawnSongPtr, &gSaveContext.scarecrowSpawnSong, sizeof(gSaveContext.scarecrowSpawnSong));
ptr = gScarecrowSpawnSongPtr;
for (i = 0; i < 0x80; i++, ptr++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowSpawnSong); i++, ptr++) {
osSyncPrintf("%d, ", *ptr);
}
@@ -651,23 +651,22 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* s
MemCopy(&fileChooseCtx->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD,
sizeof(fileChooseCtx->n64ddFlags[0]));
MemCopy(&fileChooseCtx->heartStatus[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE,
sizeof(fileChooseCtx->heartStatus[0]));
MemCopy(&fileChooseCtx->heartStatus[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE,
sizeof(fileChooseCtx->heartStatus[0]));
MemCopy(&fileChooseCtx->heartStatus[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE,
sizeof(fileChooseCtx->heartStatus[0]));
MemCopy(&fileChooseCtx->defense[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE,
sizeof(fileChooseCtx->defense[0]));
MemCopy(&fileChooseCtx->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE,
sizeof(fileChooseCtx->defense[0]));
MemCopy(&fileChooseCtx->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE,
sizeof(fileChooseCtx->defense[0]));
MemCopy(&fileChooseCtx->nowLife[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
MemCopy(&fileChooseCtx->nowLife[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
MemCopy(&fileChooseCtx->nowLife[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
MemCopy(&fileChooseCtx->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileChooseCtx->health[0]));
MemCopy(&fileChooseCtx->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileChooseCtx->health[0]));
MemCopy(&fileChooseCtx->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileChooseCtx->health[0]));
osSyncPrintf("f_64dd=%d, %d, %d\n", fileChooseCtx->n64ddFlags[0], fileChooseCtx->n64ddFlags[1],
fileChooseCtx->n64ddFlags[2]);
osSyncPrintf("heart_status=%d, %d, %d\n", fileChooseCtx->heartStatus[0], fileChooseCtx->heartStatus[1],
fileChooseCtx->heartStatus[2]);
osSyncPrintf("now_life=%d, %d, %d\n", fileChooseCtx->nowLife[0], fileChooseCtx->nowLife[1],
fileChooseCtx->nowLife[2]);
osSyncPrintf("heart_status=%d, %d, %d\n", fileChooseCtx->defense[0], fileChooseCtx->defense[1],
fileChooseCtx->defense[2]);
osSyncPrintf("now_life=%d, %d, %d\n", fileChooseCtx->health[0], fileChooseCtx->health[1], fileChooseCtx->health[2]);
}
void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
@@ -676,7 +675,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
u16* ptr;
u16 checksum;
if (fileChooseCtx->btnIdx != 0) {
if (fileChooseCtx->buttonIndex != 0) {
Sram_InitNewSave();
} else {
Sram_InitDebugSave();
@@ -687,12 +686,12 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
gSaveContext.dayTime = 0x6AAB;
gSaveContext.cutsceneIndex = 0xFFF1;
if (fileChooseCtx->btnIdx == 0) {
if (fileChooseCtx->buttonIndex == 0) {
gSaveContext.cutsceneIndex = 0;
}
for (offset = 0; offset < 8; offset++) {
gSaveContext.playerName[offset] = fileChooseCtx->fileNames[fileChooseCtx->btnIdx][offset];
gSaveContext.playerName[offset] = fileChooseCtx->fileNames[fileChooseCtx->buttonIndex][offset];
}
gSaveContext.newf[0] = 'Z';
@@ -750,14 +749,14 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
sizeof(fileChooseCtx->questItems[0]));
MemCopy(&fileChooseCtx->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD,
sizeof(fileChooseCtx->n64ddFlags[0]));
MemCopy(&fileChooseCtx->heartStatus[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE,
sizeof(fileChooseCtx->heartStatus[0]));
MemCopy(&fileChooseCtx->nowLife[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH,
sizeof(fileChooseCtx->nowLife[0]));
MemCopy(&fileChooseCtx->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE,
sizeof(fileChooseCtx->defense[0]));
MemCopy(&fileChooseCtx->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH,
sizeof(fileChooseCtx->health[0]));
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->heartStatus[gSaveContext.fileNum]);
osSyncPrintf("now_life[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->nowLife[gSaveContext.fileNum]);
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->defense[gSaveContext.fileNum]);
osSyncPrintf("now_life[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->health[gSaveContext.fileNum]);
}
void Sram_EraseSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
@@ -765,14 +764,14 @@ void Sram_EraseSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
Sram_InitNewSave();
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIdx];
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex];
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->selectedFileIdx], sramCtx->readBuff + offset + N64DD,
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->selectedFileIndex], sramCtx->readBuff + offset + N64DD,
sizeof(fileChooseCtx->n64ddFlags[0]));
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIdx + 3];
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex + 3];
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
@@ -782,45 +781,48 @@ void Sram_EraseSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
void Sram_CopySave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
s32 offset;
osSyncPrintf("READ=%d(%x) COPY=%d(%x)\n", fileChooseCtx->selectedFileIdx,
gSramSlotOffsets[fileChooseCtx->selectedFileIdx], fileChooseCtx->copyDestFileIdx,
gSramSlotOffsets[fileChooseCtx->copyDestFileIdx]);
osSyncPrintf("READ=%d(%x) COPY=%d(%x)\n", fileChooseCtx->selectedFileIndex,
gSramSlotOffsets[fileChooseCtx->selectedFileIndex], fileChooseCtx->copyDestFileIndex,
gSramSlotOffsets[fileChooseCtx->copyDestFileIndex]);
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIdx];
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex];
MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIdx];
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex];
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIdx + 3];
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex + 3];
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIdx];
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex];
MemCopy(&fileChooseCtx->deaths[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + DEATHS,
MemCopy(&fileChooseCtx->deaths[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + DEATHS,
sizeof(fileChooseCtx->deaths[0]));
MemCopy(&fileChooseCtx->fileNames[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + NAME,
MemCopy(&fileChooseCtx->fileNames[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + NAME,
sizeof(fileChooseCtx->fileNames[0]));
MemCopy(&fileChooseCtx->healthCapacities[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + HEALTH_CAP,
MemCopy(&fileChooseCtx->healthCapacities[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + HEALTH_CAP,
sizeof(fileChooseCtx->healthCapacities[0]));
MemCopy(&fileChooseCtx->questItems[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + QUEST,
MemCopy(&fileChooseCtx->questItems[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + QUEST,
sizeof(fileChooseCtx->questItems[0]));
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + N64DD,
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + N64DD,
sizeof(fileChooseCtx->n64ddFlags[0]));
MemCopy(&fileChooseCtx->heartStatus[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + DEFENSE,
sizeof(fileChooseCtx->heartStatus[0]));
MemCopy(&fileChooseCtx->nowLife[fileChooseCtx->copyDestFileIdx], (sramCtx->readBuff + offset) + HEALTH,
sizeof(fileChooseCtx->nowLife[0]));
MemCopy(&fileChooseCtx->defense[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE,
sizeof(fileChooseCtx->defense[0]));
MemCopy(&fileChooseCtx->health[fileChooseCtx->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH,
sizeof(fileChooseCtx->health[0]));
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->heartStatus[gSaveContext.fileNum]);
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->defense[gSaveContext.fileNum]);
osSyncPrintf("COPY終了\n"); // "Copy end"
}
void Sram_Write16Bytes(SramContext* sramCtx) {
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 0x10, OS_WRITE);
/**
* Write the first 16 bytes of the read buffer to the SRAM header
*/
void Sram_WriteSramHeader(SramContext* sramCtx) {
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_HEADER_SIZE, OS_WRITE);
}
void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
@@ -830,23 +832,23 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
if (sZeldaMagic[i + 3] != sramCtx->readBuff[i + 3]) {
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
gSaveContext.language = sramCtx->readBuff[2];
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
MemCopy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
sramCtx->readBuff[2] = gSaveContext.language;
Sram_Write16Bytes(sramCtx);
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
}
}
gSaveContext.audioSetting = sramCtx->readBuff[0] & 3;
gSaveContext.zTargetSetting = sramCtx->readBuff[1] & 1;
gSaveContext.language = sramCtx->readBuff[2];
gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3;
gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1;
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
if (gSaveContext.language > 2) {
gSaveContext.language = 0;
sramCtx->readBuff[2] = gSaveContext.language;
Sram_Write16Bytes(sramCtx);
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
}
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
+8 -6
View File
@@ -907,7 +907,9 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
}
}
void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) {
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
GlobalContext* globalCtx = (GlobalContext*)state;
skyboxCtx->unk_140 = 0;
skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f;
@@ -921,24 +923,24 @@ void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxI
osSyncPrintf(VT_FGCOL(GREEN));
if (skyboxCtx->unk_140 != 0) {
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 8 * 150 * sizeof(Gfx), "../z_vr_box.c", 1636);
skyboxCtx->dListBuf = GameState_Alloc(state, 8 * 150 * sizeof(Gfx), "../z_vr_box.c", 1636);
ASSERT(skyboxCtx->dListBuf != NULL, "vr_box->dpList != NULL", "../z_vr_box.c", 1637);
skyboxCtx->roomVtx = GameState_Alloc(&globalCtx->state, 256 * sizeof(Vtx), "../z_vr_box.c", 1639);
skyboxCtx->roomVtx = GameState_Alloc(state, 256 * sizeof(Vtx), "../z_vr_box.c", 1639);
ASSERT(skyboxCtx->roomVtx != NULL, "vr_box->roomVtx != NULL", "../z_vr_box.c", 1640);
func_800AEFC8(skyboxCtx, skyboxId);
} else {
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 12 * 150 * sizeof(Gfx), "../z_vr_box.c", 1643);
skyboxCtx->dListBuf = GameState_Alloc(state, 12 * 150 * sizeof(Gfx), "../z_vr_box.c", 1643);
ASSERT(skyboxCtx->dListBuf != NULL, "vr_box->dpList != NULL", "../z_vr_box.c", 1644);
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
skyboxCtx->roomVtx = GameState_Alloc(&globalCtx->state, 192 * sizeof(Vtx), "../z_vr_box.c", 1648);
skyboxCtx->roomVtx = GameState_Alloc(state, 192 * sizeof(Vtx), "../z_vr_box.c", 1648);
ASSERT(skyboxCtx->roomVtx != NULL, "vr_box->roomVtx != NULL", "../z_vr_box.c", 1649);
func_800AF178(skyboxCtx, 6);
} else {
skyboxCtx->roomVtx = GameState_Alloc(&globalCtx->state, 160 * sizeof(Vtx), "../z_vr_box.c", 1653);
skyboxCtx->roomVtx = GameState_Alloc(state, 160 * sizeof(Vtx), "../z_vr_box.c", 1653);
ASSERT(skyboxCtx->roomVtx != NULL, "vr_box->roomVtx != NULL", "../z_vr_box.c", 1654);
func_800AF178(skyboxCtx, 5);
@@ -665,8 +665,8 @@ void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) {
this->stateFlag = OSSAN_STATE_IDLE;
}
s32 EnOssan_TestEndInteraction(EnOssan* this, GlobalContext* globalCtx, Input* controller1) {
if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) {
s32 EnOssan_TestEndInteraction(EnOssan* this, GlobalContext* globalCtx, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
EnOssan_EndInteraction(globalCtx, this);
return true;
} else {
@@ -674,8 +674,8 @@ s32 EnOssan_TestEndInteraction(EnOssan* this, GlobalContext* globalCtx, Input* c
}
}
s32 EnOssan_TestCancelOption(EnOssan* this, GlobalContext* globalCtx, Input* controller1) {
if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) {
s32 EnOssan_TestCancelOption(EnOssan* this, GlobalContext* globalCtx, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->stateFlag = this->tempStateFlag;
func_8010B720(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId);
return true;
@@ -747,9 +747,9 @@ void EnOssan_State_Idle(EnOssan* this, GlobalContext* globalCtx, Player* player)
}
void EnOssan_UpdateJoystickInputState(GlobalContext* globalCtx, EnOssan* this) {
Input* controller1 = &globalCtx->state.input[0];
s8 stickX = controller1->rel.stick_x;
s8 stickY = controller1->rel.stick_y;
Input* input = &globalCtx->state.input[0];
s8 stickX = input->rel.stick_x;
s8 stickY = input->rel.stick_y;
this->moveHorizontal = this->moveVertical = false;
@@ -0,0 +1,219 @@
#ifndef _FILE_CHOOSE_H_
#define _FILE_CHOOSE_H_
#include "ultra64.h"
#include "global.h"
#include "vt.h"
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + OFFSETOF(SaveContext, newf[index])])
#define SLOT_OCCUPIED(sramCtx, slotNum) \
((GET_NEWF(sramCtx, slotNum, 0) == 'Z') || \
(GET_NEWF(sramCtx, slotNum, 1) == 'E') || \
(GET_NEWF(sramCtx, slotNum, 2) == 'L') || \
(GET_NEWF(sramCtx, slotNum, 3) == 'D') || \
(GET_NEWF(sramCtx, slotNum, 4) == 'A') || \
(GET_NEWF(sramCtx, slotNum, 5) == 'Z'))
// Init mode: Initial setup as the file select is starting up, fades and slides in various menu elements
// Config mode: Handles the bulk of the file select, various configuration tasks like picking a file, copy/erase, and the options menu
// Select mode: Displays the selected file with various details about it, and allows the player to confirm and open it
typedef enum {
/* 0 */ FS_MENU_MODE_INIT,
/* 1 */ FS_MENU_MODE_CONFIG,
/* 2 */ FS_MENU_MODE_SELECT
} MenuMode;
typedef enum {
/* 00 */ CM_FADE_IN_START,
/* 01 */ CM_FADE_IN_END,
/* 02 */ CM_MAIN_MENU,
/* 03 */ CM_SETUP_COPY_SOURCE,
/* 04 */ CM_SELECT_COPY_SOURCE,
/* 05 */ CM_SETUP_COPY_DEST_1,
/* 06 */ CM_SETUP_COPY_DEST_2,
/* 07 */ CM_SELECT_COPY_DEST,
/* 08 */ CM_EXIT_TO_COPY_SOURCE_1,
/* 09 */ CM_EXIT_TO_COPY_SOURCE_2,
/* 10 */ CM_SETUP_COPY_CONFIRM_1,
/* 11 */ CM_SETUP_COPY_CONFIRM_2,
/* 12 */ CM_COPY_CONFIRM,
/* 13 */ CM_RETURN_TO_COPY_DEST,
/* 14 */ CM_COPY_ANIM_1,
/* 15 */ CM_COPY_ANIM_2,
/* 16 */ CM_COPY_ANIM_3,
/* 17 */ CM_COPY_ANIM_4,
/* 18 */ CM_COPY_ANIM_5,
/* 19 */ CM_COPY_RETURN_MAIN,
/* 20 */ CM_SETUP_ERASE_SELECT,
/* 21 */ CM_ERASE_SELECT,
/* 22 */ CM_SETUP_ERASE_CONFIRM_1,
/* 23 */ CM_SETUP_ERASE_CONFIRM_2,
/* 24 */ CM_ERASE_CONFIRM,
/* 25 */ CM_EXIT_TO_ERASE_SELECT_1,
/* 26 */ CM_EXIT_TO_ERASE_SELECT_2,
/* 27 */ CM_ERASE_ANIM_1,
/* 28 */ CM_ERASE_ANIM_2,
/* 29 */ CM_ERASE_ANIM_3,
/* 30 */ CM_EXIT_ERASE_TO_MAIN,
/* 31 */ CM_UNUSED_31,
/* 32 */ CM_ROTATE_TO_NAME_ENTRY,
/* 33 */ CM_NAME_ENTRY,
/* 34 */ CM_START_NAME_ENTRY,
/* 35 */ CM_NAME_ENTRY_TO_MAIN,
/* 36 */ CM_MAIN_TO_OPTIONS,
/* 37 */ CM_OPTIONS_MENU,
/* 38 */ CM_START_OPTIONS,
/* 39 */ CM_OPTIONS_TO_MAIN,
/* 40 */ CM_UNUSED_DELAY
} ConfigMode;
typedef enum {
/* 0 */ SM_FADE_MAIN_TO_SELECT,
/* 1 */ SM_MOVE_FILE_TO_TOP,
/* 2 */ SM_FADE_IN_FILE_INFO,
/* 3 */ SM_CONFIRM_FILE,
/* 4 */ SM_FADE_OUT_FILE_INFO,
/* 5 */ SM_MOVE_FILE_TO_SLOT,
/* 6 */ SM_FADE_OUT,
/* 7 */ SM_LOAD_GAME
} SelectMode;
typedef enum {
/* 0 */ FS_TITLE_SELECT_FILE, // "Please select a file."
/* 1 */ FS_TITLE_OPEN_FILE, // "Open this file?"
/* 2 */ FS_TITLE_COPY_FROM, // "Copy which file?"
/* 3 */ FS_TITLE_COPY_TO, // "Copy to which file?"
/* 4 */ FS_TITLE_COPY_CONFIRM, // "Are you sure?"
/* 5 */ FS_TITLE_COPY_COMPLETE, // "File copied."
/* 6 */ FS_TITLE_ERASE_FILE, // "Erase which file?"
/* 7 */ FS_TITLE_ERASE_CONFIRM, // "Are you sure?"
/* 8 */ FS_TITLE_ERASE_COMPLETE // "File erased."
} TitleLabel;
typedef enum {
/* -1 */ FS_WARNING_NONE = -1,
/* 0 */ FS_WARNING_NO_FILE_COPY, // "No file to copy."
/* 1 */ FS_WARNING_NO_FILE_ERASE, // "No file to erase."
/* 2 */ FS_WARNING_NO_EMPTY_FILES, // "There is no empty file."
/* 3 */ FS_WARNING_FILE_EMPTY, // "This is an empty file."
/* 4 */ FS_WARNING_FILE_IN_USE // "This file is in use."
} WarningLabel;
typedef enum {
/* 0 */ FS_BTN_MAIN_FILE_1,
/* 1 */ FS_BTN_MAIN_FILE_2,
/* 2 */ FS_BTN_MAIN_FILE_3,
/* 3 */ FS_BTN_MAIN_COPY,
/* 4 */ FS_BTN_MAIN_ERASE,
/* 5 */ FS_BTN_MAIN_OPTIONS
} MainMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_COPY_FILE_1,
/* 1 */ FS_BTN_COPY_FILE_2,
/* 2 */ FS_BTN_COPY_FILE_3,
/* 3 */ FS_BTN_COPY_QUIT
} CopyMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_ERASE_FILE_1,
/* 1 */ FS_BTN_ERASE_FILE_2,
/* 2 */ FS_BTN_ERASE_FILE_3,
/* 3 */ FS_BTN_ERASE_QUIT
} EraseMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_SELECT_FILE_1,
/* 1 */ FS_BTN_SELECT_FILE_2,
/* 2 */ FS_BTN_SELECT_FILE_3,
/* 3 */ FS_BTN_SELECT_YES,
/* 4 */ FS_BTN_SELECT_QUIT
} SelectMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_CONFIRM_YES,
/* 1 */ FS_BTN_CONFIRM_QUIT
} ConfirmButtonIndex;
typedef enum {
/* 0 */ FS_BTN_ACTION_COPY,
/* 1 */ FS_BTN_ACTION_ERASE
} ActionButtonIndex;
typedef enum {
/* 0 */ FS_SETTING_AUDIO,
/* 1 */ FS_SETTING_TARGET
} SettingIndex;
typedef enum {
/* 0 */ FS_AUDIO_STEREO,
/* 1 */ FS_AUDIO_MONO,
/* 2 */ FS_AUDIO_HEADSET,
/* 3 */ FS_AUDIO_SURROUND
} AudioOption;
typedef enum {
/* 0 */ FS_CHAR_PAGE_HIRA,
/* 1 */ FS_CHAR_PAGE_KATA,
/* 2 */ FS_CHAR_PAGE_ENG
} CharPage;
typedef enum {
/* 00 */ FS_KBD_BTN_HIRA,
/* 01 */ FS_KBD_BTN_KATA,
/* 02 */ FS_KBD_BTN_ENG,
/* 03 */ FS_KBD_BTN_BACKSPACE,
/* 04 */ FS_KBD_BTN_END,
/* 99 */ FS_KBD_BTN_NONE = 99
} KeyboardButton;
void FileChoose_SetupCopySource(GameState* thisx);
void FileChoose_SelectCopySource(GameState* thisx);
void FileChoose_SetupCopyDest1(GameState* thisx);
void FileChoose_SetupCopyDest2(GameState* thisx);
void FileChoose_SelectCopyDest(GameState* thisx);
void FileChoose_ExitToCopySource1(GameState* thisx);
void FileChoose_ExitToCopySource2(GameState* thisx);
void FileChoose_SetupCopyConfirm1(GameState* thisx);
void FileChoose_SetupCopyConfirm2(GameState* thisx);
void FileChoose_CopyConfirm(GameState* thisx);
void FileChoose_ReturnToCopyDest(GameState* thisx);
void FileChoose_CopyAnim1(GameState* thisx);
void FileChoose_CopyAnim2(GameState* thisx);
void FileChoose_CopyAnim3(GameState* thisx);
void FileChoose_CopyAnim4(GameState* thisx);
void FileChoose_CopyAnim5(GameState* thisx);
void FileChoose_ExitCopyToMain(GameState* thisx);
void FileChoose_SetupEraseSelect(GameState* thisx);
void FileChoose_EraseSelect(GameState* thisx);
void FileChoose_SetupEraseConfirm1(GameState* thisx);
void FileChoose_SetupEraseConfirm2(GameState* thisx);
void FileChoose_EraseConfirm(GameState* thisx);
void FileChoose_ExitToEraseSelect1(GameState* thisx);
void FileChoose_ExitToEraseSelect2(GameState* thisx);
void FileChoose_EraseAnim1(GameState* thisx);
void FileChoose_EraseAnim2(GameState* thisx);
void FileChoose_EraseAnim3(GameState* thisx);
void FileChoose_ExitEraseToMain(GameState* thisx);
void FileChoose_UpdateKeyboardCursor(GameState* thisx);
void FileChoose_StartNameEntry(GameState* thisx);
void FileChoose_UpdateOptionsMenu(GameState* thisx);
void FileChoose_StartOptions(GameState* thisx);
void FileChoose_InitModeDraw(GameState* thisx);
void FileChoose_ConfigModeDraw(GameState* thisx);
void FileChoose_SelectModeDraw(GameState* thisx);
void FileChoose_PulsateCursor(GameState* thisx);
void FileChoose_DrawOptions(GameState* thisx);
void FileChoose_DrawNameEntry(GameState* thisx);
void FileChoose_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
extern s16 D_808123F0[];
#endif
@@ -1,3 +1,5 @@
ovl_file_choose
z_file_nameset_data.c
z_file_copy_erase.c
z_file_nameset_PAL.c
z_file_choose.c
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
#include "file_choose.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,
};
+16 -20
View File
@@ -25,11 +25,8 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) {
gSaveContext.unk_13F4 = 0;
gSaveContext.magicLevel = gSaveContext.magic;
}
gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[2] = BTN_ENABLED;
gSaveContext.buttonStatus[1] = BTN_ENABLED;
gSaveContext.buttonStatus[0] = BTN_ENABLED;
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Audio_QueueSeqCmd(NA_BGM_STOP);
gSaveContext.entranceIndex = entranceIndex;
@@ -195,19 +192,19 @@ static SceneSelectEntry sScenes[] = {
};
void Select_UpdateMenu(SelectContext* this) {
Input* controller1 = &this->state.input[0];
Input* input = &this->state.input[0];
s32 pad;
SceneSelectEntry* selectedScene;
if (this->verticalInputAccumulator == 0) {
if (CHECK_BTN_ALL(controller1->press.button, BTN_A) || CHECK_BTN_ALL(controller1->press.button, BTN_START)) {
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) {
selectedScene = &this->scenes[this->currentScene];
if (selectedScene->loadFunc != NULL) {
selectedScene->loadFunc(this, selectedScene->entranceIndex);
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
gSaveContext.linkAge = 1;
} else {
@@ -215,7 +212,7 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_Z)) {
if (CHECK_BTN_ALL(input->press.button, BTN_Z)) {
if (gSaveContext.cutsceneIndex == 0x8000) {
gSaveContext.cutsceneIndex = 0;
} else if (gSaveContext.cutsceneIndex == 0) {
@@ -243,7 +240,7 @@ void Select_UpdateMenu(SelectContext* this) {
} else if (gSaveContext.cutsceneIndex == 0xFFFA) {
gSaveContext.cutsceneIndex = 0x8000;
}
} else if (CHECK_BTN_ALL(controller1->press.button, BTN_R)) {
} else if (CHECK_BTN_ALL(input->press.button, BTN_R)) {
if (gSaveContext.cutsceneIndex == 0x8000) {
gSaveContext.cutsceneIndex = 0xFFFA;
} else if (gSaveContext.cutsceneIndex == 0) {
@@ -279,14 +276,14 @@ void Select_UpdateMenu(SelectContext* this) {
}
// user can change "opt", but it doesn't do anything
if (CHECK_BTN_ALL(controller1->press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
this->opt--;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
this->opt++;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
if (this->lockUp == true) {
this->timerUp = 0;
}
@@ -298,12 +295,12 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DUP) && this->timerUp == 0) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DUP) && this->timerUp == 0) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
if (this->lockDown == true) {
this->timerDown = 0;
}
@@ -315,24 +312,23 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DDOWN) && (this->timerDown == 0)) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN) && (this->timerDown == 0)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = -R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DLEFT) || CHECK_BTN_ALL(controller1->cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) || CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = R_UPDATE_RATE;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DRIGHT) ||
CHECK_BTN_ALL(controller1->cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT) || CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = -R_UPDATE_RATE;
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_L)) {
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
this->pageDownIndex++;
this->pageDownIndex =
(this->pageDownIndex + ARRAY_COUNT(this->pageDownStops)) % ARRAY_COUNT(this->pageDownStops);