(WiiU) import only the needed symbols.

This commit is contained in:
aliaspider 2016-11-22 22:48:44 +01:00
parent e2f7145112
commit 3acdf3d1cb
12 changed files with 184 additions and 80 deletions

View File

@ -16,7 +16,7 @@ OBJ += wiiu/tex_shader.o
ifneq ($(RPX_BUILD), 1)
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/dyn_stubs.o
OBJ += wiiu/system/stubs_elf.o
endif
DEFINES :=

View File

@ -1,18 +1,19 @@
#include <coreinit/dynload.h>
#include <coreinit/debug.h>
#define EXPORT(name) void* addr_##name
#define EXPORT_BEGIN(lib)
#define EXPORT_END()
#include "exports/all.h"
#define IMPORT(name) void* addr_##name
#define IMPORT_BEGIN(lib)
#define IMPORT_END()
#include "imports.h"
#undef EXPORT
#undef EXPORT_BEGIN
//#undef EXPORT_END
#undef IMPORT
#undef IMPORT_BEGIN
#undef IMPORT_END
#define EXPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
#define EXPORT_BEGIN(lib) OSDynLoad_Acquire(#lib, &handle)
//#define EXPORT_END() OSDynLoad_Release(handle)
#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
#define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle)
//#define IMPORT_END() OSDynLoad_Release(handle)
#define IMPORT_END()
void InitFunctionPointers(void)
{
@ -20,6 +21,6 @@ void InitFunctionPointers(void)
addr_OSDynLoad_Acquire = *(void**)0x00801500;
addr_OSDynLoad_FindExport = *(void**)0x00801504;
#include "exports/all.h"
#include "imports.h"
}

View File

@ -1,8 +0,0 @@
#include "libcoreinit.h"
#include "libnsysnet.h"
#include "libgx2.h"
#include "libproc_ui.h"
#include "libsndcore2.h"
#include "libsysapp.h"
#include "libvpad.h"

View File

@ -1,7 +0,0 @@
EXPORT_BEGIN(coreinit.rpl);
/* OSFatal should preferably be put first in the list */
#include "../rpl/libcoreinit/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(gx2.rpl);
#include "../rpl/libgx2/exports.h"
EXPORT(GX2GetSwapStatus);
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(nsysnet.rpl);
#include "../rpl/libnsysnet/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(proc_ui.rpl);
#include "../rpl/libproc_ui/exports.h"
EXPORT_END();

View File

@ -1,18 +0,0 @@
EXPORT_BEGIN(sndcore2.rpl);
#include "../rpl/libsndcore2/exports.h"
EXPORT(AXRegisterFrameCallback);
EXPORT(AXAcquireMultiVoice);
EXPORT(AXSetMultiVoiceDeviceMix);
EXPORT(AXSetMultiVoiceOffsets);
EXPORT(AXSetMultiVoiceState);
EXPORT(AXSetMultiVoiceVe);
EXPORT(AXSetMultiVoiceSrcType);
EXPORT(AXSetMultiVoiceSrcRatio);
EXPORT(AXIsMultiVoiceRunning);
EXPORT(AXFreeMultiVoice);
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(sysapp.rpl);
#include "../rpl/libsysapp/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(vpad.rpl);
#include "../rpl/libvpad/exports.h"
EXPORT_END();

166
wiiu/system/imports.h Normal file
View File

@ -0,0 +1,166 @@
/* coreinit */
IMPORT_BEGIN(coreinit);
IMPORT(OSFatal);
IMPORT(OSDynLoad_Acquire);
IMPORT(OSDynLoad_FindExport);
IMPORT(OSDynLoad_Release);
IMPORT(OSSetExceptionCallback);
IMPORT(OSSavesDone_ReadyToRelease);
IMPORT(OSInitMutex);
IMPORT(OSLockMutex);
IMPORT(OSUnlockMutex);
IMPORT(OSInitSpinLock);
IMPORT(OSUninterruptibleSpinLock_Acquire);
IMPORT(OSUninterruptibleSpinLock_Release);
IMPORT(OSSleepTicks);
IMPORT(OSYieldThread);
IMPORT(OSGetSystemTime);
IMPORT(OSGetSystemTick);
IMPORT(exit);
IMPORT(_Exit);
IMPORT(__os_snprintf);
IMPORT(DCFlushRange);
IMPORT(DCStoreRange);
IMPORT(DCStoreRangeNoSync);
IMPORT(MEMGetBaseHeapHandle);
IMPORT(MEMCreateExpHeapEx);
IMPORT(MEMDestroyExpHeap);
IMPORT(MEMAllocFromExpHeapEx);
IMPORT(MEMFreeToExpHeap);
IMPORT(MEMGetSizeForMBlockExpHeap);
IMPORT(MEMAllocFromFrmHeapEx);
IMPORT(MEMFreeToFrmHeap);
IMPORT(MEMGetAllocatableSizeForFrmHeapEx);
IMPORT(FSInit);
IMPORT(FSShutdown);
IMPORT(FSAddClient);
IMPORT(FSDelClient);
IMPORT(FSInitCmdBlock);
IMPORT(FSChangeDir);
IMPORT(FSGetFreeSpaceSize);
IMPORT(FSGetStat);
IMPORT(FSRemove);
IMPORT(FSOpenFile);
IMPORT(FSCloseFile);
IMPORT(FSOpenDir);
IMPORT(FSMakeDir);
IMPORT(FSReadDir);
IMPORT(FSRewindDir);
IMPORT(FSCloseDir);
IMPORT(FSGetStatFile);
IMPORT(FSReadFile);
IMPORT(FSWriteFile);
IMPORT(FSSetPosFile);
IMPORT(FSFlushFile);
IMPORT(FSTruncateFile);
IMPORT(FSRename);
IMPORT(FSGetMountSource);
IMPORT(FSMount);
IMPORT(FSUnmount);
IMPORT_END();
/* nsysnet */
IMPORT_BEGIN(nsysnet);
IMPORT(socket_lib_init);
IMPORT(socket);
IMPORT(socketclose);
IMPORT(connect);
IMPORT(send);
IMPORT(inet_aton);
IMPORT_END();
/* gx2 */
IMPORT_BEGIN(gx2);
IMPORT(GX2Invalidate);
IMPORT(GX2Init);
IMPORT(GX2GetSystemTVScanMode);
IMPORT(GX2CalcTVSize);
IMPORT(GX2SetTVBuffer);
IMPORT(GX2CalcDRCSize);
IMPORT(GX2SetDRCBuffer);
IMPORT(GX2CalcSurfaceSizeAndAlignment);
IMPORT(GX2InitColorBufferRegs);
IMPORT(GX2SetupContextStateEx);
IMPORT(GX2SetContextState);
IMPORT(GX2SetColorBuffer);
IMPORT(GX2SetViewport);
IMPORT(GX2SetScissor);
IMPORT(GX2SetDepthOnlyControl);
IMPORT(GX2SetColorControl);
IMPORT(GX2SetBlendControl);
IMPORT(GX2SetCullOnlyControl);
IMPORT(GX2CalcFetchShaderSizeEx);
IMPORT(GX2InitFetchShaderEx);
IMPORT(GX2SetFetchShader);
IMPORT(GX2SetVertexShader);
IMPORT(GX2SetPixelShader);
IMPORT(GX2SetAttribBuffer);
IMPORT(GX2InitTextureRegs);
IMPORT(GX2InitSampler);
IMPORT(GX2SetPixelTexture);
IMPORT(GX2SetPixelSampler);
IMPORT(GX2ClearColor);
IMPORT(GX2CopyColorBufferToScanBuffer);
IMPORT(GX2SwapScanBuffers);
IMPORT(GX2Flush);
IMPORT(GX2WaitForVsync);
IMPORT(GX2SetTVEnable);
IMPORT(GX2SetDRCEnable);
IMPORT(GX2SetSwapInterval);
IMPORT(GX2DrawDone);
IMPORT(GX2Shutdown);
IMPORT(GX2DrawEx);
IMPORT(GX2WaitForFlip);
IMPORT(GX2GetSwapStatus);
IMPORT_END();
/* proc_ui */
IMPORT_BEGIN(proc_ui);
IMPORT(ProcUIInit);
IMPORT(ProcUIShutdown);
IMPORT_END();
/* sndcore2 */
IMPORT_BEGIN(sndcore2);
IMPORT(AXInitWithParams);
IMPORT(AXQuit);
IMPORT(AXRegisterFrameCallback);
IMPORT(AXAcquireMultiVoice);
IMPORT(AXSetMultiVoiceDeviceMix);
IMPORT(AXSetMultiVoiceOffsets);
IMPORT(AXSetMultiVoiceState);
IMPORT(AXSetMultiVoiceVe);
IMPORT(AXSetMultiVoiceSrcType);
IMPORT(AXSetMultiVoiceSrcRatio);
IMPORT(AXIsMultiVoiceRunning);
IMPORT(AXFreeMultiVoice);
IMPORT_END();
/* sysapp */
IMPORT_BEGIN(sysapp);
IMPORT(SYSRelaunchTitle);
IMPORT_END();
/* vpad */
IMPORT_BEGIN(vpad);
IMPORT(VPADRead);
IMPORT(VPADInit);
IMPORT_END();

View File

@ -1,4 +1,4 @@
/*#define EXPORT(name) \
/*#define IMPORT(name) \
.global name; \
name: \
lis %r11, addr_##name@h; \
@ -6,7 +6,7 @@
mtctr %r11; \
bctr*/
#define EXPORT(name) \
#define IMPORT(name) \
.global name; \
name: \
lis %r11, addr_##name@h; \
@ -15,11 +15,11 @@
mtctr %r11; \
bctr
#define EXPORT_BEGIN(lib)
#define EXPORT_END()
#define IMPORT_BEGIN(lib)
#define IMPORT_END()
.align 2;
.section ".text";
#include "exports/all.h"
#include "imports.h"