-now gamecube view defaults to on if either devolution or nintendont are installed.

-removed setting emu paths and changing emu presets.
-added select nand setting on page 2 of nand emulation settings. nands must be in a subfolder of nands folder on root of device. example - dev:/nands/nand1, dev:/nands/nand2 etc..
-nand select also works for saves nand in wii view.
-nand emulation settings is only shown if in wii view or nand view.
-if no nand is found wiiflow will create a nand named default in the nands folder.
-rewrote coverloader code a little to make it easier to follow. but still couldn't fix it. honestly it appears there's nothing wrong. wiiflow just acts weird.
This commit is contained in:
fledge68 2016-04-21 00:05:28 +00:00
parent 140999c2e3
commit ac4012e708
13 changed files with 228 additions and 346 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

@ -1012,6 +1012,7 @@ s32 Nand::CreateConfig()
s32 Nand::PreNandCfg(bool miis, bool realconfig) s32 Nand::PreNandCfg(bool miis, bool realconfig)
{ {
/* create paths only if they don't exist */
CreatePath(FullNANDPath); CreatePath(FullNANDPath);
CreatePath("%s/shared2", FullNANDPath); CreatePath("%s/shared2", FullNANDPath);
CreatePath("%s/shared2/sys", FullNANDPath); CreatePath("%s/shared2/sys", FullNANDPath);
@ -1245,16 +1246,9 @@ 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)); memset(&NandPath, 0, sizeof(NandPath));
if(emuPath[0] == '\0' || emuPath[0] == ' ')
return;
else if(emuPath[0] != '/' && emuPath[1] != '\0') //missing / before path
strcat(NandPath, "/");
for(u32 i = 0; emuPath[i] != '\0'; i++) for(u32 i = 0; emuPath[i] != '\0'; i++)
{
if(emuPath[i] == '/' && emuPath[i+1] == '\0')
break;
strncat(NandPath, &emuPath[i], 1); strncat(NandPath, &emuPath[i], 1);
}
/* Our WiiFlow handle Path */ /* Our WiiFlow handle Path */
memset(&FullNANDPath, 0, sizeof(FullNANDPath)); memset(&FullNANDPath, 0, sizeof(FullNANDPath));
strcat(FullNANDPath, fmt("%s:%s", currentPart, NandPath)); strcat(FullNANDPath, fmt("%s:%s", currentPart, NandPath));

View File

@ -4,8 +4,7 @@
#define APPDATA_DIR "wiiflow" #define APPDATA_DIR "wiiflow"
#define APPDATA_DIR2 "apps/wiiflow_lite" #define APPDATA_DIR2 "apps/wiiflow_lite"
//#define EMU_NANDS_DIR "%s:/nands" #define EMU_NANDS_DIR "nands"
#define STDEMU_DIR "/wiiflow/nandemu"
#define GAMES_DIR "%s:/wbfs" #define GAMES_DIR "%s:/wbfs"
#define HOMEBREW_DIR "%s:/apps" #define HOMEBREW_DIR "%s:/apps"
#define DF_GC_GAMES_DIR "%s:/games" #define DF_GC_GAMES_DIR "%s:/games"

View File

