Simplify pre-setup. (#2)

* Simplify pre-setup.

Signed-off-by: Thomas Rohloff <v10lator@myway.de>
Co-authored-by: Maschell <Maschell@gmx.de>
This commit is contained in:
V10lator 2022-01-08 11:36:42 +01:00 committed by GitHub
parent dca014b2a5
commit 8cb5eb23fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;