mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
- recoded a little of explorer to make it more memory friendly as Fix94 says. But it still works the same. Also removed theme.selsbtnFontColor and theme.selubtnFontColor which aren't used anymore.
This commit is contained in:
parent
76b7ad1d6b
commit
c8673083f9
@ -950,9 +950,6 @@ void CMenu::_buildMenus(void)
|
||||
theme.txtFont = _font(theme.fontSet, "GENERAL", "text_font", TEXTFONT);
|
||||
theme.txtFontColor = m_theme.getColor("GENERAL", "text_font_color", 0xFFFFFFFF);
|
||||
|
||||
theme.selsbtnFontColor = m_theme.getColor("GENERAL", "selsbtn_font_color", 0xFA5882FF);
|
||||
theme.selubtnFontColor = m_theme.getColor("GENERAL", "selubtn_font_color", 0xD0BFDFFF);
|
||||
|
||||
// Default Sounds
|
||||
theme.clickSound = _sound(theme.soundSet, "GENERAL", "click_sound", click_wav, click_wav_size, "default_btn_click", false);
|
||||
theme.hoverSound = _sound(theme.soundSet, "GENERAL", "hover_sound", hover_wav, hover_wav_size, "default_btn_hover", false);
|
||||
|
@ -990,7 +990,7 @@ private:
|
||||
void _gameSettings(void);
|
||||
void _CoverBanner(void);
|
||||
void _Explorer(void);
|
||||
string _FolderExplorer(void);
|
||||
const char *_FolderExplorer(void);
|
||||
void _Wad(const char *wad_path = NULL);
|
||||
void _CheatSettings();
|
||||
bool _Source();
|
||||
|
@ -44,10 +44,10 @@ list_element *elements = NULL;
|
||||
u32 elements_num = 0;
|
||||
char file[MAX_FAT_PATH];
|
||||
char dir[MAX_FAT_PATH];
|
||||
char folderPath[MAX_FAT_PATH];
|
||||
char tmpPath[MAX_FAT_PATH];
|
||||
u8 explorer_partition = 0;
|
||||
bool folderExplorer = false;
|
||||
string folderPath = "";
|
||||
string path = "";
|
||||
|
||||
void CMenu::_hideExplorer(bool instant)
|
||||
{
|
||||
@ -120,9 +120,8 @@ void CMenu::_Explorer(void)
|
||||
}
|
||||
else if(m_btnMgr.selected(m_explorerBtnSet))
|
||||
{
|
||||
//only when set is clicked do we set path to dir
|
||||
if(dir[0] != '\0')
|
||||
path = dir;
|
||||
//only when set is clicked do we set folderPath to dir
|
||||
strcpy(folderPath, dir);
|
||||
break;
|
||||
}
|
||||
else if(m_btnMgr.selected(m_explorerBtnBack))
|
||||
@ -137,29 +136,31 @@ void CMenu::_Explorer(void)
|
||||
if(strchr(dir, '/') != NULL)
|
||||
*(strrchr(dir, '/')+1) = '\0';
|
||||
}
|
||||
folderPath = dir;
|
||||
//if dir is just device and : then folderpath empty
|
||||
if(folderPath.find_last_of("/") == string::npos)
|
||||
folderPath = "";
|
||||
else
|
||||
{
|
||||
if(folderPath.find_first_of("/") != folderPath.find_last_of("/"))
|
||||
{
|
||||
folderPath = folderPath.erase(folderPath.find_last_of("/"));
|
||||
while(folderPath.length() > 32)
|
||||
{
|
||||
if(folderPath.find_first_of("/") == string::npos)
|
||||
break;
|
||||
folderPath = folderPath.erase(0, folderPath.find_first_of("/")+1);
|
||||
}
|
||||
if(folderPath.find_first_of(":") == string::npos)
|
||||
folderPath = "/"+folderPath;
|
||||
folderPath = folderPath+"/";
|
||||
}
|
||||
}
|
||||
//if we removed device then clear path completely
|
||||
strcpy(folderPath, dir);
|
||||
//if dir is just device and : then clear path completely
|
||||
if(strchr(dir, '/') == NULL)
|
||||
{
|
||||
memset(dir, 0, MAX_FAT_PATH);
|
||||
memset(folderPath, 0, MAX_FAT_PATH);
|
||||
}
|
||||
else if(strchr(folderPath, '/') != strrchr(folderPath, '/'))
|
||||
{
|
||||
*strrchr(folderPath, '/') = '\0';
|
||||
while(strlen(folderPath) > 48)
|
||||
{
|
||||
if(strchr(folderPath, '/') == strrchr(folderPath, '/'))
|
||||
break;
|
||||
memset(tmpPath, 0, MAX_FAT_PATH);
|
||||
strncpy(tmpPath, strchr(folderPath, '/') + 1, MAX_FAT_PATH - 1);
|
||||
strcpy(folderPath, tmpPath);
|
||||
}
|
||||
memset(tmpPath, 0, MAX_FAT_PATH);
|
||||
if(strchr(folderPath, ':') == NULL)
|
||||
strcpy(tmpPath, "/");
|
||||
strcat(tmpPath, folderPath);
|
||||
strcat(tmpPath, "/");
|
||||
strcpy(folderPath, tmpPath);
|
||||
}
|
||||
_refreshExplorer();
|
||||
}
|
||||
for(u8 i = 1; i < 7; ++i)
|
||||
@ -171,26 +172,29 @@ void CMenu::_Explorer(void)
|
||||
{
|
||||
explorer_partition = i-1;
|
||||
strcpy(dir, fmt("%s:/", DeviceName[i-1]));
|
||||
folderPath = dir;
|
||||
strcpy(folderPath, dir);
|
||||
_refreshExplorer();
|
||||
}
|
||||
//if it's a folder add folder+/ to path
|
||||
else if(!fsop_FileExist(fmt("%s%s", dir, elements[start_pos+(i-1)].name)))
|
||||
{
|
||||
strcat(dir, elements[start_pos+(i-1)].name);
|
||||
folderPath = dir;
|
||||
while(folderPath.length() > 48)
|
||||
{
|
||||
//this if won't happen the first time
|
||||
if(folderPath.find_first_of("/") == string::npos)
|
||||
break;
|
||||
folderPath = folderPath.erase(0, folderPath.find_first_of("/")+1);
|
||||
}
|
||||
if(folderPath.find_first_of(":") == string::npos)
|
||||
folderPath = "/"+folderPath;
|
||||
folderPath = folderPath+"/";
|
||||
/* otherwise it fails */
|
||||
strcpy(folderPath, dir);
|
||||
strcat(dir, "/");
|
||||
while(strlen(folderPath) > 48)
|
||||
{
|
||||
if(strchr(folderPath, '/') == strrchr(folderPath, '/'))
|
||||
break;
|
||||
memset(tmpPath, 0, MAX_FAT_PATH);
|
||||
strncpy(tmpPath, strchr(folderPath, '/') + 1, MAX_FAT_PATH - 1);
|
||||
strcpy(folderPath, tmpPath);
|
||||
}
|
||||
memset(tmpPath, 0, MAX_FAT_PATH);
|
||||
if(strchr(folderPath, ':') == NULL)
|
||||
strcpy(tmpPath, "/");
|
||||
strcat(tmpPath, folderPath);
|
||||
strcat(tmpPath, "/");
|
||||
strcpy(folderPath, tmpPath);
|
||||
_refreshExplorer();
|
||||
}
|
||||
else
|
||||
@ -295,7 +299,7 @@ void CMenu::_refreshExplorer(s8 direction)
|
||||
}
|
||||
m_btnMgr.setText(entries[0], L". . .");
|
||||
wstringEx path(_t("cfgne36", L"Path ="));
|
||||
path.append(wfmt(L" %.48s", folderPath.c_str()));
|
||||
path.append(wfmt(L" %.48s", folderPath));
|
||||
m_btnMgr.setText(m_explorerLblSelFolder, path, true);
|
||||
|
||||
if(direction == 0)
|
||||
@ -400,11 +404,11 @@ void CMenu::_refreshExplorer(s8 direction)
|
||||
m_btnMgr.show(m_explorerBtnPageP);
|
||||
}
|
||||
|
||||
string CMenu::_FolderExplorer(void)
|
||||
const char *CMenu::_FolderExplorer(void)
|
||||
{
|
||||
folderExplorer = true;
|
||||
path = "";
|
||||
//path = "";
|
||||
_Explorer();
|
||||
folderExplorer = false;
|
||||
return path;
|
||||
return folderPath;
|
||||
}
|
||||
|
@ -374,18 +374,19 @@ int CMenu::_NandEmuCfg(void)
|
||||
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandFolder)))
|
||||
{
|
||||
_hideNandEmu(true);
|
||||
path = _FolderExplorer();
|
||||
if(!path.empty())
|
||||
const char *path = _FolderExplorer();
|
||||
if(strlen(path) > 0)
|
||||
{
|
||||
if(path.find("sd:/") != string::npos)
|
||||
if(strncmp(path, "sd:/", 4) == 0)
|
||||
m_cfg.setInt(CHANNEL_DOMAIN, "partition", 0);
|
||||
else
|
||||
{
|
||||
const char *partval = &path[3];
|
||||
m_cfg.setInt(CHANNEL_DOMAIN, "partition", atoi(partval));
|
||||
}
|
||||
path = path.erase(0,path.find_first_of("/"));
|
||||
m_cfg.setString(CHANNEL_DOMAIN, "path", path);
|
||||
char tmpPath[MAX_FAT_PATH];
|
||||
strncpy(tmpPath, strchr(path, '/'), MAX_FAT_PATH-1);
|
||||
m_cfg.setString(CHANNEL_DOMAIN, "path", tmpPath);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
|
||||
}
|
||||
_showNandEmu();
|
||||
@ -393,18 +394,19 @@ int CMenu::_NandEmuCfg(void)
|
||||
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSavesFolder)))
|
||||
{
|
||||
_hideNandEmu(true);
|
||||
path = _FolderExplorer();
|
||||
if(!path.empty())
|
||||
const char *path = _FolderExplorer();
|
||||
if(strlen(path) > 0)
|
||||
{
|
||||
if(path.find("sd:/") != string::npos)
|
||||
if(strncmp(path, "sd:/", 4) == 0)
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", 0);
|
||||
else
|
||||
{
|
||||
const char *partval = &path[3];
|
||||
m_cfg.setInt(WII_DOMAIN, "savepartition", atoi(partval));
|
||||
}
|
||||
path = path.erase(0,path.find_first_of("/"));
|
||||
m_cfg.setString(WII_DOMAIN, "savepath", path);
|
||||
char tmpPath[MAX_FAT_PATH];
|
||||
strncpy(tmpPath, strchr(path, '/'), MAX_FAT_PATH-1);
|
||||
m_cfg.setString(WII_DOMAIN, "savepath", tmpPath);
|
||||
}
|
||||
_showNandEmu();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user