Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9c723da
WIP: Initial parts of Steam Input API support
RobertCochran Jan 28, 2026
6859ab8
Remove leftover debug include
RobertCochran Jan 29, 2026
0a13193
Don't require both X and Y movement to consider it a controller move
RobertCochran Jan 29, 2026
d6d88e9
Move to using keymaps instead of directly calling doaction
RobertCochran Jan 29, 2026
57e5cbd
Make the handle and keymap_id public members
RobertCochran Jan 30, 2026
c82ecbe
Deduplicate function
RobertCochran Jan 30, 2026
af30273
Initial glyph implementation
RobertCochran Feb 3, 2026
bf5482d
Add menu action set, do cursor/camera actions 'the right way'
RobertCochran Feb 5, 2026
36f75cb
Add 'real' interface to reset player pitch
RobertCochran Feb 7, 2026
645f108
Accept input from all connected controllers
RobertCochran Feb 7, 2026
86e0406
Be prepared to initialize SIAPI handles after boot
RobertCochran Feb 7, 2026
7a1034c
Fix default state of some handles
RobertCochran Feb 8, 2026
db87ec2
Add 'open controller configurator' button to controls settings
RobertCochran Feb 8, 2026
993a7ef
Add actions for every individual weapon
RobertCochran Feb 8, 2026
6488141
Add editing mode action set
RobertCochran Feb 8, 2026
26619b9
Move handle init check to after controller count check
RobertCochran Feb 8, 2026
9b13b63
Add SIAPI action for 'last weapon'
RobertCochran Feb 8, 2026
32c6e9e
Add gameplay window style and use to sense in vs out of game menus
RobertCochran Feb 11, 2026
cff5332
Factor out common textkey fetch code and also use in SIAPI code
RobertCochran Feb 14, 2026
ffbbac3
Add multiple origins support for SIAPI actions
RobertCochran Feb 14, 2026
2e7aa7f
Add joystick-like mode for pie menu cursor
RobertCochran Feb 14, 2026
dcb8364
Kill tabs in files that already existed
RobertCochran Feb 14, 2026
5d08d26
Format more like the Romans do
RobertCochran Feb 14, 2026
f152889
Add game/controller.o to CLIENT_OBJS
RobertCochran Feb 14, 2026
5d3c690
Fix missed formatting adjustment
RobertCochran Feb 14, 2026
dcf7932
Better return value for dummy get_siapi_textkeys
RobertCochran Feb 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions bin/amd64/game_actions_967460.vdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
"In Game Actions"
{
"actions"
{
"InGameControls"
{
"title" "#Set_Ingame"
"StickPadGyro"
{
"move"
{
"title" "#Action_Move"
"input_mode" "joystick_move"
}
"camera"
{
"title" "#Action_Camera"
"input_mode" "absolute_mouse"
}
"pie_cursor"
{
"title" "#Action_PieCursor"
"input_mode" "joystick_move"
}
}
"Button"
{
"primary" "#Action_Primary"
"secondary" "#Action_Secondary"
"reload" "#Action_Reload"
"use" "#Action_Use"
"jump" "#Action_Jump"
"walk" "#Action_Walk"
"crouch" "#Action_Crouch"
"special" "#Action_Special"
"drop" "#Action_Drop"
"affinity" "#Action_Affinity"
"dash" "#Action_Dash"

"next_weapon" "#Action_NextWeapon"
"previous_weapon" "#Action_PreviousWeapon"
"primary_weapon" "#Action_PrimaryWeapon"
"secondary_weapon" "#Action_SecondaryWeapon"
"last_weapon" "#Action_LastWeapon"
"claw" "#Action_Claw"
"pistol" "#Action_Pistol"
"sword" "#Action_Sword"
"shotgun" "#Action_Shotgun"
"smg" "#Action_SMG"
"flamer" "#Action_Flamer"
"plasma" "#Action_Plasma"
"zapper" "#Action_Zapper"
"rifle" "#Action_Rifle"
"corroder" "#Action_Corroder"
"grenade" "#Action_Grenade"
"mine" "#Action_Mine"
"rocket" "#Action_Rocket"
"minigun" "#Action_Minigun"
"jetsaw" "#Action_Jetsaw"
"melee" "#Action_Melee"
"wheel_select" "#Action_WheelSelect"
"change_loadout" "#Action_ChangeLoadout"

"scoreboard" "#Action_Scoreboard"
"suicide" "#Action_Suicide"
"menu" "#Action_Menu"

"recenter_camera" "#Action_RecenterCamera"

}
}
"MenuControls"
{
"title" "#Set_Menu"
"StickPadGyro"
{
"menu_cursor"
{
"title" "#Menu_Cursor"
"input_mode" "absolute_mouse"
}
}
"AnalogTrigger"
{
}
"Button"
{
"menu_select" "#Menu_Select"
"menu_cancel" "#Menu_Cancel"
"menu_scroll_up" "#Menu_ScrollUp"
"menu_scroll_down" "#Menu_ScrollDown"
}
}
"EditingControls"
{
"title" "#Set_Editing"
"StickPadGyro"
{
}
"AnalogTrigger"
{
}
"Button"
{
}
}
}
"localization"
{
"english"
{
"Set_Ingame" "In-Game Controls"

"Action_Move" "Move"
"Action_Camera" "Camera"
"Action_PieCursor" "Pie Cursor"
"Action_Primary" "Primary Fire"
"Action_Secondary" "Secondary Fire"
"Action_Reload" "Reload"
"Action_Use" "Use/Pick Up"
"Action_Jump" "Jump"
"Action_Walk" "Walk"
"Action_Crouch" "Crouch"
"Action_Special" "Special"
"Action_Drop" "Drop Weapon"
"Action_Affinity" "Drop Affinity"
"Action_Dash" "Dash"
"Action_NextWeapon" "Next Weapon"
"Action_PreviousWeapon" "Previous Weapon"
"Action_PrimaryWeapon" "Primary Weapon"
"Action_SecondaryWeapon" "Secondary Weapon"
"Action_LastWeapon" "Last Weapon"
"Action_Claw" "Claw Attack"
"Action_Pistol" "Sidearm Pistol"
"Action_Sword" "Energy Sword"
"Action_Shotgun" "Super Shotgun"
"Action_SMG" "Submachine Gun"
"Action_Flamer" "Flame Thrower"
"Action_Plasma" "Plasma Inductor"
"Action_Zapper" "Electro Zapper"
"Action_Rifle" "Laser Rifle"
"Action_Corroder" "Corrosion Cannon"
"Action_Grenade" "Frag Grenade"
"Action_Mine" "Shock Mine"
"Action_Rocket" "Rocket Launcher"
"Action_Minigun" "Heavy Minigun"
"Action_Jetsaw" "Jet Chainsaw"
"Action_Melee" "Eclipse Rod"
"Action_WheelSelect" "Wheel Select"
"Action_ChangeLoadout" "Change Loadout"
"Action_Scoreboard" "Scoreboard"
"Action_Suicide" "Suicide"
"Action_Menu" "Menu"

"Action_RecenterCamera" "Recenter Camera"

"Set_Menu" "Menu Controls"
"Menu_Cursor" "Move Cursor"
"Menu_Select" "Select"
"Menu_Cancel" "Cancel/Return"
"Menu_ScrollUp" "Scroll Up"
"Menu_ScrollDown" "Scroll Down"

"Set_Editing" "Editing Mode Controls"
}
}
}
39 changes: 39 additions & 0 deletions config/keymap.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,45 @@ keymap -13 MOUSE13
keymap -14 MOUSE14
keymap -15 MOUSE15
keymap -16 MOUSE16
// Steam Input API controller actions
keymap -20 SIAPI_PRIMARY
keymap -21 SIAPI_SECONDARY
keymap -22 SIAPI_RELOAD
keymap -23 SIAPI_USE
keymap -24 SIAPI_JUMP
keymap -25 SIAPI_WALK
keymap -26 SIAPI_CROUCH
keymap -27 SIAPI_SPECIAL
keymap -28 SIAPI_DROP
keymap -29 SIAPI_AFFINITY
keymap -30 SIAPI_DASH
keymap -31 SIAPI_NEXT_WEAPON
keymap -32 SIAPI_PREVIOUS_WEAPON
keymap -33 SIAPI_PRIMARY_WEAPON
keymap -34 SIAPI_SECONDARY_WEAPON
keymap -35 SIAPI_LAST_WEAPON
keymap -36 SIAPI_WHEEL_SELECT
keymap -37 SIAPI_CHANGE_LOADOUT
keymap -38 SIAPI_SCOREBOARD
keymap -39 SIAPI_SUICIDE
keymap -40 SIAPI_MENU
keymap -41 SIAPI_CLAW
keymap -42 SIAPI_PISTOL
keymap -43 SIAPI_SWORD
keymap -44 SIAPI_SHOTGUN
keymap -45 SIAPI_SMG
keymap -46 SIAPI_FLAMER
keymap -47 SIAPI_PLASMA
keymap -48 SIAPI_ZAPPER
keymap -49 SIAPI_RIFLE
keymap -50 SIAPI_CORRODER
keymap -51 SIAPI_GRENADE
keymap -52 SIAPI_MINE
keymap -53 SIAPI_ROCKET
keymap -54 SIAPI_MINIGUN
keymap -55 SIAPI_JETSAW
keymap -56 SIAPI_MELEE

keymap 8 BACKSPACE
keymap 9 TAB
keymap 13 RETURN
Expand Down
43 changes: 43 additions & 0 deletions config/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,49 @@ bind K [ suicide ]

bind TAB [ showscores ]

// Steam Input controller binds; these actions _should not be rebound_ - do it
// through the Steam Input configuration interface
bind SIAPI_PRIMARY [ primary ]
specbind SIAPI_PRIMARY [ spectate 0 ]
bind SIAPI_SECONDARY [ secondary ]
specbind SIAPI_SECONDARY [ spectate 0 ]
bind SIAPI_WHEEL_SELECT [ game_hud_piemenu_open_weapsel_key ]
bind SIAPI_NEXT_WEAPON [ universaldelta 1 ]
bind SIAPI_PREVIOUS_WEAPON [ universaldelta -1 ]
bind SIAPI_PRIMARY_WEAPON [ weapon (weapload 0) 1 ]
bind SIAPI_SECONDARY_WEAPON [ weapon (weapload 1) 1 ]
bind SIAPI_LAST_WEAPON [ weapon (weapprev) 1 ]
bind SIAPI_MENU [ uitoggle ]
bind SIAPI_JUMP [ jump ]
specbind SIAPI_JUMP [ specmodeswitch ]
bind SIAPI_SPECIAL [ special ]
bind SIAPI_CROUCH [ crouch ]
bind SIAPI_USE [ use ]
specbind SIAPI_USE [ spectate 0 ]
bind SIAPI_RELOAD [ reload ]
specbind SIAPI_RELOAD [ specmodeswitch ]
bind SIAPI_DROP [ drop ]
bind SIAPI_AFFINITY [ affinity ]
bind SIAPI_SCOREBOARD [ showscores ]
bind SIAPI_CHANGE_LOADOUT [ gameui_player_show_loadout ]
bind SIAPI_SUICIDE [ suicide ]
bind SIAPI_CLAW [ weapon 0 1]
bind SIAPI_PISTOL [ weapon 1 1]
bind SIAPI_SWORD [ weapon 2 1]
bind SIAPI_SHOTGUN [ weapon 3 1]
bind SIAPI_SMG [ weapon 4 1]
bind SIAPI_FLAMER [ weapon 5 1]
bind SIAPI_PLASMA [ weapon 6 1]
bind SIAPI_ZAPPER [ weapon 7 1]
bind SIAPI_RIFLE [ weapon 8 1]
bind SIAPI_CORRODER [ weapon 9 1]
bind SIAPI_GRENADE [ weapon 10 1]
bind SIAPI_MINE [ weapon 11 1]
bind SIAPI_ROCKET [ weapon 12 1]
bind SIAPI_MINIGUN [ weapon 13 1]
bind SIAPI_JETSAW [ weapon 14 1]
bind SIAPI_MELEE [ weapon 15 1]

