mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Merge GCPadNew into Dolphin. This takes place in three segments: Core, InputCommon, and InputUICommon. From now on it can be referred to just as "GCPad".
Switch to Billiard's IniFile implementation throughout Dolphin (it's faster!!). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5579 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -64,15 +64,12 @@ CPluginManager::CPluginManager()
|
||||
|
||||
// Start LogManager
|
||||
m_PluginGlobals->logManager = LogManager::GetInstance();
|
||||
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
||||
|
||||
m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter);
|
||||
|
||||
// Set initial values to NULL.
|
||||
m_video = NULL;
|
||||
m_dsp = NULL;
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
m_pad[i] = NULL;
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
m_wiimote[i] = NULL;
|
||||
}
|
||||
@ -85,15 +82,6 @@ CPluginManager::~CPluginManager()
|
||||
delete m_PluginGlobals;
|
||||
delete m_dsp;
|
||||
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (m_pad[i])
|
||||
{
|
||||
delete m_pad[i];
|
||||
m_pad[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
{
|
||||
if (m_wiimote[i])
|
||||
@ -112,7 +100,7 @@ CPluginManager::~CPluginManager()
|
||||
|
||||
// Init and Shutdown Plugins
|
||||
// ------------
|
||||
// Function: Point the m_pad[] and other variables to a certain plugin
|
||||
// Function: Point the m_wiimote[] and other variables to a certain plugin
|
||||
bool CPluginManager::InitPlugins()
|
||||
{
|
||||
// Update pluginglobals.
|
||||
@ -134,26 +122,9 @@ bool CPluginManager::InitPlugins()
|
||||
}
|
||||
INFO_LOG(CONSOLE, "After GetVideo\n");
|
||||
|
||||
// Check if we get at least one pad or wiimote
|
||||
bool pad = false;
|
||||
// Check if we get at least one wiimote
|
||||
bool wiimote = false;
|
||||
|
||||
// Init pad
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
// Check that the plugin has a name
|
||||
if (!m_params->m_strPadPlugin[i].empty())
|
||||
GetPad(i);
|
||||
// Check that GetPad succeeded
|
||||
if (m_pad[i] != NULL)
|
||||
pad = true;
|
||||
}
|
||||
if (!pad)
|
||||
{
|
||||
PanicAlert("Can't init any PAD Plugins");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Init wiimote
|
||||
if (m_params->bWii)
|
||||
{
|
||||
@ -180,15 +151,6 @@ bool CPluginManager::InitPlugins()
|
||||
// for an explanation about the current LoadLibrary() and FreeLibrary() behavior.
|
||||
void CPluginManager::ShutdownPlugins()
|
||||
{
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (m_pad[i])
|
||||
{
|
||||
m_pad[i]->Shutdown();
|
||||
FreePad(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
{
|
||||
if (m_wiimote[i])
|
||||
@ -304,10 +266,6 @@ void *CPluginManager::LoadPlugin(const char *_rFilename)
|
||||
plugin = new Common::PluginDSP(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_PAD:
|
||||
plugin = new Common::PluginPAD(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
plugin = new Common::PluginWiimote(_rFilename);
|
||||
break;
|
||||
@ -382,28 +340,12 @@ 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. And often for the DSP
|
||||
from the DSP files.
|
||||
often for the Wiimote from the SI_.cpp files.
|
||||
|
||||
We don't need to check if [Plugin]->IsValid() here because it will not be set by LoadPlugin()
|
||||
if it's not valid.
|
||||
*/
|
||||
// ------------
|
||||
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
|
||||
FreePad(controller);
|
||||
}
|
||||
|
||||
// Else load a new plugin
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str());
|
||||
return m_pad[controller];
|
||||
}
|
||||
|
||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||
{
|
||||
if (m_wiimote[controller] != NULL)
|
||||
@ -470,15 +412,6 @@ void CPluginManager::FreeDSP()
|
||||
m_dsp = NULL;
|
||||
}
|
||||
|
||||
void CPluginManager::FreePad(u32 Pad)
|
||||
{
|
||||
if (Pad < MAXPADS)
|
||||
{
|
||||
delete m_pad[Pad];
|
||||
m_pad[Pad] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CPluginManager::FreeWiimote(u32 Wiimote)
|
||||
{
|
||||
if (Wiimote < MAXWIIMOTES)
|
||||
@ -496,7 +429,6 @@ void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState)
|
||||
// Would we need to call all plugins?
|
||||
// If yes, how would one check if the plugin was not
|
||||
// just created by GetXxx(idx) because there was none?
|
||||
GetPad(0)->EmuStateChange(newState);
|
||||
GetWiimote(0)->EmuStateChange(newState);
|
||||
}
|
||||
|
||||
@ -521,9 +453,6 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
|
||||
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;
|
||||
@ -532,7 +461,7 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
|
||||
}
|
||||
}
|
||||
|
||||
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
|
||||
// Open debugging window. Type = Video. Show = Show or hide window.
|
||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
|
||||
{
|
||||
if (!File::Exists(_rFilename))
|
||||
|
Reference in New Issue
Block a user