mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
comments, debug stuff, and compile warnings.
no functional changes
This commit is contained in:
parent
0e5d1d182f
commit
2af7d13868
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>1.0 r924</version>
|
||||
<release_date>201004102335</release_date>
|
||||
<version>1.0 r925</version>
|
||||
<release_date>201004110116</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.
|
||||
|
@ -140,10 +140,10 @@ unsigned int *xfb = NULL;
|
||||
|
||||
void InitTextVideo ()
|
||||
{
|
||||
gprintf("\nInitTextVideo ()");
|
||||
gprintf("\n\nInitTextVideo ()");
|
||||
if (textVideoInit)
|
||||
{
|
||||
gprintf("...0");
|
||||
gprintf("...0\n");
|
||||
return;
|
||||
}
|
||||
dbvideo=1;
|
||||
@ -174,7 +174,7 @@ void InitTextVideo ()
|
||||
//send console output to the gecko
|
||||
if (geckoinit)CON_EnableGecko(1, true);
|
||||
textVideoInit = true;
|
||||
gprintf("...1");
|
||||
gprintf("...1\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ int MainMenu(int menu) {
|
||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||
|
||||
if (game_cfg) {
|
||||
videoChoice = game_cfg->video;
|
||||
videoChoice = game_cfg->video;
|
||||
languageChoice = game_cfg->language;
|
||||
ocarinaChoice = game_cfg->ocarina;
|
||||
viChoice = game_cfg->vipatch;
|
||||
@ -606,7 +606,7 @@ int MainMenu(int menu) {
|
||||
u32 rtrnID = GetReturnToTitle();
|
||||
gprintf("Disc_wiiBoot\n" );
|
||||
|
||||
ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset, rtrnID);
|
||||
ret = Disc_WiiBoot( videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset, rtrnID );
|
||||
if (ret < 0) {
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
@ -416,88 +416,6 @@ void vidolpatcher(void *addr, u32 len)
|
||||
}
|
||||
|
||||
//giantpune's magic super patch to return to channels
|
||||
/*bool PatchReturnTo(void *Address, int Size, u32 id) {
|
||||
u8 SearchPattern[ 12 ] = { 0x38, 0x80, 0x00, 0x02, 0x38, 0x60, 0x00, 0x01, 0x38, 0xa0, 0x00, 0x00 };
|
||||
|
||||
int found = 0;
|
||||
int patched = 0;
|
||||
int offset = 0;
|
||||
u32 ad[ 3 ] = { 0, 0, 0 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
|
||||
//find __OSLaunchMenu() and remember some addresses in it
|
||||
while (Addr <= Addr_end - 12 ) {
|
||||
if ( memcmp( Addr, SearchPattern, 12 )==0 ) {
|
||||
ad[ found++ ] = Addr;
|
||||
}
|
||||
else if ( ad[ 0 ] && memcmp( Addr, SearchPattern, 8 )==0 ) //after the first match is found, only search the first 8 bytes for the other 2
|
||||
{
|
||||
if( !ad[ 1 ] ) ad[ found++ ] = Addr;
|
||||
else if( !ad[ 2 ] ) ad[ found++ ] = Addr;
|
||||
if( found >= 3 )break;
|
||||
}
|
||||
Addr += 4;
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
//if the function is found and if it is not too far into the main.dol
|
||||
if( found == 3 && ( offset < 0x1000001 ) )
|
||||
{
|
||||
u32 nop = 0x60000000;
|
||||
|
||||
//the magic that writes the TID to the registers
|
||||
u8 jump[ 20 ] = { 0x3C, 0x60, 0x00, 0x01, 0x60, 0x63, 0x00, 0x01,
|
||||
0x3C, 0x80, 0x4A, 0x4F, 0x60, 0x84, 0x44, 0x49,
|
||||
0x4E, 0x80, 0x00, 0x20 };
|
||||
//patch the thing to use the new TID
|
||||
jump[ 10 ] = (u8)( id>>24 );
|
||||
jump[ 11 ] = (u8)( id>>16 );
|
||||
jump[ 14 ] = (u8)( id>>8 );
|
||||
jump[ 15 ] = (u8)id;
|
||||
|
||||
u32 jumpTo = Address - sizeof( jump );
|
||||
void* addr = jumpTo;
|
||||
|
||||
//write new stuff to memory right before the main.dol
|
||||
memcpy( addr, jump, sizeof( jump ) );
|
||||
|
||||
//ES_GetTicketViews()
|
||||
u32 newval = ( jumpTo - ad[ 0 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 0 ];
|
||||
//gprintf("addr: %p\n", addr );
|
||||
memcpy( addr, &newval, sizeof( u32) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32) );
|
||||
//gprintf("%p patched to %08x\n", addr, newval );
|
||||
|
||||
//ES_GetTicketViews() again
|
||||
newval = ( jumpTo - ad[ 1 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 1 ];
|
||||
//gprintf("addr: %p\n", addr );
|
||||
memcpy( addr, &newval, sizeof( u32) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32) );
|
||||
//gprintf("%p patched to %08x\n", addr, newval );
|
||||
|
||||
//ES_LaunchTitle()
|
||||
newval = ( jumpTo - ad[ 2 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 2 ];
|
||||
//gprintf("addr: %p\n", addr );
|
||||
memcpy( addr, &newval, sizeof( u32) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32) );
|
||||
//gprintf("%p patched to %08x\n", addr, newval );
|
||||
|
||||
patched = 1;
|
||||
}
|
||||
return patched;
|
||||
}
|
||||
*/
|
||||
bool PatchReturnTo(void *Address, int Size, u32 id) {
|
||||
u8 SearchPattern[ 12 ] = { 0x38, 0x80, 0x00, 0x02, 0x38, 0x60, 0x00, 0x01, 0x38, 0xa0, 0x00, 0x00 };
|
||||
u8 SearchPattern2[ 12 ] = { 0x4D, 0x65, 0x74, 0x72, 0x6F, 0x77, 0x65, 0x72, 0x6B, 0x73, 0x20, 0x54 };
|
||||
@ -512,18 +430,18 @@ bool PatchReturnTo(void *Address, int Size, u32 id) {
|
||||
while (Addr <= Addr_end - 12 ) {
|
||||
//find a safe place or the patch to hang out
|
||||
if ( ! ad[ 3 ] && memcmp( Addr, SearchPattern2, 12 )==0 ) {
|
||||
ad[ 3 ] = Addr + 0x30;
|
||||
ad[ 3 ] = (u32)Addr + 0x30;
|
||||
gprintf("found a safe place @ %08x\n", ad[ 3 ]);
|
||||
//hexdump( Addr, 0x50 );
|
||||
}
|
||||
//find __OSLaunchMenu() and remember some addresses in it
|
||||
else if ( memcmp( Addr, SearchPattern, 12 )==0 ) {
|
||||
ad[ found++ ] = Addr;
|
||||
ad[ found++ ] = (u32)Addr;
|
||||
}
|
||||
else if ( ad[ 0 ] && memcmp( Addr, SearchPattern, 8 )==0 ) //after the first match is found, only search the first 8 bytes for the other 2
|
||||
{
|
||||
if( !ad[ 1 ] ) ad[ found++ ] = Addr;
|
||||
else if( !ad[ 2 ] ) ad[ found++ ] = Addr;
|
||||
if( !ad[ 1 ] ) ad[ found++ ] = (u32)Addr;
|
||||
else if( !ad[ 2 ] ) ad[ found++ ] = (u32)Addr;
|
||||
if( found >= 3 )break;
|
||||
}
|
||||
Addr += 4;
|
||||
@ -545,38 +463,37 @@ bool PatchReturnTo(void *Address, int Size, u32 id) {
|
||||
jump[ 14 ] = (u8)( id>>8 );
|
||||
jump[ 15 ] = (u8)id;
|
||||
|
||||
//u32 jumpTo = Address - sizeof( jump );
|
||||
void* addr = ad[ 3 ];
|
||||
void* addr = (u32*)ad[ 3 ];
|
||||
|
||||
//write new stuff to memory right before the main.dol
|
||||
//write new stuff to memory main.dol in a unused part of the main.dol
|
||||
memcpy( addr, jump, sizeof( jump ) );
|
||||
|
||||
//ES_GetTicketViews()
|
||||
u32 newval = ( ad[ 3 ] - ad[ 0 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 0 ];
|
||||
addr = (u32*)ad[ 0 ];
|
||||
memcpy( addr, &newval, sizeof( u32 ) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32 ) );
|
||||
gprintf("%p -> %08x\n", addr, newval );
|
||||
gprintf("\t%p -> %08x\n", addr, newval );
|
||||
|
||||
//ES_GetTicketViews() again
|
||||
newval = ( ad[ 3 ] - ad[ 1 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 1 ];
|
||||
addr = (u32*)ad[ 1 ];
|
||||
memcpy( addr, &newval, sizeof( u32 ) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32 ) );
|
||||
gprintf("%p -> %08x\n", addr, newval );
|
||||
gprintf("\t%p -> %08x\n", addr, newval );
|
||||
|
||||
//ES_LaunchTitle()
|
||||
newval = ( ad[ 3 ] - ad[ 2 ] );
|
||||
newval &= 0x03FFFFFC;
|
||||
newval |= 0x48000001;
|
||||
addr = ad[ 2 ];
|
||||
addr = (u32*)ad[ 2 ];
|
||||
memcpy( addr, &newval, sizeof( u32 ) );
|
||||
memcpy( addr + 4, &nop, sizeof( u32 ) );
|
||||
gprintf("%p -> %08x\n", addr, newval );
|
||||
gprintf("\t%p -> %08x\n", addr, newval );
|
||||
|
||||
patched = 1;
|
||||
}
|
||||
|
@ -8,7 +8,9 @@
|
||||
#include "apploader.h"
|
||||
#include "wdvd.h"
|
||||
#include "fstfile.h"
|
||||
#include "../gecko.h"
|
||||
#include "../patches/dvd_broadway.h"
|
||||
#include "../patches/patchcode.h"
|
||||
|
||||
extern u8 mountMethod;
|
||||
|
||||
@ -218,16 +220,21 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
|
||||
|
||||
|
||||
DCFlushRange(offset, len);
|
||||
if( offset < dolStart )dolStart = offset;
|
||||
if( offset + len > dolEnd ) dolEnd = offset + len;
|
||||
|
||||
if( (u32)offset < dolStart )
|
||||
dolStart = (u32)offset;
|
||||
|
||||
if( (u32)offset + len > dolEnd )
|
||||
dolEnd = (u32)offset + len;
|
||||
|
||||
Remove_001_Protection(offset, len);
|
||||
}
|
||||
}
|
||||
if( PatchReturnTo( dolStart, dolEnd - dolStart , rtrn ) )
|
||||
gprintf("start: %08x\tend: %x\n", dolStart, dolEnd );
|
||||
if( PatchReturnTo( (u32*)dolStart, dolEnd - dolStart , rtrn ) )
|
||||
{
|
||||
//gprintf("return-to patched\n" );
|
||||
DCFlushRange( dolStart, dolEnd - dolStart );
|
||||
// gprintf("return-to patched\n" );
|
||||
DCFlushRange( (u32*)dolStart, dolEnd - dolStart );
|
||||
}
|
||||
free(dol_header);
|
||||
|
||||
|
@ -34,11 +34,6 @@ static u8 *appldr = (u8 *)0x81200000;
|
||||
static u32 buffer[0x20] ATTRIBUTE_ALIGN(32);
|
||||
struct SSettings Settings;
|
||||
|
||||
static void __noprint(const char *fmt, ...) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight || mode1->xfbHeight != mode2->xfbHeight ||
|
||||
mode1->viXOrigin != mode2->viXOrigin || mode1->viYOrigin != mode2->viYOrigin || mode1->viWidth != mode2->viWidth || mode1->viHeight != mode2->viHeight ||
|
||||
@ -360,7 +355,8 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
|
||||
|
||||
u32 appldr_len;
|
||||
s32 ret;
|
||||
gprintf("Apploader_Run() started\n");
|
||||
gprintf("Apploader_Run( %p, %d, %d, %d, %d, %d, %d, %d, %08x)\n", \
|
||||
entry, cheat, videoSelected, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset, rtrn);
|
||||
|
||||
//u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
|
||||
//if (geckoattached)usb_flush(EXI_CHANNEL_1);
|
||||
@ -412,17 +408,17 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
|
||||
if( !alternatedol )gamepatches(dst, len, videoSelected, patchcountrystring, vipatch, cheat);
|
||||
|
||||
DCFlushRange(dst, len);
|
||||
if( dst < dolStart )dolStart = dst;
|
||||
if( dst + len > dolEnd ) dolEnd = dst + len;
|
||||
if( (u32)dst < dolStart )dolStart = (u32)dst;
|
||||
if( (u32)dst + len > dolEnd ) dolEnd = (u32)dst + len;
|
||||
}
|
||||
|
||||
//this patch should be run on the entire dol at 1 time
|
||||
if( !alternatedol && rtrn)
|
||||
{
|
||||
if( PatchReturnTo( dolStart, dolEnd - dolStart , rtrn) )
|
||||
if( PatchReturnTo( (u32*)dolStart, dolEnd - dolStart , rtrn) )
|
||||
{
|
||||
//gprintf("return-to patched\n" );
|
||||
DCFlushRange( dolStart, dolEnd - dolStart );
|
||||
DCFlushRange( (u32*)dolStart, dolEnd - dolStart );
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +437,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
|
||||
DCFlushRange(dolbuffer, dollen);
|
||||
|
||||
gamepatches(dolbuffer, dollen, videoSelected, patchcountrystring, vipatch, cheat);
|
||||
if( PatchReturnTo( dolStart, dolEnd - dolStart , rtrn ) )
|
||||
if( PatchReturnTo( (u32*)dolStart, dolEnd - dolStart , rtrn ) )
|
||||
{
|
||||
//gprintf("return-to patched\n" );
|
||||
DCFlushRange(dolbuffer, dollen);
|
||||
|
Loading…
Reference in New Issue
Block a user