nJoy and SerialInterface: Fixed the nJoy crashes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1978 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-01-22 00:31:12 +00:00
parent 7f9dc55fbc
commit bb06dfb823
3 changed files with 8 additions and 11 deletions

View File

@ -254,11 +254,8 @@ void Init()
g_Channel[i].m_InHi.Hex = 0;
g_Channel[i].m_InLo.Hex = 0;
// Check the maxpads limit
int j = i; if(i >= MAXPADS) j = MAXPADS - 1;
// Get pad
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(j);
// Access the pad and check the MAXPADS limit
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD((i >= MAXPADS) ? (MAXPADS - 1): i);
// Check if this pad is attached for the current plugin
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))

View File

@ -112,7 +112,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
// __________________________________________________________________________________________________
// GetData
//
// return true on new data (max 7 Bytes and 6 bits ;)
// Return true on new data (max 7 Bytes and 6 bits ;)
//
bool
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
@ -120,7 +120,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus));
Common::PluginPAD* pad =
CPluginManager::GetInstance().GetPAD(ISIDevice::m_iDeviceNumber);
CPluginManager::GetInstance().GetPAD((ISIDevice::m_iDeviceNumber >= MAXPADS) ? (MAXPADS - 1): ISIDevice::m_iDeviceNumber);
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
_Hi = (u32)((u8)PadStatus.stickY);

View File

@ -409,7 +409,7 @@ void DoState(unsigned char **ptr, int mode) {}
// Set PAD status
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Called from: SerialInterface_Devices.cpp
// Called from: SI_DeviceGCController.cpp
// Function: Gives the current pad status to the Core
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{