-fixed emu nand was not enabled in all cases now, also removed

unneeded debug messages and only enable/disable emu if needed
This commit is contained in:
fix94.1 2012-06-21 14:53:20 +00:00
parent 757fb1e80c
commit 7847704025
3 changed files with 15 additions and 22 deletions

View File

@ -49,6 +49,7 @@ config_header *cfg_hdr;
bool tbdec = false; bool tbdec = false;
bool configloaded = false; bool configloaded = false;
bool emu_enabled = false;
static NandDevice NandDeviceList[] = static NandDevice NandDeviceList[] =
{ {
@ -86,10 +87,7 @@ s32 Nand::Nand_Mount(NandDevice *Device)
s32 fd = IOS_Open("fat", 0); s32 fd = IOS_Open("fat", 0);
if(fd < 0) if(fd < 0)
{
gprintf("Mount Fail 1\n");
return fd; return fd;
}
static ioctlv vector[1] ATTRIBUTE_ALIGN(32); static ioctlv vector[1] ATTRIBUTE_ALIGN(32);
@ -141,7 +139,8 @@ s32 Nand::Nand_Disable(void)
{ {
gprintf("Disabling NAND Emulator\n"); gprintf("Disabling NAND Emulator\n");
s32 fd = IOS_Open("/dev/fs", 0); s32 fd = IOS_Open("/dev/fs", 0);
if (fd < 0) return fd; if(fd < 0)
return fd;
u32 inbuf ATTRIBUTE_ALIGN(32) = 0; u32 inbuf ATTRIBUTE_ALIGN(32) = 0;
s32 ret = IOS_Ioctl(fd, 100, &inbuf, sizeof(inbuf), NULL, 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() s32 Nand::Enable_Emu()
{ {
Disable_Emu(); if(emu_enabled)
return 0;
NandDevice *Device = &NandDeviceList[EmuDevice]; NandDevice *Device = &NandDeviceList[EmuDevice];
s32 ret = Nand_Mount(Device); s32 ret = Nand_Mount(Device);
if(ret < 0) if(ret < 0)
{
gprintf("Fail 2\n");
return ret; return ret;
}
ret = Nand_Enable(Device); ret = Nand_Enable(Device);
if(ret < 0) if(ret < 0)
{
gprintf("Fail 3\n");
return ret; return ret;
}
MountedDevice = EmuDevice; MountedDevice = EmuDevice;
emu_enabled = true;
return 0; return 0;
} }
s32 Nand::Disable_Emu() s32 Nand::Disable_Emu()
{ {
if(MountedDevice == 0) if(MountedDevice == 0 || !emu_enabled)
return 0; return 0;
NandDevice * Device = &NandDeviceList[MountedDevice]; NandDevice * Device = &NandDeviceList[MountedDevice];
@ -187,6 +182,7 @@ s32 Nand::Disable_Emu()
MountedDevice = 0; MountedDevice = 0;
emu_enabled = false;
return 0; return 0;
} }

View File

@ -178,12 +178,8 @@ void CMenu::_textAbout(void)
); );
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS); iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS);
if(iosInfo != NULL) if(iosInfo != NULL)
m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), mainIOS, iosInfo->baseios, iosInfo->version), true); m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), mainIOS, iosInfo->baseios, iosInfo->version), true);
MEM2_free(iosInfo); MEM2_free(iosInfo);
if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0))
Nand::Instance()->Enable_Emu();
} }

View File

@ -157,7 +157,6 @@ void CMenu::_showMain(void)
_hideMain(); _hideMain();
if(!_AutoCreateNand()) if(!_AutoCreateNand())
m_cfg.setBool("NAND", "disable", true); m_cfg.setBool("NAND", "disable", true);
_loadList(); _loadList();
_showMain(); _showMain();
_initCF(); _initCF();
@ -175,6 +174,8 @@ void CMenu::_showMain(void)
break; break;
} }
} }
else if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true))
Nand::Instance()->Enable_Emu();
} }
int CMenu::GetCoverStatusAsync(CMenu *m) int CMenu::GetCoverStatusAsync(CMenu *m)