-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) void Nand::SetPaths(const char *emuPath, const char *currentPart)
{ {
memset(&NandPath, 0, sizeof(NandPath)); /* emuPath should = /nands/nand_name */
for(u32 i = 0; emuPath[i] != '\0'; i++)
strncat(NandPath, &emuPath[i], 1);
/* Our WiiFlow handle Path */ /* set wiiflow full nand path */
memset(&FullNANDPath, 0, sizeof(FullNANDPath)); snprintf(FullNANDPath, sizeof(FullNANDPath), "%s:%s", currentPart, emuPath);
strcat(FullNANDPath, fmt("%s:%s", currentPart, NandPath));
gprintf("Emu NAND Full Path = %s\n", FullNANDPath); 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); 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); gprintf("Setting Wii games partition to: %i\n", partition);
/* Emu nands init even if not being used */ /* Emu nands init even if not being used */
memset(emu_nands_dir, 0, 64); memset(emu_nands_dir, 0, sizeof(emu_nands_dir));
strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64); strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", sizeof(emu_nands_dir) - 1);
_checkEmuNandSettings(); _checkEmuNandSettings();
CoverFlow.init(m_base_font, m_base_font_size, m_vid.vid_50hz()); CoverFlow.init(m_base_font, m_base_font_size, m_vid.vid_50hz());

View File

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

View File

@ -218,32 +218,17 @@ bool CMenu::_ExitTo(void)
} }
else if(m_btnMgr.selected(m_homeBtnExitToNeek)) 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")); Sys_SetNeekPath(NandHandle.Get_NandPath());
_showExitTo();
}
else
{
#ifdef APP_WIIFLOW
if(m_cfg.getBool("NEEK2O", "launchwiiflow", true))
exitHandler(EXIT_TO_WFNK2O);
else
#endif
exitHandler(EXIT_TO_SMNK2O); exitHandler(EXIT_TO_SMNK2O);
/* if exiting to Neek2o we must set the EmuNand Path for sys_exit() in sys.c */ break;
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();
else else
{ {
error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
_showExitTo(); _showExitTo();
} }
Sys_SetNeekPath(EmuNandPath);
}
break;
} }
} }
else if(BTN_HOME_PRESSED) else if(BTN_HOME_PRESSED)

View File

@ -239,16 +239,17 @@ void CMenu::_FullNandCheck(void)
int CMenu::_FindEmuPart(bool savesnand, bool skipchecks) int CMenu::_FindEmuPart(bool savesnand, bool skipchecks)
{ {
int emuPart; int emuPart;
char tmpPath[MAX_FAT_PATH]; char tmpPath[32];
tmpPath[31] = '\0';
if(savesnand) if(savesnand)
{ {
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); 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 else
{ {
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition"); 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 if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))//check if device is mounted and partition is FAT
return -1; return -1;