fix(host): mod run starts the game: --mod-dev and --mod-tests are not its image #3200

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/mod-run-image-arg into main 2026-12-04 20:56:27 +00:00
Owner

Summary

longshot-builder mod run ended at once with cannot open --mod-dev and never started the game.

The game's argument loop (host/hos_main.c) takes the first argument it does not know as its image file. mod run passes --mod-dev and no image, so the flag was taken for it. --mod-tests <folder> had the same fault. The builder's sandbox already read both as flags; the game's loop now skips them too (hos_mod_arg, host/prepare_args.h).

To see the bug on main: build a game, then longshot-builder --profile <profile> mod run <a mod folder>.

Testing

Tested: Linux, NVIDIA RTX 3090, headless. A game built into a scratch folder from 12bcb2d06072 (before a rebase onto newer main), then mod run on a copy of docs/modding/examples/first-mod: the game started, logged dev mode on, reached the intro and rendered until a 150 s timeout stopped it. The mod itself waited for its permissions to be granted, as a new mod does. On a game built from main plus #3193, the same command ended with cannot open --mod-dev.

tests/test_game_image_arg.py runs the argument loop of hos_main.c over command lines: it fails on main and passes here, with g++ and clang++. The other tests/ checks that read the changed files pass, except test_utf8_paths, not run (it needs --cargo). hos_main.c passes a syntax check with llvm-mingw.

Still to test:

  • Windows: mod run on a mod folder, expecting the game to start in dev mode (by hand).

Measurements

Nothing to measure: no change aims at speed.

Risks

  • An image file named --mod-dev or --mod-tests would no longer be taken as one.
  • No switch; reverting is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (Not run.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux built whole; Windows syntax-checked only.)
  • Docs updated. (The docs already describe mod run as starting the game.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH

## Summary `longshot-builder mod run` ended at once with `cannot open --mod-dev` and never started the game. The game's argument loop (`host/hos_main.c`) takes the first argument it does not know as its image file. `mod run` passes `--mod-dev` and no image, so the flag was taken for it. `--mod-tests <folder>` had the same fault. The builder's sandbox already read both as flags; the game's loop now skips them too (`hos_mod_arg`, `host/prepare_args.h`). To see the bug on `main`: build a game, then `longshot-builder --profile <profile> mod run <a mod folder>`. ## Testing **Tested:** Linux, NVIDIA RTX 3090, headless. A game built into a scratch folder from `12bcb2d06072` (before a rebase onto newer `main`), then `mod run` on a copy of `docs/modding/examples/first-mod`: the game started, logged `dev mode on`, reached the intro and rendered until a 150 s timeout stopped it. The mod itself waited for its permissions to be granted, as a new mod does. On a game built from `main` plus #3193, the same command ended with `cannot open --mod-dev`. `tests/test_game_image_arg.py` runs the argument loop of `hos_main.c` over command lines: it fails on `main` and passes here, with g++ and clang++. The other `tests/` checks that read the changed files pass, except `test_utf8_paths`, not run (it needs `--cargo`). `hos_main.c` passes a syntax check with llvm-mingw. **Still to test:** - Windows: `mod run` on a mod folder, expecting the game to start in dev mode (by hand). ## Measurements Nothing to measure: no change aims at speed. ## Risks - An image file named `--mod-dev` or `--mod-tests` would no longer be taken as one. - No switch; reverting is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). (Not run.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux built whole; Windows syntax-checked only.) - [x] Docs updated. (The docs already describe `mod run` as starting the game.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
Fails: --mod-dev, which mod run passes with no image, and --mod-tests are taken as the image file.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
fix(host): mod run starts the game: --mod-dev and --mod-tests are not its image
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
PR description / Title and description (pull_request_target) Failing after 6s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 18s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 13m0s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m32s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m14s
CI / Website build and checks (pull_request) Failing after 35s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 46m0s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
1d031bcc11
The argument loop took the first argument it did not know as the image file, so `mod run`, which passes --mod-dev and no
image, ended with "cannot open --mod-dev".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
Author
Owner

Tested in game: Linux, NVIDIA RTX 3090, headless: a scratch game built from 12bcb2d06072, mod run on the first-mod example: the game started in dev mode, reached the intro and ran until a 150 s timeout.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH

Tested in game: Linux, NVIDIA RTX 3090, headless: a scratch game built from `12bcb2d06072`, `mod run` on the first-mod example: the game started in dev mode, reached the intro and ran until a 150 s timeout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
HumanBean changed title from WIP: fix(host): mod run starts the game: --mod-dev and --mod-tests are not its image to fix(host): mod run starts the game: --mod-dev and --mod-tests are not its image 2026-12-04 20:56:22 +00:00
HumanBean deleted branch fix/mod-run-image-arg 2026-12-04 20:56:27 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3200
No description provided.