From 55a2507e192de103dbaafa51cd855b7507b61d36 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 6 Nov 2023 02:27:07 -0300 Subject: Sram_CopySave matching --- src/code/z_sram_NES.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/code') diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 83e271edc..696d79823 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1694,8 +1694,6 @@ void Sram_EraseSave(FileSelectState* fileSelect2, SramContext* sramCtx, s32 file gSaveContext.flashSaveAvailable = D_801F6AF2; } -#ifdef NON_MATCHING -// v0/v1 void Sram_CopySave(FileSelectState* fileSelect2, SramContext* sramCtx) { FileSelectState* fileSelect = fileSelect2; u16 i; @@ -1737,13 +1735,11 @@ void Sram_CopySave(FileSelectState* fileSelect2, SramContext* sramCtx) { // clear buffer bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); // read to buffer - SysFlashrom_ReadData(&sramCtx->saveBuf[0], gFlashSaveStartPages[fileSelect->selectedFileIndex * 2], - gFlashSaveNumPages[fileSelect->selectedFileIndex * 2]); - if (1) {} + if (SysFlashrom_ReadData(&sramCtx->saveBuf[0], gFlashSaveStartPages[fileSelect->selectedFileIndex * 2], + gFlashSaveNumPages[fileSelect->selectedFileIndex * 2])) {} - SysFlashrom_ReadData(&sramCtx->saveBuf[0x2000], gFlashSaveStartPages[fileSelect->selectedFileIndex * 2 + 1], - gFlashSaveNumPages[fileSelect->selectedFileIndex * 2 + 1]); - if (1) {} + if (SysFlashrom_ReadData(&sramCtx->saveBuf[0x2000], gFlashSaveStartPages[fileSelect->selectedFileIndex * 2 + 1], + gFlashSaveNumPages[fileSelect->selectedFileIndex * 2 + 1])) {} // copy buffer to save context Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); @@ -1780,9 +1776,6 @@ void Sram_CopySave(FileSelectState* fileSelect2, SramContext* sramCtx) { gSaveContext.save.time = D_801F6AF0; gSaveContext.flashSaveAvailable = D_801F6AF2; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_CopySave.s") -#endif void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) { s32 phi_v0; -- cgit v1.2.3 From 55473dd84e07a68f40f04d41829b42a082cee066 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 6 Nov 2023 15:22:51 -0300 Subject: Message_Update Matching --- src/code/z_message.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/code') diff --git a/src/code/z_message.c b/src/code/z_message.c index ff16d258a..4d3379136 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -5212,10 +5212,6 @@ s16 D_801D0464[] = { 0x1B8E, }; -#ifdef NON_MATCHING -// Down to a single compiler-managed stack variable -// Also contains in-function data -// https://decomp.me/scratch/QcQ0a void Message_Update(PlayState* play) { static u8 D_801D0468 = 0; MessageContext* msgCtx = &play->msgCtx; @@ -5731,7 +5727,7 @@ void Message_Update(PlayState* play) { ((play->activeCamId == CAM_ID_MAIN) || ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF))) && (play->msgCtx.ocarinaMode == OCARINA_MODE_END)) { - if ((gSaveContext.prevHudVisibility == HUD_VISIBILITY_IDLE) || + if (((u32)gSaveContext.prevHudVisibility == HUD_VISIBILITY_IDLE) || (gSaveContext.prevHudVisibility == HUD_VISIBILITY_NONE) || (gSaveContext.prevHudVisibility == HUD_VISIBILITY_NONE_ALT)) { gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; @@ -6002,10 +5998,6 @@ void Message_Update(PlayState* play) { break; } } -#else -u8 D_801D0468 = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_Update.s") -#endif void Message_SetTables(PlayState* play) { play->msgCtx.messageEntryTableNes = D_801C6B98; -- cgit v1.2.3 From a296c79b47009a70c556bff3dbb77f31aa792ee3 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 6 Nov 2023 15:30:37 -0300 Subject: Message_DrawTextCredits matching --- src/code/z_message_staff.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/code') diff --git a/src/code/z_message_staff.c b/src/code/z_message_staff.c index a093ef5c1..6b94d7719 100644 --- a/src/code/z_message_staff.c +++ b/src/code/z_message_staff.c @@ -35,12 +35,9 @@ f32 sCreditsFontWidths[144] = { 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, }; -#ifdef NON_MATCHING -// https://decomp.me/scratch/yc8Or -// v0/v1 swap between `character` and `i` void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { MessageContext* msgCtx = &play->msgCtx; - u16 lookAheadCharacter; + u16 pad; u16 j; u16 i; u16 sfxHi; @@ -122,14 +119,13 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING) && (msgCtx->msgMode <= MSGMODE_26)))) { j = i; while (true) { - lookAheadCharacter = msgCtx->decodedBuffer.schar[j]; - if (lookAheadCharacter == 6) { + character = msgCtx->decodedBuffer.schar[j]; + if (character == 6) { j += 2; continue; } - if ((lookAheadCharacter != 9) && (lookAheadCharacter != 0xA) && (lookAheadCharacter != 0xB) && - (lookAheadCharacter != 0xC) && (lookAheadCharacter != 0xD) && (lookAheadCharacter != 4) && - (lookAheadCharacter != 2)) { + if ((character != 9) && (character != 0xA) && (character != 0xB) && (character != 0xC) && + (character != 0xD) && (character != 4) && (character != 2)) { j++; continue; } @@ -260,7 +256,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { Audio_PlaySfx(NA_SE_SY_MESSAGE_END); Font_LoadMessageBoxEndIcon(font, 1); if (play->csCtx.state == CS_STATE_IDLE) { - func_8011552C(play, DO_ACTION_RETURN); + Interface_SetAButtonDoAction(play, DO_ACTION_RETURN); } } } @@ -282,7 +278,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { msgCtx->stateTimer = msgCtx->decodedBuffer.schar[++i]; Font_LoadMessageBoxEndIcon(font, 1); if (play->csCtx.state == CS_STATE_IDLE) { - func_8011552C(play, DO_ACTION_RETURN); + Interface_SetAButtonDoAction(play, DO_ACTION_RETURN); } } *gfxP = gfx; @@ -329,9 +325,6 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_staff/Message_DrawTextCredits.s") -#endif void Message_DecodeCredits(PlayState* play) { u16 curChar; -- cgit v1.2.3 From 13de6fa75d06fd21e33b3ed786dccf471117ec04 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 6 Nov 2023 20:18:06 -0300 Subject: func_801457CC MATCHING --- src/code/z_sram_NES.c | 90 +++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) (limited to 'src/code') diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 696d79823..bef18a20e 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1374,8 +1374,6 @@ void func_80145698(SramContext* sramCtx) { } } -// Verifies save and use backup if corrupted? -#ifdef NON_EQUIVALENT void func_801457CC(GameState* gameState, SramContext* sramCtx) { FileSelectState* fileSelect = (FileSelectState*)gameState; u16 sp7A; @@ -1387,6 +1385,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { u16 sp6E; u16 newCheckSum; // v0 u16 phi_a0; // maskCount + u8 temp; if (gSaveContext.flashSaveAvailable) { D_801F6AF0 = gSaveContext.save.time; @@ -1421,26 +1420,27 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); } else { + // phi_s2 = true; Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); // test checksum of main save - oldCheckSum = gSaveContext.save.saveInfo.checksum; + phi_s2 = gSaveContext.save.saveInfo.checksum; gSaveContext.save.saveInfo.checksum = 0; newCheckSum = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64]); - gSaveContext.save.saveInfo.checksum = oldCheckSum; + gSaveContext.save.saveInfo.checksum = phi_s2; - if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (oldCheckSum != newCheckSum)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (newCheckSum != phi_s2)) { // checksum didnt match, try backup save sp6E = 1; if ((gSaveContext.save.saveInfo.playerData.newf[0] == 'Z') && - (gSaveContext.save.saveInfo.playerData.newf[1] == 'E')) { - phi_s2 = false; - } - - // phi_s2 = false; + (gSaveContext.save.saveInfo.playerData.newf[1] == 'E') && + (gSaveContext.save.saveInfo.playerData.newf[2] == 'L') && + (gSaveContext.save.saveInfo.playerData.newf[3] == 'D') && + (gSaveContext.save.saveInfo.playerData.newf[4] == 'A')) {} // read backup save from flash + phi_s2 = false; if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64 + 1], gFlashSaveNumPages[sp64 + 1]) != 0) { // backup save didn't work @@ -1453,9 +1453,8 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { oldCheckSum = gSaveContext.save.saveInfo.checksum; gSaveContext.save.saveInfo.checksum = 0; - //! FAKE: (s32)sp64 if (phi_s2 || CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || - (oldCheckSum != Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[(s32)sp64]))) { + (oldCheckSum != Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64]))) { // backup save didn't work bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); @@ -1465,9 +1464,8 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { } gSaveContext.save.saveInfo.checksum = 0; - // FAKE: Needed? - gSaveContext.save.saveInfo.checksum = - Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64 & 0xFFFFFFFF]); + //! FAKE: [sp64 + 0]? + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64 + 0]); for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); sp7A++) { fileSelect->newf[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.newf[sp7A]; @@ -1491,13 +1489,12 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->walletUpgrades[sp76] = CUR_UPG_VALUE(UPG_WALLET); for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != 0xFF) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != ITEM_NONE) { phi_a0++; } } fileSelect->maskCount[sp76] = phi_a0; - fileSelect->heartPieceCount[sp76] = - ((gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C); + fileSelect->heartPieceCount[sp76] = GET_QUEST_HEART_PIECE_COUNT; } if (sp6E == 1) { @@ -1506,20 +1503,20 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { Sram_SyncWriteToFlash(sramCtx, gFlashSaveStartPages[sp64], gFlashSpecialSaveNumPages[sp64]); } else if (!sp6E) { // main save - phi_s7 = gSaveContext.save.saveInfo.checksum; + oldCheckSum = gSaveContext.save.saveInfo.checksum; if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64 + 1], gFlashSaveNumPages[sp64 + 1]) != 0) { - oldCheckSum = 1; + phi_s2 = 1; } else { Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); - oldCheckSum = gSaveContext.save.saveInfo.checksum; + phi_s2 = gSaveContext.save.saveInfo.checksum; gSaveContext.save.saveInfo.checksum = 0; sp7A = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); } - if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (oldCheckSum != sp7A) || - (oldCheckSum != phi_s7)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (sp7A != phi_s2) || + (oldCheckSum != phi_s2)) { SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64], gFlashSaveNumPages[sp64]); Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); @@ -1538,25 +1535,28 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); } else { + // phi_s2 = true; Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); - oldCheckSum = gSaveContext.save.saveInfo.checksum; + phi_s2 = gSaveContext.save.saveInfo.checksum; // test checksum of main save gSaveContext.save.saveInfo.checksum = 0; newCheckSum = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64]); - gSaveContext.save.saveInfo.checksum = oldCheckSum; + gSaveContext.save.saveInfo.checksum = phi_s2; - if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (oldCheckSum != newCheckSum)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (newCheckSum != phi_s2)) { // checksum didnt match, try backup save sp6E = 1; if ((gSaveContext.save.saveInfo.playerData.newf[0] == 'Z') && - (gSaveContext.save.saveInfo.playerData.newf[1] == 'E')) { - phi_s2 = false; - } + (gSaveContext.save.saveInfo.playerData.newf[1] == 'E') && + (gSaveContext.save.saveInfo.playerData.newf[2] == 'L') && + (gSaveContext.save.saveInfo.playerData.newf[3] == 'D') && + (gSaveContext.save.saveInfo.playerData.newf[4] == 'A')) {} + phi_s2 = false; // read backup save from flash if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64 + 1], - gFlashSaveNumPages[sp64 + 1])) { + gFlashSaveNumPages[sp64 + 1]) != 0) { // backup save didn't work phi_s2 = true; } @@ -1577,9 +1577,8 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { } gSaveContext.save.saveInfo.checksum = 0; - // FAKE: Needed? - gSaveContext.save.saveInfo.checksum = - Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64 & 0xFFFFFFFF]); + // FAKE: [sp64 + 0]? + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64 + 0]); for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); sp7A++) { fileSelect->newf[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.newf[sp7A]; @@ -1589,7 +1588,10 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->threeDayResetCount[sp76] = gSaveContext.save.saveInfo.playerData.threeDayResetCount; for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); sp7A++) { - fileSelect->fileNames[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.playerName[sp7A]; + fileSelect->fileNames[sp76][sp7A] = + (u32)gSaveContext.save.saveInfo.playerData.playerName[sp7A]; + //! FAKE: + if (1) {} } fileSelect->healthCapacity[sp76] = gSaveContext.save.saveInfo.playerData.healthCapacity; @@ -1603,13 +1605,12 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->walletUpgrades[sp76] = CUR_UPG_VALUE(UPG_WALLET); for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != 0xFF) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != ITEM_NONE) { phi_a0++; } } fileSelect->maskCount[sp76] = phi_a0; - fileSelect->heartPieceCount[sp76] = - ((gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C); + fileSelect->heartPieceCount[sp76] = GET_QUEST_HEART_PIECE_COUNT; } if (sp6E == 1) { @@ -1618,20 +1619,20 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { Sram_SyncWriteToFlash(sramCtx, gFlashSaveStartPages[sp64 + 1], gFlashSaveNumPages[sp64 + 1]); } else if (!sp6E) { // main save - phi_s7 = gSaveContext.save.saveInfo.checksum; + oldCheckSum = gSaveContext.save.saveInfo.checksum; if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64 + 1], - gFlashSaveNumPages[sp64 + 1])) { - oldCheckSum = 1; + gFlashSaveNumPages[sp64 + 1]) != 0) { + phi_s2 = 1; } else { Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); - oldCheckSum = gSaveContext.save.saveInfo.checksum; + phi_s2 = gSaveContext.save.saveInfo.checksum; gSaveContext.save.saveInfo.checksum = 0; sp7A = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64]); } - if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (oldCheckSum != sp7A) || - (oldCheckSum != phi_s7)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (sp7A != phi_s2) || + (oldCheckSum != phi_s2)) { SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[sp64], gFlashSaveNumPages[sp64]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); @@ -1673,9 +1674,6 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { gSaveContext.options.language = LANGUAGE_ENG; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_801457CC.s") -#endif void Sram_EraseSave(FileSelectState* fileSelect2, SramContext* sramCtx, s32 fileNum) { FileSelectState* fileSelect = fileSelect2; -- cgit v1.2.3 From 9d3a322da176f48c2a8ef489ea785eb8c090e64c Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 6 Nov 2023 20:32:05 -0300 Subject: fix fakes --- src/code/z_sram_NES.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/code') diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index bef18a20e..5f9e11878 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1374,18 +1374,18 @@ void func_80145698(SramContext* sramCtx) { } } +// Verifies save and use backup if corrupted? void func_801457CC(GameState* gameState, SramContext* sramCtx) { FileSelectState* fileSelect = (FileSelectState*)gameState; u16 sp7A; - u16 oldCheckSum; // s2 + u16 oldCheckSum; u16 sp76; - u16 sp64; // sp74? + u16 sp64; u16 phi_s2; - u16 phi_s7; + u16 pad; u16 sp6E; - u16 newCheckSum; // v0 - u16 phi_a0; // maskCount - u8 temp; + u16 newCheckSum; + u16 maskCount; if (gSaveContext.flashSaveAvailable) { D_801F6AF0 = gSaveContext.save.time; @@ -1420,7 +1420,6 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); } else { - // phi_s2 = true; Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); // test checksum of main save @@ -1488,12 +1487,13 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; fileSelect->walletUpgrades[sp76] = CUR_UPG_VALUE(UPG_WALLET); - for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != ITEM_NONE) { - phi_a0++; + for (sp7A = 0, maskCount = 0; sp7A < 24; sp7A++) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] == ITEM_NONE) { + continue; } + maskCount++; } - fileSelect->maskCount[sp76] = phi_a0; + fileSelect->maskCount[sp76] = maskCount; fileSelect->heartPieceCount[sp76] = GET_QUEST_HEART_PIECE_COUNT; } @@ -1535,7 +1535,6 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); } else { - // phi_s2 = true; Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[sp64]); phi_s2 = gSaveContext.save.saveInfo.checksum; @@ -1590,8 +1589,6 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); sp7A++) { fileSelect->fileNames[sp76][sp7A] = (u32)gSaveContext.save.saveInfo.playerData.playerName[sp7A]; - //! FAKE: - if (1) {} } fileSelect->healthCapacity[sp76] = gSaveContext.save.saveInfo.playerData.healthCapacity; @@ -1604,12 +1601,13 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; fileSelect->walletUpgrades[sp76] = CUR_UPG_VALUE(UPG_WALLET); - for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != ITEM_NONE) { - phi_a0++; + for (sp7A = 0, maskCount = 0; sp7A < 24; sp7A++) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] == ITEM_NONE) { + continue; } + maskCount++; } - fileSelect->maskCount[sp76] = phi_a0; + fileSelect->maskCount[sp76] = maskCount; fileSelect->heartPieceCount[sp76] = GET_QUEST_HEART_PIECE_COUNT; } -- cgit v1.2.3