diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-01-22 00:31:12 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-01-22 00:31:12 +0000 |
| commit | bb06dfb823009e6941e6bf355af37bb8193a69d8 (patch) | |
| tree | 6ec74158a6b8cf7df939b9f5e419d800341082b0 /Source/Core | |
| parent | 7f9dc55fbc1ebb9b2819e896d39a426bdbe74b93 (diff) | |
nJoy and SerialInterface: Fixed the nJoy crashes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1978 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Src/HW/SI.cpp | 7 | ||||
| -rw-r--r-- | Source/Core/Core/Src/HW/SI_DeviceGCController.cpp | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index 00779dbbbe..fc98f65c59 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -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)))
diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index e74eeb2f46..9d42bffe18 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -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);
|
