Commit Graph

129 Commits

Author SHA1 Message Date
Codex edc3fd4e30 Preserve one-frame debug input pulses
Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-14 16:02:13 -07:00
Codex b156770bbd Configure the runtime OpenGL 3.3 core context
Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-14 15:59:39 -07:00
Matthew Stanley e247155cd6 overlay: use platform-native shared-library suffixes
Adapted from NyperYuhgard's PR #13 POSIX overlay work.

Co-authored-by: NyperYuhgard <93950153+NyperYuhgard@users.noreply.github.com>
2026-07-14 15:58:34 -07:00
Matt Stanley e5b5e309b5 Merge pull request #30 from mstan/feat/debug-client-command-parity-douglas
tools: expose existing debug-server commands in the client
2026-07-14 15:29:50 -07:00
Matt Stanley 4e31c6b71d Merge pull request #29 from mstan/feat/debug-analog-input-douglas
debug: expose analog input and stick status
2026-07-14 15:29:47 -07:00
Matt Stanley b1759ee8e1 Merge pull request #28 from mstan/park/pr13-misaligned-dispatch-diagnostics
traps: enrich misaligned dispatch diagnostics
2026-07-14 15:29:44 -07:00
Matt Stanley 75691a4546 Merge pull request #27 from mstan/park/pr13-overlay-cache-inventory
overlay: add opt-in cache inventory telemetry
2026-07-14 15:29:40 -07:00
Matthew Stanley 7350f2413a traps: enrich misaligned dispatch diagnostics
Adapted from NyperYuhgard's PR #13.

Co-authored-by: NyperYuhgard <93950153+NyperYuhgard@users.noreply.github.com>
2026-07-14 10:20:08 -07:00
Matthew Stanley 43e5f286b3 overlay: add opt-in cache inventory telemetry
Adapted from NyperYuhgard's PR #13.

Co-authored-by: NyperYuhgard <93950153+NyperYuhgard@users.noreply.github.com>
2026-07-14 10:19:54 -07:00
Matthew Stanley 7d1fadb07c runtime: report simulated-vblank FPS telemetry
Adapted from NyperYuhgard's PR #13.

Co-authored-by: NyperYuhgard <93950153+NyperYuhgard@users.noreply.github.com>
2026-07-14 10:19:50 -07:00
Codex dbaebaf37a Expose analog input through debug controls
Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-14 10:01:12 -07:00
Codex 1211d09bf7 Expose existing debug server commands in the client
Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-14 10:01:01 -07:00
Matt Stanley e23042f82b Merge pull request #24 from mstan/audit/ecosystem-2026-07-13
Document ecosystem fork audit and provenance policy
2026-07-14 00:12:09 -07:00
Matthew Stanley 95d9f47249 docs: record first-wave merges and approval 2026-07-14 00:11:36 -07:00
Matthew Stanley 098b06e047 Merge remote-tracking branch 'origin/master' into feat/reachable-main-discovery-douglas
# Conflicts:
#	docs/config_schema.md
#	recompiler/CMakeLists.txt
#	recompiler/src/main_psx.cpp
2026-07-14 00:09:56 -07:00
Matt Stanley f7d6bf2149 Merge pull request #22 from mstan/feat/config-guarded-mips-patches-douglas
Add config-driven guarded MIPS patches
2026-07-14 00:05:13 -07:00
Matt Stanley f88828327e Merge pull request #18 from mstan/fix/posix-overlay-export-scan-douglas
Load cached overlay exports on POSIX
2026-07-14 00:03:48 -07:00
Matt Stanley e94574a3d9 Merge pull request #21 from mstan/fix/msvc-generated-init-shaneomac
Add MSVC portability for runtime and generated startup
2026-07-14 00:03:44 -07:00
Matt Stanley a03350fb68 Merge pull request #23 from mstan/fix/overlay-init-guard-shaneomac
Guard overlay entry points before initialization
2026-07-14 00:03:41 -07:00
Matt Stanley 23edb88b68 Merge pull request #20 from mstan/fix/cdrom-encoded-interrupts-kem0x
Fix encoded CD-ROM interrupt mask matching
2026-07-14 00:03:38 -07:00
Matthew Stanley 6aebcb7ea3 docs: record four-game manual acceptance 2026-07-13 23:54:41 -07:00
Matthew Stanley 5431ce5698 docs: record framebuffer checkpoints and soak contention 2026-07-13 23:17:55 -07:00
Matthew Stanley 24f471d197 docs: record combined ecosystem regression soak 2026-07-13 23:10:04 -07:00
Matthew Stanley 4db04ad65e docs: record first ecosystem port wave
Add a durable upstream-derived work policy and record the seven focused draft PRs with exact implementation/source commits, validation, exclusions, and review gates.
2026-07-13 22:02:15 -07:00
Matthew Stanley e7b61c807c recompiler: add guarded config MIPS patches
Add alias-aware, opcode-verified game-owned instruction replacements before discovery and code generation. Validate duplicate IDs and physical sites, preserve guarded overlay variants, and cover parser and generated-code behavior with CTest.

Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-13 21:59:18 -07:00
Matthew Stanley bd705bfcec Add bounded reachable main-EXE discovery
Adapt Douglas's opt-in reachable discovery onto current exact/static dispatch. Validate configured static-analysis bounds before truncation, preserve the whole-image default and canonical page reservations, and leave unresolved indirect or out-of-bound targets to runtime fallback.

