Skip to content

Neo Geo CD port onto upstream's Neo Geo refactor - #346

Merged
pwnedbygary merged 4 commits into
masterfrom
ng/upstream-refactor-2026-11
Nov 6, 2026
Merged

pwnedbygary merged 4 commits into
masterfrom
ng/upstream-refactor-2026-11

Conversation

@pwnedbygary

Copy link
Copy Markdown
Owner

Finishes the Neo Geo half of the ares merge that PR #344 left deferred.

Upstream ares moved Neo Geo ROM assembly into mia (Arcade.bml) and decryption/protection into runtime cartridge boards. After the merge Phobos's old medium still looked for the deleted Neo Geo.bml, so AES/MVS did not load on a clean tree (the phone only worked because of an old database in its files directory, now fixed by #345).

This takes upstream's medium and board set (rom/cmc/sma/pvc/pcm2/k2k2/fatfury2/kof98/mslugx/jockey-gp) and ports Phobos's Neo Geo CD onto the new system/cartridge API: CDD/CDC/DMA, CD sprite and fix-layer decode, upload registers, CD state format, plus upstream's uPD4990A RTC, shared DIP switches and arcade controls.

Two non-obvious fixes were needed:

  • Scheduler: the Neo Geo core keeps Phobos's single global Scheduler. Upstream's per-core Scheduler only exists in the cores migrated with it; a local instance shadows the global one and leaves the Z80 and other threads unscheduled, so the CD BIOS hung waiting for the sound handshake.
  • CD interrupts: the CD BIOS takes vblank on vector 2 and the timer on vector 1; its VBL line stays asserted while its enable bit is set (level-triggered), and REG_IRQACK sets pending flags on a 1 and leaves them alone on a 0. Non-CD keeps the previous model.

Verified on the RP6: AES Alpha Mission II and Garou - Mark of the Wolves boot and render at 59.2 fps (Garou exercises the new runtime decryption); Neo Geo CD Real Bout Fatal Fury loads from CHD through NOW LOADING to the title menu at 59.2 fps.

Host: tests/ngcd 2835 checks / 0 failures, tests/psp 675 groups / 0, tests/psp/ares 423 / 0, desktop all-core CMake build, 688 Android unit tests. The Arcade-database art test now expects ares's full Arcade list instead of the old 18-game one.

Limits: pad input beyond the AES coin counter was not verified end to end; the controller code is unchanged from master, so Neo Geo pad mapping stays a separate follow-up. CD saves keep the shipped v136 format.

Phobos Agent added 4 commits November 6, 2026 17:21
CD memory/state port compiles and passes tests/ngcd (2835/0), and the desktop build passes for every core, but
the device clears it: Neo Geo AES renders corrupted graphics and Neo Geo CD shows no picture. Upstream's
refactored media path (mia/medium/neo-geo.cpp plus the new board classes) expects Neo Geo ROM-region data that
this ares snapshot's Arcade.bml does not carry for most carts (only BIOS lists), so the assembled ROMs are
wrong; Phobos's medium did its own assembly/decryption on top of the old boards. Kept for reference, not for
merge.
…, diagnostics

Progress on the port: use Phobos's global scheduler (upstream's per-core scheduler refactor was not merged into
Phobos; the local Scheduler shadowed it and left the Z80/other threads unscheduled - AES carts now boot).
Restore the CD interrupt level swap (timer -> vector 1, vblank -> vector 2) that upstream's CPU::main lacks, and
take upstream's acknowledge semantics (writing a 1 sets the pending flag; a 0 does not clear it). Neo Geo CD still
stops early in its BIOS: no vblank IRQ is delivered and the Z80 idles at PC 0x138 with communication.output 0, so
the next step is to port the rest of upstream's LSPC interrupt model and trace the CD Z80 handshake. Contains
temporary android logging throughout ares/ng and mia/medium/neo-geo.cpp.
Take upstream ares's Neo Geo media/board refactor (Arcade.bml assembly plus runtime cartridge decryption) and port
Phobos's Neo Geo CD onto it: CDD/CDC/DMA, CD sprite and fix-layer decode, upload registers and the CD save format run
on the new system/cartridge API, with upstream's uPD4990A RTC, DIP switches and arcade controls.

The Neo Geo core keeps Phobos's single global scheduler: upstream's per-core Scheduler only exists in the cores
migrated with it, so a local instance left the Z80 and the other threads unscheduled and the CD BIOS hung waiting for
the sound handshake. CD interrupts are wired the way the CD BIOS expects (vblank on vector 2, timer on vector 1, a
level-triggered VBL and set-only REG_IRQACK pending flags); non-CD keeps the old behaviour.

Verified on the RP6: AES (Alpha Mission II, Garou) and Neo Geo CD (Real Bout Fatal Fury, CHD to title menu) both run
at 59.2 fps. Host: tests/ngcd 2835/0, tests/psp 675 groups/0, tests/psp/ares 423/0, desktop CMake build, 688 Android
unit tests. The Arcade database test now expects ares's full Arcade list instead of the old 18-game one.
@pwnedbygary
pwnedbygary merged commit d5c6d54 into master Nov 6, 2026
6 checks passed
@pwnedbygary
pwnedbygary deleted the ng/upstream-refactor-2026-11 branch November 6, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant