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:
parent
7f9dc55fbc
commit
bb06dfb823
|
@ -254,11 +254,8 @@ void Init()
|
||||||
g_Channel[i].m_InHi.Hex = 0;
|
g_Channel[i].m_InHi.Hex = 0;
|
||||||
g_Channel[i].m_InLo.Hex = 0;
|
g_Channel[i].m_InLo.Hex = 0;
|
||||||
|
|
||||||
// Check the maxpads limit
|
// Access the pad and check the MAXPADS limit
|
||||||
int j = i; if(i >= MAXPADS) j = MAXPADS - 1;
|
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD((i >= MAXPADS) ? (MAXPADS - 1): i);
|
||||||
|
|
||||||
// Get pad
|
|
||||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(j);
|
|
||||||
|
|
||||||
// Check if this pad is attached for the current plugin
|
// Check if this pad is attached for the current plugin
|
||||||
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
||||||
|
|
|
@ -112,7 +112,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
|
||||||
// __________________________________________________________________________________________________
|
// __________________________________________________________________________________________________
|
||||||
// GetData
|
// GetData
|
||||||
//
|
//
|
||||||
// return true on new data (max 7 Bytes and 6 bits ;)
|
// Return true on new data (max 7 Bytes and 6 bits ;)
|
||||||
//
|
//
|
||||||
bool
|
bool
|
||||||
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||||
|
@ -120,7 +120,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||||
SPADStatus PadStatus;
|
SPADStatus PadStatus;
|
||||||
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
||||||
Common::PluginPAD* pad =
|
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);
|
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||||
|
|
||||||
_Hi = (u32)((u8)PadStatus.stickY);
|
_Hi = (u32)((u8)PadStatus.stickY);
|
||||||
|
|
|
@ -249,7 +249,7 @@ void Initialize(void *init)
|
||||||
|
|
||||||
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
|
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
|
||||||
the SDL_INIT_VIDEO flag to */
|
the SDL_INIT_VIDEO flag to */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||||
|
@ -309,8 +309,8 @@ int Search_Devices()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
fprintf(pFile, "Scanning for devices\n");
|
fprintf(pFile, "Scanning for devices\n");
|
||||||
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
|
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i = 0; i < numjoy; i++ )
|
for(int i = 0; i < numjoy; i++ )
|
||||||
|
@ -409,7 +409,7 @@ void DoState(unsigned char **ptr, int mode) {}
|
||||||
|
|
||||||
// Set PAD status
|
// Set PAD status
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
// Called from: SerialInterface_Devices.cpp
|
// Called from: SI_DeviceGCController.cpp
|
||||||
// Function: Gives the current pad status to the Core
|
// Function: Gives the current pad status to the Core
|
||||||
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue