Commit Graph

60 Commits

Author SHA1 Message Date
Matthew Stanley 5237ff01fc Scaffold: commit game_options.toml; keep multi-disc probe files tracked
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 23:35:39 -07:00
Matthew Stanley 94ac3d37a8 update_disc_set: write in-project disc paths relative with '/'
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 23:34:13 -07:00
Matthew Stanley fa83aeb064 Fix Windows scaffold: BOM-less writes, native Python, configuring cmake for builds
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 23:30:47 -07:00
Matthew Stanley d240180943 Revert #487: recomp-net header block and update_cmake tool
#479 guards the host_relay.h include, so offline title builds no longer need recomp-net's include dir; the tool had no other managed block.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 10:41:25 -07:00
Claude 30718a3f72 Project Studio: Bulk 'Update CMake' button + git bulk-update-cmake
Runs tools/update_cmake.py (framework copy) against each selected repo's
CMakeLists.txt and commits only that file (optional --push / --dry-run).
2026-10-03 17:17:30 +00:00
Claude a8ea6c93d0 Scaffold: expose recomp-net headers; add tools/update_cmake.{sh,ps1}
main.cpp includes recomp_net/host_relay.h unconditionally, so offline
(PSX_NETPLAY=OFF) game builds fail with 'No such file'. Add a managed
recomp-net-headers block to CMakeLists.txt.in and an idempotent
update_cmake tool (py core + .sh/.ps1 wrappers) to sync existing projects.
2026-10-03 17:17:30 +00:00
Matthew Stanley 354e3d79a4 project studio: probe_disc_refresh merges disc identity instead of overwriting game.toml and seeds
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 11:39:00 -07:00
Alex Vanderveen 9f72435dce migrate_bundled: a pre-moved submodule gitlink is not a dirty tree
Retro Studio's bulk tab bumps the title's psxrecomp pin first so the script
it runs is the one the title will pin; the clean-tree gate must not refuse
that. Submodule-internal changes are still refused at bump time.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 21:16:36 -04:00
Alex Vanderveen 11df3be1ff tools: migrate_bundled_release.py moves an existing title onto bundled releases
One pass per title: bump psxrecomp/recomp-ui to a ref that carries
docs/ci/templates/game-release.yml and the committed BIOS backends (refused
otherwise), un-ignore generated/, ensure [runtime] overlay_cache = true, emit
scripts/package_release.sh (retiring package_setup_release.sh) and
release.yml from the pinned template, rebuild emitters + regenerate the game
C from the title's disc, refresh framework_pins.txt, run check_boot_exe and
check_generated, commit; --push optional, --dry-run writes nothing.

The operation lives in project_studio/migrate_bundled.py; the tools/ script,
`git migrate-bundled` and `git bulk-migrate-bundled` (map_repos, per-repo
streaming) are its faces. Exercised end to end on a scratch copy of
Bomberman Party Edition (48 generated files committed, zip prefix kept,
generate_ci --check current).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 21:15:57 -04:00
Alex Vanderveen 34191cadcc generate_ci: a workflow still running a retired step is stale
--check only looked for template steps the installed file lacked, so a copy
that still ran the removed OpenBIOS emission (or the setup-host wipe) read as
current and failed on the runner.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 20:33:10 -04:00
Alex Vanderveen 874df9b5bb release: ship bundled, compiled games from committed generated/ C
Retire the setup-host release model (CI wiped generated/ and shipped
emitters + sources + a wizard so every player regenerated and rebuilt the
title). Titles now commit generated/ and CI ships the compiled game.

- docs/ci/templates/game-release.yml replaces setup-release.yml: gate on
  committed game C (tools/ci/check_generated.sh), emit the OpenBIOS backend
  in CI (tools/ci/generate_openbios.sh), configure with
  PSXRECOMP_REQUIRE_GAME_C=ON and assert the full path was taken, package
  with tools/package_game_release.sh, verify the zip is a game not a kit.
- tools/package_game_release.sh: exe, assets, bundled OpenBIOS, configs, mod
  catalog + overlay toolchain via release_stage.py, notices; refuses sources,
  emitters, generated C, BIOS dumps. clear_generated.sh removed;
  package_setup_host.sh marked retired.
- Scaffold: gitignore templates track generated/, package_release.sh.in
  wrapper, setup_project.{sh,ps1} commit generated/ after Generate.
- Project Studio: audit flags ignored/untracked generated/, retail BIOS C
  and setup-host workflows; merge_gitignore un-ignores generated/; ops emit
  the bundled packager + workflow; generate_ci uses the new template.
- Docs: docs/ci/BUNDLED_RELEASES.md replaces HOST_ONLY_RELEASES.md.
- Tests: tools/tests/test_bundled_release_layout.py; fix pre-existing
  false positives in the packager-surface and overlay-static tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 17:11:14 -04:00
Martin Penkava 3a4e166545 project studio: make migrate_project.py work from a Windows console
Two failures hit while migrating a title on Windows 11:

- `audit` crashed with UnicodeEncodeError on the "->" mark (U+2192) when the
  console code page can't encode it (cp1250 here). main() now reconfigures
  stdout/stderr with errors="replace", so reports degrade those characters
  instead of aborting.
- record_framework_pins failed. subprocess.run(["bash", ...]) lets
  CreateProcess search System32 first, which starts WSL's bash; it can't see
  D:/ paths, and a CRLF checkout of record_pins.sh breaks any bash anyway.
  It now resolves bash via shutil.which, passes POSIX-style paths, and falls
  back to the existing git rev-parse snapshot when the script can't run.

Most of this was done by Claude Opus 5.5; I reviewed and tested it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 14:11:39 +02:00
Alex Vanderveen 833c591720 scaffold: setup_project writes a starter .recomp.json (recomp.fyi spec)
New projects describe themselves to community lists (recomp.board et al.)
via .recomp.json at the repo root: game, system PS1, type recomp,
toolchain psxrecomp, status exploring, and original region + serial.

write_recomp_json.py takes the serial from disc_probe.json and derives
region from the Sony serial prefix, falling back to --region (which
defaults to USA and would mislabel PAL discs). It only fills missing
fields, so re-running it never clobbers a maintainer's edits.

Both gitignore templates ignored /*.json at the root, which would have
silently dropped the file from the initial commit; un-ignore it.

Closes #406

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:07:26 -04:00
Matthew Stanley bc5ec35998 cli: generate builds the static overlay shard an AOT profile declares
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 10:28:14 -07:00
Alexandros Mandravillis d17676a5c7 setup: read .chd through libchdr in the Python disc tools
The runtime mounts a .chd natively and the launcher lists it in the disc
picker, so a player could select one and see a valid disc identity, then have
first-run setup fail: verify-disc, prepare_disc.py and probe_disc.py hash and
parse raw 2352-byte track data, which a CHD stores compressed. Nothing on the
Python side could read it, and telling players to install MAME for chdman is
not an answer.

libchdr is already vendored and compiled for the runtime and the native media
CLI. Build it once more as a shared library in recompiler/ (CMake target chdr,
output next to the emitters, static CRT on Windows so a plain python.exe can
load it) and read the CHD from Python through ctypes. tools/psx_chd.py mirrors
the layout the runtime's iso_reader.cpp uses -- 2448-byte frames, 4-frame
track padding, stored versus virtual pregaps, big-endian audio -- and
reproduces the .bin files a Redump dump of the same disc contains, in either
of Redump's two layouts (one bin per track, or one bin for the disc).

verify-disc hashes those reconstructed track bytes against [prepare_disc]
instead of the container. prepare_disc.py writes the tracks into out_dir in
whichever layout the recorded digests match and then continues down its
normal cue path, so the data track is written once, SBI companions are looked
up next to the CHD, and the receipt names the CHD the player chose.
probe_disc.py extracts to a scratch directory and probes the cue. The CLI
builds target chdr on demand for a kit whose emitters predate it, and falls
back to the extract-it-first message when it cannot.

Verified against two discs from a Redump library converted with chdman: a
single-track MODE2 disc and a four-track disc with stored audio pregaps both
reproduce their catalogued track-1 size, MD5 and SHA-1 exactly; verify-disc
and prepare_disc.py accept the four-track one end to end. Tests build a
synthetic uncompressed v5 CHD around a cooked ISO image, so no retail data is
needed; the decode tests skip with a reason when no libchdr is built.
2026-09-16 11:49:59 +03:00
Matthew Stanley 2113defcfc Fix overlay Clang exports, PGO, and scaffold cache 2026-09-10 17:23:03 -07:00
Alex Vanderveen 922e8c5a07 Rename the product from RetComM to Retro
The launcher and studio ship as Retro Launcher and Retro Studio now,
from the RetroPortingToolKit org, so the old product name is gone from
display text, documentation and release asset filenames.

The split is by case, and it is not cosmetic. CamelCase RetComM was
always the product; lowercase retcomm and RETCOMM_ are identifiers --
the C++ namespace, the binaries, the data directories, the CMake and
environment variables, the Cloudflare service names, the readme markers.
Renaming those would orphan existing installs for no benefit, so they
are untouched: 1101 lowercase retcomm and 205 RETCOMM_ still stand in
the launcher alone.

Four things are deliberately still spelled RetComM, and three of them
would have been real breakage:

- RetComM-Data is CamelCase but it is a directory on disk --
  <exe_dir>\RetComM-Data\{runtime,config,data} for a portable install.
  Renaming it strands every portable user's config, toolchains and
  catalog cache.

- TechnicallyComputers/RetComM-Launcher in readme_has_launcher() is the
  historical half of a both-slugs test. Renaming it makes it a duplicate
  of the line above and sends every port built before the transfer back
  to reporting its launcher section missing.

- _LEGACY_LAUNCHER_RE matched "^## RetComM Launcher". A sweep renamed it,
  which would have silently stopped it matching every README already out
  there; it now accepts both headings.

- The portable-stub lookup gained the pre-rename filenames back as
  fallbacks, because old zips stay on the releases page and a rollback
  downloads one.

Release assets become Retro-Launcher-* / Retro-Studio-*. That is safe
for installed clients: pick_launcher_asset() gates on *linux*/*windows*/
*macos* plus extension and arch, not on the product name, and the
Windows portable stub is identified by its RCM1 trailer rather than its
filename.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013DpaQqVguHFpBuCmdoFYWY
2026-09-09 17:32:19 -04:00
Alex Vanderveen 3b5bf48305 Follow the RetroPortingToolKit transfer in submodule URLs and tooling
recomp-net, retcomm-rbengine (now rbengine), retcomm-toolchains (now
RetroPorting-Toolchains), the catalog and the launcher moved from
TechnicallyComputers to the RetroPortingToolKit org. GitHub still
redirects the old repo URLs, so nothing is broken today — but this repo
is what every port inherits its .gitmodules from, so the old owner
propagates into each new clone until it is fixed here.

.gitmodules now names the new URLs. The toolchain repo is updated in the
CI action default, the codegen host, fetch_toolchain.sh, toolchain_pack
and package_setup_host, and the scaffolder's recomp-net / rbengine
defaults follow.

Two things the mechanical sweep would have missed:

- render_launcher_block() held a second copy of the launcher slug split
  across two string literals, so a search for the full slug did not see
  it and every regenerated README kept the dead owner. It is now derived
  from LAUNCHER_REPO, which is the only place the slug lives.

- readme_has_launcher() matched one exact slug. Pointed at the new one
  alone it would report every port built before the transfer as missing
  its launcher section, and append a second copy to any README carrying
  neither the markers nor a "## RetComM Launcher" heading. It now
  accepts both.

The scaffolder's default GitHub owner for new ports becomes
RetroPortingToolKit. Existing ports are unaffected — they carry their
own owner in the README and remote.

psxrecomp, snesrecomp and recomp-ui did not move and still point at
mstan. Submodule paths (lib/recomp-net, lib/retcomm-rbengine) are
unchanged: they are pinned by every port and are not repo slugs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018xfKkiEkh87zL1EpE5Ty55
2026-09-09 00:39:14 -04:00
Matthew Stanley 57648745a3 mods: the framework stages the title's catalog too (5 titles could not package)
4cc04be3 ("rebump") renamed the staged mod catalog from <exe>/mods/packages to
<exe>/mods/bundled so that a rebuild could wipe build output without deleting
the player's own installed mods. runtime.cmake followed the rename. The shared
release module followed it (release_overlay_stage.ps1's Add-ModCatalog reads
mods/bundled). docs/MOD_PACKAGES.md already described the destination as "the
framework's mods/builtin/packages PLUS the title's mods/preloaded/packages".

No title CMakeLists followed, because the second half of that sentence was
implemented five times, once per repository, as a hand-written

    add_custom_command(TARGET psx-runtime POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory
            "${<TITLE>_PRELOADED_MODS}" "$<TARGET_FILE_DIR:psx-runtime>/mods")

in ApeEscapeRecomp, Tomba2Recomp and MegaManX4/5/6Recomp. That names the
destination as a STRING. There is no symbol, no header, no link dependency --
so renaming a staged output directory breaks nothing a configure, compile or
link step can see, and the diffstat of the commit that does it looks cosmetic.
The five titles went on staging into a directory neither the launcher nor any
packager reads, and discovery was deferred to whichever title next ran a
release packager, in a different repository, on a later day.

MEASURED, on real build output. Framework origin/master 22fbbfca plus
Tomba2Recomp origin/master cdf00af, both unmodified, both built:

  build-dir mods/
    bundled/psx.enhancement.cd-speed          <- framework, correct
    bundled/psx.enhancement.fast-loading
    bundled/psx.enhancement.pgxp
    bundled/psx.presentation.bezel
    packages/tomba2.debug.debug-menu          <- title, stranded
    packages/tomba2.enhancement.skip-fmvs
    packages/tomba2.enhancement.widescreen
    packages/tomba2.experimental.interpolated-frame-rate

and Add-ModCatalog run against that tree, from this commit's parent:

  Mod catalog is missing package(s) the sources define:
  tomba2.debug.debug-menu, tomba2.enhancement.skip-fmvs,
  tomba2.enhancement.widescreen, tomba2.experimental.interpolated-frame-rate.
  They exist in the source tree but did not reach ...\mods\bundled, so the
  release would ship a Mods page the dev build does not have.

Shipped releases are NOT affected. Tomba 2 v0.0.9 pins 04d9184b, which is an
ancestor of 4cc04be3 and contains zero occurrences of migrate_legacy_root and
bundled_root; its artifact is a self-consistent mods/packages layout. This is a
forward break only.

THE FIX PUTS THE LAYOUT IN ONE PLACE.

psxrecomp_add_runtime_target() gains a one-value keyword PRELOADED_MODS_DIR.
A title declares WHERE its packages live and never HOW they are laid out:

    set(APE_PRELOADED_MODS "${CMAKE_CURRENT_SOURCE_DIR}/mods/preloaded")
    psxrecomp_add_runtime_target(psx-runtime
        ...
        PRELOADED_MODS_DIR "${APE_PRELOADED_MODS}")

A keyword argument rather than a positional one or a variable read out of the
caller's scope, for three reasons. It is what the other fourteen one-value
arguments already are, so it needs no new convention and reads the same as the
LAUNCHER_BOXART line next to it. A pre-set variable would be invisible at the
call site and would silently do nothing if set after the call -- the same
"fails quietly in the caller's repository" shape as the bug being fixed. And it
is PER TARGET, which a global variable cannot be: Tomba 2 has two runtime
targets needing two different catalogs (mods/preloaded, mods/preloaded_ita).
psxrecomp_v4_add_runtime_target and psxrecomp_add_game_runtime both forward
their remaining arguments, so it reaches through both wrappers unchanged.

_psxrt_stage_mod_catalog() now emits, in one POST_BUILD command sequence per
runtime target: wipe mods/bundled; remove exactly the ids it is about to stage
from any pre-existing mods/packages; copy the framework builtins; copy the
title's packages; copy <dir>/README.md to mods/README.md; verify. Consequences
worth stating:

  * mods/README.md previously reached mods/ only as a side effect of copying
    the whole mods/preloaded tree. Now that only packages/ is staged it is
    copied on purpose, or it would silently disappear. Checked per title: all
    five carry mods/preloaded/README.md and none carries a root mods/README.md,
    so mods/preloaded/README.md is the only source there ever was.
  * a title may still OVERRIDE a framework builtin at the same id and version,
    because the framework copy runs first and the title copy overwrites it.
    Tomba 2's Italian catalog relies on exactly this, shipping localized psx.*
    manifests. The id LIST is deduplicated for the assertion and the reported
    count while the copies keep both, or the build claims to stage 11 packages
    for a catalog that holds 7.
  * COSIM targets stage nothing. They have no launcher and no Mods page, and
    they land in the same output directory as the real runtime, so letting one
    stage had it wipe and re-stage the runtime's catalog with only the
    framework half whenever -DPSX_BUILD_COSIM=ON built it last.

