From 69f8e96c4a6539547512e4e944512b8f40b96cd2 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 30 Oct 2017 21:48:24 +0100 Subject: [PATCH] Added missing defines and optimized the function patcher --- source/kernel/kernel_defs.h | 90 +++++++++++++++ source/language/gettext.h | 3 + source/utils/function_patcher.cpp | 175 +++++++++++++++++++----------- source/utils/function_patcher.h | 17 +-- 4 files changed, 203 insertions(+), 82 deletions(-) diff --git a/source/kernel/kernel_defs.h b/source/kernel/kernel_defs.h index e69264e..17c6473 100644 --- a/source/kernel/kernel_defs.h +++ b/source/kernel/kernel_defs.h @@ -8,6 +8,96 @@ extern "C" { #endif +// original structure in the kernel that is originally 0x1270 long +typedef struct +{ + uint32_t version_cos_xml; // version tag from cos.xml + uint64_t os_version; // os_version from app.xml + uint64_t title_id; // title_id tag from app.xml + uint32_t app_type; // app_type tag from app.xml + uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure) + char rpx_name[0x1000]; // rpx name from cos.xml + uint32_t unknown2; // 0x050B8304 in mii maker and system menu (looks a bit like permissions complex that got masked!?) + uint32_t unknown3[63]; // those were all zeros, but its probably connected with unknown2 + uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app + uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?) + uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?) + uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?) + uint32_t max_codesize; // max_codesize in cos.xml + uint32_t overlay_arena; // overlay_arena in cos.xml + uint32_t unknown4[59]; // all zeros it seems + uint32_t default_stack0_size; // not sure because always 0 but very likely + uint32_t default_stack1_size; // not sure because always 0 but very likely + uint32_t default_stack2_size; // not sure because always 0 but very likely + uint32_t default_redzone0_size; // not sure because always 0 but very likely + uint32_t default_redzone1_size; // not sure because always 0 but very likely + uint32_t default_redzone2_size; // not sure because always 0 but very likely + uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker + uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker + uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker + uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker + uint32_t title_version; // from app.xml, 0x32 on mii maker + /* + // --------------------------------------------------------------------------------------------------------------------------------------------- + // the next part might be changing from title to title?! I don't think its important but nice to know maybe.... + // --------------------------------------------------------------------------------------------------------------------------------------------- + char mlc[4]; // string "mlc" on mii maker and sysmenu + uint32_t unknown5[7]; // all zeros on mii maker and sysmenu + uint32_t unknown6_one; // 0x01 on mii maker and sysmenu + // --------------------------------------------------------------------------------------------------------------------------------------------- + char ACP[4]; // string "ACP" on mii maker and sysmenu + uint32_t unknown7[15]; // all zeros on mii maker and sysmenu + uint32_t unknown8_5; // 0x05 on mii maker and sysmenu + uint32_t unknown9_zero; // 0x00 on mii maker and sysmenu + uint32_t unknown10_ptr; // 0xFF23DD0C pointer on mii maker and sysmenu + // --------------------------------------------------------------------------------------------------------------------------------------------- + char UVD[4]; // string "UVD" on mii maker and sysmenu + uint32_t unknown11[15]; // all zeros on mii maker and sysmenu + uint32_t unknown12_5; // 0x05 on mii maker and sysmenu + uint32_t unknown13_zero; // 0x00 on mii maker and sysmenu + uint32_t unknown14_ptr; // 0xFF23EFC8 pointer on mii maker and sysmenu + // --------------------------------------------------------------------------------------------------------------------------------------------- + char SND[4]; // string "SND" on mii maker and sysmenu + uint32_t unknown15[15]; // all zeros on mii maker and sysmenu + uint32_t unknown16_5; // 0x05 on mii maker and sysmenu + uint32_t unknown17_zero; // 0x00 on mii maker and sysmenu + uint32_t unknown18_ptr; // 0xFF23F014 pointer on mii maker and sysmenu + // --------------------------------------------------------------------------------------------------------------------------------------------- + uint32_t unknown19; // 0x02 on miimaker, 0x0F on system menu + */ + // after that only zeros follow +} __attribute__((packed)) CosAppXmlInfo; + + +// Our own cos/app.xml struct which uses only uses as much memory as really needed, since many things are just zeros in the above structure +// This structure is only 0x64 bytes long + RPX name length (dynamic up to 0x1000 theoretically) +typedef struct +{ + uint32_t version_cos_xml; // version tag from cos.xml + uint64_t os_version; // os_version from app.xml + uint64_t title_id; // title_id tag from app.xml + uint32_t app_type; // app_type tag from app.xml + uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure) + uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app + uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?) + uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?) + uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?) + uint32_t max_codesize; // max_codesize in cos.xml + uint32_t overlay_arena; // overlay_arena in cos.xml + uint32_t default_stack0_size; // not sure because always 0 but very likely + uint32_t default_stack1_size; // not sure because always 0 but very likely + uint32_t default_stack2_size; // not sure because always 0 but very likely + uint32_t default_redzone0_size; // not sure because always 0 but very likely + uint32_t default_redzone1_size; // not sure because always 0 but very likely + uint32_t default_redzone2_size; // not sure because always 0 but very likely + uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker + uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker + uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker + uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker + uint32_t title_version; // from app.xml, 0x32 on mii maker + char rpx_name[FS_MAX_ENTNAME_SIZE]; // rpx name from cos.xml, length 256 as it can't get bigger from FS anyway +} __attribute__((packed)) ReducedCosAppXmlInfo; + typedef struct _bat_t { u32 h; diff --git a/source/language/gettext.h b/source/language/gettext.h index e1da228..75f4c3c 100644 --- a/source/language/gettext.h +++ b/source/language/gettext.h @@ -22,6 +22,9 @@ extern "C" { #endif + #define tr(s) gettext(s) + #define trNOOP(s) s + bool gettextLoadLanguage(const char* langFile); void gettextCleanUp(void); /* diff --git a/source/utils/function_patcher.cpp b/source/utils/function_patcher.cpp index 979e64e..b7d35d4 100644 --- a/source/utils/function_patcher.cpp +++ b/source/utils/function_patcher.cpp @@ -31,6 +31,25 @@ #define CODE_RW_BASE_OFFSET 0x00000000 #define DEBUG_LOG_DYN 0 +u32 acp_handle_internal = 0; +u32 aoc_handle_internal = 0; +u32 sound_handle_internal = 0; +u32 sound_handle_internal_old = 0; +u32 libcurl_handle_internal = 0; +u32 gx2_handle_internal = 0; +u32 nfp_handle_internal = 0; +u32 nn_act_handle_internal = 0; +u32 nn_nim_handle_internal = 0; +u32 nn_save_handle_internal = 0; +u32 ntag_handle_internal = 0; +u32 coreinit_handle_internal = 0; +u32 padscore_handle_internal = 0; +u32 proc_ui_handle_internal = 0; +u32 nsysnet_handle_internal = 0; +u32 sysapp_handle_internal = 0; +u32 syshid_handle_internal = 0; +u32 vpad_handle_internal = 0; +u32 vpadbase_handle_internal = 0; /* * Patches a function that is loaded at the start of each application. Its not required to restore, at least when they are really dynamic. @@ -38,6 +57,8 @@ */ void PatchInvidualMethodHooks(hooks_magic_t method_hooks[],s32 hook_information_size, volatile u32 dynamic_method_calls[]){ SetupKernelCallback(); //Patch Kernel. Just to be sure. + InitAcquireOS(); + resetLibs(); DEBUG_FUNCTION_LINE("Patching %d given functions\n",hook_information_size); /* Patch branches to it. */ @@ -145,8 +166,9 @@ void PatchInvidualMethodHooks(hooks_magic_t method_hooks[],s32 hook_information_ /* ****************************************************************** */ /* RESTORE ORIGINAL INSTRUCTIONS */ /* ****************************************************************** */ -void RestoreInvidualInstructions(hooks_magic_t method_hooks[],s32 hook_information_size) -{ +void RestoreInvidualInstructions(hooks_magic_t method_hooks[],s32 hook_information_size){ + InitAcquireOS(); + resetLibs(); DEBUG_FUNCTION_LINE("Restoring given functions!\n"); s32 method_hooks_count = hook_information_size; for(s32 i = 0; i < method_hooks_count; i++) @@ -223,130 +245,129 @@ u32 GetAddressOfFunction(const char * functionName,u32 library){ u32 rpl_handle = 0; if(library == LIB_CORE_INIT){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_CORE_INIT\n", functionName);} - if(coreinit_handle == 0){InitAcquireOS();} - if(coreinit_handle == 0){DEBUG_FUNCTION_LINE("LIB_CORE_INIT failed to acquire\n"); return 0;} - - rpl_handle = coreinit_handle; + if(coreinit_handle_internal == 0){OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle_internal);} + if(coreinit_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_CORE_INIT failed to acquire\n"); return 0;} + rpl_handle = coreinit_handle_internal; } else if(library == LIB_NSYSNET){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_NSYSNET\n", functionName);} - if(nsysnet_handle == 0){InitAcquireSocket();} - if(nsysnet_handle == 0){DEBUG_FUNCTION_LINE("LIB_NSYSNET failed to acquire\n"); return 0;} - rpl_handle = nsysnet_handle; + if(nsysnet_handle_internal == 0){OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle_internal);} + if(nsysnet_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_NSYSNET failed to acquire\n"); return 0;} + rpl_handle = nsysnet_handle_internal; } else if(library == LIB_GX2){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_GX2\n", functionName);} - if(gx2_handle == 0){InitAcquireGX2();} - if(gx2_handle == 0){DEBUG_FUNCTION_LINE("LIB_GX2 failed to acquire\n"); return 0;} - rpl_handle = gx2_handle; + if(gx2_handle_internal == 0){OSDynLoad_Acquire("gx2.rpl", &gx2_handle_internal);} + if(gx2_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_GX2 failed to acquire\n"); return 0;} + rpl_handle = gx2_handle_internal; } else if(library == LIB_AOC){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_AOC\n", functionName);} - if(aoc_handle == 0){InitAcquireAoc();} - if(aoc_handle == 0){DEBUG_FUNCTION_LINE("LIB_AOC failed to acquire\n"); return 0;} - rpl_handle = aoc_handle; + if(aoc_handle_internal == 0){OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle_internal);} + if(aoc_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_AOC failed to acquire\n"); return 0;} + rpl_handle = aoc_handle_internal; } else if(library == LIB_AX){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_AX\n", functionName);} - if(sound_handle == 0){InitAcquireAX();} - if(sound_handle == 0){DEBUG_FUNCTION_LINE("LIB_AX failed to acquire\n"); return 0;} - rpl_handle = sound_handle; + if(sound_handle_internal == 0){OSDynLoad_Acquire("sndcore2.rpl", &sound_handle_internal);} + if(sound_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_AX failed to acquire\n"); return 0;} + rpl_handle = sound_handle_internal; } else if(library == LIB_AX_OLD){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_AX_OLD\n", functionName);} - if(sound_handle_old == 0){InitAcquireAX();} - if(sound_handle_old == 0){DEBUG_FUNCTION_LINE("LIB_AX_OLD failed to acquire\n"); return 0;} - rpl_handle = sound_handle_old; + if(sound_handle_internal_old == 0){OSDynLoad_Acquire("snd_core.rpl", &sound_handle_internal_old);} + if(sound_handle_internal_old == 0){DEBUG_FUNCTION_LINE("LIB_AX_OLD failed to acquire\n"); return 0;} + rpl_handle = sound_handle_internal_old; } else if(library == LIB_FS){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_FS\n", functionName);} - if(coreinit_handle == 0){InitAcquireOS();} - if(coreinit_handle == 0){DEBUG_FUNCTION_LINE("LIB_FS failed to acquire\n"); return 0;} - rpl_handle = coreinit_handle; + if(coreinit_handle_internal == 0){OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle_internal);} + if(coreinit_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_FS failed to acquire\n"); return 0;} + rpl_handle = coreinit_handle_internal; } else if(library == LIB_OS){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_OS\n", functionName);} - if(coreinit_handle == 0){InitAcquireOS();} - if(coreinit_handle == 0){DEBUG_FUNCTION_LINE("LIB_OS failed to acquire\n"); return 0;} - rpl_handle = coreinit_handle; + if(coreinit_handle_internal == 0){OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle_internal);} + if(coreinit_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_OS failed to acquire\n"); return 0;} + rpl_handle = coreinit_handle_internal; } else if(library == LIB_PADSCORE){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_PADSCORE\n", functionName);} - if(padscore_handle == 0){InitAcquirePadScore();} - if(padscore_handle == 0){DEBUG_FUNCTION_LINE("LIB_PADSCORE failed to acquire\n"); return 0;} - rpl_handle = padscore_handle; + if(padscore_handle_internal == 0){OSDynLoad_Acquire("padscore.rpl", &padscore_handle_internal);} + if(padscore_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_PADSCORE failed to acquire\n"); return 0;} + rpl_handle = padscore_handle_internal; } else if(library == LIB_SOCKET){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_SOCKET\n", functionName);} - if(nsysnet_handle == 0){InitAcquireSocket();} - if(nsysnet_handle == 0){DEBUG_FUNCTION_LINE("LIB_SOCKET failed to acquire\n"); return 0;} - rpl_handle = nsysnet_handle; + if(nsysnet_handle_internal == 0){OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle_internal);} + if(nsysnet_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_SOCKET failed to acquire\n"); return 0;} + rpl_handle = nsysnet_handle_internal; } else if(library == LIB_SYS){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_SYS\n", functionName);} - if(sysapp_handle == 0){InitAcquireSys();} - if(sysapp_handle == 0){DEBUG_FUNCTION_LINE("LIB_SYS failed to acquire\n"); return 0;} - rpl_handle = sysapp_handle; + if(sysapp_handle_internal == 0){OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle_internal);} + if(sysapp_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_SYS failed to acquire\n"); return 0;} + rpl_handle = sysapp_handle_internal; } else if(library == LIB_VPAD){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_VPAD\n", functionName);} - if(vpad_handle == 0){InitAcquireVPad();} - if(vpad_handle == 0){DEBUG_FUNCTION_LINE("LIB_VPAD failed to acquire\n"); return 0;} - rpl_handle = vpad_handle; + if(vpad_handle_internal == 0){ OSDynLoad_Acquire("vpad.rpl", &vpad_handle_internal);} + if(vpad_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_VPAD failed to acquire\n"); return 0;} + rpl_handle = vpad_handle_internal; } else if(library == LIB_NN_ACP){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_NN_ACP\n", functionName);} - if(acp_handle == 0){InitAcquireACP();} - if(acp_handle == 0){DEBUG_FUNCTION_LINE("LIB_NN_ACP failed to acquire\n"); return 0;} - rpl_handle = acp_handle; + if(acp_handle_internal == 0){OSDynLoad_Acquire("nn_acp.rpl", &acp_handle_internal);} + if(acp_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_NN_ACP failed to acquire\n"); return 0;} + rpl_handle = acp_handle_internal; } else if(library == LIB_SYSHID){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_SYSHID\n", functionName);} - if(syshid_handle == 0){InitAcquireSysHID();} - if(syshid_handle == 0){DEBUG_FUNCTION_LINE("LIB_SYSHID failed to acquire\n"); return 0;} - rpl_handle = syshid_handle; + if(syshid_handle_internal == 0){OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle_internal);} + if(syshid_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_SYSHID failed to acquire\n"); return 0;} + rpl_handle = syshid_handle_internal; } else if(library == LIB_VPADBASE){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_VPADBASE\n", functionName);} - if(vpadbase_handle == 0){InitAcquireVPad();} - if(vpadbase_handle == 0){DEBUG_FUNCTION_LINE("LIB_VPADBASE failed to acquire\n"); return 0;} - rpl_handle = vpadbase_handle; + if(vpadbase_handle_internal == 0){OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle_internal);} + if(vpadbase_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_VPADBASE failed to acquire\n"); return 0;} + rpl_handle = vpadbase_handle_internal; } else if(library == LIB_PROC_UI){ if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("FindExport of %s! From LIB_PROC_UI\n", functionName);} - if(proc_ui_handle == 0){InitAcquireProcUI();} - if(proc_ui_handle == 0){DEBUG_FUNCTION_LINE("LIB_PROC_UI failed to acquire\n"); return 0;} - rpl_handle = proc_ui_handle; + if(proc_ui_handle_internal == 0){OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle_internal);} + if(proc_ui_handle_internal == 0){DEBUG_FUNCTION_LINE("LIB_PROC_UI failed to acquire\n"); return 0;} + rpl_handle = proc_ui_handle_internal; } else if(library == LIB_NTAG){ if(DEBUG_LOG_DYN){log_printf("FindExport of %s! From LIB_NTAG\n", functionName);} - if(ntag_handle == 0){InitAcquireNTAG();} - if(ntag_handle == 0){log_print("LIB_NTAG failed to acquire\n"); return 0;} - rpl_handle = ntag_handle; + if(ntag_handle_internal == 0){OSDynLoad_Acquire("ntag.rpl", &ntag_handle_internal);} + if(ntag_handle_internal == 0){log_print("LIB_NTAG failed to acquire\n"); return 0;} + rpl_handle = ntag_handle_internal; } else if(library == LIB_NFP){ if(DEBUG_LOG_DYN){log_printf("FindExport of %s! From LIB_NFP\n", functionName);} - if(nfp_handle == 0){InitAcquireNFP();} - if(nfp_handle == 0){log_print("LIB_NFP failed to acquire\n"); return 0;} - rpl_handle = nfp_handle; + if(nfp_handle_internal == 0){OSDynLoad_Acquire("nn_nfp.rpl", &nfp_handle_internal);} + if(nfp_handle_internal == 0){log_print("LIB_NFP failed to acquire\n"); return 0;} + rpl_handle = nfp_handle_internal; } else if(library == LIB_SAVE){ if(DEBUG_LOG_DYN){log_printf("FindExport of %s! From LIB_SAVE\n", functionName);} - if(nn_save_handle == 0){InitAcquireSave();} - if(nn_save_handle == 0){log_print("LIB_SAVE failed to acquire\n"); return 0;} - rpl_handle = nn_save_handle; + if(nn_save_handle_internal == 0){OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle_internal);} + if(nn_save_handle_internal == 0){log_print("LIB_SAVE failed to acquire\n"); return 0;} + rpl_handle = nn_save_handle_internal; } else if(library == LIB_ACT){ if(DEBUG_LOG_DYN){log_printf("FindExport of %s! From LIB_ACT\n", functionName);} - if(nn_act_handle == 0){InitAcquireACT();} - if(nn_act_handle == 0){log_print("LIB_ACT failed to acquire\n"); return 0;} - rpl_handle = nn_act_handle; + if(nn_act_handle_internal == 0){OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle_internal);} + if(nn_act_handle_internal == 0){log_print("LIB_ACT failed to acquire\n"); return 0;} + rpl_handle = nn_act_handle_internal; } else if(library == LIB_NIM){ if(DEBUG_LOG_DYN){log_printf("FindExport of %s! From LIB_NIM\n", functionName);} - if(nn_nim_handle == 0){InitAcquireNim();} - if(nn_nim_handle == 0){log_print("LIB_NIM failed to acquire\n"); return 0;} - rpl_handle = nn_nim_handle; + if(nn_nim_handle_internal == 0){OSDynLoad_Acquire("nn_nim.rpl", &nn_nim_handle_internal);} + if(nn_nim_handle_internal == 0){log_print("LIB_NIM failed to acquire\n"); return 0;} + rpl_handle = nn_nim_handle_internal; } if(!rpl_handle){ @@ -375,3 +396,25 @@ u32 GetAddressOfFunction(const char * functionName,u32 library){ return real_addr; } + +void resetLibs(){ + acp_handle_internal = 0; + aoc_handle_internal = 0; + sound_handle_internal = 0; + sound_handle_internal_old = 0; + libcurl_handle_internal = 0; + gx2_handle_internal = 0; + nfp_handle_internal = 0; + nn_act_handle_internal = 0; + nn_nim_handle_internal = 0; + nn_save_handle_internal = 0; + ntag_handle_internal = 0; + coreinit_handle_internal = 0; + padscore_handle_internal = 0; + proc_ui_handle_internal = 0; + nsysnet_handle_internal = 0; + sysapp_handle_internal = 0; + syshid_handle_internal = 0; + vpad_handle_internal = 0; + vpadbase_handle_internal = 0; +} diff --git a/source/utils/function_patcher.h b/source/utils/function_patcher.h index 9f6ebde..fcb84a3 100644 --- a/source/utils/function_patcher.h +++ b/source/utils/function_patcher.h @@ -23,23 +23,7 @@ extern "C" { #endif -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* Macros for libs */ #define LIB_CORE_INIT 0 @@ -90,6 +74,7 @@ void PatchInvidualMethodHooks(hooks_magic_t hook_information[],s32 hook_informat void RestoreInvidualInstructions(hooks_magic_t hook_information[],s32 hook_information_size); u32 GetAddressOfFunction(const char * functionName,u32 library); s32 isDynamicFunction(u32 physicalAddress); +void resetLibs(); //Orignal code by Chadderz. #define MAKE_MAGIC(x, lib,functionType) { (u32) my_ ## x, (u32) &real_ ## x, lib, # x,0,0,functionType,0}