From dd14084a5520e0d5778a2269b4d6b0ee89532e3c Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Mon, 14 Oct 2024 01:33:13 +0200 Subject: [PATCH] other improvements --- config/oot-e/symbols.txt | 2 +- config/oot-j/symbols.txt | 2 +- config/oot-u/symbols.txt | 2 +- include/emulator/flash.h | 2 +- src/emulator/flash.c | 5 ++--- src/emulator/library.c | 2 +- src/emulator/store.c | 4 ++-- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/config/oot-e/symbols.txt b/config/oot-e/symbols.txt index 83c6b0b..09b7892 100644 --- a/config/oot-e/symbols.txt +++ b/config/oot-e/symbols.txt @@ -622,7 +622,7 @@ flashGet64 = .text:0x80045150; // type:function size:0x8 scope:local flashGetBlock = .text:0x80045158; // type:function size:0x108 scope:local fn_80045260 = .text:0x80045260; // type:function size:0x50 fn_800452B0 = .text:0x800452B0; // type:function size:0x50 -fn_80045300 = .text:0x80045300; // type:function size:0x10 +flashGetSize = .text:0x80045300; // type:function size:0x10 flashEvent = .text:0x80045310; // type:function size:0x1DC SetTableTevStages = .text:0x800454EC; // type:function size:0x3B4 SetNumTexGensChans = .text:0x800458A0; // type:function size:0x164 diff --git a/config/oot-j/symbols.txt b/config/oot-j/symbols.txt index 8d2dee0..bac2866 100644 --- a/config/oot-j/symbols.txt +++ b/config/oot-j/symbols.txt @@ -622,7 +622,7 @@ flashGet64 = .text:0x80045150; // type:function size:0x8 scope:local flashGetBlock = .text:0x80045158; // type:function size:0x108 scope:local fn_80045260 = .text:0x80045260; // type:function size:0x50 fn_800452B0 = .text:0x800452B0; // type:function size:0x50 -fn_80045300 = .text:0x80045300; // type:function size:0x10 +flashGetSize = .text:0x80045300; // type:function size:0x10 flashEvent = .text:0x80045310; // type:function size:0x1DC SetTableTevStages = .text:0x800454EC; // type:function size:0x3B4 SetNumTexGensChans = .text:0x800458A0; // type:function size:0x164 diff --git a/config/oot-u/symbols.txt b/config/oot-u/symbols.txt index 5e73f0f..53eaf0c 100644 --- a/config/oot-u/symbols.txt +++ b/config/oot-u/symbols.txt @@ -622,7 +622,7 @@ flashGet64 = .text:0x8004516C; // type:function size:0x8 scope:local flashGetBlock = .text:0x80045174; // type:function size:0x108 scope:local fn_80045260 = .text:0x8004527C; // type:function size:0x50 fn_800452B0 = .text:0x800452CC; // type:function size:0x50 -fn_80045300 = .text:0x8004531C; // type:function size:0x10 +flashGetSize = .text:0x8004531C; // type:function size:0x10 flashEvent = .text:0x8004532C; // type:function size:0x1DC SetTableTevStages = .text:0x80045508; // type:function size:0x3B4 SetNumTexGensChans = .text:0x800458BC; // type:function size:0x164 diff --git a/include/emulator/flash.h b/include/emulator/flash.h index 25f23b1..da5c050 100644 --- a/include/emulator/flash.h +++ b/include/emulator/flash.h @@ -21,7 +21,7 @@ typedef struct Flash { bool fn_80045260(Flash* pFLASH, s32 arg1, void* arg2); bool fn_800452B0(Flash* pFLASH, s32 arg1, void* arg2); -bool fn_80045300(Flash* pFLASH, u32* arg1); +bool flashGetSize(Flash* pFLASH, u32* pnFlashSize); bool flashEvent(Flash* pFLASH, s32 nEvent, void* pArgument); extern _XL_OBJECTTYPE gClassFlash; diff --git a/src/emulator/flash.c b/src/emulator/flash.c index e36c98a..fa0d340 100644 --- a/src/emulator/flash.c +++ b/src/emulator/flash.c @@ -150,9 +150,8 @@ bool fn_800452B0(Flash* pFLASH, s32 arg1, void* arg2) { return true; } -bool fn_80045300(Flash* pFLASH, u32* arg1) { - *arg1 = pFLASH->nFlashSize; - +bool flashGetSize(Flash* pFLASH, u32* pnFlashSize) { + *pnFlashSize = pFLASH->nFlashSize; return true; } diff --git a/src/emulator/library.c b/src/emulator/library.c index acadbc2..3b65642 100644 --- a/src/emulator/library.c +++ b/src/emulator/library.c @@ -2624,7 +2624,7 @@ bool __osEepStatus(Cpu* pCPU) { return false; } - if (pFLASH != NULL && fn_80045300(pFLASH, &nStatus)) { + if (pFLASH != NULL && flashGetSize(pFLASH, &nStatus)) { status[0] = 0x80 | (nStatus == 0x4000 ? 0x40 : 0); status[1] = 0; status[2] = 0; diff --git a/src/emulator/store.c b/src/emulator/store.c index 1c4fe29..af12fb4 100644 --- a/src/emulator/store.c +++ b/src/emulator/store.c @@ -185,7 +185,7 @@ bool fn_80061BC0(Store* pStore, void* pHeapTarget, s32 nOffset, s32 nByteCount) static void fn_80061C08(s32 nResult, NANDCommandBlock* block) { Store* pStore = (Store*)NANDGetUserData(block); - if (nResult != 0) { + if (nResult != NAND_RESULT_OK) { pStore->eResult = nResult; } @@ -199,7 +199,7 @@ static void fn_80061C4C(s32 nResult, NANDCommandBlock* block) { pStore->eResult = nResult; nCloseResult = NANDCloseAsync(&pStore->nandFileInfo, fn_80061C08, &pStore->nandCmdBlock); - if (nCloseResult) { + if (nCloseResult != NAND_RESULT_OK) { pStore->eResult = nCloseResult; pStore->unk_B9 = 1; }