From 821922f133e9bb4a425bd480deb06a718cca6b4a Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 18 Jan 2016 22:26:15 +1100 Subject: [PATCH] [Project64] Clean up code related to plugins --- Source/Project64-core/Plugins/AudioPlugin.cpp | 20 +++++++++++-------- Source/Project64-core/Plugins/AudioPlugin.h | 2 +- .../Project64-core/Plugins/ControllerPlugin.h | 2 +- Source/Project64-core/Plugins/GFXPlugin.h | 2 +- Source/Project64-core/Plugins/PluginBase.cpp | 2 +- Source/Project64-core/Plugins/RSPPlugin.cpp | 2 +- Source/Project64-core/Plugins/RSPPlugin.h | 2 +- Source/Project64/Plugins/PluginList.cpp | 4 ++-- .../Settings/SettingsPage-Game-Plugin.cpp | 4 ++-- .../Settings/SettingsPage-Plugin.cpp | 4 ++-- 10 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Source/Project64-core/Plugins/AudioPlugin.cpp b/Source/Project64-core/Plugins/AudioPlugin.cpp index c7fa8035c..dd8749d56 100644 --- a/Source/Project64-core/Plugins/AudioPlugin.cpp +++ b/Source/Project64-core/Plugins/AudioPlugin.cpp @@ -14,7 +14,7 @@ #include #include #include -#include "AudioPlugin.h" +#include #ifdef _WIN32 #include #endif @@ -64,8 +64,8 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) { struct AUDIO_INFO { - HWND hwnd; - HINSTANCE hinst; + void * hwnd; + void * hinst; int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre @@ -97,9 +97,9 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) AUDIO_INFO Info = { 0 }; - Info.hwnd = (HWND)Window->GetWindowHandle(); - Info.hinst = GetModuleHandle(NULL); - Info.MemoryBswaped = TRUE; + Info.hwnd = Window ? Window->GetWindowHandle() : NULL; + Info.hinst = Window ? Window->GetModuleInstance() : NULL;; + Info.MemoryBswaped = true; Info.CheckInterrupts = DummyCheckInterrupts; // We are initializing the plugin before any rom is loaded so we do not have any correct @@ -167,13 +167,15 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) void CAudioPlugin::UnloadPluginDetails(void) { +#ifdef _WIN32 if (m_hAudioThread) { WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread"); TerminateThread(m_hAudioThread, 0); m_hAudioThread = NULL; } - AiDacrateChanged = NULL; +#endif + AiDacrateChanged = NULL; AiLenChanged = NULL; AiReadLength = NULL; AiUpdate = NULL; @@ -190,6 +192,7 @@ void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type) AiDacrateChanged(Type); } +#ifdef _WIN32 void CAudioPlugin::AudioThread(CAudioPlugin * _this) { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); @@ -201,4 +204,5 @@ void CAudioPlugin::AudioThread(CAudioPlugin * _this) { _this->AiUpdate(true); } -} \ No newline at end of file +} +#endif diff --git a/Source/Project64-core/Plugins/AudioPlugin.h b/Source/Project64-core/Plugins/AudioPlugin.h index 0f6112f9f..97a924bae 100644 --- a/Source/Project64-core/Plugins/AudioPlugin.h +++ b/Source/Project64-core/Plugins/AudioPlugin.h @@ -9,7 +9,7 @@ * * ****************************************************************************/ #pragma once -#include "PluginBase.h" +#include class CAudioPlugin : public CPlugin { diff --git a/Source/Project64-core/Plugins/ControllerPlugin.h b/Source/Project64-core/Plugins/ControllerPlugin.h index 862a7e79e..6923174f5 100644 --- a/Source/Project64-core/Plugins/ControllerPlugin.h +++ b/Source/Project64-core/Plugins/ControllerPlugin.h @@ -9,7 +9,7 @@ * * ****************************************************************************/ #pragma once -#include "PluginBase.h" +#include #pragma warning(push) #pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union diff --git a/Source/Project64-core/Plugins/GFXPlugin.h b/Source/Project64-core/Plugins/GFXPlugin.h index b76fc2231..562e4da9d 100644 --- a/Source/Project64-core/Plugins/GFXPlugin.h +++ b/Source/Project64-core/Plugins/GFXPlugin.h @@ -9,7 +9,7 @@ * * ****************************************************************************/ #pragma once -#include "PluginBase.h" +#include class CGfxPlugin : public CPlugin { diff --git a/Source/Project64-core/Plugins/PluginBase.cpp b/Source/Project64-core/Plugins/PluginBase.cpp index c07054b16..9886b1056 100644 --- a/Source/Project64-core/Plugins/PluginBase.cpp +++ b/Source/Project64-core/Plugins/PluginBase.cpp @@ -9,7 +9,7 @@ * * ****************************************************************************/ #include "stdafx.h" -#include "PluginBase.h" +#include CPlugin::CPlugin() : DllAbout(NULL), diff --git a/Source/Project64-core/Plugins/RSPPlugin.cpp b/Source/Project64-core/Plugins/RSPPlugin.cpp index 08eaafc1e..a5a9897ba 100644 --- a/Source/Project64-core/Plugins/RSPPlugin.cpp +++ b/Source/Project64-core/Plugins/RSPPlugin.cpp @@ -14,7 +14,7 @@ #include #include "RSPPlugin.h" #include "GFXPlugin.h" -#include "AudioPlugin.h" +#include void DummyFunc1(int a) { a += 1; } diff --git a/Source/Project64-core/Plugins/RSPPlugin.h b/Source/Project64-core/Plugins/RSPPlugin.h index 3bc6b6c82..1fa8401f2 100644 --- a/Source/Project64-core/Plugins/RSPPlugin.h +++ b/Source/Project64-core/Plugins/RSPPlugin.h @@ -9,7 +9,7 @@ * * ****************************************************************************/ #pragma once -#include "PluginBase.h" +#include class CRSP_Plugin : public CPlugin { diff --git a/Source/Project64/Plugins/PluginList.cpp b/Source/Project64/Plugins/PluginList.cpp index 582834e62..38a47384a 100644 --- a/Source/Project64/Plugins/PluginList.cpp +++ b/Source/Project64/Plugins/PluginList.cpp @@ -85,8 +85,8 @@ void CPluginList::AddPluginFromDir(CPath Dir) continue; } - void(__cdecl *GetDllInfo) (PLUGIN_INFO * PluginInfo); - GetDllInfo = (void(__cdecl *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo"); + void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo); + GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo"); if (GetDllInfo == NULL) { continue; diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp index c49b10072..64f3c5d27 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp @@ -126,8 +126,8 @@ void CGamePluginPage::ShowAboutButton(int id) } //Get DLL about - void(__cdecl *DllAbout) (HWND hWnd); - DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout"); + void(CALL *DllAbout) (HWND hWnd); + DllAbout = (void(CALL *)(HWND))GetProcAddress(hLib, "DllAbout"); //call the function from the dll DllAbout(m_hWnd); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp index abdb313d7..fcd661b2f 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp @@ -118,8 +118,8 @@ void COptionPluginPage::ShowAboutButton(int id) } //Get DLL about - void(__cdecl *DllAbout) (HWND hWnd); - DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout"); + void(CALL *DllAbout) (HWND hWnd); + DllAbout = (void(CALL *)(HWND))GetProcAddress(hLib, "DllAbout"); //call the function from the dll DllAbout(m_hWnd);