make JVS L and R buttons from slider work with input emulator active
(should fix issue #6)
This commit is contained in:
@@ -125,6 +125,13 @@ namespace TLAC::Components
|
||||
inputState->DoubleTapped.Buttons = GetJvsButtonsState(tappedFunc);
|
||||
inputState->IntervalTapped.Buttons = GetJvsButtonsState(tappedFunc);
|
||||
|
||||
// if not interacting with L and R, use values from the slider instead
|
||||
if ( ( (inputState->Tapped.Buttons | inputState->Released.Buttons | inputState->Down.Buttons)
|
||||
& (JVS_L | JVS_R) ) == 0)
|
||||
{
|
||||
UpdateSliderLR();
|
||||
}
|
||||
|
||||
UpdateHoldState();
|
||||
heldButtons = GetButtonFromHold();
|
||||
|
||||
@@ -305,4 +312,43 @@ namespace TLAC::Components
|
||||
inputState->SetBit(bit, keyboard->IsIntervalTapped(keycode), InputBufferType_IntervalTapped);
|
||||
|
||||
}
|
||||
|
||||
typedef uint8_t getSliderSensorFunc(void*, int);
|
||||
void InputEmulator::UpdateSliderLR()
|
||||
{
|
||||
getSliderSensorFunc* getSliderSensorTapped = (getSliderSensorFunc*)GET_SLIDER_TAPPED_ADDRESS;
|
||||
getSliderSensorFunc* getSliderSensorReleased = (getSliderSensorFunc*)GET_SLIDER_RELEASED_ADDRESS;
|
||||
getSliderSensorFunc* getSliderSensorDown = (getSliderSensorFunc*)GET_SLIDER_DOWN_ADDRESS;
|
||||
|
||||
if (getSliderSensorTapped((void*)SLIDER_CTRL_TASK_ADDRESS, 36))
|
||||
inputState->Tapped.Buttons |= JVS_L;
|
||||
else
|
||||
inputState->Tapped.Buttons &= ~JVS_L;
|
||||
|
||||
if (getSliderSensorReleased((void*)SLIDER_CTRL_TASK_ADDRESS, 36))
|
||||
inputState->Released.Buttons |= JVS_L;
|
||||
else
|
||||
inputState->Released.Buttons &= ~JVS_L;
|
||||
|
||||
if (getSliderSensorDown((void*)SLIDER_CTRL_TASK_ADDRESS, 36))
|
||||
inputState->Down.Buttons |= JVS_L;
|
||||
else
|
||||
inputState->Down.Buttons &= ~JVS_L;
|
||||
|
||||
|
||||
if (getSliderSensorTapped((void*)SLIDER_CTRL_TASK_ADDRESS, 37))
|
||||
inputState->Tapped.Buttons |= JVS_R;
|
||||
else
|
||||
inputState->Tapped.Buttons &= ~JVS_R;
|
||||
|
||||
if (getSliderSensorReleased((void*)SLIDER_CTRL_TASK_ADDRESS, 37))
|
||||
inputState->Released.Buttons |= JVS_R;
|
||||
else
|
||||
inputState->Released.Buttons &= ~JVS_R;
|
||||
|
||||
if (getSliderSensorDown((void*)SLIDER_CTRL_TASK_ADDRESS, 37))
|
||||
inputState->Down.Buttons |= JVS_R;
|
||||
else
|
||||
inputState->Down.Buttons &= ~JVS_R;
|
||||
}
|
||||
}
|
||||
@@ -98,5 +98,6 @@ namespace TLAC::Components
|
||||
bool IsHold();
|
||||
|
||||
void UpdateInputBit(uint32_t bit, uint8_t keycode);
|
||||
void UpdateSliderLR();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,6 +78,10 @@ constexpr uint64_t UI_HEIGHT_ADDRESS = 0x000000014CC621E8;
|
||||
constexpr uint64_t FB_ASPECT_RATIO = 0x0000000140FBC2E8;
|
||||
constexpr uint64_t UI_ASPECT_RATIO = 0x000000014CC621D0;
|
||||
|
||||
constexpr uint64_t GET_SLIDER_TAPPED_ADDRESS = 0x0000000140618C60;
|
||||
constexpr uint64_t GET_SLIDER_RELEASED_ADDRESS = 0x0000000140618C40;
|
||||
constexpr uint64_t GET_SLIDER_DOWN_ADDRESS = 0x0000000140618C20;
|
||||
|
||||
#define XINPUT_A 0x00
|
||||
#define XINPUT_B 0x01
|
||||
#define XINPUT_X 0x02
|
||||
|
||||
Reference in New Issue
Block a user