From ca8ceaeb447b0953b224c79e092cf15d12ee47a9 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sun, 27 Jan 2013 13:42:54 +0000 Subject: [PATCH] -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) --- source/channel/identify.c | 10 +++------- source/channel/nand.cpp | 3 ++- source/loader/sys.c | 3 +++ source/main.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/channel/identify.c b/source/channel/identify.c index 7a46192c..a384e9fe 100644 --- a/source/channel/identify.c +++ b/source/channel/identify.c @@ -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(); } diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index eb5becf5..d9424458 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -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); diff --git a/source/loader/sys.c b/source/loader/sys.c index 1eb78a49..cda56750 100644 --- a/source/loader/sys.c +++ b/source/loader/sys.c @@ -195,3 +195,6 @@ bool Sys_DolphinMode(void) ModeChecked = true; return DolphinMode; } + +/* KILL IT */ +s32 __IOS_LoadStartupIOS() { return 0; } diff --git a/source/main.cpp b/source/main.cpp index c7dff403..957edf32 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -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();