* Added WII_Initialize call to IOS_ReloadIOSsafe to prevent DSI exception when calling WII_LaunchTitle

* Fixed check for valid cioses
* Removed gprintf from MEM2
This commit is contained in:
e.bovendeur 2009-12-05 08:06:05 +00:00
parent ab25485614
commit efcc00b66b
4 changed files with 13 additions and 35 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r848</version>
<release_date>200912041511</release_date>
<version>1.0 r850</version>
<release_date>200912050746</release_date>
<short_description>Loads games from USB-devices</short_description>
<long_description>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.

View File

@ -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);
}
}

View File

@ -1,7 +1,6 @@
#include "mem2.h"
#include "mem2alloc.h"
#include "gecko.h"
#include <malloc.h>
#include <string.h>
@ -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;
}

View File

@ -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;
}