Skip to content

gta6rt: a following option is a missing value, not the value (EGEN-GTA6RT-VALUE-OPTION) - #8803

Closed
Vonsek wants to merge 1 commit into
ProjectLeonida:mainfrom
Vonsek:deepseek/9-gta6rt-value-option
Closed

Vonsek wants to merge 1 commit into
ProjectLeonida:mainfrom
Vonsek:deepseek/9-gta6rt-value-option

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: EGEN-GTA6RT-VALUE-OPTION (claim)

What and why

--trace, --game-dir, --overlay and --mods take a path. The parser only checked that some argument followed, so the
next option became the value: gta6rt --dry-run image.exe --trace --trace-d3d12 wrote the startup trace into a file
literally named --trace-d3d12, left the D3D12 trace off, and exited 0. A mistyped command line read as a clean run with
the trace missing, which is the opposite of what a first-boot triage of the executable needs.

A value that starts with -- (and a value missing at the end of the line) is now usage: gta6rt and exit 2, before
anything is mapped. The same option with a real path is unchanged.

Tested

Windows 11, MSVC 2022 RelWithDebInfo, cmake -S runtime -B <build> then cmake --build <build> --target gta6rt, base
867d922f0; no GPU, no game copy (the new check stops at the usage error, before the image is opened).

  • New gta6rt_option_values ctest (runtime/test/check_option_value.cmake), same binary path before and after:
    • before: --trace --trace-d3d12, --game-dir --trace, --overlay --mods and --mods --overlay each returned 1 after
      trying to map the stand-in image, and a file named --trace-d3d12 appeared — the test is red.
    • after: all four return 2 with usage: gta6rt, --trace FILE still creates that file and the run goes on to the
      image (exit 1), and no file named --trace-d3d12 is written — the test is green.
  • Manual, same commands: gta6rt --dry-run <image> --trace --trace-d3d12 now prints the usage and exits 2 (was exit 0
    with the trace off).
  • ctest -R "gta6rt_option_values|gta6rt_rejects|run_tiny_game|run_startup_cmdline|startup_trace|run_tiny_atexit|run_tiny_async|run_tiny_gdk_load|run_tiny_bundled_load|run_argv_modes"
    on that build: 21/21 pass.

Next stop: this moves the command line, not the boot, so the first remaining stop of --run is unchanged (the retail
chain in docs/retail_boot_chain.md, the descriptor-heap handle assert after the first CreateDescriptorHeap).

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not a translator change.)

Tag: SHAYDERRR

…RT-VALUE-OPTION)

--trace, --game-dir, --overlay and --mods take a path, so another option where the value belongs is the usage error and exit 2. Before, `--dry-run image.exe --trace --trace-d3d12` wrote the startup trace to a file literally named --trace-d3d12 and exited 0 with the D3D12 trace off: a mistyped command line read as a clean run. The ctest runs the binary on both shapes and on a real --trace FILE value.

@Grimkaaah Grimkaaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Independent Linux CPU review (b9afc300)

What changed: gta6rt treats a following option as a missing value, not a value; CMake check + README.

Checked: Diff review (runtime not built here). Focused option-parser guard.

Looks coherent; no game files.

@haayden

haayden commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested b9afc3009 on Windows 11, RTX 5070 Ti (NVIDIA 621.14), MSVC 14.44 RelWithDebInfo: pass

Configured runtime/ with the VS 2022 generator (-DLEONIDA_VULKAN_HEADERS_FETCH=ON, SDL3 not installed); built gta6rt and tiny_game.

  • Head b9afc3009: ctest -R "^gta6rt_|^run_tiny_game": gta6rt_option_values passed, as did gta6rt_rejects_dry-run_run, gta6rt_rejects_dry-run_init, gta6rt_rejects_init_run, gta6rt_stack, run_tiny_game, run_tiny_game_console_paths, run_tiny_game_tls, run_tiny_game_eh, run_tiny_game_stack, run_tiny_game_dir. Four run_tiny_game_*exit_code*/_fixed tests did not run or failed because I only built gta6rt and tiny_game, not their helper targets; they don't exercise this change.
  • Base 867d922f0 (merge-base with main): built gta6rt and ran head's check_option_value.cmake against it with cmake -P: fails as expected. All four refusal cases return 1 (not an MZ image) instead of the usage error 2, and a file named --trace-d3d12 is created in the work folder. So the new test is red on base and green on head.

