mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
- Plugin game list generator now gets rom title and ID from wiimpathy's plugins database files. a 'reload cache' will need to be done for each plugin source so the title and ID can be added to the current cached list. custom titles still work and will override plugin database files. titles are based on custom titles file then plugins database file and finally the rom filename. if the ID is not found in the plugins database files it will have an ID of 'PLUGIN' and no game info will be displayed on the game info screen.
arcade rom clones are not included in the plugins database files to keep the files short. Any arcade rom clones you have will either not be found or will aquire the same ID and title as the parent rom when the CRC of the clone rom is included in the parent roms list of CRC's. you will need to manually edit both the CRC list file and xml database file to include the rom info on any clone you have in order for them to display the correct title and game info. i would think only a small handfull of your roms would be clones. reload cache may take longer now to create the cached list. I found zipped roms for snes, nes, and others are no problem because even if the filename can't be found the crc does not need to be calculated. it is merely taken from the zip file which already holds the crc. on the other hand, half of my gba roms are unzipped with a gba extension. so my gba list takes 10 seconds or so to make because the crc of the unzipped roms does need to be calculated. mame roms use the filename but if it's a clone then it will calculate the crc of the rom zip file. thus any clones will slow things down unless you add them to the database files mentioned above. I imagine megaCD and PS1 cd games will be slow to reload cache. but at least you only need to do it once or whenever you add or delete a game. wiimpathy's database files use the no intro naming convention. i'm not crazy about it because it moves any leading 'the' to the end preceded by a comma. in this case i use custom titles ini to put the title the way i want.
This commit is contained in:
parent
d4579b57c3
commit
13e65956fe
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 3.4 MiB |
@ -28,9 +28,12 @@
|
||||
ListGenerator m_cacheList;
|
||||
Config CustomTitles;
|
||||
GameTDB gameTDB;
|
||||
Config romNamesDB;
|
||||
string platformName;
|
||||
string pluginsDataDir;
|
||||
|
||||
dir_discHdr ListElement;
|
||||
void ListGenerator::Init(const char *settingsDir, const char *Language)
|
||||
void ListGenerator::Init(const char *settingsDir, const char *Language, const char *plgnsDataDir)
|
||||
{
|
||||
if(settingsDir != NULL)
|
||||
{
|
||||
@ -38,6 +41,7 @@ void ListGenerator::Init(const char *settingsDir, const char *Language)
|
||||
CustomTitlesPath = fmt("%s/" CTITLES_FILENAME, settingsDir);
|
||||
}
|
||||
if(Language != NULL) gameTDB_Language = Language;
|
||||
if(plgnsDataDir != NULL) pluginsDataDir = fmt("%s", plgnsDataDir);
|
||||
}
|
||||
|
||||
void ListGenerator::Clear(void)
|
||||
@ -179,36 +183,6 @@ static void Add_GameCube_Game(char *FullPath)
|
||||
}
|
||||
}
|
||||
|
||||
/* add plugin rom, song, or video to the list */
|
||||
const char *RomTitle = NULL;
|
||||
static void Add_Plugin_Game(char *FullPath)
|
||||
{
|
||||
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
||||
|
||||
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
|
||||
memcpy(ListElement.id, "PLUGIN", 6);
|
||||
|
||||
RomTitle = strrchr(FullPath, '/') + 1;
|
||||
*strrchr(RomTitle, '.') = '\0';
|
||||
|
||||
char PluginMagicWord[9];
|
||||
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
|
||||
strncpy(PluginMagicWord, fmt("%08x", m_cacheList.Magic), 8);
|
||||
char CustomTitle[64];
|
||||
memset(CustomTitle, 0, sizeof(CustomTitle));
|
||||
strncpy(CustomTitle, CustomTitles.getString(PluginMagicWord, RomTitle).c_str(), 63);
|
||||
if(strlen(CustomTitle) > 0)
|
||||
mbstowcs(ListElement.title, CustomTitle, 63);
|
||||
else
|
||||
mbstowcs(ListElement.title, RomTitle, 63);
|
||||
Asciify(ListElement.title);
|
||||
|
||||
ListElement.settings[0] = m_cacheList.Magic; //Plugin magic
|
||||
ListElement.casecolor = m_cacheList.Color;
|
||||
ListElement.type = TYPE_PLUGIN;
|
||||
m_cacheList.push_back(ListElement);
|
||||
}
|
||||
|
||||
/* add homebrew boot.dol to the list */
|
||||
static void Add_Homebrew_Dol(char *FullPath)
|
||||
{
|
||||
@ -278,6 +252,105 @@ static void Create_Channel_List(bool realNAND)
|
||||
}
|
||||
}
|
||||
|
||||
/* add plugin rom, song, or video to the list. */
|
||||
static void Add_Plugin_Game(char *FullPath)
|
||||
{
|
||||
/* Get roms's title without the extra ()'s or []'s */
|
||||
string ShortName = m_plugin.GetRomName(FullPath);
|
||||
//gprintf("shortName=%s\n", ShortName.c_str());
|
||||
|
||||
/* get rom's ID */
|
||||
string romID = "";
|
||||
if(gameTDB.IsLoaded())
|
||||
{
|
||||
/* Get 6 character unique romID (from Screenscraper.fr) using shortName. if fails then use CRC or CD serial to get romID */
|
||||
romID = m_plugin.GetRomId(FullPath, m_cacheList.Magic, romNamesDB, pluginsDataDir.c_str(), platformName.c_str(), ShortName.c_str());
|
||||
}
|
||||
if(romID.empty())
|
||||
romID = "PLUGIN";
|
||||
//gprintf("romID=%s\n", romID.c_str());
|
||||
|
||||
/* add rom to list */
|
||||
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
||||
|
||||
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
|
||||
strncpy(ListElement.id, romID.c_str(), 6);
|
||||
|
||||
/* Get titles - Rom filename, custom title, and database xml title */
|
||||
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
||||
*strrchr(RomFilename, '.') = '\0';
|
||||
|
||||
char CustomTitle[64];
|
||||
memset(CustomTitle, 0, sizeof(CustomTitle));
|
||||
strncpy(CustomTitle, CustomTitles.getString(m_plugin.PluginMagicWord, RomFilename).c_str(), 63);
|
||||
|
||||
const char *gameTDB_Title = NULL;
|
||||
if(gameTDB.IsLoaded() && strlen(CustomTitle) == 0)
|
||||
gameTDB.GetName(ListElement.id, gameTDB_Title);
|
||||
|
||||
/* set the roms title */
|
||||
if(strlen(CustomTitle) > 0)
|
||||
mbstowcs(ListElement.title, CustomTitle, 63);
|
||||
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
|
||||
mbstowcs(ListElement.title, gameTDB_Title, 63);
|
||||
else
|
||||
mbstowcs(ListElement.title, RomFilename, 63);
|
||||
Asciify(ListElement.title);
|
||||
|
||||
ListElement.settings[0] = m_cacheList.Magic; //Plugin magic
|
||||
ListElement.casecolor = m_cacheList.Color;
|
||||
ListElement.type = TYPE_PLUGIN;
|
||||
m_cacheList.push_back(ListElement);
|
||||
}
|
||||
|
||||
/* note: scummvm games have list generator in plugin.cpp */
|
||||
void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
|
||||
{
|
||||
Clear();
|
||||
if(!DBName.empty())
|
||||
{
|
||||
if(UpdateCache)
|
||||
fsop_deleteFile(DBName.c_str());
|
||||
else
|
||||
{
|
||||
CCache(*this, DBName, LOAD);
|
||||
if(!this->empty())
|
||||
return;
|
||||
fsop_deleteFile(DBName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(platform_cfg.loaded())
|
||||
{
|
||||
/* Search platform.ini to find plugin magic to get platformName */
|
||||
platformName = platform_cfg.getString("PLUGINS", m_plugin.PluginMagicWord);
|
||||
if(!platformName.empty())
|
||||
{
|
||||
/* check COMBINED for platform names that mean the same system just different region */
|
||||
/* some platforms have different names per country (ex. Genesis/Megadrive) */
|
||||
/* but we use only one platform name for both */
|
||||
string newName = platform_cfg.getString("COMBINED", platformName);
|
||||
if(newName.empty())
|
||||
platform_cfg.remove("COMBINED", platformName);
|
||||
else
|
||||
platformName = newName;
|
||||
|
||||
/* Load rom names and crc database */
|
||||
romNamesDB.load(fmt("%s/%s/%s.ini", pluginsDataDir.c_str(), platformName.c_str(), platformName.c_str()));
|
||||
/* Load platform name.xml database to get game's info using the gameID */
|
||||
gameTDB.OpenFile(fmt("%s/%s/%s.xml", pluginsDataDir.c_str(), platformName.c_str(), platformName.c_str()));
|
||||
if(gameTDB.IsLoaded())
|
||||
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
|
||||
}
|
||||
}
|
||||
CustomTitles.load(CustomTitlesPath.c_str());
|
||||
GetFiles(romsDir.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really?
|
||||
CloseConfigs();
|
||||
romNamesDB.unload();
|
||||
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
|
||||
CCache(*this, DBName, SAVE);
|
||||
}
|
||||
|
||||
void ListGenerator::CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
|
||||
const string& DBName, bool UpdateCache)
|
||||
{
|
||||
@ -314,8 +387,6 @@ void ListGenerator::CreateList(u32 Flow, u32 Device, const string& Path, const v
|
||||
{
|
||||
if(Flow == COVERFLOW_GAMECUBE)
|
||||
GetFiles(Path.c_str(), FileTypes, Add_GameCube_Game, true);// true means to look for a folder (/root)
|
||||
else if(Flow == COVERFLOW_PLUGIN)
|
||||
GetFiles(Path.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really?
|
||||
else if(Flow == COVERFLOW_HOMEBREW)
|
||||
GetFiles(Path.c_str(), FileTypes, Add_Homebrew_Dol, false);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "loader/wbfs.h"
|
||||
#include "loader/disc.h"
|
||||
#include "gui/GameTDB.hpp"
|
||||
#include "plugin/plugin.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -34,8 +35,9 @@ class ListGenerator : public vector<dir_discHdr>
|
||||
{
|
||||
public:
|
||||
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
|
||||
void Init(const char *settingsDir, const char *Language);
|
||||
void Init(const char *settingsDir, const char *Language, const char *plgnsDataDir);
|
||||
void Clear();
|
||||
void CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
|
||||
void CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
|
||||
const string& DBName, bool UpdateCache);
|
||||
u32 Color;
|
||||
|
@ -369,7 +369,7 @@ bool CMenu::init()
|
||||
}
|
||||
|
||||
/* Init gametdb and custom titles for game list making */
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str());
|
||||
|
||||
/* Init the onscreen pointer */
|
||||
m_aa = 3;
|
||||
@ -2434,7 +2434,7 @@ bool CMenu::_loadPluginList()
|
||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||
{
|
||||
u32 Magic = m_plugin.getPluginMagic(i);
|
||||
if(!m_plugin.GetEnableStatus(m_cfg, Magic))
|
||||
if(!m_plugin.GetEnableStatus(m_cfg, Magic))// m_plugin.PluginMagicWord is set here.
|
||||
continue;
|
||||
int romsPartition = m_plugin.GetRomPartition(i);
|
||||
if(romsPartition < 0)
|
||||
@ -2479,29 +2479,31 @@ bool CMenu::_loadPluginList()
|
||||
}
|
||||
else
|
||||
{
|
||||
string gameDir(fmt("%s:/%s", DeviceName[currentPartition], romDir));
|
||||
string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
|
||||
if(updateCache || !fsop_FileExist(cacheDir.c_str()))
|
||||
string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir));
|
||||
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
|
||||
if(updateCache || !fsop_FileExist(cachedListFile.c_str()))
|
||||
cacheCovers = true;
|
||||
vector<string> FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|');
|
||||
m_cacheList.Color = m_plugin.GetCaseColor(i);
|
||||
m_cacheList.Magic = Magic;
|
||||
m_cacheList.CreateList(COVERFLOW_PLUGIN, currentPartition, gameDir, FileTypes, cacheDir, updateCache);
|
||||
m_cacheList.CreateRomList(m_platform, romsDir, FileTypes, cachedListFile, updateCache);
|
||||
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
|
||||
m_gameList.push_back(*tmp_itr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Config scummvm;
|
||||
vector<dir_discHdr> scummvmList;
|
||||
Config scummvm;
|
||||
if(!scummvm.load(fmt("%s/scummvm.ini", m_pluginsDir.c_str())))
|
||||
{
|
||||
if(!scummvm.load(fmt("%s/scummvm/scummvm.ini", m_pluginsDir.c_str())))
|
||||
scummvm.load(fmt("%s:/apps/scummvm/scummvm.ini", DeviceName[currentPartition]));
|
||||
}
|
||||
//also check if in apps folder
|
||||
scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition], Magic);
|
||||
string platformName = "";
|
||||
if(m_platform.loaded())/* convert plugin magic to platform name */
|
||||
platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
|
||||
scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition], Magic, m_pluginDataDir.c_str(), platformName.c_str());
|
||||
for(vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++)
|
||||
m_gameList.push_back(*tmp_itr);
|
||||
scummvmList.clear();
|
||||
|
@ -176,7 +176,7 @@ int CMenu::_configAdv(void)
|
||||
_hideConfigAdv();
|
||||
if(m_curLanguage != prevLanguage)
|
||||
{
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str());
|
||||
fsop_deleteFolder(m_listCacheDir.c_str());// delete cache lists folder and remake it so all lists update.
|
||||
fsop_MakeFolder(m_listCacheDir.c_str());
|
||||
m_refreshGameList = true;
|
||||
|
@ -343,7 +343,8 @@ void CMenu::_textGameInfo(void)
|
||||
snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str());
|
||||
if(strstr(platformName, "multi") != NULL)// if multi platform ie. vbagx, genplusgx, get file extension
|
||||
{
|
||||
char ext[4];
|
||||
return; //if multi found (old platform.ini)
|
||||
/*char ext[4];
|
||||
if(strstr(GameHdr->path, ".zip") != NULL)// if zip get internal filename extension
|
||||
{
|
||||
ZipFile zFile(GameHdr->path);
|
||||
@ -354,7 +355,7 @@ void CMenu::_textGameInfo(void)
|
||||
{
|
||||
strcpy(ext, strrchr(GameHdr->path, '.') + 1);
|
||||
}
|
||||
snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str());
|
||||
snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str());*/
|
||||
}
|
||||
if(strlen(platformName) == 0)
|
||||
return;// no platform name found to match plugin magic #
|
||||
@ -369,17 +370,12 @@ void CMenu::_textGameInfo(void)
|
||||
snprintf(platformName, sizeof(platformName), "%s", newName.c_str());
|
||||
|
||||
/* Get roms's title without the extra ()'s or []'s */
|
||||
string ShortName = m_plugin.GetRomName(GameHdr);
|
||||
string ShortName = m_plugin.GetRomName(GameHdr->path);
|
||||
|
||||
/* Get 6 character unique romID (from Screenscraper.fr) using shortName. if fails then use CRC or CD serial */
|
||||
string romID;
|
||||
if(!ShortName.empty())
|
||||
romID = m_plugin.GetRomId(GameHdr, m_pluginDataDir.c_str(), platformName, ShortName);
|
||||
else
|
||||
return;// no romID. short name and crc/serial not found
|
||||
|
||||
/* copy romID to be used as gameID to get game info from xml */
|
||||
strncpy(GameID, romID.c_str(), 6);
|
||||
/* copy rom ID to be used as gameID to get game info from xml */
|
||||
strncpy(GameID, GameHdr->id, 6);
|
||||
if(strcasecmp(GameID, "PLUGIN") == 0)
|
||||
return;
|
||||
|
||||
/* Load platform name.xml database to get game's info using the gameID */
|
||||
gametdb.OpenFile(fmt("%s/%s/%s.xml", m_pluginDataDir.c_str(), platformName, platformName));
|
||||
|
@ -227,18 +227,22 @@ const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg, u8 *num)
|
||||
}
|
||||
|
||||
/* 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 used as the path even though 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, const char *datadir, const char *platform)
|
||||
{
|
||||
gprintf("Parsing scummvm.ini\n");
|
||||
vector<dir_discHdr> gameHeader;
|
||||
vector<dir_discHdr> ScummvmList;
|
||||
if(!ini.loaded())
|
||||
return gameHeader;
|
||||
return ScummvmList;
|
||||
|
||||
Config m_crc;
|
||||
if(platform != NULL)
|
||||
m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform));
|
||||
dir_discHdr ListElement;
|
||||
|
||||
const char *GameDomain = ini.firstDomain().c_str();
|
||||
dir_discHdr ListElement;
|
||||
while(1)
|
||||
{
|
||||
if(strlen(GameDomain) < 2)
|
||||
@ -251,18 +255,35 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char *Device, u32
|
||||
GameDomain = ini.nextDomain().c_str();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get shortName */
|
||||
char *cp;
|
||||
if((cp = strstr(GameName, " (")) != NULL)
|
||||
*cp = '\0';
|
||||
|
||||
/* get Game ID */
|
||||
string GameID = "PLUGIN";
|
||||
// Get game ID based on GameName
|
||||
if(m_crc.loaded() && m_crc.has(platform, GameName))
|
||||
{
|
||||
vector<string> searchID = m_crc.getStrings(platform, GameName, '|');
|
||||
if(!searchID[0].empty())
|
||||
GameID = searchID[0];
|
||||
}
|
||||
|
||||
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
||||
memcpy(ListElement.id, PLUGIN, 6);
|
||||
memcpy(ListElement.id, GameID.c_str(), 6);
|
||||
ListElement.casecolor = Plugins.back().caseColor;
|
||||
mbstowcs(ListElement.title, GameName, 63);
|
||||
strncpy(ListElement.path, GameDomain, sizeof(ListElement.path));
|
||||
gprintf("Found: %s\n", GameDomain);
|
||||
//gprintf("Found: %s\n", GameDomain);
|
||||
ListElement.settings[0] = Magic;
|
||||
ListElement.type = TYPE_PLUGIN;
|
||||
gameHeader.push_back(ListElement);
|
||||
ScummvmList.push_back(ListElement);
|
||||
GameDomain = ini.nextDomain().c_str();
|
||||
}
|
||||
return gameHeader;
|
||||
m_crc.unload();
|
||||
return ScummvmList;
|
||||
}
|
||||
|
||||
vector<string> Plugin::CreateArgs(const char *device, const char *path,
|
||||
@ -292,31 +313,15 @@ vector<string> Plugin::CreateArgs(const char *device, const char *path,
|
||||
}
|
||||
|
||||
/* Give the current game a simplified name */
|
||||
string Plugin::GetRomName(const dir_discHdr *gameHeader)
|
||||
string Plugin::GetRomName(const char *FullPath)
|
||||
{
|
||||
if(strrchr(gameHeader->path, '/') != NULL)
|
||||
{
|
||||
// Remove extension
|
||||
string FullName = strrchr(gameHeader->path, '/') + 1;
|
||||
FullName = FullName.substr(0, FullName.find_last_of("."));
|
||||
string FullName = strrchr(FullPath, '/') + 1;
|
||||
FullName = FullName.substr(0, FullName.find_last_of("."));
|
||||
|
||||
// Remove common suffixes and replace unwanted characters.
|
||||
string ShortName = FullName.substr(0, FullName.find(" (")).substr(0, FullName.find(" ["));
|
||||
replace(ShortName.begin(), ShortName.end(), '_', ' ');
|
||||
return ShortName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ScummVM
|
||||
char title[64];
|
||||
wcstombs(title, gameHeader->title, 63);
|
||||
title[63] = '\0';
|
||||
|
||||
string FullName = title;
|
||||
|
||||
string ShortName = FullName.substr(0, FullName.find(" (")).substr(0, FullName.find(" ["));
|
||||
return ShortName;
|
||||
}
|
||||
// Remove common suffixes and replace unwanted characters.
|
||||
string ShortName = FullName.substr(0, FullName.find(" (")).substr(0, FullName.find(" ["));
|
||||
replace(ShortName.begin(), ShortName.end(), '_', ' ');
|
||||
return ShortName;
|
||||
}
|
||||
|
||||
/* Get serial from PS1 header's iso (Borrowed from Retroarch with a few c++ changes)*/
|
||||
@ -460,39 +465,26 @@ void GetSerialMegaCD(const char *path, string &Serial)
|
||||
* and can also be used for snapshots/cartriges/discs images.
|
||||
* The Game ID is a 6 length alphanumerical value. It's screenscraper ID filled with 'A' letter.
|
||||
*/
|
||||
string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char *platform, const string &name)
|
||||
string Plugin::GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name)
|
||||
{
|
||||
string GameID;
|
||||
string CRC_Serial(12, '*');
|
||||
string GameID = "";
|
||||
string CRC_Serial(12, '*');// 12 digits because of ps1 and megaCD serials which can be 10 or more digits
|
||||
|
||||
// Load a platform list that is used to identify the current game.
|
||||
// Search a platform list that is used to identify the current game.
|
||||
// It contains a default filename(preferably No-intro without region flag), the GameID and then all known CRC32/serials.
|
||||
// filename=GameID|crc1|crc2|etc...
|
||||
// For example in SUPERNES.ini : Super Aleste=2241AA|5CA5781B|...
|
||||
Config m_crc;
|
||||
m_crc.unload();
|
||||
m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform) );
|
||||
|
||||
bool found_name = false;
|
||||
found_name = m_crc.has(platform, name.c_str());
|
||||
|
||||
// Get game ID based on the filename
|
||||
if(found_name)
|
||||
if(m_crc.has(platform, name))
|
||||
{
|
||||
vector<string> searchID = m_crc.getStrings(platform, name.c_str(), '|');
|
||||
|
||||
if(!searchID.empty())
|
||||
{
|
||||
vector<string> searchID = m_crc.getStrings(platform, name, '|');
|
||||
if(!searchID[0].empty())
|
||||
GameID = searchID[0];
|
||||
}
|
||||
|
||||
m_crc.unload();
|
||||
}
|
||||
// Get game ID by CRC or serial
|
||||
else
|
||||
{
|
||||
m_crc.unload();
|
||||
|
||||
char crc_string[9];
|
||||
crc_string[0] = '\0';
|
||||
u32 buffer;
|
||||
@ -501,15 +493,15 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
// For arcade games use the crc zip
|
||||
if(strcasestr(platform, "ARCADE") || strcasestr(platform, "CPS") || !strncasecmp(platform, "NEOGEO", 6))
|
||||
{
|
||||
strncpy(crc_string, fmt("%08x", crc32file(gameHeader->path)), 8);
|
||||
strncpy(crc_string, fmt("%08x", crc32file(romPath)), 8);
|
||||
crc_string[8] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look for for the file's crc inside the archive
|
||||
if(strstr(gameHeader->path, ".zip") != NULL)
|
||||
if(strstr(romPath, ".zip") != NULL)
|
||||
{
|
||||
infile.open(gameHeader->path, ios::binary);
|
||||
infile.open(romPath, ios::binary);
|
||||
infile.seekg(0x0e, ios::beg);
|
||||
infile.read((char*)&buffer, 8);
|
||||
infile.close();
|
||||
@ -522,19 +514,19 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
// CRC calculation would take up to 30 seconds!
|
||||
if(!strcasecmp(platform, "MEGACD"))
|
||||
{
|
||||
GetSerialMegaCD(gameHeader->path, CRC_Serial);
|
||||
GetSerialMegaCD(romPath, CRC_Serial);
|
||||
}
|
||||
else if(!strcasecmp(platform, "PS1"))
|
||||
{
|
||||
bool found;
|
||||
found = GetSerialPS1(gameHeader->path, CRC_Serial, 0);
|
||||
found = GetSerialPS1(romPath, CRC_Serial, 0);
|
||||
|
||||
if(!found)
|
||||
GetSerialPS1(gameHeader->path, CRC_Serial, 1);
|
||||
GetSerialPS1(romPath, CRC_Serial, 1);
|
||||
}
|
||||
else if(!strcasecmp(platform, "ATARIST"))
|
||||
{
|
||||
s8 pos = m_plugin.GetPluginPosition(gameHeader->settings[0]);
|
||||
s8 pos = m_plugin.GetPluginPosition(Magic);
|
||||
string FileTypes = m_plugin.GetFileTypes(pos);
|
||||
string path;
|
||||
|
||||
@ -543,7 +535,7 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
{
|
||||
Config m_cfg;
|
||||
m_cfg.unload();
|
||||
m_cfg.load(fmt("%s", gameHeader->path) );
|
||||
m_cfg.load(fmt("%s", romPath) );
|
||||
path = m_cfg.getString("Floppy", "szDiskAFileName", "");
|
||||
m_cfg.unload();
|
||||
|
||||
@ -555,7 +547,7 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
}
|
||||
else
|
||||
{
|
||||
path = gameHeader->path;
|
||||
path = romPath;
|
||||
}
|
||||
|
||||
if (path.find(".zip") != std::string::npos)
|
||||
@ -575,13 +567,13 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
}
|
||||
else if(!strcasecmp(platform, "DOS"))
|
||||
{
|
||||
s8 pos = m_plugin.GetPluginPosition(gameHeader->settings[0]);
|
||||
s8 pos = m_plugin.GetPluginPosition(Magic);
|
||||
string FileTypes = m_plugin.GetFileTypes(pos);
|
||||
|
||||
if(strcasestr(FileTypes.c_str(), ".conf"))
|
||||
{
|
||||
ifstream inputFile;
|
||||
inputFile.open(gameHeader->path, std::ios::binary);
|
||||
inputFile.open(romPath, std::ios::binary);
|
||||
string line;
|
||||
std::string dospath;
|
||||
std::string temp;
|
||||
@ -646,17 +638,22 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
}// Just check CRC for a regular file on any other system.
|
||||
else
|
||||
{
|
||||
strncpy(crc_string, fmt("%08x", crc32file(gameHeader->path)), 8);
|
||||
strncpy(crc_string, fmt("%08x", crc32file(romPath)), 8);
|
||||
crc_string[8] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(crc_string[0] != '\0')
|
||||
{
|
||||
CRC_Serial = crc_string;
|
||||
//gprintf("romCRC=%s\n", crc_string);
|
||||
}
|
||||
|
||||
// Now search ID with the obtained CRC/Serial
|
||||
// Just add 2 pipes in the pattern to be sure we don't find a crc instead of ID
|
||||
/****************************************************************/
|
||||
/* Now search ID with the obtained CRC/Serial */
|
||||
/* Just add 2 pipes in the pattern to be sure we don't find a crc instead of ID */
|
||||
/* note crc's are 8 digits but serials can be more, thats why we use idx for CRC_Serial length */
|
||||
size_t idx;
|
||||
idx=CRC_Serial.length();
|
||||
CRC_Serial.insert(0, "|").insert(idx+1, "|");
|
||||
@ -667,24 +664,19 @@ string Plugin::GetRomId(const dir_discHdr *gameHeader, const char *datadir, char
|
||||
|
||||
while(getline(inputFile, line))
|
||||
{
|
||||
// FIXME ahem, ignore case...
|
||||
if (line.find(lowerCase( CRC_Serial ), 0) != string::npos || line.find(upperCase( CRC_Serial ), 0) != string::npos)
|
||||
// FIXME ahem, ignore case... - line could contain a mix of lower and upper case. if so this 'if' will not work
|
||||
if(line.find(lowerCase( CRC_Serial ), 0) != string::npos || line.find(upperCase( CRC_Serial ), 0) != string::npos)
|
||||
{
|
||||
unsigned first = (line.find('=') + 1);
|
||||
unsigned last = line.find_first_of('|');
|
||||
unsigned last = line.find_first_of('|');// we could just use first + 6 since all ID's are 6 digits
|
||||
string ID = line.substr (first,last-first);
|
||||
|
||||
if(ID.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
GameID = ID;
|
||||
if(!ID.empty())
|
||||
GameID = ID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GameID;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ public:
|
||||
const char *GetDolName(u32 magic);
|
||||
const char *GetCoverFolderName(u32 magic);
|
||||
const char *GetRomDir(u8 pos);
|
||||
string GetRomName(const dir_discHdr *gameHeader);
|
||||
string GetRomId(const dir_discHdr *gameHeader,const char *datadir, char *platform, const string &name);
|
||||
string GetRomName(const char *FullPath);
|
||||
string GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name);
|
||||
int GetRomPartition(u8 pos);
|
||||
const string& GetFileTypes(u8 pos);
|
||||
wstringEx GetPluginName(u8 pos);
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
vector<string> CreateArgs(const char *device, const char *path,
|
||||
const char *title, const char *loader, u32 title_len_no_ext, u32 magic);
|
||||
vector<dir_discHdr> ParseScummvmINI(Config &ini, const char *Device, u32 Magic);
|
||||
vector<dir_discHdr> ParseScummvmINI(Config &ini, const char *Device, u32 Magic, const char *datadir, const char *platform);
|
||||
string GenerateCoverLink(dir_discHdr gameHeader, const string& constURL, Config &Checksums);
|
||||
char PluginMagicWord[9];
|
||||
|
||||
|
@ -1 +1 @@
|
||||
<pd><ViewState><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\cheats" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\fileOps" x="false"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\homebrew" x="false"></e><e p="Wiiflow\source\loader" x="false"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\source\gc" x="false"></e><e p="Wiiflow\source\list" x="false"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\banner" x="false"></e><e p="Wiiflow\source\config" x="false"></e><e p="Wiiflow\source\libwbfs" x="false"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source\sicksaxis-wrapper" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\channel" x="false"></e><e p="Wiiflow\source\hw" x="false"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\plugin" x="false"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\wii" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source\booter" x="false"></e><e p="Wiiflow\source\devicemounter" x="false"></e><e p="Wiiflow\source\gui" x="true"></e><e p="Wiiflow" x="true"></e></ViewState></pd>
|
||||
<pd><ViewState><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\cheats" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\fileOps" x="false"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\homebrew" x="false"></e><e p="Wiiflow\source\loader" x="false"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\source\gc" x="false"></e><e p="Wiiflow\source\list" x="true"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\banner" x="false"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\libwbfs" x="false"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source\sicksaxis-wrapper" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\channel" x="false"></e><e p="Wiiflow\source\hw" x="false"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\plugin" x="true"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\wii" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source\booter" x="false"></e><e p="Wiiflow\source\devicemounter" x="false"></e><e p="Wiiflow\source\gui" x="false"></e><e p="Wiiflow" x="true"></e></ViewState></pd>
|
Loading…
Reference in New Issue
Block a user