Skip to content

Commit a512f03

Browse files
committed
HLE CD boot: multi-phase sentinel scan + pass Highlander
The HLE CD_read sentinel scan now iterates across every session-2 track when the scan from the boot-stub-supplied LBA misses, with a single-match fallback for ASCII-tagged sentinels (CODE/STUB/SCOR/TITL). Many discs (Highlander, Battle Morph, BrainDead 13) supply MSF values that point to session-2 lead-in instead of game data; scanning each session-2 track in order locates the sync block reliably. Also: * CD_poll now reports A0 = end+4 (matching the real GPU CD ISR which pre-decrements before each long write), unblocking cmp+bge polling idioms used by Highlander. * Boot stub buffers bumped from 256KB to 600KB to fit Battle Morph's ~414KB stub; both the cdintf raw-sector buffer and the jagcd_hle injection buffer kept in lockstep. * New cdintf accessors: CDIntfGetSession2FirstTrackLBA(), CDIntfGetSession2TrackCount(), CDIntfGetSession2TrackLBA(i). * Test harness test/test_cd_hle_boot.c discovers all .cue/.iso/.cdi under VJ_TEST_CD_ROOT (defaults to test/roms/private), runs each through 300 frames, and asserts PC stays in RAM, escapes self-loops, and visits more than a handful of unique addresses. Defaults to cue-only via VJ_TEST_CD_EXTS. * CHD support removed (libchdr deps deleted, .info dropped chd ext). * test_hle_bios test cd_poll_a0_advances_past_end_after_read renamed + assertion updated to match the end+4 contract. Current CUE baseline: 4 PASS / 5 FAIL. PASS: Battle Morph, Dragon's Lair, Highlander, Space Ace. FAIL: Baldies, BrainDead 13, Hover Strike, Iron Soldier 2, Primal Rage (all blocked on GPU CD ISR streaming or post-load downstream waits). Made-with: Cursor
1 parent af4e037 commit a512f03

75 files changed

