(WiiU) can compile as rpx. (doesn't exit properly)

This commit is contained in:
aliaspider 2016-11-09 14:26:38 +01:00
parent 79192c0ead
commit dbd8a87ebb
3 changed files with 71 additions and 32 deletions

View File

@ -1,4 +1,5 @@
TARGET := retroarch_wiiu
RPX_BUILD = 0
DEBUG = 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
@ -6,14 +7,17 @@ WHOLE_ARCHIVE_LINK = 0
PC_DEVELOPMENT_IP_ADDRESS =
PC_DEVELOPMENT_TCP_PORT =
OBJ :=
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/dyn_stubs.o
OBJ += wiiu/tex_shader.o
OBJ :=
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/tex_shader.o
ifneq ($(RPX_BUILD), 1)
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/dyn_stubs.o
endif
DEFINES :=
@ -96,6 +100,7 @@ STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
ELF2RPL := $(WUT_ROOT)/tools/bin/elf2rpl
INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include -Iwiiu -I$(WUT_ROOT)/include
LIBDIRS := -L.
@ -133,20 +138,30 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc
ifeq ($(RPX_BUILD), 1)
CFLAGS += -fno-builtin -ffreestanding -DRPX_BUILD
LIBDIRS += -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
LDFLAGS += -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64
LDFLAGS += -lcoreinit -lgx2 -lnsysnet -lproc_ui -lsndcore2 -lsysapp -lvpad
else
LDFLAGS += -n -T wiiu/link_ra.ld
endif
LDFLAGS += -nostartfiles -Wl,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc
LDFLAGS += -Wl,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r
LDFLAGS += -Wl,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections
LDFLAGS += -Wl,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,-wrap,__eabi,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
all: $(TARGET)
$(TARGET): $(TARGET).elf
ifeq ($(RPX_BUILD), 1)
all: $(TARGET).elf $(TARGET).rpx
else
all: $(TARGET).elf
endif
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
@ -164,10 +179,14 @@ $(TARGET): $(TARGET).elf
$(AR) -rc $@ $^
$(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link_ra.ld
$(LD) -n -T wiiu/link_ra.ld $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
%.rpx: %.elf
@$(ELF2RPL) $(notdir $<) $@
clean:
rm -f $(OBJ)
rm -f $(TARGET).elf
rm -f $(TARGET).rpx
.PHONY: $(BUILD) clean all
.PHONY: clean all

View File

@ -45,7 +45,8 @@
#include "system/exception.h"
#include <sys/iosupport.h>
#include <coreinit/screen.h>
#include <coreinit/foreground.h>
#include <proc_ui/procui.h>
#include <vpad/input.h>
#include "wiiu_dbg.h"
@ -54,8 +55,11 @@
#include "../../menu/menu_driver.h"
#endif
//#define WIIU_SD_PATH "/vol/external01/"
#define WIIU_SD_PATH "sd:/"
static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE;
static const char* elf_path_cst = "sd:/retroarch/retroarch.elf";
static const char* elf_path_cst = WIIU_SD_PATH "retroarch/retroarch.elf";
static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
@ -134,7 +138,7 @@ static int frontend_wiiu_parse_drive_list(void *data)
return -1;
menu_entries_append_enum(list,
"sd:/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
WIIU_SD_PATH, "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
return 0;
}
@ -237,11 +241,36 @@ static devoptab_t dotab_stdout = {
NULL, // device close
log_write, // device write
NULL,
/* ... */
};
#ifdef RPX_BUILD
void __wrap___eabi(void)
{
}
void __init(void)
{
}
int main(int argc, char **argv);
void SaveCallback()
{
OSSavesDone_ReadyToRelease(); // Required
}
__attribute__((noreturn))
void _start(int argc, char **argv)
{
ProcUIInit(&SaveCallback);
int ret = main(argc, argv);
ProcUIShutdown();
exit(ret);
}
int main(int argc, char **argv)
{
#else
int __entry_menu(int argc, char **argv)
{
InitFunctionPointers();
#endif
#if 1
setup_os_exceptions();
#else
@ -263,8 +292,8 @@ int __entry_menu(int argc, char **argv)
DEBUG_STR(argv[1]);
#if 0
int argc_ = 2;
// char* argv_[] = {"sd:/retroarch/retroarch.elf", "sd:/rom.nes", NULL};
char* argv_[] = {"sd:/retroarch/retroarch.elf", "sd:/rom.sfc", NULL};
// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL};
char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.sfc", NULL};
rarch_main(argc_, argv_, NULL);
#else

View File

@ -1,9 +0,0 @@
export WIILOAD=tcp:$1
rm $2.stripped -rf
powerpc-eabi-strip $2 -o $2.stripped
wiiload $2.stripped
#netcat -p 4405 -l $1
# calling netcat directly after wiiload is unreliable, better use something like :
# for i in {1..20}; do echo; echo == $i ==; echo; netcat -p 4405 -l <wiiu ip>; done
# from a different terminal to continuously listen for incoming connections