From 7847704025878b4bfcae73d7d24e2e426d68a5f0 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Thu, 21 Jun 2012 14:53:20 +0000 Subject: [PATCH] -fixed emu nand was not enabled in all cases now, also removed unneeded debug messages and only enable/disable emu if needed --- source/channel/nand.cpp | 20 ++++++++------------ source/menu/menu_about.cpp | 4 ---- source/menu/menu_main.cpp | 13 +++++++------ 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index d2090cfa..ee179336 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -49,6 +49,7 @@ config_header *cfg_hdr; bool tbdec = false; bool configloaded = false; +bool emu_enabled = false; static NandDevice NandDeviceList[] = { @@ -86,10 +87,7 @@ s32 Nand::Nand_Mount(NandDevice *Device) s32 fd = IOS_Open("fat", 0); if(fd < 0) - { - gprintf("Mount Fail 1\n"); return fd; - } static ioctlv vector[1] ATTRIBUTE_ALIGN(32); @@ -141,7 +139,8 @@ s32 Nand::Nand_Disable(void) { gprintf("Disabling NAND Emulator\n"); s32 fd = IOS_Open("/dev/fs", 0); - if (fd < 0) return fd; + if(fd < 0) + return fd; u32 inbuf ATTRIBUTE_ALIGN(32) = 0; s32 ret = IOS_Ioctl(fd, 100, &inbuf, sizeof(inbuf), NULL, 0); @@ -152,32 +151,28 @@ s32 Nand::Nand_Disable(void) s32 Nand::Enable_Emu() { - Disable_Emu(); + if(emu_enabled) + return 0; NandDevice *Device = &NandDeviceList[EmuDevice]; s32 ret = Nand_Mount(Device); if(ret < 0) - { - gprintf("Fail 2\n"); return ret; - } ret = Nand_Enable(Device); if(ret < 0) - { - gprintf("Fail 3\n"); return ret; - } MountedDevice = EmuDevice; + emu_enabled = true; return 0; } s32 Nand::Disable_Emu() { - if(MountedDevice == 0) + if(MountedDevice == 0 || !emu_enabled) return 0; NandDevice * Device = &NandDeviceList[MountedDevice]; @@ -187,6 +182,7 @@ s32 Nand::Disable_Emu() MountedDevice = 0; + emu_enabled = false; return 0; } diff --git a/source/menu/menu_about.cpp b/source/menu/menu_about.cpp index 45ba55af..c1299dbc 100644 --- a/source/menu/menu_about.cpp +++ b/source/menu/menu_about.cpp @@ -178,12 +178,8 @@ void CMenu::_textAbout(void) ); Nand::Instance()->Disable_Emu(); - iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS); if(iosInfo != NULL) m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), mainIOS, iosInfo->baseios, iosInfo->version), true); MEM2_free(iosInfo); - - if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0)) - Nand::Instance()->Enable_Emu(); } diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index aad04983..00f613cb 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -139,7 +139,7 @@ void CMenu::_showMain(void) if (m_mainLblUser[i] != -1u) m_btnMgr.show(m_mainLblUser[i]); - if (m_gameList.empty()) + if(m_gameList.empty()) { switch(m_current_view) { @@ -149,7 +149,7 @@ void CMenu::_showMain(void) m_btnMgr.show(m_mainBtnInit); m_btnMgr.show(m_mainBtnInit2); m_btnMgr.show(m_mainLblInit); - break; + break; case COVERFLOW_CHANNEL: if(!m_cfg.getBool("NAND", "disable", true)) { @@ -157,24 +157,25 @@ void CMenu::_showMain(void) _hideMain(); if(!_AutoCreateNand()) m_cfg.setBool("NAND", "disable", true); - _loadList(); _showMain(); _initCF(); } - break; + break; case COVERFLOW_HOMEBREW: m_btnMgr.setText(m_mainLblInit, _t("main4", L"Welcome to WiiFlow. I have not found any homebrew apps. Select partition to select your partition type."), true); m_btnMgr.show(m_mainBtnInit2); m_btnMgr.show(m_mainLblInit); - break; + break; case COVERFLOW_EMU: m_btnMgr.setText(m_mainLblInit, _t("main5", L"Welcome to WiiFlow. I have not found any plugins. Select partition to select your partition type."), true); m_btnMgr.show(m_mainBtnInit2); m_btnMgr.show(m_mainLblInit); - break; + break; } } + else if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true)) + Nand::Instance()->Enable_Emu(); } int CMenu::GetCoverStatusAsync(CMenu *m)