[Project64] Clean up code related to plugins

This commit is contained in:
zilmar 2016-01-18 22:26:15 +11:00
parent df04d377e0
commit 821922f133
10 changed files with 24 additions and 20 deletions

View File

@ -14,7 +14,7 @@
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h> #include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
#include <Project64-core/N64System/Mips/RegisterClass.h> #include <Project64-core/N64System/Mips/RegisterClass.h>
#include <Project64-core/N64System/N64Class.h> #include <Project64-core/N64System/N64Class.h>
#include "AudioPlugin.h" #include <Project64-core/Plugins/AudioPlugin.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#endif #endif
@ -64,8 +64,8 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
struct AUDIO_INFO struct AUDIO_INFO
{ {
HWND hwnd; void * hwnd;
HINSTANCE hinst; void * hinst;
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre 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 }; AUDIO_INFO Info = { 0 };
Info.hwnd = (HWND)Window->GetWindowHandle(); Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
Info.hinst = GetModuleHandle(NULL); Info.hinst = Window ? Window->GetModuleInstance() : NULL;;
Info.MemoryBswaped = TRUE; Info.MemoryBswaped = true;
Info.CheckInterrupts = DummyCheckInterrupts; Info.CheckInterrupts = DummyCheckInterrupts;
// We are initializing the plugin before any rom is loaded so we do not have any correct // 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) void CAudioPlugin::UnloadPluginDetails(void)
{ {
#ifdef _WIN32
if (m_hAudioThread) if (m_hAudioThread)
{ {
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread"); WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
TerminateThread(m_hAudioThread, 0); TerminateThread(m_hAudioThread, 0);
m_hAudioThread = NULL; m_hAudioThread = NULL;
} }
AiDacrateChanged = NULL; #endif
AiDacrateChanged = NULL;
AiLenChanged = NULL; AiLenChanged = NULL;
AiReadLength = NULL; AiReadLength = NULL;
AiUpdate = NULL; AiUpdate = NULL;
@ -190,6 +192,7 @@ void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
AiDacrateChanged(Type); AiDacrateChanged(Type);
} }
#ifdef _WIN32
void CAudioPlugin::AudioThread(CAudioPlugin * _this) void CAudioPlugin::AudioThread(CAudioPlugin * _this)
{ {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@ -201,4 +204,5 @@ void CAudioPlugin::AudioThread(CAudioPlugin * _this)
{ {
_this->AiUpdate(true); _this->AiUpdate(true);
} }
} }
#endif

View File

@ -9,7 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "PluginBase.h" #include <Project64-core/Plugins/PluginBase.h>
class CAudioPlugin : public CPlugin class CAudioPlugin : public CPlugin
{ {

View File

@ -9,7 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "PluginBase.h" #include <Project64-core/Plugins/PluginBase.h>
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union #pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union

View File

@ -9,7 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "PluginBase.h" #include <Project64-core/Plugins/PluginBase.h>
class CGfxPlugin : public CPlugin class CGfxPlugin : public CPlugin
{ {

View File

@ -9,7 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#include "PluginBase.h" #include <Project64-core/Plugins/PluginBase.h>
CPlugin::CPlugin() : CPlugin::CPlugin() :
DllAbout(NULL), DllAbout(NULL),

View File

@ -14,7 +14,7 @@
#include <Project64-core/N64System/Mips/RegisterClass.h> #include <Project64-core/N64System/Mips/RegisterClass.h>
#include "RSPPlugin.h" #include "RSPPlugin.h"
#include "GFXPlugin.h" #include "GFXPlugin.h"
#include "AudioPlugin.h" #include <Project64-core/Plugins/AudioPlugin.h>
void DummyFunc1(int a) { a += 1; } void DummyFunc1(int a) { a += 1; }

View File

@ -9,7 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "PluginBase.h" #include <Project64-core/Plugins/PluginBase.h>
class CRSP_Plugin : public CPlugin class CRSP_Plugin : public CPlugin
{ {

View File

@ -85,8 +85,8 @@ void CPluginList::AddPluginFromDir(CPath Dir)
continue; continue;
} }
void(__cdecl *GetDllInfo) (PLUGIN_INFO * PluginInfo); void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
GetDllInfo = (void(__cdecl *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo"); GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo");
if (GetDllInfo == NULL) if (GetDllInfo == NULL)
{ {
continue; continue;

View File

@ -126,8 +126,8 @@ void CGamePluginPage::ShowAboutButton(int id)
} }
//Get DLL about //Get DLL about
void(__cdecl *DllAbout) (HWND hWnd); void(CALL *DllAbout) (HWND hWnd);
DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout"); DllAbout = (void(CALL *)(HWND))GetProcAddress(hLib, "DllAbout");
//call the function from the dll //call the function from the dll
DllAbout(m_hWnd); DllAbout(m_hWnd);

View File

@ -118,8 +118,8 @@ void COptionPluginPage::ShowAboutButton(int id)
} }
//Get DLL about //Get DLL about
void(__cdecl *DllAbout) (HWND hWnd); void(CALL *DllAbout) (HWND hWnd);
DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout"); DllAbout = (void(CALL *)(HWND))GetProcAddress(hLib, "DllAbout");
//call the function from the dll //call the function from the dll
DllAbout(m_hWnd); DllAbout(m_hWnd);