Change all plugin files to use the ValidPluginVersion from Plugin List.cpp

This commit is contained in:
Emmet Young 2012-10-06 23:57:18 +10:00
parent f3b672ec37
commit 62f7366885
10 changed files with 18 additions and 98 deletions

View File

@ -46,7 +46,7 @@ void CAudioPlugin::Init ( const char * FileName )
if (GetDllInfo == NULL) { UnloadPlugin(); return; }
GetDllInfo(&m_PluginInfo);
if (!ValidPluginVersion(&m_PluginInfo)) { UnloadPlugin(); return; }
if (!CPluginList::ValidPluginVersion(m_PluginInfo)) { UnloadPlugin(); return; }
//Find entries for functions in DLL
void (__cdecl *InitFunc) ( void );
@ -247,18 +247,6 @@ void CAudioPlugin::GameReset(void)
}
}
bool CAudioPlugin::ValidPluginVersion(PLUGIN_INFO * PluginInfo) {
switch (PluginInfo->Type) {
case PLUGIN_TYPE_AUDIO:
if (PluginInfo->MemoryBswaped == FALSE) { return FALSE; }
if (PluginInfo->Version == 0x0101) { return TRUE; }
if (PluginInfo->Version == 0x0102) { return TRUE; }
break;
}
return FALSE;
}
void CAudioPlugin::UnloadPlugin(void) {
if (m_hAudioThread)
{

View File

@ -30,7 +30,6 @@ private:
void Init ( const char * FileName );
void UnloadPlugin ( void );
bool ValidPluginVersion ( PLUGIN_INFO * PluginInfo );
void (__cdecl *CloseDLL) ( void );
void (__cdecl *RomOpen) ( void );

View File

@ -50,7 +50,7 @@ void CControl_Plugin::Init ( const char * FileName )
if (GetDllInfo == NULL) { UnloadPlugin(); return; }
GetDllInfo(&m_PluginInfo);
if (!ValidPluginVersion(&m_PluginInfo)) { UnloadPlugin(); return; }
if (!CPluginList::ValidPluginVersion(m_PluginInfo)) { UnloadPlugin(); return; }
//Find entries for functions in DLL
void (__cdecl *InitFunc) ( void );
@ -238,17 +238,6 @@ void CControl_Plugin::GameReset(void)
}
}
bool CControl_Plugin::ValidPluginVersion(PLUGIN_INFO * PluginInfo) {
switch (PluginInfo->Type) {
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;
}
void CControl_Plugin::UnloadPlugin(void) {
if (m_AllocatedControllers) {
for (int count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++) {

View File

@ -100,7 +100,6 @@ private:
CONTROL m_PluginControllers[4];
void UnloadPlugin ( void );
bool ValidPluginVersion ( PLUGIN_INFO * PluginInfo );
void (__cdecl *CloseDLL) ( void );
void (__cdecl *RomOpen) ( void );

View File

@ -54,7 +54,7 @@ void CGfxPlugin::Init ( const char * FileName )
if (GetDllInfo == NULL) { UnloadPlugin(); return; }
GetDllInfo(&m_PluginInfo);
if (!ValidPluginVersion(&m_PluginInfo)) { UnloadPlugin(); return; }
if (!CPluginList::ValidPluginVersion(m_PluginInfo)) { UnloadPlugin(); return; }
//Find entries for functions in DLL
BOOL (__cdecl *InitFunc) ( void * Gfx_Info );
@ -321,18 +321,6 @@ void CGfxPlugin::GameReset(void)
}
}
bool CGfxPlugin::ValidPluginVersion(PLUGIN_INFO * PluginInfo) {
switch (PluginInfo->Type) {
case PLUGIN_TYPE_GFX:
if (PluginInfo->MemoryBswaped == FALSE) { return FALSE; }
if (PluginInfo->Version == 0x0102) { return TRUE; }
if (PluginInfo->Version == 0x0103) { return TRUE; }
if (PluginInfo->Version == 0x0104) { return TRUE; }
break;
}
return FALSE;
}
void CGfxPlugin::UnloadPlugin(void) {
if (m_hDll != NULL ) {
FreeLibrary((HMODULE)m_hDll);

View File

@ -72,7 +72,6 @@ private:
void Init ( const char * FileName );
void UnloadPlugin ( void );
bool ValidPluginVersion ( PLUGIN_INFO * PluginInfo );
GFXDEBUG_INFO m_GFXDebug;
void * m_hDll;

View File

@ -104,27 +104,25 @@ void CPluginList::AddPluginFromDir ( CPath Dir)
}
bool CPluginList::ValidPluginVersion ( PLUGIN_INFO & PluginInfo ) {
if (!PluginInfo.MemoryBswaped)
{
return false;
}
switch (PluginInfo.Type)
{
case PLUGIN_TYPE_RSP:
if (PluginInfo.Version == 0x0001) { return true; }
if (PluginInfo.Version == 0x0100) { return true; }
if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; }
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.Version == 0x0102) { return true; }
if (PluginInfo.Version == 0x0103) { return true; }
if (PluginInfo.Version == 0x0104) { return true; }
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.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; }
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; }
@ -136,7 +134,7 @@ bool CPluginList::ValidPluginVersion ( PLUGIN_INFO & PluginInfo ) {
}
#ifdef tofix
#ifdef toremove
CPluginList::CPluginList (CSettings * Settings) {
_Settings = Settings;
}
@ -245,30 +243,4 @@ PluginList CPluginList::GetPluginList (void) {
return Plugins;
}
bool CPluginList::ValidPluginVersion ( PLUGIN_INFO * PluginInfo ) {
switch (PluginInfo->Type) {
case PLUGIN_TYPE_RSP:
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->Version == 0x0102) { return TRUE; }
if (PluginInfo->Version == 0x0103) { return TRUE; }
if (PluginInfo->Version == 0x0104) { return TRUE; }
break;
case PLUGIN_TYPE_AUDIO:
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;
}
#endif

View File

@ -17,7 +17,6 @@ private:
CPath m_PluginDir;
void AddPluginFromDir ( CPath Dir);
bool ValidPluginVersion ( PLUGIN_INFO & PluginInfo );
public:
CPluginList(bool bAutoFill = true);
@ -26,4 +25,5 @@ public:
bool LoadList ( void );
int GetPluginCount ( void ) const;
const PLUGIN * GetPluginInfo ( int indx ) const;
static bool ValidPluginVersion ( PLUGIN_INFO & PluginInfo );
};

View File

@ -28,7 +28,7 @@ CRSP_Plugin::CRSP_Plugin ( const char * FileName) {
if (GetDllInfo == NULL) { UnloadPlugin(); return; }
GetDllInfo(&m_PluginInfo);
if (!ValidPluginVersion(&m_PluginInfo)) { UnloadPlugin(); return; }
if (!CPluginList::ValidPluginVersion(m_PluginInfo)) { UnloadPlugin(); return; }
//Find entries for functions in DLL
void (__cdecl *InitFunc)( void );
@ -294,16 +294,3 @@ void CRSP_Plugin::UnloadPlugin(void) {
InitiateDebugger = NULL;
}
bool CRSP_Plugin::ValidPluginVersion(PLUGIN_INFO * PluginInfo) {
switch (PluginInfo->Type) {
case PLUGIN_TYPE_RSP:
if (PluginInfo->MemoryBswaped == FALSE) { 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;
}
return FALSE;
}

View File

@ -39,7 +39,6 @@ typedef struct {
PLUGIN_INFO m_PluginInfo;
void UnloadPlugin ( void );
bool ValidPluginVersion ( PLUGIN_INFO * PluginInfo );
bool Initiate_1_0 ( CPlugins * Plugins, CN64System * System );
void (__cdecl *CloseDLL) ( void );