trying to support 2 pads plugins

I don't have joystick so please check njoy
and if someone can check if njoy and pad simple can be used together:)
todo: add configuration now you can just do it from the ini by defining
pad?Plugin manually


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1920 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-01-18 13:02:38 +00:00
parent 8ca3b9a2ed
commit 1ef5eca30c
4 changed files with 28 additions and 26 deletions

View File

@ -333,11 +333,17 @@ THREAD_RETURN EmuThread(void *pArg)
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming; dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
pm.GetDSP()->Initialize((void *)&dspInit); pm.GetDSP()->Initialize((void *)&dspInit);
for (int i=0;i<MAXPADS;i++) {
// Load and Init PadPlugin // Load and Init PadPlugin
SPADInitialize PADInitialize; SPADInitialize PADInitialize;
PADInitialize.hWnd = g_pWindowHandle; PADInitialize.hWnd = g_pWindowHandle;
PADInitialize.pLog = Callback_PADLog; PADInitialize.pLog = Callback_PADLog;
pm.GetPAD(0)->Initialize((void *)&PADInitialize); PADInitialize.padNumber = i;
pm.GetPAD(i)->Initialize((void *)&PADInitialize);
}
// Load and Init WiimotePlugin - only if we are booting in wii mode // Load and Init WiimotePlugin - only if we are booting in wii mode
if (_CoreParameter.bWii) { if (_CoreParameter.bWii) {

View File

@ -231,28 +231,22 @@ void UpdateInterrupts();
void Init() void Init()
{ {
for (int i = 0; i < NUMBER_OF_CHANNELS; i++) 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;
}
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0); g_Channel[i].m_Out.Hex = 0;
g_Channel[i].m_InHi.Hex = 0;
g_Channel[i].m_InLo.Hex = 0;
}
unsigned int AttachedPadMask; // TODO: allow dynamic attaching/detaching of plugins
if (pad != NULL) // maybe this code should be in the pad plugin loader at all?
AttachedPadMask = pad->PAD_GetAttachedPads(); for (int i = 0; i < MAXPADS; i++) {
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(i);
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
g_Channel[i].m_pDevice = new CSIDevice_GCController(i);
else else
AttachedPadMask = 1; g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
}
for (int i = 0; i < 4; i++)
{
if (AttachedPadMask & (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_Poll.Hex = 0;
g_ComCSR.Hex = 0; g_ComCSR.Hex = 0;

View File

@ -119,7 +119,8 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{ {
SPADStatus PadStatus; SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus)); memset(&PadStatus, 0 ,sizeof(PadStatus));
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0); Common::PluginPAD* pad =
CPluginManager::GetInstance().GetPAD(ISIDevice::m_iDeviceNumber);
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
_Hi = (u32)((u8)PadStatus.stickY); _Hi = (u32)((u8)PadStatus.stickY);

View File

@ -35,6 +35,7 @@ typedef struct
{ {
HWND hWnd; HWND hWnd;
TLog pLog; TLog pLog;
int padNumber;
} SPADInitialize; } SPADInitialize;
typedef struct typedef struct