- now if using homebrew plugin you can use favorites and categories. normal homebrew does not.

This commit is contained in:
Fledge68 2019-02-11 14:55:44 -06:00
parent fbe1de2f4a
commit 26a978736c
11 changed files with 171 additions and 175 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -2798,24 +2798,16 @@ void CCoverFlow::_dropHQLOD(int i)
m_items[i].texture = newTex; m_items[i].texture = newTex;
} }
const char *CCoverFlow::getFilenameId(const dir_discHdr *curHdr, bool extension) const char *CCoverFlow::getFilenameId(const dir_discHdr *curHdr)
{ {
const char *NameOrID = NULL;
if(NoGameID(curHdr->type)) if(NoGameID(curHdr->type))
{ {
if(strrchr(curHdr->path, '/') != NULL) if(strrchr(curHdr->path, '/') != NULL)
{ return strrchr(curHdr->path, '/') + 1;// app folder or rom name.ext
if(curHdr->type == TYPE_HOMEBREW || extension)
NameOrID = strrchr(curHdr->path, '/') + 1;//returns title.ext or folder name for app
else // plugin and sourceflow
NameOrID = fmt("%ls", curHdr->title);// title without extension in lowercase
}
else else
NameOrID = curHdr->path;//title for scummvm return curHdr->path;// title for scummvm
} }
else return curHdr->id;// ID for Wii, GC, & Channels
NameOrID = curHdr->id;// ID for Wii, GC, & Channels
return NameOrID;
} }
CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover) CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover)

View File

@ -135,7 +135,7 @@ public:
const dir_discHdr * getSpecificHdr(u32) const; const dir_discHdr * getSpecificHdr(u32) const;
wstringEx getTitle(void) const; wstringEx getTitle(void) const;
u64 getChanTitle(void) const; u64 getChanTitle(void) const;
const char *getFilenameId(const dir_discHdr *curHdr, bool extension = true); const char *getFilenameId(const dir_discHdr *curHdr);
// //
bool getRenderTex(void); bool getRenderTex(void);
void setRenderTex(bool); void setRenderTex(bool);

View File

@ -1,6 +1,7 @@
#include "fanart.hpp" #include "fanart.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "types.h"
using namespace std; using namespace std;
@ -29,20 +30,30 @@ void CFanart::unload()
} }
char fanartDir[164]; char fanartDir[164];
bool CFanart::load(Config &m_wiiflowConfig, const char *path, const char *id, bool plugin_rom) bool CFanart::load(Config &m_wiiflowConfig, const char *path, const dir_discHdr *hdr)
{ {
bool retval = false;
if(!m_wiiflowConfig.getBool("FANART", "enable_fanart", true)) if(!m_wiiflowConfig.getBool("FANART", "enable_fanart", true))
return retval; return false;
unload(); unload();
char id[64];
memset(id, 0, sizeof(id));
if(NoGameID(hdr->type))
{
if(strrchr(hdr->path, '/') != NULL)
wcstombs(id, hdr->title, sizeof(id) - 1);
else
strncpy(id, hdr->path, sizeof(id) - 1);// scummvm
}
else
strcpy(id, hdr->id);
fanartDir[163] = '\0'; fanartDir[163] = '\0';
strncpy(fanartDir, fmt("%s/%s", path, id), 163); strncpy(fanartDir, fmt("%s/%s", path, id), 163);
TexErr texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir)); TexErr texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir));
if(texErr == TE_ERROR && !plugin_rom) if(texErr == TE_ERROR && !NoGameID(hdr->type))
{ {
strncpy(fanartDir, fmt("%s/%.3s", path, id), 163); strncpy(fanartDir, fmt("%s/%.3s", path, id), 163);
texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir)); texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir));
@ -53,14 +64,14 @@ bool CFanart::load(Config &m_wiiflowConfig, const char *path, const char *id, bo
faConfig_Path[163] = '\0'; faConfig_Path[163] = '\0';
strncpy(faConfig_Path, fmt("%s/%s.ini", fanartDir, id), 163); strncpy(faConfig_Path, fmt("%s/%s.ini", fanartDir, id), 163);
m_faConfig.load(faConfig_Path); m_faConfig.load(faConfig_Path);
if(!m_faConfig.loaded() && !plugin_rom) if(!m_faConfig.loaded() && !NoGameID(hdr->type))
{ {
strncpy(faConfig_Path, fmt("%s/%.3s.ini", fanartDir, id), 163); strncpy(faConfig_Path, fmt("%s/%.3s.ini", fanartDir, id), 163);
m_faConfig.load(faConfig_Path); m_faConfig.load(faConfig_Path);
if(!m_faConfig.loaded()) if(!m_faConfig.loaded())
{ {
TexHandle.Cleanup(m_bg); TexHandle.Cleanup(m_bg);
return retval; return false;
} }
} }
TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", fanartDir)); TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", fanartDir));
@ -70,12 +81,11 @@ bool CFanart::load(Config &m_wiiflowConfig, const char *path, const char *id, bo
if (elm.IsValid()) m_elms.push_back(elm); if (elm.IsValid()) m_elms.push_back(elm);
} }
m_loaded = true; m_loaded = true;
retval = true;
m_defaultDelay = m_wiiflowConfig.getInt("FANART", "delay_after_animation", 200); m_defaultDelay = m_wiiflowConfig.getInt("FANART", "delay_after_animation", 200);
m_delayAfterAnimation = m_faConfig.getInt("GENERAL", "delay_after_animation", m_defaultDelay); m_delayAfterAnimation = m_faConfig.getInt("GENERAL", "delay_after_animation", m_defaultDelay);
m_globalShowCoverAfterAnimation = m_wiiflowConfig.getOptBool("FANART", "show_cover_after_animation", 2); m_globalShowCoverAfterAnimation = m_wiiflowConfig.getOptBool("FANART", "show_cover_after_animation", 2);
} }
return retval; return true;
} }
void CFanart::getBackground(const TexData * &hq, const TexData * &lq) void CFanart::getBackground(const TexData * &hq, const TexData * &lq)

View File

@ -9,6 +9,7 @@
#include "gui.hpp" #include "gui.hpp"
#include "texture.hpp" #include "texture.hpp"
#include "config/config.hpp" #include "config/config.hpp"
#include "loader/disc.h"
class CFanartElement class CFanartElement
{ {
@ -58,7 +59,7 @@ public:
~CFanart(void); ~CFanart(void);
void unload(); void unload();
bool load(Config &m_wiiflowConfig, const char *path, const char *id, bool plugin_rom); bool load(Config &m_wiiflowConfig, const char *path, const dir_discHdr *hdr);
bool isAnimationComplete(); bool isAnimationComplete();
bool isLoaded(); bool isLoaded();

View File

@ -1970,18 +1970,16 @@ void CMenu::_initCF(void)
u8 numReqCats = strlen(requiredCats); u8 numReqCats = strlen(requiredCats);
u8 numSelCats = strlen(selectedCats); u8 numSelCats = strlen(selectedCats);
u8 numHidCats = strlen(hiddenCats); u8 numHidCats = strlen(hiddenCats);
char id[74];
char catID[64];
for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr) for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr)
{ {
const char *id = NULL;
const char *catID = NULL;
const char *favDomain = "FAVORITES"; const char *favDomain = "FAVORITES";
const char *adultDomain = "ADULTONLY"; const char *adultDomain = "ADULTONLY";
char tmp1[74];//title plus magic# memset(id, 0, 74);
memset(tmp1, 0, 74); memset(catID, 0, 64);
char tmp2[64];
memset(tmp2, 0, 64);
if(m_sourceflow) if(m_sourceflow)
{ {
@ -1992,31 +1990,34 @@ void CMenu::_initCF(void)
strcat(tmp1, tmp2); strcat(tmp1, tmp2);
id = tmp1;*/ id = tmp1;*/
} }
if(hdr->type == TYPE_HOMEBREW) else if(m_current_view == COVERFLOW_HOMEBREW)
{ {
CoverFlow.addItem(&(*hdr), 0, 0); CoverFlow.addItem(&(*hdr), 0, 0);
continue; continue;
//id = strrchr(hdr->path, '/') + 1;
} }
if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_HOMEBREW)
{
wcstombs(id, hdr->title, 63);
strcpy(catID, id);
}
else if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
wcstombs(tmp2, hdr->title, 64); if(strrchr(hdr->path, '/') != NULL)
strcat(tmp1, m_plugin.PluginMagicWord); wcstombs(catID, hdr->title, 63);
strcat(tmp1, fmt("/%s", tmp2)); else
id = tmp1; strncpy(catID, hdr->path, 63);// scummvm
catID = tmp2; strcpy(id, m_plugin.PluginMagicWord);
strcat(id, fmt("/%s", catID));
favDomain = "FAVORITES_PLUGINS"; favDomain = "FAVORITES_PLUGINS";
adultDomain = "ADULTONLY_PLUGINS"; adultDomain = "ADULTONLY_PLUGINS";
} }
else else
{ {
id = hdr->id; strcpy(id, hdr->id);
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */ if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
{ strcat(id, "_2");
strcat(tmp1, fmt("%.6s_2", hdr->id)); strcpy(catID, id);
id = tmp1;
}
} }
if((!m_favorites || m_gcfg1.getBool(favDomain, id, false)) if((!m_favorites || m_gcfg1.getBool(favDomain, id, false))
@ -2031,16 +2032,18 @@ void CMenu::_initCF(void)
catDomain = "GAMECUBE"; catDomain = "GAMECUBE";
else if(hdr->type == TYPE_WII_GAME) else if(hdr->type == TYPE_WII_GAME)
catDomain = "WII"; catDomain = "WII";
else if(hdr->type == TYPE_HOMEBREW)
catDomain = "HOMEBREW";
else else
catDomain = m_plugin.PluginMagicWord; catDomain = m_plugin.PluginMagicWord;
if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games
{ {
char idCats[10]; char idCats[10];
strcpy(idCats, m_cat.getString(catDomain, hdr->type == TYPE_PLUGIN? catID : id).c_str()); strcpy(idCats, m_cat.getString(catDomain, catID).c_str());
u8 numIdCats = strlen(idCats); u8 numIdCats = strlen(idCats);
if(numIdCats == 0) if(numIdCats == 0)
m_cat.remove(catDomain, hdr->type == TYPE_PLUGIN? catID : id); m_cat.remove(catDomain, catID);
bool inaCat = false; bool inaCat = false;
bool inHiddenCat = false; bool inHiddenCat = false;
int reqMatch = 0; int reqMatch = 0;
@ -2103,7 +2106,7 @@ void CMenu::_initCF(void)
} }
} }
if(dumpGameLst && hdr->type != TYPE_PLUGIN) if(dumpGameLst && !NoGameID(hdr->type))
{ {
const char *domain = NULL; const char *domain = NULL;
switch(hdr->type) switch(hdr->type)
@ -2133,6 +2136,11 @@ void CMenu::_initCF(void)
CoverFlow.addItem(&(*hdr), playcount, lastPlayed); CoverFlow.addItem(&(*hdr), playcount, lastPlayed);
} }
} }
/* remove them if false to keep file short */
if(!m_gcfg1.getBool(favDomain, id))
m_cfg.remove(favDomain, id);
if(!m_gcfg1.getBool(adultDomain, id))
m_cfg.remove(adultDomain, id);
} }
if(dumpGameLst) if(dumpGameLst)
@ -2152,28 +2160,31 @@ void CMenu::_initCF(void)
CoverFlow.setBoxMode(m_cfg.getBool(SOURCEFLOW_DOMAIN, "box_mode", true)); CoverFlow.setBoxMode(m_cfg.getBool(SOURCEFLOW_DOMAIN, "box_mode", true));
CoverFlow.setSmallBoxMode(m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false)); CoverFlow.setSmallBoxMode(m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false));
} }
else if(m_current_view != COVERFLOW_PLUGIN)
{
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
CoverFlow.setSmallBoxMode(false);
}
else else
{ {
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount); m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
if(m_current_view == COVERFLOW_PLUGIN && enabledPluginsCount > 0)// 1 main source is plugin mode if(enabledPluginsCount == 1 && m_cfg.getBool(PLUGIN_ENABLED, "48425257") && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox"))
{ CoverFlow.setSmallBoxMode(true);
int boxmode_cnt = 0;
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
{
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
{
if(m_plugin.GetBoxMode(i))
boxmode_cnt++;
}
}
if(boxmode_cnt == 0)
CoverFlow.setBoxMode(false);
else
CoverFlow.setBoxMode(true);
}
else else
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true)); CoverFlow.setSmallBoxMode(false);
CoverFlow.setSmallBoxMode(false); int boxmode_cnt = 0;
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
{
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
{
if(m_plugin.GetBoxMode(i))
boxmode_cnt++;
}
}
if(boxmode_cnt == 0)
CoverFlow.setBoxMode(false);
else
CoverFlow.setBoxMode(true);
} }
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20)); CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", true)); CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", true));
@ -2205,11 +2216,13 @@ void CMenu::_initCF(void)
path = false; path = false;
if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND
path = false; path = false;
if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND
path = false;
strncpy(cur_item, m_cfg.getString("plugin_item", m_plugin.PluginMagicWord).c_str(), 63); strncpy(cur_item, m_cfg.getString("plugin_item", m_plugin.PluginMagicWord).c_str(), 63);
} }
else else
{ {
if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW || (m_source_cnt > 1 && m_cfg.getInt("MULTI", "current_item_type", TYPE_PLUGIN) == TYPE_PLUGIN)) if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW || (m_source_cnt > 1 && NoGameID(m_cfg.getInt("MULTI", "current_item_type", TYPE_PLUGIN))))
path = true; path = true;
strncpy(cur_item, m_cfg.getString(_domainFromView(), "current_item").c_str(), 63); strncpy(cur_item, m_cfg.getString(_domainFromView(), "current_item").c_str(), 63);
} }

View File

@ -19,11 +19,8 @@ TexData m_categoryBg;
vector<char> m_categories; vector<char> m_categories;
static u8 curPage; static u8 curPage;
u8 lastBtn; u8 lastBtn;
const char *catSettings = NULL; char id[64];
const char *id = NULL;
const char *pluginID = NULL;
const char *catDomain = NULL; const char *catDomain = NULL;
char tmp[64];
bool gameSet; bool gameSet;
void CMenu::_hideCategorySettings(bool instant) void CMenu::_hideCategorySettings(bool instant)
@ -128,49 +125,46 @@ void CMenu::_getGameCategories(void)
default: default:
catDomain = m_plugin.PluginMagicWord; catDomain = m_plugin.PluginMagicWord;
} }
memset(tmp, 0, 64);
if(hdr->type == TYPE_PLUGIN) memset(id, 0, 64);
if(NoGameID(hdr->type))
{ {
wcstombs(tmp, hdr->title, 64); if(strrchr(hdr->path, '/') != NULL)
pluginID = tmp; wcstombs(id, hdr->title, sizeof(id) - 1);
else
strncpy(id, hdr->path, sizeof(id) - 1);// scummvm
} }
else else
strcpy(id, hdr->id);
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
strcat(id, "_2");
const char *gameCats = m_cat.getString(catDomain, id, "").c_str();
if(strlen(gameCats) > 0)
{ {
id = hdr->id; for(u8 j = 0; j < strlen(gameCats); ++j)
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
{ {
strcat(tmp, fmt("%.6s_2", hdr->id)); int k = (static_cast<int>(gameCats[j])) - 32;
id = tmp;
}
}
const char *idCats = m_cat.getString(catDomain, hdr->type == TYPE_PLUGIN? pluginID : id).c_str();
u8 numIdCats = strlen(idCats);
if(numIdCats != 0)
{
for(u8 j = 0; j < numIdCats; ++j)
{
int k = (static_cast<int>(idCats[j])) - 32;
m_categories.at(k) = '1'; m_categories.at(k) = '1';
} }
} }
else else
m_cat.remove(catDomain, hdr->type == TYPE_PLUGIN? pluginID : id); m_cat.remove(catDomain, id);
m_btnMgr.setText(m_categoryLblTitle, CoverFlow.getTitle()); m_btnMgr.setText(m_categoryLblTitle, CoverFlow.getTitle());
} }
void CMenu::_setGameCategories(void) void CMenu::_setGameCategories(void)
{ {
const dir_discHdr *hdr = CoverFlow.getHdr(); string gameCats = "";
string newIdCats = "";
for(int i = 1; i < m_max_categories; i++) for(int i = 1; i < m_max_categories; i++)
{ {
if(m_categories.at(i) == '1') if(m_categories.at(i) == '1')
{ {
char cCh = static_cast<char>( i + 32); char cCh = static_cast<char>(i + 32);
newIdCats = newIdCats + cCh; gameCats =+ cCh;
} }
} }
m_cat.setString(catDomain, hdr->type == TYPE_PLUGIN? pluginID : id, newIdCats); m_cat.setString(catDomain, id, gameCats);
} }
void CMenu::_CategorySettings(bool fromGameSet) void CMenu::_CategorySettings(bool fromGameSet)
@ -195,9 +189,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
} }
else else
{ {
//const char *requiredCats = m_cat.getString("GENERAL", "required_categories").c_str();
//const char *selectedCats = m_cat.getString("GENERAL", "selected_categories").c_str();
//const char *hiddenCats = m_cat.getString("GENERAL", "hidden_categories").c_str();
char requiredCats[10]; char requiredCats[10];
char selectedCats[10]; char selectedCats[10];
char hiddenCats[10]; char hiddenCats[10];
@ -275,7 +266,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
else else
{ {
_setGameCategories(); _setGameCategories();
//m_refreshGameList = true;
} }
break; break;
} }

View File

@ -147,10 +147,29 @@ void CMenu::_hideGameSettingsPg(bool instant)
void CMenu::_showGameSettings() void CMenu::_showGameSettings()
{ {
//const char *id = CoverFlow.getId(); u32 i;
//const dir_discHdr *GameHdr = CoverFlow.getHdr();
const char *id = GameHdr->id; const char *id = GameHdr->id;
_setBg(m_gameSettingsBg, m_gameSettingsBg);
for(i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
if(m_gameSettingsLblUser[i] != -1)
m_btnMgr.show(m_gameSettingsLblUser[i]);
wstringEx title(_t("cfgg1", L"Settings"));
if(!NoGameID(GameHdr->type))
title.append(wfmt(L" [%.6s]", id));
m_btnMgr.setText(m_gameSettingsLblTitle, title);
m_btnMgr.show(m_gameSettingsLblTitle);
m_btnMgr.show(m_gameSettingsBtnBack);
if(GameHdr->type == TYPE_PLUGIN || GameHdr->type == TYPE_HOMEBREW)
{
m_btnMgr.show(m_gameSettingsBtnCategoryMain);
m_btnMgr.show(m_gameSettingsLblCategoryMain);
return;
}
if(GameHdr->type == TYPE_GC_GAME) if(GameHdr->type == TYPE_GC_GAME)
{ {
GCLoader = min(m_gcfg2.getUInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); GCLoader = min(m_gcfg2.getUInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u);
@ -160,27 +179,6 @@ void CMenu::_showGameSettings()
m_gameSettingsMaxPgs = 5; m_gameSettingsMaxPgs = 5;
if(GameHdr->type == TYPE_GC_GAME && GCLoader == DEVOLUTION) if(GameHdr->type == TYPE_GC_GAME && GCLoader == DEVOLUTION)
m_gameSettingsMaxPgs = 2; m_gameSettingsMaxPgs = 2;
_setBg(m_gameSettingsBg, m_gameSettingsBg);
u32 i = 0;
for(i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
if(m_gameSettingsLblUser[i] != -1)
m_btnMgr.show(m_gameSettingsLblUser[i]);
wstringEx title(_t("cfgg1", L"Settings"));
if(GameHdr->type != TYPE_PLUGIN)
title.append(wfmt(L" [%.6s]", id));
m_btnMgr.setText(m_gameSettingsLblTitle, title);
m_btnMgr.show(m_gameSettingsLblTitle);
m_btnMgr.show(m_gameSettingsBtnBack);
if(GameHdr->type == TYPE_PLUGIN)
{
m_btnMgr.show(m_gameSettingsBtnCategoryMain);
m_btnMgr.show(m_gameSettingsLblCategoryMain);
return;
}
m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", m_gameSettingsPage, m_gameSettingsMaxPgs)); m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", m_gameSettingsPage, m_gameSettingsMaxPgs));
m_btnMgr.show(m_gameSettingsLblPage); m_btnMgr.show(m_gameSettingsLblPage);

View File

@ -263,7 +263,7 @@ void CMenu::_extractBnr(const dir_discHdr *hdr)
void CMenu::_setCurrentItem(const dir_discHdr *hdr) void CMenu::_setCurrentItem(const dir_discHdr *hdr)
{ {
const char *title = CoverFlow.getFilenameId(hdr, true);// with extension const char *title = CoverFlow.getFilenameId(hdr);
if(m_current_view == COVERFLOW_PLUGIN) if(m_current_view == COVERFLOW_PLUGIN)
{ {
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
@ -274,8 +274,12 @@ void CMenu::_setCurrentItem(const dir_discHdr *hdr)
strncpy(m_plugin.PluginMagicWord, "4E574949", 9); strncpy(m_plugin.PluginMagicWord, "4E574949", 9);
else if(hdr->type == TYPE_GC_GAME) else if(hdr->type == TYPE_GC_GAME)
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9); strncpy(m_plugin.PluginMagicWord, "4E47434D", 9);
else else if(hdr->type == TYPE_CHANNEL)
strncpy(m_plugin.PluginMagicWord, "4E414E44", 9); strncpy(m_plugin.PluginMagicWord, "4E414E44", 9);
else if(hdr->type == TYPE_EMUCHANNEL)
strncpy(m_plugin.PluginMagicWord, "454E414E", 9);
else //HOMEBREW
strncpy(m_plugin.PluginMagicWord, "48425257", 9);
} }
m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", m_plugin.PluginMagicWord); m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", m_plugin.PluginMagicWord);
m_cfg.setString("plugin_item", m_plugin.PluginMagicWord, title); m_cfg.setString("plugin_item", m_plugin.PluginMagicWord, title);
@ -325,7 +329,7 @@ void CMenu::_showGame(void)
Path = fmt("%s", m_fanartDir.c_str()); Path = fmt("%s", m_fanartDir.c_str());
else else
Path = fmt("%s/%s", m_fanartDir.c_str(), coverDir); Path = fmt("%s/%s", m_fanartDir.c_str(), coverDir);
if(m_fa.load(m_cfg, Path, CoverFlow.getFilenameId(GameHdr, false), GameHdr->type == TYPE_PLUGIN)) if(m_fa.load(m_cfg, Path, CoverFlow.getHdr()))
{ {
const TexData *bg = NULL; const TexData *bg = NULL;
const TexData *bglq = NULL; const TexData *bglq = NULL;
@ -336,24 +340,6 @@ void CMenu::_showGame(void)
} }
else else
_setMainBg(); _setMainBg();
return;
if(!m_zoom_banner)
{
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]);
m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack);
m_btnMgr.show(m_gameBtnToggle);
}
else
{
m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToggleFull);
}
} }
void CMenu::_cleanupBanner(bool gamechange) void CMenu::_cleanupBanner(bool gamechange)
@ -451,31 +437,30 @@ void CMenu::_game(bool launch)
dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr)); dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr));
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr)); memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
if(hdr->type == TYPE_HOMEBREW)
launch = true;
_setCurrentItem(hdr); _setCurrentItem(hdr);
const char *id = NULL; char id[74];
char tmp1[74];// title/magic# char catID[64];
memset(tmp1, 0, 74); memset(id, 0, 74);
char tmp2[64]; memset(catID, 0, 64);
memset(tmp2, 0, 64);
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_HOMEBREW)
wcstombs(id, hdr->title, 63);
else if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
wcstombs(tmp2, hdr->title, 64); if(strrchr(hdr->path, '/') != NULL)
strcat(tmp1, m_plugin.PluginMagicWord); wcstombs(catID, hdr->title, 63);
strcat(tmp1, fmt("/%s", tmp2)); else
id = tmp1; strncpy(catID, hdr->path, 63);// scummvm
strcpy(id, m_plugin.PluginMagicWord);
strcat(id, fmt("/%s", catID));
} }
else else
{ {
id = hdr->id; strcpy(id, hdr->id);
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */ if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
{ strcat(id, "_2");
strcat(tmp1, fmt("%.6s_2", hdr->id));
id = tmp1;
}
} }
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false); m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false);
@ -497,7 +482,7 @@ void CMenu::_game(bool launch)
{ {
m_fa.unload(); m_fa.unload();
CoverFlow.showCover(); CoverFlow.showCover();
_setBg(m_gameBg, m_gameBgLQ); _setMainBg();
} }
else //loop fanart else //loop fanart
m_fa.reset(); m_fa.reset();
@ -620,15 +605,15 @@ void CMenu::_game(bool launch)
} }
else if(launch || BTN_A_PRESSED) else if(launch || BTN_A_PRESSED)
{ {
if(m_fa.isLoaded() && ShowPointer()) if(m_fa.isLoaded() && ShowPointer())// stop and unload fanart
{ {
m_fa.unload(); m_fa.unload();
CoverFlow.showCover(); CoverFlow.showCover();
_setBg(m_gameBg, m_gameBgLQ); _setMainBg();
continue; continue;
} }
/* delete button */ /* delete button */
else if(m_btnMgr.selected(m_gameBtnDelete)) else if(m_btnMgr.selected(m_gameBtnDelete) && hdr->type != TYPE_HOMEBREW)
{ {
_hideGame(); _hideGame();
m_banner.SetShowBanner(false); m_banner.SetShowBanner(false);
@ -846,24 +831,26 @@ void CMenu::_game(bool launch)
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header
_setCurrentItem(hdr); _setCurrentItem(hdr);
memset(tmp1, 0, 74); memset(id, 0, 74);
memset(tmp2, 0, 64); memset(catID, 0, 64);
if(hdr->type == TYPE_PLUGIN)
if(hdr->type == TYPE_HOMEBREW)
wcstombs(id, hdr->title, 64);
else if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
wcstombs(tmp2, hdr->title, 64); if(strrchr(hdr->path, '/') != NULL)
strcat(tmp1, m_plugin.PluginMagicWord); wcstombs(catID, hdr->title, 63);
strcat(tmp1, fmt("/%s", tmp2)); else
id = tmp1; strncpy(catID, hdr->path, 63);// scummvm
strcpy(id, m_plugin.PluginMagicWord);
strcat(id, fmt("/%s", catID));
} }
else else
{ {
id = hdr->id; strcpy(id, hdr->id);
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */ if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
{ strcat(id, "_2");
strcat(tmp1, fmt("%.6s_2", hdr->id));
id = tmp1;
}
} }
if(m_newGame) if(m_newGame)
{ {
@ -1084,8 +1071,7 @@ void CMenu::_launch(const dir_discHdr *hdr)
} }
/* get title from hdr */ /* get title from hdr */
u32 title_len_no_ext = 0; u32 title_len_no_ext = 0;
const char *title = CoverFlow.getFilenameId(hdr, true);// with extension const char *title = CoverFlow.getFilenameId(hdr);// with extension
//m_cfg.setString(_domainFromView(), "current_item", title);
/* get path from hdr */ /* get path from hdr */
// example rom path - dev:/roms/super mario bros.zip // example rom path - dev:/roms/super mario bros.zip

View File

@ -223,7 +223,9 @@ void CMenu::_showCF(bool refreshList)
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
{ {
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount); m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
if(enabledPluginsCount > 0) if(enabledPluginsCount == 1 && m_cfg.getBool(PLUGIN_ENABLED, "48425257") && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox"))
cf_domain = "_smallflow";
else if(enabledPluginsCount > 0)
{ {
int sdc = 0; int sdc = 0;
int shc = 0; int shc = 0;

View File

@ -226,6 +226,10 @@ const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg, u8 *num)
return enabledPlugins; return enabledPlugins;
} }
/* notes: "description" is used as the title because it basically is the title */
/* the [GameDomain] is used as the path even thought it isn't the path */
/* the [GameDomain] is usually short without any '/' */
/* in scummvm.ini the path is the path without the exe or main app file added on */
vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char *Device, u32 Magic) vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char *Device, u32 Magic)
{ {
gprintf("Parsing scummvm.ini\n"); gprintf("Parsing scummvm.ini\n");