[Project64] remove ValidPluginVersion from Plugin List.cpp

This commit is contained in:
zilmar 2015-11-12 20:15:49 +11:00
parent efa3c87de7
commit 69383fcc7e
2 changed files with 5 additions and 36 deletions

View File

@ -10,6 +10,8 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#include <io.h> #include <io.h>
#include "Plugin List.h"
#include <Project64\Plugins\Plugin Base.h>
CPluginList::CPluginList(bool bAutoFill /* = true */) : CPluginList::CPluginList(bool bAutoFill /* = true */) :
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "") m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
@ -91,15 +93,13 @@ void CPluginList::AddPluginFromDir(CPath Dir)
PLUGIN Plugin = { 0 }; PLUGIN Plugin = { 0 };
Plugin.Info.MemoryBswaped = true; Plugin.Info.MemoryBswaped = true;
GetDllInfo(&Plugin.Info); GetDllInfo(&Plugin.Info);
if (!ValidPluginVersion(Plugin.Info)) if (!CPlugin::ValidPluginVersion(Plugin.Info))
{ {
continue; continue;
} }
Plugin.FullPath = Dir; Plugin.FullPath = Dir;
std::string& fullPath = Dir; Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir));
std::string& pluginPath = m_PluginDir;
Plugin.FileName = fullPath.substr(pluginPath.length());
if (GetProcAddress(hLib, "DllAbout") != NULL) if (GetProcAddress(hLib, "DllAbout") != NULL)
{ {
@ -115,33 +115,3 @@ void CPluginList::AddPluginFromDir(CPath Dir)
} }
} }
} }
bool CPluginList::ValidPluginVersion(PLUGIN_INFO & PluginInfo) {
switch (PluginInfo.Type)
{
case PLUGIN_TYPE_RSP:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0001) { return true; }
if (PluginInfo.Version == 0x0100) { return true; }
if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; }
break;
case PLUGIN_TYPE_GFX:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0102) { return true; }
if (PluginInfo.Version == 0x0103) { return true; }
if (PluginInfo.Version == 0x0104) { return true; }
break;
case PLUGIN_TYPE_AUDIO:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; }
break;
case PLUGIN_TYPE_CONTROLLER:
if (PluginInfo.Version == 0x0100) { return true; }
if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; }
break;
}
return FALSE;
}

View File

@ -10,7 +10,7 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Project64/Settings/Settings.h> #include <Project64/Settings.h>
class CPluginList class CPluginList
{ {
@ -30,7 +30,6 @@ public:
bool LoadList(void); bool LoadList(void);
int GetPluginCount(void) const; int GetPluginCount(void) const;
const PLUGIN * GetPluginInfo(int indx) const; const PLUGIN * GetPluginInfo(int indx) const;
static bool ValidPluginVersion(PLUGIN_INFO & PluginInfo);
private: private:
typedef std::vector<PLUGIN> PluginList; typedef std::vector<PLUGIN> PluginList;