Make sure OSDynLoad_Acquire and OSDynLoad_FindExport are available before acquire libs

This commit is contained in:
Maschell 2017-10-30 19:19:00 +01:00
parent db7554293e
commit 9bc4dfe2d1
18 changed files with 52 additions and 70 deletions

View File

@ -28,13 +28,12 @@ u32 acp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml); EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml);
void InitAcquireACP(void) void InitAcquireACP(void){
{ if(coreinit_handle == 0){ InitAcquireOS(); };
OSDynLoad_Acquire("nn_acp.rpl", &acp_handle); OSDynLoad_Acquire("nn_acp.rpl", &acp_handle);
} }
void InitACPFunctionPointers(void) void InitACPFunctionPointers(void){
{
InitAcquireACP(); InitAcquireACP();
OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml); OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml);
} }

View File

@ -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_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); 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); OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle);
} }
void InitAocFunctionPointers(void) void InitAocFunctionPointers(void){
{
InitAcquireAoc(); InitAcquireAoc();
if(aoc_handle == 0) if(aoc_handle == 0)
return; return;

View File

@ -49,8 +49,8 @@ EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v);
EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset); EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset);
EXPORT_DECL(void, AXSetVoiceLoopOffset, 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; u32 *funcPointer = 0;
if(OS_FIRMWARE >= 400) if(OS_FIRMWARE >= 400)
@ -73,8 +73,7 @@ void InitAcquireAX(void)
} }
} }
void InitAXFunctionPointers(void) void InitAXFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireAX(); InitAcquireAX();

View File

@ -33,13 +33,12 @@ EXPORT_DECL(CURLcode, n_curl_easy_perform, CURL *curl);
EXPORT_DECL(void, n_curl_easy_cleanup, CURL *curl); EXPORT_DECL(void, n_curl_easy_cleanup, CURL *curl);
EXPORT_DECL(CURLcode, n_curl_easy_getinfo, CURL *curl, CURLINFO info, ...); 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); OSDynLoad_Acquire("nlibcurl", &libcurl_handle);
} }
void InitCurlFunctionPointers(void) void InitCurlFunctionPointers(void){
{
InitAcquireCurl(); InitAcquireCurl();
u32 *funcPointer = 0; u32 *funcPointer = 0;

View File

@ -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); 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; u32 *funcPointer = 0;
OS_FIND_EXPORT(coreinit_handle, FSInit); OS_FIND_EXPORT(coreinit_handle, FSInit);

View File

@ -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); 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); OSDynLoad_Acquire("gx2.rpl", &gx2_handle);
} }
void InitGX2FunctionPointers(void) void InitGX2FunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireGX2(); InitAcquireGX2();

View File

@ -26,13 +26,12 @@
u32 nfp_handle __attribute__((section(".data"))) = 0; 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); OSDynLoad_Acquire("nn_nfp.rpl", &nfp_handle);
} }
void InitNFPFunctionPointers(void) void InitNFPFunctionPointers(void){
{
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNFP(); InitAcquireNFP();
} }

View File

@ -32,13 +32,12 @@ EXPORT_DECL(u8, nn_act_GetSlotNo, void);
EXPORT_DECL(u8, nn_act_GetDefaultAccount, void); EXPORT_DECL(u8, nn_act_GetDefaultAccount, void);
EXPORT_DECL(u32, nn_act_GetPersistentIdEx, u8 slot); 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); OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
} }
void InitACTFunctionPointers(void) void InitACTFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireACT(); InitAcquireACT();

View File

@ -26,13 +26,12 @@
u32 nn_nim_handle __attribute__((section(".data"))) = 0; 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); OSDynLoad_Acquire("nn_nim.rpl", &nn_nim_handle);
} }
void InitNimFunctionPointers(void) void InitNimFunctionPointers(void){
{
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNim(); InitAcquireNim();
} }

View File

@ -30,13 +30,12 @@ u32 nn_save_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, SAVEInit, void); 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); 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); OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle);
} }
void InitSaveFunctionPointers(void) void InitSaveFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSave(); InitAcquireSave();
OS_FIND_EXPORT(nn_save_handle, SAVEInit); OS_FIND_EXPORT(nn_save_handle, SAVEInit);

View File

@ -26,13 +26,12 @@
u32 ntag_handle __attribute__((section(".data"))) = 0; u32 ntag_handle __attribute__((section(".data"))) = 0;
void InitAcquireNTAG(void) void InitAcquireNTAG(void){
{ if(coreinit_handle == 0){ InitAcquireOS(); };
OSDynLoad_Acquire("ntag.rpl", &ntag_handle); OSDynLoad_Acquire("ntag.rpl", &ntag_handle);
} }
void InitNTAGFunctionPointers(void) void InitNTAGFunctionPointers(void){
{
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNTAG(); InitAcquireNTAG();
} }

View File

@ -220,8 +220,7 @@ void _os_find_export(u32 handle, const char *funcName, void *funcPointer)
} }
} }
void InitAcquireOS(void) void InitAcquireOS(void){
{
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions //! Lib handle functions
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -231,8 +230,7 @@ void InitAcquireOS(void)
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
} }
void InitOSFunctionPointers(void) void InitOSFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireOS(); InitAcquireOS();

View File

@ -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,WPADSetAutoSleepTime,u8 minute);
EXPORT_DECL(void,WPADDisconnect,s32 chan); EXPORT_DECL(void,WPADDisconnect,s32 chan);
void InitAcquirePadScore(void) void InitAcquirePadScore(void){
{ if(coreinit_handle == 0){ InitAcquireOS(); };
OSDynLoad_Acquire("padscore.rpl", &padscore_handle); OSDynLoad_Acquire("padscore.rpl", &padscore_handle);
} }
void InitPadScoreFunctionPointers(void) void InitPadScoreFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquirePadScore(); InitAcquirePadScore();

View File

@ -29,13 +29,12 @@ u32 proc_ui_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(u32, ProcUIInForeground, void); EXPORT_DECL(u32, ProcUIInForeground, void);
EXPORT_DECL(void, ProcUIRegisterCallback, u32 type,ProcUICallback callback,void* param, u32 unkwn); 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); OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle);
} }
void InitProcUIFunctionPointers(void) void InitProcUIFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireProcUI(); InitAcquireProcUI();

View File

@ -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, 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); 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); OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle);
} }
void InitSocketFunctionPointers(void) void InitSocketFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSocket(); InitAcquireSocket();

View File

@ -33,13 +33,12 @@ EXPORT_DECL(s32, SYSCheckTitleExists, u64 titleId);
EXPORT_DECL(s32, SYSLaunchTitle, u64 titleId); EXPORT_DECL(s32, SYSLaunchTitle, u64 titleId);
EXPORT_DECL(s32, SYSLaunchSettings, s32 unk); EXPORT_DECL(s32, SYSLaunchSettings, s32 unk);
void InitAcquireSys(void) void InitAcquireSys(void){
{ if(coreinit_handle == 0){ InitAcquireOS(); };
OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);
} }
void InitSysFunctionPointers(void) void InitSysFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSys(); InitAcquireSys();

View File

@ -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, 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); 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); OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle);
} }
void InitSysHIDFunctionPointers(void) void InitSysHIDFunctionPointers(void){
{
InitAcquireSysHID(); InitAcquireSysHID();
if(syshid_handle == 0){ if(syshid_handle == 0){

View File

@ -79,14 +79,13 @@ EXPORT_DECL(s32, VPADBASESetMotorOnRemainingCount, s32 lcdmode, s32 counter);
EXPORT_DECL(void, VPADBASESetSensorBarSetting, s32 chan, s8 setting); EXPORT_DECL(void, VPADBASESetSensorBarSetting, s32 chan, s8 setting);
EXPORT_DECL(void, VPADBASEGetSensorBarSetting, 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("vpad.rpl", &vpad_handle);
OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle); OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle);
} }
void InitVPadFunctionPointers(void) void InitVPadFunctionPointers(void){
{
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireVPad(); InitAcquireVPad();