2012-10-03 23:34:37 +02:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2012-05-11 16:17:39 +02:00
|
|
|
#include "menu.hpp"
|
2012-05-19 23:55:58 +02:00
|
|
|
#include "defines.h"
|
|
|
|
|
2012-06-22 15:09:31 +02:00
|
|
|
extern const u8 btnchannel_png[];
|
|
|
|
extern const u8 btnchannels_png[];
|
|
|
|
extern const u8 btnusb_png[];
|
|
|
|
extern const u8 btnusbs_png[];
|
|
|
|
extern const u8 btndml_png[];
|
|
|
|
extern const u8 btndmls_png[];
|
|
|
|
extern const u8 btnemu_png[];
|
|
|
|
extern const u8 btnemus_png[];
|
|
|
|
extern const u8 btnhomebrew_png[];
|
|
|
|
extern const u8 btnhomebrews_png[];
|
2012-08-06 15:48:57 +02:00
|
|
|
extern const u8 favoriteson_png[];
|
|
|
|
extern const u8 favoritesons_png[];
|
2012-06-22 15:09:31 +02:00
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
// Source menu
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_sourceLblNotice;
|
|
|
|
s16 m_sourceLblPage;
|
|
|
|
s16 m_sourceBtnPageM;
|
|
|
|
s16 m_sourceBtnPageP;
|
2013-01-15 14:54:33 +01:00
|
|
|
s16 m_sourceBtnBack;
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_sourceLblTitle;
|
|
|
|
s16 m_sourceBtnSource[12];
|
|
|
|
s16 m_sourceLblUser[4];
|
|
|
|
s16 m_sourceBtnDML;
|
|
|
|
s16 m_sourceBtnEmu;
|
|
|
|
s16 m_sourceBtnUsb;
|
|
|
|
s16 m_sourceBtnChannel;
|
|
|
|
s16 m_sourceBtnHomebrew;
|
2012-05-11 16:17:39 +02:00
|
|
|
|
2013-07-23 15:14:51 +02:00
|
|
|
TexData m_sourceBg;
|
|
|
|
|
2013-09-21 18:33:16 +02:00
|
|
|
bool exitSource = false;
|
2013-07-29 23:06:50 +02:00
|
|
|
u8 sourceBtn;
|
|
|
|
u8 selectedBtns;
|
|
|
|
int source_curPage;
|
|
|
|
int source_Pages;
|
|
|
|
string themeName;
|
2013-07-23 15:14:51 +02:00
|
|
|
vector<string> magicNums;
|
2013-09-12 15:04:50 +02:00
|
|
|
char btn_selected[256];
|
2013-07-23 15:14:51 +02:00
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
void CMenu::_hideSource(bool instant)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.hide(m_sourceLblTitle, instant);
|
|
|
|
m_btnMgr.hide(m_sourceLblNotice, instant);
|
|
|
|
m_btnMgr.hide(m_sourceLblPage, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnPageM, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnPageP, instant);
|
2013-01-15 14:54:33 +01:00
|
|
|
m_btnMgr.hide(m_sourceBtnBack, instant);
|
2012-06-22 15:09:31 +02:00
|
|
|
m_btnMgr.hide(m_sourceBtnHomebrew, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnChannel, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnUsb, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnDML, instant);
|
|
|
|
m_btnMgr.hide(m_sourceBtnEmu, instant);
|
|
|
|
|
2013-07-29 23:06:50 +02:00
|
|
|
u8 i;
|
|
|
|
for(i = 0; i < ARRAY_SIZE(m_sourceLblUser); ++i)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-09-13 16:54:17 +02:00
|
|
|
if(m_sourceLblUser[i] != -1)
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.hide(m_sourceLblUser[i], instant);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2013-07-29 23:06:50 +02:00
|
|
|
for(i = 0; i < 12; ++i)
|
2012-11-30 21:54:02 +01:00
|
|
|
{
|
2012-08-21 16:30:42 +02:00
|
|
|
m_btnMgr.hide(m_sourceBtnSource[i], instant);
|
2012-11-30 21:54:02 +01:00
|
|
|
m_btnMgr.freeBtnTexture(m_sourceBtnSource[i]);
|
|
|
|
}
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
void CMenu::_showSource(void)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-05-25 16:21:43 +02:00
|
|
|
_setBg(m_sourceBg, m_sourceBg);
|
2013-07-29 23:06:50 +02:00
|
|
|
|
2013-07-23 15:14:51 +02:00
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_sourceLblUser); ++i)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-09-13 16:54:17 +02:00
|
|
|
if(m_sourceLblUser[i] != -1)
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.show(m_sourceLblUser[i]);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.show(m_sourceLblTitle);
|
2013-01-15 14:54:33 +01:00
|
|
|
m_btnMgr.show(m_sourceBtnBack);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
void CMenu::_updateSourceBtns(void)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
if (source_Pages > 1)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
m_btnMgr.setText(m_sourceLblPage, wfmt(L"%i / %i", source_curPage, source_Pages));
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.show(m_sourceLblPage);
|
|
|
|
m_btnMgr.show(m_sourceBtnPageM);
|
|
|
|
m_btnMgr.show(m_sourceBtnPageP);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2012-05-18 18:02:36 +02:00
|
|
|
|
2012-11-30 21:54:02 +01:00
|
|
|
const char *ImgName = NULL;
|
2013-06-27 16:29:40 +02:00
|
|
|
const char *ImgSelName = NULL;
|
2013-07-29 23:06:50 +02:00
|
|
|
u8 j = (source_curPage - 1) * 12;
|
|
|
|
sourceBtn = 0;
|
|
|
|
selectedBtns = 0;
|
2013-08-15 14:26:44 +02:00
|
|
|
for(u8 i = 0; i < ((source_Pages - 1) * 12 + 12); ++i)
|
2012-08-06 15:48:57 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
if(i < 12)
|
|
|
|
m_btnMgr.hide(m_sourceBtnSource[i], true);
|
|
|
|
string btnSource = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
2013-07-23 15:14:51 +02:00
|
|
|
|
|
|
|
if(btnSource == "")
|
|
|
|
continue;
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(m_multisource == false)
|
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
2013-01-18 22:40:55 +01:00
|
|
|
else if(btnSource == "allplugins")
|
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
2013-01-19 22:41:05 +01:00
|
|
|
if(EnabledPlugins.size() == 0)
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
sourceBtn = i;
|
2013-07-29 23:06:50 +02:00
|
|
|
selectedBtns++;
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-01-19 22:41:05 +01:00
|
|
|
else
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
2013-01-18 22:40:55 +01:00
|
|
|
}
|
|
|
|
else if(btnSource == "plugin")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-01-19 22:41:05 +01:00
|
|
|
magicNums.clear();
|
2013-08-15 14:26:44 +02:00
|
|
|
magicNums = m_source.getStrings(fmt("BUTTON_%i", i), "magic", ',');
|
2013-07-23 15:14:51 +02:00
|
|
|
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false) && m_cfg.getBool("PLUGIN", magicNums.at(0), false))
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
sourceBtn = i;
|
2013-07-29 23:06:50 +02:00
|
|
|
selectedBtns++;
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-01-15 14:54:33 +01:00
|
|
|
else
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
2013-07-23 15:14:51 +02:00
|
|
|
else if(btnSource == "realnand" || btnSource == "emunand")
|
2013-01-19 22:41:05 +01:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
2013-07-23 15:14:51 +02:00
|
|
|
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "realnand")
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
sourceBtn = i;
|
2013-07-29 23:06:50 +02:00
|
|
|
selectedBtns++;
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-07-23 15:14:51 +02:00
|
|
|
else if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && !m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "emunand")
|
2013-08-13 15:12:40 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
sourceBtn = i;
|
2013-08-13 15:12:40 +02:00
|
|
|
selectedBtns++;
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
2013-08-13 15:12:40 +02:00
|
|
|
}
|
2013-01-19 22:41:05 +01:00
|
|
|
}
|
2013-07-23 15:14:51 +02:00
|
|
|
else if(btnSource != "realnand" && btnSource != "emunand" && btnSource != "plugin" && btnSource != "allplugins")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-07-23 15:14:51 +02:00
|
|
|
string domain = (btnSource == "dml" ? GC_DOMAIN : (btnSource == "homebrew" ? HOMEBREW_DOMAIN : WII_DOMAIN));
|
2013-01-15 14:54:33 +01:00
|
|
|
if(m_cfg.getBool(domain, "source", false))
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
sourceBtn = i;
|
2013-07-29 23:06:50 +02:00
|
|
|
selectedBtns++;
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-01-15 14:54:33 +01:00
|
|
|
else
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
|
|
|
|
2013-08-15 14:26:44 +02:00
|
|
|
ImgSelName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
|
|
|
|
if(i >= j && i < (j + 12))
|
2012-08-06 15:48:57 +02:00
|
|
|
{
|
2013-08-15 14:26:44 +02:00
|
|
|
TexData texConsoleImg;
|
|
|
|
TexData texConsoleImgs;
|
|
|
|
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgName)) != TE_OK)
|
|
|
|
{
|
|
|
|
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
|
|
|
|
TexHandle.fromPNG(texConsoleImg, favoriteson_png);
|
|
|
|
}
|
|
|
|
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgSelName)) != TE_OK)
|
|
|
|
{
|
|
|
|
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgSelName)) != TE_OK)
|
|
|
|
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
|
|
|
|
}
|
|
|
|
m_btnMgr.setBtnTexture(m_sourceBtnSource[i - j], texConsoleImg, texConsoleImgs);
|
|
|
|
m_btnMgr.show(m_sourceBtnSource[i - j]);
|
2012-08-06 15:48:57 +02:00
|
|
|
}
|
|
|
|
}
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
void CMenu::_showSourceNotice(void)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
|
|
|
m_showtimer = 90;
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.show(m_sourceLblNotice);
|
2013-09-21 18:33:16 +02:00
|
|
|
exitSource = false;
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2013-09-12 15:04:50 +02:00
|
|
|
dir_discHdr sourceList;
|
|
|
|
void CMenu::_createSFList()
|
|
|
|
{
|
|
|
|
bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false);
|
|
|
|
bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false);
|
|
|
|
bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false);
|
|
|
|
bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false);
|
|
|
|
m_gameList.clear();
|
|
|
|
for(u8 i = 0; i < m_cfg.getInt("GENERAL", "max_source_buttons", 71); i++)
|
|
|
|
{
|
|
|
|
memset(btn_selected, 0, 256);
|
|
|
|
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
|
|
|
|
string source = m_source.getString(btn_selected, "source","");
|
|
|
|
if(source == "")
|
|
|
|
continue;
|
|
|
|
if(source == "dml" && !m_show_dml && !m_devo_installed)
|
|
|
|
continue;
|
|
|
|
else if(source == "emunand" && !show_channel)
|
|
|
|
continue;
|
|
|
|
else if(source == "homebrew" && (!show_homebrew || (!parental_homebrew && m_locked)))
|
|
|
|
continue;
|
|
|
|
else if((source == "plugin" || source == "allplugins") && !show_emu)
|
|
|
|
continue;
|
|
|
|
const char *path = fmt("%s/%s", m_sourceDir.c_str(), m_source.getString(btn_selected, "image", "").c_str());
|
|
|
|
memset((void*)&sourceList, 0, sizeof(dir_discHdr));
|
|
|
|
sourceList.index = m_gameList.size();
|
|
|
|
strncpy(sourceList.id, "SOURCE", 6);
|
|
|
|
strncpy(sourceList.path, path, sizeof(sourceList.path) - 1);
|
|
|
|
sourceList.casecolor = 0xFFFFFF;
|
|
|
|
sourceList.type = TYPE_SOURCE;
|
|
|
|
sourceList.settings[0] = i;
|
|
|
|
const char *title = m_source.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
|
|
|
|
mbstowcs(sourceList.title, title, 63);
|
|
|
|
Asciify(sourceList.title);
|
|
|
|
m_gameList.push_back(sourceList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_sourceFlow()
|
|
|
|
{
|
|
|
|
u8 numPlugins = 0, k;
|
|
|
|
if(!m_cfg.getBool(PLUGIN_DOMAIN, "disable", false))
|
|
|
|
{
|
|
|
|
Config m_plugin_cfg;
|
|
|
|
DIR *pdir;
|
|
|
|
struct dirent *pent;
|
|
|
|
pdir = opendir(m_pluginsDir.c_str());
|
|
|
|
while((pent = readdir(pdir)) != NULL)
|
|
|
|
{
|
|
|
|
if(pent->d_name[0] == '.'|| strcasecmp(pent->d_name, "scummvm.ini") == 0)
|
|
|
|
continue;
|
|
|
|
if(strcasestr(pent->d_name, ".ini") != NULL)
|
|
|
|
{
|
|
|
|
m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
|
|
|
if (m_plugin_cfg.loaded())
|
|
|
|
{
|
|
|
|
numPlugins++;
|
|
|
|
m_plugin.AddPlugin(m_plugin_cfg);
|
|
|
|
}
|
|
|
|
m_plugin_cfg.unload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(pdir);
|
|
|
|
m_plugin.EndAdd();
|
|
|
|
}
|
|
|
|
const dir_discHdr *hdr = CoverFlow.getHdr();
|
2013-09-24 23:24:03 +02:00
|
|
|
if(m_cfg.getBool("SOURCEFLOW", "remember_last_item", true))
|
|
|
|
m_cfg.setString("SOURCEFLOW", "current_item", strrchr(hdr->path, '/') + 1);
|
|
|
|
else
|
|
|
|
m_cfg.remove("SOURCEFLOW", "current_item");
|
|
|
|
|
2013-09-12 15:04:50 +02:00
|
|
|
memset(btn_selected, 0, 256);
|
|
|
|
strncpy(btn_selected, fmt("BUTTON_%i", hdr->settings[0]), 255);
|
|
|
|
string source = m_source.getString(btn_selected, "source", "");
|
|
|
|
_clearSources();
|
|
|
|
if(source == "wii")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_USB;
|
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
|
|
|
else if(source == "dml")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_DML;
|
|
|
|
m_cfg.setBool(GC_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
|
|
|
else if(source == "emunand")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_CHANNEL;
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
|
|
|
else if(source == "realnand")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_CHANNEL;
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
|
|
|
else if(source == "homebrew")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_HOMEBREW;
|
|
|
|
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
|
|
|
else if(source == "allplugins")
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_PLUGIN;
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
for(k = 0; k < numPlugins; ++k)
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, k, 2); /* force enable */
|
|
|
|
}
|
|
|
|
else if(source == "plugin")
|
|
|
|
{
|
|
|
|
magicNums.clear();
|
|
|
|
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
|
|
|
u32 plugin_magic_nums = magicNums.size();
|
|
|
|
if(plugin_magic_nums != 0)
|
|
|
|
{
|
|
|
|
m_current_view = COVERFLOW_PLUGIN;
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
|
|
|
for(k = 0; k < numPlugins; ++k)
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */
|
|
|
|
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
|
|
|
{
|
|
|
|
s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
|
|
|
|
if(exist >= 0)
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
|
|
|
|
if(plugin_magic_nums == 1)
|
|
|
|
{
|
|
|
|
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", itr->c_str(), 1);
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
int layout = m_source.getInt(btn_selected, "emuflow", 0);
|
|
|
|
if(layout > 0)
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
|
|
|
int category = m_source.getInt(btn_selected, "category", 0);
|
|
|
|
if(category > 0)
|
|
|
|
{
|
|
|
|
m_cat.remove("GENERAL", "selected_categories");
|
|
|
|
m_cat.remove("GENERAL", "required_categories");
|
|
|
|
char cCh = static_cast<char>(category + 32);
|
|
|
|
string newSelCats(1, cCh);
|
|
|
|
m_cat.setString("GENERAL", "selected_categories", newSelCats);
|
|
|
|
m_clearCats = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_sourceflow = false;
|
2013-10-21 17:32:37 +02:00
|
|
|
/* 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;
|
|
|
|
}
|
2013-09-12 15:04:50 +02:00
|
|
|
}
|
|
|
|
|
2012-06-21 14:25:47 +02:00
|
|
|
bool CMenu::_Source()
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-08-13 15:12:40 +02:00
|
|
|
CoverFlow.clear();
|
2013-07-29 23:06:50 +02:00
|
|
|
u8 i, j, k;
|
2012-11-04 20:22:02 +01:00
|
|
|
bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false);
|
2012-05-11 16:17:39 +02:00
|
|
|
bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false);
|
2012-11-04 20:22:02 +01:00
|
|
|
bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false);
|
|
|
|
bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false);
|
2013-07-29 23:06:50 +02:00
|
|
|
bool noChanges = true;
|
|
|
|
bool updateSource = false;
|
2013-09-21 18:33:16 +02:00
|
|
|
exitSource = false;
|
2013-07-29 23:06:50 +02:00
|
|
|
u8 numPlugins = 0;
|
2012-05-11 16:17:39 +02:00
|
|
|
m_showtimer = 0;
|
2013-07-29 23:06:50 +02:00
|
|
|
source_curPage = 1;
|
2013-08-16 02:33:31 +02:00
|
|
|
source_Pages = 1;
|
2013-07-29 23:06:50 +02:00
|
|
|
|
|
|
|
SetupInput();
|
2012-05-25 16:21:43 +02:00
|
|
|
_showSource();
|
2013-07-29 23:06:50 +02:00
|
|
|
bool sourceIniLoaded = m_source.loaded();
|
|
|
|
if(!sourceIniLoaded)
|
2012-06-22 15:09:31 +02:00
|
|
|
{
|
|
|
|
m_btnMgr.show(m_sourceBtnHomebrew);
|
|
|
|
m_btnMgr.show(m_sourceBtnChannel);
|
|
|
|
m_btnMgr.show(m_sourceBtnUsb);
|
|
|
|
m_btnMgr.show(m_sourceBtnDML);
|
|
|
|
m_btnMgr.show(m_sourceBtnEmu);
|
|
|
|
}
|
|
|
|
else
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
|
|
|
//set number of pages based on highest source btn number used
|
|
|
|
for(i = m_cfg.getInt("GENERAL", "max_source_buttons", 71); i > 11; --i)
|
|
|
|
{
|
|
|
|
string source = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
|
|
|
if (!source.empty())
|
|
|
|
{
|
|
|
|
source_Pages = (i / 12) + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(show_emu)
|
|
|
|
{
|
|
|
|
Config m_plugin_cfg;
|
|
|
|
DIR *pdir;
|
|
|
|
struct dirent *pent;
|
|
|
|
pdir = opendir(m_pluginsDir.c_str());
|
|
|
|
while((pent = readdir(pdir)) != NULL)
|
|
|
|
{
|
|
|
|
if(pent->d_name[0] == '.'|| strcasecmp(pent->d_name, "scummvm.ini") == 0)
|
|
|
|
continue;
|
|
|
|
if(strcasestr(pent->d_name, ".ini") != NULL)
|
|
|
|
{
|
|
|
|
m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
|
|
|
if (m_plugin_cfg.loaded())
|
|
|
|
{
|
|
|
|
numPlugins++;
|
|
|
|
m_plugin.AddPlugin(m_plugin_cfg);
|
|
|
|
}
|
|
|
|
m_plugin_cfg.unload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(pdir);
|
|
|
|
m_plugin.EndAdd();
|
|
|
|
}
|
2012-06-22 15:09:31 +02:00
|
|
|
_updateSourceBtns();
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2012-09-09 20:35:15 +02:00
|
|
|
|
|
|
|
while(!m_exit)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
updateSource = false;
|
2012-05-11 16:17:39 +02:00
|
|
|
_mainLoopCommon();
|
2013-07-29 23:06:50 +02:00
|
|
|
if(BTN_HOME_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack)) || (BTN_B_PRESSED))
|
2012-05-25 16:21:43 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
if(selectedBtns == 1)
|
|
|
|
{
|
|
|
|
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "cat_page", 1);
|
|
|
|
if(m_source.getString(fmt("BUTTON_%i", sourceBtn), "source") == "plugin")
|
|
|
|
{
|
|
|
|
int layout = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "emuflow", 0);
|
|
|
|
if(layout > 0)
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
|
|
|
int category = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "category", 0);
|
|
|
|
if(category > 0)
|
|
|
|
{
|
|
|
|
m_cat.remove("GENERAL", "selected_categories");
|
|
|
|
m_cat.remove("GENERAL", "required_categories");
|
|
|
|
char cCh = static_cast<char>(category + 32);
|
|
|
|
string newSelCats(1, cCh);
|
|
|
|
m_cat.setString("GENERAL", "selected_categories", newSelCats);
|
|
|
|
m_clearCats = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(selectedBtns == 0)
|
2013-01-15 14:54:33 +01:00
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", true);
|
2013-09-04 22:58:22 +02:00
|
|
|
|
2013-09-12 15:04:50 +02:00
|
|
|
vector<bool> plugin_list = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
|
|
if(enabledPluginsCount == 1)
|
|
|
|
{
|
|
|
|
u8 i = 0;
|
2013-09-15 16:29:14 +02:00
|
|
|
for(i = 0; i < plugin_list.size(); ++i)
|
2013-09-12 15:04:50 +02:00
|
|
|
{
|
|
|
|
if(plugin_list[i] == true)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
char PluginMagicWord[9];
|
|
|
|
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
|
|
|
|
strncpy(PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8);
|
|
|
|
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", PluginMagicWord, 1);
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
|
|
|
}
|
2013-08-15 14:26:44 +02:00
|
|
|
u8 sourceCount = 0;
|
|
|
|
if(m_cfg.getBool(WII_DOMAIN, "source", false))
|
|
|
|
sourceCount++;
|
|
|
|
if(m_cfg.getBool(GC_DOMAIN, "source", false))
|
|
|
|
sourceCount++;
|
|
|
|
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false))
|
|
|
|
sourceCount++;
|
|
|
|
if(m_cfg.getBool(HOMEBREW_DOMAIN, "source", false))
|
|
|
|
sourceCount++;
|
|
|
|
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false))
|
|
|
|
sourceCount++;
|
|
|
|
if(sourceCount > 1)
|
2013-08-13 15:12:40 +02:00
|
|
|
m_combined_view = true;
|
2012-05-11 16:17:39 +02:00
|
|
|
break;
|
2012-05-25 16:21:43 +02:00
|
|
|
}
|
2012-05-11 16:17:39 +02:00
|
|
|
else if(BTN_UP_PRESSED)
|
|
|
|
m_btnMgr.up();
|
|
|
|
else if(BTN_DOWN_PRESSED)
|
|
|
|
m_btnMgr.down();
|
2013-09-11 20:11:23 +02:00
|
|
|
else if(((BTN_LEFT_PRESSED || (!m_multisource && BTN_MINUS_PRESSED)) && source_Pages > 1)
|
2013-09-04 22:58:22 +02:00
|
|
|
|| (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
source_curPage--;
|
|
|
|
if(source_curPage < 1)
|
|
|
|
source_curPage = source_Pages;
|
2013-09-11 20:11:23 +02:00
|
|
|
if(!BTN_A_PRESSED)
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.click(m_sourceBtnPageM);
|
|
|
|
_updateSourceBtns();
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2013-09-11 20:11:23 +02:00
|
|
|
else if(((BTN_RIGHT_PRESSED || (!m_multisource && BTN_PLUS_PRESSED)) && source_Pages > 1)
|
2013-09-04 22:58:22 +02:00
|
|
|
|| (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
source_curPage++;
|
|
|
|
if(source_curPage > source_Pages)
|
|
|
|
source_curPage = 1;
|
2013-09-11 20:11:23 +02:00
|
|
|
if (!BTN_A_PRESSED)
|
2012-05-25 16:21:43 +02:00
|
|
|
m_btnMgr.click(m_sourceBtnPageP);
|
|
|
|
_updateSourceBtns();
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
else if(BTN_A_PRESSED && !sourceIniLoaded)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-01-15 14:54:33 +01:00
|
|
|
// check default source buttons when no source_menu.ini
|
2012-06-22 15:09:31 +02:00
|
|
|
if(m_btnMgr.selected(m_sourceBtnUsb))
|
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", true);
|
|
|
|
exitSource = true;
|
2012-06-22 15:09:31 +02:00
|
|
|
}
|
|
|
|
if(m_btnMgr.selected(m_sourceBtnDML))
|
|
|
|
{
|
2013-09-08 20:29:54 +02:00
|
|
|
if(!m_show_dml && !m_devo_installed)
|
|
|
|
_showSourceNotice();
|
2012-06-22 15:09:31 +02:00
|
|
|
else
|
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
m_cfg.setBool(GC_DOMAIN, "source", true);
|
|
|
|
exitSource = true;
|
2012-06-22 15:09:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(m_btnMgr.selected(m_sourceBtnChannel))
|
|
|
|
{
|
2013-09-08 20:29:54 +02:00
|
|
|
if(!show_channel)
|
|
|
|
_showSourceNotice();
|
2012-06-22 15:09:31 +02:00
|
|
|
else
|
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
|
|
|
exitSource = true;
|
2012-06-22 15:09:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(m_btnMgr.selected(m_sourceBtnHomebrew))
|
|
|
|
{
|
2013-09-08 20:29:54 +02:00
|
|
|
if(!show_homebrew || (!parental_homebrew && m_locked))
|
|
|
|
_showSourceNotice();
|
2012-06-22 15:09:31 +02:00
|
|
|
else
|
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
|
|
|
exitSource = true;
|
2012-06-22 15:09:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(m_btnMgr.selected(m_sourceBtnEmu))
|
|
|
|
{
|
2013-09-08 20:29:54 +02:00
|
|
|
if(!show_emu)
|
|
|
|
_showSourceNotice();
|
2012-06-22 15:09:31 +02:00
|
|
|
else
|
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
|
|
|
exitSource = true;
|
2012-06-22 15:09:31 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if((BTN_A_PRESSED || (BTN_PLUS_PRESSED && m_multisource)) && sourceIniLoaded)
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-01-15 14:54:33 +01:00
|
|
|
// check actual source menu buttons
|
2013-07-29 23:06:50 +02:00
|
|
|
j = (source_curPage - 1) * 12;
|
|
|
|
for(i = 0; i < 12; ++i)
|
2012-05-18 18:02:36 +02:00
|
|
|
{
|
2012-06-21 14:25:47 +02:00
|
|
|
if(m_btnMgr.selected(m_sourceBtnSource[i]))
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-09-06 02:25:36 +02:00
|
|
|
memset(btn_selected, 0, 256);
|
|
|
|
strncpy(btn_selected, fmt("BUTTON_%i", i + j), 255);
|
2013-09-04 22:58:22 +02:00
|
|
|
string source = m_source.getString(btn_selected, "source", "");
|
|
|
|
if(BTN_A_PRESSED)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2013-07-29 23:06:50 +02:00
|
|
|
_clearSources();
|
|
|
|
exitSource = true;
|
2013-09-04 22:58:22 +02:00
|
|
|
m_catStartPage = 1;
|
|
|
|
if(source == "wii")
|
2012-05-25 16:21:43 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
2012-05-25 16:21:43 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "dml")
|
2012-05-25 16:21:43 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(!m_show_dml && !m_devo_installed)
|
|
|
|
_showSourceNotice();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_cfg.setBool(GC_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
}
|
2012-05-25 16:21:43 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "emunand")
|
2012-05-25 16:21:43 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(!show_channel)
|
|
|
|
_showSourceNotice();
|
|
|
|
else
|
2012-05-25 16:21:43 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
2013-07-29 23:06:50 +02:00
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
2013-09-04 22:58:22 +02:00
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
2012-05-25 16:21:43 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
}
|
|
|
|
else if(source == "realnand")
|
|
|
|
{
|
|
|
|
if(!show_channel)
|
|
|
|
_showSourceNotice();
|
2013-07-29 23:06:50 +02:00
|
|
|
else
|
2012-12-25 20:09:41 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
2012-12-25 20:09:41 +01:00
|
|
|
}
|
2012-05-25 16:21:43 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "homebrew")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(!show_homebrew || (!parental_homebrew && m_locked))
|
|
|
|
_showSourceNotice();
|
|
|
|
else
|
2013-01-19 22:41:05 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
2013-01-19 22:41:05 +01:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
}
|
|
|
|
else if(source == "allplugins")
|
|
|
|
{
|
|
|
|
if(!show_emu)
|
|
|
|
_showSourceNotice();
|
2013-01-19 22:41:05 +01:00
|
|
|
else
|
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
for(k = 0; k < numPlugins; ++k)
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, k, 2); /* force enable */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(source == "plugin")
|
|
|
|
{
|
|
|
|
if(!show_emu)
|
|
|
|
_showSourceNotice();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
magicNums.clear();
|
|
|
|
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
2013-09-08 20:29:54 +02:00
|
|
|
u32 plugin_magic_nums = magicNums.size();
|
|
|
|
if(plugin_magic_nums != 0)
|
2013-09-04 22:58:22 +02:00
|
|
|
{
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
|
|
|
for(k = 0; k < numPlugins; ++k)
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */
|
|
|
|
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
|
|
|
{
|
|
|
|
s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
|
|
|
|
if(exist >= 0)
|
2013-09-08 20:29:54 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
|
2013-09-08 20:29:54 +02:00
|
|
|
if(plugin_magic_nums == 1)
|
|
|
|
{
|
|
|
|
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", itr->c_str(), 1);
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
|
|
|
int layout = m_source.getInt(btn_selected, "emuflow", 0);
|
|
|
|
if(layout > 0)
|
|
|
|
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
|
|
|
int category = m_source.getInt(btn_selected, "category", 0);
|
|
|
|
if(category > 0)
|
|
|
|
{
|
|
|
|
m_cat.remove("GENERAL", "selected_categories");
|
|
|
|
m_cat.remove("GENERAL", "required_categories");
|
|
|
|
char cCh = static_cast<char>(category + 32);
|
|
|
|
string newSelCats(1, cCh);
|
|
|
|
m_cat.setString("GENERAL", "selected_categories", newSelCats);
|
|
|
|
m_clearCats = false;
|
|
|
|
}
|
2013-01-19 22:41:05 +01:00
|
|
|
}
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
2013-10-19 17:31:08 +02:00
|
|
|
/* 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;
|
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
break;
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
updateSource = true;
|
|
|
|
if(source == "wii")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", !m_cfg.getBool(WII_DOMAIN, "source"));
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "dml")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(m_show_dml || m_devo_installed)
|
|
|
|
m_cfg.setBool(GC_DOMAIN, "source", !m_cfg.getBool(GC_DOMAIN, "source"));
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "emunand")
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(show_channel)
|
|
|
|
{
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", !m_cfg.getBool(CHANNEL_DOMAIN, "source"));
|
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "realnand")
|
2013-01-18 22:40:55 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(show_channel)
|
|
|
|
{
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", !m_cfg.getBool(CHANNEL_DOMAIN, "source"));
|
|
|
|
}
|
2013-01-18 22:40:55 +01:00
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
else if(source == "homebrew")
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
if(show_homebrew && (parental_homebrew || !m_locked))
|
|
|
|
m_cfg.setBool(HOMEBREW_DOMAIN, "source", !m_cfg.getBool(HOMEBREW_DOMAIN, "source"));
|
|
|
|
}
|
|
|
|
else if(source == "allplugins")
|
|
|
|
{
|
|
|
|
if(show_emu)
|
|
|
|
{
|
|
|
|
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
|
|
for(j = 0; m_plugin.PluginExist(j); ++j) /* opposite */
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, j, (enabledPluginsCount == 0) ? 2 : 1);
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", (enabledPluginsCount == 0) ? true : false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(source == "plugin")
|
|
|
|
{
|
|
|
|
if(show_emu)
|
|
|
|
{
|
|
|
|
magicNums.clear();
|
|
|
|
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
|
|
|
if(!magicNums.empty())
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
u32 cur_magic = strtoul(itr->c_str(), NULL, 16);
|
|
|
|
s8 exist = m_plugin.GetPluginPosition(cur_magic);
|
|
|
|
if(exist >= 0)
|
2013-07-29 23:06:50 +02:00
|
|
|
{
|
2013-09-04 22:58:22 +02:00
|
|
|
bool enabled = m_plugin.GetEnableStatus(m_cfg, cur_magic);
|
|
|
|
m_plugin.SetEnablePlugin(m_cfg, exist, enabled ? 1 : 2);
|
|
|
|
break;
|
2013-07-29 23:06:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 22:58:22 +02:00
|
|
|
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", enabledPluginsCount > 0 ? true : false);
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
break;
|
2013-01-15 14:54:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-29 23:06:50 +02:00
|
|
|
if(exitSource)
|
2013-01-15 14:54:33 +01:00
|
|
|
{
|
2013-08-13 15:12:40 +02:00
|
|
|
m_combined_view = false;
|
2013-07-29 23:06:50 +02:00
|
|
|
noChanges = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(updateSource)
|
|
|
|
{
|
|
|
|
noChanges = false;
|
2013-01-15 14:54:33 +01:00
|
|
|
_updateSourceBtns();
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2012-06-21 14:25:47 +02:00
|
|
|
if(m_showtimer > 0)
|
|
|
|
{
|
|
|
|
if(--m_showtimer == 0)
|
|
|
|
m_btnMgr.hide(m_sourceLblNotice);
|
|
|
|
}
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2012-05-25 16:21:43 +02:00
|
|
|
_hideSource(true);
|
2013-07-29 23:06:50 +02:00
|
|
|
return noChanges;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_clearSources(void)
|
|
|
|
{
|
|
|
|
m_cfg.setBool(WII_DOMAIN, "source", false);
|
|
|
|
m_cfg.setBool(GC_DOMAIN, "source", false);
|
|
|
|
m_cfg.setBool(CHANNEL_DOMAIN, "source", false);
|
|
|
|
m_cfg.setBool(HOMEBREW_DOMAIN, "source", false);
|
|
|
|
m_cfg.setBool(PLUGIN_DOMAIN, "source", false);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
void CMenu::_initSourceMenu()
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-12-28 15:19:40 +01:00
|
|
|
TexData texDML;
|
|
|
|
TexData texDMLs;
|
|
|
|
TexData texEmu;
|
|
|
|
TexData texEmus;
|
|
|
|
TexData texUsb;
|
|
|
|
TexData texUsbs;
|
|
|
|
TexData texChannel;
|
|
|
|
TexData texChannels;
|
|
|
|
TexData texHomebrew;
|
|
|
|
TexData texHomebrews;
|
2012-06-22 15:09:31 +02:00
|
|
|
|
2012-12-28 15:19:40 +01:00
|
|
|
TexHandle.fromPNG(texUsb, btnusb_png);
|
|
|
|
TexHandle.fromPNG(texUsbs, btnusbs_png);
|
|
|
|
TexHandle.fromPNG(texDML, btndml_png);
|
|
|
|
TexHandle.fromPNG(texDMLs, btndmls_png);
|
|
|
|
TexHandle.fromPNG(texEmu, btnemu_png);
|
|
|
|
TexHandle.fromPNG(texEmus, btnemus_png);
|
|
|
|
TexHandle.fromPNG(texChannel, btnchannel_png);
|
|
|
|
TexHandle.fromPNG(texChannels, btnchannels_png);
|
|
|
|
TexHandle.fromPNG(texHomebrew, btnhomebrew_png);
|
|
|
|
TexHandle.fromPNG(texHomebrews, btnhomebrews_png);
|
2012-06-22 15:09:31 +02:00
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
_addUserLabels(m_sourceLblUser, ARRAY_SIZE(m_sourceLblUser), "SOURCE");
|
|
|
|
m_sourceBg = _texture("SOURCE/BG", "texture", theme.bg, false);
|
2013-11-04 20:46:23 +01:00
|
|
|
m_sourceLblTitle = _addTitle("SOURCE/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
2012-11-03 20:16:03 +01:00
|
|
|
m_sourceLblNotice = _addLabel("SOURCE/NOTICE", theme.btnFont, L"", 20, 400, 600, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
|
2013-11-04 20:46:23 +01:00
|
|
|
m_sourceLblPage = _addLabel("SOURCE/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
|
|
|
m_sourceBtnPageM = _addPicButton("SOURCE/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 48, 48);
|
|
|
|
m_sourceBtnPageP = _addPicButton("SOURCE/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 172, 400, 48, 48);
|
|
|
|
m_sourceBtnBack = _addButton("SOURCE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
|
2013-09-03 15:48:30 +02:00
|
|
|
|
|
|
|
m_sourceBtnChannel = _addPicButton("SOURCE/CHANNEL_BTN", texChannel, texChannels, 265, 260, 48, 48);
|
|
|
|
m_sourceBtnHomebrew = _addPicButton("SOURCE/HOMEBREW_BTN", texHomebrew, texHomebrews, 325, 260, 48, 48);
|
|
|
|
m_sourceBtnUsb = _addPicButton("SOURCE/USB_BTN", texUsb, texUsbs, 235, 200, 48, 48);
|
|
|
|
m_sourceBtnDML = _addPicButton("SOURCE/DML_BTN", texDML, texDMLs, 295, 200, 48, 48);
|
|
|
|
m_sourceBtnEmu = _addPicButton("SOURCE/EMU_BTN", texEmu, texEmus, 355, 200, 48, 48);
|
2013-01-15 14:54:33 +01:00
|
|
|
|
2013-07-29 23:06:50 +02:00
|
|
|
themeName = m_cfg.getString("GENERAL", "theme", "default");
|
|
|
|
if(!m_source.load(fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), SOURCE_FILENAME)))
|
2013-09-12 15:04:50 +02:00
|
|
|
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME));
|
|
|
|
else
|
|
|
|
m_sourceDir = fmt("%s/%s", m_sourceDir.c_str(), themeName.c_str());
|
2012-08-06 15:48:57 +02:00
|
|
|
|
2012-05-18 18:02:36 +02:00
|
|
|
int row;
|
|
|
|
int col;
|
2012-05-25 16:21:43 +02:00
|
|
|
string ImgName;
|
2012-05-18 18:02:36 +02:00
|
|
|
|
2012-11-11 19:28:03 +01:00
|
|
|
for(u8 i = 0; i < 12; ++i)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-12-28 15:19:40 +01:00
|
|
|
TexData texConsoleImg;
|
|
|
|
TexData texConsoleImgs;
|
2012-08-06 15:48:57 +02:00
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "");
|
2012-12-28 15:19:40 +01:00
|
|
|
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
|
2012-08-06 15:48:57 +02:00
|
|
|
{
|
2012-12-28 15:19:40 +01:00
|
|
|
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
|
|
|
|
TexHandle.fromPNG(texConsoleImg, favoriteson_png);
|
2012-08-06 15:48:57 +02:00
|
|
|
}
|
|
|
|
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "");
|
2012-12-28 15:19:40 +01:00
|
|
|
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
|
2012-08-06 15:48:57 +02:00
|
|
|
{
|
2012-12-28 15:19:40 +01:00
|
|
|
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
|
|
|
|
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
|
2012-08-06 15:48:57 +02:00
|
|
|
}
|
2012-05-25 16:21:43 +02:00
|
|
|
|
2012-08-06 15:48:57 +02:00
|
|
|
row = i / 4;
|
|
|
|
col = i - (row * 4);
|
2013-11-04 20:46:23 +01:00
|
|
|
m_sourceBtnSource[i] = _addPicButton(fmt("SOURCE/SOURCE_BTN_%i", i), texConsoleImg, texConsoleImgs, (100 + 120 * col), (90 + 100 * row), 80, 80);
|
|
|
|
_setHideAnim(m_sourceBtnSource[i], fmt("SOURCE/SOURCE_BTN_%i", i), 0, 0, -2.f, 0.f);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
2012-06-22 15:09:31 +02:00
|
|
|
_setHideAnim(m_sourceBtnChannel, "SOURCE/CHANNEL_BTN", 0, 40, 0.f, 0.f);
|
|
|
|
_setHideAnim(m_sourceBtnHomebrew, "SOURCE/HOMEBREW_BTN", 0, 40, 0.f, 0.f);
|
|
|
|
_setHideAnim(m_sourceBtnUsb, "SOURCE/USB_BTN", 0, 40, 0.f, 0.f);
|
|
|
|
_setHideAnim(m_sourceBtnDML, "SOURCE/DML_BTN", 0, 40, 0.f, 0.f);
|
|
|
|
_setHideAnim(m_sourceBtnEmu, "SOURCE/EMU_BTN", 0, 40, 0.f, 0.f);
|
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
|
|
|
_setHideAnim(m_sourceLblTitle, "SOURCE/TITLE", 0, 0, -2.f, 0.f);
|
2012-05-25 16:21:43 +02:00
|
|
|
_setHideAnim(m_sourceLblNotice, "SOURCE/NOTICE", 0, 0, 1.f, 0.f);
|
2013-11-04 20:46:23 +01:00
|
|
|
_setHideAnim(m_sourceLblPage, "SOURCE/PAGE_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_sourceBtnPageM, "SOURCE/PAGE_MINUS", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_sourceBtnPageP, "SOURCE/PAGE_PLUS", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_sourceBtnBack, "SOURCE/BACK_BTN", 0, 0, 1.f, -1.f);
|
2012-05-18 18:02:36 +02:00
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
_textSource();
|
|
|
|
_hideSource(true);
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:21:43 +02:00
|
|
|
void CMenu::_textSource(void)
|
2012-05-11 16:17:39 +02:00
|
|
|
{
|
2012-06-18 00:12:03 +02:00
|
|
|
m_btnMgr.setText(m_sourceLblTitle, _t("stup1", L"Select Source"));
|
2013-07-23 15:14:51 +02:00
|
|
|
m_btnMgr.setText(m_sourceLblNotice, _t("stup2", L"** DISABLED **"));
|
2013-01-15 14:54:33 +01:00
|
|
|
m_btnMgr.setText(m_sourceBtnBack, _t("cfg10", L"Back"));
|
2012-05-11 16:17:39 +02:00
|
|
|
}
|