-reverted some of miigotus experiments to fix IOS reload

-more intelligent IOS reload code (thanks davebaol)
This commit is contained in:
fix94.1 2012-01-22 17:06:56 +00:00
parent a8d3b2b900
commit adecc42f5c
3 changed files with 43 additions and 37 deletions

View File

@ -88,9 +88,9 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc
*entry = appldr_final();
IOSReloadBlock(IOS_GetVersion());
*(vu32 *)0x80003140 = *(vu32 *)0x80003188; // IOS Version Check
*(vu32 *)0x80003180 = *(vu32 *)0x80000000; // Game ID Online Check
*(vu32 *)0x80003184 = 0x80000000;
/* ERROR 002 fix (WiiPower) */
*(u32 *)0x80003140 = *(u32 *)0x80003188;
DCFlushRange((void*)0x80000000, 0x3f00);

View File

@ -44,27 +44,33 @@ extern void __exception_closeall();
static u8 Tmd_Buffer[0x49e4 + 0x1C] ALIGNED(32);
void __Disc_SetLowMem()
{
*(vu32 *)0x80000060 = 0x38A00040; // Dev Debugger Hook
/* Setup low memory */
*(vu32 *)0x80000060 = 0x38A00040;
*(vu32 *)0x800000E4 = 0x80431A80;
*(vu32 *)0x800000EC = 0x81800000; // Dev Debugger Monitor Address
*(vu32 *)0x800000F0 = 0x01800000; // Simulated Memory Size
*(vu32 *)0xCD00643C = 0x00000000; // 32Mhz on Bus
*Sys_Magic = 0x0d15ea5e;
*Version = 1;
*Arena_L = 0x00000000;
*BI2 = 0x817E5480;
*Bus_Speed = 0x0E7BE2C0;
*CPU_Speed = 0x2B73A840;
/* Copy disc ID (online check) */
memcpy((void *)0x80003180, (void *)0x80000000, 4);
*(vu32 *)0x800030F0 = 0x0000001C; // Dol Args
*(vu32 *)0x8000318C = 0x00000000; // Launch Code
*(vu32 *)0x80003190 = 0x00000000; // Return Code
// Patch in info missing from apploader reads
*Sys_Magic = 0x0d15ea5e;
*Version = 1;
*Arena_L = 0x00000000;
*BI2 = 0x817E5480;
*Bus_Speed = 0x0E7BE2C0;
*CPU_Speed = 0x2B73A840;
*(vu32 *)0x80003140 = *(vu32 *)0x80003188; // IOS Version Check
*(vu32 *)0x80003180 = *(vu32 *)0x80000000; // Game ID Online Check
// From NeoGamme R4 (WiiPower)
*(vu32 *)0x800030F0 = 0x0000001C;
*(vu32 *)0x8000318C = 0x00000000;
*(vu32 *)0x80003190 = 0x00000000;
// Fix for Sam & Max (WiiPower)
*(vu32 *)0x80003184 = 0x80000000;
/* Flush cache */

View File

@ -251,27 +251,27 @@ s32 IOSReloadBlock(u8 reqios)
s32 ESHandle = IOS_Open("/dev/es", 0);
if (ESHandle < 0)
{
gprintf("Reload IOS Block failed, cannot open /dev/es\n");
{
gprintf("Reload IOS Block failed, cannot open /dev/es\n");
return ESHandle;
}
}
static ioctlv vector[2] ATTRIBUTE_ALIGN(32);
static u32 mode[8] ATTRIBUTE_ALIGN(32);
static u32 ios[8] ATTRIBUTE_ALIGN(32);
static ioctlv vector[2] ATTRIBUTE_ALIGN(32);
static u32 mode ATTRIBUTE_ALIGN(32);
static u32 ios ATTRIBUTE_ALIGN(32);
mode[0] = 2;
vector[0].data = mode;
vector[0].len = 4;
mode = 2;
vector[0].data = &mode;
vector[0].len = sizeof(u32);
ios[0] = reqios;
vector[1].data = ios;
vector[1].len = 4;
ios = reqios;
vector[1].data = &ios;
vector[1].len = sizeof(u32);
s32 r = IOS_Ioctlv(ESHandle, 0xA0, 2, 0, vector);
gprintf("Enable/Disable Block IOS Reload for cIOS%uv%u %s\n", IOS_GetVersion(), IOS_GetRevision() % 100, r < 0 ? "FAILED!" : "SUCCEEDED!");
s32 r = IOS_Ioctlv(ESHandle, 0xA0, 2, 0, vector);
gprintf("Enable/Disable Block IOS Reload for cIOS%uv%u %s\n", IOS_GetVersion(), IOS_GetRevision() % 100, r < 0 ? "FAILED!" : "SUCCEEDED!");
IOS_Close(ESHandle);
IOS_Close(ESHandle);
return r;
return r;
}