Source: https://github.com/douglasjv/mm8

Source-commit: https://github.com/douglasjv/mm8/commit/8415f3a95458c41c7f48fbe36caaf0ee82730720

Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-13 21:56:43 -07:00
Matthew Stanley c0fa9b1e89 overlay: load cached exports on POSIX
Port Douglas Vanderveer's manifest-driven macOS/Linux overlay discovery onto the current cache index and exact-dispatch loader. Validate both filename key fields, preserve ABI cleanup and rescan idempotence, and cover the POSIX primitives with a real shared-library fixture.

Co-authored-by: douglasjv <vanderveerdouglas@gmail.com>
2026-07-13 21:52:25 -07:00
Matthew Stanley 5b8098a9d9 runtime: guard overlay loader before initialization
Adapt only the fail-closed overlay lifecycle checks from mstan/psxrecomp#16 commit e6809ccf7d. Add a focused structural regression test and record the excluded dirty-interpreter and game/runtime work.

Co-authored-by: Martin Penkava <mpenkava1337@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 21:48:39 -07:00
Martin Penkava 05d4f35bd6 build: MSVC portability for runtime and generated code
- psx_cyc.h / psx_cycles.c: _BitScanForward/_BitScanReverse shims for
  __builtin_ctz/__builtin_clz under _MSC_VER
- full_function_emitter.cpp / main_psx.cpp: emit a portable .CRT$XCU
  init-pointer instead of GCC-only __attribute__((constructor)) in
  generated dispatch/game code
- main.cpp: declare cross-language globals extern "C" so MSVC links
  them against their C definitions (no-op for GCC/Clang)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 21:47:40 -07:00
Matthew Stanley 76ddcc008a test(spu): pin END-only voice mute semantics
Document the overlap with kem0x PR #14 and explicitly record the game-specific and unrelated changes excluded from this branch.

Co-authored-by: Kareem Olim <kareemolim@gmail.com>
2026-07-13 21:40:11 -07:00
Matthew Stanley 52eb8e8a24 Fix encoded CD-ROM interrupt mask matching
Adapt the CD interrupt mask/status comparison from kem0x PR #14 and centralize it in a tested helper. The HC05 exposes numeric INT1..INT5 reasons but gates the line with a direct mask/status AND, so the common 0x07 mask must also pass INT4 and INT5.

Source: https://github.com/mstan/psxrecomp/pull/14

Source-commit: https://github.com/mstan/psxrecomp/commit/dd9e5c65073dd41fbac2d965d2f945a866ec59e2

Co-authored-by: Kareem Olim <kareemolim@gmail.com>
2026-07-13 21:38:58 -07:00
Matthew Stanley 6aada214e8 docs: add ecosystem fork watch ledger 2026-07-13 21:30:13 -07:00
Matthew Stanley c94fcd5e1a docs: add COMPILING_OVERLAYS how-to (overlay_captures.json -> shards)
User-facing guide for turning overlay_captures.json into native code:
developer-first framing (ship a full gcc cache), the manual gcc cache
build, the --static bake-into-binary path, and the staleness guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 14:19:16 -07:00
Matthew Stanley fb585541ec opengl: sustain full-rate gameplay and FMV presentation 2026-07-11 14:07:17 -07:00
Matthew Stanley 264f00cee5 widescreen: native-wide flat/phase backdrop gates + FMV silent-hold (Tomba 2 Beach Town)
- [widescreen] nw_flat_backdrop: in the native-wide mirror only, stretch
  untextured flat primitives across the wide output (flat-colour sky/water
  backdrops). Canonical 4:3 framebuffer stays byte-for-byte untouched.
