Adapts emulated trigger range to Gamecube trigger range
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4963 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
20704509bf
commit
e988a7487c
|
@ -364,6 +364,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
{
|
||||
_pPADStatus->triggerLeft = GCMapping[_numPAD].AxisState.Lx;
|
||||
_pPADStatus->triggerRight = GCMapping[_numPAD].AxisState.Ly;
|
||||
EmulateAnalogTrigger(_pPADStatus->triggerLeft, _pPADStatus->triggerRight);
|
||||
if (_pPADStatus->triggerLeft > DEF_TRIGGER_THRESHOLD)
|
||||
_pPADStatus->button |= PAD_TRIGGER_L;
|
||||
if (_pPADStatus->triggerRight > DEF_TRIGGER_THRESHOLD)
|
||||
|
@ -373,6 +374,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
{
|
||||
_pPADStatus->triggerLeft = GCMapping[_numPAD].AxisState.Rx;
|
||||
_pPADStatus->triggerRight = GCMapping[_numPAD].AxisState.Ry;
|
||||
EmulateAnalogTrigger(_pPADStatus->triggerLeft, _pPADStatus->triggerRight);
|
||||
if (_pPADStatus->triggerLeft > DEF_TRIGGER_THRESHOLD)
|
||||
_pPADStatus->button |= PAD_TRIGGER_L;
|
||||
if (_pPADStatus->triggerRight > DEF_TRIGGER_THRESHOLD)
|
||||
|
@ -382,6 +384,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
{
|
||||
_pPADStatus->triggerLeft = GCMapping[_numPAD].AxisState.Tl;
|
||||
_pPADStatus->triggerRight = GCMapping[_numPAD].AxisState.Tr;
|
||||
EmulateAnalogTrigger(_pPADStatus->triggerLeft, _pPADStatus->triggerRight);
|
||||
if (_pPADStatus->triggerLeft > DEF_TRIGGER_THRESHOLD)
|
||||
_pPADStatus->button |= PAD_TRIGGER_L;
|
||||
if (_pPADStatus->triggerRight > DEF_TRIGGER_THRESHOLD)
|
||||
|
@ -424,6 +427,17 @@ void EmulateAnalogStick(unsigned char &stickX, unsigned char &stickY, bool butto
|
|||
}
|
||||
}
|
||||
|
||||
void EmulateAnalogTrigger(unsigned char &trL, unsigned char &trR)
|
||||
{
|
||||
if (GCMapping[g_ID].TriggerType == InputCommon::CTL_TRIGGER_SDL)
|
||||
{
|
||||
int triggerL = abs((int)trL - 0x80) * 2;
|
||||
int triggerR = abs((int)trR - 0x80) * 2;
|
||||
trL = (triggerL > 0xFF) ? 0xFF : triggerL;
|
||||
trR = (triggerR > 0xFF) ? 0xFF : triggerR;
|
||||
}
|
||||
}
|
||||
|
||||
void Close_Devices()
|
||||
{
|
||||
PAD_RumbleClose();
|
||||
|
|
|
@ -155,6 +155,7 @@ extern Display* WMdisplay;
|
|||
// Custom Functions
|
||||
// ----------------
|
||||
void EmulateAnalogStick(unsigned char &stickX, unsigned char &stickY, bool buttonUp, bool buttonDown, bool buttonLeft, bool buttonRight, int magnitude);
|
||||
void EmulateAnalogTrigger(unsigned char &trL, unsigned char &trR);
|
||||
void Close_Devices();
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
||||
void GetAxisState(CONTROLLER_MAPPING_GC &_GCMapping);
|
||||
|
|
Loading…
Reference in New Issue