You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update CLAUDE.md with C89 rules, testing, and CD docs
Add C Language Standard section documenting the C89/GNU89
requirement and local lint command. Update stale "no test suite"
line, add Jaguar CD, Testing, and expanded Key Directories sections.
Made-with: Cursor
Copy file name to clipboardExpand all lines: CLAUDE.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,28 @@ Output binary name varies by platform:
20
20
- Linux: `virtualjaguar_libretro.so`
21
21
- Windows: `virtualjaguar_libretro.dll`
22
22
23
-
There is no test suite. CI runs `make -j4` on Ubuntu (GCC) and macOS (Clang).
23
+
CI runs `make -j4` on Ubuntu (GCC) and macOS (Clang), plus screenshot regression tests via `test/regression_test.sh`. See `docs/test-infrastructure.md` for the full test harness inventory.
24
24
25
25
## Architecture
26
26
27
+
### C Language Standard — C89/GNU89
28
+
29
+
This codebase **must** compile as C89 (GNU89 dialect). The libretro buildbot uses MSVC on Windows, which enforces C89 strictly. CI includes a `c89-lint` job that catches violations.
30
+
31
+
**Rules:**
32
+
-**No mid-block variable declarations.** All variables must be declared at the top of their enclosing block (function or `{}`), before any statements. This is the most common violation.
33
+
-`//` comments are allowed (GNU89 extension), but `/* */` is preferred for new code.
34
+
- No C99 features: no `for (int i = ...)`, no compound literals, no designated initializers, no VLAs.
35
+
- SIMD files (`src/blitter_simd_sse2.c`, `src/blitter_simd_neon.c`) are exempt from the lint check since they require platform-specific headers.
36
+
- Machine-generated files (`src/m68000/*`) are also exempt.
-`docs/` — original Virtual Jaguar documentation, changelog, known issues
77
+
-`docs/` — documentation: changelog, known issues, BUTCH register map, CD data flow, test infrastructure
78
+
-`test/tools` — test scripts and headless front-ends
79
+
-`test/roms` — test ROMs; `private/` subdirectory has commercial ROMs and BIOSes
60
80
61
81
### Build System
62
82
63
83
`Makefile` handles 30+ platform targets with auto-detection. `Makefile.common` lists all source files. Platform is selected via `platform=` variable or auto-detected from `uname`. Key flags: `-D__LIBRETRO__`, `-DMSB_FIRST` for big-endian platforms.
64
84
85
+
### Jaguar CD Emulation
86
+
87
+
CD support is implemented across `src/cdrom.c` (BUTCH chip / FIFO / DSA commands), `src/cdintf.c` (disc image loading: CUE/BIN, CHD, CDI), and hooks in `src/jaguar.c` (BIOS auth bypass, boot stub injection).
88
+
89
+
Key docs:
90
+
-`docs/butch-registers.md` — full BUTCH register map ($DFFF00-$DFFF2F) with bit definitions
91
+
-`docs/cd-data-flow.md` — how CD data moves from disc to RAM (I2S -> FIFO -> GPU ISR -> RAM), BIOS code map, boot stub layout
92
+
93
+
### Testing
94
+
95
+
See `docs/test-infrastructure.md` for all test harnesses:
96
+
-`test/headless.py` — Python headless runner via libretro.py (screenshots, frame control)
97
+
-`test/regression_test.sh` — screenshot regression suite with baseline comparison
98
+
-`test/test_cd_boot.c` — low-level C harness with dlsym access to 68K registers and RAM
0 commit comments