diff --git a/source/acp_functions.c b/source/acp_functions.c index beed06a..fc91b93 100644 --- a/source/acp_functions.c +++ b/source/acp_functions.c @@ -28,13 +28,12 @@ u32 acp_handle __attribute__((section(".data"))) = 0; EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml); -void InitAcquireACP(void) -{ +void InitAcquireACP(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_acp.rpl", &acp_handle); } -void InitACPFunctionPointers(void) -{ +void InitACPFunctionPointers(void){ InitAcquireACP(); OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml); } diff --git a/source/aoc_functions.c b/source/aoc_functions.c index e1adc7a..bdad537 100644 --- a/source/aoc_functions.c +++ b/source/aoc_functions.c @@ -35,13 +35,12 @@ EXPORT_DECL(s32, AOC_CloseTitle, void * title); EXPORT_DECL(s32, AOC_DeleteContent, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void* buffer, u32 buffer_size); EXPORT_DECL(s32, AOC_GetPurchaseInfo, u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size); -void InitAcquireAoc(void) -{ +void InitAcquireAoc(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle); } -void InitAocFunctionPointers(void) -{ +void InitAocFunctionPointers(void){ InitAcquireAoc(); if(aoc_handle == 0) return; diff --git a/source/ax_functions.c b/source/ax_functions.c index 37dc869..a4c470b 100644 --- a/source/ax_functions.c +++ b/source/ax_functions.c @@ -49,8 +49,8 @@ EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v); EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset); EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset); -void InitAcquireAX(void) -{ +void InitAcquireAX(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; u32 *funcPointer = 0; if(OS_FIRMWARE >= 400) @@ -73,8 +73,7 @@ void InitAcquireAX(void) } } -void InitAXFunctionPointers(void) -{ +void InitAXFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireAX(); diff --git a/source/curl_functions.c b/source/curl_functions.c index 459524d..5593743 100644 --- a/source/curl_functions.c +++ b/source/curl_functions.c @@ -33,13 +33,12 @@ EXPORT_DECL(CURLcode, n_curl_easy_perform, CURL *curl); EXPORT_DECL(void, n_curl_easy_cleanup, CURL *curl); EXPORT_DECL(CURLcode, n_curl_easy_getinfo, CURL *curl, CURLINFO info, ...); -void InitAcquireCurl(void) -{ +void InitAcquireCurl(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nlibcurl", &libcurl_handle); } -void InitCurlFunctionPointers(void) -{ +void InitCurlFunctionPointers(void){ InitAcquireCurl(); u32 *funcPointer = 0; diff --git a/source/fs_functions.c b/source/fs_functions.c index 2526465..8478360 100644 --- a/source/fs_functions.c +++ b/source/fs_functions.c @@ -78,8 +78,8 @@ EXPORT_DECL(s32, FSMakeQuotaAsync ,void *pClient, void *pCmd, const char *path,u EXPORT_DECL(s32, FSGetCwd,void * client,void * block,char * buffer,u32 bufferSize,u32 flags); -void InitFSFunctionPointers(void) -{ +void InitFSFunctionPointers(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; u32 *funcPointer = 0; OS_FIND_EXPORT(coreinit_handle, FSInit); diff --git a/source/gx2_functions.c b/source/gx2_functions.c index 501c4d7..3644153 100644 --- a/source/gx2_functions.c +++ b/source/gx2_functions.c @@ -95,13 +95,12 @@ EXPORT_DECL(void, GX2CopySurface, GX2Surface * srcSurface,u32 srcMip,u32 srcSlic EXPORT_DECL(void, GX2ClearBuffersEx, GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,s32 clearFlags); -void InitAcquireGX2(void) -{ +void InitAcquireGX2(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("gx2.rpl", &gx2_handle); } -void InitGX2FunctionPointers(void) -{ +void InitGX2FunctionPointers(void){ u32 *funcPointer = 0; InitAcquireGX2(); diff --git a/source/nfp_functions.c b/source/nfp_functions.c index 35cc281..0fcb4ef 100644 --- a/source/nfp_functions.c +++ b/source/nfp_functions.c @@ -26,13 +26,12 @@ u32 nfp_handle __attribute__((section(".data"))) = 0; -void InitAcquireNFP(void) -{ +void InitAcquireNFP(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_nfp.rpl", &nfp_handle); } -void InitNFPFunctionPointers(void) -{ +void InitNFPFunctionPointers(void){ // u32 *funcPointer = 0; InitAcquireNFP(); } diff --git a/source/nn_act_functions.c b/source/nn_act_functions.c index f51b8c9..81102da 100644 --- a/source/nn_act_functions.c +++ b/source/nn_act_functions.c @@ -32,13 +32,12 @@ EXPORT_DECL(u8, nn_act_GetSlotNo, void); EXPORT_DECL(u8, nn_act_GetDefaultAccount, void); EXPORT_DECL(u32, nn_act_GetPersistentIdEx, u8 slot); -void InitAcquireACT(void) -{ +void InitAcquireACT(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle); } -void InitACTFunctionPointers(void) -{ +void InitACTFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireACT(); diff --git a/source/nn_nim_functions.c b/source/nn_nim_functions.c index 356796e..2e82130 100644 --- a/source/nn_nim_functions.c +++ b/source/nn_nim_functions.c @@ -26,13 +26,12 @@ u32 nn_nim_handle __attribute__((section(".data"))) = 0; -void InitAcquireNim(void) -{ +void InitAcquireNim(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_nim.rpl", &nn_nim_handle); } -void InitNimFunctionPointers(void) -{ +void InitNimFunctionPointers(void){ // u32 *funcPointer = 0; InitAcquireNim(); } diff --git a/source/nn_save_functions.c b/source/nn_save_functions.c index e07173b..e6ccfab 100644 --- a/source/nn_save_functions.c +++ b/source/nn_save_functions.c @@ -30,13 +30,12 @@ u32 nn_save_handle __attribute__((section(".data"))) = 0; EXPORT_DECL(void, SAVEInit, void); EXPORT_DECL(int, SAVEOpenFile, void *pClient, void *pCmd, unsigned char user, const char *path, const char *mode, int *fd, int errHandling); -void InitAcquireSave(void) -{ +void InitAcquireSave(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle); } -void InitSaveFunctionPointers(void) -{ +void InitSaveFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireSave(); OS_FIND_EXPORT(nn_save_handle, SAVEInit); diff --git a/source/ntag_functions.c b/source/ntag_functions.c index a4fa9c2..5f3715c 100644 --- a/source/ntag_functions.c +++ b/source/ntag_functions.c @@ -26,13 +26,12 @@ u32 ntag_handle __attribute__((section(".data"))) = 0; -void InitAcquireNTAG(void) -{ +void InitAcquireNTAG(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("ntag.rpl", &ntag_handle); } -void InitNTAGFunctionPointers(void) -{ +void InitNTAGFunctionPointers(void){ // u32 *funcPointer = 0; InitAcquireNTAG(); } diff --git a/source/os_functions.c b/source/os_functions.c index 64a8769..96bba5c 100644 --- a/source/os_functions.c +++ b/source/os_functions.c @@ -220,8 +220,7 @@ void _os_find_export(u32 handle, const char *funcName, void *funcPointer) } } -void InitAcquireOS(void) -{ +void InitAcquireOS(void){ //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! Lib handle functions //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -231,8 +230,7 @@ void InitAcquireOS(void) OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); } -void InitOSFunctionPointers(void) -{ +void InitOSFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireOS(); diff --git a/source/padscore_functions.c b/source/padscore_functions.c index 2f8ed86..3279209 100644 --- a/source/padscore_functions.c +++ b/source/padscore_functions.c @@ -37,13 +37,12 @@ EXPORT_DECL(s32, KPADReadEx, s32 chan, KPADData * data, u32 size, s32 *error); EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute); EXPORT_DECL(void,WPADDisconnect,s32 chan); -void InitAcquirePadScore(void) -{ +void InitAcquirePadScore(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("padscore.rpl", &padscore_handle); } -void InitPadScoreFunctionPointers(void) -{ +void InitPadScoreFunctionPointers(void){ u32 *funcPointer = 0; InitAcquirePadScore(); diff --git a/source/proc_ui_functions.c b/source/proc_ui_functions.c index d270600..a032d78 100644 --- a/source/proc_ui_functions.c +++ b/source/proc_ui_functions.c @@ -29,13 +29,12 @@ u32 proc_ui_handle __attribute__((section(".data"))) = 0; EXPORT_DECL(u32, ProcUIInForeground, void); EXPORT_DECL(void, ProcUIRegisterCallback, u32 type,ProcUICallback callback,void* param, u32 unkwn); -void InitAcquireProcUI(void) -{ +void InitAcquireProcUI(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle); } -void InitProcUIFunctionPointers(void) -{ +void InitProcUIFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireProcUI(); diff --git a/source/socket_functions.c b/source/socket_functions.c index e9dbb44..9fecf84 100644 --- a/source/socket_functions.c +++ b/source/socket_functions.c @@ -49,13 +49,12 @@ EXPORT_DECL(s32, NSSLWrite, s32 connection, const void* buf, s32 len,s32 * writt EXPORT_DECL(s32, NSSLRead, s32 connection, const void* buf, s32 len,s32 * read); EXPORT_DECL(s32, NSSLCreateConnection, s32 context, const char* host, s32 hotlen,s32 options,s32 sock,s32 block); -void InitAcquireSocket(void) -{ +void InitAcquireSocket(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle); } -void InitSocketFunctionPointers(void) -{ +void InitSocketFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireSocket(); diff --git a/source/sys_functions.c b/source/sys_functions.c index be4f281..99ce0db 100644 --- a/source/sys_functions.c +++ b/source/sys_functions.c @@ -33,13 +33,12 @@ EXPORT_DECL(s32, SYSCheckTitleExists, u64 titleId); EXPORT_DECL(s32, SYSLaunchTitle, u64 titleId); EXPORT_DECL(s32, SYSLaunchSettings, s32 unk); -void InitAcquireSys(void) -{ +void InitAcquireSys(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); } -void InitSysFunctionPointers(void) -{ +void InitSysFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireSys(); diff --git a/source/syshid_functions.c b/source/syshid_functions.c index b5dbca4..a7d66a8 100644 --- a/source/syshid_functions.c +++ b/source/syshid_functions.c @@ -46,13 +46,12 @@ EXPORT_DECL(s32, HIDSetIdle,u32 handle, u8 s32erface_index,u8 duration, HIDCallb EXPORT_DECL(s32, HIDRead,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); EXPORT_DECL(s32, HIDWrite,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); -void InitAcquireSysHID(void) -{ +void InitAcquireSysHID(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle); } -void InitSysHIDFunctionPointers(void) -{ +void InitSysHIDFunctionPointers(void){ InitAcquireSysHID(); if(syshid_handle == 0){ diff --git a/source/vpad_functions.c b/source/vpad_functions.c index 2746dfb..75f2ef2 100644 --- a/source/vpad_functions.c +++ b/source/vpad_functions.c @@ -79,14 +79,13 @@ EXPORT_DECL(s32, VPADBASESetMotorOnRemainingCount, s32 lcdmode, s32 counter); EXPORT_DECL(void, VPADBASESetSensorBarSetting, s32 chan, s8 setting); EXPORT_DECL(void, VPADBASEGetSensorBarSetting, s32 chan, s8 *setting); -void InitAcquireVPad(void) -{ +void InitAcquireVPad(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; OSDynLoad_Acquire("vpad.rpl", &vpad_handle); OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle); } -void InitVPadFunctionPointers(void) -{ +void InitVPadFunctionPointers(void){ u32 *funcPointer = 0; InitAcquireVPad();