Comment on lines 134 to 176
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bind the SIAPI actions. You are not supposed to rebind these actions in-engine; you are intended to use the Steam Input configurator tool and change things there.

saytextcolour = 0; setpersist saytextcolour 1; setcomplete saytextcolour 1
getsaycolour = [
sc = $saytextcolour
Expand Down
1 change: 1 addition & 0 deletions config/ui/game/hud/pie.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ ui_game_hud_piemenu = [
]

newui "hud_piemenu" $SURFACE_FOREGROUND [
uiwinstyle $WINSTYLE_PIE
uiallowinput 1

ui_game_hud_piemenu
Expand Down
29 changes: 29 additions & 0 deletions config/ui/game/settings.cfg
Copy link
Author

@RobertCochran RobertCochran Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settings menu item for glyph prompts. 'Automatic' is probably what most people want (dynamically changes glyphs based on last input), but - as is considered good practice - there are options to explicitly lock glyphs if needed. Because Steam Input handles different hardware types for us, the only glyph distinction we need make is KB/M vs controller. This is technically an interface thing, but I feel like it makes more sense to have it together with the controls options.

KNOWN ISSUE 1: The box for this is weirdly not as wide as the other boxes in the menu. I probably copied a setting I didn't intend.
KNOWN ISSUE 2: This box needs to be hidden for non-Steam builds since it will be connected to a variable that will do nothing without SIAPI support.

It may not be worth fiddling with this much because I still need to add a button to open up the controller configurator interface provided by Steam.

Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,35 @@ ui_gameui_settings_controls_dims = 0.72
]
]

uivlist 0.025 [
ui_gameui_group [
uistyle clampx

uigrid 2 0.05 0 [
uistyle clampx

uicolourtext "Type" 0xaaaaaa
ui_gameui_switch textkeyimagepreference [
p_options = [
"Automatic"
"Always Keyboard/Mouse"
"Always Controller"
"Both"
]
p_tip = "Which device icons to show in text"
p_id = #(gameui_get_id switch)
]
]
] [
p_label = "Input Icons"
]
ui_gameui_button [
p_label = "Open Controller Configurator"
p_on_click = [ showsiapibindpanel ]
p_id = #(gameui_get_id button)
]
]

ui_gameui_vscrollarea [
uiborderedimageclamped $skintex 0x44010101 0 $ui_texborder $ui_screenborder 0.56 0.5 [
uivlist 0 [
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ CLIENT_OBJS = \
game/scoreboard.o \
game/server.o \
game/waypoint.o \
game/weapons.o
game/weapons.o \
game/controller.o

# Build tests
ifneq (,$(findstring -D_DEBUG,$(CXXFLAGS)))
Expand Down
4 changes: 4 additions & 0 deletions src/engine/cdpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace cdpi
ISteamUserStats *stats = NULL;
ISteamClient *client = NULL, *sclient = NULL;
ISteamGameServer *serv = NULL;
ISteamInput *input = NULL;
HSteamPipe umpipe = 0, smpipe = 0;
HSteamUser uupipe = 0, supipe = 0;
HAuthTicket authticket = k_HAuthTicketInvalid;
Expand Down Expand Up @@ -184,6 +185,9 @@ namespace cdpi
if(!friends) { conoutf(colourred, "Failed to get Steam friends interface."); cleanup(SWCLIENT); return true; }
stats = (ISteamUserStats *)SteamAPI_ISteamClient_GetISteamUserStats(client, uupipe, umpipe, STEAMUSERSTATS_INTERFACE_VERSION);
if(!stats) { conoutf(colourred, "Failed to get Steam stats interface."); cleanup(SWCLIENT); return true; }
input = (ISteamInput *)SteamAPI_ISteamClient_GetISteamInput(client, uupipe, umpipe, STEAMINPUT_INTERFACE_VERSION);
if (!input) { conoutf(colourred, "Failed to get Steam Input interface."); cleanup(SWCLIENT); return true; }
input->Init(false);

const char *name = SteamAPI_ISteamFriends_GetPersonaName(friends);
if(name && *name)
Expand Down
6 changes: 6 additions & 0 deletions src/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "version.h"
#include "cube.h"
#if defined(USE_STEAM)
#include "steam_api_flat.h"
#endif

#define LOG_FILE "log.txt"

Expand Down Expand Up @@ -49,6 +52,9 @@ namespace cdpi
namespace steam
{
extern char *steamusername, *steamuserid, *steamserverid;
#if defined(USE_STEAM)
extern ISteamInput *input;
#endif

extern bool clientready();
extern bool clientauthticket(char *token, uint *tokenlen, ENetAddress *addr = NULL);
Expand Down
Loading