Commit Graph

241 Commits

Author SHA1 Message Date
Alex Vanderveen ceee034d59 Merge origin/CTR-Netplay into integrate/game-codegen-hooks-into-rollback
Keep both psx_bss.h (BSS rings) and nd_intro_ot.h from CTR-Netplay.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 22:53:34 -04:00
Alex Vanderveen 9689ad40dd shrink 0's and use explicit portable toolchain python 2026-08-08 22:50:17 -04:00
Alex Vanderveen e8fbceeca0 bump windows build errors 2026-08-08 21:11:34 -04:00
Alex Vanderveen 069adf871e bump windows build errors 2026-08-08 21:10:11 -04:00
Alex Vanderveen c53025ed13 bump toolchain 2026-08-08 20:03:06 -04:00
Alex Vanderveen e8f96d75b5 SDL3 toolchain patch 2026-08-08 20:01:44 -04:00
Alex Vanderveen 7f3a77ecc7 Merge pull request #116 from mstan/integrate/game-codegen-hooks-into-rollback
Integrate/game codegen hooks into rollback
2026-08-08 19:39:17 -04:00
Alex Vanderveen 4fb1715425 update new project scripts 2026-08-08 15:12:35 -04:00
Alex Vanderveen c31eb12dc1 setup wizard and launcher support 2026-08-08 14:10:49 -04:00
Alex Vanderveen ea8f1308e6 CTR graphical diagnostic 2026-08-08 01:19:15 -04:00
Alex Vanderveen cd13726a47 toolchain clean old packs 2026-08-07 20:19:18 -04:00
Alex Vanderveen 2e3e7365db CI hardening 2026-08-07 16:13:55 -04:00
Alex Vanderveen 346e627f3e toolchain + CI + wizard hardening 2026-08-07 14:33:43 -04:00
Alex Vanderveen 162a930512 codegen + bios launcher patch 2026-08-07 12:36:28 -04:00
Alex Vanderveen 2917936f6d Heal broken toolchain caches during ensure / rebuild.
Probe cmake --version; if the cache or latest pointer is unusable, clear
the bad pointer and stamp, then re-download (or install from zip) so
Generate & rebuild can recover without manual cleanup.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 12:27:50 -04:00
Alex Vanderveen 85ab30a0ba Find RetComM latest toolchain packs on Linux/macOS.
Install into versioned <tag>/ with latest as a pointer (not extract-into-
latest), honor RETCOMM_DATA_HOME/TOOLCHAIN_CACHE, and search both XDG and
~/.local/share so install.sh packs resolve during ensure/rebuild.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 12:19:58 -04:00
Alex Vanderveen 598e3887a4 toolchain patch 2026-08-07 11:29:50 -04:00
Alex Vanderveen 7940137d0d bump setup script 2026-08-07 03:42:37 -04:00
Alex Vanderveen bea16e3ad2 -DPSXRECOMP_ALLOW_NO_BIOS=ON 2026-08-07 03:24:34 -04:00
Alex Vanderveen 09d94214af GH reorder 2026-08-07 03:08:40 -04:00
Alex Vanderveen a79619462e update script 2026-08-07 02:04:55 -04:00
Alex Vanderveen 480fcad652 new build wizard 2026-08-07 01:43:04 -04:00
Alex Vanderveen 94cb3807a9 Merge origin/master into integrate/game-codegen-hooks-into-rollback
Keep rollback/netplay multiplayer routing, dual-raster GL present, and TOC
fingerprints while taking master's CHD support, mod load acceleration,
adaptive widescreen, and geometry/perspective APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 22:50:38 -04:00
Matthew Stanley 42a69624b1 fix(tools,docs): diagnose unconfigured recompiler build dirs in regen_bios
A contributor bringing up a new title hit four dead-ends in a row, three of
which were the same missing step wearing different masks: `regen_bios.sh`
builds the BIOS emitter but never configures it, and nothing said so.

- "no recompiler build dir found (set PSXRECOMP_BIOS_BUILD)" pointed at an
  env var when a fresh clone has no CMake tree to point it at. Both discovery
  failure and an explicit override now name the actual missing step and print
  the configure command.
- Setting PSXRECOMP_BIOS_BUILD skipped the CMakeCache.txt check that discovery
  applies, so an unconfigured directory reached `cmake --build` and died with
  cmake's bare "Error: could not load cache". Validate the override too.
- A CMake configure that FAILS still writes CMakeCache.txt — the cache lands
  before the generate step, which never runs after a FATAL_ERROR. So "has a
  cache" did not mean "is buildable": the directory left behind by his failed
  SDL and BIOS-backend configures had a cache and no build.ninja, and the
  build reported only `ninja: error: loading 'build.ninja': GetLastError() =
  2`. Read the generator out of the cache, check for its build files, and say
  what happened. Discovery skips such a directory and keeps looking rather
  than selecting it and dying; an unrecognized generator falls through to
  cmake instead of inventing a failure.

All errors now go to stderr (the old one went to stdout).

Docs: the README's framework build block configured the recompiler and jumped
straight to the runtime build, omitting the required BIOS regen between them —
exactly the hole he fell into. It is now the same numbered 1/2/3 sequence
docs/BUILDING.md already used. BUILDING.md gains troubleshooting entries for
the two CMake half-configured-directory errors, the fresh-clone "No recompiled
BIOS backend available", and PSXRECOMP_BIOS_BUILD being resolved relative to
the framework root rather than the shell's cwd.

Verified: both new failure paths and the half-configured-directory case
reproduce and now self-explain; discovery precedence (build-t2 over build),
explicit-override precedence, Ninja/Makefiles/unknown generators, and a CRLF
cache all behave; end-to-end `regen_bios.sh --config bios/OpenBIOS.toml`
still emits (Dispatch entries: 3911).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 18:03:03 -07:00
Alex Vanderveen 2f7a2d6026 new 3+p architecture 2026-08-05 19:07:06 -04:00
Matthew Stanley af6dff5132 feat(debug): screenshot_hires — capture the surface the player actually sees
screenshot/screenshot_file read native 15-bit VRAM via gpu_display_pixel_rgb.
That is correct for faithfulness work but BLIND to any enhancement that only
exists in the supersampled mirror: at supersampling >= 2 the geometry-correction
sub-pixel vertices, SSAA edges and perspective UVs are resolved in the hi-res
surface and gone once pixels are packed back to native.

This bit hard. Native captures of Ape Escape looked clean while the user was
looking at a visibly cracked frame, so a real regression got reported as fixed
and the argument moved to counters. An instrument that cannot show the defect
is worse than no instrument.

screenshot_hires routes gr_render_display_hires — the same present path the
window uses — and falls back to the native resolve (reporting scale 1) when
there is no hi-res surface, so it always answers truthfully about real output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 15:36:27 -07:00
Matthew Stanley 5a64a98440 feat(debug): geom_correction TCP command — is the correction engaging?
Both [video] enhancements are silent no-ops on anything they cannot prove is
projected geometry: a vertex whose sub-pixel fraction was never cached, or a
packet whose position words lack full GTE projection provenance, just draws the
faithful way. So the enable flag alone says nothing about whether a given title
benefits, and the existing hit counters had no reader.

geom_correction reports the flag plus the free-running geometry_vertex_hits and
perspective_triangles totals, so per-title bring-up can tell an engaged
correction from an inert one before anyone argues about screenshots. Sample
twice and diff for a per-window rate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 14:42:37 -07:00
Matthew Stanley c8b692eda2 feat(video): opt-in sub-pixel vertex precision + perspective-correct textures
Makes the parked projection/perspective work reachable and gets it into the
renderers people actually use. Addresses issue #92 (PGXP-style geometry and
texture correction).

The GTE side cache, SWC2 RAM provenance, GP0 triangle preparation and the
software-renderer consumption path already landed in 2ceaf5a ("park projection
and perspective correction", from kem0x PR #14), but were unreachable: the
generic setters gte_geometry_correction_set() / gpu_texture_correction_set()
had no production caller, and the corrected vertices went straight to
sw_set_precise_triangle(), bypassing the renderer vtable — while the default
renderer is OpenGL.

This adds:

- [video] geometry_correction and [video] perspective_texturing, in game.toml
  and settings.toml, both defaulting false. Independent knobs; the launcher
  seed marks them present so a save round-trips a hand-edited key instead of
  dropping it. Startup names the active pair, and notes when geometry
  correction is on below supersampling 2 (where it cannot be seen).
- gr_set_precise_triangle() / gr_set_perspective_triangle() on the
  GpuRenderBackend vtable, so gpu.c hands the correction to whichever backend
  is live rather than to the software rasterizer directly. NULL entries no-op.
- OpenGL and Vulkan consumption. Positions are already float end-to-end, so
  sub-pixel vertices drop in; the readback dirty rect widens by one pixel to
  cover them. Perspective UVs use a per-vertex a_q weight and clip coordinates
  pre-multiplied by w = 1/q, letting the hardware's own perspective divide
  interpolate a smooth UV varying beside the affine noperspective one. a_q == 0
  — the default, and what every prim gets with the feature off — makes w
  exactly 1.0 and selects the affine varying, so the faithful path is the
  pre-feature pipeline unchanged.

The PS1-visible GTE SXY FIFO stays integer either way: guest-side screen-bounds
culling and SXY readback are untouched, and this remains visual-only.

Also fixes a pre-existing concurrent-build race found while validating: every
runtime target runs embed_spirv.py over the same shaders, and each wrote
"<shader>.spv" next to the source, so under -j N one process deleted the file
another had just written (FileNotFoundError on a shader that compiled fine).
The intermediates now go to a per-invocation temp dir.

Parked-work provenance retained; see ENHANCEMENTS.md G1.

Co-authored-by: Kareem Olim <kareemolim@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 14:02:58 -07:00
Matthew Stanley 67757efac4 feat(runtime): add CHD discs and mod-owned loading modes 2026-08-03 22:32:17 -07:00
Matthew Stanley 5959ef2fdd feat(tools): shared macOS release packager for game repos
tools/package_release.ps1 packages this framework's BIOS-only runtime, and
each game repo carries its own Windows packager. There was no macOS
equivalent at either level, so the first macOS release (Crash Bandicoot) was
assembled by hand and TombaRecomp already carries a private copy of most of
this logic. Add the generic one here so titles configure rather than
duplicate it.

Takes an already-built runtime plus the per-game identity and produces a
signed, relocatable .app in a staged release folder, archived as
<package>-<version>-macos-<arch>.zip with a .sha256 sidecar — the naming the
game repos' Windows releases already use. It does not build; the game's
build script builds, then calls this.

Release gates, porting the intent of the Windows packager to macOS:
- self-containment via otool (only OS libraries or bundled Frameworks)
- no baked absolute BIOS path, and no build-machine home path. The Windows
  gate keys on a drive letter; the macOS tell is a path rooted under
  /Users, /Volumes and friends. Matching bare "/...SCPH*.BIN" instead would
  flag both the correct relative default "bios/SCPH1001.BIN" and the usage
  string "/path/to/SCPH1001.BIN" in every binary.
- the 512 KiB OpenBIOS image and its MIT notice are present
- every --require-mod package is present, so a title cannot ship a launcher
  whose Mods page silently vanished
- no disc / retail BIOS / memory-card / generated / local-state files
- saves/ ships empty
- the .app carries a valid signature

The mod catalog is taken from the repo's reviewed source, never the build
tree: a developer build dir accumulates mods/state.toml with enhancements
switched on, which would silently flip a title's default presentation for
every player. Packaging from a build tree without --mods-src is refused.

Bundle layout: staged data lives in Contents/Resources with symlinks from
Contents/MacOS. The runtime resolves bios/, assets/ and mods/ beside the
real executable, but codesign treats anything non-executable under
Contents/MacOS as nested code and rejects the whole bundle —
mods/packages/<pkg>/<version>/ parses as a versioned bundle. codesign seals
a symlink without descending, so this signs cleanly and path resolution is
unchanged. Signing is deliberately not --deep for the same reason.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 18:19:34 -07:00
Alex Vanderveen 34f2ecb490 Merge pull request #97 from mstan/feat/game-codegen-hooks
Feat/game codegen hooks
2026-08-03 07:26:00 -04:00
Alex Vanderveen 3428829090 Require cmake-clang-v1 1.0.4 for Linux IPO linking.
Floor ensure-toolchain at 1.0.4 (libxml2 + clang.cfg -fuse-ld=lld) and
prepend pack lib/ to LD_LIBRARY_PATH when activating the toolchain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 07:20:31 -04:00
Alex Vanderveen 0948109653 bump ci and prepare CDDA multi bin/track disc 2026-08-03 05:57:29 -04:00
Alex Vanderveen d35024ef23 codegen toolchain shared dir with retcomm 2026-08-03 02:54:19 -04:00
Alex Vanderveen db24f79db5 toolchain patch windows 2026-08-01 14:09:49 -04:00
Alex Vanderveen f46bcaae85 windows toolchain patch 2026-08-01 10:36:07 -04:00
Alex Vanderveen 20d08da27a window dll workflow patch 2026-08-01 01:37:12 -04:00
Alex Vanderveen 9ac26e2135 Update package_setup_host.sh 2026-08-01 01:20:38 -04:00
Alex Vanderveen 92c82adecc split toolchain from core game package 2026-08-01 01:03:44 -04:00
Alex Vanderveen 2f99cca345 migrate more tools into psxrecomp for building 2026-08-01 00:32:10 -04:00
Alex Vanderveen 4cb93f8c3f migrate bundling logic into psxrecomp, thinner layer at game level 2026-07-31 23:18:24 -04:00
Alex Vanderveen 17c60e470d disc conversion and optimizations to generate+build flow 2026-07-31 17:22:45 -04:00
Alex Vanderveen 3da61df355 Revert "ok"
This reverts commit b836f2198c.
2026-07-29 03:18:10 -04:00
Alex Vanderveen b836f2198c ok 2026-07-29 03:15:42 -04:00
Matthew Stanley 60cb60eee6 fix: repair CLI BIOS and launcher builds 2026-07-28 22:46:55 -07:00
Matthew Stanley 106e31d6e9 Make SDL3 the default runtime backend 2026-07-28 09:22:28 -07:00
Matthew Stanley 0c4dd2db85 docs(tcp): generate the command index; fix six wrong entries
TCP_COMMANDS.md instructed contributors to "update this file" on every new
handler. It described 47 commands while the two debug servers registered 292
between them (279 native + 61 Beetle, overlapping) -- 15% coverage. A
hand-maintained inventory that size does not stay correct, and a stale
reference is worse than none because people trust it.

New tools/gen_tcp_commands.py parses the s_commands[] (native) and CMDS[]
(Beetle) tables and regenerates a complete index between AUTOGEN markers,
marking which commands the curated prose already covers. The hand-written
"Command inventory" table is untouched -- it carries parameters and context
worth keeping. `--check` exits non-zero when the block drifts, so this can gate
CI; verified it fails on a simulated added handler and passes once regenerated.

Corrections to the curated table, each verified against the code first:

  write_ram       params are `addr`,`val` -- not `addr`,`hex` -- and it writes
                  exactly one byte per call (handle_write_ram)
  screenshot      writes a PNG (psx_screenshot.png), not a 24-bit BMP
                  (debug_server.c:7666,7856)
  wtrace_range    ring holds 262144 entries (WRITE_TRACE_CAP, 1<<18), not 1024
                  -- the documented figure was 256x too small
  sljit_async     row removed; the command is not registered anywhere (the
                  sljit tier was removed 2026-07-15)
  pause/continue/step/run_to_frame
                  documented as working. All four are registered but
                  unconditionally return an error (debug_server.c:7324-7342);
                  they were deliberately removed in favour of ring-buffer
                  queries. Marked REMOVED with the replacement each error
                  message names.

Also corrected the header: it presented DuckStation (port 4371) as one of the
two live servers, though DuckStation was retired as the oracle on 2026-05-05
and has no .gitmodules entry, while the page's own CLI examples already used
Beetle on 4380. The live pair is now Native 4370 / Beetle 4380, with a note
that the inventory's "D" column is historical, and the "add a handler" checklist
now points at beetle_debug_server.c and the generator instead of DuckStation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 11:49:31 -07:00
Matthew Stanley fa408aae50 Merge trusted mod plugin support 2026-07-26 21:05:03 -07:00
Matthew Stanley 45dd4210cf Remove Tomba legacy hybrid controller path 2026-07-26 20:52:12 -07:00
Matthew Stanley 8b77d8a730 fix: make overlay autocompile cache-safe 2026-07-26 09:39:24 -07:00