- now platform ini is loaded on wiiflow start. instead of constantly loading and unloading it. platform ini is now used for gameinfo, coverflows, blank cover titles, and more.

- fixed some missing cleanup when leaving wiiflow. in particular the pointer textures and closing the language ini.
- new way to handle the custom blank covers by Abz. blank covers now must go in wiiflow/boxcovers/blank_covers folder and must be named after their platform name via platform ini. they can also now be png or jpg.
This commit is contained in:
Fledge68 2019-04-08 11:10:30 -05:00
parent b829137794
commit a4968a91ac
9 changed files with 77 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 3.4 MiB

View File

@ -64,6 +64,13 @@ bool CCursor::init(const char *png, bool wideFix, CColor shadowColor, float shad
return ok; return ok;
} }
void CCursor::cleanup(void)
{
TexHandle.Cleanup(m_texture);
if(m_shadow.data != NULL)
TexHandle.Cleanup(m_shadow);
}
void CCursor::draw(int x, int y, float a) void CCursor::draw(int x, int y, float a)
{ {
GXTexObj texObj; GXTexObj texObj;

View File

@ -8,6 +8,7 @@ class CCursor
{ {
public: public:
bool init(const char *png, bool wideFix, CColor shadowColor, float shadowX, float shadowY, bool blur, int chan); bool init(const char *png, bool wideFix, CColor shadowColor, float shadowX, float shadowY, bool blur, int chan);
void cleanup(void);
void draw(int x, int y, float a); void draw(int x, int y, float a);
u32 width(void) const { return m_texture.height; } u32 width(void) const { return m_texture.height; }
u32 height(void) const { return m_texture.width; } u32 height(void) const { return m_texture.width; }

View File

@ -231,7 +231,8 @@ bool CMenu::init()
fsop_MakeFolder(m_sourceDir.c_str()); fsop_MakeFolder(m_sourceDir.c_str());
fsop_MakeFolder(m_customBnrDir.c_str()); fsop_MakeFolder(m_customBnrDir.c_str());
fsop_MakeFolder(m_pluginsDir.c_str()); fsop_MakeFolder(m_pluginsDir.c_str());
fsop_MakeFolder(m_pluginDataDir.c_str());
fsop_MakeFolder(m_cacheDir.c_str()); fsop_MakeFolder(m_cacheDir.c_str());
fsop_MakeFolder(m_listCacheDir.c_str()); fsop_MakeFolder(m_listCacheDir.c_str());
fsop_MakeFolder(m_bnrCacheDir.c_str()); fsop_MakeFolder(m_bnrCacheDir.c_str());
@ -288,6 +289,7 @@ bool CMenu::init()
m_coverflow.load(fmt("%s/coverflows/%s.ini", m_themeDir.c_str(), themeName.c_str())); m_coverflow.load(fmt("%s/coverflows/%s.ini", m_themeDir.c_str(), themeName.c_str()));
if(!m_coverflow.loaded()) if(!m_coverflow.loaded())
m_coverflow.load(fmt("%s/coverflows/default.ini", m_themeDir.c_str())); m_coverflow.load(fmt("%s/coverflows/default.ini", m_themeDir.c_str()));
m_platform.load(fmt("%s/platform.ini", m_pluginDataDir.c_str()));
/* Get plugin ini files */ /* Get plugin ini files */
m_plugin.init(m_pluginsDir); m_plugin.init(m_pluginsDir);
@ -449,10 +451,13 @@ void CMenu::cleanup()
m_banner.DeleteBanner(); m_banner.DeleteBanner();
m_plugin.Cleanup(); m_plugin.Cleanup();
m_source.unload(); m_source.unload();
m_platform.unload();
//_stopSounds(); m_loc.unload();
_Theme_Cleanup(); _Theme_Cleanup();
//MusicPlayer.Cleanup(); for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
m_cursor[chan].cleanup();
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
SoundHandle.Cleanup(); SoundHandle.Cleanup();
soundDeinit(); soundDeinit();
@ -2438,6 +2443,7 @@ bool CMenu::_loadPluginList()
Config scummvm; Config scummvm;
vector<dir_discHdr> scummvmList; vector<dir_discHdr> scummvmList;
scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini")); scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini"));
//also check if in apps folder
scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition], Magic); scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition], Magic);
for(vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
@ -2660,29 +2666,40 @@ void CMenu::TempLoadIOS(int IOS)
} }
} }
static char blankCoverPath[MAX_FAT_PATH];
const char *CMenu::getBlankCoverPath(const dir_discHdr *element) const char *CMenu::getBlankCoverPath(const dir_discHdr *element)
{ {
const char *blankCoverKey = NULL; string blankCoverTitle = "wii";
switch(element->type) if(m_platform.loaded())
{ {
case TYPE_CHANNEL: switch(element->type)
case TYPE_EMUCHANNEL: {
blankCoverKey = "channels"; case TYPE_CHANNEL:
break; strncpy(m_plugin.PluginMagicWord, "4E414E44", 9);
case TYPE_HOMEBREW: break;
blankCoverKey = "homebrew"; case TYPE_EMUCHANNEL:
break; strncpy(m_plugin.PluginMagicWord, "454E414E", 9);
case TYPE_GC_GAME: break;
blankCoverKey = "gamecube"; case TYPE_HOMEBREW:
break; strncpy(m_plugin.PluginMagicWord, "48425257", 9);
case TYPE_PLUGIN: break;
strncpy(m_plugin.PluginMagicWord, fmt("%08x", element->settings[0]), 8); case TYPE_GC_GAME:
blankCoverKey = m_plugin.PluginMagicWord; strncpy(m_plugin.PluginMagicWord, "4E47434D", 9);
break; break;
default: case TYPE_PLUGIN:
blankCoverKey = "wii"; strncpy(m_plugin.PluginMagicWord, fmt("%08x", element->settings[0]), 8);
break;
default:// wii
strncpy(m_plugin.PluginMagicWord, "4E574949", 9);
}
blankCoverTitle = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "wii");
} }
return fmt("%s/blank_covers/%s", m_boxPicDir.c_str(), m_theme.getString("BLANK_COVERS", blankCoverKey, fmt("%s.jpg", blankCoverKey)).c_str()); if(blankCoverTitle.find("multi") != string::npos && (blankCoverTitle.find("fceu") != string::npos || blankCoverTitle.find("nes") != string::npos))
blankCoverTitle = "nes";
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.jpg", m_boxPicDir.c_str(), blankCoverTitle.c_str());
if(!fsop_FileExist(blankCoverPath))
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.png", m_boxPicDir.c_str(), blankCoverTitle.c_str());
return blankCoverPath;
} }
const char *CMenu::getBoxPath(const dir_discHdr *element) const char *CMenu::getBoxPath(const dir_discHdr *element)

