- added a fix for plugin rom game info when using a multi platform plugin, ie. genplusgx, wiimednafen, vbagx. if a multi platform plugin is detected then we get the rom's filename extension and use it to determine the platform. if its a zip file we get the filename from inside the zip file. this fix requires an updated platform ini which will be supplied with wfl v5.2.0

This commit is contained in:
Fledge68 2019-02-25 06:09:46 -06:00
parent f9f23f9048
commit 5407cfdf87
4 changed files with 33 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -4,6 +4,7 @@
#include "gui/GameTDB.hpp"
#include "plugin/plugin.hpp"
#include "plugin/crc32.h"
#include "unzip/ZipFile.h"
s16 m_gameinfoLblRomInfo;
@ -326,8 +327,9 @@ void CMenu::_textGameInfo(void)
tdb_found = false;
GameTDB gametdb;
TexData emptyTex;
const dir_discHdr *GameHdr = CoverFlow.getHdr();
if(CoverFlow.getHdr()->type == TYPE_PLUGIN)
if(GameHdr->type == TYPE_PLUGIN)
{
// Check the platform name corresponding to the current magic number.
// We can't use magic # directly since it'd require hardcoding values and a # can be several systems(genplus)
@ -341,12 +343,26 @@ void CMenu::_textGameInfo(void)
/* Search platform.ini to find plugin magic to get platformName */
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];
if(strstr(GameHdr->path, ".zip") != NULL)// if zip get internal filename extension
{
ZipFile zFile(GameHdr->path);
const char *fileName = zFile.GetFileName();
strcpy(ext, strrchr(fileName, '.') + 1);
}
else
{
strcpy(ext, strrchr(GameHdr->path, '.') + 1);
}
snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str());
}
m_platform.unload();
if(strlen(platformName) == 0)
return;// no platform name found to match plugin magic #
/* Get Game's crc/serial to be used as gameID by searching platformName.ini file */
const dir_discHdr *GameHdr = CoverFlow.getHdr();
string romID;// this will be the crc or serial
string ShortName = m_plugin.GetRomName(GameHdr);// if scummvm game then shortname=NULL
if(!ShortName.empty())

View File

@ -55,6 +55,20 @@ bool ZipFile::LoadList()
return true;
}
char filename[256];
const char *ZipFile::GetFileName()
{
memset(filename, 0, sizeof(filename));
if(unzGoToFirstFile(File) == UNZ_OK)
{
if(unzGetCurrentFileInfo(File, &cur_file_info, filename, sizeof(filename), NULL, 0, NULL, 0) != UNZ_OK)
filename[0] = '\0';
}
return filename;
}
bool ZipFile::ExtractAll(const char *dest)
{
if(!File)

View File

@ -48,6 +48,7 @@ public:
//!Extract all files from a zip file to a directory
//!\param dest Destination path to where to extract
bool ExtractAll(const char *dest);
const char *GetFileName();
protected:
bool LoadList();
unzFile File;