TWO GUARDS, because the failure mode being closed is silence.

Configure time: a project with packages under mods/preloaded/packages that does
not declare PRELOADED_MODS_DIR is a FATAL_ERROR naming the packages and the
argument to add. That is exactly the missed-title state and it is detectable
before any build runs. An empty packages/ is fine (the scaffold creates one),
and PRELOADED_MODS_DIR NONE is the explicit opt-out.

Build time: runtime/psx_check_mod_catalog.cmake fails the build if a declared
package did not reach mods/bundled, or if any package this build stages turned
up under mods/packages -- which after this change can only mean a CMakeLists
still stages its own catalog by hand. It runs as the LAST POST_BUILD step, via
cmake_language(DEFER), because POST_BUILD commands execute in registration
order and the framework block registers BEFORE anything a title adds after its
psxrecomp_add_runtime_target() call. Verified by inspecting build.ninja: the
deferred command lands after a title-registered POST_BUILD, not before it.

The deferred pass takes NO arguments and reads its work list out of global
properties. cmake_language(DEFER CALL <fn> "${var}") does not carry a
function-local variable through -- measured with cmake 4.2.2, the callee
receives an empty argument and an add_custom_command built from it fails at
directory end with "CMakeLists.txt:DEFERRED". Recorded so the next reader does
not re-derive it.

Ids the build does NOT stage are deliberately left alone in mods/packages. On a
self-compiling setup release that directory can hold packages the player
installed under the pre-split layout, and mod_packages.cpp's
migrate_legacy_root() relocates those into mods/installed on the next launch.
Removing only the ids this build stages is also what lets a build directory
made before the split be migrated silently, so the guard's "an id turned up in
mods/packages" report has no false positives.

The same script is registered as the ctest psx_staged_mod_catalog_test in every
project that stages a catalog, with REQUIRE_STAGED=0 so a tree where the
runtime was never built reports a skip rather than a spurious failure. Where
two runtime targets share an output directory it accepts either target's
complete catalog, since after a full build mods/bundled holds whichever linked
last -- which is correct for the packager, as it builds exactly one target per
variant, and each target's own POST_BUILD guard already verified its catalog at
stage time.

TESTS. runtime/tests/test_mod_catalog_layout.py exercises the guard against
on-disk fixtures: a reproduction of the broken state as it actually appeared
(bundled/ holding the four psx.* ids, packages/ holding the four game ids), a
declared package simply absent, a package directory with no manifest.toml, a
FOREIGN legacy package that must NOT fail the build, the require-staged split
between the two callers, and the shared-output-directory sibling case. It also
pins two source invariants in runtime.cmake so the layout cannot drift back
into per-title copies. Registered in runtime/CMakeLists.txt; the
test-registration guard reports 123 test file(s), all registered.

Framework ctest: 59/59 pass, 2 pre-existing DISABLED.

Also updated so the next title does not repeat this: the project scaffold
template now passes PRELOADED_MODS_DIR (it staged no catalog at all before, so
a scaffolded project with mods/preloaded/packages shipped none), and
docs/MOD_PACKAGES.md gains a "How bundled/ gets staged" section written at
titles.

Bead beads-eio.3.101. The five title-side patches must land AFTER this commit:
they reference PRELOADED_MODS_DIR, which does not exist before it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 16:37:19 -07:00
Alex Vanderveen 4cc04be3e6 rebump 2026-09-02 13:26:06 -04:00
Alex Vanderveen 209970cfe5 self-build: loop breaker, install-folder preflight, boot-EXE name lint
Follow-ups to the marker-skew hardening, closing the remaining legs of
the generate+build loop class:

- Loop breaker: host_prepare_generate stamps a successful generate into
  .psxrecomp_last_generate at the project root. When apply() is about to
  reopen the wizard because sources are missing and the stamp is recent,
  the wizard's prepare note becomes a diagnostic naming exactly which
  gate is unmet (the expected *_dispatch.c and/or the BIOS backends) and
  what generated/ actually contains, instead of silently asking for
  another round. The stamp is dropped once sources are visible so a much
  later manual wipe of generated/ reads as a fresh first run.

- Preflight: generate now refuses up front when the project root sits
  under the Windows temp directory (Explorer's run-from-inside-the-ZIP
  extraction, which evaporates) or is not writable, with instructions,
  instead of failing downstream in ways that present as the same loop.

- CI lint: tools/ci/check_boot_exe.sh cross-checks the three baked
  copies of the boot-EXE name (game.toml boot_exe/exe, CMakeLists
  GEN_MARKER, codegen_setup.c gen_marker_relpath) and the setup-release
  template gains a fail-fast "Lint boot-EXE name consistency" step, so a
  skew fails the maintainer's release instead of the player's install.
  op_emit_ci_workflow's step-name drift detection flags older titles
  automatically. Script is bash-3.2-clean for macOS runners; verified
  against fixture repos (consistent / skewed / boot_exe override /
  single-source) and real ports - where it immediately caught
  Tomba2Recomp's placeholder gen_marker_relpath ("SLUS_01234" vs
  SCUS_944.54), a live instance of the reported loop.

Both gitignore templates learn the new sidecar names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KfPHUBEYiSCwaGiwRc8ea7
2026-09-01 11:00:29 -04:00
Alexandros Mandravillis cabe566d01 tools: probe falls back to PSX.EXE boot when SYSTEM.CNF is absent 2026-08-30 22:28:22 +03:00
Alex Vanderveen 72b17fd095 ci: carry the mod-catalog gate in the template, and detect stale workflows
Two gaps, one cause: a title installs the CI workflow once and then never
learns the template moved on.

- docs/ci/templates/setup-release.yml gains the release gate that asserts the
  zip actually ships a mod catalog, carries no per-machine state.toml, and
  carries no developer-channel package. It existed only in one title's
  workflow, so every project generated before now would publish an empty Mods
  page with a green build -- the exact failure the gate was written for.

- op_emit_ci_workflow stopped at "release.yml already filled" and reported OK.
  Filled is not the same as current. It now compares STEP NAMES against the
  template and reports which are missing, so Studio's migration tab surfaces
  the drift instead of silently blessing it.

Step names rather than a text diff, deliberately: a filled workflow always
differs from the template (tokens, and titles customise theirs), so a textual
comparison would report stale on every project forever and be ignored within a
week. A step the template defines and the installed file does not is
unambiguous. Names containing a token are skipped -- the installed copy has
them substituted, so they are evidence of nothing.

It reports rather than rewrites: re-emitting overwrites a customised workflow
wholesale, so that stays behind --force.

Checked for a version-stamp gap while here and found none: both the template
and the installed workflow already configure with
-DPSX_GAME_VERSION="${RELEASE_VERSION}" and verify the lobby pin against it,
and the CI cache covers only build-recompiler, never the runtime. The
mismatch that prompted the look was a stale LOCAL build directory, not CI.

Verified both directions: the current workflow reports "already filled and
current"; the same workflow with the gate stripped reports the missing step
by name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194TYJAqgyG9a9PJe9uUcgQ
2026-08-29 21:21:56 -04:00
Alex Vanderveen 86e9c40b34 package: stage assets/ so a rebuilt zip can configure and keeps its icon
The CMakeLists gate added in 6ec5e29b caught a real latent break: every
generated project passes APP_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/
psxrecomp.ico" unguarded, but no wrapper staged assets/. The zip built fine
and would have died on the player's machine at cmake configure with "Cannot
find source file" -- exactly the failure that gate exists to move forward in
time. It fired on the FF7 release run.

Staging assets/ also keeps the rebuilt executable branded: runtime.cmake takes
the SDL window icon from the sibling psxrecomp.png in the same directory, so
without it a successful rebuild would still come out unbranded.

Conditional, matching the src/ and mods/ blocks above it, so it stays inert
for a project that has no assets/ of its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194TYJAqgyG9a9PJe9uUcgQ
2026-08-29 21:16:54 -04:00
Alex Vanderveen 29cba084fc package: keep src/ staging conditional after the merge
Both merged branches added src/ to the packaging template: feat/setup-host-
multi-disc as an unconditional --project-dir in the static argument list, and
fix/package-src-mods as a guarded EXTRA_PROJECT entry. git merged them
cleanly because they touch different lines, leaving src/ passed twice.

The duplicate copy is harmless, but the unconditional entry is not:
copy_proj() hard-fails on a missing path, so a scaffolded project without
src/ would stop packaging with "error: missing src". Every single-disc title
that has never added game-owned C is in that position.

Drops the static entry and keeps the guarded one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1TpXRJve6WvwyZbSJAbCL
2026-08-29 21:09:27 -04:00
Alex Vanderveen 081bb79084 Merge fix/package-src-mods (#267) into feat/multi-disc-launcher
Brings the packaging gates and Project Studio audit for allowlist drift:

  - template stages src/, mods/ and the generated symbol headers
  - package_setup_host.sh refuses to zip a stage whose CMakeLists.txt names
    an unstaged path, or whose project sources include one
  - Studio Migrate gains packager_stages_sources / packager_stages_optional
    and op_sync_packager_project_dirs

Both branches touch tools/package_setup_host.sh and the packaging template,
so this is merged here rather than left to race on master.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1TpXRJve6WvwyZbSJAbCL
2026-08-29 21:08:07 -04:00
Alex Vanderveen 61d23ba777 package: stage the symbol headers, and gate on what sources include
FF7 v0.1.3 shipped src/ff7_mods.c (the previous commit's fix) and then died
at the first object file:

  src/ff7_mods.c:20:10: fatal error: '../psx_symbols.h' file not found

psx_symbols.h is a tracked 82 KB header that game-owned C in src/ includes by
relative path. Nothing in CMakeLists.txt names it, so the CMakeLists gate
added in the previous commit could not see it — it is a compile input of the
shipped tree that only the source knows about.

Two changes:

1. The template stages psx_symbols.h and psx_symbols_overlays.h when present.

2. package_setup_host.sh gains a second pre-zip gate: every relative #include
   in the project's own staged sources must resolve inside the stage. Only
   project-owned paths (PROJECT_FILES / PROJECT_DIRS) are scanned — framework
   trees resolve their headers through -I and are not ours to police.

The include check accepts three resolutions: relative to the including file,
relative to the stage root, and finally any file of that basename anywhere in
the stage. That last one covers -I resolution out of the staged framework
trees (a bare "mod_plugins.h" comes from psxrecomp/runtime/include). It is
deliberately loose: a false pass only forfeits a warning, while a false
failure would block a good release.

Verified against the real v0.1.3 tree: the stage as shipped fails naming
exactly ../psx_symbols.h, and passes once the header is staged. mod_plugins.h
was a false positive in a minimal stage and is correctly cleared once the
framework tree is present.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1TpXRJve6WvwyZbSJAbCL
2026-08-29 20:57:09 -04:00
Alex Vanderveen 0ffab10ddf studio: audit + fix packaging allowlist drift in the Migrate tab
The setup_host_packager check only asked whether scripts/package_setup_
release.sh exists. Final Fantasy VII had one, passed, and still shipped a
zip without src/ff7_mods.c — a file its own CMakeLists.txt compiles — so
the install died at cmake configure on the user's machine. op_emit_packager
could not have helped either: it early-returns when the file is present.

Two new checks in audit_project, both driven by the same rule the packager's
pre-zip gate uses, so the two can never disagree:

- packager_stages_sources (FAIL): a path CMakeLists.txt requires that the
  allowlist omits. This is the build-breaking case.
- packager_stages_optional (WARN): a path present in the repo and used under
  if(EXISTS ...). cmake skips the block, so the build passes and the feature
  ships dead — mods/preloaded/packages is exactly this: the activation
  plugin is compiled in and has no package to select.

op_sync_packager_project_dirs patches the existing wrapper rather than
regenerating it, because packagers get hand-extended with extra
--project-file lines that a template rewrite would drop.

The rule is general, not an src/mods special case: a fleet audit also
surfaced tests/ and tools/ on Crash-Team-Racing-Recomp and src/+mods/ on
EmeraldRecomp and Final-Fantasy-7.

The GUI iterates report.checks, so both appear in Migrate with no UI change.

Verified against Final-Fantasy-VII at origin/master: pristine audit reports
1 fail + 1 warn; one apply stages mods and src; re-audit is clean; a second
apply is a no-op; the result is valid shell. The idempotency check caught a
real parser bug — packager_staged_paths captured the closing paren of
EXTRA_PROJECT+=(--project-dir mods), so applied fixes read back as unstaged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1TpXRJve6WvwyZbSJAbCL
2026-08-29 20:38:01 -04:00
Alex Vanderveen 6ec5e29b97 package: stage src/ and mods/, and gate on CMakeLists references
Final Fantasy VII shipped a release zip whose CMakeLists.txt compiles
src/ff7_mods.c, but the zip had no src/ at all. Installing it died at
configure with "Cannot find source file" and "No SOURCES given to target:
psx-runtime". The commit that added the widescreen mod plugin updated
CMakeLists.txt but not the packaging allowlist, and nothing checked.

The allowlist in the generated scripts/package_setup_release.sh is a closed
list that has to be kept in sync with CMakeLists.txt by hand, so this is a
class problem, not a one-off: of 23 game repos with a packaging script, all
23 carry mods/ and only 3 stage it; 7 carry src/ and only 2 stage it. Those
3 are hand-patched copies of this same fix, which is the tell.

Two changes:

1. templates/package_setup_release.sh.in stages src/ and mods/ when the
   project has them, using the existing EXTRA_PROJECT idiom (copy_proj hard
   -fails on a missing path, so they cannot be added unconditionally).
   src/ holds game-owned C that CMakeLists compiles in; mods/preloaded/
   packages holds the markers those plugins select themselves through, so
   without it a mod is built and never enabled.

2. package_setup_host.sh now refuses to zip a stage that cannot configure
   itself: every ${CMAKE_CURRENT_SOURCE_DIR}/<rel> the staged CMakeLists.txt
   names must exist in the stage. Paths used only inside if(EXISTS "...")
   are optional by construction and are skipped, as are globs and paths
   built from cmake variables. This turns a silent omission that surfaces on
   a user's machine into a release-time failure.

Verified against the real FF7 CMakeLists: the stage as shipped fails naming
exactly src/ff7_mods.c; with src/ staged it passes; the guarded
mods/preloaded/packages reference correctly does not fail a project without
mods/.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1TpXRJve6WvwyZbSJAbCL
2026-08-29 20:38:01 -04:00
Alex Vanderveen d6529481d4 packaging: a developer channel, kept out of published releases
Mods under active development had nowhere to live: a package was either in
the catalog and therefore in every release, or not built at all. Widescreen is
the immediate case -- it engages, but it is unvalidated as gameplay and FF7's
pre-rendered field backdrops still cull at the 4:3 bound, so it is not
something to put in front of players yet.

A package now declares its own maturity with channel = "developer". It still
ships with ordinary local builds and local exports, so it can be tested
exactly as a player would see it, and release packaging drops it.

The exclusion defaults from $CI -- on under any CI provider, off locally.
That is deliberate: a per-workflow opt-in is precisely the shape that left 21
of 23 ports shipping no mods at all, so this must not need 23 release
workflows edited to take effect. --exclude-dev-mods / --include-dev-mods and
EXCLUDE_DEV_MODS=0|1 override in either direction, and Studio's
`build export --exclude-dev-mods` reproduces what a release contains.

Applied in all three packagers (setup-host, Windows, macOS). Each prunes the
whole PACKAGE directory and then asserts no developer manifest survived --
including the SOURCE catalog under mods/preloaded, since the setup-host zip
rebuilds on the player's machine and would otherwise re-stage the package the
release just removed.

A manifest is never rewritten during packaging: editing a package while
packaging it would change content meant to be verifiable, which is why the
marker is package-level rather than per-feature.

Verified by packaging: local keeps 5 catalogs, CI=true drops to 4 with no
ff7.enhancements entry anywhere in the zip, and EXCLUDE_DEV_MODS=0 under
CI=true restores it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194TYJAqgyG9a9PJe9uUcgQ
2026-08-29 20:25:08 -04:00
Alex Vanderveen 82589d669a packaging: ship the mod catalog in every release, and let Studio bundle one
A built title stages its mod catalog next to the exe, but nothing put it in
the shipped package. Every release went out with an empty Mods page.

The packager already had --runtime-dir mods; it was opt-in and RUNTIME_DIRS
defaulted to empty, so each title had to pass it from its own generated
wrapper. An audit of the workspace found 21 of 23 ports never did, and the
two that did used the -optional variant that warns instead of failing. A
capability that exists, defaults off, and fails silently.

- package_setup_host.sh stages mods/ by DEFAULT and REQUIRES it. runtime.cmake
  guarantees <exe>/mods for every non-oracle target, so a missing one means
  broken build wiring and should fail the release rather than quietly ship an
  empty catalog. --no-mods opts out a title with none; an explicit
  --runtime-dir-optional mods still wins. It also ships the SOURCE catalog,
  because the setup-host zip rebuilds on the player's machine and that rebuild
  re-runs POST_BUILD staging from the source tree -- without it a rebuilt exe
  silently drops every game-owned mod and keeps only framework builtins.

- package_release.ps1 (Windows/MinGW) had no mod handling at all. It now
  stages the catalog before the stray-file scan, so the existing gate covers
  it, strips the build machine's mods/state.toml, and asserts at least one
  manifest survived -- matching the file's own assert-rather-than-trust idiom.

- package_release_macos.sh shipped ONE package where the player should have
  seen five. It took the catalog from mods/preloaded "never the build tree",
  but framework builtins (PGXP, fast loading, CD speed, bezel) live in
  psxrecomp/mods/builtin and only ever appear next to the exe. The real hazard
  was never the build tree, it was state.toml inside it -- so take the build
  tree and delete that one file. --mods-src still overrides.

- The wrapper template gains --project-dir src so future titles ship their
  game-owned trusted-plugin sources; CMakeLists.txt references them
  unconditionally, so the setup-host rebuild cannot configure without them.

Studio could build a title but never bundle one: the only route to a
distributable was install-CI, commit, push, wait. That is how an empty Mods
page survived unnoticed -- nobody produced a package locally to look inside.
buildops.export_release() runs the SAME wrapper CI runs, so a local zip and a
released one are the same artifact by construction; exposed as
`build export` on the CLI and an "Export release zip" button in the GUI.
Artifact tags default to the host and match the CI matrix.

Verified by packaging, not by reading: default produces 5 catalogs with no
state.toml; --no-mods reproduces the old behaviour at 0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194TYJAqgyG9a9PJe9uUcgQ
2026-08-29 20:10:44 -04:00
Alex Vanderveen 022dbc640e setup: keep disc probe artifacts out of the project tree
update_disc_set.py wrote disc_probe*.json and disc_set.json beside
game.toml. Those are inputs to verify_disc_set, not project content --
and disc_probe*.json are COMMITTED provenance records of the original
scaffold, so every wizard Generate modified three tracked files in the
game repo. Caught by a dirty `git status` after a test run, which also
showed the rewrite downgrading a curated display_name back to the raw
file name.

They now go to a TemporaryDirectory and are discarded; --artifact-dir
keeps them when a caller actually wants them. Re-verified: still an exact
no-op against Final Fantasy VII's correct 3-disc game.toml, and it leaves
nothing behind.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWiDNcWuNtDWHE7Pnhq4jp
2026-08-29 19:38:24 -04:00
Alex Vanderveen c4b8fdeb11 setup: re-sync the vendored disc tooling, dropping a stale status claim
Both vendored tools reported that "the runtime mounts the boot disc only
today" and named MULTI_DISC.md P1 + P3 as outstanding. P1 has landed --
`discs` is a first-class config entry, the runtime builds a roster from
it and mounts the SELECTED disc, remembered in disc_index -- so the
message was telling anyone scaffolding a set that the config they had
just written did nothing.

Fixed upstream first and re-synced, rather than patched here: these files
are vendored, and correcting only the copy would fork it from the MIT
original the attribution pins. Both files are again byte-identical to
retcomm-studio, and the pin moves a2b71ed9 -> 06bb918b.

The corrected text is also narrower and therefore more useful: what is
missing is specifically P3, a faithful lid in cdrom.c. Choosing a disc
means choosing it before the game starts; swapping mid-session is not
implemented. Worth stating plainly, because the roster this tooling
writes is what makes launcher-time disc selection work and it is easy to
read that as in-game hot-swap.

update_disc_set.py imports probe_disc, so the re-sync was re-verified:
still an exact no-op against Final Fantasy VII's already-correct 3-disc
game.toml, and --check agrees.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWiDNcWuNtDWHE7Pnhq4jp
2026-08-29 19:12:37 -04:00
Alex Vanderveen d28bab6574 setup: write the located disc set into game.toml, closing the wizard gap
Records the wizard's disc picks where the runtime actually looks, so a
standalone-wizard install reaches the same end state as a RetComM build.

The gap this closes. The runtime's hot-swap roster is built from
game.toml [game] discs (game_discs = gc.discs). disc.cfg is the
mounted-image cache and read_cached_path() takes only its first line via
std::getline. So the previous commit -- which taught the wizard to ASK
for every disc and write them all to disc.cfg -- recorded discs 2..N
where nothing reads them for the roster. The player located three images
and still got a one-disc roster.

Nothing in the standalone path wrote [game] discs. The tooling that does
lives in retcomm-studio, which is why the RetComM path produced a working
3-disc config and the wizard could not.

  tools/new_project_layout/probe_disc.py       synced forward
  tools/new_project_layout/verify_disc_set.py  vendored (new here)

Both from retcomm-studio @ a2b71ed9 (MIT, (c) Alex Vanderveen; psxrecomp
is PolyForm-NC, so this is permissive-into-stricter and the notice is
recorded in THIRD_PARTY_ATTRIBUTION.md). psxrecomp's probe_disc.py was a
stale fork predating multi-disc support: 90 lines behind, with its only
8 unique lines being older revisions of the same functions, so the sync
drops nothing psxrecomp-specific. A single-disc project still emits
`disc = "..."` byte-identically to before.

update_disc_set.py is new, and is the piece neither repo had. probe_disc
--write-game-toml renders a COMPLETE game.toml, which is right when
scaffolding and destructive afterwards -- it would discard a live
project's [video], [controller], [widescreen], [netplay] and its
comments. This probes each located image, verifies them as one set, and
then edits ONLY disc / discs / disc_serials / required_disc_fps. It skips
any key whose value it already agrees with, so it does not reflow a
hand-formatted array and a re-run is a no-op. It refuses to write at all
when verify_disc_set rejects the set: images that are not one program are
a mistake to surface, not a config to record.

Generate runs it before invoking the CLI (the CLI reads game.toml).
Failure is reported and non-fatal -- Generate needs only the boot image,
and refusing to build because disc 3 could not be probed is worse than
building with a single-disc roster. Absent script (older SDK checkout) or
fewer than two located discs are both early returns, so single-disc
titles are untouched.

Verified against Final Fantasy VII's three real images:
  - from a single-disc game.toml, produces discs + disc_serials
    (SCUS-94163/64/65) + required_disc_fps identical to the values the
    RetComM path had already produced in that repo;
  - all 114 remaining lines of config and comments byte-for-byte intact;
  - a second run changes nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWiDNcWuNtDWHE7Pnhq4jp
2026-08-29 19:12:37 -04:00
Alex Vanderveen 10f443eb8b setup: stop copying game discs into the project by default
setup_project.sh has always defaulted to STAGE_DISC=0 — probe the dump where
the user keeps it, write its absolute path into game.toml, and extract only
the small boot EXE into disc/. Two callers overrode that and copied instead:
NewProjectOptions.stage_disc defaulted True, and Project Studio's checkbox
was pre-ticked.

Staging copies every track into the repo, so a 3-disc PS1 set duplicates
~2.2 GB of a ROM library the user already owns and stores elsewhere — for no
gain, since disc/ is gitignored and a staged copy is never shipped either.

The checkbox is also relabelled "Stage disc" -> "Copy disc into project":
"stage" did not say what it costs. --stage-disc still works for anyone who
genuinely wants a self-contained tree. cli.py and setup_project.ps1 already
defaulted off and are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194TYJAqgyG9a9PJe9uUcgQ
2026-08-29 11:04:39 -04:00
Alex Vanderveen e6ad1bc4a6 bump
(cherry picked from commit 422583fc97)
2026-08-25 11:17:44 -04:00
Matthew Stanley 8ddcafb1c4 tools: extend new project setup workflow 2026-08-23 13:24:06 -07:00
Matthew Stanley 239052f166 docs: explain generated project framework requirement 2026-08-23 11:54:10 -07:00
Matthew Stanley 0fb110939c Fix setup_project.ps1 codegen source wiring 2026-08-15 12:39:17 -07:00
LarsDuJour 17eddc0f1d Update setup_project.ps1 2026-08-15 21:17:33 +02:00
LarsDuJour 81431498aa Update setup_project.ps1
Changed various ANSI characters to UTF-8 equivalents.

This solves a blocker on systems with some  languages, preventing using this script.
2026-08-15 21:13:30 +02:00
Alex Vanderveen ae9e6a4e2b hotfix build error on ci 2026-08-12 22:00:46 -04:00
Alex Vanderveen d5b5a029fe hotfix ci template 2026-08-12 21:53:26 -04:00
Alex Vanderveen f3c6caf96c game_options.toml template 2026-08-12 20:07:44 -04:00
Alex Vanderveen c4f412be17 project studio, harden prefetch sdl3 2026-08-12 16:49:03 -04:00
Alex Vanderveen a73a5c1093 rewind feature 2026-08-12 02:42:30 -04:00
Alex Vanderveen 3acb8f6d59 Integrate retcomm-rbengine as shared rollback host policy.
Wire lib/retcomm-rbengine beside recomp-net and replace MotK in-tree sched,
hash_confirm, input hist, snap ring, and rb_post with thin PSX shims so the
ecosystem can share invent/pacing policy outside each title facade.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 23:52:31 -04:00
Alex Vanderveen 37a5b7c7cd project studio 2026-08-11 23:17:47 -04:00
Alex Vanderveen 2c1942b569 project migration tools 2026-08-10 20:44:55 -04:00
Matthew Stanley 20a8f4ad08 input: make Hybrid a mod-only mode, not a selectable one
Hybrid kept reappearing in titles that never meant to ship it, because it was
the ZERO value of PadMode and therefore the default everywhere: PlayerInput,
p1_mode/p2_mode, ctrl_locked_*, and default_p1/p2_mode all initialised to it.
A game then had to opt OUT with [controller] allow_hybrid = false, and every
shipping title did exactly that or pinned a mode - so no title actually ran it.

Hybrid now has exactly one route: a trusted game plugin calling
psx_mod_set_controller_mode_override(), which is how Tomba's hybrid controller
mod already requests it. Everything that made it reachable by accident is gone:

  - defaults are ANALOG (PlayerInput, p1/p2, ctrl_locked_*, default_p1/p2)
  - [controller] allow_hybrid is removed, along with the startup clamp that
    existed only to undo the bad default
  - game.toml default_mode/p1_mode/p2_mode = hybrid now THROWS, naming the
    mod API as the only route, rather than being silently coerced
  - a stale settings.toml hybrid migrates to analog via
    pad_mode_from_settings_string(); a user should not fail to launch over a
    value they never typed
  - pad_mode_to_string() never writes hybrid back

Deliberately KEPT, because the mod runs on it: PAD_MODE_HYBRID,
PSX_MOD_CONTROLLER_HYBRID, psx_mod_set_controller_mode_override(),
hybrid_stick_active/hybrid_dpad_active, PlayerInput::hybrid_analog and
psx_keybinds_dpad_active.

Paired with the recomp-ui change that drops the Hybrid segment and the
allow_hybrid field from RecompLauncherCGameInfo - the two must land together.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 19:06:13 -07:00