mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
updated lstub to work with newer HBC stub ( fixes "return to loader" )
This commit is contained in:
parent
ba5e1f2c37
commit
5bc9cee195
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>1.0 r940</version>
|
||||
<release_date>201009151816</release_date>
|
||||
<version>1.0 r941</version>
|
||||
<release_date>201009160837</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.
|
||||
|
@ -23,7 +23,8 @@ void gprintf( const char *str, ... )
|
||||
|
||||
va_end(ap);
|
||||
|
||||
usb_sendbuffer( 1, astr, strlen(astr) );
|
||||
//usb_sendbuffer( 1, astr, strlen(astr) );
|
||||
usb_sendbuffer_safe( 1, astr, strlen(astr) );
|
||||
}
|
||||
|
||||
bool InitGecko()
|
||||
@ -37,5 +38,43 @@ bool InitGecko()
|
||||
else return false;
|
||||
}
|
||||
|
||||
static char ascii(char s)
|
||||
{
|
||||
if(s < 0x20)
|
||||
return '.';
|
||||
if(s > 0x7E)
|
||||
return '.';
|
||||
return s;
|
||||
}
|
||||
|
||||
void hexdump(void *d, int len)
|
||||
{
|
||||
u8 *data;
|
||||
int i, off;
|
||||
data = (u8*)d;
|
||||
|
||||
gprintf("\n 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF");
|
||||
gprintf("\n==== =============================================== ================\n");
|
||||
|
||||
for (off=0; off<len; off += 16)
|
||||
{
|
||||
gprintf("%04x ",off);
|
||||
for(i=0; i<16; i++)
|
||||
if((i+off)>=len)
|
||||
gprintf(" ");
|
||||
else
|
||||
gprintf("%02x ",data[off+i]);
|
||||
|
||||
gprintf(" ");
|
||||
for(i=0; i<16; i++)
|
||||
if((i+off)>=len)
|
||||
gprintf(" ");
|
||||
else
|
||||
gprintf("%c",ascii(data[off+i]));
|
||||
gprintf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* NO_DEBUG */
|
||||
|
@ -11,9 +11,11 @@ extern "C" {
|
||||
//use this just like printf();
|
||||
void gprintf(const char *str, ...);
|
||||
bool InitGecko();
|
||||
void hexdump(void *d, int len);
|
||||
#else
|
||||
#define gprintf(...)
|
||||
#define InitGecko() false
|
||||
#define hexdump( x, y )
|
||||
#endif /* NO_DEBUG */
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "lstub.h"
|
||||
#include "stub_bin.h"
|
||||
#include "gecko.h"
|
||||
|
||||
#define TITLE_1(x) ((u8)((x) >> 8))
|
||||
#define TITLE_2(x) ((u8)((x) >> 16))
|
||||
@ -18,6 +19,23 @@
|
||||
#define TITLE_7(x) ((u8)((x) >> 56))
|
||||
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
|
||||
|
||||
static char* determineStubTIDLocation()
|
||||
{
|
||||
u32 *stubID = (u32*)0x80001818;
|
||||
|
||||
//HBC stub 1.0.6 and lower, and stub.bin
|
||||
if( stubID[ 0 ] == 0x480004c1 && stubID[ 1 ] == 0x480004f5 )
|
||||
return (char *)0x800024C6;
|
||||
|
||||
//HBC stub changed @ version 1.0.7. this file was last updated for HBC 1.0.8
|
||||
else if ( stubID[ 0 ] == 0x48000859 && stubID[ 1 ] == 0x4800088d )
|
||||
return (char *)0x8000286A;
|
||||
|
||||
//hexdump( stubID, 0x20 );
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
s32 Set_Stub(u64 reqID)
|
||||
{
|
||||
u32 tmdsize;
|
||||
@ -54,7 +72,9 @@ s32 Set_Stub(u64 reqID)
|
||||
if(ES_GetStoredTMDSize(tid, &tmdsize) < 0)
|
||||
return WII_EINSTALL;
|
||||
|
||||
char *stub = (char *)0x800024C6;
|
||||
char *stub = determineStubTIDLocation();
|
||||
if( !stub )
|
||||
return -68;
|
||||
|
||||
stub[0] = TITLE_7(reqID);
|
||||
stub[1] = TITLE_6(reqID);
|
||||
@ -64,6 +84,8 @@ s32 Set_Stub(u64 reqID)
|
||||
stub[5] = TITLE_2(reqID);
|
||||
stub[12] = TITLE_1(reqID);
|
||||
stub[13] = ((u8)(reqID));
|
||||
|
||||
DCFlushRange( stub, 0x10 );
|
||||
|
||||
return 1;
|
||||
|
||||
@ -84,6 +106,7 @@ void loadStub()
|
||||
{
|
||||
char *stubLoc = (char *)0x80001800;
|
||||
memcpy(stubLoc, stub_bin, stub_bin_size);
|
||||
DCFlushRange( stubLoc, stub_bin_size );
|
||||
}
|
||||
|
||||
u64 getStubDest()
|
||||
@ -91,10 +114,13 @@ u64 getStubDest()
|
||||
if (!hbcStubAvailable())
|
||||
return 0;
|
||||
|
||||
char ret[ 8 ];
|
||||
u64 retu = 0;
|
||||
|
||||
char *stub = determineStubTIDLocation();
|
||||
if( !stub )
|
||||
return 0;
|
||||
|
||||
char *stub = (char *)0x800024C6;
|
||||
char ret[9];
|
||||
u64 retu =0;
|
||||
|
||||
ret[0] = stub[0];
|
||||
ret[1] = stub[1];
|
||||
|
Loading…
Reference in New Issue
Block a user