mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 19:01:56 +01:00
-more powerful detection if gamecube game is installed on
sd card by reading the sd card directory (bit slower though) -made list cache a bit smaller again by using more general settings, dont forget to reload list cache
This commit is contained in:
parent
c90f7ff49b
commit
18373f9f3d
@ -1492,7 +1492,8 @@ u64 CCoverFlow::getChanTitle(void) const
|
||||
{
|
||||
if (m_covers.empty() || m_items.empty()) return 0;
|
||||
|
||||
return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->chantitle;
|
||||
return TITLE_ID(m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[0],
|
||||
m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,6 +129,9 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||
gprintf("Getting headers for paths in pathlist (%d)\n", pathlist.size());
|
||||
|
||||
vector<char*> GC_SD_IDs;
|
||||
bool GC_SD_IDs_loaded = false;
|
||||
|
||||
dir_discHdr tmp;
|
||||
u32 count = 0;
|
||||
string GTitle;
|
||||
@ -182,7 +185,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
Asciify(tmp.title);
|
||||
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.plugin_magic); //Plugin magic
|
||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.settings[0]); //Plugin magic
|
||||
tmp.type = TYPE_PLUGIN;
|
||||
headerlist.push_back(tmp);
|
||||
break;
|
||||
@ -238,8 +241,27 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
|
||||
if(strncmp(dml_partition, "sd", 2) != 0)
|
||||
{
|
||||
if(GC_GameIsInstalled(tmp.id, DeviceName[SD], DML_DIR) || GC_GameIsInstalled((char*)fmt("%s [%s]", tmp.title, tmp.id), DeviceName[SD], DML_DIR) || GC_GameIsInstalled(tmp.path, DeviceName[SD], DML_DIR))
|
||||
wcslcat(tmp.title, L" \n(on SD)", sizeof(tmp.title));
|
||||
if(!GC_SD_IDs_loaded)
|
||||
{
|
||||
CList<dir_discHdr> tmplist;
|
||||
vector<string> pathlist;
|
||||
tmplist.GetPaths(pathlist, ".iso|.bin", "sd:/games", false, true);
|
||||
vector<dir_discHdr> tmpGameList;
|
||||
tmplist.GetHeaders(pathlist, tmpGameList, settingsDir, curLanguage, DMLgameUSBDir, plugin);
|
||||
for(u8 i = 0; i < tmpGameList.size(); i++)
|
||||
GC_SD_IDs.push_back(tmpGameList.at(i).id);
|
||||
GC_SD_IDs_loaded = true;
|
||||
}
|
||||
tmp.settings[0] = 0;
|
||||
for(u8 i = 0; i < GC_SD_IDs.size(); i++)
|
||||
{
|
||||
if(strncasecmp(GC_SD_IDs.at(i), tmp.id, 6) == 0)
|
||||
{
|
||||
tmp.settings[0] = 1; //Later Checks can use this as easy information
|
||||
wcslcat(tmp.title, L" \n(on SD)", sizeof(tmp.title));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Asciify(tmp.title);
|
||||
|
||||
@ -427,7 +449,8 @@ void CList<dir_discHdr>::GetChannels(vector<dir_discHdr> &headerlist, string set
|
||||
tmp.index = headerlist.size();
|
||||
tmp.casecolor = 1;
|
||||
|
||||
tmp.chantitle = chan->title;
|
||||
tmp.settings[0] = TITLE_UPPER(chan->title);
|
||||
tmp.settings[1] = TITLE_LOWER(chan->title);
|
||||
strncpy(tmp.id, chan->id, 4);
|
||||
int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
|
||||
|
||||
|
@ -77,9 +77,8 @@ struct dir_discHdr
|
||||
|
||||
char path[256];
|
||||
wchar_t title[64];
|
||||
u64 chantitle;
|
||||
u32 settings[2]; //chantitle, plugin magic, crc32, gamecube game on sd, etc
|
||||
|
||||
u32 plugin_magic;
|
||||
u8 type;
|
||||
|
||||
u32 casecolor;
|
||||
|
@ -1508,7 +1508,7 @@ void CMenu::_initCF(void)
|
||||
{
|
||||
string id;
|
||||
string tempname(m_gameList[i].path);
|
||||
u64 chantitle = m_gameList[i].chantitle;
|
||||
u64 chantitle = TITLE_ID(m_gameList[i].settings[0],m_gameList[i].settings[1]);
|
||||
if(m_gameList[i].type == TYPE_HOMEBREW)
|
||||
{
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
@ -1516,7 +1516,7 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
else if(m_gameList[i].type == TYPE_PLUGIN)
|
||||
{
|
||||
if(!m_plugin.isScummVM(m_gameList[i].plugin_magic))
|
||||
if(!m_plugin.isScummVM(m_gameList[i].settings[0]))
|
||||
{
|
||||
if(tempname.empty() || tempname.find_first_of('/') == string::npos)
|
||||
{
|
||||
@ -1661,14 +1661,14 @@ void CMenu::_initCF(void)
|
||||
string tempname(m_gameList[i].path);
|
||||
if(tempname.find_last_of("/") != string::npos)
|
||||
tempname.assign(&tempname[tempname.find_last_of("/") + 1]);
|
||||
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].plugin_magic));
|
||||
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].settings[0]));
|
||||
if(EnabledPlugins.size() == 0) //all plugins
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
else
|
||||
{
|
||||
for(u8 j = 0; j < EnabledPlugins.size(); j++)
|
||||
{
|
||||
if(EnabledPlugins[j] == true && m_gameList[i].plugin_magic == m_plugin.getPluginMagic(j))
|
||||
if(EnabledPlugins[j] == true && m_gameList[i].settings[0] == m_plugin.getPluginMagic(j))
|
||||
{
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
break;
|
||||
|
@ -476,19 +476,24 @@ void CMenu::_game(bool launch)
|
||||
dir_discHdr *hdr = m_cf.getHdr();
|
||||
if(currentPartition != SD && hdr->type == TYPE_GC_GAME)
|
||||
{
|
||||
char gcfolder[300];
|
||||
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->id);
|
||||
if(GC_GameIsInstalled((char *)hdr->id, DeviceName[SD], DML_DIR))
|
||||
bool foundOnSD;
|
||||
CList<dir_discHdr> tmplist;
|
||||
vector<string> pathlist;
|
||||
tmplist.GetPaths(pathlist, ".iso|.bin", "sd:/games", false, true);
|
||||
vector<dir_discHdr> tmpGameList;
|
||||
Config nullCfg;
|
||||
tmplist.GetHeaders(pathlist, tmpGameList, m_settingsDir, m_curLanguage, m_DMLgameDir, nullCfg);
|
||||
for(u8 i = 0; i < tmpGameList.size(); i++)
|
||||
{
|
||||
memset(hdr->path, 0, sizeof(hdr->path));
|
||||
strncpy(hdr->path, (char*)hdr->id, sizeof(hdr->path));
|
||||
if(strncasecmp(tmpGameList.at(i).id, hdr->id, 6) == 0)
|
||||
{
|
||||
foundOnSD = true;
|
||||
memset(hdr->path, 0, sizeof(hdr->path));
|
||||
strncpy(hdr->path, tmpGameList.at(i).path, sizeof(hdr->path));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(GC_GameIsInstalled(gcfolder, DeviceName[SD], DML_DIR))
|
||||
{
|
||||
memset(hdr->path, 0, sizeof(hdr->path));
|
||||
strncpy(hdr->path, gcfolder, sizeof(hdr->path));
|
||||
}
|
||||
else if(!GC_GameIsInstalled(hdr->path, DeviceName[SD], DML_DIR) && !_wbfsOp(CMenu::WO_COPY_GAME))
|
||||
if(!foundOnSD && !_wbfsOp(CMenu::WO_COPY_GAME))
|
||||
break;
|
||||
currentPartition = SD;
|
||||
}
|
||||
@ -647,7 +652,7 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
|
||||
vector<string> arguments;
|
||||
gprintf("Game title: %s\n", title.c_str());
|
||||
if(m_plugin.isMplayerCE(hdr->plugin_magic))
|
||||
if(m_plugin.isMplayerCE(hdr->settings[0]))
|
||||
arguments = m_plugin.CreateMplayerCEArguments(string(hdr->path).c_str());
|
||||
else if(strstr(path.c_str(), ":/") != NULL)
|
||||
{
|
||||
@ -655,7 +660,7 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
path.erase(3,1);
|
||||
arguments.push_back(path);
|
||||
arguments.push_back(title);
|
||||
if(m_plugin.UseReturnLoader(hdr->plugin_magic))
|
||||
if(m_plugin.UseReturnLoader(hdr->settings[0]))
|
||||
arguments.push_back(sfmt("%s/WiiFlowLoader.dol",m_pluginsDir.c_str()));
|
||||
else
|
||||
arguments.push_back(wiiflow_dol);
|
||||
@ -668,7 +673,7 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
wcstombs(gametitle, hdr->title, sizeof(gametitle));
|
||||
m_cfg.setString("EMULATOR", "current_item", gametitle);
|
||||
}
|
||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->plugin_magic)), arguments);
|
||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->settings[0])), arguments);
|
||||
return;
|
||||
}
|
||||
else if(hdr->type == TYPE_HOMEBREW)
|
||||
@ -980,7 +985,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
|
||||
if(!forwarder)
|
||||
{
|
||||
entry = channel.Load(hdr->chantitle, &ios);
|
||||
entry = channel.Load(TITLE_ID(hdr->settings[0],hdr->settings[1]), &ios);
|
||||
setLanguage(language);
|
||||
|
||||
SmartBuf cheatFile;
|
||||
@ -1072,11 +1077,11 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
if(forwarder)
|
||||
{
|
||||
WII_Initialize();
|
||||
if(WII_LaunchTitle(hdr->chantitle) < 0)
|
||||
if(WII_LaunchTitle(TITLE_ID(hdr->settings[0],hdr->settings[1])) < 0)
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
if(!BootChannel(entry, hdr->chantitle, ios, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio))
|
||||
if(!BootChannel(entry, TITLE_ID(hdr->settings[0],hdr->settings[1]), ios, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio))
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
@ -1442,7 +1447,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
}
|
||||
else if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->plugin_magic), m->m_plugin.GetBannerSoundSize(), false);
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->settings[0]), m->m_plugin.GetBannerSoundSize(), false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
@ -1453,7 +1458,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
|
||||
Banner *banner = m->m_gameSoundHdr->type == TYPE_WII_GAME ?
|
||||
_extractBnr(m->m_gameSoundHdr) : m->m_gameSoundHdr->type == TYPE_CHANNEL ?
|
||||
_extractChannelBnr(m->m_gameSoundHdr->chantitle) : NULL;
|
||||
_extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL;
|
||||
m->m_gameSoundHdr = NULL;
|
||||
|
||||
if (banner == NULL || !banner->IsValid())
|
||||
|
@ -329,13 +329,13 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
{
|
||||
Disc_ReadHeader(&header);
|
||||
|
||||
if (_searchGamesByID((const char *) header.id).size() != 0)
|
||||
if(_searchGamesByID((const char *) header.id).size() != 0)
|
||||
{
|
||||
error(_t("wbfsoperr4", L"Game already installed"));
|
||||
out = true;
|
||||
break;
|
||||
}
|
||||
cfPos = string((char *) header.id);
|
||||
cfPos = string((char *)header.id);
|
||||
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop6", L"Installing [%s] %s..."), string((const char *)header.id, sizeof header.id).c_str(), string((const char *)header.title, sizeof header.title).c_str()));
|
||||
done = true;
|
||||
upd_usb = true;
|
||||
@ -352,7 +352,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
char dmlgamedir[50];
|
||||
strncpy(dmlgamedir, (currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, sizeof(dmlgamedir));
|
||||
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", gcheader.title, (char *)gcheader.id);
|
||||
if (_searchGamesByID((const char *) gcheader.id).size() != 0 || GC_GameIsInstalled((char *)gcheader.id, DeviceName[currentPartition], dmlgamedir) || GC_GameIsInstalled(gcfolder, DeviceName[currentPartition], dmlgamedir))
|
||||
if(_searchGamesByID((const char *) gcheader.id).size() != 0)
|
||||
{
|
||||
error(_t("wbfsoperr4", L"Game already installed"));
|
||||
out = true;
|
||||
|
@ -221,7 +221,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
|
||||
gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.plugin_magic = Plugins.back().magicWord;
|
||||
tmp.settings[0] = Plugins.back().magicWord;
|
||||
tmp.type = TYPE_PLUGIN;
|
||||
gameHeader.push_back(tmp);
|
||||
game = ini.nextDomain();
|
||||
@ -281,7 +281,7 @@ bool Plugin::isScummVM(u32 magic)
|
||||
|
||||
string Plugin::GenerateCoverLink(dir_discHdr gameHeader, string url)
|
||||
{
|
||||
Plugin_Pos = GetPluginPosition(gameHeader.plugin_magic);
|
||||
Plugin_Pos = GetPluginPosition(gameHeader.settings[0]);
|
||||
|
||||
if(url.find(TAG_LOC) != url.npos)
|
||||
url.replace(url.find(TAG_LOC), strlen(TAG_LOC), "EN");
|
||||
|
Loading…
Reference in New Issue
Block a user