From 772178a64a957660c888fd70aa129344df353dfa Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Sat, 24 Oct 2026 22:43:23 +0200 Subject: [PATCH 1/3] name reset_flag --- include/vc.h | 4 ++-- lib/hb-NACE.txt | 2 +- lib/hb-NACJ.txt | 2 +- lib/hb-NARE.txt | 2 +- lib/hb-NARJ.txt | 2 +- src/homeboy.c | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/vc.h b/include/vc.h index a56b83c..fba4d48 100644 --- a/include/vc.h +++ b/include/vc.h @@ -148,7 +148,7 @@ typedef struct Ram { #endif } Ram; // size = 0x48 -#define SYSTEM_CPU(pSystem) ((void*)(((System*)(pSystem))->apObject[SOT_CPU])) +#define SYSTEM_CPU(pSystem) ((Cpu*)(((System*)(pSystem))->apObject[SOT_CPU])) #define SYSTEM_ROM(pSystem) ((Rom*)(((System*)(pSystem))->apObject[SOT_ROM])) // xlObject.h @@ -228,7 +228,7 @@ int iosCreateHeap(void* heap, size_t size); void* iosAllocAligned(int hid, size_t size, size_t page_size); bool iosFree(int hid, void* ptr); -extern u32 reset_flag; // TODO: use decomp name +extern bool sResetBtnPressed; #define title_id (*(volatile u32*)0x80003180) diff --git a/lib/hb-NACE.txt b/lib/hb-NACE.txt index 75b7055..ac35ac9 100644 --- a/lib/hb-NACE.txt +++ b/lib/hb-NACE.txt @@ -37,4 +37,4 @@ iosAllocAligned = 0x800B9B50; iosFree = 0x800B9B54; ganMapGPR = 0x80170B68; gpSystem = 0x8025D0E0; -reset_flag = 0x8025D1EC; +sResetBtnPressed = 0x8025D1EC; diff --git a/lib/hb-NACJ.txt b/lib/hb-NACJ.txt index db72e02..9bd3079 100644 --- a/lib/hb-NACJ.txt +++ b/lib/hb-NACJ.txt @@ -37,4 +37,4 @@ iosAllocAligned = 0x800B9B44; iosFree = 0x800B9B48; ganMapGPR = 0x80170B68; gpSystem = 0x8025CFE0; -reset_flag = 0x8025D0EC; +sResetBtnPressed = 0x8025D0EC; diff --git a/lib/hb-NARE.txt b/lib/hb-NARE.txt index fdb9118..fe26a82 100644 --- a/lib/hb-NARE.txt +++ b/lib/hb-NARE.txt @@ -37,4 +37,4 @@ iosAllocAligned = 0x800C62F8; iosFree = 0x800C62FC; ganMapGPR = 0x8014CEB0; gpSystem = 0x801FB838; -reset_flag = 0x801FBA28; +sResetBtnPressed = 0x801FBA28; diff --git a/lib/hb-NARJ.txt b/lib/hb-NARJ.txt index d2d541c..5493b86 100644 --- a/lib/hb-NARJ.txt +++ b/lib/hb-NARJ.txt @@ -37,4 +37,4 @@ iosAllocAligned = 0x800C693C; iosFree = 0x800C6940; ganMapGPR = 0x8014F3F0; gpSystem = 0x80200638; -reset_flag = 0x80200830; +sResetBtnPressed = 0x80200830; diff --git a/src/homeboy.c b/src/homeboy.c index ca788b2..8a6517a 100644 --- a/src/homeboy.c +++ b/src/homeboy.c @@ -86,7 +86,8 @@ static void do_status_update() { fs_close(fd); } - reset_flag = 1; + // see https://github.com/zeldaret/oot-vc/blob/6fee0769e9e2f0ba7ad20c2b36c5c6063f24a8bd/src/emulator/helpRVL.c#L1170 + sResetBtnPressed = 1; } #endif From 55d137d3b91d3c87d42c905ede0818a55533b0b8 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Sat, 24 Oct 2026 22:46:16 +0200 Subject: [PATCH 2/3] remove call to simulatorPlayMovie --- lib/hb-D43E.txt | 2 ++ lib/hb-D43J.txt | 2 ++ lib/hb-PZLE.txt | 2 ++ lib/hb-PZLJ.txt | 2 ++ src/hooks.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+) diff --git a/lib/hb-D43E.txt b/lib/hb-D43E.txt index ee2fcb0..5defab7 100644 --- a/lib/hb-D43E.txt +++ b/lib/hb-D43E.txt @@ -30,3 +30,5 @@ OSGetTick = 0x800A1D80; ganMapGPR = 0x800EC858; gpSystem = 0x80135DE0; gnFlagZelda = 0x80135EB8; +cpuExecuteJump_hook_addr_ha = 0x80036914; +cpuExecuteJump_hook_addr_l = 0x80036918; diff --git a/lib/hb-D43J.txt b/lib/hb-D43J.txt index eba3e56..794a52c 100644 --- a/lib/hb-D43J.txt +++ b/lib/hb-D43J.txt @@ -30,3 +30,5 @@ OSGetTick = 0x800A14F8; ganMapGPR = 0x800ED338; gpSystem = 0x8018B894; gnFlagZelda = 0x8018B968; +cpuExecuteJump_hook_addr_ha = 0x80036170; +cpuExecuteJump_hook_addr_l = 0x80036174; diff --git a/lib/hb-PZLE.txt b/lib/hb-PZLE.txt index 57b3fdc..8491404 100644 --- a/lib/hb-PZLE.txt +++ b/lib/hb-PZLE.txt @@ -30,3 +30,5 @@ OSGetTick = 0x800A233C; ganMapGPR = 0x800EE378; gpSystem = 0x80137B00; gnFlagZelda = 0x80137BD8; +cpuExecuteJump_hook_addr_ha = 0x80036940; +cpuExecuteJump_hook_addr_l = 0x80036944; diff --git a/lib/hb-PZLJ.txt b/lib/hb-PZLJ.txt index 0bc84a4..8c47558 100644 --- a/lib/hb-PZLJ.txt +++ b/lib/hb-PZLJ.txt @@ -30,3 +30,5 @@ OSGetTick = 0x800A22C0; ganMapGPR = 0x800EBE70; gpSystem = 0x80135600; gnFlagZelda = 0x801356D8; +cpuExecuteJump_hook_addr_ha = 0x800368C4; +cpuExecuteJump_hook_addr_l = 0x800368C8; diff --git a/src/hooks.c b/src/hooks.c index 3f9a63b..d8f963b 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -16,6 +16,8 @@ extern u8 romSetCacheSize_hook_addr[]; extern u8 romLoadRange_hook_addr_1[]; extern u8 romLoadRange_hook_addr_2[]; extern u8 mcardWrite_hook_addr[]; +extern u8 cpuExecuteJump_hook_addr_ha[]; +extern u8 cpuExecuteJump_hook_addr_l[]; #endif // Change an instruction in memory. @@ -197,6 +199,30 @@ bool mcardWrite_hook(MemCard* pMCard, s32 address, s32 size, char* data) { return mcardWrite(pMCard, address, size, data); } +s32 cpuExecuteJump_hook(Cpu* pCPU, s32 nCount, s32 nAddressN64, s32 nAddressGCN) { + nCount = OSGetTick(); + + if (pCPU->nWaitPC != 0) { + pCPU->nMode |= 8; + } else { + pCPU->nMode &= ~8; + } + + if (gpSystem->eTypeROM == 4 /* SRT_ZELDA1 */ && nAddressN64 == 0x81000000) { + // do nothing instead of trying to play the movie + } else { + pCPU->nMode |= 4; + pCPU->nPC = nAddressN64; + + if (!cpuExecuteUpdate(pCPU, &nAddressGCN, nCount)) { + return 0; + } + } + + pCPU->nTickLast = OSGetTick(); + return nAddressGCN; +} + #endif void init_hooks(void) { @@ -224,5 +250,9 @@ void init_hooks(void) { // Hook to mcardWrite to fix gz settings not saving patch_bl(mcardWrite_hook_addr, mcardWrite_hook); + + // Hook to cpuExecuteJump to avoid playing the non-existent credits movie + patch_ha(cpuExecuteJump_hook_addr_ha, cpuExecuteJump_hook); + patch_l(cpuExecuteJump_hook_addr_l, cpuExecuteJump_hook); #endif } From 43780369a893ec54aae19b76dcdbe0979d9cc734 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Sat, 24 Oct 2026 23:11:39 +0200 Subject: [PATCH 3/3] format --- src/homeboy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/homeboy.c b/src/homeboy.c index 8a6517a..31b791b 100644 --- a/src/homeboy.c +++ b/src/homeboy.c @@ -86,7 +86,8 @@ static void do_status_update() { fs_close(fd); } - // see https://github.com/zeldaret/oot-vc/blob/6fee0769e9e2f0ba7ad20c2b36c5c6063f24a8bd/src/emulator/helpRVL.c#L1170 + // see + // https://github.com/zeldaret/oot-vc/blob/6fee0769e9e2f0ba7ad20c2b36c5c6063f24a8bd/src/emulator/helpRVL.c#L1170 sResetBtnPressed = 1; } #endif