From f7f8b007facd2d099aa295a496f6ef63862690bd Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 26 Mar 2023 15:27:30 +0200 Subject: [PATCH] Make sure the sdaBase and sda2Base are set properly --- wumsloader/src/entry.cpp | 9 +++++++++ wumsloader/src/utils/imports.h | 1 + 2 files changed, 10 insertions(+) diff --git a/wumsloader/src/entry.cpp b/wumsloader/src/entry.cpp index 7b36a2c..a6e10a9 100644 --- a/wumsloader/src/entry.cpp +++ b/wumsloader/src/entry.cpp @@ -11,6 +11,7 @@ #include "utils/utils.h" #include "version.h" #include +#include #include #include #include @@ -43,6 +44,14 @@ extern "C" int _start(int argc, char **argv) { doStart(argc, argv); } + KernelInfo0 kernelInfo0; + __KernelGetInfo0(&kernelInfo0, 0); + asm( + "mr 13,%0\n" + "mr 2,%1\n" ::"r"(kernelInfo0.sdaBase), + "r"(kernelInfo0.sda2Base) + :); + return ((int (*)(int, char **))(*(unsigned int *) 0x1005E040))(argc, argv); } diff --git a/wumsloader/src/utils/imports.h b/wumsloader/src/utils/imports.h index db0f9cd..8087c91 100644 --- a/wumsloader/src/utils/imports.h +++ b/wumsloader/src/utils/imports.h @@ -34,6 +34,7 @@ IMPORT(OSSignalCond); IMPORT(OSSwapAtomic); IMPORT(OSDynLoad_GetAllocator); IMPORT(OSDynLoad_SetAllocator); +IMPORT(__KernelGetInfo); IMPORT(FSTimeToCalendarTime); IMPORT(FSInit);