Skip to content

Merge upstream ares 05232171d (34 commits since 2026-09-22) - #344

Merged
pwnedbygary merged 35 commits into
masterfrom
merge/upstream-ares-2026-11
Nov 6, 2026
Merged

pwnedbygary merged 35 commits into
masterfrom
merge/upstream-ares-2026-11

Conversation

@pwnedbygary

Copy link
Copy Markdown
Owner

At the user's request: upstream ares 05232171d (2026-11-06), 34 commits past the fork point 4cb8d92b4, as a merge commit so the next sync starts from it.

Taken

  • PlayStation: timing/hardware accuracy overhaul, SIO FIFO and timing, GPU write FIFO/MDEC, SPU envelopes and CD-audio capture, textured-draw parallelism. Upstream rewrote peripheral/io.cpp; Phobos's older Ape Escape controller/memory-card workarounds are superseded and the game was checked on the RP6.
  • N64: the JIT commits its PC at every block (Phobos's Count/Compare fix stays).
  • SFC: CX4 accuracy, window edges latched per scanline. Atari 5200: ANTIC playfield DMA timing. Arcade/media: MAME loader rewrite (Phobos's basename member matching and mia::parentLocation() fallback kept), Python mamedb tooling, Sega System E, Neo Geo crypto moved.
  • Screen: configurable deinterlacing (Weave/Blend/Phosphor) beside Phobos's passthrough hand-off.

Deferred

  • Neo Geo cartridge/arcade refactor (AES/MVS option, centralized DIP switches, uPD4990A RTC module): the new board API requires porting Phobos's Neo Geo CD code, and the first attempt left Neo Geo CD on a white screen on the RP6 while AES cartridges played. The merged tree keeps the CD-capable Neo Geo core; a follow-up will port CD onto the new boards.

Checks

  • Desktop CMake build (every core): pass.
  • tests/psp/run-tests.sh: 675 groups, 0 failures.
  • tests/psp/ares/run-tests.sh: 423 checks, 0 failed.
  • tests/ngcd/run-tests.sh: 2835 checks, 0 failures.
  • Android assembleRelease and :app:testLegacyDebugUnitTest :app:testModernDebugUnitTest: pass.
  • RP6 (build 2.4.0-480): PS1 Ape Escape, N64 Conker's Bad Fur Day, Neo Geo CD Real Bout Garou boot and run at full speed; Neo Geo AES Alpha Mission II plays; PSP path unchanged (frame-300 byte-identical to the pre-merge runner).

Docs: docs/handoff.md "Upstream ares merge — 2026-11-06" and a row in docs/implementation-plan.md.

AkiteruSDA and others added 30 commits October 4, 2026 23:34
Ported directly from bsnes PRs 377 and 401.
- When triggering a cache preload by writing to $7f48, update the pb register with the prepared program page
- When preloading a page, ignore all runtime checks and reload the page immediately
- Step 1+WS on both reads for cache, not just one
- Remove extra cycle on bus reads/writes
- Remove extra cycle on DMA to internal RAM (fixes excessive slowdown in Morph Moth fight)
With FreeBSD 15.0 going EOL very soon, it is time to update the runner
in the CI to FreeBSD 15.1. This version is supported by Cross-Platform
GitHub Actions since version 1.3.0, and the runner is updated to the
currently newest version 1.6.0, which corresponds to the commit
cross-platform-actions/action@e0b9770.

Using the operating system's shell for running commands inside steps is
deprecated. Cross-Platform GitHub Actions provides and recommends the
new custom shell cpa.sh instead, which the runner is now using.

This requires to split the "Build: FreeBSD" step into at least one
separate step for setting up the VM before executing commands in the
following steps. This opens up the opportunity to be more in line with
the Linux runner by installing the build dependencies in its own step,
"Install FreeBSD Dependencies".

Before installing dependencies, the runner now updates the preinstalled
packages in the VM via pkg upgrade -y. This ensures that the whole VM is
cohesively up-to-date.

Last but not least, the TARGET_PRESET environment variable must be set
in the "Build: FreeBSD" step with the --environment-variables option of
cpa.sh, or else it won't be propagated to the build environment.
Latch the left and right edge matches independently until the next scanline, preserving the inclusive right edge. This prevents mid-line bounds writes from reopening a stopped window, as demonstrated by Mickey Magic and MiSTer SNES PR ares-emulator#508.

Serialize the latches and bump the SNES state format. Fixes ares-emulator#2645.
- more accurately model the CPU bus, write buffering and cache behavior
- improve DMA arbitration, chopping, transfer timing, and interaction with CPU
- rework CD-ROM command timing, deferred responses, interrupts, sector delivery, subchannel data, and disc session handling
- implement the GPU command FIFO, busy timing, texture caches, rasterization, and improve scanout accuracy
- improve timer synchronization, reset, interrupt, and blanking behavior
- improve peripheral, SPU, MDEC, and memory-mapped I/O timing
- add support for Datel Action Replay and Blaze Xplorer cartridges
- add support for the Pixel Accuracy toggle to enable per-pixel scanout (required by tajmiing demo)

These changes were validated against psxtest_cpx, psxtest_gpu, nocash diag.exe, JaCzekanski's tests, and the pcsx-redux CD-ROM torture tests.
Most of tests now pass, and known problematic games such as Monkey Hero are working.

Framebuffer output matches expected hardware output pixel-for-pixel in the nocash diagnostics and psxtest_gpu primitive tests.

Timer test results generally remain within a small margin of hardware baseline results (when compared against the psx.log reference point shipped with the tests)

psxtest_cpx and psxtest_gpu do not initialize controllers correctly when launched directly from the BIOS. You must run them them through software that initializes the hardware first, such as a Datel Action Replay or Blaze Xplorer cartridge. These devices can be configured in Core settings. This issue exists on real hardware and is correct behavoir.

ares can now run the tajmiing demo and all its effects end-to-end.

tajmiing changes display registers at individual-pixel boundaries, so it requires the Pixel Accuracy option in Video settings. Scanline-level synchronization remains the default as oridnary software does not depend on mid-scanline register changes.
A block can end before an instruction that has a gdb breakpoint. Its
last instruction can then be straight-line code, which does not commit
the pipeline PC. The block exited with ipu.pc at the last commit point,
so the CPU ran the instructions after that point a second time. If that
point was an internal entry of the same block, the CPU looped forever
and the breakpoint never hit.

Commit the pipeline PC on the last instruction of every block. All other
block ends already commit there, so code without breakpoints is
unchanged.
Rationale is that the clang64 ci is resulting in a build that drops as low as 40vps in FMV sequences in the PS1 core, vs 90vps in the same scene for clang-cl

Pinning a known-performant version of clang was considered (local testing proved clang22 produces more performant builds than clang20), but this is not viable with how msys2 is managed. Investigation concluded that we cannot reliably update the clang msys environment; just running 'update:true' breaks the build due to a ymfm issue with the clang23 runtime, and installing the 'clang22' packages still uses the clang23 runtimes, it only pins the compiler itself.
- prevent discarded polygons from counting in draw timing calculations
- fix depth mode changes applying one frame too late
- fix cd-rom stop command
- prevent MDEC output fifo from losing data when full and reduce output size to a more realistic 32 words-
nocash DIAG's hardware cache tests measure miss penalties of ~60 CPU
clocks for eight entries and ~120 clocks for sixteen entries. This is
approximately 12 GPU clocks per 8-byte refill.

We use 13 clocks here as it better fits JaCzekanski's GPU bandwidth
test; textured drawing timings now measure within ~1-2% of the hardware
baseline.
Weave (default): combines the current field with the previous field. this preserves detail but may introduce combing during motion. This is how ares behaved historically.

Bob: displays the current field and interpolates missing lines. This prevents motion combing but causes a noticable loss of vertical detail and may flicker thin lines.

Blend: displays an average of consecutive bobbed fields. Behaves similar to bob, but swaps flicker for motion blur.

Phosphor: displays only the currently displaying field while simulating phosphor decay. This Produces a darker image with visible scanlines and may flicker, but is closer to how a real CRT handles interlaced video.
Moon Patrol's HSCROL write was landing too early in ares, corrupting the mountains

Altirra Hardware Reference Manual was used to determine correct behavoir, which I believe to be trustworthy as the introduction specifies that "This document attempts to describe the hardware in detail as the target to which the emulator aspires to imitate"
To measure texture cache timing, textured draws previously waited for
the renderer to catch up before emulation could continue.

Now we wait only when the GPU becomes ready for another draw.

draw timing observed by the game is unaffected.
…rt for sg1000a encryption

Introduce a shared DIP switch implementation for arcade systems, replacing system-specific implementations.

Neo Geo:

Implement the NEC uPD4990A real-time clock.
Implement the MVS hardware watchdog.
Fix IRQ acknowledgement register handling to that only pending IRQs can be acknowledged
Move ROM decryption and protection handling into runtime PCB emulation, more closely reflecting the behaviour of original hardware.
Add support for additional protection schemes and game-specific memory mappers.

SG-1000A:

Add support for the encrypted Z80 variant used by Championship Wrestling.
Introduce separate opcode fetch and data read paths for the Z80, allowing accurate emulation of hardware-dependent decryption.

Portions of the ROM decryption and protection implementations are derived from MAME. Only code distributed under permissive licences, including the BSD 3-Clause License, has been incorporated.

All MAME-derived implementations are explicitly identified in the source code, with the applicable copyright notices and licence terms preserved in the project's LICENSE file.
Extend the existing per-system input override functionality to support game-specific controller mappings.

The intended workflow is for users to configure their Virtual Pad once. The Virtual Pad attempts to map inputs to each system's controller based on the physical position of its buttons.

Users can then customize mappings by adding overrides for specific inputs per-system, or per-game. Per-game overrides can only be configured while the relevant game is loaded.

ares attempts to strip common Disc, Disk, Side and Part suffixes from game titles, allowing multi-disc games to share the same input configuration.
This is essentially just a master system with two VDPs and an optional encrypted z80
The following are new behavoirs in the python tooling:

Extract DIP switch definitions, input mappings, and other metadata by parsing tables directly from the MAME source tree; this lifts metadata (such as dip switch names and bit-values and button labels) into Arcade.bml, no code is lifted.
Support custom overrides for information that is missing or insufficient in MAME's database.
Allow ROMs to be excluded from the generated database, including incomplete dumps, unsupported bootlegs, and non-game software.
Clearing DPC_FREEZE calls flushCommands even when END equals CURRENT. Previously, this set pipeBusy and startGclk without executing any commands, leaving an initially idle RDP reporting busy.

Return before setting the busy flags when no forward command range is available. Preserve existing busy state for starved pipelines and leave START/END latching unchanged.
it was responding but not actually turning the motor flag on.
LukeUsher and others added 5 commits November 3, 2026 13:34
Devices are now in charge of their own timing, fix Memory Card and Controller timing to be closer to hardware.

Fixes an infinite loop polling for memory cards in Ace Combat 3 (USA)
Fix envelope timing and key-on delay, jump to the repeat address on sample end.
Capture CD audio before volume processing,
Fix sign handling for cd-rom volume and pitch modulation

ref: https://psx-spx.consoledev.net/soundprocessingunitspu/
PlayStation timing/SIO/GPU/MDEC/CD-audio, the N64 JIT PC commit, SFC CX4 and window-edge fixes,
Atari 5200 ANTIC timing, the arcade media loader rewrite (Phobos's basename ROM matching and parent
fallback kept), deinterlacing modes in Screen (with Phobos's passthrough), and the Python mamedb
tooling. Neo Geo's cartridge/arcade refactor is deferred: its new board API needs Phobos's Neo Geo CD
code ported (the first attempt left Neo Geo CD white on the RP6 while AES cartridges played), so the
merged tree keeps the CD-capable Neo Geo core. Desktop CMake build, PSP 675/0, PSP-as-ares 423/0,
NGCD 2835/0 and the Android build pass; PS1, N64 and Neo Geo CD boot on the RP6.
@pwnedbygary
pwnedbygary merged commit 1ea5dd3 into master Nov 6, 2026
14 checks passed
@pwnedbygary
pwnedbygary deleted the merge/upstream-ares-2026-11 branch November 6, 2026 19:08
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.

9 participants