-fixed the (yet again) broken shutdown/reset via the wii buttons

-safe reloading the IOS on bootup now (may takes a bit longer to boot)
This commit is contained in:
fix94.1 2013-01-27 13:42:54 +00:00
parent eb24ebf76f
commit ca8ceaeb44
4 changed files with 10 additions and 10 deletions

View File

@ -27,7 +27,6 @@ static inline bool apply_patch(char *name, const u8 *old, const u8 *patch, u32 s
ptr++;
}
IRQ_Restore(level);
usleep(1000);
gprintf("patched %s %u times.\n", name, found);
return (found > 0);
@ -46,9 +45,7 @@ static const u8 new_hash_patch[] = { 0x20, 0x00, 0x4B, 0x0B };
void PatchIOS(void)
{
/* Stop IOS from blocking shit */
__IOS_ShutdownSubsystems();
/* Disable memory protection */
__ES_Close();
write16(MEM_PROT, 0);
/* Do Patching */
apply_patch("isfs_permissions", isfs_perm_old, isfs_perm_patch, sizeof(isfs_perm_patch));
@ -56,8 +53,7 @@ void PatchIOS(void)
apply_patch("es_identify", es_identify_old, es_identify_patch, sizeof(es_identify_patch));
apply_patch("hash_check", hash_old, hash_patch, sizeof(hash_patch));
apply_patch("new_hash_check", new_hash_old, new_hash_patch, sizeof(new_hash_patch));
/* Enable memory protection */
/* Reinit */
write16(MEM_PROT, 1);
/* Restart our IOS stuff */
__IOS_InitializeSubsystems();
__ES_Init();
}

View File

@ -81,7 +81,8 @@ void Nand::Init()
bool Nand::LoadDefaultIOS(void)
{
Patch_AHB();
s32 ret = __IOS_LoadStartupIOS();
DeInit_ISFS();
s32 ret = IOS_ReloadIOS(IOS_GetPreferredVersion());
loadIOS(IOS_GetVersion(), false);
Init_ISFS();
return (ret == 0);

View File

@ -195,3 +195,6 @@ bool Sys_DolphinMode(void)
ModeChecked = true;
return DolphinMode;
}
/* KILL IT */
s32 __IOS_LoadStartupIOS() { return 0; }

View File

@ -72,8 +72,8 @@ int main(int argc, char **argv)
iosOK = loadIOS(IOS_GetVersion(), false);
else if(useMainIOS && CustomIOS(IOS_GetType(mainIOS))) /* Requested */
iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type);
else /* Keep our current IOS */
iosOK = loadIOS(IOS_GetVersion(), false);
else /* safe reload to preferred IOS */
iosOK = NandHandle.LoadDefaultIOS();
// Init
Sys_Init();