From cd9b3ca394dc278874f029464294848b89aa5a40 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Tue, 29 May 2012 13:49:28 +0000 Subject: [PATCH] -fixed scummvm games not showing anymore --- source/menu/menu.cpp | 35 ++++++++++++++++++++--------------- source/plugin/plugin.cpp | 8 ++++++++ source/plugin/plugin.hpp | 3 +++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index c3a5dbfd..bd2f80a3 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1515,23 +1515,28 @@ void CMenu::_initCF(void) if(m_current_view == COVERFLOW_EMU) { string tempname(m_gameList[i].path); - if(tempname.empty() || tempname.find_first_of('/') == string::npos) + if(!m_plugin.isScummVM(m_gameList[i].hdr.magic)) { - continue; + if(tempname.empty() || tempname.find_first_of('/') == string::npos) + { + continue; + } + tempname.erase(0, tempname.find_first_of('/')+1); + string dirName = tempname.substr(0, tempname.find_first_of('/')+1); + if (tempname.find_first_of('/') == string::npos) + { + continue; + } + tempname.assign(&tempname[tempname.find_last_of('/') + 1]); + if(tempname.find_last_of('.') == string::npos) + { + continue; + } + tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.')); + id = dirName+tempname; } - tempname.erase(0, tempname.find_first_of('/')+1); - string dirName = tempname.substr(0, tempname.find_first_of('/')+1); - if (tempname.find_first_of('/') == string::npos) - { - continue; - } - tempname.assign(&tempname[tempname.find_last_of('/') + 1]); - if(tempname.find_last_of('.') == string::npos) - { - continue; - } - tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.')); - id = dirName+tempname; + else + id = tempname; } else id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6); diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 4cf1a182..bc18ec44 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -22,6 +22,7 @@ static char* emptyChar = (char*)" "; void Plugin::init(string m_pluginsDir) { + ScummVM_magic = 0; pluginsDir = m_pluginsDir; //Ready to add plugins adding = true; @@ -192,6 +193,8 @@ vector Plugin::ParseScummvmINI(Config &ini, string Device) vector gameHeader; if(!ini.loaded()) return gameHeader; + ScummVM_magic = Plugins[Plugins.size()-1].magicWord; + string game(ini.firstDomain()); string GameName; dir_discHdr tmp; @@ -265,3 +268,8 @@ bool Plugin::isMplayerCE(u32 magic) return (Plugins[Plugin_Pos].magicWord == 0x4D504345); return false; } + +bool Plugin::isScummVM(u32 magic) +{ + return (magic == ScummVM_magic); +} diff --git a/source/plugin/plugin.hpp b/source/plugin/plugin.hpp index 4cce94fb..19767b22 100644 --- a/source/plugin/plugin.hpp +++ b/source/plugin/plugin.hpp @@ -49,12 +49,15 @@ public: void Cleanup(); void EndAdd(); vector ParseScummvmINI(Config &ini, string Device); + bool isScummVM(u32 magic); + private: s8 GetPluginPosition(u32 magic); vector Plugins; s8 Plugin_Pos; string pluginsDir; + u32 ScummVM_magic; bool adding; }; #endif