//functions for manipulating the HBC stub by giantpune #include #include #include #include #include "lstub.h" #include "stub_bin.h" #include "gecko.h" #define TITLE_1(x) ((u8)((x) >> 8)) #define TITLE_2(x) ((u8)((x) >> 16)) #define TITLE_3(x) ((u8)((x) >> 24)) #define TITLE_4(x) ((u8)((x) >> 32)) #define TITLE_5(x) ((u8)((x) >> 40)) #define TITLE_6(x) ((u8)((x) >> 48)) #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; u64 tid = 0; u64 *list; u32 titlecount; s32 ret; u32 i; ret = ES_GetNumTitles(&titlecount); if(ret < 0) return WII_EINTERNAL; list = memalign(32, titlecount * sizeof(u64) + 32); ret = ES_GetTitles(list, titlecount); if(ret < 0) { free(list); return WII_EINTERNAL; } for(i=0; i