fixed mouse binding

This commit is contained in:
Fire_Head 2019-12-01 01:02:34 +03:00 committed by GitHub
parent 37a7c48e63
commit c07272dfa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 49 additions and 56 deletions

View File

@ -1443,39 +1443,36 @@ bool CControllerConfigManager::GetIsMouseButtonDown(RsKeyCodes keycode)
bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode) bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode)
{ {
if (keycode > rsMOUSEX2BUTTON) switch (keycode)
{ {
switch (keycode) case rsMOUSELEFTBUTTON:
{ if (CPad::GetPad(PAD1)->GetLeftMouseUp())
case rsMOUSELEFTBUTTON: return true;
if (CPad::GetPad(PAD1)->GetLeftMouseUp()) break;
return true; case rsMOUSMIDDLEBUTTON:
break; if (CPad::GetPad(PAD1)->GetMiddleMouseUp())
case rsMOUSMIDDLEBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMiddleMouseUp()) break;
return true; case rsMOUSERIGHTBUTTON:
break; if (CPad::GetPad(PAD1)->GetRightMouseUp())
case rsMOUSERIGHTBUTTON: return true;
if (CPad::GetPad(PAD1)->GetRightMouseUp()) break;
return true; case rsMOUSEWHEELUPBUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseWheelUpUp())
case rsMOUSEWHEELUPBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseWheelUpUp()) break;
return true; case rsMOUSEWHEELDOWNBUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseWheelDownUp())
case rsMOUSEWHEELDOWNBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseWheelDownUp()) break;
return true; case rsMOUSEX1BUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseX1Up())
case rsMOUSEX1BUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseX1Up()) break;
return true; case rsMOUSEX2BUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseX2Up())
case rsMOUSEX2BUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseX2Up()) break;
return true;
break;
}
} }
return false; return false;
@ -1662,9 +1659,6 @@ void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction
bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type) bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type)
{ {
if (type > JOYSTICK)
return true;
switch (type) switch (type)
{ {
case KEYBOARD: case KEYBOARD:
@ -1755,27 +1749,24 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAction action, eControllerType type) void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAction action, eControllerType type)
{ {
if (type <= JOYSTICK) switch (type)
{ {
switch (type) case KEYBOARD:
{ m_aSettings[action][type].m_Key = rsNULL;
case KEYBOARD: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = rsNULL; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case OPTIONAL_EXTRA:
break; m_aSettings[action][type].m_Key = rsNULL;
case OPTIONAL_EXTRA: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = rsNULL; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case MOUSE:
break; m_aSettings[action][type].m_Key = 0;
case MOUSE: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = 0; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case JOYSTICK:
break; m_aSettings[action][type].m_Key = 0;
case JOYSTICK: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = 0; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
break;
}
} }
ResetSettingOrder(action); ResetSettingOrder(action);
@ -2257,6 +2248,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
for (int32 i = 0; i < MAX_BUTTONS; i++) for (int32 i = 0; i < MAX_BUTTONS; i++)
m_aButtonStates[i] = false; m_aButtonStates[i] = false;
#ifdef __DINPUT_INCLUDED__
for (int32 i = 0; i < MAX_BUTTONS; i++) for (int32 i = 0; i < MAX_BUTTONS; i++)
{ {
if (m_NewState.rgbButtons[i] & 0x80) if (m_NewState.rgbButtons[i] & 0x80)
@ -2264,6 +2256,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
else else
m_aButtonStates[i] = false; m_aButtonStates[i] = false;
} }
#endif
} }
bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action) bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action)
@ -2412,4 +2405,4 @@ STARTPATCHES
InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP); InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP);
InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP); InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP);
InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP); InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP);
ENDPATCHES ENDPATCHES