Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ method, scope and caveats. No game data is included.
| [directstorage.md](directstorage.md) | Console DirectStorage: the DLL and ABI the title is expected to use (`DStorageGetFactory`, `dstorage_xs`, `XCRDAPI`), how sure that is and the evidence for it, and what `runtime/shims/dstorage.cpp` serves on the PC. The executable's own imports are unmeasured. |
| [cpu_features.md](cpu_features.md) | CPU instructions in the executable a desktop CPU may lack (`tools/cpu_feature_scan.py`): 19 SSE4a, 10 CLZERO and 4 MONITORX/MWAITX sites (AMD only) and 8 CLWB sites (Intel since Ice Lake), all real code; `#UD` on hosts without them. |
| [xcl_compare.md](xcl_compare.md) | XCL's synthetic test title under `gta6rt --run` and under XCL (`tools/xcl_compare.py`): 5 of 50 checks pass here, both hangs are the documented manual-queue terminate deadlock, and each other difference mapped to an open item or a lead. |
| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; 261 checks on virtual joysticks and a fake haptic backend; by hand on an Xbox Series X pad (Bluetooth) and a DualSense (USB). 261 checks on virtual joysticks and a fake haptic backend, not yet tried on a real pad. |
| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; without SDL3, one scripted pad for `LEONIDA_INPUT_SCRIPT`; 261 checks on virtual joysticks and a fake haptic backend; by hand on an Xbox Series X pad (Bluetooth) and a DualSense (USB). 261 checks on virtual joysticks and a fake haptic backend, not yet tried on a real pad. |
| [saves.md](saves.md) | Save containers: `JSAV` (index + JSON story save, byte-exact rebuild), `ASAV` header, `SLAYER1` packed copy (not decoded); `tools/saves.py` and import into the offline `XGameSave` folder; key hashes are case-sensitive joaat (`tools/save_keys.py`). |
| [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: the full corpus, 26,503 of 26,503 modules and pipelines, 0 failures (RTX 4060 Ti); an earlier 10/12-shard run, 22,092 modules and 2,217 compute pipelines, also had 0 failures. Driver-level corpus check: 10/12 shards, 22,092 modules, 2,217 compute pipelines, 0 failures. |
| [multi_gpu_validation.md](multi_gpu_validation.md) | Running disjoint shards on eight identical RDNA1/RADV GPUs: PCI-BDF pinning, base controls, per-card logs, the V540 farm's aggregate results and its known driver limitations. |
Expand Down
50 changes: 45 additions & 5 deletions docs/gameinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,42 @@ SDL3 is available in one of these ways:
- **A local copy of that tarball**: extract it and pass `-DFETCHCONTENT_SOURCE_DIR_SDL3=<path to SDL3-3.4.20>`; it is
built the same way, without a download.

Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the shim:
it has no `GameInputCreate`, as before, so the loader binds it to the host's `GameInput.dll` or the unimplemented
thunk. `gameinput_test` and `gameinput_probe` are not built, and CTest lists `gameinput` as not run (disabled) rather
than failing.
Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the SDL3
shim. It links `runtime/shims/gameinput_no_sdl.cpp` instead, which still serves `GameInputCreate` (by name and as
`gameinput.dll!#1`): with no devices, or with `LEONIDA_INPUT_SCRIPT` set with one scripted pad (see
[Scripted input without SDL3](#scripted-input-without-sdl3)). `gameinput_test` and `gameinput_probe` are not built,
and CTest lists `gameinput` and `gameinput_script` as not run (disabled) rather than failing; `gameinput_no_sdl` and
`gameinput_no_sdl_script` run instead.

### Scripted input without SDL3

The Windows artifacts of CI and offline builds have no SDL3. Without a device, the title waits at its first "press A"
prompt forever, so no headless or CI run could get past it. With `LEONIDA_INPUT_SCRIPT` set, such a build serves one
scripted pad, driven by the script alone:

- **The device:** an Xbox One gamepad named `Scripted pad (Leonida)`, connected from the first `GameInputCreate`. It
is reported by `RegisterDeviceCallback` enumeration (blocking on the caller's thread, async from a thread of the
shim, or through `IGameInputDispatcher::Dispatch` once the title made a dispatcher) and found by `FindDeviceFromId`.
It is already connected, so a callback registered without enumeration hears nothing.
- **The readings:** `GetCurrentReading`, `GetNextReading` and `GetPreviousReading`, with gamepad, UI navigation,
controller axis and controller button state. A reading is taken when the title asks for one and the script's state
has changed since the last, so no thread polls; the history keeps the last 64 readings.
- **The timeline:** the same as with SDL3 (`runtime/shims/gameinput_script.h` holds the parser, the timeline and the
log lines for both): seconds from the first `GameInputCreate`, each press held 300 ms, then released.
- **Not served:** reading callbacks, aggregate devices, rumble and every other device. Those slots answer `E_NOTIMPL`
and log the slot once. Controllers and the [keyboard pad](#keyboard-pad) still need SDL3.

The start of the run logs one line with the counts, and each press logs the same lines as with SDL3:

```text
[rt] gameinput: served without SDL3: one scripted pad for LEONIDA_INPUT_SCRIPT (3 scripted press(es), 0 rejected); controllers and the keyboard pad need SDL3
[rt] gameinput: scripted press of button 0 at 40.0 s
[rt] gameinput: press a@40.0 (Scripted pad (Leonida))
```

A press is logged when the title reads it, so a press the title never reads is not logged. `LEONIDA_INPUT_LOG=0`
turns the `press` lines off. Without `LEONIDA_INPUT_SCRIPT`, the shim serves no devices and answers `E_NOTIMPL` for
every slot past `Release`, as before.

`scripts/build_runtime.ps1` (what `make_game.py` runs) builds the shim only on its CMake path, when Visual Studio's
C++ CMake tools are installed. Its direct-`cl.exe` fallback compiles a fixed file list without the shim and warns
Expand Down Expand Up @@ -302,7 +334,7 @@ line is logged when it takes effect); tracking goes on underneath, so clearing i
| `LEONIDA_PROMPTS_SWITCH_MS` | `300` | shortest time between two changes of the active input family, 0..2000 ms |
| `LEONIDA_GAMEINPUT_THREAD` | `1` | `0` stops the background poll thread; only `rt::gameinput::poll()` then reads the pads (tests) |
| `LEONIDA_KEYBOARD_PAD` | `off` | `1` adds the [keyboard pad](#keyboard-pad), read while this process has focus; `always` reads keys whatever has focus |
| `LEONIDA_INPUT_SCRIPT` | unset | With the keyboard pad enabled, set comma-separated `button@seconds` entries, e.g. `a@2,a@4,start@6`. The first pad update reads the script once at startup and starts the clock. `reload_config()` does not reread it. Each press lasts 300 ms. Buttons are `a b x y start back lb rb up down left right`. Spaces around entries are allowed. Empty entries, unknown buttons and invalid times (including negative or non-finite values) are counted and ignored. |
| `LEONIDA_INPUT_SCRIPT` | unset | Comma-separated `button@seconds` entries, e.g. `a@2,a@4,start@6`. With SDL3 they drive the keyboard pad, which has to be enabled; without SDL3 they drive [one scripted pad](#scripted-input-without-sdl3), the only device. The first pad update (without SDL3, the first `GameInputCreate`) reads the script once at startup and starts the clock. `reload_config()` does not reread it. Each press lasts 300 ms. Buttons are `a b x y start back lb rb up down left right`. Spaces around entries are allowed. Empty entries, unknown buttons and invalid times (including negative or non-finite values) are counted and ignored. |
| `LEONIDA_MOUSE_SENSITIVITY` | `1` | scales how far the mouse moves the keyboard pad's right stick, 0.1..10 |

SDL's own hints (`SDL_JOYSTICK_*`, see SDL's `SDL_hints.h`) also apply, for example `SDL_JOYSTICK_HIDAPI_PS5=0` to
Expand Down Expand Up @@ -457,6 +489,14 @@ rests on a transcription rather than on a side-by-side compile.
button, the touchpad, a trigger or a stick, stick drift and a one-count mouse jitter ignored, a real mouse movement
counted, the 300 ms window on the real clock, and `LEONIDA_PROMPTS` forcing, changing, ignoring an unknown value
and clearing.
- `gameinput_no_sdl_test` (CTest, only in a build without SDL3, no controller): `gameinput_no_sdl` checks the
identity-only object (both names served, `AddRef`/`Release`, `E_NOTIMPL` without touching the out-parameter).
`gameinput_no_sdl_script` sets `LEONIDA_INPUT_SCRIPT` with overlapping presses, a mixed-case name, `rsup` and three
rejected entries, puts the shim on a fake clock and checks the scripted pad: blocking, async and dispatcher
enumeration (and none without enumeration, for another status or another kind), the device info, `FindDeviceFromId`,
the buttons, UI navigation and right stick read at chosen times (held for 0.3 s, a later press of the same button
not cut short, nothing after the script), no new reading without a change, `GetPreviousReading` and
`GetNextReading`, no motion, and reading callbacks answering `E_NOTIMPL`.
- `gameinput_test` (CTest, no controller): turns SDL's real backends off and drives the shim through
`rt::shims::find` with SDL virtual joysticks, an Xbox-style pad with trigger motors, a DualSense (Sony
`054c:0ce6`) and a pad without trigger motors. It checks enumeration and device callbacks, the button, stick,
Expand Down
9 changes: 6 additions & 3 deletions docs/linux_proton.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ the layout the comments at their top describe (`/opt/leonida` for traces, overla
`__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1`.
- **Input:** a pad through GameInput/SDL3, or the keyboard pad (`LEONIDA_KEYBOARD_PAD=always`), or a script:
`LEONIDA_INPUT_SCRIPT=a@210,a@240` presses A at those seconds (any length since this branch; it was cut at 63
characters before).
characters before). The script also works in a build without SDL3, where it drives one scripted pad
([docs/gameinput.md](gameinput.md#scripted-input-without-sdl3)); pads and the keyboard pad need SDL3.
- **Window:** frames are presented in the title's own window; `LEONIDA_PRESENT_WINDOW=own|hidden` chooses otherwise.

Three setup mistakes each give a blank or empty picture without an error: the executable's embedded shaders missing
from the library (`exe/index.json`), a build without SDL3 (no pad), and a BCPack predictor file that was never
generated (`tools/build_dstorage_history.py`; without it the loading art and most BC7 textures stay empty).
from the library (`exe/index.json`), a build without SDL3 and without `LEONIDA_INPUT_SCRIPT` (no pad, so nothing
gets past the first prompt; set a script, or build with SDL3 for a pad or the keyboard pad), and a BCPack predictor
file that was never generated (`tools/build_dstorage_history.py`; without it the loading art and most BC7 textures
stay empty).

## What a healthy boot looks like (Linux machine)

Expand Down
5 changes: 4 additions & 1 deletion runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME)
endif()
if(NOT (LEONIDA_SDL3 AND TARGET SDL3::SDL3-static))
# Nothing served gameinput.dll in a build without SDL3, so the loader fell through to the host's gameinput.dll and
# that one answers GameInputCreate with a null interface the title dereferences. Keep the object identity honest.
# that one answers GameInputCreate with a null interface the title dereferences. Keep the object identity honest,
# and with LEONIDA_INPUT_SCRIPT serve one pad driven by the script (shims/gameinput_script.h, shared with SDL3's).
target_sources(gta6rt PRIVATE shims/gameinput_no_sdl.cpp)
add_executable(gameinput_no_sdl_test
test/gameinput_no_sdl_test.cpp
Expand Down Expand Up @@ -1657,6 +1658,8 @@ if(BUILD_TESTING)
add_test(NAME active_input COMMAND active_input_test)
if(WIN32 AND TARGET gameinput_no_sdl_test)
add_test(NAME gameinput_no_sdl COMMAND gameinput_no_sdl_test)
# LEONIDA_INPUT_SCRIPT without SDL3: the scripted pad, its device callbacks and its readings on a fake clock.
add_test(NAME gameinput_no_sdl_script COMMAND gameinput_no_sdl_test --input-script)
endif()
if(WIN32 AND TARGET gameinput_test)
add_test(NAME gameinput COMMAND gameinput_test)
Expand Down
8 changes: 7 additions & 1 deletion runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ Current limits, by design:
lightbar. Optional and CMake-only: built when an installed SDL3 is found,
or with `-DLEONIDA_SDL3_FETCH=ON` to download the pinned release; nothing is downloaded otherwise, and the
`scripts/build_runtime.ps1` cl.exe fallback never builds it. See [docs/gameinput.md](../docs/gameinput.md) for the mapping, the `LEONIDA_DS_*` settings and what is
unverified.
unverified. A build without SDL3 links `shims/gameinput_no_sdl.cpp` instead: no devices, or with
`LEONIDA_INPUT_SCRIPT` set one scripted pad driven by the script alone, so a headless or CI build can get past the
title's first prompt ([docs/gameinput.md](../docs/gameinput.md#scripted-input-without-sdl3)).

### What `xgameruntime.dll` reports: environment overrides

Expand Down Expand Up @@ -340,6 +342,7 @@ ones marked *diagnostic* only add log lines or exist to compare a run with and w
| `LEONIDA_VOLUME_MIPS` | on | The XG layout of a 3D texture with mips or a block format is computed (`shims/xg_xs_layout.h`). `0` refuses it. |
| `LEONIDA_TITLE_WATCHDOG` | unset (armed) | The title's own hang watchdog stays armed by default, as on the console: if the game's main loop does not report for 30 seconds, the title ends itself. `0` makes `gta6rt --run` keep it from firing while the game thread waits for the driver, for example on the first boot after a driver update (`src/main.cpp`), and only in the build the watchdog was measured in. |
| `LEONIDA_PEEK_SECONDS` | `10` | *Diagnostic.* The period of the `LEONIDA_PEEK` thread (`src/main.cpp`), which prints 8-byte values of the title's image. |
| `LEONIDA_INPUT_SCRIPT` | unset | Timed pad presses, `button@seconds` separated by commas (`a@70,a@85,start@120`), each held 300 ms; the clock starts with the shim. Works with and without SDL3: with SDL3 it drives the keyboard pad (`LEONIDA_KEYBOARD_PAD=always`), without SDL3 one scripted pad that is the only device. Controllers and the keyboard pad still need SDL3. Format and buttons in [docs/gameinput.md](../docs/gameinput.md#environment-variables). |
| `LEONIDA_INPUT_LOG` | on | The GameInput shim logs every press in `LEONIDA_INPUT_SCRIPT`'s form (`name@seconds`), so a session played by hand can be replayed. `0` turns the lines off. |
| `LEONIDA_LOG_ALLOCINFO` | unset | *Diagnostic.* `1` logs every device slot 25 call (`GetResourceAllocationInfo`) with its thread, description and sizes (`shims/d3d12_xs_device.cpp`). |
| `LEONIDA_LOG_EXE_PIPELINES` | unset | *Diagnostic.* When set, one line per distinct graphics pipeline that uses a program translated from the executable's inline containers. |
Expand Down Expand Up @@ -454,6 +457,9 @@ SDK, or `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` to download the pinned Khronos Vulka

`gameinput_test` (only with SDL3; otherwise CTest lists `gameinput` as not run) drives the GameInput shim on SDL virtual joysticks (no controller needed): enumeration, readings
and the button/axis mapping, rumble and trigger rumble, DualSense effect bytes, a dispatcher, and hot-plug.
`gameinput_no_sdl_test` (only without SDL3) checks the shim a build without SDL3 links: `gameinput_no_sdl` the
identity-only object, `gameinput_no_sdl_script` the scripted pad of `LEONIDA_INPUT_SCRIPT` on a fake clock (device
callbacks, readings at chosen times, the reading history).
`gameinput_probe [--seconds N] [--rumble] [--force-feedback]` is the manual check on a real pad: it prints live
readings, plays each motor and trigger, and holds a constant force on a pad that reports a force-feedback motor.

Expand Down
Loading
Loading