Gamepad Improvements

* Cleanup: Alignment, long lines, Replace 0 with SDLK_UNKNOWN

* Gamecontroller api analogue input

* Added some button handling

* Added mapping for other buttons

* Added trigger events

* Added force_joystick flag

* Removed force_joystick flag

Rationale:
1. It was actually broken lol
2. I cannot think of a case where enabling this would be a useful thing for
gzdoom. If the user is using a gamecontroller, it is pointless. If they are
not using a gamecontroller, it will just default to using the joystick api.
If they are not using a gamecontroller, but SDL thinks they are, it is an
SDL bug, and will be reported and fixed

* Modified default mapping

* Added analogue to digital threshold

* Added analogue response curve

* Per axis settings

* Fixed controller reconnect

* Added threshold and curve to IJoystickConfig
Enabled saving of settings

* Added stubs

* Cleanup

Constants are no longer defines.
Constants are mostly shared between backends.
Moved some logic to m_joy

* Implemented xinput stubs

* Implemented dinput stubs

* Implemented ps2 stubs (untested)

* Fixed inclusive check

* Implemented osx stubs (untested)

* Fixed curve implementation

No longer savable, I screwed the curve function up.
I though it needed 2 control points, but it needs 4.
Need to re-do controller settings :(

* Now using CubicBezier struct

* Fixed SetDefaultConfig to match xinput behavior

* Expanded gamepad CCMD

* Rename enum JoyResponseCurve to EJoyCurve

* Initial menu implementation

* Fixed SDL controller setting saving

* SDL gamepads can now actually be disabled

* Fixed initial controller connect of some versions of SDL

* Spelling error

* Enable gamepad by default

* Fixed segfault on some versions of SDL

* Only block keydown
This commit is contained in:
Marcus Minhorst 2025-07-05 16:41:40 -04:00 committed by GitHub
commit 2a5cce543b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1613 additions and 215 deletions

View file

@ -84,6 +84,56 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisDeadZone)
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisDigitalThreshold)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_FLOAT(self->GetAxisDigitalThreshold(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisDigitalThreshold)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_FLOAT(dt);
self->SetAxisDigitalThreshold(axis, (float)dt);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisResponseCurve)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_INT(self->GetAxisResponseCurve(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisResponseCurve)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_INT(curve);
self->SetAxisResponseCurve(axis, (EJoyCurve)curve);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisResponseCurvePoint)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_INT(point);
ACTION_RETURN_INT(self->GetAxisResponseCurvePoint(axis, point));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisResponseCurvePoint)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_INT(point);
PARAM_FLOAT(value);
self->SetAxisResponseCurvePoint(axis, point, value);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisMap)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);