From efcc00b66bfb9ae52a7ef7f29be1a1794616c151 Mon Sep 17 00:00:00 2001 From: "e.bovendeur" Date: Sat, 5 Dec 2009 08:06:05 +0000 Subject: [PATCH] * Added WII_Initialize call to IOS_ReloadIOSsafe to prevent DSI exception when calling WII_LaunchTitle * Fixed check for valid cioses * Removed gprintf from MEM2 --- HBC/META.XML | 4 ++-- source/main.cpp | 8 +++++--- source/memory/mem2.cpp | 30 +----------------------------- source/sys.cpp | 6 +++++- 4 files changed, 13 insertions(+), 35 deletions(-) diff --git a/HBC/META.XML b/HBC/META.XML index 0d1c72f9..09d1023a 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r848 - 200912041511 + 1.0 r850 + 200912050746 Loads games from USB-devices USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. diff --git a/source/main.cpp b/source/main.cpp index 399378fd..28b47b13 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -234,7 +234,7 @@ main(int argc, char *argv[]) { ios249rev = getIOSrev(0x00000001000000f9ll); //if we don't like either of the cIOS then scram - if (!(ios222rev==4 && (ios249rev>=9 && ios249rev<65535))) + if (!(ios222rev==4 || (ios249rev>=9 && ios249rev<65280))) { InitTextVideo(); printf("\x1b[2J"); @@ -249,12 +249,14 @@ main(int argc, char *argv[]) { } else { printf("\n\n\n\tERROR!"); printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+"); - printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65535?" (Stubbed by 4.2 update)":""); - printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65535?" (Stubbed by 4.2 update)":""); + printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65280?" (Stubbed by 4.2 update)":""); + printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65280?" (Stubbed by 4.2 update)":""); printf("\n\n\tGo figure out how to get some cIOS action going on\n\tin your Wii and come back and see me."); sleep(15); printf("\n\n\tBye"); + + USBDevice_deInit(); exit(0); } } diff --git a/source/memory/mem2.cpp b/source/memory/mem2.cpp index c57a2af7..0643b383 100644 --- a/source/memory/mem2.cpp +++ b/source/memory/mem2.cpp @@ -1,7 +1,6 @@ #include "mem2.h" #include "mem2alloc.h" -#include "gecko.h" #include #include @@ -72,18 +71,14 @@ void *__wrap_malloc(size_t size) { p = MEM2_alloc(size); if (p != 0) { - gprintf("Malloc of size %d returns address in MEM2\n", size); return p; } - gprintf("Malloc of size %d returns address in MEM1\n", size); return __real_malloc(size); } p = __real_malloc(size); if (p != 0) { - gprintf("Malloc of size %d returns address in MEM1\n", size); return p; } - gprintf("Malloc of size %d returns address in MEM2\n", size); return MEM2_alloc(size); } @@ -95,24 +90,18 @@ void *__wrap_calloc(size_t n, size_t size) p = MEM2_alloc(n * size); if (p != 0) { - gprintf("Calloc of amount %d, size %d returns address in MEM2\n", n, size); memset(p, 0, n * size); return p; } - gprintf("Calloc of amount %d, size %d returns address in MEM1\n", n, size); return __real_calloc(n, size); } p = __real_calloc(n, size); if (p != 0) { - gprintf("Calloc of amount %d, size %d returns address in MEM1\n", n, size); return p; } p = MEM2_alloc(n * size); if (p != 0) { - gprintf("Calloc of amount %d, size %d returns address in MEM2\n", n, size); memset(p, 0, n * size); - } else { - gprintf("Calloc of amount %d, size %d returns NULL\n", n, size); } return p; } @@ -126,35 +115,24 @@ void *__wrap_memalign(size_t a, size_t size) { p = MEM2_alloc(size); if (p != 0) { - gprintf("Memalign in blocks of %d, size %d returns address in MEM2\n", a, size); return p; } } - gprintf("Memalign in blocks of %d, size %d returns address in MEM1\n", a, size); return __real_memalign(a, size); } p = __real_memalign(a, size); if (p != 0 || a > 32 || 32 % a != 0) { - gprintf("Memalign in blocks of %d, size %d returns address in MEM1\n", a, size); return p; } - p = MEM2_alloc(size); - if (p != 0) { - gprintf("Memalign in blocks of %d, size %d returns address in MEM2\n", a, size); - } else { - gprintf("Memalign in blocks of %d, size %d returns NULL\n", a, size); - } - return p; + return MEM2_alloc(size); } void __wrap_free(void *p) { if (((u32)p & 0x10000000) != 0) { - gprintf("Free pointer in address in MEM2\n"); MEM2_free(p); } else { - gprintf("Free pointer in address in MEM1\n"); __real_free(p); } } @@ -167,12 +145,10 @@ void *__wrap_realloc(void *p, size_t size) { n = MEM2_realloc(p, size); if (n != 0) { - gprintf("Realloc of size %d returns memory in MEM2\n", size); return n; } n = __real_malloc(size); if (n == 0) { - gprintf("Realloc of size %d returns NULL\n", size); return 0; } if (p != 0) @@ -180,18 +156,15 @@ void *__wrap_realloc(void *p, size_t size) memcpy(n, p, MEM2_usableSize(p) < size ? MEM2_usableSize(p) : size); MEM2_free(p); } - gprintf("Realloc of size %d returns memory in MEM1\n", size); return n; } // ptr from malloc n = __real_realloc(p, size); if (n != 0) { - gprintf("Realloc of size %d returns memory in MEM1\n", size); return n; } n = MEM2_alloc(size); if (n == 0) { - gprintf("Realloc of size %d returns memory in MEM2\n", size); return 0; } if (p != 0) @@ -199,7 +172,6 @@ void *__wrap_realloc(void *p, size_t size) memcpy(n, p, __real_malloc_usable_size(p) < size ? __real_malloc_usable_size(p) : size); __real_free(p); } - gprintf("Realloc of size %d returns memory in MEM2\n", size); return n; } diff --git a/source/sys.cpp b/source/sys.cpp index 52273fc6..0b035c33 100644 --- a/source/sys.cpp +++ b/source/sys.cpp @@ -255,6 +255,10 @@ s32 IOS_ReloadIOSsafe(int ios) if (ios250rev >= 0 && !(ios250rev>=9 && ios250rev<65280))return -2; } - return IOS_ReloadIOS(ios); + s32 r = IOS_ReloadIOS(ios); + if (r >= 0) { + WII_Initialize(); + } + return r; }