-updated the file explorer filetype handling, you can now boot ".elf" and ".dol" files and read text files with the extensions ".txt", ".ini", ".cfg", ".nfo", ".conf" and ".xml"

This commit is contained in:
fix94.1 2013-08-05 20:58:26 +00:00
parent c8673083f9
commit 45400dd879
4 changed files with 46 additions and 3 deletions

View File

@ -127,6 +127,9 @@ CMenu::CMenu()
m_use_source = true;
m_clearCats = true;
m_catStartPage = 1;
/* Explorer stuff */
m_txt_view = false;
m_txt_path = NULL;
}
void CMenu::init()

View File

@ -116,6 +116,10 @@ private:
string m_DMLgameDir;
string m_helpDir;
/* Explorer stuff */
bool m_txt_view;
const char *m_txt_path;
/* Updates */
char m_app_update_drive[6];
const char* m_app_update_url;

View File

@ -81,6 +81,7 @@ void CMenu::_showAbout(void)
{
_setBg(m_aboutBg, m_aboutBg);
m_btnMgr.show(m_aboutLblTitle);
if(m_txt_view == false)
m_btnMgr.show(m_aboutLblIOS);
m_btnMgr.show(m_aboutLblInfo,false);
for(u8 i = 0; i < ARRAY_SIZE(m_aboutLblUser); ++i)
@ -107,7 +108,24 @@ void CMenu::_initAboutMenu()
void CMenu::_textAbout(void)
{
if(showHelp)
if(m_txt_view)
{
wstringEx txt_file_name;
txt_file_name.fromUTF8(strrchr(m_txt_path, '/') + 1);
m_btnMgr.setText(m_aboutLblTitle, txt_file_name);
wstringEx txt_file_content;
u32 txt_size = 0;
char *txt_mem = (char*)fsop_ReadFile(m_txt_path, &txt_size);
if(txt_mem != NULL)
{
txt_file_content.fromUTF8(txt_mem);
m_btnMgr.setText(m_aboutLblInfo, txt_file_content);
free(txt_mem);
}
txt_mem = NULL;
return; /* no need for ios checks */
}
else if(showHelp)
{
m_btnMgr.setText(m_aboutLblTitle, _t("about10", L"Help Guide"));
wstringEx help_text;

View File

@ -228,6 +228,24 @@ void CMenu::_Explorer(void)
}
_showExplorer();
}
else if(strcasestr(file, ".dol") != NULL || strcasestr(file, ".elf") != NULL)
{
_hideExplorer();
_launchHomebrew(file, m_homebrewArgs);
_showExplorer();
}
else if(strcasestr(file, ".txt") != NULL || strcasestr(file, ".nfo") != NULL
|| strcasestr(file, ".ini") != NULL || strcasestr(file, ".conf") != NULL
|| strcasestr(file, ".cfg") != NULL || strcasestr(file, ".xml") != NULL)
{
_hideExplorer();
m_txt_view = true;
m_txt_path = file;
_about(false);
m_txt_view = false;
m_txt_path = NULL;
_showExplorer();
}
else if(strcasestr(file, ".wad") != NULL)
{
_hideExplorer();