From ce14fc8a6ee15ea9cb5b2bb0e15b9adb5daf8837 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 30 May 2020 22:00:17 +0200 Subject: [PATCH] relocator: Make sure to call the memory_mapping main() function at first --- relocator/src/entry.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/relocator/src/entry.cpp b/relocator/src/entry.cpp index c0ef342..1753ddd 100644 --- a/relocator/src/entry.cpp +++ b/relocator/src/entry.cpp @@ -131,9 +131,20 @@ extern "C" void doStart(int argc, char **argv) { } for (int i = 0; i < gModuleData->number_used_modules; i++) { - DEBUG_FUNCTION_LINE("About to call %08X\n", gModuleData->module_data[i].entrypoint); - int ret = ((int (*)(int, char **)) (gModuleData->module_data[i].entrypoint))(argc, argv); - DEBUG_FUNCTION_LINE("return code was %d\n", ret); + if(strcmp(gModuleData->module_data[i].module_export_name, "homebrew_memorymapping") == 0){ + DEBUG_FUNCTION_LINE("About to call memory mapping (%08X)\n", gModuleData->module_data[i].entrypoint); + int ret = ((int (*)(int, char **)) (gModuleData->module_data[i].entrypoint))(argc, argv); + DEBUG_FUNCTION_LINE("return code was %d\n", ret); + break; + } + } + + for (int i = 0; i < gModuleData->number_used_modules; i++) { + if(strcmp(gModuleData->module_data[i].module_export_name, "homebrew_memorymapping") != 0) { + DEBUG_FUNCTION_LINE("About to call %08X\n", gModuleData->module_data[i].entrypoint); + int ret = ((int (*)(int, char **)) (gModuleData->module_data[i].entrypoint))(argc, argv); + DEBUG_FUNCTION_LINE("return code was %d\n", ret); + } } }