Remove old silly code that pretended to support loading multiple pad plugins and multiple wiimote plugins, but actually didn't.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5666 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2010-06-12 20:13:58 +00:00
parent 7c103fbc4e
commit 5fe57452af
14 changed files with 87 additions and 134 deletions

View File

@ -296,8 +296,8 @@ void SConfig::LoadSettings()
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin[0], m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
}

View File

@ -392,7 +392,7 @@ THREAD_RETURN EmuThread(void *pArg)
PADInitialize.pRendererHasFocus = Callback_RendererHasFocus;
// This is may be needed to avoid a SDL problem
//Plugins.FreeWiimote();
Plugins.GetPad(0)->Initialize(&PADInitialize);
Plugins.GetPad()->Initialize(&PADInitialize);
// Load and Init WiimotePlugin - only if we are booting in wii mode
if (_CoreParameter.bWii)
@ -407,7 +407,7 @@ THREAD_RETURN EmuThread(void *pArg)
WiimoteInitialize.pWiimoteInterruptChannel = Callback_WiimoteInterruptChannel;
WiimoteInitialize.pRendererHasFocus = Callback_RendererHasFocus;
// Wait for Wiiuse to find the number of connected Wiimotes
Plugins.GetWiimote(0)->Initialize((void *)&WiimoteInitialize);
Plugins.GetWiimote()->Initialize((void *)&WiimoteInitialize);
}
// The hardware is initialized.

View File

@ -21,9 +21,6 @@
#include "IniFile.h"
#include <string>
#define MAXPADS 1
#define MAXWIIMOTES 1
enum Hotkey {
HK_FULLSCREEN,
HK_PLAY_PAUSE,
@ -121,9 +118,9 @@ struct SCoreStartupParameter
// files
std::string m_strVideoPlugin;
std::string m_strPadPlugin[MAXPADS];
std::string m_strPadPlugin;
std::string m_strDSPPlugin;
std::string m_strWiimotePlugin[MAXWIIMOTES];
std::string m_strWiimotePlugin;
std::string m_strFilename;
std::string m_strBootROM;

View File

@ -144,7 +144,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 10, %02x (READ STATUS&SWITCHES)", ptr(1));
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus));
CPluginManager::GetInstance().GetPad(0)
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
res[resp++] = 0x10;
res[resp++] = 0x2;
@ -310,7 +310,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
for (i=0; i<nr_players; ++i)
{
SPADStatus PadStatus;
CPluginManager::GetInstance().GetPad(0)
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(i, &PadStatus);
unsigned char player_data[2] = {0,0};
if (PadStatus.button & PAD_BUTTON_START)
@ -348,7 +348,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
int slots = *jvs_io++;
msg.addData(1);
SPADStatus PadStatus;
CPluginManager::GetInstance().GetPad(0)
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(0, &PadStatus);
while (slots--)
{

View File

@ -128,7 +128,7 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{
SPADStatus PadStatus;
memset(&PadStatus, 0, sizeof(PadStatus));
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(0);
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad();
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
u32 netValues[2] = {0};
@ -258,7 +258,7 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
// SendCommand
void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
{
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(0);
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad();
UCommand command(_Cmd);
switch (command.Command)

View File

@ -497,7 +497,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
#if defined(HAVE_WX) && HAVE_WX
NetPlay_WiimoteUpdate(i);
#endif
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update(i);
CPluginManager::GetInstance().GetWiimote()->Wiimote_Update(i);
return true;
}
}

View File

@ -182,7 +182,7 @@ void CWII_IPC_HLE_WiiMote::EventDisconnect()
{
// Send disconnect message to plugin
u8 Message = WIIMOTE_DISCONNECT;
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, 99, &Message, 0);
CPluginManager::GetInstance().GetWiimote()->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, 99, &Message, 0);
m_Connected = -1;
// Clear channel flags
@ -264,7 +264,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
const int number = 0;
#endif
Common::PluginWiimote* mote = CPluginManager::GetInstance().GetWiimote(0);
Common::PluginWiimote* mote = CPluginManager::GetInstance().GetWiimote();
if (itr != m_Channel.end())
{
SChannel& rChannel = itr->second;

View File

@ -70,10 +70,8 @@ CPluginManager::CPluginManager()
// 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;
m_pad = NULL;
m_wiimote = NULL;
}
// This will call FreeLibrary() for all plugins
@ -84,23 +82,17 @@ CPluginManager::~CPluginManager()
delete m_PluginGlobals;
delete m_dsp;
for (int i = 0; i < MAXPADS; i++)
if (m_pad)
{
if (m_pad[i])
{
delete m_pad[i];
m_pad[i] = NULL;
}
delete m_pad;
m_pad = NULL;
}
for (int i = 0; i < MAXWIIMOTES; i++)
if (m_wiimote)
{
if (m_wiimote[i])
{
m_wiimote[i]->Shutdown();
delete m_wiimote[i];
m_wiimote[i] = NULL;
}
m_wiimote->Shutdown();
delete m_wiimote;
m_wiimote = NULL;
}
delete m_video;
@ -131,40 +123,27 @@ bool CPluginManager::InitPlugins()
PanicAlert("Can't init DSP Plugin");
return false;
}
// Check if we get at least one pad or wiimote
bool pad = false;
bool wiimote = false;
// Init pad
for (int i = 0; i < MAXPADS; i++)
// Check that the plugin has a name
if (!m_params->m_strPadPlugin.empty())
GetPad();
// Check that GetPad succeeded
if (!m_pad)
{
// 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");
PanicAlert("Can't init PAD Plugin");
return false;
}
// Init wiimote
if (m_params->bWii)
{
for (int i = 0; i < MAXWIIMOTES; i++)
if (!m_params->m_strWiimotePlugin.empty())
GetWiimote();
if (!m_wiimote)
{
if (!m_params->m_strWiimotePlugin[i].empty())
GetWiimote(i);
if (m_wiimote[i] != NULL)
wiimote = true;
}
if (!wiimote)
{
PanicAlert("Can't init any Wiimote Plugins");
PanicAlert("Can't init Wiimote Plugin");
return false;
}
}
@ -177,22 +156,16 @@ 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)
{
if (m_pad[i])
{
m_pad[i]->Shutdown();
FreePad(i);
}
m_pad->Shutdown();
FreePad();
}
for (int i = 0; i < MAXWIIMOTES; i++)
if (m_wiimote)
{
if (m_wiimote[i])
{
m_wiimote[i]->Shutdown();
FreeWiimote(i);
}
m_wiimote->Shutdown();
FreeWiimote();
}
if (m_dsp)
@ -381,34 +354,34 @@ void CPluginManager::ScanForPlugins()
if it's not valid.
*/
// ------------
Common::PluginPAD *CPluginManager::GetPad(int controller)
Common::PluginPAD *CPluginManager::GetPad()
{
if (m_pad[controller] != NULL)
if (m_pad != NULL)
{
if (m_pad[controller]->GetFilename() == m_params->m_strPadPlugin[controller])
return m_pad[controller];
if (m_pad->GetFilename() == m_params->m_strPadPlugin)
return m_pad;
else
FreePad(controller);
FreePad();
}
// Else load a new plugin
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str());
return m_pad[controller];
m_pad = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin.c_str());
return m_pad;
}
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
Common::PluginWiimote *CPluginManager::GetWiimote()
{
if (m_wiimote[controller] != NULL)
if (m_wiimote != NULL)
{
if (m_wiimote[controller]->GetFilename() == m_params->m_strWiimotePlugin[controller])
return m_wiimote[controller];
if (m_wiimote->GetFilename() == m_params->m_strWiimotePlugin)
return m_wiimote;
else
FreeWiimote(controller);
FreeWiimote();
}
// Else load a new plugin
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params->m_strWiimotePlugin[controller].c_str());
return m_wiimote[controller];
m_wiimote = (Common::PluginWiimote*)LoadPlugin(m_params->m_strWiimotePlugin.c_str());
return m_wiimote;
}
Common::PluginDSP *CPluginManager::GetDSP()
@ -462,22 +435,16 @@ void CPluginManager::FreeDSP()
m_dsp = NULL;
}
void CPluginManager::FreePad(u32 Pad)
void CPluginManager::FreePad()
{
if (Pad < MAXPADS)
{
delete m_pad[Pad];
m_pad[Pad] = NULL;
}
delete m_pad;
m_pad = NULL;
}
void CPluginManager::FreeWiimote(u32 Wiimote)
void CPluginManager::FreeWiimote()
{
if (Wiimote < MAXWIIMOTES)
{
delete m_wiimote[Wiimote];
m_wiimote[Wiimote] = NULL;
}
delete m_wiimote;
m_wiimote = NULL;
}
void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState)
@ -488,8 +455,8 @@ 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);
GetPad()->EmuStateChange(newState);
GetWiimote()->EmuStateChange(newState);
}
@ -515,10 +482,10 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
GetDSP()->Config((HWND)_Parent);
break;
case PLUGIN_TYPE_PAD:
GetPad(0)->Config((HWND)_Parent);
GetPad()->Config((HWND)_Parent);
break;
case PLUGIN_TYPE_WIIMOTE:
GetWiimote(0)->Config((HWND)_Parent);
GetWiimote()->Config((HWND)_Parent);
break;
default:
PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename);

