-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 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;
}

View File

@ -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();
}

View File

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