-since wiiflow (lite) can no longer work in neek2o mode i cleaned up the code for exit to Neek2o on the exit to menu.cpp

-also cleaned up the code for setting the current emu nand path.
This commit is contained in:
Fledge68 2018-11-09 16:09:07 -06:00
parent 056aa2735b
commit e133c49836
6 changed files with 24 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -1249,16 +1249,17 @@ u8 *Nand::GetTMD(u64 title, u32 *size)
void Nand::SetPaths(const char *emuPath, const char *currentPart)
{
memset(&NandPath, 0, sizeof(NandPath));
for(u32 i = 0; emuPath[i] != '\0'; i++)
strncat(NandPath, &emuPath[i], 1);
/* emuPath should = /nands/nand_name */
/* Our WiiFlow handle Path */
memset(&FullNANDPath, 0, sizeof(FullNANDPath));
strcat(FullNANDPath, fmt("%s:%s", currentPart, NandPath));
/* set wiiflow full nand path */
snprintf(FullNANDPath, sizeof(FullNANDPath), "%s:%s", currentPart, emuPath);
gprintf("Emu NAND Full Path = %s\n", FullNANDPath);
/* For d2x IOS Path */
if(strlen(NandPath) == 0) strcat(NandPath, "/");
/* set IOS compatible NAND Path */
strncpy(NandPath, emuPath, sizeof(NandPath));
NandPath[sizeof(NandPath) - 1] = '\0';
if(strlen(NandPath) == 0)
strcat(NandPath, "/");
gprintf("IOS Compatible NAND Path = %s\n", NandPath);
}

View File

@ -269,8 +269,8 @@ bool CMenu::init()
gprintf("Setting Wii games partition to: %i\n", partition);
/* Emu nands init even if not being used */
memset(emu_nands_dir, 0, 64);
strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64);
memset(emu_nands_dir, 0, sizeof(emu_nands_dir));
strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", sizeof(emu_nands_dir) - 1);
_checkEmuNandSettings();
CoverFlow.init(m_base_font, m_base_font_size, m_vid.vid_50hz());

View File

@ -145,7 +145,7 @@ private:
string m_helpDir;
/* NandEmulation */
char emu_nands_dir[64];
char emu_nands_dir[32];
string m_saveExtGameId;
bool m_forceext;
bool m_emuSaveNand;

View File

@ -218,32 +218,17 @@ bool CMenu::_ExitTo(void)
}
else if(m_btnMgr.selected(m_homeBtnExitToNeek))
{
if(!Load_Neek2o_Kernel())
if(Load_Neek2o_Kernel() && _FindEmuPart(EMU_NAND, false) >= 0)// make sure neek2o and emunand exists
{
error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
_showExitTo();
}
else
{
#ifdef APP_WIIFLOW
if(m_cfg.getBool("NEEK2O", "launchwiiflow", true))
exitHandler(EXIT_TO_WFNK2O);
else
#endif
Sys_SetNeekPath(NandHandle.Get_NandPath());
exitHandler(EXIT_TO_SMNK2O);
/* if exiting to Neek2o we must set the EmuNand Path for sys_exit() in sys.c */
const char *EmuNandPath = NULL;
/* but only if we are not already in neek2o mode */
if(_FindEmuPart(EMU_NAND, false) >= 0)// make sure emunand exists
EmuNandPath = NandHandle.Get_NandPath();
break;
}
else
{
error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
_showExitTo();
}
Sys_SetNeekPath(EmuNandPath);
}
break;
}
}
else if(BTN_HOME_PRESSED)

View File

@ -239,16 +239,17 @@ void CMenu::_FullNandCheck(void)
int CMenu::_FindEmuPart(bool savesnand, bool skipchecks)
{
int emuPart;
char tmpPath[MAX_FAT_PATH];
char tmpPath[32];
tmpPath[31] = '\0';
if(savesnand)
{
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition");
snprintf(tmpPath, sizeof(tmpPath), "/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str());
strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()), sizeof(tmpPath));
}
else
{
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
snprintf(tmpPath, sizeof(tmpPath), "/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str());
strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_emunand").c_str()), sizeof(tmpPath));
}
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))//check if device is mounted and partition is FAT
return -1;