mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
Warp back to 1983!!! (rev 1983, that is, not the year :P)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1997 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Core"
|
||||
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||
RootNamespace="Core"
|
||||
@ -191,7 +191,7 @@
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="false"
|
||||
AdditionalIncludeDirectories="..\..\..\Externals\SDL\Include;.\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
|
||||
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -155,6 +155,8 @@ bool GetRealWiimote()
|
||||
// -----------------
|
||||
bool Init()
|
||||
{
|
||||
//Console::Open();
|
||||
|
||||
if (g_pThread != NULL)
|
||||
{
|
||||
PanicAlert("ERROR: Emu Thread already running. Report this bug.");
|
||||
@ -345,18 +347,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
PADInitialize.pLog = Callback_PADLog;
|
||||
PADInitialize.padNumber = i;
|
||||
// Check if we should init the plugin
|
||||
if(Plugins.OkayToInitPlugin(i))
|
||||
{
|
||||
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
||||
|
||||
// Check if joypad open failed, in that case try again
|
||||
if(PADInitialize.padNumber == -1)
|
||||
{
|
||||
Plugins.GetPad(i)->Shutdown();
|
||||
Plugins.FreePad();
|
||||
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
||||
}
|
||||
}
|
||||
if(Plugins.OkayToInitPlugin(i)) Plugins.GetPAD(i)->Initialize((void *)&PADInitialize);
|
||||
}
|
||||
|
||||
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
||||
|
@ -254,8 +254,9 @@ void Init()
|
||||
g_Channel[i].m_InHi.Hex = 0;
|
||||
g_Channel[i].m_InLo.Hex = 0;
|
||||
|
||||
// Access the pap
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(i);
|
||||
// Access the pad and check the MAXPADS limit
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD((i >= MAXPADS) ? (MAXPADS - 1): i);
|
||||
//Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(i);
|
||||
|
||||
// Check if this pad is attached for the current plugin
|
||||
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
||||
|
@ -120,7 +120,8 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||
SPADStatus PadStatus;
|
||||
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
||||
Common::PluginPAD* pad =
|
||||
CPluginManager::GetInstance().GetPad(ISIDevice::m_iDeviceNumber);
|
||||
//CPluginManager::GetInstance().GetPAD(ISIDevice::m_iDeviceNumber);
|
||||
CPluginManager::GetInstance().GetPAD((ISIDevice::m_iDeviceNumber >= MAXPADS) ? (MAXPADS - 1): ISIDevice::m_iDeviceNumber);
|
||||
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||
|
||||
_Hi = (u32)((u8)PadStatus.stickY);
|
||||
@ -147,7 +148,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||
void
|
||||
CSIDevice_GCController::SendCommand(u32 _Cmd)
|
||||
{
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(0);
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0);
|
||||
UCommand command(_Cmd);
|
||||
|
||||
switch(command.Command)
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
CPluginManager CPluginManager::m_Instance;
|
||||
|
||||
//#define INPUTCOMMON
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -46,26 +44,14 @@ CPluginManager::CPluginManager() :
|
||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||
{
|
||||
m_PluginGlobals = new PLUGIN_GLOBALS;
|
||||
|
||||
|
||||
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||
m_PluginGlobals->messageLogger = NULL;
|
||||
|
||||
#ifdef INPUTCOMMON
|
||||
m_InputManager = new InputManager();
|
||||
m_PluginGlobals->inputManager = m_InputManager;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Function: FreeLibrary()
|
||||
Called from: In an attempt to avoid the crash that occurs when the use LoadLibrary() and
|
||||
FreeLibrary() often (every game a game is stopped and started) these functions will only
|
||||
be used when
|
||||
1. Dolphin is started
|
||||
2. A plugin is changed
|
||||
3. Dolphin is closed
|
||||
it will not be used when we Start and Stop games. */
|
||||
// Function: FreeLibrary()
|
||||
// Called from: This will be called when Dolphin is closed, not when we Stop a game
|
||||
CPluginManager::~CPluginManager()
|
||||
{
|
||||
Console::Print("Delete CPluginManager\n");
|
||||
@ -122,7 +108,7 @@ bool CPluginManager::InitPlugins()
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (! m_params.m_strPadPlugin[i].empty())
|
||||
GetPad(i);
|
||||
GetPAD(i);
|
||||
if (m_pad[i] != NULL)
|
||||
pad = true;
|
||||
}
|
||||
@ -162,8 +148,8 @@ void CPluginManager::ShutdownPlugins()
|
||||
{
|
||||
//Console::Print("Shutdown: %i\n", i);
|
||||
m_pad[i]->Shutdown();
|
||||
//delete m_pad[i];
|
||||
}
|
||||
}
|
||||
//delete m_pad[i];
|
||||
//m_pad[i] = NULL;
|
||||
}
|
||||
|
||||
@ -171,10 +157,10 @@ void CPluginManager::ShutdownPlugins()
|
||||
if (m_wiimote[i]) m_wiimote[i]->Shutdown();
|
||||
|
||||
if (m_video)
|
||||
m_video->Shutdown();
|
||||
m_video->Shutdown();
|
||||
|
||||
if (m_dsp)
|
||||
m_dsp->Shutdown();
|
||||
m_dsp->Shutdown();
|
||||
}
|
||||
//////////////////////////////////////////
|
||||
|
||||
@ -182,34 +168,31 @@ void CPluginManager::ShutdownPlugins()
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Supporting functions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Called from: Get__() functions in this file only (not from anywhere else)
|
||||
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_TYPE type)
|
||||
|
||||
|
||||
void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type)
|
||||
{
|
||||
CPluginInfo info(_rFilename);
|
||||
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
||||
//std::string Filename = info.GetPluginInfo().Filename;
|
||||
std::string Filename = _rFilename;
|
||||
Common::CPlugin *plugin = NULL;
|
||||
|
||||
Common::CPlugin *plugin = NULL;
|
||||
switch (type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
plugin = new Common::PluginVideo(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_DSP:
|
||||
plugin = new Common::PluginDSP(_rFilename);
|
||||
case PLUGIN_TYPE_PAD:
|
||||
plugin = new Common::PluginPAD(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_PAD:
|
||||
plugin = new Common::PluginPAD(_rFilename);
|
||||
case PLUGIN_TYPE_DSP:
|
||||
plugin = new Common::PluginDSP(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
plugin = new Common::PluginWiimote(_rFilename);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
PanicAlert("Trying to load unsupported type %d", type);
|
||||
}
|
||||
|
||||
@ -229,13 +212,15 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_T
|
||||
// -------------
|
||||
int CPluginManager::OkayToInitPlugin(int Plugin)
|
||||
{
|
||||
//Console::Print("OkayToInitShutdown: %i", Plugin);
|
||||
// Compare it to the earlier plugins
|
||||
for(int i = 0; i < Plugin; i++)
|
||||
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[i])
|
||||
{
|
||||
//Console::Print("(%i %i) %s\n", Plugin, i, g_CoreStartupParameter.m_strPadPlugin[Plugin].c_str());
|
||||
return i;
|
||||
|
||||
// No there is no duplicate plugin
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -286,67 +271,52 @@ void CPluginManager::ScanForPlugins()
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Create or return the already created plugin pointers. This will be called often for the
|
||||
Pad and Wiimote from the SI_.cpp files. */
|
||||
// Create or return the already created plugin pointers
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||
Common::PluginPAD *CPluginManager::GetPAD(int controller)
|
||||
{
|
||||
if (m_pad[controller] != NULL)
|
||||
if (m_pad[controller]->GetFilename() == m_params.m_strPadPlugin[controller])
|
||||
return m_pad[controller];
|
||||
|
||||
// Else do this
|
||||
if(OkayToInitPlugin(controller) == -1)
|
||||
if (m_pad[controller] == NULL)
|
||||
{
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
||||
Console::Print("LoadPlugin: %i\n", controller);
|
||||
if(OkayToInitPlugin(controller) == -1)
|
||||
{
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str());
|
||||
Console::Print("LoadPlugin: %i\n", controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||
}
|
||||
return m_pad[controller];
|
||||
|
||||
//Console::Print("Returned: %i\n", controller);
|
||||
return m_pad[controller];
|
||||
}
|
||||
|
||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||
{
|
||||
if (m_pad[controller] != NULL)
|
||||
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
||||
return m_wiimote[controller];
|
||||
if (m_wiimote[controller] == NULL)
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin
|
||||
(m_params.m_strWiimotePlugin[controller].c_str());
|
||||
|
||||
// Else load a new plugin
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
||||
return m_wiimote[controller];
|
||||
}
|
||||
|
||||
Common::PluginDSP *CPluginManager::GetDSP()
|
||||
{
|
||||
if (m_dsp != NULL)
|
||||
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin)
|
||||
return m_dsp;
|
||||
// Else load a new plugin
|
||||
if (m_dsp == NULL)
|
||||
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
||||
|
||||
return m_dsp;
|
||||
}
|
||||
|
||||
Common::PluginVideo *CPluginManager::GetVideo()
|
||||
{
|
||||
if (m_video != NULL)
|
||||
if (m_video->GetFilename() == m_params.m_strVideoPlugin)
|
||||
return m_video;
|
||||
Common::PluginVideo *CPluginManager::GetVideo() {
|
||||
|
||||
// Else load a new plugin
|
||||
if (m_video == NULL)
|
||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
||||
|
||||
return m_video;
|
||||
}
|
||||
Common::PluginPAD *CPluginManager::FreePad()
|
||||
{
|
||||
delete m_pad[0];
|
||||
m_pad[0] = NULL; m_pad[1] = NULL; m_pad[2] = NULL; m_pad[3] = NULL;
|
||||
m_pad[0] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[0].c_str(), 0);
|
||||
return m_pad[0];
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
||||
@ -355,33 +325,15 @@ Common::PluginPAD *CPluginManager::FreePad()
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// ----------------------------------------
|
||||
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
|
||||
// Open config window. _rFilename = plugin filename , ret = the dll slot number
|
||||
// -------------
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
{
|
||||
#ifdef INPUTCOMMON
|
||||
m_InputManager->Init();
|
||||
#endif
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
GetVideo()->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_DSP:
|
||||
GetDSP()->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_PAD:
|
||||
GetPad(0)->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
GetWiimote(0)->Config((HWND)_Parent);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef INPUTCOMMON
|
||||
m_InputManager->Shutdown();
|
||||
#endif
|
||||
Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
|
||||
plugin->SetGlobals(m_PluginGlobals);
|
||||
plugin->Config((HWND)_Parent);
|
||||
delete plugin;
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
@ -389,14 +341,10 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
|
||||
// -------------
|
||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
|
||||
{
|
||||
switch(Type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
if (Type == PLUGIN_TYPE_VIDEO) {
|
||||
GetVideo()->Debug((HWND)_Parent, Show);
|
||||
break;
|
||||
case PLUGIN_TYPE_DSP:
|
||||
} else if (Type == PLUGIN_TYPE_DSP) {
|
||||
GetDSP()->Debug((HWND)_Parent, Show);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "PluginWiimote.h"
|
||||
#include "EventHandler.h"
|
||||
#include "CoreParameter.h"
|
||||
#include "InputManager.h"
|
||||
|
||||
class CPluginInfo
|
||||
{
|
||||
@ -47,23 +46,20 @@ class CPluginManager
|
||||
{
|
||||
public:
|
||||
static CPluginManager& GetInstance() {return(m_Instance);}
|
||||
Common::PluginPAD *GetPad(int controller);
|
||||
Common::PluginPAD *GetPAD(int controller);
|
||||
Common::PluginWiimote *GetWiimote(int controller);
|
||||
Common::PluginDSP *GetDSP();
|
||||
Common::PluginVideo *GetVideo();
|
||||
Common::PluginPAD *FreePad();
|
||||
|
||||
bool InitPlugins();
|
||||
void ShutdownPlugins();
|
||||
int OkayToInitPlugin(int Plugin);
|
||||
void ScanForPlugins();
|
||||
void OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type);
|
||||
void OpenConfig(void* _Parent, const char *_rFilename);
|
||||
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;
|
||||
bool m_Initialized;
|
||||
|
||||
@ -74,11 +70,10 @@ private:
|
||||
Common::PluginWiimote *m_wiimote[4];
|
||||
Common::PluginDSP *m_dsp;
|
||||
|
||||
InputManager *m_InputManager;
|
||||
SCoreStartupParameter& m_params;
|
||||
CPluginManager();
|
||||
~CPluginManager();
|
||||
void *LoadPlugin(const char *_rFilename, int Number = 0);
|
||||
void *LoadPlugin(const char *_rFilename);
|
||||
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@ files = ["Console.cpp",
|
||||
"PatchEngine.cpp",
|
||||
"State.cpp",
|
||||
"Tracer.cpp",
|
||||
"PluginManager.cpp",
|
||||
'PluginManager.cpp',
|
||||
"VolumeHandler.cpp",
|
||||
"Boot/Boot.cpp",
|
||||
"Boot/Boot_BIOSEmu.cpp",
|
||||
|
Reference in New Issue
Block a user