diff options
| author | fires.gc <fires.gc@gmail.com> | 2008-07-21 18:25:46 +0000 |
|---|---|---|
| committer | fires.gc <fires.gc@gmail.com> | 2008-07-21 18:25:46 +0000 |
| commit | 1b2d7ef56d4110aba030f4ef78ea98aba4ade782 (patch) | |
| tree | 453bd44649f3596f74fee1292484b5bc11c6a73e /Source | |
| parent | 90c8c2185dcec2788c21845879e9a646c58040c4 (diff) | |
added support for multi-controller
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@41 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/Src/HW/Memmap.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Core/Src/HW/SerialInterface.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/Core/Src/Plugins/Plugin_PAD.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/Core/Src/Plugins/Plugin_PAD.h | 1 | ||||
| -rw-r--r-- | 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<i))
+ g_Channel[i].m_pDevice = new CSIDevice_GCController(i);
+ else
+ g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
+ }
+
g_Poll.Hex = 0;
g_ComCSR.Hex = 0;
g_StatusReg.Hex = 0;
diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp index d674e849d1..09abde5f60 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp @@ -29,6 +29,8 @@ typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); typedef void (__cdecl* TPAD_Shutdown)();
typedef void (__cdecl* TPAD_GetStatus)(BYTE, SPADStatus*);
typedef void (__cdecl* TPAD_Rumble)(BYTE, unsigned int, unsigned int);
+typedef unsigned int (__cdecl* TPAD_GetNumberOfPads)();
+
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
@@ -38,6 +40,7 @@ TDllConfig g_DllConfig = 0; TPAD_Initialize g_PAD_Initialize = 0;
TPAD_GetStatus g_PAD_GetStatus = 0;
TPAD_Rumble g_PAD_Rumble = 0;
+TPAD_GetNumberOfPads g_PAD_GetNumberOfPads = 0;
//! Library Instance
DynamicLibrary plugin;
@@ -71,6 +74,7 @@ bool LoadPlugin(const char *_Filename) g_PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown"));
g_PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus"));
g_PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble"));
+ g_PAD_GetNumberOfPads = reinterpret_cast<TPAD_GetNumberOfPads>(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 @@ -126,6 +126,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
// input: pointer to a 32k scratchpad/saved state
|