- [widescreen] nw_phase_backdrop: stretch textured prims emitted before the
  frame first shaded 3D primitive (authored 2D backdrop phase), isolating
  the sky from the textured 3D foreground. Both runtime-only, off by default,
  title-opted (draw ordering is title-specific).
- [video] fmv_skip_no_xa_hold (4..3600 vblanks): presentation-side
  fast-forward latch after the last silent MDEC decode, so auto-skip covers a
  preloaded logo authored post-decode wait (Whoopee Camp logo). Guest
  timeline unchanged; default stays the generic 4-vblank hysteresis.
- ws_dbg_stretch correlation modes 7 (all prims) / 8 (all flat prims).
- fmv_state: JSON-escape config_path + report fmv_skip_no_xa_hold.

Validated on Tomba 2: Release build, unattended first-attract captures at
4:3 / 16:9 / 21:9, zero unknown dispatches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 13:45:23 -07:00
Matthew Stanley 77d036bfb6 docs: production-friendly contributor docs + declutter root
Make the repo approachable for outside contributors and an IDE integrator:

- New contributor docs:
  - docs/EXECUTION_MODEL.md — semi-technical tour of the static / native-overlay
    / interpreter execution model and how coverage gaps get plugged.
  - docs/ARCHITECTURE.md — component-level view (recompiler, runtime, LLE+HLE
    BIOS, overlay backend static->gcc->tcc, renderers, oracle model).
  - docs/BUILDING.md — accurate dependency table, per-platform prereqs, build
    steps, and the submodule + local-junction framework-linking setup.
  - CONTRIBUTING.md — distilled core rules, verification expectations, PR flow.
- Declutter root: move ~14 internal dev-logs into docs/internal/ (history
  preserved via rename) with an index README; repoint CLAUDE.md references.
- README: correct build recipe, LLE+HLE + overlay-backend summary, links to the
  new docs.
- code_provider.c: update the stale backend comment to the real static->gcc->tcc
  resolution (dead SLJIT.md reference removed).
- config_schema.md: drop the obsolete "once Phase A2/A3 ships --config" note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:25:16 -07:00
Matthew Stanley d3034f9fc2 Merge branch 'master' into wt/tsumu
# Conflicts:
#	runtime/src/memory.c
2026-07-06 15:33:41 -07:00
Matthew Stanley 38d1902c2b chore: remove game-specific Kula World content from framework repo
Games live in their own repositories in this project (TombaRecomp,
MegaManX6Recomp, ...); the framework holds only the shared recompiler +
runtime, never a game's config/assets. A contributor PR landed Kula World
(SCES-01000) game files directly in the framework, which is inconsistent
with that layout — that content belongs in the contributor's own game
repo. Remove it:

  - games/kula/{game.toml,seeds.txt}
  - docs/kula-world-findings.md, docs/{MACOS,WINDOWS}_BUILD_KULA.md
  - docs/assets/kula-world-*.png
  - README "This fork — Kula World" + macOS branding sections
  - runtime/CMakeLists.txt kula-runtime target

The general framework improvements those commits also carried are KEPT
(they benefit every game): KUSEG-addressed PS-X EXE header acceptance,
dirty-RAM interpreter interrupt-poll-at-entry, main-RAM 4x mirror /
GetID-from-serial / CD-status / CD-version fixes, and the Linux/macOS
POSIX ports. Source comments citing Kula as the motivating case are left
in place as provenance.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 14:53:47 -07:00
Matthew Stanley 60801820fd cleanup: genericize hardcoded dev-machine paths in tracked docs/tools
Replace absolute F:/C: paths with repo-relative (../TombaRecomp, bios/, beetle-psx/)
or placeholders (<desktop>/<psxref>/<nesrecomp>/<psxrecomp-v4>) across accuracy docs,
WIDESCREEN/SHADOW/RECURSION_BUG/config_schema/ISSUES/README, and tools/*.py|.ps1.
Removed a personal C:\Users\Matthew\Desktop path (ISSUES.md). Left CLAUDE.md/PLAN.md
sibling-project + version-history paths intact (intentional layout documentation).
2026-07-06 11:51:36 -07:00
Matthew Stanley 9b54441a8a repo cleanup: drop 16 stale handoff/overnight/resolved-bug docs; untrack scratch scripts + test binaries
Deleted dated session-scratch (HANDOFF*, OVERNIGHT*, SUMMARY*) and resolved-bug
writeups (memcard audit, Tomba2 attract/FMV/Whoopee, codex analysis, load4 wedge
superseded). KEPT docs still cited by canonical docs/source (RECURSION_BUG,
WEDGE_load4, CASE_A_AOT_GAP) and all current subsystem-design docs.
Untracked (gitignored, kept on disk): tools/_options_session/ (80 scratch scripts
w/ hardcoded paths) + runtime/tests/*.exe (build artifacts; .c sources stay).
Genericized sibling-project absolute paths in bios_hle.h + crash_trace.c; fixed
README link CURRENT_STATE->FAITHFUL_TIMING_PLAN.
2026-07-06 11:34:35 -07:00
Matthew Stanley 13d84d2f7b Merge branch 'pr9-kula' into merge-pr9
# Conflicts:
#	runtime/src/beetle_libretro.cpp
#	runtime/src/dirty_ram_interp.c
#	runtime/src/memory.c
2026-07-06 10:59:27 -07:00
Matthew Stanley c6d12d76cd docs: Appendix Z — full 37-entry vram_patch coverage + palette-family notes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 01:51:23 -07:00
Matthew Stanley d78e7a784f text_xlate: [[vram_patch]] pre-rendered-strip layer + GP0-ring builder attribution
Two interlocking pieces from the Tsumu HUD/menu-label investigation:

- GP0 ring builder attribution (gpu.h/gpu.c/debug_server.c): op-0x80
  entries now carry a bounded guest-stack unwind (bld[6]) + copy-time
  $sp (csp); gpu_frame_dump emits func/ra per entry and csp+bld[] for
  copies. This cracked the HUD compose: whole label strips are
  MoveImaged from the glyph sheet (src 834/852,352 -> HUD cache y=32).

- [[vram_patch]] (text_xlate.cpp/.h + gpu.c hook): third translation
  layer for text that exists only as pre-rendered pixels in an
  uploaded texture asset (Tsumu HUD labels, menus, prompts live in
  the glyph-sheet image; the 144-glyph font has no katakana at all).
  On every GP0 0xA0 upload completion the configured rects are
  verified halfword-for-halfword against expected JP pixels and only
  then rewritten with the target-language pixels via the renderer
  facade (software/GL/supersample coherent). Re-applies on every
  re-upload; verify-fail leaves foreign assets untouched. Debug:
  xlate stats gains vram_patches/vram_applied; new "vpatch"
  force-apply subcommand for config iteration without rebuild.

Verified on-screen: HUD "STAGE: 1-1 / BATTERY: 100", pause menu
(CONTINUE/RESTART/GIVE UP/CHANGE CONTROLS, TARGET BATT), title-menu
strips. docs/STRING_TRANSLATION.md Appendix Z documents the model,
mechanism, authoring recipe, and remaining strip backlog.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 01:41:42 -07:00
Matthew Stanley 4806096cde docs: HUD reachability blockers (empty saves, static demo HUD)
Records the LOAD-GAME attempt outcome and why the HUD can't be finished
headless: both memcards are empty (0 used blocks) so LOAD GAME reaches no
stage; NEW GAME still hits the intractable name grid; and the attract
demo's HUD is composed once at stage-load and only displayed (never
per-frame-drawn as glyph quads in the full 554-3754 GP0 capture; its
values are static so there is no dynamic draw to intercept). The drawer
(0x8005443C) + font-tile scheme are cracked; capturing the HUD label's
own glyph quads needs real gameplay (dynamic HUD) reachable only via a
real save or driving past the name grid on an interactive build. No hook
shipped (no discriminator captured -> would risk non-HUD quads; Rule 5).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 18:30:16 -07:00
Matthew Stanley 7627978b8c docs: pin the per-glyph text drawer (0x8005443C) for the HUD remap
Live GP0-ring capture (on the name-entry screen, same per-glyph drawer
class as the HUD) cracked the mechanism for the eventual HUD index-remap:

- Drawer PC 0x8005443C draws one textured 0x2C quad per glyph via direct
  GP0, building prims in game RAM ~0x80092xxx; U,V into texpage 0x1E
  selects the font tile (CLUT 0x7C10).
- Texpage 0x1E holds hiragana AND Latin (the name-entry grid draws A-Z
  through this same drawer), so the Latin tile U,Vs the remap needs are
  readable straight off the grid's letter quads.
- Remaining blocker: catch the HUD's own stage-load compose to get its
  katakana source prims, then rewrite their U,V to Latin tiles (or hook
  0x8005443C to remap HUD-position glyph quads). Gated only on reaching a
  fresh stage-load (blind grid-confirm navigation didn't land headless; a
  reachable build clears it). No fragile partial shipped (Rule 5).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 18:12:32 -07:00
Matthew Stanley 4c19677b9e docs: CLEAR!! already English + HUD render model (GP0-ring evidence)
Corrects and refines the Bucket-1/3 findings with live GPU evidence:

- CLEAR!! banner: ALREADY renders in stylized Latin ("CLEAR!!") — verified
  on-screen in a gameplay stage. Not Japanese; no translation needed. The
  earlier "resister/baked-sprite" assumption was wrong.

- In-game HUD (ステージ/バッテリー): pinned the render model via the always-on
  GP0 ring (gpu_frame_dump). The game composites — ~6 draw prims/frame,
  rebuilding only the animated foreground (character/blocks, ~8 textured 0x2C
  quads at screen y>=31, via BIOS DMA from an OT at ~0x138xxx). The HUD (screen
  y~8) is composed ONCE at stage-load, not per-frame, and has no static SJIS
  source (RAM-scan proof). Remapping it needs catching that stage-load compose
  (a fresh stage load while observing) and a scoped blit/tile intercept — not a
  source-patch. NOT shipped: no clean pixel-verified remap this pass, and a
  blanket VRAM font swap would corrupt katakana elsewhere (Rule 5, no hacks).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 18:07:42 -07:00
Matthew Stanley 938fc26f17 docs: per-glyph coverage pass — shipped labels + composed-HUD/CLEAR resisters
Records the outcome of the per-glyph translation pass (Buckets 1-3):

- SHIPPED: stage/level/tutorial names (source-patch, f00631e/31ab3c2);
  name-entry prompt -> "YOUR NAME?" (source-patch, 31ba92d); name-entry
  Latin input confirmed NATIVE (grid already draws the font's A-Z/0-9).

- RESISTERS (not shipped, no fake): the in-game HUD (ステージ/バッテリー)
  and the CLEAR!! banner are composed per-glyph at runtime with NO static
  source address. Proven: a live 2 MB RAM scan finds ステージ/バッテリー
  only inside static message sentences (never a standalone HUD label,
  no ステージ: template); クリア/CLEAR/CLEAR exist nowhere as a
  standalone banner; and every disc graphic TIM was extracted+rendered —
  the only baked text is the already-English TSUMU light logo. So the
  source-patch (which needs a static address) cannot reach them; they
  require the scoped per-glyph sprite-draw index-remap hook (Appendix Y),
  a separate larger effort. Includes the full disc asset map.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 17:49:17 -07:00
Matthew Stanley b0f8a8518c docs: per-glyph text investigation (font index map, label storage, hook design)
Records the concrete findings for the deferred per-glyph HUD/menu/title
localization: the font glyph-index map (Latin A-Z=73-98, 0-9=105-114;
fullwidth Latin glyphs present, no injection needed), the static LE-SJIS
label storage in fixed-width space-padded slots (level names 0x80070755+,
tutorial/mode labels 0x80070300+), and the cleanest hook design (load-time
source patch: rewrite a label's katakana/hiragana SJIS to fullwidth-Latin
so the existing per-glyph routine draws English).

Not shipped: the verification bar is a rendered-English screenshot, and the
target screens (mode/level-select, in-game HUD) are unreachable in the
headless build — the attract never auto-plays the demo, and reaching them
needs completing the name-entry glyph grid (blind grid nav to the "End"
cell did not land). Committing a RAM-patch without that screenshot would be
unverified coverage. Remaining resisters (HUD runtime counter; title/CLEAR
sprites) documented.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 15:29:56 -07:00
Matthew Stanley d24d660774 docs: coverage status - 138-entry message table + reader limitation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 13:52:32 -07:00
Matthew Stanley c72e36d10e docs: record Phase-0 empirical findings for string translation
Fold the hard-won runtime findings into STRING_TRANSLATION.md: the
message-table text is little-endian 16-bit Shift-JIS (EXE menu labels are
big-endian); FE-FF/FF-FF/30-FC control framing; message text is
string-pointer-drawn (interceptable) but HUD/title/menu are per-glyph
sprites (need a separate glyph-index hook); struct-embedded NUL records
crash if replaced (apply gated to 0xFFFF-framed messages by default);
capture quality gate; verification status; open items for full coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 12:19:53 -07:00