Skip to content

ares-headless#2467

Draft
awsms wants to merge 9 commits into
ares-emulator:masterfrom
awsms:feat/ares-headless
Draft

ares-headless#2467
awsms wants to merge 9 commits into
ares-emulator:masterfrom
awsms:feat/ares-headless

Conversation

@awsms

@awsms awsms commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

headless target; WIP.

awsms added 9 commits March 4, 2026 22:05
Add a headless target for running ares without the desktop UI
stack. This introduces a separate executable wired directly against
ares, mia, and nall, and makes it possible to launch content from the
command line without depending on ruby, hiro, or the desktop frontend.

To support that, add an ARES_BUILD_DESKTOP_UI option at the top level so
GUI dependencies can be disabled for headless-oriented builds. Also make
mia-ui conditional on hiro actually being present, so optional-target
builds still configure correctly when the desktop UI is turned off.

The headless build loads media through mia, derives a default system and
profile from the detected medium, connects default media and controller
ports, and runs the emulation loop until completion criteria are met.

Initial CLI support includes:
- --system to override medium detection
- --benchmark for.. benchmarks
- --run-frames for fixed-length execution
- --video-checksum to print the final frame hash
Expand the initial nogui into something much closer to a usable
automation and tooling interface.

Add save state loading and saving, including optional slot parsing and
save-on-exit behavior, and extend nall::Arguments with takeOptional() so
flags that accept an optional value can be handled cleanly.

Introduce launch/settings parsing in a dedicated settings module. This
adds support for --settings-file and --setting name=value overrides, and
plumbs selected values into runtime behavior. The settings layer also
reads default save paths from settings.bml so the headless target can
follow the same general save-location conventions as the desktop UI.

Add several runtime CLI features:
- --save-state with optional slot selection
- --save-on-exit with optional slot selection
- --save-last-frame to export the final rendered frame as PNG
- --quiet / --verbose / --verbosity for log control
- embedded GDB server configuration via launch settings
Refactor the headless target to break up the monolithic main source
file into smaller, focused translation units. The previous single-file
implementation had grown to include CLI parsing, numeric parsing
helpers, runtime/platform callbacks, savestate handling, PNG output etc
in one place, which made it harder to read and extend.

Introduce dedicated modules for:
- cli: command-line parsing and usage text
- parse: shared integer parsing helpers
- runtime: the ares::Platform implementation and frame/audio/input hooks
- states: save-state path resolution and serialization helpers
- video-output: frame resizing and PNG encoding helpers
This adds CLI options to dump mixed audio to WAV and to print the run's
audio checksum. Also extends the headless runtime to enumerate
audio streams, mix pending samples, and canonicalize the captured output
as stereo 16-bit PCM.

To improve reproducibility, the runtime now stabilizes node ordering for
audio/video enumeration, aligns audio draining with the run loop exit
boundary and forces a fixed RNG seed for headless runs, so cores that
randomize boot-time audio state do not vary between runs.
Reuse the desktop settings.bml firmware mapping in headless mode.
That way, systems requiring a BIOS to boot can resolve their configured
firmware locations without a separate headless-only configuration.

Also fix Mega Drive-family pak routing in the headless runtime so
they resolve the correct paks instead of the wrong backing data.
@awsms awsms force-pushed the feat/ares-headless branch from 6361a50 to fc44d45 Compare March 20, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant