missed these with last commit

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1876 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-01-15 07:27:06 +00:00
parent ba8c2aa7e4
commit 9dcb4edc97
2 changed files with 199 additions and 218 deletions

View File

@ -46,10 +46,7 @@
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "Plugins/Plugin_Video.h" #include "PluginManager.h"
#include "Plugins/Plugin_PAD.h"
#include "Plugins/Plugin_DSP.h"
#include "Plugins/Plugin_Wiimote.h"
#include "MemTools.h" #include "MemTools.h"
#include "Host.h" #include "Host.h"
@ -120,12 +117,14 @@ bool PanicAlertToVideo(const char* text, bool yes_no)
void DisplayMessage(const std::string &message, int time_in_ms) void DisplayMessage(const std::string &message, int time_in_ms)
{ {
PluginVideo::Video_AddMessage(message.c_str(), time_in_ms); CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message.c_str(),
time_in_ms);
} }
void DisplayMessage(const char *message, int time_in_ms) void DisplayMessage(const char *message, int time_in_ms)
{ {
PluginVideo::Video_AddMessage(message, time_in_ms); CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message,
time_in_ms);
} }
void Callback_DebuggerBreak() void Callback_DebuggerBreak()
@ -160,38 +159,26 @@ bool Init(const SCoreStartupParameter _CoreParameter)
return false; return false;
} }
CPluginManager &pManager = CPluginManager::GetInstance();
LogManager::Init(); LogManager::Init();
Host_SetWaitCursor(true); Host_SetWaitCursor(true);
g_CoreStartupParameter = _CoreParameter;
// start the thread again // start the thread again
_dbg_assert_(HLE, g_pThread == NULL); _dbg_assert_(HLE, g_pThread == NULL);
// load plugins if (!pManager.InitPlugins(_CoreParameter))
if (!PluginDSP::LoadPlugin(g_CoreStartupParameter.m_strDSPPlugin.c_str())) { return false;
return false;
} g_CoreStartupParameter = _CoreParameter;
if (!PluginPAD::LoadPlugin(g_CoreStartupParameter.m_strPadPlugin.c_str())) {
return false;
}
if (!PluginVideo::LoadPlugin(g_CoreStartupParameter.m_strVideoPlugin.c_str())) {
return false;
}
if (_CoreParameter.bWii && !PluginWiimote::LoadPlugin(g_CoreStartupParameter.m_strWiimotePlugin.c_str())) {
return false;
}
emuThreadGoing.Init(); emuThreadGoing.Init();
// This will execute EmuThread() further down in this file // This will execute EmuThread() further down in this file
g_pThread = new Common::Thread(EmuThread, (void*)&g_CoreStartupParameter); g_pThread = new Common::Thread(EmuThread, (void*)&g_CoreStartupParameter);
emuThreadGoing.Wait(); emuThreadGoing.Wait();
emuThreadGoing.Shutdown(); emuThreadGoing.Shutdown();
// all right ... here we go // all right ... here we go
Host_SetWaitCursor(false); Host_SetWaitCursor(false);
DisplayMessage("CPU: " + cpu_info.Summarize(), 8000); DisplayMessage("CPU: " + cpu_info.Summarize(), 8000);
DisplayMessage(_CoreParameter.m_strFilename, 3000); DisplayMessage(_CoreParameter.m_strFilename, 3000);
@ -218,7 +205,7 @@ void Stop() // - Hammertime!
#ifdef _WIN32 #ifdef _WIN32
PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0); PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0);
#else #else
PluginVideo::Video_Stop(); CPluginManager::GetInstance().GetVideo()->Video_Stop();
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@ -246,7 +233,8 @@ THREAD_RETURN CpuThread(void *pArg)
const SCoreStartupParameter& _CoreParameter = g_CoreStartupParameter; const SCoreStartupParameter& _CoreParameter = g_CoreStartupParameter;
if (!g_CoreStartupParameter.bUseDualCore) if (!g_CoreStartupParameter.bUseDualCore)
{ {
PluginVideo::Video_Prepare(); //wglMakeCurrent //wglMakeCurrent
CPluginManager::GetInstance().GetVideo()->Video_Prepare();
} }
if (_CoreParameter.bRunCompareServer) if (_CoreParameter.bRunCompareServer)
@ -292,8 +280,8 @@ THREAD_RETURN CpuThread(void *pArg)
THREAD_RETURN EmuThread(void *pArg) THREAD_RETURN EmuThread(void *pArg)
{ {
Common::SetCurrentThreadName("Emuthread - starting"); Common::SetCurrentThreadName("Emuthread - starting");
const SCoreStartupParameter& _CoreParameter = *(SCoreStartupParameter*)pArg; const SCoreStartupParameter _CoreParameter = *(SCoreStartupParameter*)pArg;
CPluginManager &pm = CPluginManager::GetInstance();
if (_CoreParameter.bLockThreads) if (_CoreParameter.bLockThreads)
Common::Thread::SetCurrentThreadAffinity(2); // Force to second core Common::Thread::SetCurrentThreadAffinity(2); // Force to second core
@ -302,7 +290,7 @@ THREAD_RETURN EmuThread(void *pArg)
HW::Init(); HW::Init();
emuThreadGoing.Set(); emuThreadGoing.Set();
// Load the VideoPlugin // Load the VideoPlugin
SVideoInitialize VideoInitialize; SVideoInitialize VideoInitialize;
@ -323,7 +311,7 @@ THREAD_RETURN EmuThread(void *pArg)
VideoInitialize.pMemoryBase = Memory::base; VideoInitialize.pMemoryBase = Memory::base;
VideoInitialize.pKeyPress = Callback_KeyPress; VideoInitialize.pKeyPress = Callback_KeyPress;
VideoInitialize.bWii = _CoreParameter.bWii; VideoInitialize.bWii = _CoreParameter.bWii;
PluginVideo::Video_Initialize(&VideoInitialize); // Call the dll pm.GetVideo()->Initialize(&VideoInitialize); // Call the dll
// Under linux, this is an X11 Display, not an HWND! // Under linux, this is an X11 Display, not an HWND!
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle; g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle;
@ -341,13 +329,13 @@ THREAD_RETURN EmuThread(void *pArg)
dspInit.pDebuggerBreak = Callback_DebuggerBreak; dspInit.pDebuggerBreak = Callback_DebuggerBreak;
dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt; dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt;
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming; dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
PluginDSP::DSP_Initialize(dspInit); pm.GetDSP()->Initialize((void *)&dspInit);
// Load and Init PadPlugin // Load and Init PadPlugin
SPADInitialize PADInitialize; SPADInitialize PADInitialize;
PADInitialize.hWnd = g_pWindowHandle; PADInitialize.hWnd = g_pWindowHandle;
PADInitialize.pLog = Callback_PADLog; PADInitialize.pLog = Callback_PADLog;
PluginPAD::PAD_Initialize(PADInitialize); pm.GetPAD(0)->Initialize((void *)&PADInitialize);
// Load and Init WiimotePlugin - only if we are booting in wii mode // Load and Init WiimotePlugin - only if we are booting in wii mode
if (_CoreParameter.bWii) { if (_CoreParameter.bWii) {
@ -356,7 +344,7 @@ THREAD_RETURN EmuThread(void *pArg)
WiimoteInitialize.pLog = Callback_WiimoteLog; WiimoteInitialize.pLog = Callback_WiimoteLog;
WiimoteInitialize.pWiimoteInput = Callback_WiimoteInput; WiimoteInitialize.pWiimoteInput = Callback_WiimoteInput;
// Wait for Wiiuse to find the number of connected Wiimotes // Wait for Wiiuse to find the number of connected Wiimotes
g_bRealWiimote = PluginWiimote::Wiimote_Initialize(WiimoteInitialize); pm.GetWiimote(0)->Initialize((void *)&WiimoteInitialize);
} }
// The hardware is initialized. // The hardware is initialized.
@ -414,9 +402,9 @@ THREAD_RETURN EmuThread(void *pArg)
else else
{ {
cpuThread = new Common::Thread(CpuThread, pArg); cpuThread = new Common::Thread(CpuThread, pArg);
PluginVideo::Video_Prepare(); //wglMakeCurrent pm.GetVideo()->Video_Prepare(); //wglMakeCurrent
Common::SetCurrentThreadName("Video thread"); Common::SetCurrentThreadName("Video thread");
PluginVideo::Video_EnterLoop(); pm.GetVideo()->Video_EnterLoop();
} }
// Wait for CPU thread to exit - it should have been signaled to do so by now // Wait for CPU thread to exit - it should have been signaled to do so by now
@ -433,17 +421,7 @@ THREAD_RETURN EmuThread(void *pArg)
} }
g_bHwInit = false; g_bHwInit = false;
PluginPAD::PAD_Shutdown(); pm.ShutdownPlugins();
PluginPAD::UnloadPlugin();
if (_CoreParameter.bWii)
{
PluginWiimote::Wiimote_Shutdown();
PluginWiimote::UnloadPlugin();
}
PluginDSP::DSP_Shutdown();
PluginDSP::UnloadPlugin();
PluginVideo::Video_Shutdown();
PluginVideo::UnloadPlugin();
HW::Shutdown(); HW::Shutdown();
@ -511,12 +489,15 @@ void LoadState() {
bool MakeScreenshot(const std::string &filename) bool MakeScreenshot(const std::string &filename)
{ {
bool bResult = false; bool bResult = false;
if (PluginVideo::IsLoaded()) CPluginManager &pManager = CPluginManager::GetInstance();
if (pManager.GetVideo()->IsValid())
{ {
TCHAR szTmpFilename[MAX_PATH]; TCHAR szTmpFilename[MAX_PATH];
strcpy(szTmpFilename, filename.c_str()); strcpy(szTmpFilename, filename.c_str());
bResult = PluginVideo::Video_Screenshot(szTmpFilename) ? true : false; bResult = pManager.GetVideo()->Video_Screenshot(szTmpFilename) ? true : false;
} }
return bResult; return bResult;
} }

View File

@ -68,9 +68,9 @@
// * Cleanup of messy now unnecessary safety code in jit // * Cleanup of messy now unnecessary safety code in jit
#include "Common.h" #include "Common.h"
#include "../Plugins/Plugin_Video.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
#include "../CoreTiming.h" #include "../CoreTiming.h"
#include "../PluginManager.h"
#include "MathUtil.h" #include "MathUtil.h"
#include "Thread.h" #include "Thread.h"
@ -660,7 +660,7 @@ void CatchUpGPU()
// We are going to do FP math on the main thread so have to save the current state // We are going to do FP math on the main thread so have to save the current state
SaveSSEState(); SaveSSEState();
LoadDefaultSSEState(); LoadDefaultSSEState();
PluginVideo::Video_SendFifoData(ptr,32); CPluginManager::GetInstance().GetVideo()->Video_SendFifoData(ptr,32);
LoadSSEState(); LoadSSEState();
fifo.CPReadWriteDistance -= 32; fifo.CPReadWriteDistance -= 32;