From a165d44090d1b2470f43f794ab0b28b879d31fa0 Mon Sep 17 00:00:00 2001 From: Nicolas Pixel Noble Date: Tue, 21 Nov 2023 22:39:02 -0800 Subject: [PATCH] Tweaking OpenBIOS' fastboot to work with cheat roms. --- src/mips/openbios/shell/shell.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mips/openbios/shell/shell.c b/src/mips/openbios/shell/shell.c index 471714d18..8dfafb059 100644 --- a/src/mips/openbios/shell/shell.c +++ b/src/mips/openbios/shell/shell.c @@ -47,10 +47,13 @@ int startShell(uint32_t arg) { } #endif #ifdef OPENBIOS_FASTBOOT - return 0; + // Embed a simple jr $ra / nop to simulate a shell being copied and run, + // so cheat cart hooks and other tricks can still work properly. + static const uint32_t dummy[2] = {0x03e00008, 0}; + memcpy((uint32_t *)0x80030000, dummy, sizeof(dummy)); #else memcpy((uint32_t *)0x80030000, _binary_shell_bin_start, _binary_shell_bin_end - _binary_shell_bin_start); +#endif flushCache(); return ((int (*)(int))0x80030000)(arg); -#endif }