View File

@ -51,13 +51,13 @@ public:
Common::PluginVideo *GetVideo();
Common::PluginDSP *GetDSP();
Common::PluginPAD *GetPad(int controller);
Common::PluginWiimote *GetWiimote(int controller);
Common::PluginPAD *GetPad();
Common::PluginWiimote *GetWiimote();
void FreeVideo();
void FreeDSP();
void FreePad(u32 Pad);
void FreeWiimote(u32 Wiimote);
void FreePad();
void FreeWiimote();
void EmuStateChange(PLUGIN_EMUSTATE newState);
@ -69,6 +69,7 @@ public:
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;
@ -76,8 +77,8 @@ private:
PLUGIN_GLOBALS *m_PluginGlobals;
Common::PluginVideo *m_video;
Common::PluginDSP *m_dsp;
Common::PluginPAD *m_pad[4];
Common::PluginWiimote *m_wiimote[4];
Common::PluginPAD *m_pad;
Common::PluginWiimote *m_wiimote;
SCoreStartupParameter * m_params;
CPluginManager();

View File

@ -92,9 +92,9 @@ void DoState(PointerWrap &p)
CPluginManager &pm = CPluginManager::GetInstance();
pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
pm.GetPad(0)->DoState(p.GetPPtr(), p.GetMode());
pm.GetPad()->DoState(p.GetPPtr(), p.GetMode());
if (Core::g_CoreStartupParameter.bWii)
pm.GetWiimote(0)->DoState(p.GetPPtr(), p.GetMode());
pm.GetWiimote()->DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p);
HW::DoState(p);
CoreTiming::DoState(p);

View File

@ -319,10 +319,8 @@ void CConfigMain::InitializeGUIValues()
// Plugins
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
for (int i = 0; i < MAXPADS; i++)
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
for (int i=0; i < MAXWIIMOTES; i++)
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
}
void CConfigMain::InitializeGUITooltips()
@ -1144,10 +1142,8 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
// Update plugin filenames
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
for (int i = 0; i < MAXPADS; i++)
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
for (int i = 0; i < MAXWIIMOTES; i++)
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
}
void CConfigMain::OnConfig(wxCommandEvent& event)

View File

@ -882,8 +882,8 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
#endif
// Send the keyboard status to the Input plugins
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Input(event.GetKeyCode(), 1); // 1 = Down
CPluginManager::GetInstance().GetPad()->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 1); // 1 = Down
}
else
event.Skip();
@ -894,8 +894,8 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
event.Skip();
if(Core::GetState() != Core::CORE_UNINITIALIZED) {
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Input(event.GetKeyCode(), 0); // 0 = Up
CPluginManager::GetInstance().GetPad()->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 0); // 0 = Up
}
}

View File

@ -944,7 +944,7 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str(),
PLUGIN_TYPE_PAD
);
}
@ -952,7 +952,7 @@ void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0].c_str(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str(),
PLUGIN_TYPE_WIIMOTE
);
}

View File

@ -354,20 +354,12 @@ bool DolphinApp::OnInit()
std::string(audioPluginFilename.mb_str());
if (selectPadPlugin && padPluginFilename != wxEmptyString)
{
int k;
for(k=0;k<MAXPADS;k++)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[k] =
std::string(padPluginFilename.mb_str());
}
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin =
std::string(padPluginFilename.mb_str());
if (selectWiimotePlugin && wiimotePluginFilename != wxEmptyString)
{
int k;
for(k=0;k<MAXWIIMOTES;k++)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[k] =
std::string(wiimotePluginFilename.mb_str());
}
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin =
std::string(wiimotePluginFilename.mb_str());
// Enable the PNG image handler
wxInitAllImageHandlers();