-added experimental autoboot function for source menu buttons, just add

autoboot=ID
for channel, wii and gc game buttons or
autoboot=TITLE
for plugin and homebrew buttons.
Replace ID/TITLE with the game ID/Title you want to boot when clicking on the button of course.
This commit is contained in:
fix94.1 2013-10-19 15:31:08 +00:00
parent 8cd9dfbfef
commit b86a95e517
4 changed files with 74 additions and 0 deletions

View File

@ -156,6 +156,8 @@ CMenu::CMenu()
m_init_ftp = false; m_init_ftp = false;
/* screensaver */ /* screensaver */
no_input_time = 0; no_input_time = 0;
/* Autoboot stuff */
m_source_autoboot = false;
} }
void CMenu::init() void CMenu::init()

View File

@ -1040,6 +1040,8 @@ private:
public: public:
void directlaunch(const char *GameID); void directlaunch(const char *GameID);
private: private:
dir_discHdr m_autoboot_hdr;
bool m_source_autoboot;
bool m_use_wifi_gecko; bool m_use_wifi_gecko;
bool m_use_sd_logging; bool m_use_sd_logging;
bool init_network; bool init_network;

View File

@ -199,6 +199,42 @@ void CMenu::LoadView(void)
_createSFList(); _createSFList();
else else
_loadList(); _loadList();
if(m_source_autoboot == true)
{ /* search for the requested file */
bool game_found = false;
for(vector<dir_discHdr>::iterator element = m_gameList.begin(); element != m_gameList.end(); ++element)
{
switch(m_autoboot_hdr.type)
{
case TYPE_CHANNEL:
case TYPE_WII_GAME:
case TYPE_GC_GAME:
if(strcmp(m_autoboot_hdr.id, element->id) == 0)
game_found = true;
break;
case TYPE_HOMEBREW:
case TYPE_PLUGIN:
if(wcsncmp(m_autoboot_hdr.title, element->title, 63) == 0)
game_found = true;
break;
default:
break;
}
if(game_found == true)
{
memcpy(&m_autoboot_hdr, &(*(element)), sizeof(dir_discHdr));
break;
}
}
if(game_found == true)
{
gprintf("Game found, autobooting...\n");
_launch(&m_autoboot_hdr);
}
/* fail */
m_source_autoboot = false;
}
_showMain(); _showMain();
_initCF(); _initCF();
_loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1)); _loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1));

View File

@ -670,6 +670,40 @@ bool CMenu::_Source()
} }
} }
} }
/* autoboot */
const char *autoboot = m_source.getString(btn_selected, "autoboot", "").c_str();
if(autoboot != NULL && autoboot[0] != '\0')
{
m_source_autoboot = true;
memset(&m_autoboot_hdr, 0, sizeof(dir_discHdr));
if(source == "emunand" || source == "realnand")
{
m_autoboot_hdr.type = TYPE_CHANNEL;
memcpy(m_autoboot_hdr.id, autoboot, 4);
}
else if(source == "wii")
{
m_autoboot_hdr.type = TYPE_WII_GAME;
memcpy(m_autoboot_hdr.id, autoboot, 6);
}
else if(source == "dml")
{
m_autoboot_hdr.type = TYPE_GC_GAME;
memcpy(m_autoboot_hdr.id, autoboot, 6);
}
else if(source == "homebrew")
{
m_autoboot_hdr.type = TYPE_HOMEBREW;
mbstowcs(m_autoboot_hdr.title, autoboot, 63);
}
else if(source == "plugin")
{
m_autoboot_hdr.type = TYPE_PLUGIN;
mbstowcs(m_autoboot_hdr.title, autoboot, 63);
}
else
m_source_autoboot = false;
}
break; break;
} }
else else