From cd76970d8f29b7e7c4ab3244833adbd3dbe16f92 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Wed, 21 Jan 2009 17:54:03 +0000 Subject: [PATCH] SerialInterface: Fixed the Init for different MAXPADS values, I think git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1975 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/SI.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index 11b09a8321..00779dbbbe 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -246,28 +246,25 @@ void DoState(PointerWrap &p) // ŻŻŻŻŻŻŻŻŻŻ void Init() { + // TODO: allow dynamic attaching/detaching of plugins + // maybe this code should be in the pad plugin loader at all? for (int i = 0; i < NUMBER_OF_CHANNELS; i++) { g_Channel[i].m_Out.Hex = 0; g_Channel[i].m_InHi.Hex = 0; g_Channel[i].m_InLo.Hex = 0; - // First attach a dummy device to all channels - g_Channel[i].m_pDevice = new CSIDevice_Dummy(i); - } + // Check the maxpads limit + int j = i; if(i >= MAXPADS) j = MAXPADS - 1; - // TODO: allow dynamic attaching/detaching of plugins - // maybe this code should be in the pad plugin loader at all? - for (int i = 0; i < MAXPADS; i++) - { - // Get pad status - Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(i); + // Get pad + Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(j); // Check if this pad is attached for the current plugin if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i))) g_Channel[i].m_pDevice = new CSIDevice_GCController(i); - //else - // g_Channel[i].m_pDevice = new CSIDevice_Dummy(i); + else + g_Channel[i].m_pDevice = new CSIDevice_Dummy(i); } g_Poll.Hex = 0;