mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-12 11:59:08 +01:00
Fixed NAND emulation stuff:
*Fixed NAND emulation itself *Fixed creation of nandpath and title.tmd for some games *Fixed extraction of game saves for some games *Cleaned up some code for NAND emulation *Cleaned up some more unused stuff Todo: *Cleanup NAND emulation code much more *Move the last used function in savefile.c to a better place *Add extraction and flash options to game config menu
This commit is contained in:
parent
615000728d
commit
26a1ca085c
@ -1826,7 +1826,7 @@ bool CMenu::_loadChannelList(void)
|
|||||||
|
|
||||||
gprintf("%s, which is %s\n", disable_emu ? "NAND" : DeviceName[currentPartition], changed ? "refreshing." : "cached.");
|
gprintf("%s, which is %s\n", disable_emu ? "NAND" : DeviceName[currentPartition], changed ? "refreshing." : "cached.");
|
||||||
|
|
||||||
string path = m_cfg.getString("NAND", "path", "");
|
string path = m_cfg.getString("NAND", "path", STDEMU_DIR);
|
||||||
|
|
||||||
if(first && !disable_emu)
|
if(first && !disable_emu)
|
||||||
{
|
{
|
||||||
@ -1839,7 +1839,7 @@ bool CMenu::_loadChannelList(void)
|
|||||||
|
|
||||||
if(sysconf != NULL && sysconf_size > 0)
|
if(sysconf != NULL && sysconf_size > 0)
|
||||||
{
|
{
|
||||||
sprintf(filepath, "%s:%sshared2/sys/SYSCONF", DeviceName[currentPartition], path.c_str());
|
sprintf(filepath, "%s:%s/shared2/sys/SYSCONF", DeviceName[currentPartition], path.c_str());
|
||||||
FILE *file = fopen(filepath, "wb");
|
FILE *file = fopen(filepath, "wb");
|
||||||
if(file)
|
if(file)
|
||||||
{
|
{
|
||||||
@ -1856,7 +1856,7 @@ bool CMenu::_loadChannelList(void)
|
|||||||
|
|
||||||
if(meez != NULL && meez_size > 0)
|
if(meez != NULL && meez_size > 0)
|
||||||
{
|
{
|
||||||
sprintf(filepath, "%s:%sshared2/menu/FaceLib/RFL_DB.dat", DeviceName[currentPartition], path.c_str());
|
sprintf(filepath, "%s:%s/shared2/menu/FaceLib/RFL_DB.dat", DeviceName[currentPartition], path.c_str());
|
||||||
FILE *file = fopen(filepath, "wb");
|
FILE *file = fopen(filepath, "wb");
|
||||||
if(file)
|
if(file)
|
||||||
{
|
{
|
||||||
@ -1890,7 +1890,7 @@ bool CMenu::_loadChannelList(void)
|
|||||||
if(!DeviceHandler::Instance()->IsInserted(currentPartition))
|
if(!DeviceHandler::Instance()->IsInserted(currentPartition))
|
||||||
DeviceHandler::Instance()->Mount(currentPartition);
|
DeviceHandler::Instance()->Mount(currentPartition);
|
||||||
|
|
||||||
string nandpath = sfmt("%s:%s", DeviceName[currentPartition], path.empty() ? "/" : path.c_str());
|
string nandpath = sfmt("%s:%s/", DeviceName[currentPartition], path.empty() ? "" : path.c_str());
|
||||||
gprintf("nandpath = %s\n", nandpath.c_str());
|
gprintf("nandpath = %s\n", nandpath.c_str());
|
||||||
|
|
||||||
if(!failed)
|
if(!failed)
|
||||||
|
@ -1150,10 +1150,10 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
{
|
{
|
||||||
m_forceext = false;
|
m_forceext = false;
|
||||||
_hideWaitMessage();
|
_hideWaitMessage();
|
||||||
_AutoExtractSave(id);
|
if(!_AutoExtractSave(id))
|
||||||
|
CreateTitleTMD(basepath, hdr);
|
||||||
_showWaitMessage();
|
_showWaitMessage();
|
||||||
}
|
}
|
||||||
CreateSavePath(basepath, hdr);
|
|
||||||
}
|
}
|
||||||
if(emuSave > 2)
|
if(emuSave > 2)
|
||||||
{
|
{
|
||||||
|
@ -941,7 +941,6 @@ void CMenu::_textMain(void)
|
|||||||
{
|
{
|
||||||
m_btnMgr.setText(m_mainBtnInit, _t("main1", L"Install Game"));
|
m_btnMgr.setText(m_mainBtnInit, _t("main1", L"Install Game"));
|
||||||
m_btnMgr.setText(m_mainBtnInit2, _t("main3", L"Select Partition"));
|
m_btnMgr.setText(m_mainBtnInit2, _t("main3", L"Select Partition"));
|
||||||
//m_btnMgr.setText(m_mainLblInit, _t("main2", L"Welcome to WiiFlow. I have not found any games. Click Install to install games, or Select partition to select your partition type."), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wstringEx CMenu::_getNoticeTranslation(int sorting, wstringEx curLetter)
|
wstringEx CMenu::_getNoticeTranslation(int sorting, wstringEx curLetter)
|
||||||
|
@ -259,11 +259,26 @@ int CMenu::_AutoExtractSave(string gameId)
|
|||||||
{
|
{
|
||||||
int emuPartition = m_cfg.getInt("GAMES", "savepartition", m_cfg.getInt("NAND", "partition", 0));
|
int emuPartition = m_cfg.getInt("GAMES", "savepartition", m_cfg.getInt("NAND", "partition", 0));
|
||||||
int savePath = gameId.c_str()[0] << 24 | gameId.c_str()[1] << 16 | gameId.c_str()[2] << 8 | gameId.c_str()[3];
|
int savePath = gameId.c_str()[0] << 24 | gameId.c_str()[1] << 16 | gameId.c_str()[2] << 8 | gameId.c_str()[3];
|
||||||
string npath = sfmt("/title/00010000/%x", savePath);
|
char basepath[MAX_FAT_PATH];
|
||||||
string path = sfmt("%s:%s/title/00010000/%x", DeviceName[emuPartition], m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")).c_str(), savePath);
|
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")).c_str());
|
||||||
|
|
||||||
if(!_nandSaveExists(npath.c_str()) || (!m_forceext && _saveExists(path.c_str())))
|
Nand::Instance()->CreatePath("%s/import", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/meta", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/shared1", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/shared2", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/sys", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/title", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/ticket", basepath);
|
||||||
|
Nand::Instance()->CreatePath("%s/tmp", basepath);
|
||||||
|
|
||||||
|
string npath = sfmt("/title/00010000/%08x", savePath);
|
||||||
|
string path = sfmt("%s/title/00010000/%08x", basepath, savePath);
|
||||||
|
|
||||||
|
if(!_nandSaveExists(sfmt("/title/00010000/%08x", savePath).c_str()) && !_nandSaveExists(sfmt("/title/00010004/%08x", savePath).c_str()))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if(!m_forceext && (_saveExists(sfmt("%s/title/00010000/%08x", basepath, savePath).c_str()) || _saveExists(sfmt("%s/title/00010004/%08x", basepath, savePath).c_str())))
|
||||||
|
return 1;
|
||||||
|
|
||||||
lwp_t thread = 0;
|
lwp_t thread = 0;
|
||||||
SetupInput();
|
SetupInput();
|
||||||
@ -509,7 +524,6 @@ int CMenu::_NandDumper(void *obj)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool missingOnly = !m.m_saveall;
|
bool missingOnly = !m.m_saveall;
|
||||||
string path, npath;
|
|
||||||
vector<string> saveList;
|
vector<string> saveList;
|
||||||
m.m_sgdump = true;
|
m.m_sgdump = true;
|
||||||
|
|
||||||
@ -527,12 +541,9 @@ int CMenu::_NandDumper(void *obj)
|
|||||||
|
|
||||||
int savePath = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3];
|
int savePath = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3];
|
||||||
|
|
||||||
path = sfmt("%s/title/00010000/%x", basepath, savePath);
|
if(!missingOnly || (!_saveExists(sfmt("%s/title/00010000/%08x", basepath, savePath).c_str()) && !_saveExists(sfmt("%s/title/00010004/%08x", basepath, savePath).c_str())))
|
||||||
npath = sfmt("/title/00010000/%x", savePath);
|
|
||||||
|
|
||||||
if(!missingOnly || !_saveExists(path.c_str()))
|
|
||||||
{
|
{
|
||||||
if(_nandSaveExists(npath.c_str()))
|
if(_nandSaveExists(sfmt("/title/00010000/%08x", savePath).c_str()) || _nandSaveExists(sfmt("/title/00010004/%08x", savePath).c_str()))
|
||||||
{
|
{
|
||||||
m.m_nandexentry++;
|
m.m_nandexentry++;
|
||||||
saveList.push_back(id);
|
saveList.push_back(id);
|
||||||
@ -547,14 +558,20 @@ int CMenu::_NandDumper(void *obj)
|
|||||||
{
|
{
|
||||||
char source[ISFS_MAXPATH];
|
char source[ISFS_MAXPATH];
|
||||||
int savePath = saveList[i].c_str()[0] << 24 | saveList[i].c_str()[1] << 16 | saveList[i].c_str()[2] << 8 | saveList[i].c_str()[3];
|
int savePath = saveList[i].c_str()[0] << 24 | saveList[i].c_str()[1] << 16 | saveList[i].c_str()[2] << 8 | saveList[i].c_str()[3];
|
||||||
snprintf(source, sizeof(source), "/title/00010000/%x", savePath);
|
snprintf(source, sizeof(source), "/title/00010000/%08x", savePath);
|
||||||
|
if(!_nandSaveExists(source))
|
||||||
|
snprintf(source, sizeof(source), "/title/00010004/%08x", savePath);
|
||||||
|
|
||||||
m.m_dumpsize = Nand::Instance()->CalcDumpSpace(source, false, CMenu::_ShowProgress, obj);
|
m.m_dumpsize = Nand::Instance()->CalcDumpSpace(source, false, CMenu::_ShowProgress, obj);
|
||||||
}
|
}
|
||||||
for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i)
|
for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i)
|
||||||
{
|
{
|
||||||
char source[ISFS_MAXPATH];
|
char source[ISFS_MAXPATH];
|
||||||
int savePath = saveList[i].c_str()[0] << 24 | saveList[i].c_str()[1] << 16 | saveList[i].c_str()[2] << 8 | saveList[i].c_str()[3];
|
int savePath = saveList[i].c_str()[0] << 24 | saveList[i].c_str()[1] << 16 | saveList[i].c_str()[2] << 8 | saveList[i].c_str()[3];
|
||||||
snprintf(source, sizeof(source), "/title/00010000/%x", savePath);
|
snprintf(source, sizeof(source), "/title/00010000/%08x", savePath);
|
||||||
|
if(!_nandSaveExists(source))
|
||||||
|
snprintf(source, sizeof(source), "/title/00010004/%08x", savePath);
|
||||||
|
|
||||||
m.m_nandext = true;
|
m.m_nandext = true;
|
||||||
Nand::Instance()->DoNandDump(source, basepath, false, CMenu::_ShowProgress, obj);
|
Nand::Instance()->DoNandDump(source, basepath, false, CMenu::_ShowProgress, obj);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user