From aa5c1acba58919307aacbb0ed57506b27f24e68e Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Fri, 27 Jan 2012 11:43:31 +0000 Subject: [PATCH] -added option to disable IOS reload block for wii games and channels --- source/channel/channel_launcher.c | 7 ++++-- source/channel/channel_launcher.h | 2 +- source/channel/channels.cpp | 4 +-- source/channel/channels.h | 2 +- source/loader/disc.c | 11 +++++--- source/loader/disc.h | 4 +-- source/loader/patchcode.c | 42 ++++++++++++++++--------------- source/loader/patchcode.h | 2 +- source/menu/menu.hpp | 5 ++++ source/menu/menu_config_game.cpp | 29 +++++++++++++++++++++ source/menu/menu_game.cpp | 10 +++++--- 11 files changed, 81 insertions(+), 37 deletions(-) diff --git a/source/channel/channel_launcher.c b/source/channel/channel_launcher.c index 9c5b88fa..a4b6d0dc 100644 --- a/source/channel/channel_launcher.c +++ b/source/channel/channel_launcher.c @@ -37,7 +37,7 @@ typedef struct _dolheader{ u32 entryPoint; -s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode) +s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload) { u32 ios; Identify(chantitle, &ios); @@ -60,7 +60,10 @@ s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryS entrypoint appJump = (entrypoint)entryPoint; - IOSReloadBlock(IOS_GetVersion()); + if (disableIOSreload) + IOSReloadBlock(IOS_GetVersion(), false); + else + IOSReloadBlock(IOS_GetVersion(), true); /* Set an appropriate video mode */ __Disc_SetVMode(); diff --git a/source/channel/channel_launcher.h b/source/channel/channel_launcher.h index 98301dc6..7361bfde 100644 --- a/source/channel/channel_launcher.h +++ b/source/channel/channel_launcher.h @@ -8,7 +8,7 @@ extern "C" { #include #include -s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode); +s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload); u32 LoadChannel(u8 *buffer); void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes); diff --git a/source/channel/channels.cpp b/source/channel/channels.cpp index e7dd65b0..02196944 100644 --- a/source/channel/channels.cpp +++ b/source/channel/channels.cpp @@ -103,9 +103,9 @@ u8 Channels::GetRequestedIOS(u64 title) return IOS; } -bool Channels::Launch(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode) +bool Channels::Launch(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload) { - return BootChannel(data, chantitle, vidMode, vipatch, countryString, patchVidMode); + return BootChannel(data, chantitle, vidMode, vipatch, countryString, patchVidMode, disableIOSreload); } u64* Channels::GetChannelList(u32* count) diff --git a/source/channel/channels.h b/source/channel/channels.h index 14d86aaa..b5438a2c 100644 --- a/source/channel/channels.h +++ b/source/channel/channels.h @@ -56,7 +56,7 @@ class Channels u8 * Load(u64 title, char* id); u8 GetRequestedIOS(u64 title); - bool Launch(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode); + bool Launch(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload); int Count(); wchar_t *GetName(int index); diff --git a/source/loader/disc.c b/source/loader/disc.c index 364c3fcb..d9d1026b 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -339,11 +339,14 @@ s32 Disc_IsGC(void) return Disc_Type(1); } -s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode) +s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload) { entry_point p_entry; - IOSReloadBlock(IOS_GetVersion()); + if (disableIOSreload) + IOSReloadBlock(IOS_GetVersion(), false); + else + IOSReloadBlock(IOS_GetVersion(), true); s32 ret = WDVD_OpenPartition(offset, 0, 0, 0, Tmd_Buffer); if (ret < 0) return ret; @@ -422,7 +425,7 @@ s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString, return 0; } -s32 Disc_WiiBoot(u8 vidMode, bool vipatch, bool countryString, u8 patchVidModes) +s32 Disc_WiiBoot(u8 vidMode, bool vipatch, bool countryString, u8 patchVidModes, bool disableIOSreload) { u64 offset; @@ -431,5 +434,5 @@ s32 Disc_WiiBoot(u8 vidMode, bool vipatch, bool countryString, u8 patchVidModes) if (ret < 0) return ret; /* Boot partition */ - return Disc_BootPartition(offset, vidMode, vipatch, countryString, patchVidModes); + return Disc_BootPartition(offset, vidMode, vipatch, countryString, patchVidModes, disableIOSreload); } diff --git a/source/loader/disc.h b/source/loader/disc.h index a9481317..6610f8db 100644 --- a/source/loader/disc.h +++ b/source/loader/disc.h @@ -102,8 +102,8 @@ extern "C" { s32 Disc_Type(bool); s32 Disc_IsWii(void); s32 Disc_IsGC(void); - s32 Disc_BootPartition(u64, u8, bool, bool, u8); - s32 Disc_WiiBoot(u8, bool, bool, u8); + s32 Disc_BootPartition(u64, u8, bool, bool, u8, bool); + s32 Disc_WiiBoot(u8, bool, bool, u8, bool); #ifdef __cplusplus } diff --git a/source/loader/patchcode.c b/source/loader/patchcode.c index e35e14d9..b3d6b8ab 100644 --- a/source/loader/patchcode.c +++ b/source/loader/patchcode.c @@ -246,32 +246,34 @@ void vidolpatcher(void *addr, u32 len) } } -s32 IOSReloadBlock(u8 reqios) +s32 IOSReloadBlock(u8 reqios, bool enable) { - s32 ESHandle = IOS_Open("/dev/es", 0); + s32 ESHandle = IOS_Open("/dev/es", 0); - if (ESHandle < 0) - { - gprintf("Reload IOS Block failed, cannot open /dev/es\n"); - return ESHandle; - } + if (ESHandle < 0) + { + gprintf("Reload IOS Block failed, cannot open /dev/es\n"); + return ESHandle; + } - static ioctlv vector[2] ATTRIBUTE_ALIGN(32); - static u32 mode ATTRIBUTE_ALIGN(32); - static u32 ios ATTRIBUTE_ALIGN(32); + static ioctlv vector[2] ATTRIBUTE_ALIGN(32); + static u32 mode ATTRIBUTE_ALIGN(32); + static u32 ios ATTRIBUTE_ALIGN(32); - mode = 2; - vector[0].data = &mode; - vector[0].len = sizeof(u32); + mode = enable ? 2 : 0; + vector[0].data = &mode; + vector[0].len = sizeof(u32); - ios = reqios; - vector[1].data = &ios; - vector[1].len = sizeof(u32); + if (enable) { + 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; } \ No newline at end of file diff --git a/source/loader/patchcode.h b/source/loader/patchcode.h index 0131889b..fc63dcc1 100644 --- a/source/loader/patchcode.h +++ b/source/loader/patchcode.h @@ -33,7 +33,7 @@ u8 configbytes[2]; bool dogamehooks(void *addr, u32 len, bool channel); void langpatcher(void *addr, u32 len); void vidolpatcher(void *addr, u32 len); -s32 IOSReloadBlock(u8 reqios); +s32 IOSReloadBlock(u8 reqios, bool enable); #ifdef __cplusplus } diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 9b4bce53..aa5c8b5f 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -324,10 +324,15 @@ private: u32 m_gameSettingsLblVideo; u32 m_gameSettingsBtnVideoP; u32 m_gameSettingsBtnVideoM; + u32 m_gameSettingsLblDMLGameVideo; u32 m_gameSettingsLblDMLVideo; u32 m_gameSettingsBtnDMLVideoP; u32 m_gameSettingsBtnDMLVideoM; + + u32 m_gameSettingsLblIOSreloadBlock; + u32 m_gameSettingsBtnIOSreloadBlock; + u32 m_gameSettingsLblOcarina; u32 m_gameSettingsBtnOcarina; u32 m_gameSettingsLblVipatch; diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index 07dd397e..0c3ba7fa 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -36,6 +36,8 @@ void CMenu::_hideGameSettings(bool instant) m_btnMgr.hide(m_gameSettingsLblDMLVideo, instant); m_btnMgr.hide(m_gameSettingsBtnDMLVideoP, instant); m_btnMgr.hide(m_gameSettingsBtnDMLVideoM, instant); + m_btnMgr.hide(m_gameSettingsLblIOSreloadBlock, instant); + m_btnMgr.hide(m_gameSettingsBtnIOSreloadBlock, instant); m_btnMgr.hide(m_gameSettingsLblOcarina, instant); m_btnMgr.hide(m_gameSettingsBtnOcarina, instant); m_btnMgr.hide(m_gameSettingsLblCheat, instant); @@ -247,6 +249,12 @@ void CMenu::_showGameSettings(void) m_btnMgr.show(m_gameSettingsLblIOS); m_btnMgr.show(m_gameSettingsBtnIOSP); m_btnMgr.show(m_gameSettingsBtnIOSM); + + if (m_current_view != COVERFLOW_HOMEBREW) + { + m_btnMgr.show(m_gameSettingsLblIOSreloadBlock); + m_btnMgr.show(m_gameSettingsBtnIOSreloadBlock); + } } else { @@ -254,6 +262,9 @@ void CMenu::_showGameSettings(void) m_btnMgr.hide(m_gameSettingsLblIOS); m_btnMgr.hide(m_gameSettingsBtnIOSP); m_btnMgr.hide(m_gameSettingsBtnIOSM); + + m_btnMgr.hide(m_gameSettingsLblIOSreloadBlock); + m_btnMgr.hide(m_gameSettingsBtnIOSreloadBlock); } @@ -326,6 +337,7 @@ void CMenu::_showGameSettings(void) m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat"))); m_btnMgr.setText(m_gameSettingsBtnVipatch, _optBoolToString(m_gcfg2.getOptBool(id, "vipatch", 0))); m_btnMgr.setText(m_gameSettingsBtnCountryPatch, _optBoolToString(m_gcfg2.getOptBool(id, "country_patch", 0))); + m_btnMgr.setText(m_gameSettingsBtnIOSreloadBlock, _optBoolToString(m_gcfg2.getOptBool(id, "reload_block", 0))); i = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_videoModes) - 1u); m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_videoModes[i].id, CMenu::_videoModes[i].text)); i = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u); @@ -439,6 +451,15 @@ void CMenu::_gameSettings(void) m_gcfg2.setBool(id, "country_patch", true); _showGameSettings(); } + else if (m_btnMgr.selected(m_gameSettingsBtnIOSreloadBlock)) + { + bool booloption = m_gcfg2.getBool(id, "reload_block"); + if (booloption != false) + m_gcfg2.remove(id, "reload_block"); + else + m_gcfg2.setBool(id, "reload_block", true); + _showGameSettings(); + } else if (m_btnMgr.selected(m_gameSettingsBtnLanguageP) || m_btnMgr.selected(m_gameSettingsBtnLanguageM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnLanguageP) ? 1 : -1; @@ -564,6 +585,7 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme) _addUserLabels(theme, m_gameSettingsLblUser, ARRAY_SIZE(m_gameSettingsLblUser), "GAME_SETTINGS"); m_gameSettingsBg = _texture(theme.texSet, "GAME_SETTINGS/BG", "texture", theme.bg); m_gameSettingsLblTitle = _addLabel(theme, "GAME_SETTINGS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE); + // Page 1 m_gameSettingsLblCover = _addLabel(theme, "GAME_SETTINGS/COVER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsBtnCover = _addButton(theme, "GAME_SETTINGS/COVER_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor); @@ -599,6 +621,7 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme) m_gameSettingsBtnOcarina = _addButton(theme, "GAME_SETTINGS/OCARINA_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor); m_gameSettingsLblCheat = _addLabel(theme, "GAME_SETTINGS/CHEAT", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsBtnCheat = _addButton(theme, "GAME_SETTINGS/CHEAT_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor); + // Page 3 m_gameSettingsLblCountryPatch = _addLabel(theme, "GAME_SETTINGS/COUNTRY_PATCH", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsBtnCountryPatch = _addButton(theme, "GAME_SETTINGS/COUNTRY_PATCH_BTN", theme.btnFont, L"", 380, 130, 220, 56, theme.btnFontColor); @@ -620,6 +643,9 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme) m_gameSettingsBtnIOSM = _addPicButton(theme, "GAME_SETTINGS/IOS_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 380, 130, 56, 56); m_gameSettingsBtnIOSP = _addPicButton(theme, "GAME_SETTINGS/IOS_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56); + m_gameSettingsLblIOSreloadBlock = _addLabel(theme, "GAME_SETTINGS/IOS_RELOAD_BLOCK", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_gameSettingsBtnIOSreloadBlock = _addButton(theme, "GAME_SETTINGS/IOS_RELOAD_BLOCK_BTN", theme.btnFont, L"", 380, 190, 220, 56, theme.btnFontColor); + //Categories Page 1 //m_gameSettingsLblCategory[0] = _addLabel(theme, "GAME_SETTINGS/CAT_ALL", theme.lblFont, L"All", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); //m_gameSettingsBtnCategory[0] = _addButton(theme, "GAME_SETTINGS/CAT_ALL_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor); @@ -662,6 +688,8 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme) _setHideAnim(m_gameSettingsLblVideo, "GAME_SETTINGS/VIDEO_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnVideoM, "GAME_SETTINGS/VIDEO_MINUS", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnVideoP, "GAME_SETTINGS/VIDEO_PLUS", 200, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsLblIOSreloadBlock, "GAME_SETTINGS/IOS_RELOAD_BLOCK", -200, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsBtnIOSreloadBlock, "GAME_SETTINGS/IOS_RELOAD_BLOCK_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblDMLGameVideo, "GAME_SETTINGS/DML_VIDEO", -200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblDMLVideo, "GAME_SETTINGS/DML_VIDEO_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnDMLVideoM, "GAME_SETTINGS/DML_VIDEO_MINUS", 200, 0, 1.f, 0.f); @@ -726,6 +754,7 @@ void CMenu::_textGameSettings(void) m_btnMgr.setText(m_gameSettingsLblCountryPatch, _t("cfgg4", L"Patch country strings")); m_btnMgr.setText(m_gameSettingsLblOcarina, _t("cfgg5", L"Ocarina")); m_btnMgr.setText(m_gameSettingsLblDMLGameVideo, _t("cfgg2", L"Video mode")); + m_btnMgr.setText(m_gameSettingsLblIOSreloadBlock, (L"Disable IOS Reload block")); m_btnMgr.setText(m_gameSettingsLblVipatch, _t("cfgg7", L"Vipatch")); m_btnMgr.setText(m_gameSettingsBtnBack, _t("cfgg8", L"Back")); m_btnMgr.setText(m_gameSettingsLblGameIOS, _t("cfgg10", L"IOS")); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 1e080cbd..4f0f73f2 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -654,7 +654,8 @@ void CMenu::_launchChannel(dir_discHdr *hdr) int language = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); const char *rtrn = m_gcfg2.getBool(id, "returnto", true) ? m_cfg.getString("GENERAL", "returnto").c_str() : NULL; u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); - + bool disableIOSreload = m_gcfg2.testOptBool(id, "reload_block", m_cfg.getBool("GENERAL", "reload_block", false)); + int gameIOS = 0; if(!forwarder) @@ -799,7 +800,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) if (WII_LaunchTitle(hdr->hdr.chantitle) < 0) Sys_LoadMenu(); } - else if(!channel.Launch(data, hdr->hdr.chantitle, videoMode, vipatch, countryPatch, patchVidMode)) + else if(!channel.Launch(data, hdr->hdr.chantitle, videoMode, vipatch, countryPatch, patchVidMode, disableIOSreload)) Sys_LoadMenu(); } @@ -859,7 +860,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) u8 videoMode = (u8)min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_videoModes) - 1u); int language = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); const char *rtrn = m_gcfg2.getBool(id, "returnto", true) ? m_cfg.getString("GENERAL", "returnto").c_str() : NULL; - + bool disableIOSreload = m_gcfg2.testOptBool(id, "reload_block", m_cfg.getBool("GENERAL", "reload_block", false)); + int emuPartition = m_cfg.getInt("GAMES", "savepartition", -1); if(emuPartition == -1) emuPartition = m_cfg.getInt("NAND", "partition", -1); @@ -1057,7 +1059,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) else { gprintf("Booting game\n"); - if (Disc_WiiBoot(videoMode, vipatch, countryPatch, patchVidMode) < 0) + if (Disc_WiiBoot(videoMode, vipatch, countryPatch, patchVidMode, disableIOSreload) < 0) Sys_LoadMenu(); } }