From 8cb5eb23fe5042b7d623bac8fb73d1431ee9add8 Mon Sep 17 00:00:00 2001 From: V10lator Date: Sat, 8 Jan 2022 11:36:42 +0100 Subject: [PATCH] Simplify pre-setup. (#2) * Simplify pre-setup. Signed-off-by: Thomas Rohloff Co-authored-by: Maschell --- source/hbl_install.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/source/hbl_install.cpp b/source/hbl_install.cpp index ed652ad..71b9d70 100644 --- a/source/hbl_install.cpp +++ b/source/hbl_install.cpp @@ -144,22 +144,17 @@ const unsigned char homebrew_stub[] = static void InstallPatches() { OsSpecifics osSpecificFunctions; memset(&osSpecificFunctions, 0, sizeof(OsSpecifics)); - - unsigned int bufferU32; - /* Pre-setup a few options to defined values */ - bufferU32 = 550; - memcpy((void *) &OS_FIRMWARE, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0xDEADC0DE; - memcpy((void *) &MAIN_ENTRY_ADDR, &bufferU32, sizeof(bufferU32)); - memcpy((void *) &ELF_DATA_ADDR, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0; - memcpy((void *) &ELF_DATA_SIZE, &bufferU32, sizeof(bufferU32)); - memcpy((void *) &HBL_CHANNEL, &bufferU32, sizeof(bufferU32)); - + // If we install the sd_loader but don't have any homebrew loaded some applications won't start. // We load a stub that just opens the real app and opens the hbl when opening the mii maker. memcpy((void *) 0x00802000, homebrew_stub, sizeof(homebrew_stub)); + + /* Pre-setup a few options to defined values */ + OS_FIRMWARE = 550; MAIN_ENTRY_ADDR = 0x00802000; + ELF_DATA_ADDR = 0xDEADC0DE; + ELF_DATA_SIZE = 0; + HBL_CHANNEL = 0; osSpecificFunctions.addr_OSDynLoad_Acquire = (unsigned int) OSDynLoad_Acquire; osSpecificFunctions.addr_OSDynLoad_FindExport = (unsigned int) OSDynLoad_FindExport;