@ -2600,7 +2600,7 @@ bool CCoverFlow::fullCoverCached(const char *id)
bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover) bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
{ {
if (!m_loadingCovers) return false; if(!m_loadingCovers) return false;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565; u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
const char *path = box ? (blankBoxCover ? mainMenu.getBlankCoverPath(m_items[i].hdr) : const char *path = box ? (blankBoxCover ? mainMenu.getBlankCoverPath(m_items[i].hdr) :
@ -2643,17 +2643,17 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data; u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK)) if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{ {
const char *gamePath = NULL; const char *gameNameOrID = NULL;
const char *coverDir = NULL; const char *coverDir = NULL;
if(blankBoxCover) if(blankBoxCover)
{ {
const char *menuPath = mainMenu.getBlankCoverPath(m_items[i].hdr); const char *menuPath = mainMenu.getBlankCoverPath(m_items[i].hdr);
if(menuPath != NULL && strrchr(menuPath, '/') != NULL) if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
gamePath = strrchr(menuPath, '/') + 1; gameNameOrID = strrchr(menuPath, '/') + 1;
} }
else else
{ {
gamePath = getPathId(m_items[i].hdr); gameNameOrID = getPathId(m_items[i].hdr);
if(NoGameID(m_items[i].hdr->type)) if(NoGameID(m_items[i].hdr->type))
{ {
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN) if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
@ -2664,7 +2664,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
} }
FILE *file = NULL; FILE *file = NULL;
if(gamePath != NULL) if(gameNameOrID != NULL)
{ {
char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1); char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1);
if(full_path == NULL) if(full_path == NULL)
@ -2675,7 +2675,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
} }
memset(full_path, 0, MAX_FAT_PATH+1); memset(full_path, 0, MAX_FAT_PATH+1);
if(coverDir == NULL || strlen(coverDir) == 0) if(coverDir == NULL || strlen(coverDir) == 0)
strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), MAX_FAT_PATH); strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gameNameOrID), MAX_FAT_PATH);
else else
{ {
if(strchr(coverDir, '/') != NULL) if(strchr(coverDir, '/') != NULL)
@ -2694,7 +2694,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
MEM2_free(tmp); MEM2_free(tmp);
} }
fsop_MakeFolder(fmt("%s/%s", m_cachePath.c_str(), coverDir)); fsop_MakeFolder(fmt("%s/%s", m_cachePath.c_str(), coverDir));
strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), MAX_FAT_PATH); strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gameNameOrID), MAX_FAT_PATH);
} }
DCFlushRange(full_path, MAX_FAT_PATH+1); DCFlushRange(full_path, MAX_FAT_PATH+1);
file = fopen(full_path, "wb"); file = fopen(full_path, "wb");
@ -2786,17 +2786,17 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
// Try to find the texture in the cache // Try to find the texture in the cache
if(!m_cachePath.empty()) if(!m_cachePath.empty())
{ {
const char *gamePath = NULL; const char *gameNameOrID = NULL;
const char *coverDir = NULL; const char *coverDir = NULL;
if(blankBoxCover) if(blankBoxCover)
{ {
const char *menuPath = mainMenu.getBlankCoverPath(m_items[i].hdr); const char *blankCoverPath = mainMenu.getBlankCoverPath(m_items[i].hdr);
if(menuPath != NULL && strrchr(menuPath, '/') != NULL) if(blankCoverPath != NULL && strrchr(blankCoverPath, '/') != NULL)
gamePath = strrchr(menuPath, '/') + 1; gameNameOrID = strrchr(blankCoverPath, '/') + 1;
} }
else else
{ {
gamePath = getPathId(m_items[i].hdr); gameNameOrID = getPathId(m_items[i].hdr);
if(NoGameID(m_items[i].hdr->type)) if(NoGameID(m_items[i].hdr->type))
{ {
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN) if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
@ -2807,16 +2807,16 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
} }
FILE *fp = NULL; FILE *fp = NULL;
if(gamePath != NULL) if(gameNameOrID != NULL)
{ {
char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1); char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1);
if(full_path == NULL) if(full_path == NULL)
return CL_NOMEM; return CL_NOMEM;
memset(full_path, 0, MAX_FAT_PATH+1); memset(full_path, 0, MAX_FAT_PATH+1);
if(coverDir == NULL || strlen(coverDir) == 0) if(coverDir == NULL || strlen(coverDir) == 0)
strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), MAX_FAT_PATH); strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gameNameOrID), MAX_FAT_PATH);
else else
strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), MAX_FAT_PATH); strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gameNameOrID), MAX_FAT_PATH);
DCFlushRange(full_path, MAX_FAT_PATH+1); DCFlushRange(full_path, MAX_FAT_PATH+1);
fp = fopen(full_path, "rb"); fp = fopen(full_path, "rb");
MEM2_free(full_path); MEM2_free(full_path);
@ -2832,7 +2832,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
{ {
fread(&header, 1, sizeof(header), fp); fread(&header, 1, sizeof(header), fp);
//make sure wfc cache file matches what we want //make sure wfc cache file matches what we want
if(header.newFmt == 1 && (((header.full != 0) == box) && ((header.cmpr != 0) == m_compressTextures))) if(header.newFmt == 1 && (header.full != 0) == box && (header.cmpr != 0) == m_compressTextures)
{ {
TexData tex; TexData tex;
tex.format = header.cmpr != 0 ? GX_TF_CMPR : GX_TF_RGB565; tex.format = header.cmpr != 0 ? GX_TF_CMPR : GX_TF_RGB565;
@ -2846,43 +2846,46 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
u32 texLen = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); u32 texLen = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
tex.data = (u8*)MEM2_alloc(texLen); tex.data = (u8*)MEM2_alloc(texLen);
u8 *ptrTex = (header.zipped != 0) ? (u8*)MEM2_alloc(bufSize) : tex.data;
if(ptrTex == NULL || tex.data == NULL) if(header.zipped != 0)//if it's compressed ie. zipped
allocFailed = true; {
u8 *ptrTex = (u8*)MEM2_alloc(bufSize);
if(ptrTex == NULL)
allocFailed = true;
else
{
u8 *zBuffer = (u8*)MEM2_alloc(fileSize - sizeof(header));
if(zBuffer != NULL)
{
fread(zBuffer, 1, fileSize - sizeof(header), fp);
uLongf size = bufSize;
if(uncompress(ptrTex, &size, zBuffer, fileSize - sizeof(header)) == Z_OK && size == bufSize)
memcpy(tex.data, ptrTex + bufSize - texLen, texLen);
free(zBuffer);
free(ptrTex);
}
}
}
else else
{ {
u8 *zBuffer = (header.zipped != 0) ? (u8*)MEM2_alloc(fileSize - sizeof(header)) : tex.data; if(tex.data == NULL)
if(zBuffer != NULL && ((header.zipped != 0) || fileSize - sizeof(header) == bufSize)) allocFailed = true;
else
{ {
if(!header.zipped) fseek(fp, fileSize - sizeof(header) - texLen, SEEK_CUR);
{ fread(tex.data, 1, texLen, fp);
fseek(fp, fileSize - sizeof(header) - texLen, SEEK_CUR);
fread(tex.data, 1, texLen, fp);
}
else
fread(zBuffer, 1, fileSize - sizeof(header), fp);
uLongf size = bufSize;
if(header.zipped == 0 || (uncompress(ptrTex, &size, zBuffer, fileSize - sizeof(header)) == Z_OK && size == bufSize))
{
if(header.zipped != 0)
memcpy(tex.data, ptrTex + bufSize - texLen, texLen);
LockMutex lock(m_mutex);
TexHandle.Cleanup(m_items[i].texture);
m_items[i].texture = tex;
DCFlushRange(tex.data, texLen);
m_items[i].state = STATE_Ready;
m_items[i].boxTexture = header.full != 0;
success = true;
}
}
if(header.zipped != 0)
{
if(zBuffer != NULL)
free(zBuffer);
if(ptrTex != NULL)
free(ptrTex);
} }
} }
if(!allocFailed)
{
LockMutex lock(m_mutex);
TexHandle.Cleanup(m_items[i].texture);
m_items[i].texture = tex;
DCFlushRange(tex.data, texLen);
m_items[i].state = STATE_Ready;
m_items[i].boxTexture = header.full != 0;
success = true;
}
if(!success && tex.data != NULL) if(!success && tex.data != NULL)
{ {
free(tex.data); free(tex.data);

View File

@ -219,15 +219,21 @@ void CMenu::init()
/* GameCube stuff */ /* GameCube stuff */
m_devo_installed = DEVO_Installed(m_dataDir.c_str()); m_devo_installed = DEVO_Installed(m_dataDir.c_str());
m_nintendont_installed = Nintendont_Installed(); m_nintendont_installed = Nintendont_Installed();
m_show_gc = !m_cfg.getBool(GC_DOMAIN, "disable", true); m_show_gc = !m_cfg.getBool(GC_DOMAIN, "disable", ((m_devo_installed || m_nintendont_installed) == false));
memset(gc_games_dir, 0, 64); memset(gc_games_dir, 0, 64);
strncpy(gc_games_dir, m_cfg.getString(GC_DOMAIN, "gc_games_dir", DF_GC_GAMES_DIR).c_str(), 64); strncpy(gc_games_dir, m_cfg.getString(GC_DOMAIN, "gc_games_dir", DF_GC_GAMES_DIR).c_str(), 64);
if(strncmp(gc_games_dir, "%s:/", 4) != 0) if(strncmp(gc_games_dir, "%s:/", 4) != 0)
strcpy(gc_games_dir, DF_GC_GAMES_DIR); strcpy(gc_games_dir, DF_GC_GAMES_DIR);
gprintf("GameCube Games Directory: %s\n", gc_games_dir); gprintf("GameCube Games Directory: %s\n", gc_games_dir);
/* Create CHANNEL keys and set default values if key didn't exist */ /* Create CHANNEL keys and set default values if key didn't exist */
m_cfg.getString(CHANNEL_DOMAIN, "path", ""); int i;
m_cfg.getInt(CHANNEL_DOMAIN, "partition", 1); 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 m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false);//emu_nand
/* Load cIOS Map */ /* Load cIOS Map */
_installed_cios.clear(); _installed_cios.clear();
@ -2103,26 +2109,25 @@ const wstringEx CMenu::_fmt(const char *key, const wchar_t *def)
bool CMenu::_loadChannelList(void) bool CMenu::_loadChannelList(void)
{ {
m_gameList.clear(); m_gameList.clear();
string emuPath;// set via _FindEmuPart and used throughout wiiflow code string emuPath;//set via _FindEmuPart and used throughout wiiflow code
string cacheDir;//real nand empty string cacheDir;//left empty for real nand and not used
int emuPartition = -1; //real nand value int emuPartition = -1; //left at -1 for real nand
NANDemuView = (neek2o() || m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false)); NANDemuView = (neek2o() || m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false));
if(NANDemuView) if(NANDemuView)
{ {
emuPartition = _FindEmuPart(emuPath, false); emuPartition = _FindEmuPart(emuPath, false);//check if exist & has sysconf, settings.txt, & RFL_DB.dat
if(emuPartition < 0) if(emuPartition < 0)
emuPartition = _FindEmuPart(emuPath, true); emuPartition = _FindEmuPart(emuPath, true);//check if exist without those files
else
{ /* only create folder struct if the partition really has a emu nand on it already */
NandHandle.PreNandCfg(m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false),
m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false));
}
if(emuPartition < 0) if(emuPartition < 0)
return false; 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 */
NandHandle.PreNandCfg(m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false),
m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false));
currentPartition = emuPartition; currentPartition = emuPartition;
cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]); cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]);
} }
bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");//real nand doesn't update bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");//real nand doesn't update because cacheDir is left empty
/* CreateList checks if cacheDir is empty if so then doesn't update/create cache .db file */ /* CreateList checks if cacheDir is empty if so then doesn't update/create cache .db file */
vector<string> NullVector; vector<string> NullVector;
m_gameList.CreateList(COVERFLOW_CHANNEL, currentPartition, std::string(), m_gameList.CreateList(COVERFLOW_CHANNEL, currentPartition, std::string(),

View File

@ -1032,7 +1032,6 @@ private:
CONFIG_PAGE_INC = 1, CONFIG_PAGE_INC = 1,
CONFIG_PAGE_BACK, CONFIG_PAGE_BACK,
}; };
void _cfNeedsUpdate(void);
void _game(bool launch = false); void _game(bool launch = false);
void _downloadUrl(const char *url, u8 **dl_file, u32 *dl_size); void _downloadUrl(const char *url, u8 **dl_file, u32 *dl_size);
void _download(string gameId = string()); void _download(string gameId = string());

View File

@ -64,23 +64,19 @@ void CMenu::_showConfig(void)
m_btnMgr.show(m_configLblUser[i]); m_btnMgr.show(m_configLblUser[i]);
bool disable = (m_current_view == COVERFLOW_CHANNEL) && (!m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false) || neek2o()) && !m_emuSaveNand; bool disable = (m_current_view == COVERFLOW_CHANNEL) && (!m_cfg.getBool(CHANNEL_DOMAIN, "emu_nand", false) || neek2o()) && !m_emuSaveNand;
const char *partitionname = disable ? CHANNEL_DOMAIN : DeviceName[m_emuSaveNand ? m_cfg.getInt(WII_DOMAIN, "savepartition", 0) : m_cfg.getInt(_domainFromView(), "partition", 0)]; const char *partitionname = disable ? CHANNEL_DOMAIN : DeviceName[m_emuSaveNand ? m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)) : m_cfg.getInt(_domainFromView(), "partition", 0)];
m_btnMgr.setText(m_configLblPartition, upperCase(partitionname)); m_btnMgr.setText(m_configLblPartition, upperCase(partitionname));
m_btnMgr.show(m_configLblCfg4); if(m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_WII)
m_btnMgr.show(m_configBtnCfg4); {
m_btnMgr.show(m_configLblCfg4);
m_btnMgr.show(m_configBtnCfg4);
}
} }
m_btnMgr.show(m_configLblParental); m_btnMgr.show(m_configLblParental);
m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode); m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode);
} }
void CMenu::_cfNeedsUpdate(void)
{
if (!m_cfNeedsUpdate)
CoverFlow.clear();
m_cfNeedsUpdate = true;
}
void CMenu::_config(int page) void CMenu::_config(int page)
{ {
m_cfNeedsUpdate = false; m_cfNeedsUpdate = false;
@ -176,7 +172,7 @@ int CMenu::_config1(void)
{ {
if (m_btnMgr.selected(m_configBtnDownload)) if (m_btnMgr.selected(m_configBtnDownload))
{ {
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
CoverFlow.stopCoverLoader(true); CoverFlow.stopCoverLoader(true);
_hideConfig(); _hideConfig();
_download(); _download();
@ -189,7 +185,7 @@ int CMenu::_config1(void)
_hideConfig(); _hideConfig();
if (_code(code) && memcmp(code, m_cfg.getString("GENERAL", "parent_code", "").c_str(), 4) == 0) if (_code(code) && memcmp(code, m_cfg.getString("GENERAL", "parent_code", "").c_str(), 4) == 0)
{ {
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
m_locked = false; m_locked = false;
} }
else else
@ -202,7 +198,7 @@ int CMenu::_config1(void)
_hideConfig(); _hideConfig();
if (_code(code, true)) if (_code(code, true))
{ {
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str()); m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str());
m_locked = true; m_locked = true;
} }
@ -216,7 +212,7 @@ int CMenu::_config1(void)
} }
else if (m_btnMgr.selected(m_configBtnCfg4) && m_current_view != COVERFLOW_MAX) else if (m_btnMgr.selected(m_configBtnCfg4) && m_current_view != COVERFLOW_MAX)
{ {
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
CoverFlow.stopCoverLoader(true); CoverFlow.stopCoverLoader(true);
_hideConfig(); _hideConfig();
if(m_current_view != COVERFLOW_PLUGIN) if(m_current_view != COVERFLOW_PLUGIN)

View File

@ -120,7 +120,6 @@ int CMenu::_configAdv(void)
} }
else if(m_btnMgr.selected(m_configAdvBtnCurThemeP) || m_btnMgr.selected(m_configAdvBtnCurThemeM)) else if(m_btnMgr.selected(m_configAdvBtnCurThemeP) || m_btnMgr.selected(m_configAdvBtnCurThemeM))
{ {
_cfNeedsUpdate();
s8 direction = m_btnMgr.selected(m_configAdvBtnCurThemeP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configAdvBtnCurThemeP) ? 1 : -1;
curTheme = loopNum(curTheme + direction, (int)themes.size()); curTheme = loopNum(curTheme + direction, (int)themes.size());
m_cfg.setString("GENERAL", "theme", themes[curTheme]); m_cfg.setString("GENERAL", "theme", themes[curTheme]);
@ -135,7 +134,7 @@ int CMenu::_configAdv(void)
} }
else if(m_btnMgr.selected(m_configAdvBtnCFTheme)) else if(m_btnMgr.selected(m_configAdvBtnCFTheme))
{ {
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
_hideConfigAdv(); _hideConfigAdv();
_cfTheme(); _cfTheme();
_showConfigAdv(); _showConfigAdv();

View File

@ -124,6 +124,7 @@ const CMenu::SOption CMenu::_GClanguages[8] = {
}; };
const CMenu::SOption CMenu::_NandEmu[2] = { const CMenu::SOption CMenu::_NandEmu[2] = {
//{ "SaveOff", L"Off" },
{ "NANDpart", L"Partial" }, { "NANDpart", L"Partial" },
{ "NANDfull", L"Full" }, { "NANDfull", L"Full" },
}; };
@ -1136,7 +1137,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
string emuPath = m_cfg.getString(CHANNEL_DOMAIN, "path"); string emuPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str());
int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
int userIOS = m_gcfg2.getInt(id, "ios", 0); int userIOS = m_gcfg2.getInt(id, "ios", 0);
@ -1305,55 +1306,55 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
int emuPartition = 0; int emuPartition = 0;
u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
if(emulate_mode == 0) 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); emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
if(emulate_mode != 0) if(emulate_mode != 0)//not off
emulate_mode++; emulate_mode++;//then increase 1,2,3 to 2,3,4
} }
else if(emulate_mode == 1) else if(emulate_mode == 1)//equals off
emulate_mode = 0; emulate_mode = 0;// then off
m_current_view = COVERFLOW_WII; // used for _FindEmuPart() m_current_view = COVERFLOW_WII; // used for _FindEmuPart()
if(emulate_mode && !dvd && !neek2o()) if(emulate_mode && !dvd && !neek2o())
{ {
emuPartition = _FindEmuPart(emuPath, false); emuPartition = _FindEmuPart(emuPath, false);
if(emuPartition < 0) if(emuPartition < 0)
{ {
if(emulate_mode == 4) if(emulate_mode == 4)//full
{ {
_hideWaitMessage(); _hideWaitMessage();
while(true) while(true)
{ {
_AutoCreateNand(); _AutoCreateNand();
if(_TestEmuNand(m_cfg.getInt(WII_DOMAIN, "savepartition", 0), emuPath.c_str(), true)) if(_TestEmuNand(m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)), emuPath.c_str(), true))
{ {
emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
emuPath = m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")); 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());
break; break;
} }
} }
_showWaitMessage(); _showWaitMessage();
} }
else else//gamesave or regionswitch
{ {
emuPartition = _FindEmuPart(emuPath, true); emuPartition = _FindEmuPart(emuPath, true);
NandHandle.CreatePath(fmt("%s:/%s", DeviceName[emuPartition], APPDATA_DIR)); NandHandle.CreatePath(fmt("%s:/%s", DeviceName[emuPartition], EMU_NANDS_DIR));
NandHandle.CreatePath(fmt("%s:/%s/nandemu", DeviceName[emuPartition], APPDATA_DIR)); NandHandle.CreatePath(fmt("%s:/%s/default", DeviceName[emuPartition], EMU_NANDS_DIR));
} }
} }
/* Set them */ /* Set them */
NANDemuView = true; NANDemuView = true;
m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition); m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition);
m_cfg.setString(WII_DOMAIN, "savepath", emuPath); m_cfg.setString(WII_DOMAIN, "current_save_emunand", "default");
if(emulate_mode == 2) if(emulate_mode == 2)//gamesave
{ {
m_forceext = false; m_forceext = false;
_hideWaitMessage(); _hideWaitMessage();
if(!_AutoExtractSave(id)) if(!_AutoExtractSave(id))//extract gamesave
NandHandle.CreateTitleTMD(hdr); NandHandle.CreateTitleTMD(hdr);//if no save then create one
_showWaitMessage(); _showWaitMessage();
} }
else if(emulate_mode > 2) else if(emulate_mode > 2)//region switch or full
{ {
NandHandle.CreateConfig(); NandHandle.CreateConfig();
NandHandle.Do_Region_Change(id, false); NandHandle.Do_Region_Change(id, false);

View File

@ -276,7 +276,7 @@ bool CMenu::_LangSettings(void)
} }
_hideLangSettings(); _hideLangSettings();
if(lang_changed) if(lang_changed)
_cfNeedsUpdate(); m_cfNeedsUpdate = true;
if(lang_list_mem != NULL) if(lang_list_mem != NULL)
free(lang_list_mem); free(lang_list_mem);

