Skip to content

Controller Support - #295

Open
AL2009man wants to merge 279 commits into
GooberRF:masterfrom
AL2009man:POC-GyroGamepad
Open

AL2009man wants to merge 279 commits into
GooberRF:masterfrom
AL2009man:POC-GyroGamepad

Conversation

@AL2009man

@AL2009man AL2009man commented Mar 14, 2026 •

Copy link
Copy Markdown
Contributor

Disclaimer: this code was originally meant to be a [Claude AI POC], this needs heavy review and refactors (if needed) before a merge.

Note: This PR will be targeting Update 1.6.0


this PR adds what is essentially an input-related feature that is missing from the original PS2 release while adding a few enhancements. While it's not 1:1 with the PS2 (additional rumble effects, auto-aim), it's close enough.

(note: video below represents early development; it does not represent the final gamepad setup)

redfactionwithgamepad2.mp4

this leverages SDL3's Gamepad API inorder to implement Gamepad Inputs, not only it'll support Xbox controllers, it also supports PlayStation controllers, Nintendo Controllers and selected 8BitDo Controllers while being the foundation for advanced feature sets down in the line (such as Lightbar, DualSense's Adaptive Triggers, pressure-sensitive buttons, etc)

Controller features.

  • Analog Movements
    • When playing Multiplayer: the speed ramp is fixed.
  • Rumble support
    • most Weapon and Environmental rumbles are in, but some are missing at the moment
    • Trigger Rumble/Impulse Triggers are also supported.
  • experimental Lightbar support
  • (requires enabling via Input Settings under Advanced, joy_led cmd or alpine_settings.ini)
  • Dynamic Button prompt detection system
    • In-Game glyph HUD dynamically switches based on active input method
    • supports Xbox, PlayStation, Nintendo Switch and Steam Hardware (Steam Deck, Steam Controller, HoriPad for Steam)
  • Gamepad Rebinding
  • Gyro Aiming support
    • Real World Sensitivity / Natural Sensitivity Scale
    • Gyro Autocalibration
      • Off, Menu Only or Always
    • Gyro Axis Orientation (Gyro Space)
      • Yaw, Roll, Local Space, Player Space, World Space
    • Gyro Vertical / Horizontal Output Mixer
    • Gyro Modifier (aka Gyro Ratcheting)
  • Flick Stick support
  • Mixed Input support
    • HUD Input glyphs will not switch to KB/M glyphs when using Mouse Movements (as per recommendations from Valve)
    • Ability to lock either Gamepad or Keyboard/Mouse hud glyphs
  • Reset Camera action (also works for Keyboard/Mouse users!)
image image image image

portions of the code and file structure were referenced and inspired by yquake2, Perfect Dark PC Port (currently under draft pr as of this writing) was used as inspiration for glyph management system. Motion sensor's overall functionality is powered by GamepadMotionHelper header.

@AL2009man
AL2009man force-pushed the POC-GyroGamepad branch 2 times, most recently from 4411e50 to 3311ead Compare March 16, 2026 06:40
@AL2009man
AL2009man marked this pull request as ready for review March 16, 2026 22:02
@GooberRF

Copy link
Copy Markdown
Owner

portions of the code and structure were referenced from yquake2 and Perfect Dark PC (currently under pending pr as of this writing), while the Motion sensor's overall functionality is powered by GamepadMotionHelperheader.

@AL2009man can you confirm the license state of this code? This is an area in which we certainly need to be careful and ensure compliance. Potentially 4 different licenses are at play here based on 4 different sources, can you confirm the license for each?

@AL2009man

AL2009man commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor Author

portions of the code and structure were referenced from yquake2 and Perfect Dark PC (currently under pending pr as of this writing), while the Motion sensor's overall functionality is powered by GamepadMotionHelperheader.

@AL2009man can you confirm the license state of this code? This is an area in which we certainly need to be careful and ensure compliance. Potentially 4 different licenses are at play here based on 4 different sources, can you confirm the license for each?

Won't be able to check in detail but I'll give a quick summary. The Perfect Dark PC one is primarily used for the glyph portion although it isn't officially in the master branch and it's my own setup. I might reconsider redoing everything from scratch if it needs be.

the yquake2 one is only use as a sanity check on the gyro processing order and it's file structure (honestly easier to organize than my previous attempt back then, otherwise gamepad.cpp gets bloated), but I can't use the code directly.

GamepadMotionHelper however, is MIT License, while SDL is zlib license, yquake2 uses multiple license alongside GPL I think.

@AL2009man

Copy link
Copy Markdown
Contributor Author

portions of the code and structure were referenced from yquake2 and Perfect Dark PC (currently under pending pr as of this writing), while the Motion sensor's overall functionality is powered by GamepadMotionHelperheader.

@AL2009man can you confirm the license state of this code? This is an area in which we certainly need to be careful and ensure compliance. Potentially 4 different licenses are at play here based on 4 different sources, can you confirm the license for each?

Won't be able to check in detail but I'll give a quick summary. The Perfect Dark PC one is primarily used for the glyph portion although it isn't officially in the master branch and it's my own setup. I might reconsider redoing everything from scratch if it needs be.

the yquake2 one is only use as a sanity check on the gyro processing order and it's file structure (honestly easier to organize than my previous attempt back then, otherwise gamepad.cpp gets bloated), but I can't use the code directly.

GamepadMotionHelper however, is MIT License, while SDL is zlib license, yquake2 uses multiple license alongside GPL I think.

ok, I review the everything to ensure everything is compliant; everything should be A-OK!
the Gyro Smoothing and Gyro Tightening snippet will now redirect to both GyroWiki articles going fowrard, while a portion of Glyph system receive a revision/overhaul to lean far less into the reuse territory

@AL2009man
AL2009man force-pushed the POC-GyroGamepad branch 2 times, most recently from af2839a to b127bf3 Compare March 23, 2026 00:07
Upgraded Gyro Autocalibration system to introduce a "Menu"-Only system where it only autocalibrates while in the Menu. |

the actual Calibration behavior has been tweaked to handle edge-case while upgrading the original "Always" setup to a more hybrid setup with a semi-aggressive calibration set.
now it should function as intended, while fixing the in-game ui toggle (it wasn't properly applying)
you now have the option to control the camera with the power of Flick Stick...but is considered a experimental feature. (can be enable within .config file or `joy_flickstick` on the console command)
Aside from "Gyro Aiming" toggle, all Gyro settings will become hidden until the player toggles Gyro Aiming.
AL2009man and others added 3 commits November 7, 2026 23:59
now that Menu UI got a upgrade, leftover from the legacy menu ui will be gone
…ggle button

fixed gyro cursor scale to be more consistent with the rest of the cursor navs.

flick stick sweep ui scale should now match the intended cap of 6.0
and lastly: move the gyro cursor toggle to the Left Stick Stick.
AL2009man and others added 5 commits November 9, 2026 12:39
since we're moving to SVG Menu, we're going to remove Spray Picker stuffs out.
rework the way how Glyphs are now handled. it should serve as a foundation for VR Controller's glyph support
When a Alpine Setting pops-up, you don't need to use the cursor. you  can always use the scrollbar no problem.
now both rumbles operates independently from each other.
After discussion, Gamepad PR will be moved to 1.6.0, and this time: it will be locked in, for real.
same case with Gyro Cursor toggle, if you swap them: it'll be moved to the  Left Stick Click instead
AL2009man and others added 9 commits November 10, 2026 22:53
to prepare for SDL 3.6.0 and Alpine Faction 1.6.0, the Gamepad RawInput flag will now be removed.

the main reason is that SDL 3.6.0 will have full-on GameInput driver support built-in to SDL Gamepad suite, and GameInput 4.0 has partial x86 support, for Alpine Faction's case: this is important.

Going forward: Impulse Triggers (and other controller feature sets that GameInput supports) now requires Windows users to install/update GameInput distribution (it comes with your Windows Update, or `winget` it) inorder for Trigger Rumble intensity slider to be active
for some reason: using a jeep's turrets disables Gyro Camera. Now, it should work as intended
in-case if the player unknownly click the Stick Click (Left Stick Click by default), a pop-up notification will be shown on the top right.
this should allow you to use Big Map action on the Select/Back button while keeping with Skip Cutscene button
@GooberRF GooberRF added the AF1.6 Slated for inclusion in AF1.6 label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AF1.6 Slated for inclusion in AF1.6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants