Add jstick member functions missing on Windows implementation.

This commit is contained in:
2025-06-12 03:49:54 -04:00
parent c9e64c5fe6
commit 9117f778b3
2 changed files with 36 additions and 9 deletions

View File

@@ -22,6 +22,25 @@ bool jstick::Cleanup() { return true; }
void jstick::JoystickServiceUpdate() { }
// XInput cannot tell us what type of device it is, so assume it's a legitimate Microsoft XB360 controller.
std::string jstick::GetDeviceName(int hwid) { return "Microsoft X-Box 360 pad"; }
jstick::ControllerType jstick::GetDeviceTypeFromName(const std::string &name) {
// On Windows, we assume the standard controller, we have no way of knowing specifics currently.
// ~josh.
return ControllerType::XBox;
}
int jstick::NumJoysticksDetected() {
// TODO: Check it properly!!
if (JoystickDetected())
return 1;
return 0;
}
Vector2 jstick::GetDPadAxis(float deadzone, int hwid)
{
// "Synthesize" a DPad vector based upon whether the buttons are pressed.
@@ -150,6 +169,17 @@ Vector2 jstick::GetRightThumbstickAxis(float deadzone, int hwid)
return Vector2(state.Gamepad.sThumbRX, state.Gamepad.sThumbRY);
}
int jstick::Connect(int hwid)
{
return hwid;
}
bool jstick::Disconnect(int hwid) {
return true;
}
bool jstick::Connected(int hwid) { return true; }
Vector2 jstick::GetRightThumbstickAxisNormalized(float deadzone, int hwid)
{
Vector2 axisL = jstick::GetLeftThumbstickAxis(deadzone, hwid);