mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 19:01:56 +01:00
-okay fried my brain on trying to follow all this checking emunand partitions and paths and extracting etc... for emunand and emunand saves
-cleaned up some code for emunand list and when using emunand for wii saves. might be a problem here or there but need to take a break and come back to this later. should work for now.
This commit is contained in:
parent
ac4012e708
commit
eff9f721e5
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
@ -225,16 +225,7 @@ void CMenu::init()
|
||||
if(strncmp(gc_games_dir, "%s:/", 4) != 0)
|
||||
strcpy(gc_games_dir, DF_GC_GAMES_DIR);
|
||||
gprintf("GameCube Games Directory: %s\n", gc_games_dir);
|
||||
/* Create CHANNEL keys and set default values if key didn't exist */
|
||||
int i;
|
||||
i = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
|
||||
if(i < 0 || i > 1)
|
||||
m_cfg.setInt(CHANNEL_DOMAIN, "partition", 0);
|
||||
i = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
|
||||
if(i < 0 || i > 1)
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
|
||||
m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
|
||||
m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false);//emu_nand
|
||||
|
||||
/* Load cIOS Map */
|
||||
_installed_cios.clear();
|
||||
if(!neek2o() && !Sys_DolphinMode())
|
||||
@ -2116,8 +2107,8 @@ bool CMenu::_loadChannelList(void)
|
||||
if(NANDemuView)
|
||||
{
|
||||
emuPartition = _FindEmuPart(emuPath, false);//check if exist & has sysconf, settings.txt, & RFL_DB.dat
|
||||
if(emuPartition < 0)
|
||||
emuPartition = _FindEmuPart(emuPath, true);//check if exist without those files
|
||||
//if(emuPartition < 0)
|
||||
//emuPartition = _FindEmuPart(emuPath, true);//check if exist without those files
|
||||
if(emuPartition < 0)
|
||||
return false;// emu nand not found - menu_main will ask user to extract nand, disable emunand, or change partition
|
||||
/* copy real NAND sysconf, settings.txt, & RFL_DB.dat if you want to, they are replaced if they already exist */
|
||||
|
@ -1307,61 +1307,65 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
|
||||
u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
|
||||
if(emulate_mode == 0)// default then use global
|
||||
{
|
||||
emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
|
||||
if(emulate_mode != 0)//not off
|
||||
emulate_mode++;//then increase 1,2,3 to 2,3,4
|
||||
}
|
||||
else if(emulate_mode == 1)//equals off
|
||||
emulate_mode = 0;// then off
|
||||
m_current_view = COVERFLOW_WII; // used for _FindEmuPart()
|
||||
else
|
||||
emulate_mode--;
|
||||
|
||||
m_current_view = COVERFLOW_WII; //set this in case of multisource mode
|
||||
if(emulate_mode && !dvd && !neek2o())
|
||||
{
|
||||
emuPartition = _FindEmuPart(emuPath, false);
|
||||
if(emuPartition < 0)
|
||||
if(emuPartition < 0)//if savepartition and/or nand folder no good
|
||||
{
|
||||
if(emulate_mode == 4)//full
|
||||
_hideWaitMessage();
|
||||
while(true)
|
||||
{
|
||||
_hideWaitMessage();
|
||||
while(true)
|
||||
if(!_AutoCreateNand())//change partition, extract nand, or disable emunand save
|
||||
{//if disable
|
||||
emulate_mode = 0;
|
||||
m_gcfg2.setInt(id, "emulate_save", 1);
|
||||
break;
|
||||
}
|
||||
if(emulate_mode == 3)//full
|
||||
{
|
||||
_AutoCreateNand();
|
||||
if(_TestEmuNand(m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)), emuPath.c_str(), true))
|
||||
if(_TestEmuNand(m_cfg.getInt(WII_DOMAIN, "savepartition"), emuPath.c_str(), true))
|
||||
{
|
||||
emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
|
||||
emuPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand", m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default")).c_str());
|
||||
emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition");
|
||||
break;
|
||||
}
|
||||
}
|
||||
_showWaitMessage();
|
||||
}
|
||||
else//gamesave or regionswitch
|
||||
{
|
||||
emuPartition = _FindEmuPart(emuPath, true);
|
||||
NandHandle.CreatePath(fmt("%s:/%s", DeviceName[emuPartition], EMU_NANDS_DIR));
|
||||
NandHandle.CreatePath(fmt("%s:/%s/default", DeviceName[emuPartition], EMU_NANDS_DIR));
|
||||
else//gamesave or regionswitch
|
||||
{
|
||||
if(!_TestEmuNand(emuPartition, emuPath.c_str(), false))
|
||||
{
|
||||
NandHandle.CreatePath(fmt("%s:/%s", DeviceName[emuPartition], EMU_NANDS_DIR));
|
||||
NandHandle.CreatePath(fmt("%s:/%s/%s", DeviceName[emuPartition], EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition);
|
||||
_showWaitMessage();
|
||||
}
|
||||
/* Set them */
|
||||
NANDemuView = true;
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition);
|
||||
m_cfg.setString(WII_DOMAIN, "current_save_emunand", "default");
|
||||
if(emulate_mode == 2)//gamesave
|
||||
if(emulate_mode == 1)//gamesave
|
||||
{
|
||||
m_forceext = false;
|
||||
_hideWaitMessage();
|
||||
if(!_AutoExtractSave(id))//extract gamesave
|
||||
NandHandle.CreateTitleTMD(hdr);//if no save then create one
|
||||
/*_AutoExtractSave(id) returns true if
|
||||
if save is not on real nand (nothing to extract)
|
||||
if the save is already on emu nand (then no extraction)
|
||||
if the save was successfully extracted
|
||||
false if user chooses to have game create new save*/
|
||||
if(!_AutoExtractSave(id))
|
||||
NandHandle.CreateTitleTMD(hdr);//setup emu nand for gamesave
|
||||
_showWaitMessage();
|
||||
}
|
||||
else if(emulate_mode > 2)//region switch or full
|
||||
else if(emulate_mode > 1)//region switch or full
|
||||
{
|
||||
NandHandle.CreateConfig();
|
||||
NandHandle.Do_Region_Change(id, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
emulate_mode = 0;
|
||||
|
||||
bool use_led = m_gcfg2.getBool(id, "led", false);
|
||||
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
|
||||
@ -1405,7 +1409,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
|
||||
|
||||
bool patchregion = false;
|
||||
if(emulate_mode <= 2 && !neek2o() && m_cfg.getBool("GENERAL", "tempregionrn", false))
|
||||
if(emulate_mode <= 1 && !neek2o() && m_cfg.getBool("GENERAL", "tempregionrn", false))
|
||||
{
|
||||
gprintf("Check\n");
|
||||
patchregion = NandHandle.Do_Region_Change(id, true);
|
||||
@ -1426,9 +1430,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
{
|
||||
/* Enable our Emu NAND */
|
||||
DeviceHandle.UnMountAll();
|
||||
if(emulate_mode == 3)
|
||||
if(emulate_mode == 2)
|
||||
NandHandle.Set_RCMode(true);
|
||||
else if(emulate_mode == 4)
|
||||
else if(emulate_mode == 3)
|
||||
NandHandle.Set_FullMode(true);
|
||||
else
|
||||
NandHandle.Set_FullMode(false);
|
||||
|
@ -547,10 +547,10 @@ int CMenu::_AutoExtractSave(string gameId)
|
||||
int emuPartition = _FindEmuPart(emuPath, false);
|
||||
if(emuPartition < 0)
|
||||
emuPartition = _FindEmuPart(emuPath, true);
|
||||
if(!_checkSave(gameId, true))
|
||||
if(!_checkSave(gameId, true))//if save not on real nand
|
||||
return 1;
|
||||
|
||||
if(!m_forceext && _checkSave(gameId, false))
|
||||
if(!m_forceext && _checkSave(gameId, false))//if not force extract and save is already on emunand
|
||||
return 1;
|
||||
|
||||
lwp_t thread = 0;
|
||||
@ -597,7 +597,7 @@ int CMenu::_AutoExtractSave(string gameId)
|
||||
m_thrdWorking = true;
|
||||
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40);
|
||||
}
|
||||
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnDisable)))
|
||||
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnDisable)))//create new save
|
||||
{
|
||||
char basepath[MAX_FAT_PATH];
|
||||
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str());
|
||||
@ -655,12 +655,15 @@ int CMenu::_AutoCreateNand(void)
|
||||
m_thrdMessageAdded = false;
|
||||
m_nandext = false;
|
||||
m_emuSaveNand = false;
|
||||
bool changePart = false;
|
||||
bool lock_part_change = false;
|
||||
|
||||
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne5", L"Extract NAND"));
|
||||
m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne22", L"Disable NAND Emulation"));
|
||||
m_btnMgr.setText(m_nandemuBtnPartition, _t("cfgne31", L"Select Partition"));
|
||||
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Emu NAND not found. Try changing the partition to select the correct device/partition, click Extract to extract your NAND, or click disable to disable NAND Emulation."));
|
||||
//might add change nand button
|
||||
//m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Emu NAND not found. Try changing the partition to select the correct device/partition, click Extract to extract your NAND, or click disable to disable NAND Emulation."));
|
||||
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Emu NAND not found. Try one of these options to fix the problem."));
|
||||
m_btnMgr.show(m_nandemuBtnExtract);
|
||||
m_btnMgr.show(m_nandemuBtnDisable);
|
||||
m_btnMgr.show(m_nandemuBtnPartition);
|
||||
@ -700,29 +703,56 @@ int CMenu::_AutoCreateNand(void)
|
||||
_hideNandEmu();
|
||||
return 0;
|
||||
}
|
||||
//use partition btn from config so we don't have to show the whole main settings.
|
||||
else if(m_btnMgr.selected(m_nandemuBtnPartition))
|
||||
{
|
||||
if(m_current_view == COVERFLOW_WII)
|
||||
m_btnMgr.hide(m_nandemuBtnExtract);
|
||||
m_btnMgr.hide(m_nandemuBtnDisable);
|
||||
m_btnMgr.hide(m_nandemuBtnPartition);
|
||||
m_btnMgr.hide(m_nandemuLblInit);
|
||||
m_btnMgr.show(m_configLblPartitionName);
|
||||
m_btnMgr.show(m_configLblPartition);
|
||||
m_btnMgr.show(m_configBtnPartitionP);
|
||||
m_btnMgr.show(m_configBtnPartitionM);
|
||||
m_btnMgr.show(m_nandemuBtnBack);
|
||||
changePart = true;
|
||||
}
|
||||
else if(m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM))
|
||||
{
|
||||
s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1;
|
||||
//_setPartition(direction);
|
||||
u8 limiter = 0;
|
||||
int FS_Type = 0;
|
||||
do
|
||||
{
|
||||
m_emuSaveNand = true;
|
||||
m_current_view = COVERFLOW_CHANNEL;
|
||||
currentPartition = loopNum(currentPartition + direction, 10);
|
||||
FS_Type = DeviceHandle.GetFSType(currentPartition);
|
||||
limiter++;
|
||||
}
|
||||
_hideNandEmu();
|
||||
_config(1);
|
||||
if(m_emuSaveNand)
|
||||
{
|
||||
m_current_view = COVERFLOW_WII;
|
||||
m_emuSaveNand = false;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
while(limiter < 12 && FS_Type != PART_FS_FAT);
|
||||
//if limiter = 12 error
|
||||
m_btnMgr.setText(m_configLblPartition, upperCase(DeviceName[currentPartition]));
|
||||
}
|
||||
else if(m_btnMgr.selected(m_nandemuBtnBack))
|
||||
{
|
||||
m_cfg.save();
|
||||
_hideNandEmu();
|
||||
return 1;
|
||||
if(changePart)
|
||||
{
|
||||
m_btnMgr.hide(m_configLblPartitionName);
|
||||
m_btnMgr.hide(m_configLblPartition);
|
||||
m_btnMgr.hide(m_configBtnPartitionP);
|
||||
m_btnMgr.hide(m_configBtnPartitionM);
|
||||
m_btnMgr.hide(m_nandemuBtnBack);
|
||||
if(m_current_view == COVERFLOW_WII)
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", currentPartition);
|
||||
else
|
||||
m_cfg.setInt(CHANNEL_DOMAIN, "partition", currentPartition);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cfg.save();//why save?
|
||||
_hideNandEmu();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(BTN_B_HELD && BTN_MINUS_PRESSED && !lock_part_change)
|
||||
@ -812,6 +842,8 @@ int CMenu::_NandDumper(void *obj)
|
||||
if(emuPartition < 0)
|
||||
{
|
||||
m.error(m._t("cfgne8", L"No valid FAT partition found for NAND Emulation!"));
|
||||
//probably should set m.m_thrdWorking = false;
|
||||
//and set bool error to true and then main thread will handle it
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user