diff options
| author | kawaii-shakal <deusex1998@gmail.com> | 2026-11-25 08:31:50 +0500 |
|---|---|---|
| committer | kawaii-shakal <deusex1998@gmail.com> | 2026-11-25 08:31:50 +0500 |
| commit | d4d969a1fdc4bf8026017ab52d0a5d03c7737be6 (patch) | |
| tree | 68c4c8b47997166ee446b368bb60f8ce72ff5005 /runtime/shims/gameinput.cpp | |
| parent | 0bc810504aa44ba7e30f3c3352ebad697b9814d6 (diff) | |
make_game, gameinput: controller, keyboard and mouse input out of the box (INPUT-OUT-OF-THE-BOX)
A build made with make_game.py on Windows had no input at all. The runtime
stage ran scripts/build_runtime.ps1 without -FetchSdl3, so on a machine without
an installed SDL3 the GameInput shim was not built. gta6rt then logged "served
without SDL3 (no devices)", and a connected DualSense or Xbox pad did nothing.
- make_game.py: the Windows runtime stage passes -FetchSdl3 (the pinned SDL3
3.4.20, SHA-256 checked by CMake). --no-sdl3 leaves the download out. The
docstring's "what it downloads" sentence names it.
- gameinput: LEONIDA_KEYBOARD_PAD defaults to the focused mode, so a player
without a pad still has the keyboard and mouse. Keys count only while the
game window has focus. "off" or "0" removes the pad.
- gameinput_test: the other cases set LEONIDA_KEYBOARD_PAD=off, as they count
only their own virtual pads. The keyboard pad case checks the new default.
- docs/gameinput.md: default and make_game behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/gameinput.cpp')
| -rw-r--r-- | runtime/shims/gameinput.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/shims/gameinput.cpp b/runtime/shims/gameinput.cpp index db685e71f..5e9674380 100644 --- a/runtime/shims/gameinput.cpp +++ b/runtime/shims/gameinput.cpp | |||
| @@ -172,12 +172,15 @@ rt::gameinput::Config read_config() { | |||
| 172 | } | 172 | } |
| 173 | if (env("LEONIDA_RUMBLE") == "0") c.rumble = false; | 173 | if (env("LEONIDA_RUMBLE") == "0") c.rumble = false; |
| 174 | if (env("LEONIDA_GAMEINPUT_THREAD") == "0") c.background_thread = false; | 174 | if (env("LEONIDA_GAMEINPUT_THREAD") == "0") c.background_thread = false; |
| 175 | // On by default in the focused mode: the title reads gamepads only, so without it a player with no pad has no | ||
| 176 | // input at all. Keys and the mouse count only while this process's window has focus (docs/gameinput.md). | ||
| 175 | const std::string k = env("LEONIDA_KEYBOARD_PAD"); | 177 | const std::string k = env("LEONIDA_KEYBOARD_PAD"); |
| 176 | if (k == "1" || k == "on" || k == "focus") c.keyboard_pad = rt::gameinput::KeyboardPadMode::Focused; | 178 | if (k.empty() || k == "1" || k == "on" || k == "focus") c.keyboard_pad = rt::gameinput::KeyboardPadMode::Focused; |
| 177 | else if (k == "always") c.keyboard_pad = rt::gameinput::KeyboardPadMode::Always; | 179 | else if (k == "always") c.keyboard_pad = rt::gameinput::KeyboardPadMode::Always; |
| 178 | else if (!k.empty() && k != "0" && k != "off") | 180 | else if (k == "0" || k == "off") c.keyboard_pad = rt::gameinput::KeyboardPadMode::Off; |
| 179 | std::fprintf(stderr, "[rt] gameinput: LEONIDA_KEYBOARD_PAD=%s unknown (1, always or off), keyboard pad off\n", | 181 | else |
| 180 | k.c_str()); | 182 | std::fprintf(stderr, "[rt] gameinput: LEONIDA_KEYBOARD_PAD=%s unknown (1, focus, always or off), keyboard pad " |
| 183 | "off\n", k.c_str()); | ||
| 181 | using leonida::InputFamily; | 184 | using leonida::InputFamily; |
| 182 | const std::string p = env("LEONIDA_PROMPTS"); | 185 | const std::string p = env("LEONIDA_PROMPTS"); |
| 183 | if (p == "xbox") c.prompts = InputFamily::Xbox; | 186 | if (p == "xbox") c.prompts = InputFamily::Xbox; |