Eliminated the plugin interface. Merged DX9/DX11/OGL video plugins into Dolphin. It could still use a lot of cleanup. Lots of things are still named "plugin". Software renderer is temporarily disabled until it gets some namespaces. I only updated vs08/10, Linux/OSX builds are broken.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6996 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-01-31 01:28:32 +00:00
parent ae7c64ec13
commit fbaf965995
136 changed files with 1537 additions and 3412 deletions

View File

@ -21,7 +21,6 @@
#include "CommonPaths.h"
#include "IniFile.h"
#include "ConfigManager.h"
#include "PluginManager.h"
#include "FileUtil.h"
SConfig* SConfig::m_Instance;
@ -184,6 +183,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "UseFPS", b_UseFPS);
// Plugins
// TODO: change key name, it's no longer a plugin
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
@ -318,6 +318,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default
// Plugins
// TODO: change key name, it's no longer a plugin
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
}

View File

@ -54,9 +54,9 @@
#include "PowerPC/PowerPC.h"
#include "PowerPC/JitCommon/JitBase.h"
#include "PluginManager.h"
#include "PluginDSP.h"
#include "ConfigManager.h"
#include "VideoBackendBase.h"
#include "VolumeHandler.h"
#include "FileMonitor.h"
@ -68,6 +68,9 @@
#include "State.h"
#include "OnFrame.h"
// TODO: ugly, remove
bool g_aspect_wide;
namespace Core
{
@ -77,20 +80,11 @@ volatile u32 DrawnFrame = 0;
u32 DrawnVideo = 0;
// Function forwarding
void Callback_VideoGetWindowSize(int& x, int& y, int& width, int& height);
void Callback_VideoRequestWindowSize(int& width, int& height);
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
void Callback_VideoCopiedToXFB(bool video_update);
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
const char *Callback_ISOName(void);
void Callback_DSPInterrupt();
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
// For keyboard shortcuts.
void Callback_CoreMessage(int Id);
TPeekMessages Callback_PeekMessages = NULL;
TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
// Function declarations
void EmuThread();
@ -131,14 +125,12 @@ bool PanicAlertToVideo(const char* text, bool yes_no)
void DisplayMessage(const std::string &message, int time_in_ms)
{
CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message.c_str(),
time_in_ms);
g_video_backend->Video_AddMessage(message.c_str(), time_in_ms);
}
void DisplayMessage(const char *message, int time_in_ms)
{
CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message,
time_in_ms);
g_video_backend->Video_AddMessage(message, time_in_ms);
}
void Callback_DebuggerBreak()
@ -176,19 +168,11 @@ bool Init()
return false;
}
// Get a handle to the current instance of the plugin manager
CPluginManager &pManager = CPluginManager::GetInstance();
SCoreStartupParameter &_CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
g_CoreStartupParameter = _CoreParameter;
g_CoreStartupParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
// FIXME DEBUG_LOG(BOOT, dump_params());
Host_SetWaitCursor(true);
// Load all needed plugins
if (!pManager.InitPlugins())
return false;
emuThreadGoing.Init();
// Start the emu thread
@ -207,7 +191,7 @@ void Stop() // - Hammertime!
{
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
g_bStopping = true;
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_STOP);
g_video_backend->EmuStateChange(PLUGIN_EMUSTATE_STOP);
WARN_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
@ -226,7 +210,7 @@ void Stop() // - Hammertime!
// concurrently with the rest of the commands in this function. We no
// longer rely on Postmessage.
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();
g_video_backend->Video_ExitLoop();
// Wait until the CPU finishes exiting the main run loop
cpuRunloopQuit.Wait();
@ -246,7 +230,6 @@ void Stop() // - Hammertime!
void CpuThread()
{
CPluginManager &Plugins = CPluginManager::GetInstance();
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
if (_CoreParameter.bCPUThread)
@ -255,7 +238,7 @@ void CpuThread()
}
else
{
CPluginManager::GetInstance().GetVideo()->Video_Prepare();
g_video_backend->Video_Prepare();
Common::SetCurrentThreadName("CPU-GPU thread");
}
@ -279,7 +262,7 @@ void CpuThread()
// So we have to call the shutdown from the thread that started it.
if (!_CoreParameter.bCPUThread)
{
Plugins.ShutdownVideoPlugin();
g_video_backend->Shutdown();
}
cpuRunloopQuit.Set();
@ -299,7 +282,6 @@ void EmuThread()
Common::SetCurrentThreadName("Emuthread - starting");
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
CPluginManager &Plugins = CPluginManager::GetInstance();
if (_CoreParameter.bLockThreads)
{
if (cpu_info.num_cores > 3)
@ -315,46 +297,19 @@ void EmuThread()
emuThreadGoing.Set();
// Load the VideoPlugin
SVideoInitialize VideoInitialize;
VideoInitialize.pGetMemoryPointer = Memory::GetPointer;
VideoInitialize.pSetInterrupt = ProcessorInterface::SetInterrupt;
VideoInitialize.pRegisterEvent = CoreTiming::RegisterEvent;
VideoInitialize.pScheduleEvent_Threadsafe = CoreTiming::ScheduleEvent_Threadsafe;
VideoInitialize.pRemoveEvent = CoreTiming::RemoveAllEvents;
VideoInitialize.pProcessFifoEvents = CoreTiming::ProcessFifoWaitEvents;
// This is first the m_Panel handle, then it is updated to have the new window handle
VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow;
VideoInitialize.pLog = Callback_VideoLog;
VideoInitialize.pSysMessage = Host_SysMessage;
VideoInitialize.pGetWindowSize = Callback_VideoGetWindowSize;
VideoInitialize.pRequestWindowSize = Callback_VideoRequestWindowSize;
VideoInitialize.pCopiedToXFB = Callback_VideoCopiedToXFB;
VideoInitialize.pPeekMessages = NULL;
VideoInitialize.pUpdateFPSDisplay = NULL;
VideoInitialize.pMemoryBase = Memory::base;
VideoInitialize.pCoreMessage = Callback_CoreMessage;
VideoInitialize.pResetGatherPipe = GPFifo::ResetGatherPipe;
VideoInitialize.bWii = _CoreParameter.bWii;
VideoInitialize.bOnThread = _CoreParameter.bCPUThread;
VideoInitialize.Fifo_CPUBase = &ProcessorInterface::Fifo_CPUBase;
VideoInitialize.Fifo_CPUEnd = &ProcessorInterface::Fifo_CPUEnd;
VideoInitialize.Fifo_CPUWritePointer = &ProcessorInterface::Fifo_CPUWritePointer;
bool aspectWide = _CoreParameter.bWii;
if (aspectWide)
g_aspect_wide = _CoreParameter.bWii;
if (g_aspect_wide)
{
IniFile gameIni;
gameIni.Load(_CoreParameter.m_strGameIni.c_str());
gameIni.Get("Wii", "Widescreen", &aspectWide, !!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
gameIni.Get("Wii", "Widescreen", &g_aspect_wide, !!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
}
VideoInitialize.bAutoAspectIs16_9 = aspectWide;
Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll
// Under linux, this is an X11 Window, not a HWND!
g_pWindowHandle = VideoInitialize.pWindowHandle;
Callback_PeekMessages = VideoInitialize.pPeekMessages;
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
// _CoreParameter.hMainWindow is first the m_Panel handle, then it is updated to have the new window handle,
// within g_video_backend->Initialize()
// TODO: that's ugly, change Initialize() to take m_Panel and return the new window handle
g_video_backend->Initialize();
g_pWindowHandle = _CoreParameter.hMainWindow;
DSP::GetPlugin()->Initialize(g_pWindowHandle, _CoreParameter.bWii, _CoreParameter.bDSPThread);
@ -395,7 +350,7 @@ void EmuThread()
// This thread, after creating the EmuWindow, spawns a CPU thread,
// and then takes over and becomes the video thread
Plugins.GetVideo()->Video_Prepare(); // wglMakeCurrent
g_video_backend->Video_Prepare(); // wglMakeCurrent
cpuThread = std::thread(CpuThread);
Common::SetCurrentThreadName("Video thread");
@ -403,7 +358,7 @@ void EmuThread()
Host_UpdateDisasmDialog();
Host_UpdateMainFrame();
Plugins.GetVideo()->Video_EnterLoop();
g_video_backend->Video_EnterLoop();
}
else // SingleCore mode
{
@ -423,8 +378,7 @@ void EmuThread()
// then we lose the powerdown check. ... unless powerdown sends a message :P
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
{
if (Callback_PeekMessages)
Callback_PeekMessages();
g_video_backend->PeekMessages();
Common::SleepCurrentThread(20);
}
@ -465,7 +419,7 @@ void EmuThread()
WARN_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down plugins").c_str());
// In single core mode, this has already been called.
if (_CoreParameter.bCPUThread)
Plugins.ShutdownVideoPlugin();
g_video_backend->Shutdown();
Pad::Shutdown();
Wiimote::Shutdown();
@ -540,7 +494,7 @@ void ScreenShot(const std::string& name)
bool bPaused = (GetState() == CORE_PAUSE);
SetState(CORE_PAUSE);
CPluginManager::GetInstance().GetVideo()->Video_Screenshot(name.c_str());
g_video_backend->Video_Screenshot(name.c_str());
if(!bPaused)
SetState(CORE_RUN);
}
@ -621,8 +575,7 @@ void VideoThrottle()
SMessage;
// Show message
if (g_pUpdateFPSDisplay != NULL)
g_pUpdateFPSDisplay(SMessage.c_str());
g_video_backend->UpdateFPSDisplay(SMessage.c_str());
if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar) {
@ -658,7 +611,7 @@ bool report_slow(int skipped)
// Callback_VideoLog
// WARNING - THIS IS EXECUTED FROM VIDEO THREAD
void Callback_VideoLog(const TCHAR *_szMessage, int _bDoBreak)
void Callback_VideoLog(const char *_szMessage, int _bDoBreak)
{
INFO_LOG(VIDEO, "%s", _szMessage);
}

View File

@ -33,6 +33,13 @@
namespace Core
{
void Callback_VideoLog(const char* _szMessage, int _bDoBreak);
void Callback_VideoCopiedToXFB(bool video_update);
void Callback_VideoGetWindowSize(int& x, int& y, int& width, int& height);
void Callback_VideoRequestWindowSize(int& width, int& height);
void Callback_CoreMessage(int Id);
enum EState
{
CORE_UNINITIALIZED,

View File

@ -22,7 +22,7 @@
#include "CoreTiming.h"
#include "Core.h"
#include "StringUtil.h"
#include "PluginManager.h"
#include "VideoBackendBase.h"
#define MAX_SLICE_LENGTH 20000
@ -520,7 +520,7 @@ void Idle()
//When the FIFO is processing data we must not advance because in this way
//the VI will be desynchronized. So, We are waiting until the FIFO finish and
//while we process only the events required by the FIFO.
while (CPluginManager::GetInstance().GetVideo()->Video_IsFifoBusy())
while (g_video_backend->Video_IsFifoBusy())
{
ProcessFifoWaitEvents();
Common::YieldCPU();

View File

@ -18,13 +18,12 @@
#include "Common.h"
#include "Thread.h"
#include "../PluginDSP.h"
#include "../PluginManager.h"
#include "../PowerPC/PowerPC.h"
#include "../Host.h"
#include "../Core.h"
#include "CPU.h"
#include "DSP.h"
#include "VideoBackendBase.h"
namespace
{
@ -116,15 +115,13 @@ void CCPU::EnableStepping(const bool _bStepping)
if (_bStepping)
{
PowerPC::Pause();
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PAUSE);
DSP::GetPlugin()->DSP_ClearAudioBuffer(true);
g_video_backend->EmuStateChange(PLUGIN_EMUSTATE_PAUSE);
}
else
{
PowerPC::Start();
m_StepEvent.Set();
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PLAY);
DSP::GetPlugin()->DSP_ClearAudioBuffer(false);
g_video_backend->EmuStateChange(PLUGIN_EMUSTATE_PLAY);
}
}

View File

@ -45,7 +45,6 @@
#include "ProcessorInterface.h"
#include "AudioInterface.h"
#include "../PowerPC/PowerPC.h"
#include "../PluginManager.h"
#include "../ConfigManager.h"
#include "../PluginDSP.h"

View File

@ -29,6 +29,7 @@ public:
virtual void Initialize(void *hWnd, bool bWii, bool bDSPThread);
virtual void Shutdown();
virtual bool IsLLE() { return true; }
virtual void DoState(PointerWrap &p);

View File

@ -18,10 +18,11 @@
#include "Common.h"
#include "ChunkFile.h"
#include "ProcessorInterface.h"
#include "../PluginManager.h"
#include "Memmap.h"
#include "../PowerPC/PowerPC.h"
#include "VideoBackendBase.h"
#include "GPFifo.h"
namespace GPFifo
@ -42,9 +43,7 @@ namespace GPFifo
u8 GC_ALIGNED32(m_gatherPipe[GATHER_PIPE_SIZE*16]); //more room, for the fastmodes
// pipe counter
u32 m_gatherPipeCount = 0;
Common::TVideo_GatherPipeBursted m_GatherPipeBursted = NULL;
u32 m_gatherPipeCount = 0;
void DoState(PointerWrap &p)
{
@ -55,7 +54,6 @@ void DoState(PointerWrap &p)
void Init()
{
ResetGatherPipe();
m_GatherPipeBursted = CPluginManager::GetInstance().GetVideo()->Video_GatherPipeBursted;
}
bool IsEmpty()
@ -92,8 +90,7 @@ void STACKALIGN CheckGatherPipe()
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
}
// Call pre-fetched pointer
m_GatherPipeBursted();
g_video_backend->Video_GatherPipeBursted();
}
// move back the spill bytes

View File

@ -31,7 +31,6 @@
#include "AudioInterface.h"
#include "VideoInterface.h"
#include "WII_IPC.h"
#include "../PluginManager.h"
#include "../ConfigManager.h"
#include "../CoreTiming.h"
#include "SystemTimers.h"

View File

@ -39,14 +39,14 @@ may be redirected here (for example to Read_U32()).
#include "VideoInterface.h"
#include "SI.h"
#include "EXI.h"
#include "PluginVideo.h"
#include "AudioInterface.h"
#include "MemoryInterface.h"
#include "WII_IOB.h"
#include "WII_IPC.h"
#include "../ConfigManager.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "../PluginManager.h"
#include "CommandProcessor.h"
#include "PixelEngine.h"
namespace Memory
{
@ -180,12 +180,12 @@ void InitHWMemFuncs()
for (int i = 0; i < BLOCKSIZE; i++)
{
hwRead16 [CP_START+i] = CPluginManager::GetInstance().GetVideo()->Video_CommandProcessorRead16;
hwWrite16[CP_START+i] = CPluginManager::GetInstance().GetVideo()->Video_CommandProcessorWrite16;
hwRead16 [CP_START+i] = CommandProcessor::Read16;
hwWrite16[CP_START+i] = CommandProcessor::Write16;
hwRead16 [PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineRead16;
hwWrite16[PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineWrite16;
hwWrite32[PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineWrite32;
hwRead16 [PE_START+i] = PixelEngine::Read16;
hwWrite16[PE_START+i] = PixelEngine::Write16;
hwWrite32[PE_START+i] = PixelEngine::Write32;
hwRead8 [VI_START+i] = VideoInterface::Read8;
hwRead16 [VI_START+i] = VideoInterface::Read16;
@ -253,12 +253,12 @@ void InitHWMemFuncsWii()
// MI, PI, DSP are still mapped to 0xCCxxxxxx
for (int i = 0; i < BLOCKSIZE; i++)
{
hwRead16 [CP_START+i] = CPluginManager::GetInstance().GetVideo()->Video_CommandProcessorRead16;
hwWrite16[CP_START+i] = CPluginManager::GetInstance().GetVideo()->Video_CommandProcessorWrite16;
hwRead16 [CP_START+i] = CommandProcessor::Read16;
hwWrite16[CP_START+i] = CommandProcessor::Write16;
hwRead16 [PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineRead16;
hwWrite16[PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineWrite16;
hwWrite32[PE_START+i] = CPluginManager::GetInstance().GetVideo()->Video_PixelEngineWrite32;
hwRead16 [PE_START+i] = PixelEngine::Read16;
hwWrite16[PE_START+i] = PixelEngine::Write16;
hwWrite32[PE_START+i] = PixelEngine::Write32;
hwRead16 [PI_START+i] = ProcessorInterface::Read16;
hwRead32 [PI_START+i] = ProcessorInterface::Read32;

View File

@ -23,7 +23,7 @@
#include "WII_IOB.h"
#include "../Core.h"
#include "../PowerPC/PowerPC.h"
#include "../PluginManager.h"
#include "VideoBackendBase.h"
namespace Memory
{
@ -133,10 +133,10 @@ u32 EFB_Read(const u32 addr)
int y = (addr >> 12) & 0x3ff;
if (addr & 0x00400000) {
var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(PEEK_Z, x, y, 0);
var = g_video_backend->Video_AccessEFB(PEEK_Z, x, y, 0);
DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= 0x%08x", x, y, var);
} else {
var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(PEEK_COLOR, x, y, 0);
var = g_video_backend->Video_AccessEFB(PEEK_COLOR, x, y, 0);
DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= 0x%08x", x, y, var);
}
@ -229,10 +229,10 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
int y = (em_address >> 12) & 0x3ff;
// TODO figure out a way to send data without falling into the template trap
if (em_address & 0x00400000) {
CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(POKE_Z, x, y, (u32)data);
g_video_backend->Video_AccessEFB(POKE_Z, x, y, (u32)data);
DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %i, %i", (u32)data, x, y);
} else {
CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(POKE_COLOR, x, y,(u32)data);
g_video_backend->Video_AccessEFB(POKE_COLOR, x, y,(u32)data);
DEBUG_LOG(MEMMAP, "EFB Color Write %08x @ %i, %i", (u32)data, x, y);
}
return;

View File

@ -25,7 +25,8 @@
#include "../CoreTiming.h"
#include "ProcessorInterface.h"
#include "GPFifo.h"
#include "../PluginManager.h"
#include "VideoBackendBase.h"
namespace ProcessorInterface
{
@ -190,7 +191,7 @@ void Write32(const u32 _uValue, const u32 _iAddress)
case PI_FIFO_RESET:
//Abort the actual frame
CPluginManager::GetInstance().GetVideo()->Video_AbortFrame();
g_video_backend->Video_AbortFrame();
//Fifo_CPUWritePointer = Fifo_CPUBase; ??
//PanicAlert("Unknown write to PI_FIFO_RESET (%08x)", _uValue);
WARN_LOG(PROCESSORINTERFACE, "Fifo reset (%08x)", _uValue);

View File

@ -23,8 +23,6 @@
#include "GCPadStatus.h"
#include "GCPad.h"
#include "../PluginManager.h" // for pad state
// where to put baseboard debug
#define AMBASEBOARDDEBUG OSREPORT

View File

@ -18,7 +18,6 @@
#ifndef _SI_DEVICEGCCONTROLLER_H
#define _SI_DEVICEGCCONTROLLER_H
#include "../PluginManager.h"
#include "SI_Device.h"
#include "GCPadStatus.h"

View File

@ -61,7 +61,6 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule:
#include "Atomic.h"
#include "../PatchEngine.h"
#include "SystemTimers.h"
#include "../PluginManager.h"
#include "../HW/DSP.h"
#include "../HW/AudioInterface.h"
#include "../HW/VideoInterface.h"
@ -74,7 +73,7 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule:
#include "../PluginDSP.h"
#include "Thread.h"
#include "Timer.h"
#include "VideoBackendBase.h"
namespace SystemTimers
@ -228,7 +227,7 @@ u64 GetFakeTimeBase()
// For DC watchdog hack
void FakeGPWatchdogCallback(u64 userdata, int cyclesLate)
{
CPluginManager::GetInstance().GetVideo()->Video_WaitForFrameFinish(); // lock CPUThread until frame finish
g_video_backend->Video_WaitForFrameFinish(); // lock CPUThread until frame finish
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerFrame() - cyclesLate, et_FakeGPWD);
}

View File

@ -23,11 +23,12 @@
#include "ProcessorInterface.h"
#include "VideoInterface.h"
#include "Memmap.h"
#include "../PluginManager.h"
#include "../CoreTiming.h"
#include "../HW/SystemTimers.h"
#include "StringUtil.h"
#include "VideoBackendBase.h"
namespace VideoInterface
{
@ -783,19 +784,14 @@ static void BeginField(FieldType field)
fieldTypeNames[field]
);
Common::PluginVideo* video = CPluginManager::GetInstance().GetVideo();
if (xfbAddr && video->IsValid())
video->Video_BeginField(xfbAddr, field, fbWidth, fbHeight);
if (xfbAddr)
g_video_backend->Video_BeginField(xfbAddr, field, fbWidth, fbHeight);
}
static void EndField()
{
Common::PluginVideo* video = CPluginManager::GetInstance().GetVideo();
if (video->IsValid())
{
video->Video_EndField();
Core::VideoThrottle();
}
g_video_backend->Video_EndField();
Core::VideoThrottle();
}
// Purpose: Send VI interrupt when triggered

View File

@ -20,7 +20,6 @@
#include "WII_IPC_HLE_WiiMote.h" // Core
#include "WII_IPC_HLE_Device_usb.h"
#include "../PluginManager.h"
#include "../ConfigManager.h"
#include "../Host.h"
#include "../Core.h"

View File

@ -27,13 +27,13 @@
#include "Core.h"
#include "State.h"
#include "ConfigManager.h"
#include "PluginManager.h"
#include "HW/DSP.h"
#include "HW/Memmap.h"
#include "Host.h"
#include "PowerPC/PowerPC.h"
#include "CoreTiming.h"
#include "PluginDSP.h"
#include "VideoBackendBase.h"
extern "C" {
#include "lua.h"
@ -1375,14 +1375,14 @@ DEFINE_LUA_FUNCTION(emulua_frameadvance, "")
// run 1 frame
if(info.speedMode == SPEEDMODE_MAXIMUM)
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(false);
g_video_backend->Video_SetRendering(false);
if(Core::GetState() == Core::CORE_PAUSE)
Core::SetState(Core::CORE_RUN);
PowerPC::RunLoop();
// continue as normal
if(info.speedMode == SPEEDMODE_MAXIMUM)
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true);
g_video_backend->Video_SetRendering(true);
Frame::SetFrameStopping(false);
*PowerPC::GetStatePtr() = PowerPC::CPU_RUNNING;

View File

@ -18,11 +18,11 @@
#include "OnFrame.h"
#include "Core.h"
#include "PluginManager.h"
#include "Thread.h"
#include "FileUtil.h"
#include "PowerPC/PowerPC.h"
#include "HW/SI.h"
#include "VideoBackendBase.h"
Common::CriticalSection cs_frameSkip;
@ -77,7 +77,7 @@ void SetFrameSkipping(unsigned int framesToSkip)
// Don't forget to re-enable rendering in case it wasn't...
// as this won't be changed anymore when frameskip is turned off
if (framesToSkip == 0)
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true);
g_video_backend->Video_SetRendering(true);
cs_frameSkip.Leave();
}
@ -110,7 +110,7 @@ void FrameSkipping()
if (g_frameSkipCounter > g_framesToSkip || Core::report_slow(g_frameSkipCounter) == false)
g_frameSkipCounter = 0;
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(!g_frameSkipCounter);
g_video_backend->Video_SetRendering(!g_frameSkipCounter);
cs_frameSkip.Leave();
}

View File

@ -19,6 +19,7 @@
#define _PLUGINDSP_H_
#include "PluginSpecs.h" // TODO: Only here for EmuStateChange
#include "ChunkFile.h"
class PluginDSP

View File

@ -1,295 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// File description
/* ------------
This file controls when plugins are loaded and unloaded from memory. Its functions scan for valid
plugins when Dolphin is booted, and open the debugging and config windows. The PluginManager is
created once when Dolphin starts and is closed when Dolphin is closed.
*/
// Include
// ------------
#include <string> // System
#include <vector>
#include "Common.h"
#include "CommonPaths.h"
#include "PluginManager.h"
#include "ConfigManager.h"
#include "LogManager.h"
#include "Core.h"
#include "Host.h"
#include "FileSearch.h" // Common
#include "FileUtil.h"
#include "StringUtil.h"
#include "MemoryUtil.h"
#include "Setup.h"
// Create the plugin manager class
CPluginManager* CPluginManager::m_Instance;
// The Plugin Manager Class
// ------------
void CPluginManager::Init()
{
m_Instance = new CPluginManager;
}
void CPluginManager::Shutdown()
{
delete m_Instance;
m_Instance = NULL;
}
// The plugin manager is some sort of singleton that runs during Dolphin's entire lifespan.
CPluginManager::CPluginManager()
{
m_PluginGlobals = new PLUGIN_GLOBALS;
// Start LogManager
m_PluginGlobals->logManager = LogManager::GetInstance();
m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter);
// Set initial values to NULL.
m_video = NULL;
}
// This will call FreeLibrary() for all plugins
CPluginManager::~CPluginManager()
{
INFO_LOG(CONSOLE, "Delete CPluginManager\n");
delete m_PluginGlobals;
delete m_video;
}
// Init and Shutdown Plugins
// ------------
// Function: Point the m_pad[] and other variables to a certain plugin
bool CPluginManager::InitPlugins()
{
// Update pluginglobals.
if (SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.size() == 0)
{
PanicAlertT("Bad gameini filename");
}
strcpy(m_PluginGlobals->game_ini, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
strcpy(m_PluginGlobals->unique_id, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str());
INFO_LOG(CONSOLE, "Before GetVideo\n");
if (!GetVideo()) {
PanicAlertT("Can't init Video Plugin");
return false;
}
INFO_LOG(CONSOLE, "After GetVideo\n");
return true;
}
void CPluginManager::ShutdownVideoPlugin()
{
if (m_video)
{
m_video->Shutdown();
FreeVideo();
NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(false, "Video shutdown").c_str());
}
}
// The PluginInfo class: Find Valid Plugins
// ------------
/* Function: This info is used in ScanForPlugins() to check for valid plugins and and in LoadPlugin() to
check that the filename we want to use is a good DLL. */
CPluginInfo::CPluginInfo(const char *_rFilename)
: m_Filename(_rFilename)
, m_Valid(false)
{
// Check if the functions that are common to all plugins are present
Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
if (plugin->IsValid())
{
if (plugin->GetInfo(m_PluginInfo))
m_Valid = true;
else
PanicAlertT("Could not get info about plugin %s", _rFilename);
// We are now done with this plugin and will call FreeLibrary()
delete plugin;
}
else
{
WARN_LOG(CONSOLE, "PluginInfo: %s is not a valid Dolphin plugin. Ignoring.", _rFilename);
}
}
// Supporting functions
// ------------
/* Return the plugin info we saved when Dolphin was started. We don't even add a function to try load a
plugin name that was not found because in that case it must have been deleted while Dolphin was running.
If the user has done that he will instead get the "Can't open %s, it's missing" message. */
void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
{
for (int i = 0; i < (int)m_PluginInfos.size(); i++)
{
if (m_PluginInfos.at(i).GetFilename() == Filename)
{
info = &m_PluginInfos.at(i);
return;
}
}
}
/* Called from: Get__() functions in this file only (not from anywhere else),
therefore we can leave all condition checks in the Get__() functions
below. */
void *CPluginManager::LoadPlugin(const char *_rFilename)
{
Common::CPlugin *plugin = new Common::PluginVideo(_rFilename);
// Check that the plugin has all the common and all the type specific functions
if (!plugin->IsValid())
{
PanicAlertT("Can't open %s, it has a missing function", _rFilename);
delete plugin;
return NULL;
}
// Call the DLL function SetGlobals
plugin->SetGlobals(m_PluginGlobals);
return plugin;
}
PLUGIN_GLOBALS* CPluginManager::GetGlobals()
{
return m_PluginGlobals;
}
// ----------------------------------------
// Create list of available plugins
// -------------
void CPluginManager::ScanForPlugins()
{
m_PluginInfos.clear();
// Get plugins dir
CFileSearch::XStringVector Directories;
Directories.push_back(File::GetPluginsDirectory());
CFileSearch::XStringVector Extensions;
Extensions.push_back("*" PLUGIN_SUFFIX);
// Get all DLL files in the plugins dir
CFileSearch FileSearch(Extensions, Directories);
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
if (rFilenames.size() > 0)
{
for (size_t i = 0; i < rFilenames.size(); i++)
{
std::string orig_name = rFilenames[i];
std::string Filename, Extension;
if (!SplitPath(rFilenames[i], NULL, &Filename, &Extension)) {
printf("Bad Path %s\n", rFilenames[i].c_str());
return;
}
// Leave off the directory component
std::string StoredName = Filename;
StoredName += Extension;
CPluginInfo PluginInfo(StoredName.c_str());
if (PluginInfo.IsValid())
{
// Save the Plugin
m_PluginInfos.push_back(PluginInfo);
}
}
}
}
Common::PluginVideo *CPluginManager::GetVideo()
{
/* We don't need to check if m_video->IsValid() here, because m_video will not be set by LoadPlugin()
if it's not valid */
if (m_video != NULL)
{
return m_video;
}
// and load a new plugin
m_video = (Common::PluginVideo*)LoadPlugin(m_params->m_strVideoPlugin.c_str());
return m_video;
}
// Free plugins to completely reset all variables and potential DLLs loaded by
// the plugins in turn
void CPluginManager::FreeVideo()
{
WARN_LOG(CONSOLE, "%s", Core::StopMessage(false, "Will unload video DLL").c_str());
delete m_video;
m_video = NULL;
}
void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState)
{
GetVideo()->EmuStateChange(newState);
}
// Call DLL functions
// ------------
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
{
switch(Type)
{
case PLUGIN_TYPE_VIDEO:
if (GetVideo() != NULL)
GetVideo()->Config(_Parent);
break;
default:
PanicAlertT("Type %d config not supported in plugin %s", Type, _rFilename);
break;
}
}
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
void *CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
{
switch(Type)
{
case PLUGIN_TYPE_VIDEO:
return GetVideo()->Debug(_Parent, Show);
break;
default:
PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename);
return NULL;
break;
}
}

View File

@ -1,79 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __PLUGIN_MANAGER_H_
#define __PLUGIN_MANAGER_H_
#include "Plugin.h"
#include "PluginVideo.h"
#include "CoreParameter.h"
class CPluginInfo
{
public:
CPluginInfo(const char *_rFileName);
bool IsValid() const {return(m_Valid);}
const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);}
const std::string& GetFilename() const {return(m_Filename);}
private:
PLUGIN_INFO m_PluginInfo;
std::string m_Filename;
bool m_Valid;
};
typedef std::vector<CPluginInfo>CPluginInfos;
class CPluginManager : NonCopyable
{
public:
static CPluginManager& GetInstance() {return(*m_Instance);}
static void Init();
static void Shutdown();
Common::PluginVideo *GetVideo();
void FreeVideo();
void EmuStateChange(PLUGIN_EMUSTATE newState);
bool InitPlugins();
void ShutdownVideoPlugin();
void ScanForPlugins();
void OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type);
void *OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show);
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
PLUGIN_GLOBALS* GetGlobals();
private:
static CPluginManager* m_Instance;
CPluginInfos m_PluginInfos;
PLUGIN_GLOBALS *m_PluginGlobals;
Common::PluginVideo *m_video;
SCoreStartupParameter * m_params;
CPluginManager();
~CPluginManager();
void GetPluginInfo(CPluginInfo *&info, std::string Filename);
void *LoadPlugin(const char *_rFilename);
};
#endif

View File

@ -30,7 +30,7 @@
#include "HW/CPU.h"
#include "PowerPC/JitCommon/JitBase.h"
#include "PluginManager.h"
#include "VideoBackendBase.h"
#include <string>
@ -88,8 +88,7 @@ void DoState(PointerWrap &p)
return;
}
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM
CPluginManager &pm = CPluginManager::GetInstance();
pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
g_video_backend->DoState(p);
if (Core::g_CoreStartupParameter.bWii)
Wiimote::DoState(p.GetPPtr(), p.GetMode());