From 2bff8c2653a4010c2c6930b5239d2595ab4574a2 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 17 Sep 2021 16:28:37 +0200 Subject: [PATCH] Override __init_wut_socket and __fini_wut_socket --- .gitignore | 1 + libraries/libwups/main.cpp | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 078a9f4..b627c6b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ debug/ *.jekyll-metadata *.cbp lib/ +cmake-build-debug/ diff --git a/libraries/libwups/main.cpp b/libraries/libwups/main.cpp index 93a324f..2b8d01f 100644 --- a/libraries/libwups/main.cpp +++ b/libraries/libwups/main.cpp @@ -3,4 +3,27 @@ extern "C" void OSFatal(const char *msg); extern "C" void __wups_start(){ OSFatal("This file needs to be run with the Wii U Plugin System."); } - \ No newline at end of file + +extern __attribute__((weak)) void __wut_socket_init_devoptab(); +extern __attribute__((weak)) void __wut_socket_fini_devoptab(); + +static int __wut_socket_devoptab_added = 0; + +extern void socket_lib_init(); + +void __attribute__((weak)) __init_wut_socket() { + if(!&__wut_socket_init_devoptab) return; + if (!__wut_socket_devoptab_added) { + socket_lib_init(); + __wut_socket_init_devoptab(); + __wut_socket_devoptab_added = 1; + } +} + +void __attribute__((weak)) __fini_wut_socket() { + if(!&__wut_socket_init_devoptab || !&__wut_socket_fini_devoptab) return; + if (__wut_socket_devoptab_added) { + __wut_socket_fini_devoptab(); + __wut_socket_devoptab_added = 0; + } +} \ No newline at end of file