Beispiel #1
0
void InitSysFunctionPointers(void)
{
    unsigned int *funcPointer = 0;
    InitAcquireSys();

    OS_FIND_EXPORT(sysapp_handle, _SYSLaunchTitleByPathFromLauncher);
    OS_FIND_EXPORT(sysapp_handle, SYSRelaunchTitle);
    OS_FIND_EXPORT(sysapp_handle, SYSLaunchMenu);
    OS_FIND_EXPORT(sysapp_handle, SYSCheckTitleExists);
}
Beispiel #2
0
void InitSysFunctionPointers(void)
{
    unsigned int *funcPointer = 0;
    unsigned int sysapp_handle;
    OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);

    OS_FIND_EXPORT(sysapp_handle, _SYSLaunchTitleByPathFromLauncher);
    OS_FIND_EXPORT(sysapp_handle, SYSRelaunchTitle);
    OS_FIND_EXPORT(sysapp_handle, SYSLaunchMenu);
    OS_FIND_EXPORT(sysapp_handle, SYSLaunchMiiStudio);
}
Beispiel #3
0
void InitVPadFunctionPointers(void)
{
    unsigned int *funcPointer = 0;

    InitAcquireVPad();

    OS_FIND_EXPORT(vpad_handle, VPADInit);
    OS_FIND_EXPORT(vpad_handle, VPADRead);
    OS_FIND_EXPORT(vpad_handle, VPADGetLcdMode);
    OS_FIND_EXPORT(vpad_handle, VPADSetLcdMode);
    OS_FIND_EXPORT(vpadbase_handle, VPADBASEGetMotorOnRemainingCount);
    OS_FIND_EXPORT(vpadbase_handle, VPADBASESetMotorOnRemainingCount);
}
Beispiel #4
0
void InitGX2FunctionPointers(void)
{
    unsigned int *funcPointer = 0;
    unsigned int gx2_handle;
    OSDynLoad_Acquire("gx2.rpl", &gx2_handle);

    OS_FIND_EXPORT(gx2_handle, GX2Init);
    OS_FIND_EXPORT(gx2_handle, GX2Shutdown);
    OS_FIND_EXPORT(gx2_handle, GX2Flush);
    OS_FIND_EXPORT(gx2_handle, GX2GetMainCoreId);
    OS_FIND_EXPORT(gx2_handle, GX2DrawDone);
    OS_FIND_EXPORT(gx2_handle, GX2ClearColor);
    OS_FIND_EXPORT(gx2_handle, GX2SetViewport);
    OS_FIND_EXPORT(gx2_handle, GX2SetScissor);
    OS_FIND_EXPORT(gx2_handle, GX2SetContextState);
    OS_FIND_EXPORT(gx2_handle, GX2DrawEx);
    OS_FIND_EXPORT(gx2_handle, GX2DrawIndexedEx);
    OS_FIND_EXPORT(gx2_handle, GX2ClearDepthStencilEx);
    OS_FIND_EXPORT(gx2_handle, GX2CopyColorBufferToScanBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2SwapScanBuffers);
    OS_FIND_EXPORT(gx2_handle, GX2SetTVEnable);
    OS_FIND_EXPORT(gx2_handle, GX2SetSwapInterval);
    OS_FIND_EXPORT(gx2_handle, GX2GetSwapInterval);
    OS_FIND_EXPORT(gx2_handle, GX2WaitForVsync);
    OS_FIND_EXPORT(gx2_handle, GX2CalcTVSize);
    OS_FIND_EXPORT(gx2_handle, GX2Invalidate);
    OS_FIND_EXPORT(gx2_handle, GX2SetTVBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2CalcSurfaceSizeAndAlignment);
    OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferRegs);
    OS_FIND_EXPORT(gx2_handle, GX2InitColorBufferRegs);
    OS_FIND_EXPORT(gx2_handle, GX2CalcColorBufferAuxInfo);
    OS_FIND_EXPORT(gx2_handle, GX2CalcDepthBufferHiZInfo);
    OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferHiZEnable);
//    OS_FIND_EXPORT(gx2_handle, GX2SetSpecialState);
    OS_FIND_EXPORT(gx2_handle, GX2SetupContextStateEx);
    OS_FIND_EXPORT(gx2_handle, GX2SetColorBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2SetDepthBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2SetAttribBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2InitTextureRegs);
    OS_FIND_EXPORT(gx2_handle, GX2InitSampler);
    OS_FIND_EXPORT(gx2_handle, GX2CalcFetchShaderSizeEx);
    OS_FIND_EXPORT(gx2_handle, GX2InitFetchShaderEx);
    OS_FIND_EXPORT(gx2_handle, GX2SetFetchShader);
    OS_FIND_EXPORT(gx2_handle, GX2SetVertexUniformReg);
    OS_FIND_EXPORT(gx2_handle, GX2SetPixelUniformReg);
    OS_FIND_EXPORT(gx2_handle, GX2SetPixelTexture);
    OS_FIND_EXPORT(gx2_handle, GX2SetVertexTexture);
    OS_FIND_EXPORT(gx2_handle, GX2SetPixelSampler);
    OS_FIND_EXPORT(gx2_handle, GX2SetVertexSampler);
    OS_FIND_EXPORT(gx2_handle, GX2SetPixelShader);
    OS_FIND_EXPORT(gx2_handle, GX2SetVertexShader);
    OS_FIND_EXPORT(gx2_handle, GX2InitSamplerZMFilter);
//    OS_FIND_EXPORT(gx2_handle, GX2SetClearDepth);
//    OS_FIND_EXPORT(gx2_handle, GX2SetClearStencil);
    OS_FIND_EXPORT(gx2_handle, GX2SetColorControl);
    OS_FIND_EXPORT(gx2_handle, GX2SetDepthOnlyControl);
    OS_FIND_EXPORT(gx2_handle, GX2SetBlendControl);
    OS_FIND_EXPORT(gx2_handle, GX2CalcDRCSize);
    OS_FIND_EXPORT(gx2_handle, GX2SetDRCBuffer);
    OS_FIND_EXPORT(gx2_handle, GX2SetDRCScale);
    OS_FIND_EXPORT(gx2_handle, GX2SetDRCEnable);
    OS_FIND_EXPORT(gx2_handle, GX2SetPolygonControl);
    OS_FIND_EXPORT(gx2_handle, GX2SetCullOnlyControl);
    OS_FIND_EXPORT(gx2_handle, GX2SetDepthStencilControl);
    OS_FIND_EXPORT(gx2_handle, GX2SetStencilMask);
    OS_FIND_EXPORT(gx2_handle, GX2SetLineWidth);
    OS_FIND_EXPORT(gx2_handle, GX2SetDRCGamma);
    OS_FIND_EXPORT(gx2_handle, GX2SetTVGamma);
    OS_FIND_EXPORT(gx2_handle, GX2GetSystemTVScanMode);
    OS_FIND_EXPORT(gx2_handle, GX2GetSystemDRCScanMode);
    OS_FIND_EXPORT(gx2_handle, GX2RSetAllocator);
}
void InitOSFunctionPointers(void)
{
    unsigned int *funcPointer = 0;
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! Lib handle functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    EXPORT_FUNC_WRITE(OSDynLoad_Acquire, (int (*)(const char*, unsigned *))OS_SPECIFICS->addr_OSDynLoad_Acquire);
    EXPORT_FUNC_WRITE(OSDynLoad_FindExport, (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport);

    OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);

    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! System functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    OS_FIND_EXPORT(coreinit_handle, OSFatal);
    OS_FIND_EXPORT(coreinit_handle, OSGetTitleID);
    OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback);
    OS_FIND_EXPORT(coreinit_handle, DCFlushRange);
    OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
    OS_FIND_EXPORT(coreinit_handle, OSEffectiveToPhysical);
    OS_FIND_EXPORT(coreinit_handle, __os_snprintf);
    OS_FIND_EXPORT(coreinit_handle, __gh_errno_ptr);
    OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &__Exit);
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! Thread functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    OS_FIND_EXPORT(coreinit_handle, OSCreateThread);
    OS_FIND_EXPORT(coreinit_handle, OSResumeThread);
    OS_FIND_EXPORT(coreinit_handle, OSSuspendThread);
    OS_FIND_EXPORT(coreinit_handle, OSIsThreadTerminated);
    OS_FIND_EXPORT(coreinit_handle, OSIsThreadSuspended);
    OS_FIND_EXPORT(coreinit_handle, OSJoinThread);
    OS_FIND_EXPORT(coreinit_handle, OSSetThreadPriority);
    OS_FIND_EXPORT(coreinit_handle, OSDetachThread);
    OS_FIND_EXPORT(coreinit_handle, OSSleepTicks);
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! Mutex functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    OS_FIND_EXPORT(coreinit_handle, OSInitMutex);
    OS_FIND_EXPORT(coreinit_handle, OSLockMutex);
    OS_FIND_EXPORT(coreinit_handle, OSUnlockMutex);
    OS_FIND_EXPORT(coreinit_handle, OSTryLockMutex);

    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! Memory functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &pMEMAllocFromDefaultHeapEx);
    OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeap", &pMEMAllocFromDefaultHeap);
    OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &pMEMFreeToDefaultHeap);

    OS_FIND_EXPORT(coreinit_handle, MEMGetBaseHeapHandle);
    OS_FIND_EXPORT(coreinit_handle, MEMGetAllocatableSizeForFrmHeapEx);
    OS_FIND_EXPORT(coreinit_handle, MEMAllocFromFrmHeapEx);
    OS_FIND_EXPORT(coreinit_handle, MEMFreeToFrmHeap);
    OS_FIND_EXPORT(coreinit_handle, MEMAllocFromExpHeapEx);
    OS_FIND_EXPORT(coreinit_handle, MEMCreateExpHeapEx);
    OS_FIND_EXPORT(coreinit_handle, MEMDestroyExpHeap);
    OS_FIND_EXPORT(coreinit_handle, MEMFreeToExpHeap);

    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //! Special non library functions
    //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    if(OS_FIRMWARE == 550)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x01010180);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0101006C);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x0100080C);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF184E4);
    }
    else if(OS_FIRMWARE == 532 || OS_FIRMWARE == 540)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FFA4);                // loader.elf
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FE90);  // loader.elf
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC);              // loader.elf
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18558);           // kernel.elf

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00);           // loader.elf
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C);         // loader.elf
    }
    else if(OS_FIRMWARE == 500 || OS_FIRMWARE == 510)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FBC4);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FAB0);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18534);

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00);
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C);
    }
    else if(OS_FIRMWARE == 410)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF166DC);

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0);
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC);
    }
    else if(OS_FIRMWARE == 400) // same for 4.0.2 and 4.0.3
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15E70);

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0);
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC);
    }
    else if(OS_FIRMWARE == 310)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15A0C);

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340);
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C);
    }
    else if(OS_FIRMWARE == 300 || OS_FIRMWARE == 301)
    {
        EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4);
        EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4);
        EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8);
        EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15974);

        EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340);
        EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C);
    }
    else
    {
        OSFatal("Missing all OS specific addresses.");
    }
}
Beispiel #6
0
void InitFSFunctionPointers(void)
{
    unsigned int *funcPointer = 0;

    OS_FIND_EXPORT(coreinit_handle, FSInit);
    OS_FIND_EXPORT(coreinit_handle, FSShutdown);
    OS_FIND_EXPORT(coreinit_handle, FSAddClientEx);
    OS_FIND_EXPORT(coreinit_handle, FSDelClient);
    OS_FIND_EXPORT(coreinit_handle, FSInitCmdBlock);
    OS_FIND_EXPORT(coreinit_handle, FSGetMountSource);

    OS_FIND_EXPORT(coreinit_handle, FSMount);
    OS_FIND_EXPORT(coreinit_handle, FSUnmount);

    OS_FIND_EXPORT(coreinit_handle, FSGetStat);
    OS_FIND_EXPORT(coreinit_handle, FSGetStatAsync);
    OS_FIND_EXPORT(coreinit_handle, FSRename);
    OS_FIND_EXPORT(coreinit_handle, FSRenameAsync);
    OS_FIND_EXPORT(coreinit_handle, FSRemove);
    OS_FIND_EXPORT(coreinit_handle, FSRemoveAsync);
    OS_FIND_EXPORT(coreinit_handle, FSFlushQuota);
    OS_FIND_EXPORT(coreinit_handle, FSFlushQuotaAsync);
    OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSize);
    OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSizeAsync);
    OS_FIND_EXPORT(coreinit_handle, FSRollbackQuota);
    OS_FIND_EXPORT(coreinit_handle, FSRollbackQuotaAsync);

    OS_FIND_EXPORT(coreinit_handle, FSOpenDir);
    OS_FIND_EXPORT(coreinit_handle, FSOpenDirAsync);
    OS_FIND_EXPORT(coreinit_handle, FSReadDir);
    OS_FIND_EXPORT(coreinit_handle, FSRewindDir);
    OS_FIND_EXPORT(coreinit_handle, FSCloseDir);
    OS_FIND_EXPORT(coreinit_handle, FSChangeDir);
    OS_FIND_EXPORT(coreinit_handle, FSChangeDirAsync);
    OS_FIND_EXPORT(coreinit_handle, FSMakeDir);
    OS_FIND_EXPORT(coreinit_handle, FSMakeDirAsync);


    OS_FIND_EXPORT(coreinit_handle, FSOpenFile);
    OS_FIND_EXPORT(coreinit_handle, FSOpenFileAsync);
    OS_FIND_EXPORT(coreinit_handle, FSReadFile);
    OS_FIND_EXPORT(coreinit_handle, FSCloseFile);

    OS_FIND_EXPORT(coreinit_handle, FSFlushFile);
    OS_FIND_EXPORT(coreinit_handle, FSTruncateFile);
    OS_FIND_EXPORT(coreinit_handle, FSGetStatFile);
    OS_FIND_EXPORT(coreinit_handle, FSSetPosFile);
    OS_FIND_EXPORT(coreinit_handle, FSWriteFile);

    OS_FIND_EXPORT(coreinit_handle, FSBindMount);
    OS_FIND_EXPORT(coreinit_handle, FSBindUnmount);

    OS_FIND_EXPORT(coreinit_handle, FSMakeQuota);
    OS_FIND_EXPORT(coreinit_handle, FSMakeQuotaAsync);
}
Beispiel #7
0
void InitSocketFunctionPointers(void)
{
    unsigned int nsysnet_handle;
    unsigned int *funcPointer = 0;
    OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle);

    unsigned int nn_ac_handle;
    int(*ACInitialize)();
    int(*ACGetStartupId) (unsigned int *id);
    int(*ACConnectWithConfigId) (unsigned int id);
    int(*ACGetAssignedAddress) (u32 * ip);
    OSDynLoad_Acquire("nn_ac.rpl", &nn_ac_handle);
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACInitialize", &ACInitialize);
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetStartupId", &ACGetStartupId);
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACConnectWithConfigId",&ACConnectWithConfigId);
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetAssignedAddress",&ACGetAssignedAddress);

    OS_FIND_EXPORT(nsysnet_handle, socket_lib_init);
    OS_FIND_EXPORT(nsysnet_handle, socket_lib_finish);
    OS_FIND_EXPORT(nsysnet_handle, socket);
    OS_FIND_EXPORT(nsysnet_handle, socketclose);
    OS_FIND_EXPORT(nsysnet_handle, connect);
    OS_FIND_EXPORT(nsysnet_handle, bind);
    OS_FIND_EXPORT(nsysnet_handle, listen);
    OS_FIND_EXPORT(nsysnet_handle, accept);
    OS_FIND_EXPORT(nsysnet_handle, send);
    OS_FIND_EXPORT(nsysnet_handle, recv);
    OS_FIND_EXPORT(nsysnet_handle, sendto);
    OS_FIND_EXPORT(nsysnet_handle, setsockopt);
    OS_FIND_EXPORT(nsysnet_handle, inet_ntoa);
    OS_FIND_EXPORT(nsysnet_handle, inet_aton);

    unsigned int nn_startupid;
    ACInitialize();
    ACGetStartupId(&nn_startupid);
    ACConnectWithConfigId(nn_startupid);
    ACGetAssignedAddress(&hostIpAddress);

    socket_lib_init();
}