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

@ -332,13 +332,19 @@ THREAD_RETURN EmuThread(void *pArg)
dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt;
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
pm.GetDSP()->Initialize((void *)&dspInit);
for (int i=0;i<MAXPADS;i++) {
// Load and Init PadPlugin
SPADInitialize PADInitialize;
PADInitialize.hWnd = g_pWindowHandle;
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
if (_CoreParameter.bWii) {
SWiimoteInitialize WiimoteInitialize;

View File

@ -231,28 +231,22 @@ void UpdateInterrupts();
void Init()
{
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);
unsigned int AttachedPadMask;
if (pad != NULL)
AttachedPadMask = pad->PAD_GetAttachedPads();
else
AttachedPadMask = 1;
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);
}
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;
}
// 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++) {
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
g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
}
g_Poll.Hex = 0;
g_ComCSR.Hex = 0;

View File

@ -119,7 +119,8 @@ 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(ISIDevice::m_iDeviceNumber);
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
_Hi = (u32)((u8)PadStatus.stickY);

View File

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