diff --git a/Makefile.wiiu b/Makefile.wiiu index 9a25569570..bc6d0c0533 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -79,10 +79,7 @@ $(error "Please set WUT_ROOT in your environment. export WUT_ROOT=WUT") endif -export PATH := $(PATH):$(DEVKITPPC)/bin:$(PORTLIBS)/bin -export LIBOGC_INC := $(DEVKITPRO)/libogc/include -export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii -export PORTLIBS := $(DEVKITPRO)/portlibs/ppc +export PATH := $(PATH):$(DEVKITPPC)/bin PREFIX := powerpc-eabi- @@ -96,7 +93,7 @@ NM := $(PREFIX)nm LD := $(CXX) -INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include -Iwiiu -I$(WUT_ROOT)/include -I$(LIBOGC_INC) +INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include -Iwiiu -I$(WUT_ROOT)/include LIBDIRS := -L. CFLAGS := -mrvl -mcpu=750 -meabi -mhard-float @@ -138,7 +135,6 @@ all: $(TARGET) $(TARGET): $(TARGET).elf -$(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link.ld %.o: %.cpp $(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) @@ -155,9 +151,8 @@ $(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link.ld %.a: $(AR) -rc $@ $^ -$(TARGET).elf: wiiu/link.ld $(OBJ) -# $(LD) -T wiiu/link.ld $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@ - $(LD) -n -T wiiu/link.ld $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@ +$(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link_ra.ld + $(LD) -n -T wiiu/link_ra.ld $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@ clean: rm -f $(OBJ) diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index 7aa0ad241e..3066bc5d0d 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -226,43 +226,34 @@ void net_print(const char* str) log_write(NULL, 0, str, strlen(str)); } +void net_print_exp(const char* str) +{ + send(log_socket, str, strlen(str), 0); +} + static devoptab_t dotab_stdout = { - "stdout", // device name - 0, // size of file structure - NULL, // device open - NULL, // device close - log_write, // device write - NULL, // device read - NULL, // device seek - NULL, // device fstat - NULL, // device stat - NULL, // device link - NULL, // device unlink - NULL, // device chdir - NULL, // device rename - NULL, // device mkdir - 0, // dirStateSize - NULL, // device diropen_r - NULL, // device dirreset_r - NULL, // device dirnext_r - NULL, // device dirclose_r - NULL, // device statvfs_r - NULL, // device ftrunctate_r - NULL, // device fsync_r - NULL, // deviceData; + "stdout_net", // device name + 0, // size of file structure + NULL, // device open + NULL, // device close + log_write, // device write + NULL, }; int __entry_menu(int argc, char **argv) { InitFunctionPointers(); +#if 1 + setup_os_exceptions(); +#else + InstallExceptionHandler(); +#endif socket_lib_init(); log_init("10.42.0.1"); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; memoryInitialize(); mount_sd_fat("sd"); - setup_os_exceptions(); -// InstallExceptionHandler(); VPADInit(); OSScreenInit(); @@ -294,11 +285,10 @@ int __entry_menu(int argc, char **argv) main_exit(NULL); - - printf("Unmount SD\n"); unmount_sd_fat("sd"); - printf("Release memory\n"); memoryRelease(); + fflush(stdout); + fflush(stderr); log_deinit(); return 0; diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index 13807d1815..3e5fe01163 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -53,9 +53,18 @@ static int16_t wiiu_input_state(void *data, const struct retro_keybind **binds, { wiiu_input_t *wiiu = (wiiu_input_t*)data; + if(!wiiu) + return 0; + if (port > 0) return 0; + if(!binds) + return 0; + + if(!binds[port]) + return 0; + switch (device) { case RETRO_DEVICE_JOYPAD: diff --git a/wiiu/fs/sd_fat_devoptab.c b/wiiu/fs/sd_fat_devoptab.c index a9d964f981..72bea8efca 100644 --- a/wiiu/fs/sd_fat_devoptab.c +++ b/wiiu/fs/sd_fat_devoptab.c @@ -177,7 +177,7 @@ static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path, return -1; } - int result = FSOpenFile(dev->pClient, dev->pCmd, real_path, mode_str, &fd, -1); + int result = FSOpenFile(dev->pClient, dev->pCmd, real_path, mode_str, (FSFileHandle*)&fd, -1); free(real_path); @@ -740,7 +740,7 @@ static DIR_ITER *sd_fat_diropen_r (struct _reent *r, DIR_ITER *dirState, const c int dirHandle; - int result = FSOpenDir(dev->pClient, dev->pCmd, real_path, &dirHandle, -1); + int result = FSOpenDir(dev->pClient, dev->pCmd, real_path, (FSDirectoryHandle*)&dirHandle, -1); free(real_path); diff --git a/wiiu/link.ld b/wiiu/link.ld index 2d0760edee..cde4096abb 100644 --- a/wiiu/link.ld +++ b/wiiu/link.ld @@ -9,6 +9,7 @@ SECTIONS { .rodata : { *(.rodata*); } + . = 0x10000000; .data : { *(.data*); diff --git a/wiiu/net.sh b/wiiu/net.sh index a4705fe947..5d477f082f 100755 --- a/wiiu/net.sh +++ b/wiiu/net.sh @@ -1,4 +1,8 @@ export WIILOAD=tcp:$1 -powerpc-eabi-strip retroarch_wiiu.elf -o retroarch_wiiu_stripped.elf -wiiload retroarch_wiiu_stripped.elf -netcat -p 4405 -l $1 +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 ; done +# from a different terminal to continuously listen for incoming connections diff --git a/wiiu/system/dyn_stubs.S b/wiiu/system/dyn_stubs.S index 6301ebb968..1b2f85d7ed 100644 --- a/wiiu/system/dyn_stubs.S +++ b/wiiu/system/dyn_stubs.S @@ -13,15 +13,13 @@ ori %r11, %r11, addr_##name@l; \ lwz %r11, 0(%r11); \ mtctr %r11; \ - bctr; + bctr + +#define EXPORT_BEGIN(lib) +#define EXPORT_END() .align 2; .section ".text"; -#include "../rpl/libcoreinit/exports.h" -#include "../rpl/libnsysnet/exports.h" -#include "../rpl/libgx2/exports.h" -#include "../rpl/libproc_ui/exports.h" -#include "../rpl/libsndcore2/exports.h" -#include "../rpl/libsysapp/exports.h" -#include "../rpl/libvpad/exports.h" +#include "exports/all.h" + diff --git a/wiiu/system/dynamic.c b/wiiu/system/dynamic.c index 22baf344df..da1766a5c2 100644 --- a/wiiu/system/dynamic.c +++ b/wiiu/system/dynamic.c @@ -2,16 +2,17 @@ #include #define EXPORT(name) void* addr_##name -#include "../rpl/libcoreinit/exports.h" -#include "../rpl/libnsysnet/exports.h" -#include "../rpl/libgx2/exports.h" -#include "../rpl/libproc_ui/exports.h" -#include "../rpl/libsndcore2/exports.h" -#include "../rpl/libsysapp/exports.h" -#include "../rpl/libvpad/exports.h" +#define EXPORT_BEGIN(lib) +#define EXPORT_END() +#include "exports/all.h" #undef EXPORT -#define EXPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0) +#undef EXPORT_BEGIN +#undef EXPORT_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) void InitFunctionPointers(void) { @@ -19,33 +20,6 @@ void InitFunctionPointers(void) addr_OSDynLoad_Acquire = *(void**)0x00801500; addr_OSDynLoad_FindExport = *(void**)0x00801504; - OSDynLoad_Acquire("coreinit.rpl", &handle); - OSDynLoad_FindExport(handle, 0, "OSFatal", &addr_OSFatal); - #include "../rpl/libcoreinit/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("nsysnet.rpl", &handle); - #include "../rpl/libnsysnet/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("gx2.rpl", &handle); - #include "../rpl/libgx2/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("proc_ui.rpl", &handle); - #include "../rpl/libproc_ui/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("sndcore2.rpl", &handle); - #include "../rpl/libsndcore2/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("sysapp.rpl", &handle); - #include "../rpl/libsysapp/exports.h" - OSDynLoad_Release(handle); - - OSDynLoad_Acquire("vpad.rpl", &handle); - #include "../rpl/libvpad/exports.h" - OSDynLoad_Release(handle); +#include "exports/all.h" } diff --git a/wiiu/system/exception.h b/wiiu/system/exception.h index cc1b0c2a3f..f1c3a0507d 100644 --- a/wiiu/system/exception.h +++ b/wiiu/system/exception.h @@ -1,5 +1,6 @@ /* source: https://github.com/QuarkTheAwesome/URetro */ +#include #include #include #include @@ -39,8 +40,10 @@ unsigned char exception_handler(void* contextIn) { DisassemblePPCRange((void*)context[38]-0x18, (void*)context[38]+0x4, (void*)exception_disassembly_helper, 0, 0); char buf[2048]; __os_snprintf(buf, 2048, "SP:%08X LR:%08X PC:%08X CR:%08X CTR:%08X\nXER:%08X SR0:%08X SR1:%08X EX0:%08X EX1:%08X\nr0:%08X r2:%08X r3:%08X r4:%08X r5:%08X\nr6:%08X r7:%08X r8:%08X r9:%08X r10:%08X\nr11:%08X r12:%08X r13:%08X r14:%08X r15:%08X\nr16:%08X r17:%08X r18:%08X r19:%08X r20:%08X\nr21:%08X r22:%08X r23:%08X r24:%08X r25:%08X\nr26:%08X r27:%08X r28:%08X r29:%08X r30:%08X\nr31:%08X\n%s", context[3], context[35], context[38], context[34], context[36], context[37], context[38], context[39], context[40], context[41], context[2], context[4], context[5], context[6], context[7], context[8], context[9], context[10], context[11], context[12], context[13], context[14], context[15], context[16], context[17], context[18], context[19], context[20], context[21], context[22], context[23], context[24], context[25], context[26], context[27], context[28], context[29], context[30], context[31], context[32], context[33], buf2); - void net_print(const char* str); - net_print(buf); + void net_print_exp(const char* str); + void log_deinit(void); + net_print_exp(buf); + log_deinit(); OSFatal(buf); return 0; diff --git a/wiiu/system/exception_handler.c b/wiiu/system/exception_handler.c index fbc4e1cbb2..66680d9c71 100644 --- a/wiiu/system/exception_handler.c +++ b/wiiu/system/exception_handler.c @@ -2,8 +2,9 @@ #include #include #include +#include #include "exception_handler.h" -#include "wiiu/wiiu_dbg.h" +#include "wiiu_dbg.h" #define OS_EXCEPTION_MODE_GLOBAL_ALL_CORES 4 @@ -14,160 +15,197 @@ /* Exceptions */ typedef struct OSContext_ { - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; + /* OSContext identifier */ + uint32_t tag1; + uint32_t tag2; - /* GPRs */ - uint32_t gpr[32]; + /* GPRs */ + uint32_t gpr[32]; - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; + /* Special registers */ + uint32_t cr; + uint32_t lr; + uint32_t ctr; + uint32_t xer; - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; + /* Initial PC and MSR */ + uint32_t srr0; + uint32_t srr1; - /* Only valid during DSI exception */ - uint32_t exception_specific0; - uint32_t exception_specific1; + /* Only valid during DSI exception */ + uint32_t exception_specific0; + uint32_t exception_specific1; - /* There is actually a lot more here but we don't need the rest*/ + /* There is actually a lot more here but we don't need the rest*/ } OSContext_; -#define CPU_STACK_TRACE_DEPTH 10 -#define __stringify(rn) #rn +#define CPU_STACK_TRACE_DEPTH 10 +#define __stringify(rn) #rn #define mfspr(_rn) \ -({ register uint32_t _rval = 0; \ - asm volatile("mfspr %0," __stringify(_rn) \ - : "=r" (_rval));\ - _rval; \ +({ register uint32_t _rval = 0; \ + asm volatile("mfspr %0," __stringify(_rn) \ + : "=r" (_rval));\ + _rval; \ }) -typedef struct _framerec { - struct _framerec *up; - void *lr; +typedef struct _framerec +{ + struct _framerec* up; + void* lr; } frame_rec, *frame_rec_t; -static const char *exception_names[] = { - "DSI", - "ISI", - "PROGRAM" +static const char* exception_names[] = +{ + "DSI", + "ISI", + "PROGRAM" }; -static const char exception_print_formats[18][45] = { - "Exception type %s occurred!\n", // 0 - "GPR00 %08X GPR08 %08X GPR16 %08X GPR24 %08X\n", // 1 - "GPR01 %08X GPR09 %08X GPR17 %08X GPR25 %08X\n", // 2 - "GPR02 %08X GPR10 %08X GPR18 %08X GPR26 %08X\n", // 3 - "GPR03 %08X GPR11 %08X GPR19 %08X GPR27 %08X\n", // 4 - "GPR04 %08X GPR12 %08X GPR20 %08X GPR28 %08X\n", // 5 - "GPR05 %08X GPR13 %08X GPR21 %08X GPR29 %08X\n", // 6 - "GPR06 %08X GPR14 %08X GPR22 %08X GPR30 %08X\n", // 7 - "GPR07 %08X GPR15 %08X GPR23 %08X GPR31 %08X\n", // 8 - "LR %08X SRR0 %08x SRR1 %08x\n", // 9 - "DAR %08X DSISR %08X\n", // 10 - "STACK DUMP:", // 11 - " --> ", // 12 - " -->\n", // 13 - "\n", // 14 - "%p", // 15 - "\nCODE DUMP:\n", // 16 - "%p: %08X %08X %08X %08X\n", // 17 +static const char exception_print_formats[18][45] = +{ + "Exception type %s occurred!\n", // 0 + "GPR00 %08X GPR08 %08X GPR16 %08X GPR24 %08X\n", // 1 + "GPR01 %08X GPR09 %08X GPR17 %08X GPR25 %08X\n", // 2 + "GPR02 %08X GPR10 %08X GPR18 %08X GPR26 %08X\n", // 3 + "GPR03 %08X GPR11 %08X GPR19 %08X GPR27 %08X\n", // 4 + "GPR04 %08X GPR12 %08X GPR20 %08X GPR28 %08X\n", // 5 + "GPR05 %08X GPR13 %08X GPR21 %08X GPR29 %08X\n", // 6 + "GPR06 %08X GPR14 %08X GPR22 %08X GPR30 %08X\n", // 7 + "GPR07 %08X GPR15 %08X GPR23 %08X GPR31 %08X\n", // 8 + "LR %08X SRR0 %08x SRR1 %08x\n", // 9 + "DAR %08X DSISR %08X\n", // 10 + "STACK DUMP:", // 11 + " --> ", // 12 + " -->\n", // 13 + "\n", // 14 + "%p", // 15 + "\nCODE DUMP:\n", // 16 + "%p: %08X %08X %08X %08X\n", // 17 }; +void net_print_exp(const char* str); +void log_deinit(void); -static unsigned char exception_cb(void * c, unsigned char exception_type) { - char buf[4096]; - int pos = 0; +static unsigned char exception_cb(void* c, unsigned char exception_type) +{ + char gdb_buf[512]; + char* gdb_buf_ptr = gdb_buf; + char buf[4096]; + int pos = 0; - OSContext_ *context = (OSContext_ *) c; - /* - * This part is mostly from libogc. Thanks to the devs over there. - */ - pos += sprintf(buf + pos, exception_print_formats[0], exception_names[exception_type]); - pos += sprintf(buf + pos, exception_print_formats[1], context->gpr[0], context->gpr[8], context->gpr[16], context->gpr[24]); - pos += sprintf(buf + pos, exception_print_formats[2], context->gpr[1], context->gpr[9], context->gpr[17], context->gpr[25]); - pos += sprintf(buf + pos, exception_print_formats[3], context->gpr[2], context->gpr[10], context->gpr[18], context->gpr[26]); - pos += sprintf(buf + pos, exception_print_formats[4], context->gpr[3], context->gpr[11], context->gpr[19], context->gpr[27]); - pos += sprintf(buf + pos, exception_print_formats[5], context->gpr[4], context->gpr[12], context->gpr[20], context->gpr[28]); - pos += sprintf(buf + pos, exception_print_formats[6], context->gpr[5], context->gpr[13], context->gpr[21], context->gpr[29]); - pos += sprintf(buf + pos, exception_print_formats[7], context->gpr[6], context->gpr[14], context->gpr[22], context->gpr[30]); - pos += sprintf(buf + pos, exception_print_formats[8], context->gpr[7], context->gpr[15], context->gpr[23], context->gpr[31]); - pos += sprintf(buf + pos, exception_print_formats[9], context->lr, context->srr0, context->srr1); + OSContext_ *context = (OSContext_*) c; + /* + * This part is mostly from libogc. Thanks to the devs over there. + */ + pos += sprintf(buf + pos, exception_print_formats[0], exception_names[exception_type]); + pos += sprintf(buf + pos, exception_print_formats[1], context->gpr[0], context->gpr[8], context->gpr[16], + context->gpr[24]); + pos += sprintf(buf + pos, exception_print_formats[2], context->gpr[1], context->gpr[9], context->gpr[17], + context->gpr[25]); + pos += sprintf(buf + pos, exception_print_formats[3], context->gpr[2], context->gpr[10], context->gpr[18], + context->gpr[26]); + pos += sprintf(buf + pos, exception_print_formats[4], context->gpr[3], context->gpr[11], context->gpr[19], + context->gpr[27]); + pos += sprintf(buf + pos, exception_print_formats[5], context->gpr[4], context->gpr[12], context->gpr[20], + context->gpr[28]); + pos += sprintf(buf + pos, exception_print_formats[6], context->gpr[5], context->gpr[13], context->gpr[21], + context->gpr[29]); + pos += sprintf(buf + pos, exception_print_formats[7], context->gpr[6], context->gpr[14], context->gpr[22], + context->gpr[30]); + pos += sprintf(buf + pos, exception_print_formats[8], context->gpr[7], context->gpr[15], context->gpr[23], + context->gpr[31]); + pos += sprintf(buf + pos, exception_print_formats[9], context->lr, context->srr0, context->srr1); - //if(exception_type == OS_EXCEPTION_DSI) { - pos += sprintf(buf + pos, exception_print_formats[10], context->exception_specific1, context->exception_specific0); // this freezes - //} + //if(exception_type == OS_EXCEPTION_DSI) { + pos += sprintf(buf + pos, exception_print_formats[10], context->exception_specific1, + context->exception_specific0); // this freezes + //} - void *pc = (void*)context->srr0; - void *lr = (void*)context->lr; - void *r1 = (void*)context->gpr[1]; - register uint32_t i = 0; - register frame_rec_t l,p = (frame_rec_t)lr; + void* pc = (void*)context->srr0; + void* lr = (void*)context->lr; + void* r1 = (void*)context->gpr[1]; + register uint32_t i = 0; + register frame_rec_t l, p = (frame_rec_t)lr; - l = p; - p = r1; - if(!p) - asm volatile("mr %0,%%r1" : "=r"(p)); + l = p; + p = r1; - pos += sprintf(buf + pos, exception_print_formats[11]); + if (!p) + asm volatile("mr %0,%%r1" : "=r"(p)); - for(i = 0; i < CPU_STACK_TRACE_DEPTH-1 && p->up; p = p->up, i++) { - if(i % 4) - pos += sprintf(buf + pos, exception_print_formats[12]); - else { - if(i > 0) - pos += sprintf(buf + pos, exception_print_formats[13]); - else - pos += sprintf(buf + pos, exception_print_formats[14]); - } + pos += sprintf(buf + pos, exception_print_formats[11]); - switch(i) { - case 0: - if(pc) - pos += sprintf(buf + pos, exception_print_formats[15],pc); - break; - case 1: - if(!l) - l = (frame_rec_t)mfspr(8); - pos += sprintf(buf + pos, exception_print_formats[15],(void*)l); - break; - default: - pos += sprintf(buf + pos, exception_print_formats[15],(void*)(p->up->lr)); - break; - } - } + for (i = 0; i < CPU_STACK_TRACE_DEPTH - 1 && p->up; p = p->up, i++) + { + if (i % 4) + pos += sprintf(buf + pos, exception_print_formats[12]); + else + { + if (i > 0) + pos += sprintf(buf + pos, exception_print_formats[13]); + else + pos += sprintf(buf + pos, exception_print_formats[14]); + } - //if(exception_type == OS_EXCEPTION_DSI) { - uint32_t *pAdd = (uint32_t*)context->srr0; - pos += sprintf(buf + pos, exception_print_formats[16]); - // TODO by Dimok: this was actually be 3 instead of 2 lines in libogc .... but there is just no more space anymore on the screen - for (i = 0; i < 8; i += 4) - pos += sprintf(buf + pos, exception_print_formats[17], &(pAdd[i]),pAdd[i], pAdd[i+1], pAdd[i+2], pAdd[i+3]); - //} - void net_print(const char* str); + switch (i) + { + case 0: + if (pc) + { + pos += sprintf(buf + pos, exception_print_formats[15], pc); + gdb_buf_ptr += __os_snprintf(gdb_buf_ptr, &gdb_buf[sizeof(gdb_buf)] - gdb_buf_ptr, "info line *0x%08X\n", pc); - net_print(buf); - OSFatal(buf); - return 1; + } + + break; + + case 1: + if (!l) + l = (frame_rec_t)mfspr(8); + + pos += sprintf(buf + pos, exception_print_formats[15], (void*)l); + gdb_buf_ptr += __os_snprintf(gdb_buf_ptr, &gdb_buf[sizeof(gdb_buf)] - gdb_buf_ptr, "info line *0x%08X\n", l); + break; + + default: + pos += sprintf(buf + pos, exception_print_formats[15], (void*)(p->up->lr)); + gdb_buf_ptr += __os_snprintf(gdb_buf_ptr, &gdb_buf[sizeof(gdb_buf)] - gdb_buf_ptr, "info line *0x%08X\n", p->up->lr); + break; + } + } + + //if(exception_type == OS_EXCEPTION_DSI) { + uint32_t* pAdd = (uint32_t*)context->srr0; + pos += sprintf(buf + pos, exception_print_formats[16]); + + // TODO by Dimok: this was actually be 3 instead of 2 lines in libogc .... but there is just no more space anymore on the screen + for (i = 0; i < 8; i += 4) + pos += sprintf(buf + pos, exception_print_formats[17], &(pAdd[i]), pAdd[i], pAdd[i + 1], pAdd[i + 2], pAdd[i + 3]); + + //} + net_print_exp(gdb_buf); +// net_print_exp(buf); + log_deinit(); + OSFatal(buf); + return 1; } -static unsigned char dsi_exception_cb(void * context) { - return exception_cb(context, 0); +static unsigned char dsi_exception_cb(void* context) +{ + return exception_cb(context, 0); } -static unsigned char isi_exception_cb(void * context) { - return exception_cb(context, 1); +static unsigned char isi_exception_cb(void* context) +{ + return exception_cb(context, 1); } -static unsigned char program_exception_cb(void * context) { - return exception_cb(context, 2); +static unsigned char program_exception_cb(void* context) +{ + return exception_cb(context, 2); } -void setup_os_exceptions(void) { - OSSetExceptionCallback(OS_EXCEPTION_DSI, (OSExceptionCallbackFn)&dsi_exception_cb); - OSSetExceptionCallback(OS_EXCEPTION_ISI, (OSExceptionCallbackFn)&isi_exception_cb); - OSSetExceptionCallback(OS_EXCEPTION_PROGRAM, (OSExceptionCallbackFn)&program_exception_cb); +void setup_os_exceptions(void) +{ + OSSetExceptionCallback(OS_EXCEPTION_DSI, (OSExceptionCallbackFn)&dsi_exception_cb); + OSSetExceptionCallback(OS_EXCEPTION_ISI, (OSExceptionCallbackFn)&isi_exception_cb); + OSSetExceptionCallback(OS_EXCEPTION_PROGRAM, (OSExceptionCallbackFn)&program_exception_cb); } diff --git a/wiiu/system/exports/all.h b/wiiu/system/exports/all.h new file mode 100644 index 0000000000..c2accb1058 --- /dev/null +++ b/wiiu/system/exports/all.h @@ -0,0 +1,8 @@ + +#include "libcoreinit.h" +#include "libnsysnet.h" +#include "libgx2.h" +#include "libproc_ui.h" +#include "libsndcore2.h" +#include "libsysapp.h" +#include "libvpad.h" diff --git a/wiiu/system/exports/libcoreinit.h b/wiiu/system/exports/libcoreinit.h new file mode 100644 index 0000000000..b291de7f76 --- /dev/null +++ b/wiiu/system/exports/libcoreinit.h @@ -0,0 +1,7 @@ + +EXPORT_BEGIN(coreinit.rpl); + +/* OSFatal should preferably be put first in the list */ +#include "../rpl/libcoreinit/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libgx2.h b/wiiu/system/exports/libgx2.h new file mode 100644 index 0000000000..90ed1d25a7 --- /dev/null +++ b/wiiu/system/exports/libgx2.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(gx2.rpl); + +#include "../rpl/libgx2/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libnsysnet.h b/wiiu/system/exports/libnsysnet.h new file mode 100644 index 0000000000..e950006893 --- /dev/null +++ b/wiiu/system/exports/libnsysnet.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(nsysnet.rpl); + +#include "../rpl/libnsysnet/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libproc_ui.h b/wiiu/system/exports/libproc_ui.h new file mode 100644 index 0000000000..870b28b86f --- /dev/null +++ b/wiiu/system/exports/libproc_ui.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(proc_ui.rpl); + +#include "../rpl/libproc_ui/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libsndcore2.h b/wiiu/system/exports/libsndcore2.h new file mode 100644 index 0000000000..66b9f2bf5a --- /dev/null +++ b/wiiu/system/exports/libsndcore2.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(sndcore2.rpl); + +#include "../rpl/libsndcore2/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libsysapp.h b/wiiu/system/exports/libsysapp.h new file mode 100644 index 0000000000..8a5759dcfc --- /dev/null +++ b/wiiu/system/exports/libsysapp.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(sysapp.rpl); + +#include "../rpl/libsysapp/exports.h" + +EXPORT_END(); diff --git a/wiiu/system/exports/libvpad.h b/wiiu/system/exports/libvpad.h new file mode 100644 index 0000000000..9df6a5e438 --- /dev/null +++ b/wiiu/system/exports/libvpad.h @@ -0,0 +1,6 @@ + +EXPORT_BEGIN(vpad.rpl); + +#include "../rpl/libvpad/exports.h" + +EXPORT_END(); diff --git a/wiiu/wiiload.py b/wiiu/wiiload.py deleted file mode 100755 index cb7585de1f..0000000000 --- a/wiiu/wiiload.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python - -import os, sys, zlib, socket, struct - -#ip = os.getenv("WIILOAD") -ip = "tcp:10.42.0.170" -assert ip.startswith("tcp:") -wii_ip = (ip[4:], 4299) - -filename = sys.argv[1] - -WIILOAD_VERSION_MAJOR=0 -WIILOAD_VERSION_MINOR=5 - -len_uncompressed = os.path.getsize(filename) -c_data = zlib.compress(open(filename).read(), 6) - -chunk_size = 1024*128 -chunks = [c_data[i:i+chunk_size] for i in range(0, len(c_data), chunk_size)] - -args = [os.path.basename(filename)]+sys.argv[2:] -args = "\x00".join(args) + "\x00" - -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.connect(wii_ip) - -s.send("HAXX") -s.send(struct.pack("B", WIILOAD_VERSION_MAJOR)) # one byte, unsigned -s.send(struct.pack("B", WIILOAD_VERSION_MINOR)) # one byte, unsigned -s.send(struct.pack(">H",len(args))) # bigendian, 2 bytes, unsigned -s.send(struct.pack(">L",len(c_data))) # bigendian, 4 bytes, unsigned -s.send(struct.pack(">L",len_uncompressed)) # bigendian, 4 bytes, unsigned - -print len(chunks),"chunks to send" -for piece in chunks: - s.send(piece) - sys.stdout.write("."); sys.stdout.flush() -sys.stdout.write("\n") - -s.send(args) - -s.close() -print "done" diff --git a/wiiu/wiiu_dbg.h b/wiiu/wiiu_dbg.h index 4c3c2e4ba8..e44e75408a 100644 --- a/wiiu/wiiu_dbg.h +++ b/wiiu/wiiu_dbg.h @@ -20,7 +20,7 @@ extern "C" { #define DEBUG_VAR64(X) printf( #X"\r\t\t\t\t : 0x%016llX\n", (u64)(X)) //#define DEBUG_ERROR(X) do{if(X)dump_result_value(X);}while(0) #define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H" -#define PRINTFPOS_STR(X,Y) "\x1b["X";"Y"H" -#define PRINTF_LINE(X) "\x1b["X";0H" +#define PRINTFPOS_STR(X,Y) "\x1b[" X ";" Y "H" +#define PRINTF_LINE(X) "\x1b[" X ";0H" #endif // WIIU_DBG_H