From dc5bff23d8f1fe6ad592d08b3baab14524914470 Mon Sep 17 00:00:00 2001 From: dborth Date: Sat, 18 Dec 2010 16:05:06 +0000 Subject: [PATCH] add IOS whitelist, reload if found. display warning if not. --- source/menu.cpp | 11 +++++++++-- source/vbagx.cpp | 21 +++++++++++++++++++-- source/vbagx.h | 3 ++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index 30066b4..41e55b9 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -4311,8 +4311,15 @@ MainMenu (int menu) #ifdef HW_RVL static bool checkIOS = true; - if(checkIOS && !SaneIOS()) - ErrorPrompt("The current IOS has been altered (fake-signed). Functionality and/or stability may be adversely affected."); + if(checkIOS) + { + u32 ios = IOS_GetVersion(); + + if(!SupportedIOS(ios)) + ErrorPrompt("The current IOS is unsupported. Functionality and/or stability may be adversely affected."); + else if(!SaneIOS(ios)) + ErrorPrompt("The current IOS has been altered (fake-signed). Functionality and/or stability may be adversely affected."); + } checkIOS = false; #endif diff --git a/source/vbagx.cpp b/source/vbagx.cpp index 9302792..01b753c 100644 --- a/source/vbagx.cpp +++ b/source/vbagx.cpp @@ -175,12 +175,19 @@ static void ipl_set_config(unsigned char c) * IOS Check ***************************************************************************/ #ifdef HW_RVL -bool SaneIOS() +bool SupportedIOS(u32 ios) +{ + if(ios == 58 || ios == 61) + return true; + + return false; +} + +bool SaneIOS(u32 ios) { bool res = false; u32 num_titles=0; u32 tmd_size; - u32 ios = IOS_GetVersion(); if(ios > 200) return false; @@ -296,6 +303,16 @@ void USBGeckoOutput() ****************************************************************************/ int main(int argc, char *argv[]) { + u32 ios = IOS_GetVersion(); + + if(!SupportedIOS(ios)) + { + s32 preferred = IOS_GetPreferredVersion(); + + if(SupportedIOS(preferred)) + IOS_ReloadIOS(preferred); + } + //USBGeckoOutput(); // uncomment to enable USB gecko output __exception_setreload(8); diff --git a/source/vbagx.h b/source/vbagx.h index 46537fe..888527d 100644 --- a/source/vbagx.h +++ b/source/vbagx.h @@ -93,7 +93,8 @@ struct SGCSettings{ void ExitApp(); void ShutdownWii(); -bool SaneIOS(); +bool SupportedIOS(u32 ios); +bool SaneIOS(u32 ios); extern struct SGCSettings GCSettings; extern int ScreenshotRequested; extern int ConfigRequested;