From d2f071a9ae256e46576629600d1695b4125d1158 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 8 Aug 2022 11:45:02 +0200 Subject: [PATCH] Use wut 1.1.1 --- Dockerfile | 2 +- src/crt.c | 36 ++++++++++++++++++++++++++++++++++++ src/imports.h | 2 ++ src/main.cpp | 8 ++++---- 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/crt.c diff --git a/Dockerfile b/Dockerfile index 080eec7..08fc052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM wiiuenv/devkitppc:20211229 +FROM wiiuenv/devkitppc:20220806 WORKDIR project \ No newline at end of file diff --git a/src/crt.c b/src/crt.c new file mode 100644 index 0000000..954c654 --- /dev/null +++ b/src/crt.c @@ -0,0 +1,36 @@ +void __init_wut_malloc(); + +void __init_wut_newlib(); + +void __init_wut_stdcpp(); + +void __init_wut_devoptab(); + +void __attribute__((weak)) __init_wut_socket(); + +void __fini_wut_malloc(); + +void __fini_wut_newlib(); + +void __fini_wut_stdcpp(); + +void __fini_wut_devoptab(); + +void __attribute__((weak)) __fini_wut_socket(); + +void __attribute__((weak)) +init_wut() { + __init_wut_malloc(); + __init_wut_newlib(); + __init_wut_stdcpp(); + __init_wut_devoptab(); + if (&__init_wut_socket) __init_wut_socket(); +} + +void __attribute__((weak)) +fini_wut() { + __fini_wut_devoptab(); + __fini_wut_stdcpp(); + __fini_wut_newlib(); + __fini_wut_malloc(); +} diff --git a/src/imports.h b/src/imports.h index 60ce3d9..aa69e7a 100644 --- a/src/imports.h +++ b/src/imports.h @@ -58,6 +58,7 @@ IMPORT(OSCompareAndSwapAtomic); IMPORT(OSGetThreadSpecific); IMPORT(OSSetThreadSpecific); IMPORT(OSReport); +IMPORT(OSSwapAtomic); IMPORT(exit); IMPORT(_Exit); @@ -92,6 +93,7 @@ IMPORT(FSChangeDir); IMPORT(FSGetFreeSpaceSize); IMPORT(FSGetStat); IMPORT(FSRemove); +IMPORT(FSOpenFileEx); IMPORT(FSOpenFile); IMPORT(FSCloseFile); IMPORT(FSOpenDir); diff --git a/src/main.cpp b/src/main.cpp index e6b911b..64f9e3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,8 +41,8 @@ std::map get_all_payloads(const char *relativefilepath std::string PayloadSelectionScreen(const std::map &payloads); -extern "C" void __init_wut(); -extern "C" void __fini_wut(); +extern "C" void init_wut(); +extern "C" void fini_wut(); MEMExpHeapBlock *memory_start = nullptr; extern "C" uint32_t start_wrapper(int argc, char **argv) { @@ -54,7 +54,7 @@ extern "C" uint32_t start_wrapper(int argc, char **argv) { auto heap = (MEMExpHeap *) mem2_heap_handle; memory_start = heap->usedList.tail; - __init_wut(); + init_wut(); WHBLogUdpInit(); WHBLogCafeInit(); @@ -88,7 +88,7 @@ extern "C" uint32_t start_wrapper(int argc, char **argv) { WHBLogUdpDeinit(); WHBLogCafeDeinit(); - __fini_wut(); + fini_wut(); revertKernelHook();