Code read: the -- prefix check only applies to the four path options; --view-mode-getter and the rest keep the old i + 1 < argc handling. A path value that really starts with -- can no longer be passed (it would need ./--name), which seems fine for these options.

AI-assisted (Claude Code). Synthetic tests only, no game files.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head b9afc3009 merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo):

  • python -I scripts/check_no_game_data.py on all 4 changed files: clean (exit 0)
  • cmake --build runtime/build --target gta6rt --parallel: built cleanly
  • ctest --test-dir runtime/build -R 'option_value|gta6rt' --output-on-failure -V: 5/5 passed (including gta6rt_option_values)

AI-assisted.

@xSavunBeyHD

Copy link
Copy Markdown

Reviewed b9afc30 (code read, static check against main, no local build/run):

Looks good overall — no blocking issues found.

  • runtime/src/main.cpp: checking i + 1 >= argc || std::wstring(argv[i + 1]).rfind(L"--", 0) == 0 for --trace, --game-dir, --overlay, and --mods cleanly catches both missing trailing values and following options (including --), returning usage() (exit 2) before opening or mapping anything.
  • runtime/test/check_option_value.cmake & runtime/CMakeLists.txt: works for both native Windows (RUNNER empty) and cross-run (RUNNER set), verifies exit 2 + usage message, confirms --trace-d3d12 is not created on disk, and keeps a positive --trace FILE test.
  • Docs (runtime/README.md) match the new behavior.

Two small non-blocking notes:

  • check_option_value.cmake only exercises the following-option cases (--trace --trace-d3d12, etc.), not the trailing end-of-line missing-value case (--dry-run --trace) that i + 1 >= argc also guards.
  • An empty string argument (--trace "") still passes the rfind(L"--", 0) check; adding argv[i + 1][0] == L'\0' would reject that too if desired.

AI-assisted.

@comtek21516

comtek21516 commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested b9afc3009 (it sits directly on main at 867d922f0) on Windows Server 2025, MSVC 14.52 (Visual Studio 18), Ninja RelWithDebInfo, no GPU: pass.

  • Build: all 475 steps, no warning from runtime/src/main.cpp.
  • ctest: the new gta6rt_option_values passes, and so do startup_trace, run_tiny_game, run_tiny_game_console_paths and the gta6rt_* tests, which all pass real values to these options.
  • Negative control: with runtime/src/main.cpp taken from main and this PR's test kept, gta6rt_option_values fails on all four refused forms (--trace --trace-d3d12, --game-dir --trace, --overlay --mods, --mods --overlay: each returned 1 where 2 is wanted).
  • Whole suite: 148 passed, 124 skipped (no Vulkan driver here), 4 failed. The four are gameinput_host, d3d12_sparse_queue_family, vk_bindless_ps_tex and vk_bindless_ps_imgatomic, which fail the same way on main on this machine (runtime tests: skip, not fail, without a Vulkan driver or a working host GameInput (4 ctests) #7452) and do not involve option parsing.
  • Code read: a value-taking option at the end of the line used to fall through to the image-name branch; it is the usage error now as well. One consequence to be aware of: --trace -- <game arguments> is refused too, because -- starts with --. On main that wrote a trace file named -- and dropped the separator, so the refusal is the better answer.

It conflicts with #8729 (the --game-dir folder check) in runtime/README.md only, where both extend the same sentence (git merge-tree: main.cpp and CMakeLists.txt merge by themselves); whichever lands second needs that one paragraph rebased. No game files used. AI-assisted (Claude Code).

Edited: the first version of this comment said the two PRs touch the same lines of main.cpp; they do not.

@OlaiFG7

OlaiFG7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed b9afc30, code read only (not built, no MSVC or GPU here), AI-assisted: LGTM. runtime/src/main.cpp:87-94, runtime/test/check_option_value.cmake and runtime/README.md:53-55 are consistent: a missing trailing value or a --* token (including --) is refused for --trace, --game-dir, --overlay and --mods, and the test checks exit 2 with no --trace-d3d12 file plus a valid --trace FILE. Agree with the non-blocking notes already made: an empty "" value still passes and the trailing-end-of-arguments case is not tested, and --view-mode-getter / --archetype-lookup keep i + 1 < argc. runtime/README.md overlaps #8729, and stale #2236 touches the same code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants