(WiiU) build RPX imports from imports.h.

This commit is contained in:
aliaspider 2016-11-23 00:06:35 +01:00
parent 3acdf3d1cb
commit eedbea4527
5 changed files with 67 additions and 13 deletions

View File

@ -14,7 +14,9 @@ OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/tex_shader.o
ifneq ($(RPX_BUILD), 1)
ifeq ($(RPX_BUILD), 1)
OBJ += wiiu/system/stubs_rpl.o
else
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/stubs_elf.o
endif
@ -145,7 +147,6 @@ ifeq ($(RPX_BUILD), 1)
LIBDIRS += -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
LDFLAGS += -pie -fPIE
LDFLAGS += -z common-page-size=64 -z max-page-size=64
LDFLAGS += -lcoreinit -lgx2 -lnsysnet -lproc_ui -lsndcore2 -lsysapp -lvpad
LDFLAGS += -T $(WUT_ROOT)/rules/rpl.ld
# LDFLAGS += -T wiiu/link_rpl.ld
LDFLAGS += -nostartfiles

View File

@ -3,7 +3,7 @@
#define IMPORT(name) void* addr_##name
#define IMPORT_BEGIN(lib)
#define IMPORT_END()
#define IMPORT_END(lib)
#include "imports.h"
#undef IMPORT
@ -12,8 +12,8 @@
#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()
//#define IMPORT_END(lib) OSDynLoad_Release(handle)
#define IMPORT_END(lib)
void InitFunctionPointers(void)
{

View File

@ -63,7 +63,7 @@ IMPORT(FSGetMountSource);
IMPORT(FSMount);
IMPORT(FSUnmount);
IMPORT_END();
IMPORT_END(coreinit);
/* nsysnet */
IMPORT_BEGIN(nsysnet);
@ -75,7 +75,7 @@ IMPORT(connect);
IMPORT(send);
IMPORT(inet_aton);
IMPORT_END();
IMPORT_END(nsysnet);
/* gx2 */
IMPORT_BEGIN(gx2);
@ -122,7 +122,7 @@ IMPORT(GX2DrawEx);
IMPORT(GX2WaitForFlip);
IMPORT(GX2GetSwapStatus);
IMPORT_END();
IMPORT_END(gx2);
/* proc_ui */
IMPORT_BEGIN(proc_ui);
@ -130,7 +130,7 @@ IMPORT_BEGIN(proc_ui);
IMPORT(ProcUIInit);
IMPORT(ProcUIShutdown);
IMPORT_END();
IMPORT_END(proc_ui);
/* sndcore2 */
IMPORT_BEGIN(sndcore2);
@ -148,14 +148,14 @@ IMPORT(AXSetMultiVoiceSrcRatio);
IMPORT(AXIsMultiVoiceRunning);
IMPORT(AXFreeMultiVoice);
IMPORT_END();
IMPORT_END(sndcore2);
/* sysapp */
IMPORT_BEGIN(sysapp);
IMPORT(SYSRelaunchTitle);
IMPORT_END();
IMPORT_END(sysapp);
/* vpad */
IMPORT_BEGIN(vpad);
@ -163,4 +163,4 @@ IMPORT_BEGIN(vpad);
IMPORT(VPADRead);
IMPORT(VPADInit);
IMPORT_END();
IMPORT_END(vpad);

View File

@ -16,7 +16,7 @@
bctr
#define IMPORT_BEGIN(lib)
#define IMPORT_END()
#define IMPORT_END(lib)
.align 2;
.section ".text";

53
wiiu/system/stubs_rpl.S Normal file
View File

@ -0,0 +1,53 @@
/*#define IMPORT_BEGIN(lib) .align 2; .section .fimport_##lib,"ax";*/
#define IMPORT_BEGIN(lib)
/*#define IMPORT(name) \
.global name; \
name: \
nop; \
nop*/
#define IMPORT(name) \
.align 2; \
.section ".rplTramp.text","ax"; \
.global name; \
name: \
lis %r0, name##_stub@h; \
ori %r0, %r0, name##_stub@l; \
mtctr %r0; \
bctr;
/*#define IMPORT_END() .align 2;*/
#define IMPORT_END(lib)
#include "imports.h"
#undef IMPORT_BEGIN
#undef IMPORT
#undef IMPORT_END
#define IMPORT_BEGIN(lib) \
.section ".data.rplFuncStubs"; \
.align 2; \
fstubBegin_##lib:
#define IMPORT(name) \
.global name##_stub; \
name##_stub: \
.long name;
#define IMPORT_END(lib) \
fstubEnd_##lib: \
.section ".rodata.rplNames"; \
lib##_name: \
.string #lib; \
.section ".lib.rplLibs"; \
.align 2; \
.long lib##_name; \
.long fstubBegin_##lib; \
.long fstubEnd_##lib
#include "imports.h"