-fixed boot of some wii games like brawl

This commit is contained in:
fix94.1 2012-10-20 15:43:48 +00:00
parent 600437dedf
commit 1fc6250f04
4 changed files with 100 additions and 86 deletions

View File

@ -27,13 +27,28 @@ s32 Disc_Open()
return ret;
}
void Disc_SetLowMemPre()
{
/* Setup low memory before Apploader */
*BI2 = 0x817E5480; // BI2
*(vu32*)0xCD00643C = 0x00000000; // 32Mhz on Bus
/* Clear Disc ID */
memset((u8*)Disc_ID, 0, 32);
/* For WiiRD */
memset((void*)0x80001800, 0, 0x1800);
/* Flush everything */
DCFlushRange((void*)0x80000000, 0x3f00);
}
void Disc_SetLowMem(u32 IOS)
{
/* Setup low memory */
*Sys_Magic = 0x0D15EA5E; // Standard Boot Code
*Sys_Version = 0x00000001; // Version
*Arena_L = 0x00000000; // Arena Low
*BI2 = 0x817E5480; // BI2
*Bus_Speed = 0x0E7BE2C0; // Console Bus Speed
*CPU_Speed = 0x2B73A840; // Console CPU Speed
*Assembler = 0x38A00040; // Assembler
@ -41,11 +56,13 @@ void Disc_SetLowMem(u32 IOS)
*Dev_Debugger = 0x81800000; // Dev Debugger Monitor Address
*Simulated_Mem = 0x01800000; // Simulated Memory Size
*GameID_Address = 0x80000000; // Fix for Sam & Max (WiiPower)
*(vu32*)0xCD00643C = 0x00000000; // 32Mhz on Bus
/* Copy disc ID */
/* Copy Disc ID */
memcpy((void*)Online_Check, (void*)Disc_ID, 4);
/* For WiiRD */
memcpy((void*)0x80001800, (void*)Disc_ID, 8);
/* Error 002 Fix (thanks WiiPower and uLoader) */
*Current_IOS = (IOS << 16) | 0xffff;
*Apploader_IOS = (IOS << 16) | 0xffff;

View File

@ -9,6 +9,7 @@ extern "C" {
s32 Disc_Open();
s32 Disc_FindPartition(u32 *outbuf);
s32 Disc_SetUSB(const u8 *id, bool frag);
void Disc_SetLowMemPre();
void Disc_SetLowMem(u32 IOS);
void Disc_SetTime();

View File

@ -139,8 +139,6 @@ void app_pokevalues()
}
void load_handler()
{
if (hooktype != 0x00)
{
if(debuggerselect == 0x01)
{
@ -154,7 +152,7 @@ void load_handler()
memcpy((void*)0x80001F5A, &codelist, 2);
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
DCFlushRange((void*)0x80001800,codehandler_size);
ICInvalidateRange((void*)0x80001000,codehandler_size);
ICInvalidateRange((void*)0x80001800,codehandler_size);
}
else
{
@ -164,8 +162,9 @@ void load_handler()
memcpy((void*)0x80001906, &codelist, 2);
memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
DCFlushRange((void*)0x80001800,codehandleronly_size);
ICInvalidateRange((void*)0x80001000,codehandleronly_size);
ICInvalidateRange((void*)0x80001800,codehandleronly_size);
}
// Load multidol handler
memset((void*)0x80001000,0,multidol_size);
memcpy((void*)0x80001000,multidol,multidol_size);
@ -219,16 +218,11 @@ void load_handler()
}
DCFlushRange((void*)0x80001198,16);
}
}
int ocarina_do_code()
{
//if (!code_buf) return 0; // Need the handler loaded for hooking other than cheats!
memset((void*)0x80001800, 0, 0x1800);
load_handler();
memcpy((void*)0x80001800, (void*)Disc_ID, 8);
DCFlushRange((void*)0x80001800, 0x1800);
if(codelist)
memset(codelist, 0, (u32)codelistend - (u32)codelist);

View File

@ -79,7 +79,9 @@ int main()
}
prog10();
memset((u8*)Disc_ID, 0, 32);
/* Setup Low Memory */
Disc_SetLowMemPre();
if(normalCFG.BootType == TYPE_WII_GAME)
{
WDVD_Init();