From 1b2d7ef56d4110aba030f4ef78ea98aba4ade782 Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Mon, 21 Jul 2008 18:25:46 +0000 Subject: [PATCH] added support for multi-controller git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@41 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/Memmap.cpp | 2 +- Source/Core/Core/Src/HW/SerialInterface.cpp | 14 +++++++++----- Source/Core/Core/Src/Plugins/Plugin_PAD.cpp | 12 ++++++++++++ Source/Core/Core/Src/Plugins/Plugin_PAD.h | 1 + Source/PluginSpecs/pluginspecs_pad.h | 8 ++++++++ 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 1b2e84e45c..8452a35ca9 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -46,7 +46,7 @@ namespace Memory // GLOABL DEFINES -#define NOCHECK +// #define NOCHECK static const bool bFakeVMEM = false; diff --git a/Source/Core/Core/Src/HW/SerialInterface.cpp b/Source/Core/Core/Src/HW/SerialInterface.cpp index 14095fe92f..c80350c6b5 100644 --- a/Source/Core/Core/Src/HW/SerialInterface.cpp +++ b/Source/Core/Core/Src/HW/SerialInterface.cpp @@ -24,6 +24,7 @@ #include "CPU.h" #include "../PowerPC/PowerPC.h" +#include "../Plugins/Plugin_PAD.h" namespace SerialInterface { @@ -226,11 +227,14 @@ void Init() g_Channel[i].m_InLo.Hex = 0; } - g_Channel[0].m_pDevice = new CSIDevice_GCController(0); - g_Channel[1].m_pDevice = new CSIDevice_Dummy(1);//new CSIDevice_GCController(1); - g_Channel[2].m_pDevice = new CSIDevice_Dummy(2);//new CSIDevice_GCController(2); - g_Channel[3].m_pDevice = new CSIDevice_Dummy(3);//new CSIDevice_GCController(3); - + for (int i=0; i<4; i++) + { + if (PluginPAD::PAD_GetNumberOfPads() & (1 (plugin.Get("PAD_Shutdown")); g_PAD_GetStatus = reinterpret_cast (plugin.Get("PAD_GetStatus")); g_PAD_Rumble = reinterpret_cast (plugin.Get("PAD_Rumble")); + g_PAD_GetNumberOfPads = reinterpret_cast(plugin.Get("PAD_GetNumberOfPads")); if ((g_GetDllInfo != 0) && (g_DllAbout != 0) && @@ -132,4 +136,12 @@ void PAD_Rumble(BYTE _numPAD, unsigned int _iType, unsigned int _iStrength) g_PAD_Rumble(_numPAD, _iType, _iStrength); } +unsigned int PAD_GetNumberOfPads() +{ + if (g_PAD_GetNumberOfPads) + return g_PAD_GetNumberOfPads(); + + return 1; +} + } // end of namespace PluginPAD diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.h b/Source/Core/Core/Src/Plugins/Plugin_PAD.h index c137b3fd22..1eb11a954f 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.h +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.h @@ -38,6 +38,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize); void PAD_Shutdown(); void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus); void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength); +unsigned int PAD_GetNumberOfPads(); unsigned int SaveLoadState(char* _ptr, BOOL save); } // end of namespace PluginPAD diff --git a/Source/PluginSpecs/pluginspecs_pad.h b/Source/PluginSpecs/pluginspecs_pad.h index 24fa19cdfe..402c8d243d 100644 --- a/Source/PluginSpecs/pluginspecs_pad.h +++ b/Source/PluginSpecs/pluginspecs_pad.h @@ -125,6 +125,14 @@ EXPORT void CALL PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus); // EXPORT void CALL PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength); +// __________________________________________________________________________________________________ +// Function: PAD_GetNumberOfPads +// Purpose: Get number of pads (it is flag eg: controller 1 & 4 -> 5) +// input: none +// output: number of pads +// +EXPORT unsigned int CALL PAD_GetNumberOfPads(); + // __________________________________________________________________________________________________ // Function: SaveLoadState // Purpose: Saves/load state