Skip to content

Commit

Permalink
Simplify pre-setup. (#2)
Browse files Browse the repository at this point in the history
* Simplify pre-setup.

Signed-off-by: Thomas Rohloff <v10lator@myway.de>
Co-authored-by: Maschell <Maschell@gmx.de>
  • Loading branch information
V10lator and Maschell authored Jan 8, 2022
1 parent dca014b commit 8cb5eb2
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions source/hbl_install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8cb5eb2

Please sign in to comment.