Lines changed: 1196 additions & 60838 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ test/test_blitter_simd
2424
test/test_cd_boot
2525
test/*.dSYM/
2626

27-
# One-off tools
28-
chd_dump
29-
chd_dump.c
30-
3127
# Private test ROMs
32-
test/roms/private/*
28+
# test/roms/private/*
3329
!test/roms/private/.gitkeep
3430
!test/roms/private/README.md
31+
/test/test_cd_hle_boot
3532
/test/test_dsp_instructions
3633
/test/test_gpu_instructions
3734
/test/test_hle_bios

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Core options defined in `libretro_core_options.h` control blitter mode, BIOS usa
6666

6767
### Jaguar CD Emulation
6868

69-
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).
69+
CD support is implemented across `src/cdrom.c` (BUTCH chip / FIFO / DSA commands), `src/cdintf.c` (disc image loading: CUE/BIN, ISO, CDI), and hooks in `src/jaguar.c` (BIOS auth bypass, boot stub injection).
7070

7171
Key docs:
7272
- `docs/butch-registers.md` — full BUTCH register map ($DFFF00-$DFFF2F) with bit definitions

Makefile

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ ifeq ($(platform), unix)
6262
# Platform affix = classic_<ISA>_<µARCH>
6363
# Help at https://modmyclassic.com/comp
6464

65-
# (armv7 a7, hard point, neon based) ###
66-
# NESC, SNESC, C64 mini
65+
# (armv7 a7, hard point, neon based) ###
66+
# NESC, SNESC, C64 mini
6767
else ifeq ($(platform), classic_armv7_a7)
6868
TARGET := $(TARGET_NAME)_libretro.so
6969
fpic := -fPIC
@@ -88,13 +88,16 @@ else ifeq ($(platform), classic_armv7_a7)
8888
LDFLAGS += -static-libgcc -static-libstdc++
8989
endif
9090
endif
91-
#######################################
92-
91+
#######################################
92+
9393
# OSX
9494
else ifeq ($(platform), osx)
9595
TARGET := $(TARGET_NAME)_libretro.dylib
9696
fpic := -fPIC
9797
SHARED := -dynamiclib
98+
CFLAGS += -Ofast
99+
CXXFLAGS += $(CFLAGS)
100+
HAVE_NEON = 1
98101
ifeq ($(arch),ppc)
99102
FLAGS += -DMSB_FIRST
100103
OLD_GCC = 1
@@ -123,6 +126,10 @@ else ifneq (,$(findstring ios,$(platform)))
123126
fpic := -fPIC
124127
SHARED := -dynamiclib
125128
MINVERSION :=
129+
CFLAGS += -Ofast
130+
CXXFLAGS += $(CFLAGS)
131+
HAVE_NEON = 1
132+
126133
ifeq ($(IOSSDK),)
127134
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
128135
endif
@@ -577,7 +584,7 @@ CXXFLAGS += $(FLAGS)
577584
CFLAGS += $(FLAGS)
578585

579586
OBJOUT = -o
580-
LINKOUT = -o
587+
LINKOUT = -o
581588

582589
ifneq (,$(findstring msvc,$(platform)))
583590
OBJOUT = -Fo
@@ -618,7 +625,7 @@ clean:
618625
TEST_CC ?= $(CC)
619626
TEST_CFLAGS = -O0 -g -Wno-incompatible-pointer-types
620627
TEST_LDFLAGS = -ldl
621-
TEST_BINS = test/test_gpu_instructions test/test_dsp_instructions test/test_m68k_instructions test/test_irq test/test_hle_bios test/test_blitter_simd
628+
TEST_BINS = test/test_gpu_instructions test/test_dsp_instructions test/test_m68k_instructions test/test_irq test/test_hle_bios test/test_cd_hle_boot test/test_blitter_simd
622629

623630
test/test_gpu_instructions: test/test_gpu_instructions.c test/test_framework.h $(TARGET)
624631
$(TEST_CC) $(TEST_CFLAGS) -o $@ $< $(TEST_LDFLAGS)
@@ -635,6 +642,9 @@ test/test_irq: test/test_irq.c test/test_framework.h $(TARGET)
635642
test/test_hle_bios: test/test_hle_bios.c test/test_framework.h $(TARGET)
636643
$(TEST_CC) $(TEST_CFLAGS) -o $@ $< $(TEST_LDFLAGS)
637644

645+
test/test_cd_hle_boot: test/test_cd_hle_boot.c test/test_framework.h test/cd_assertions.h $(TARGET)
646+
$(TEST_CC) $(TEST_CFLAGS) -o $@ $< $(TEST_LDFLAGS)
647+
638648
test/test_blitter_simd: test/test_blitter_simd.c src/blitter_simd.h $(TARGET)
639649
$(TEST_CC) -O2 -o $@ test/test_blitter_simd.c src/blitter_simd_neon.c
640650

@@ -653,12 +663,24 @@ test: test-build
653663
done; \
654664
exit $$fail
655665

666+
# CD HLE boot smoke suite — separated from `test` because it intentionally
667+
# carries a known-failing TDD baseline. CI / pre-commit should call `test`
668+
# (which stays green); developers iterating on CD HLE call `test-cd-hle-boot`
669+
# directly and diff against test/cd_hle_boot_baseline.log.
670+
test-cd-hle-boot: test/test_cd_hle_boot
671+
@echo ""; echo "=== CD HLE boot smoke (TDD baseline; not part of strict test) ==="
672+
@DYLD_LIBRARY_PATH=. LD_LIBRARY_PATH=. test/test_cd_hle_boot \
673+
> test/cd_hle_boot_baseline.log 2>&1; \
674+
rc=$$?; \
675+
grep -aE '\[(RUN|PASS|FAIL|CRASH|FOCUS-SKIP|SKIP|PC-)\]|Discovered|---' test/cd_hle_boot_baseline.log; \
676+
echo ""; echo "(full log: test/cd_hle_boot_baseline.log; rc=$$rc)"; \
677+
exit 0
678+
656679
clean-test:
657680
rm -f $(TEST_BINS) $(addsuffix .dSYM,$(TEST_BINS))
658681

659-
.PHONY: clean test test-build clean-test
682+
.PHONY: clean test test-build clean-test test-cd-hle-boot
660683
endif
661684

662685
print-%:
663686
@echo '$*=$($*)'
664-

deps/libchdr/.github/workflows/cmake.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

deps/libchdr/.github/workflows/cross-platform-actions.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

deps/libchdr/.github/workflows/msys2.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

deps/libchdr/.github/workflows/switch.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

deps/libchdr/.github/workflows/vita.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

deps/libchdr/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)