View File

@ -84,8 +84,7 @@ private:
Config m_gcfg2; Config m_gcfg2;
Config m_theme; Config m_theme;
Config m_coverflow; Config m_coverflow;
Config m_titles; Config m_platform;
Config m_version;
//vector<string> m_homebrewArgs; //vector<string> m_homebrewArgs;
u8 *m_base_font; u8 *m_base_font;

View File

@ -818,7 +818,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc)
} }
} }
if(!disc) if(!disc)
m_gcfg2.save(true); m_gcfg2.save(true);// do not save changes for disc games
_hideGameSettings(); _hideGameSettings();
} }

View File

@ -1706,7 +1706,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
DeviceHandle.MountAll(); DeviceHandle.MountAll();
} }
cleanup();//done with error menu can now cleanup cleanup();//no more error messages we can now cleanup
if(WII_Launch) if(WII_Launch)
{ {
@ -1752,25 +1752,25 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
} }
else else
{ {
if(!m_nintendont_installed)
{
error(_t("errgame12", L"Nintendont not found! Can't launch GC Disc."));
return;
}
/* Read GC disc header */ /* Read GC disc header */
Disc_ReadGCHeader(&gc_hdr); Disc_ReadGCHeader(&gc_hdr);
memcpy(hdr->id, gc_hdr.id, 6); memcpy(hdr->id, gc_hdr.id, 6);
hdr->type = TYPE_GC_GAME; hdr->type = TYPE_GC_GAME;
/* Launching GC Game */ /* Launching GC Game */
if(m_nintendont_installed) if(disc_cfg)
{ _gameSettings(hdr, dvd);
if(disc_cfg) MusicPlayer.Stop();
_gameSettings(hdr, dvd); m_cfg.setInt("GENERAL", "cat_startpage", m_catStartPage);
MusicPlayer.Stop(); if(!disc_cfg)
m_cfg.setInt("GENERAL", "cat_startpage", m_catStartPage); m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
if(!disc_cfg) currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", 1);
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); _launchGC(hdr, dvd);
currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", 1);
_launchGC(hdr, dvd);
}
else
error(_t("errgame12", L"Nintendont not found! Can't launch GC Disc."));
return; return;
} }
} }

View File

@ -335,9 +335,7 @@ void CMenu::_textGameInfo(void)
// We can't use magic # directly since it'd require hardcoding values and a # can be several systems(genplus) // We can't use magic # directly since it'd require hardcoding values and a # can be several systems(genplus)
// We can't rely on coverfolder either. Different systems can share the same folder. Or combined plugins used for the same system. // We can't rely on coverfolder either. Different systems can share the same folder. Or combined plugins used for the same system.
/* load platform.ini */ /* is platform.ini available? */
Config m_platform;
m_platform.load(fmt("%s/platform.ini", m_pluginDataDir.c_str()) );
if(!m_platform.loaded()) if(!m_platform.loaded())
return;// no platform.ini found return;// no platform.ini found
@ -358,10 +356,16 @@ void CMenu::_textGameInfo(void)
} }
snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str()); snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str());
} }
m_platform.unload();
if(strlen(platformName) == 0) if(strlen(platformName) == 0)
return;// no platform name found to match plugin magic # return;// no platform name found to match plugin magic #
if(!strcasecmp(platformName, "mame") || !strcasecmp(platformName, "fba_pgm") || !strcasecmp(platformName, "fba_psikyo") || !strcasecmp(platformName, "fb_alpha"))
snprintf(platformName, sizeof(platformName), "%s", "arcade");
if(!strcasecmp(platformName, "turbografx"))
snprintf(platformName, sizeof(platformName), "%s", "pcengine");
if(!strcasecmp(platformName, "genesis"))
snprintf(platformName, sizeof(platformName), "%s", "megadrive");
/* Get Game's crc/serial to be used as gameID by searching platformName.ini file */ /* Get Game's crc/serial to be used as gameID by searching platformName.ini file */
string romID;// this will be the crc or serial string romID;// this will be the crc or serial
string ShortName = m_plugin.GetRomName(GameHdr);// if scummvm game then shortname=NULL string ShortName = m_plugin.GetRomName(GameHdr);// if scummvm game then shortname=NULL

View File

@ -231,11 +231,10 @@ void CMenu::_showCF(bool refreshList)
strcpy(cf_domain, "_SMALLFLOW"); strcpy(cf_domain, "_SMALLFLOW");
else if(enabledPluginsCount > 0) else if(enabledPluginsCount > 0)
{ {
/* load platform.ini */ /* check if platform.ini is loaded */
Config m_platform;
m_platform.load(fmt("%s/platform.ini", m_pluginDataDir.c_str()) );
if(m_platform.loaded()) if(m_platform.loaded())
{ {
/* get first plugin flow domain */
string flow_domain; string flow_domain;
for(u8 i = 0; m_plugin.PluginExist(i); ++i) for(u8 i = 0; m_plugin.PluginExist(i); ++i)
{ {
@ -246,6 +245,7 @@ void CMenu::_showCF(bool refreshList)
break; break;
} }
} }
/* check if all plugin flow domains match */
if(!flow_domain.empty()) if(!flow_domain.empty())
{ {
bool match = true; bool match = true;
@ -261,10 +261,10 @@ void CMenu::_showCF(bool refreshList)
} }
} }
} }
/* if all match we use that flow domain */
if(match) if(match)
snprintf(cf_domain, sizeof(cf_domain), "%s", flow_domain.c_str()); snprintf(cf_domain, sizeof(cf_domain), "%s", flow_domain.c_str());
} }
m_platform.unload();
} }
} }
} }