View File

@ -132,7 +132,7 @@ start_main:
_hideMain(); _hideMain();
if(!_AutoCreateNand()) if(!_AutoCreateNand())
{ {
while(NANDemuView) while(NANDemuView)//keep calling _setPartition till NANDemuView is false and CHANNEL_DOMAIN, "emu_nand", false
_setPartition(1); _setPartition(1);
} }
_loadList(); _loadList();
@ -1089,7 +1089,6 @@ void CMenu::_setPartition(s8 direction)
{ {
if(m_current_view == COVERFLOW_CHANNEL && neek2o()) if(m_current_view == COVERFLOW_CHANNEL && neek2o())
return; return;
_cfNeedsUpdate();
int FS_Type = 0; int FS_Type = 0;
if(direction != 0) if(direction != 0)
{ {

View File

@ -1,6 +1,6 @@
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <algorithm>
#include "menu.hpp" #include "menu.hpp"
#include "defines.h" #include "defines.h"
#include "lockMutex.hpp" #include "lockMutex.hpp"
@ -23,14 +23,10 @@ s16 m_nandemuBtnAll;
s16 m_nandemuBtnMissing; s16 m_nandemuBtnMissing;
s16 m_nandemuLblNandDump; s16 m_nandemuLblNandDump;
s16 m_nandemuBtnNandDump; s16 m_nandemuBtnNandDump;
s16 m_nandemuLblNandFolder; s16 m_nandemuLblNandSelect;
s16 m_nandemuBtnNandFolder; s16 m_nandemuLblNandSelectVal;
s16 m_nandemuLblNandSavesFolder; s16 m_nandemuBtnNandSelectM;
s16 m_nandemuBtnNandSavesFolder; s16 m_nandemuBtnNandSelectP;
s16 m_nandemuLblPresetNand;
s16 m_nandemuLblPresetVal;
s16 m_nandemuBtnPresetM;
s16 m_nandemuBtnPresetP;
s16 m_nandfileLblMessage; s16 m_nandfileLblMessage;
s16 m_nandemuLblMessage; s16 m_nandemuLblMessage;
s16 m_nandfileLblDialog; s16 m_nandfileLblDialog;
@ -57,6 +53,33 @@ static inline int loopNum(int i, int s)
return (i + s) % s; return (i + s) % s;
} }
static void listEmuNands(const char * path, vector<string> &emuNands)
{
DIR *d;
struct dirent *dir;
emuNands.clear();
bool def = true;
d = opendir(path);
if(d != 0)
{
while((dir = readdir(d)) != 0)
{
if(dir->d_name[0] == '.')
continue;
if(dir->d_type == DT_DIR)
{
emuNands.push_back(dir->d_name);
def = false;
}
}
closedir(d);
}
if(def)
emuNands.push_back("default");
sort(emuNands.begin(), emuNands.end());
}
static bool _saveExists(const char *path) static bool _saveExists(const char *path)
{ {
DIR *d = opendir(path); DIR *d = opendir(path);
@ -84,14 +107,14 @@ bool CMenu::_TestEmuNand(int epart, const char *path, bool indept)
if(indept) if(indept)
{ {
// Check Wiimotes && Region // Check Wiimotes && Region
snprintf(testpath, sizeof(testpath), "%s:%s/shared2/sys/SYSCONF", DeviceName[epart], path); snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath))
return false; return false;
snprintf(testpath, sizeof(testpath), "%s:%s/title/00000001/00000002/data/setting.txt", DeviceName[epart], path); snprintf(testpath, sizeof(testpath), "%s/title/00000001/00000002/data/setting.txt", basepath);
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath))
return false; return false;
// Check Mii's // Check Mii's
snprintf(testpath, sizeof(testpath), "%s:%s/shared2/menu/FaceLib/RFL_DB.dat", DeviceName[epart], path); snprintf(testpath, sizeof(testpath), "%s/shared2/menu/FaceLib/RFL_DB.dat", basepath);
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath))
return false; return false;
} }
@ -105,24 +128,12 @@ int CMenu::_FindEmuPart(string &emuPath, bool skipchecks)
if(m_current_view == COVERFLOW_CHANNEL) if(m_current_view == COVERFLOW_CHANNEL)
{ {
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
tmpPath = m_cfg.getString(CHANNEL_DOMAIN, "path", "").c_str(); tmpPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str());
if(strlen(tmpPath) == 0)
{
tmpPath = STDEMU_DIR;
m_cfg.setString(CHANNEL_DOMAIN, "path", STDEMU_DIR);
}
} }
else if(m_current_view == COVERFLOW_WII) else if(m_current_view == COVERFLOW_WII)
{ {
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
if(emuPart == -1) tmpPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand", m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default")).c_str());
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
tmpPath = m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")).c_str();
if(strlen(tmpPath) == 0)
{
tmpPath = STDEMU_DIR;
m_cfg.setString(WII_DOMAIN, "savepath", STDEMU_DIR);
}
} }
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart)) if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))
return -1; return -1;
@ -148,7 +159,7 @@ bool CMenu::_checkSave(string id, bool nand)
} }
else else
{ {
int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
string emuPath = m_cfg.getString(WII_DOMAIN, "savepath", ""); string emuPath = m_cfg.getString(WII_DOMAIN, "savepath", "");
if(emuPartition < 0 || emuPath.size() == 0) if(emuPartition < 0 || emuPath.size() == 0)
return false; return false;
@ -209,14 +220,10 @@ void CMenu::_hideNandEmu(bool instant)
m_btnMgr.hide(m_nandemuBtnMissing, instant); m_btnMgr.hide(m_nandemuBtnMissing, instant);
m_btnMgr.hide(m_nandemuLblNandDump, instant); m_btnMgr.hide(m_nandemuLblNandDump, instant);
m_btnMgr.hide(m_nandemuBtnNandDump, instant); m_btnMgr.hide(m_nandemuBtnNandDump, instant);
m_btnMgr.hide(m_nandemuLblNandFolder, instant); m_btnMgr.hide(m_nandemuLblNandSelect, instant);
m_btnMgr.hide(m_nandemuBtnNandFolder, instant); m_btnMgr.hide(m_nandemuLblNandSelectVal, instant);
m_btnMgr.hide(m_nandemuLblNandSavesFolder, instant); m_btnMgr.hide(m_nandemuBtnNandSelectP, instant);
m_btnMgr.hide(m_nandemuBtnNandSavesFolder, instant); m_btnMgr.hide(m_nandemuBtnNandSelectM, instant);
m_btnMgr.hide(m_nandemuLblPresetNand, instant);
m_btnMgr.hide(m_nandemuLblPresetVal, instant);
m_btnMgr.hide(m_nandemuBtnPresetP, instant);
m_btnMgr.hide(m_nandemuBtnPresetM, instant);
m_btnMgr.hide(m_nandemuBtnExtract, instant); m_btnMgr.hide(m_nandemuBtnExtract, instant);
m_btnMgr.hide(m_nandemuBtnPartition, instant); m_btnMgr.hide(m_nandemuBtnPartition, instant);
m_btnMgr.hide(m_nandemuBtnDisable, instant); m_btnMgr.hide(m_nandemuBtnDisable, instant);
@ -249,53 +256,34 @@ void CMenu::_showNandEmu(void)
m_btnMgr.show(m_nandemuBtnEmulationM); m_btnMgr.show(m_nandemuBtnEmulationM);
} }
if((m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_WII)) m_btnMgr.show(m_nandemuLblSaveDump);
m_btnMgr.show(m_nandemuBtnAll);
m_btnMgr.show(m_nandemuBtnMissing);
m_btnMgr.show(m_nandemuLblNandDump);
m_btnMgr.show(m_nandemuBtnNandDump);
if(m_current_view == COVERFLOW_CHANNEL)
{ {
m_btnMgr.show(m_nandemuLblSaveDump); i = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
m_btnMgr.show(m_nandemuBtnAll); m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_NandEmu[i].id, CMenu::_NandEmu[i].text));
m_btnMgr.show(m_nandemuBtnMissing); }
m_btnMgr.show(m_nandemuLblNandDump); else if(m_current_view == COVERFLOW_WII)
m_btnMgr.show(m_nandemuBtnNandDump); {
if (m_current_view == COVERFLOW_CHANNEL) i = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
{ m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_GlobalSaveEmu[i].id, CMenu::_GlobalSaveEmu[i].text));
i = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_NandEmu[i].id, CMenu::_NandEmu[i].text));
}
else if (m_current_view == COVERFLOW_WII)
{
i = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_GlobalSaveEmu[i].id, CMenu::_GlobalSaveEmu[i].text));
}
} }
} }
else else //page 2
{ {
m_btnMgr.show(m_nandemuLblNandFolder); m_btnMgr.show(m_nandemuLblNandSelect);
m_btnMgr.show(m_nandemuBtnNandFolder); m_btnMgr.show(m_nandemuLblNandSelectVal);
m_btnMgr.show(m_nandemuLblNandSavesFolder); m_btnMgr.show(m_nandemuBtnNandSelectP);
m_btnMgr.show(m_nandemuBtnNandSavesFolder); m_btnMgr.show(m_nandemuBtnNandSelectM);
m_btnMgr.show(m_nandemuLblPresetNand); if(m_current_view == COVERFLOW_CHANNEL)
m_btnMgr.show(m_nandemuLblPresetVal); m_btnMgr.setText(m_nandemuLblNandSelectVal, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default"));
m_btnMgr.show(m_nandemuBtnPresetP); else if(m_current_view == COVERFLOW_WII)
m_btnMgr.show(m_nandemuBtnPresetM); m_btnMgr.setText(m_nandemuLblNandSelectVal, m_cfg.getString(WII_DOMAIN, "current_save_emunand", m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default")));
const char *presetPath = m_cfg.getString(CHANNEL_DOMAIN, fmt("path_%i", m_cfg.getInt(CHANNEL_DOMAIN, "current_preset", 1)), "").c_str();
if(strlen(presetPath) > 0)
{
char tmpPath[64];
memset(tmpPath, 0, 64);
if(strchr(presetPath, '/') != strrchr(presetPath, '/'))
{
if(presetPath[strlen(presetPath) - 1] == '/')
*strrchr(presetPath, '/') = '\0';
strncpy(tmpPath, strrchr(presetPath, '/') + 1, 63);
}
else
strcpy(tmpPath, presetPath);
m_btnMgr.setText(m_nandemuLblPresetVal, wstringEx(tmpPath));
}
else
m_btnMgr.setText(m_nandemuLblPresetVal, _t("cfgne38", L"Empty"));
} }
for(u8 i = 0; i < ARRAY_SIZE(m_nandemuLblUser); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_nandemuLblUser); ++i)
if(m_nandemuLblUser[i] != -1) if(m_nandemuLblUser[i] != -1)
m_btnMgr.show(m_nandemuLblUser[i]); m_btnMgr.show(m_nandemuLblUser[i]);
@ -304,8 +292,28 @@ void CMenu::_showNandEmu(void)
int CMenu::_NandEmuCfg(void) int CMenu::_NandEmuCfg(void)
{ {
nandemuPage = 1; nandemuPage = 1;
bool bothNands = m_cfg.getBool(CHANNEL_DOMAIN, "switch_both_nands", false);
const char *path; vector<string> emuNands;
string prevEmuNand;
int emuPart;
if(m_current_view == COVERFLOW_CHANNEL)
{
prevEmuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
}
else
{
prevEmuNand = m_cfg.getString(WII_DOMAIN, "current_save_emunand", m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default"));
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
}
listEmuNands(fmt("%s:/%s", DeviceName[emuPart], EMU_NANDS_DIR), emuNands);
int curEmuNand = 0;
for(u8 i = 0; i < emuNands.size(); ++i)
if(emuNands[i] == prevEmuNand)
{
curEmuNand = i;
break;
}
lwp_t thread = 0; lwp_t thread = 0;
SetupInput(); SetupInput();
@ -329,14 +337,10 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.hide(m_nandemuBtnMissing, true); m_btnMgr.hide(m_nandemuBtnMissing, true);
m_btnMgr.hide(m_nandemuLblNandDump, true); m_btnMgr.hide(m_nandemuLblNandDump, true);
m_btnMgr.hide(m_nandemuBtnNandDump, true); m_btnMgr.hide(m_nandemuBtnNandDump, true);
m_btnMgr.hide(m_nandemuLblNandFolder, true); m_btnMgr.hide(m_nandemuLblNandSelect, true);
m_btnMgr.hide(m_nandemuBtnNandFolder, true); m_btnMgr.hide(m_nandemuLblNandSelectVal, true);
m_btnMgr.hide(m_nandemuLblNandSavesFolder, true); m_btnMgr.hide(m_nandemuBtnNandSelectP, true);
m_btnMgr.hide(m_nandemuBtnNandSavesFolder, true); m_btnMgr.hide(m_nandemuBtnNandSelectM, true);
m_btnMgr.hide(m_nandemuLblPresetNand, true);
m_btnMgr.hide(m_nandemuLblPresetVal, true);
m_btnMgr.hide(m_nandemuBtnPresetP, true);
m_btnMgr.hide(m_nandemuBtnPresetM, true);
nandemuPage = nandemuPage == 1 ? 2 : 1; nandemuPage = nandemuPage == 1 ? 2 : 1;
_showNandEmu(); _showNandEmu();
@ -352,14 +356,10 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.hide(m_nandemuBtnMissing, true); m_btnMgr.hide(m_nandemuBtnMissing, true);
m_btnMgr.hide(m_nandemuLblNandDump, true); m_btnMgr.hide(m_nandemuLblNandDump, true);
m_btnMgr.hide(m_nandemuBtnNandDump, true); m_btnMgr.hide(m_nandemuBtnNandDump, true);
m_btnMgr.hide(m_nandemuLblNandFolder, true); m_btnMgr.hide(m_nandemuLblNandSelect, true);
m_btnMgr.hide(m_nandemuBtnNandFolder, true); m_btnMgr.hide(m_nandemuLblNandSelectVal, true);
m_btnMgr.hide(m_nandemuLblNandSavesFolder, true); m_btnMgr.hide(m_nandemuBtnNandSelectP, true);
m_btnMgr.hide(m_nandemuBtnNandSavesFolder, true); m_btnMgr.hide(m_nandemuBtnNandSelectM, true);
m_btnMgr.hide(m_nandemuLblPresetNand, true);
m_btnMgr.hide(m_nandemuLblPresetVal, true);
m_btnMgr.hide(m_nandemuBtnPresetP, true);
m_btnMgr.hide(m_nandemuBtnPresetM, true);
nandemuPage = nandemuPage == 1 ? 2 : 1; nandemuPage = nandemuPage == 1 ? 2 : 1;
_showNandEmu(); _showNandEmu();
@ -415,121 +415,14 @@ int CMenu::_NandEmuCfg(void)
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40);
} }
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandFolder))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSelectP) || m_btnMgr.selected(m_nandemuBtnNandSelectM)))
{ {
_hideNandEmu(true); s8 direction = m_btnMgr.selected(m_nandemuBtnNandSelectP) ? 1 : -1;
u8 tmpView = m_current_view; curEmuNand = loopNum(curEmuNand + direction, emuNands.size());
m_current_view = COVERFLOW_CHANNEL; if(m_current_view == COVERFLOW_CHANNEL)
string emuPath; m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", emuNands[curEmuNand]);
_FindEmuPart(emuPath, true); else
path = _FolderExplorer(NandHandle.GetPath()); m_cfg.setString(WII_DOMAIN, "current_save_emunand", emuNands[curEmuNand]);
m_current_view = tmpView;
if(strlen(path) > 0)
{
char preset[256];
memset(preset, 0, 256);
strncpy(preset, path, strlen(path)-1);
m_cfg.setString(CHANNEL_DOMAIN, fmt("path_%i", m_cfg.getInt(CHANNEL_DOMAIN, "current_preset", 1)), preset);
if(strncmp(path, "sd:/", 4) == 0)
{
m_cfg.setInt(CHANNEL_DOMAIN, "partition", 0);
if(bothNands)
m_cfg.setInt(WII_DOMAIN, "savepartition", 0);
}
else
{
const char *partval = &path[3];
m_cfg.setInt(CHANNEL_DOMAIN, "partition", atoi(partval));
if(bothNands)
m_cfg.setInt(WII_DOMAIN, "savepartition", atoi(partval));
}
char tmpPath[MAX_FAT_PATH];
memset(tmpPath, 0, MAX_FAT_PATH);
strncpy(tmpPath, strchr(path, '/'), MAX_FAT_PATH-1);
m_cfg.setString(CHANNEL_DOMAIN, "path", tmpPath);
if(bothNands)
m_cfg.setString(WII_DOMAIN, "savepath", tmpPath);
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
if(m_cfg.getBool(CHANNEL_DOMAIN, "source"))
m_load_view = true;
}
_showNandEmu();
}
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSavesFolder)))
{
_hideNandEmu(true);
u8 tmpView = m_current_view;
m_current_view = COVERFLOW_WII;
string emuPath;
_FindEmuPart(emuPath, true);
path = _FolderExplorer(NandHandle.GetPath());
m_current_view = tmpView;
if(strlen(path) > 0)
{
if(bothNands)
{
char preset[256];
memset(preset, 0, 256);
strncpy(preset, path, strlen(path)-1);
m_cfg.setString(CHANNEL_DOMAIN, fmt("path_%i", m_cfg.getInt(CHANNEL_DOMAIN, "current_preset", 1)), preset);
}
if(strncmp(path, "sd:/", 4) == 0)
{
m_cfg.setInt(WII_DOMAIN, "savepartition", 0);
if(bothNands)
m_cfg.setInt(CHANNEL_DOMAIN, "partition", 0);
}
else
{
const char *partval = &path[3];
m_cfg.setInt(WII_DOMAIN, "savepartition", atoi(partval));
if(bothNands)
m_cfg.setInt(CHANNEL_DOMAIN, "partition", atoi(partval));
}
char tmpPath[MAX_FAT_PATH];
memset(tmpPath, 0, MAX_FAT_PATH);
strncpy(tmpPath, strchr(path, '/'), MAX_FAT_PATH-1);
m_cfg.setString(WII_DOMAIN, "savepath", tmpPath);
if(bothNands)
{
m_cfg.setString(CHANNEL_DOMAIN, "path", tmpPath);
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
if(m_cfg.getBool(CHANNEL_DOMAIN, "source"))
m_load_view = true;
}
}
_showNandEmu();
}
else if (BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnPresetP) || m_btnMgr.selected(m_nandemuBtnPresetM)))
{
s8 direction = m_btnMgr.selected(m_nandemuBtnPresetP) ? 1 : -1;
m_cfg.setInt(CHANNEL_DOMAIN, "current_preset", ((int)loopNum((u32)(m_cfg.getInt(CHANNEL_DOMAIN, "current_preset", 1) - 1) + direction, 4)) + 1);
path = m_cfg.getString(CHANNEL_DOMAIN, fmt("path_%i", m_cfg.getInt(CHANNEL_DOMAIN, "current_preset", 1)), "").c_str();
if(strlen(path) > 0)
{
if(strncmp(path, "sd:/", 4) == 0)
{
m_cfg.setInt(CHANNEL_DOMAIN, "partition", 0);
if(bothNands)
m_cfg.setInt(WII_DOMAIN, "savepartition", 0);
}
else
{
const char *partval = &path[3];
m_cfg.setInt(CHANNEL_DOMAIN, "partition", atoi(partval));
if(bothNands)
m_cfg.setInt(WII_DOMAIN, "savepartition", atoi(partval));
}
char tmpPath[MAX_FAT_PATH];
memset(tmpPath, 0, MAX_FAT_PATH);
strncpy(tmpPath, strchr(path, '/'), MAX_FAT_PATH-1);
m_cfg.setString(CHANNEL_DOMAIN, "path", tmpPath);
if(bothNands)
m_cfg.setString(WII_DOMAIN, "savepath", tmpPath);
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
if(m_cfg.getBool(CHANNEL_DOMAIN, "source"))
m_load_view = true;
}
_showNandEmu(); _showNandEmu();
} }
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnBack))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnBack)))
@ -565,6 +458,11 @@ int CMenu::_NandEmuCfg(void)
} }
} }
_hideNandEmu(); _hideNandEmu();
if(prevEmuNand != m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") && m_current_view == COVERFLOW_CHANNEL)
{
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
m_load_view = true;
}
return 0; return 0;
} }
@ -572,7 +470,7 @@ int CMenu::_FlashSave(string gameId)
{ {
int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)); int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0));
char basepath[MAX_FAT_PATH]; char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")).c_str()); snprintf(basepath, sizeof(basepath), "%s:/%s/%s", DeviceName[emuPartition], EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand", m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default")).c_str());
if(!_checkSave(gameId, false)) if(!_checkSave(gameId, false))
return 0; return 0;
@ -762,7 +660,7 @@ int CMenu::_AutoCreateNand(void)
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne5", L"Extract NAND")); 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_nandemuBtnDisable, _t("cfgne22", L"Disable NAND Emulation"));
m_btnMgr.setText(m_nandemuBtnPartition, _t("cfgne31", L"Select Partition")); m_btnMgr.setText(m_nandemuBtnPartition, _t("cfgne31", L"Select Partition"));
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Welcome to WiiFlow. I have not found a valid NAND for NAND Emulation. 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 changing the partition to select the correct device/partition, click Extract to extract your NAND, or click disable to disable NAND Emulation."));
m_btnMgr.show(m_nandemuBtnExtract); m_btnMgr.show(m_nandemuBtnExtract);
m_btnMgr.show(m_nandemuBtnDisable); m_btnMgr.show(m_nandemuBtnDisable);
m_btnMgr.show(m_nandemuBtnPartition); m_btnMgr.show(m_nandemuBtnPartition);
@ -802,6 +700,7 @@ int CMenu::_AutoCreateNand(void)
_hideNandEmu(); _hideNandEmu();
return 0; 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)) else if(m_btnMgr.selected(m_nandemuBtnPartition))
{ {
if(m_current_view == COVERFLOW_WII) if(m_current_view == COVERFLOW_WII)
@ -1019,14 +918,10 @@ void CMenu::_initNandEmuMenu()
m_nandemuLblNandDump = _addLabel("NANDEMU/NAND_DUMP", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_nandemuLblNandDump = _addLabel("NANDEMU/NAND_DUMP", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnNandDump = _addButton("NANDEMU/NAND_DUMP_BTN", theme.btnFont, L"", 420, 310, 200, 48, theme.btnFontColor); m_nandemuBtnNandDump = _addButton("NANDEMU/NAND_DUMP_BTN", theme.btnFont, L"", 420, 310, 200, 48, theme.btnFontColor);
m_nandemuLblNandFolder = _addLabel("NANDEMU/NAND_FOLDER", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_nandemuLblNandSelect = _addLabel("NANDEMU/NAND_SELECT", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnNandFolder = _addButton("NANDEMU/NAND_FOLDER_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor); m_nandemuLblNandSelectVal = _addLabel("NANDEMU/NAND_SELECT_BTN", theme.btnFont, L"", 468, 130, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_nandemuLblNandSavesFolder = _addLabel("NANDEMU/NAND_SAVES_FOLDER", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_nandemuBtnNandSelectM = _addPicButton("NANDEMU/NAND_SELECT_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 130, 48, 48);
m_nandemuBtnNandSavesFolder = _addButton("NANDEMU/NAND_SAVES_FOLDER_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor); m_nandemuBtnNandSelectP = _addPicButton("NANDEMU/NAND_SELECT_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 130, 48, 48);
m_nandemuLblPresetNand = _addLabel("NANDEMU/PRESET_NAND", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuLblPresetVal = _addLabel("NANDEMU/PRESET_NAND_BTN", theme.btnFont, L"", 468, 250, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_nandemuBtnPresetM = _addPicButton("NANDEMU/PRESET_NAND_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 250, 48, 48);
m_nandemuBtnPresetP = _addPicButton("NANDEMU/PRESET_NAND_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 250, 48, 48);
m_nandemuBtnBack = _addButton("NANDEMU/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor); m_nandemuBtnBack = _addButton("NANDEMU/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_nandemuLblPage = _addLabel("NANDEMU/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_nandemuLblPage = _addLabel("NANDEMU/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
@ -1057,14 +952,10 @@ void CMenu::_initNandEmuMenu()
_setHideAnim(m_nandemuLblNandDump, "NANDEMU/NAND_DUMP", 50, 0, -2.f, 0.f); _setHideAnim(m_nandemuLblNandDump, "NANDEMU/NAND_DUMP", 50, 0, -2.f, 0.f);
_setHideAnim(m_nandemuBtnNandDump, "NANDEMU/NAND_DUMP_BTN", -50, 0, 1.f, 0.f); _setHideAnim(m_nandemuBtnNandDump, "NANDEMU/NAND_DUMP_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuLblNandFolder, "NANDEMU/NAND_FOLDER", 50, 0, -2.f, 0.f); _setHideAnim(m_nandemuLblNandSelect, "NANDEMU/NAND_SELECT", 50, 0, -2.f, 0.f);
_setHideAnim(m_nandemuBtnNandFolder, "NANDEMU/NAND_FOLDER_BTN", -50, 0, 1.f, 0.f); _setHideAnim(m_nandemuLblNandSelectVal, "NANDEMU/NAND_SELECT_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuLblNandSavesFolder, "NANDEMU/NAND_SAVES_FOLDER", 50, 0, -2.f, 0.f); _setHideAnim(m_nandemuBtnNandSelectM, "NANDEMU/NAND_SELECT_MINUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuBtnNandSavesFolder, "NANDEMU/NAND_SAVES_FOLDER_BTN", -50, 0, 1.f, 0.f); _setHideAnim(m_nandemuBtnNandSelectP, "NANDEMU/NAND_SELECT_PLUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuLblPresetNand, "NANDEMU/PRESET_NAND", 50, 0, -2.f, 0.f);
_setHideAnim(m_nandemuLblPresetVal, "NANDEMU/PRESET_NAND_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuBtnPresetM, "NANDEMU/PRESET_NAND_MINUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuBtnPresetP, "NANDEMU/PRESET_NAND_PLUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_nandemuBtnBack, "NANDEMU/BACK_BTN", 0, 0, 1.f, -1.f); _setHideAnim(m_nandemuBtnBack, "NANDEMU/BACK_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_nandemuLblPage, "NANDEMU/PAGE_BTN", 0, 0, 1.f, -1.f); _setHideAnim(m_nandemuLblPage, "NANDEMU/PAGE_BTN", 0, 0, 1.f, -1.f);
@ -1082,11 +973,7 @@ void CMenu::_initNandEmuMenu()
void CMenu::_textNandEmu(void) void CMenu::_textNandEmu(void)
{ {
m_btnMgr.setText(m_nandemuLblNandFolder, _t("cfgne32", L"Change Nand")); m_btnMgr.setText(m_nandemuLblNandSelect, _t("cfgne37", L"Select Nand"));
m_btnMgr.setText(m_nandemuLblNandSavesFolder, _t("cfgne33", L"Change Saves Nand"));
m_btnMgr.setText(m_nandemuLblPresetNand, _t("cfgne37", L"Select Preset Nand"));
m_btnMgr.setText(m_nandemuBtnNandFolder, _t("dl16", L"Set"));
m_btnMgr.setText(m_nandemuBtnNandSavesFolder, _t("dl16", L"Set"));
m_btnMgr.setText(m_nandemuLblEmulation, _t("cfgne1", L"NAND Emulation")); m_btnMgr.setText(m_nandemuLblEmulation, _t("cfgne1", L"NAND Emulation"));
m_btnMgr.setText(m_nandemuLblSaveDump, _t("cfgne2", L"Extract Game Saves")); m_btnMgr.setText(m_nandemuLblSaveDump, _t("cfgne2", L"Extract Game Saves"));
m_btnMgr.setText(m_nandemuBtnAll, _t("cfgne3", L"All")); m_btnMgr.setText(m_nandemuBtnAll, _t("cfgne3", L"All"));

View File

@ -450,7 +450,7 @@ void CMenu::_Wad(const char *wad_path)
/* mios is real nand, chans are emu */ /* mios is real nand, chans are emu */
if(mios == false) if(mios == false)
{ {
const char *emu_char = m_cfg.getString(CHANNEL_DOMAIN, "path", "/").c_str(); const char *emu_char = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str());
NandHandle.SetPaths(emu_char, DeviceName[currentPartition]); NandHandle.SetPaths(emu_char, DeviceName[currentPartition]);
} }
_start_pThread(); _start_pThread();