Skip to content

Latest commit

 

History

History
498 lines (417 loc) · 34.5 KB

upstream-differences.md

File metadata and controls

498 lines (417 loc) · 34.5 KB

XGrid core vs the xemu 0.8.139 baseline

This page documents the historical starting delta between the XGrid core in xemu/ and the pristine xemu 0.8.139 baseline in References2/xemu-0.8.139. XGrid's core now evolves separately from xemu, so this is a baseline record rather than a commitment to track upstream releases. It is a developer and advanced-user reference; the user-facing behavior is described in the guides.

References2/ is a read-only oracle. Compare against it, but never edit, move or clean it. The product source is the tracked xemu/ tree.

Baseline and provenance

Item Value
Upstream baseline xemu 0.8.139 in References2/xemu-0.8.139
XGrid core xemu 0.8.139 lineage + XGrid changes in xemu/, now evolving separately
Recorded upstream commit aa54c34cae1c09410d74c69a44210a9867fe2d16 (xemu/XEMU_COMMIT)
XGrid-native code xemu/xgrid-core/
Upstream edit record xemu/xemu-patches/ (retained patches 0007-0055; 49 files)
Ported arcade machine xemu/hw/xbox/chihiro/
Third-party notices THIRD_PARTY_NOTICES.md, docs/legal/licensing.md

The comparison below ignores build outputs (build/, dist/), downloaded Meson subprojects, documentation and line-ending-only differences. It is a source comparison, not a claim that every changed line is listed.

By the numbers

Measure Count
Existing upstream source/build files changed 60
Lines added/removed in those files about +6,225 / -209
Patch files in the current record 49
New Sega Chihiro files 34
Files under xemu/xgrid-core/ (including vendored libraries) 97

ui/xemu-input.c alone accounts for 2,720 added lines because it carries the Chihiro JVS, gun, card and force-feedback input paths as well as the shell pad hooks.

At a glance

Capability Upstream xemu 0.8.139 XGrid core
Process model Standalone XGridCore.exe / xemu Standalone binary plus xgrid_core.dll for in-process hosting
Shell integration None Embedding, four-pad input sink with rumble return, core-side filter/overlay, screenshots, H.264 MP4 recording with PCM audio (MJPEG AVI fallback) and instant replay, playback, snapshots and disc requests; a loopback control channel gives the separate process the same playback/snapshot/disc/memory-unit operations
Tooling None RAM-only guest memory read/write/hash for trainers, achievements, save editors and TAS tools; core-side .xgin input recording and replay over a save state
Media ISO/XISO and raw block images ISO/XISO, CHD, CCI and ZArchive drivers with XGD offset detection
Renderers OpenGL, Vulkan, NULL OpenGL, Vulkan, NULL; Vulkan keeps disk-backed SPIR-V and pipeline caches
Picture controls DAC palette and gamma only Final-blit brightness, contrast, saturation and gamma, integer scaling and overscan cropping selected by the shell
Input SDL keyboard/gamepad SDL plus the shell's four-port shared section; Chihiro JVS and light guns
Fast-forward Standalone emulation speed only 1–8× vblank pace and guest virtual-clock scale; the shell uses 4× and can reach both hosting modes
Save states Core snapshot UI Core snapshots exposed as four slots and a session state over the in-process ABI or the separate-process control channel
Memory cards No host-facing memory-unit API XMU attach/detach/list through the ABI and control channel, restored from [input.peripherals.*]; the shell creates, browses, imports, exports, organizes and deletes 8 MB FATX card entries
Machines Xbox Xbox plus Sega Chihiro media board, DIMM, JVS, cards and netboard
EEPROM profile Fixed North America / NTSC-M generation Region, language and video-standard profile applied to an existing EEPROM, preserving its keys and identity; the shell resolves the region from the disc's XBE certificate
Audio QEMU audio backends Backends plus DirectSound device GUIDs and the -audio-drivers probe
Build Upstream Meson options xgrid_vulkan, the xgrid-core subdir, the Windows DLL and Windows ARM64 build fixes

Current patch record

A later patch, 0057-ui-remove-imgui.patch, removes the ui/xui/ subtree and the ImGui/ImPlot dependency entirely: the core has no user interface, the presentation filter and screenshot helpers moved to ui/xemu-present.cc, and the DXGI presenter moved to ui/win32-dxgi-present.cc. The rows below record the upstream changes at the time they landed; where they name a ui/xui/ file, read the current location from the map at the end of this page.

Patch Area Existing upstream files touched
0007-ui-in-process-core.patch In-process host, thread stack, sigsetjmp shim, library mode, xgrid_core.dll include/qemu/thread.h, include/system/os-win32.h, meson.build, ui/xemu.c, util/oslib-win32.c, util/qemu-thread-win32.c
0008-ui-shell-pads.patch Bind a controller to every port the keyboard did not take and return XID rumble to the shell pads ui/xemu-input.c, ui/xemu-input.h
0009-ui-fast-forward.patch Vblank pace multiplier ui/xemu.c, ui/xemu-run.h
0010-ui-presentation-filter-overlay.patch Core-side presentation filter and FPS overlay ui/xui/gl-helpers.cc, ui/xui/main.cc
0011-ui-dxgi-exit-cleanup.patch Do not call GL after the context is gone ui/xui/win32-dxgi-present.cc
0012-ui-fast-forward-clock.patch Scale the guest virtual clock with fast-forward include/system/cpu-timers.h, system/cpus.c, ui/xemu.c
0013-d3d11-renderer.patch Direct3D 11 renderer and shader cache (superseded by 0058-d3d11-removal.patch) config_spec.yml, hw/xbox/nv2a/nv2a.c, hw/xbox/nv2a/pgraph/*, meson.build, meson_options.txt
0014-ui-in-process-screenshot.patch Core-side screenshot request ui/xemu-snapshots.h, ui/xui/main.cc
0015-ui-dxgi-interop-presentation.patch WGL/DXGI interop keeps native flip presentation on NVIDIA ui/xui/win32-dxgi-present.cc
0016-core-disc-formats.patch Select the XGrid disc driver from the file extension system/vl.c
0017-core-audio-device.patch DirectSound device GUID and audio-driver probe qapi/audio.json, audio/dsoundaudio.c, ui/xemu.c
0018-core-chihiro.patch Sega Chihiro machine, boards, JVS, cards, guns, force feedback and netboard block/meson.build, config_spec.yml, hw/ide/core.c, hw/usb/hcd-ohci.c, hw/xbox/*, system/vl.c, ui/*, ui/xui/*
0019-block-snapshot-skip-nonsnapshot.patch Let the all-device snapshot path skip devices that cannot snapshot (Chihiro DIMM) block/snapshot.c
0020-ui-frame-pacing-and-clear.patch Core presentation frame limit/skip, safe fast-forward clock update, Space handling, full-target clear/edge clamp and black out-of-range rows for an embedded picture shorter than its video mode hw/xbox/nv2a/pgraph/gl/display.c, system/cpus.c, ui/xemu.c, ui/xui/gl-helpers.cc, ui/xui/win32-dxgi-present.cc
0021-build-meson-introspect.patch Read Meson build options from the configured build directory so a Rust-less host can regenerate them Makefile
0022-repo-ignore-xemu-patches.patch Keep the patch record tracked and ignore generated Meson wrap-hash files .gitignore
0023-core-dsp56300-hash.patch Verify the dsp56300 release archive SHA-256 before unpacking subprojects/dsp56300/meson.build
0024-core-xbox-snapshot-store.patch Use a dedicated qcow2 store when the Xbox HDD cannot hold snapshots; read snapshot metadata from the selected store; make the HDD format explicit config_spec.yml, hw/xbox/xbox.c, hw/xbox/xbox.h, hw/xbox/chihiro/chihiro.c, hw/xbox/chihiro/chihiro.h, system/vl.c, ui/xemu-snapshots.c
0025-core-chihiro-gamepad-map.patch Choose each player's cabinet gamepad, tune the steering and player-2 aim dead zones and trigger threshold, and remap cabinet buttons and triggers config_spec.yml, ui/xemu-input.c
0026-ui-gpu-filter-expansion.patch Add sharp-bilinear, curved-CRT, bicubic and Lanczos GPU presentation filters; replace the hard CRT mask with a beam/aperture-grille profile xgrid-core/display/xgrid-display.c, xgrid-core/display/xgrid-display.h, ui/xui/gl-helpers.cc
0027-ui-more-gpu-filters.patch Add Scale2x, slot-mask and shadow-mask CRT profiles, CAS sharpening, and the two-pass FSR 1.0 EASU/RCAS scaler xgrid-core/display/xgrid-display.c, xgrid-core/display/xgrid-display.h, ui/xui/gl-helpers.cc
0028-build-winarm64.patch Move the MinGW system libraries to the link line and add the AArch64 context save/restore path build.sh, util/oslib-win32.c
0029-winarm64-setjmp.patch Use the MinGW-w64 CRT setjmp/longjmp pair on AArch64 include/system/os-win32.h, util/oslib-win32.c
0030-winarm64-disable-compat-reporter.patch Omit the compatibility reporter from the Windows ARM64 build ui/xui/compat.cc, ui/xui/compat.hh, ui/xui/main.cc, ui/xui/menubar.cc
0031-ui-recording-hook.patch Sample the core's composed picture for H.264 MP4 / MJPEG AVI recording and instant replay ui/xui/gl-helpers.cc, ui/xui/gl-helpers.hh, ui/xui/main.cc
0032-core-eeprom-profile.patch Apply a configurable EEPROM region/language/video-standard profile without changing the file's keys config_spec.yml, hw/xbox/eeprom_generation.c, hw/xbox/eeprom_generation.h, system/vl.c
0033-ui-fast-forward-hooks.patch Keep the shell's fast-forward message working through the Chihiro raw-input hook and apply the pace on the core loop ui/xemu.c, ui/xemu-run.h, ui/xemu-input.c
0034-ui-shell-rumble.patch Return XID rumble from shell-bound pads through the input sink and stop it when a pad is unbound ui/xemu-input.c
0035-vk-disk-cache.patch Persist the Vulkan pipeline cache and generated SPIR-V modules in a verified on-disk cache hw/xbox/nv2a/pgraph/vk/*
0036-core-colour-geometry.patch Add final-blit colour adjustments, integer scaling and overscan cropping config_spec.yml, ui/xui/gl-helpers.cc
0037-d3d11-anisotropy.patch Anisotropic filtering in the Direct3D 11 sampler cache (superseded by 0058-d3d11-removal.patch) hw/xbox/nv2a/pgraph/d3d11/texture.c
0038-ui-control-channel.patch Start the separate-process control channel beside the machine and stop it on shutdown ui/xemu.c
0039-core-256mb-mem.patch Allow and map the experimental 256 MB sys.mem_limit value config_spec.yml, system/vl.c
0040-ui-xmu-manager.patch Report memory-unit bind/unbind to the manager and restore cards on shell-bound pads ui/xemu-input.c
0041-core-recording-audio.patch Feed the APU's mixed frame buffer to the video recorder hw/xbox/mcpx/apu/monitor.c
0042-core-version-sh.patch Use a POSIX shell and test for the version header so Windows CI does not resolve the WSL bash stub scripts/xemu-version.sh
0043-core-wasapi.patch Add a WASAPI audio backend, its QAPI options and its default priority meson.build, meson_options.txt, qapi/audio.json, audio/meson.build, audio/audio.c, audio/audio_template.h
0044-core-snapshot-reload.patch Capture the XBE title before the save holds the pgraph lock and refresh GL surfaces/textures after a snapshot load ui/xemu-snapshots.c, hw/xbox/nv2a/pgraph/gl/renderer.c, hw/xbox/nv2a/pgraph/gl/renderer.h, hw/xbox/nv2a/pgraph/gl/surface.c
0045-core-apu-lock-yield.patch Yield the APU lock between DSP frames so a slow audio thread does not starve the guest or block a snapshot quiesce hw/xbox/mcpx/apu/apu.c
0046-core-apu-monitor-mute.patch Mute the APU monitor SDL stream for the null and WAV sinks and expose the selected QEMU driver name audio/audio.c, include/qemu/audio.h, hw/xbox/mcpx/apu/apu_int.h, hw/xbox/mcpx/apu/monitor.c
0047-core-apu-monitor-qemu-audio.patch Feed the APU monitor mix to the selected QEMU backend through a ring and callback, keeping SDL as a muted pacing fallback hw/xbox/mcpx/apu/apu_int.h, hw/xbox/mcpx/apu/monitor.c
0048-core-xgridcore-branding.patch Rename the standalone core window, SDL metadata, NVIDIA profile and log to XGridCore ui/xemu.c
0049-gl-atomic-cache-writes.patch Write the OpenGL shader binary and LRU list through GLib's atomic file replacement hw/xbox/nv2a/pgraph/gl/shaders.c
0050-per-title-cache-dirs.patch Put OpenGL and Vulkan caches under the shell-selected per-title shader_cache_dir hw/xbox/nv2a/pgraph/gl/shaders.c, hw/xbox/nv2a/pgraph/vk/cache.c
0051-point-size-begin-end.patch Ignore SET_POINT_SIZE inside a BEGIN/END block and add the point-size unit test hw/xbox/nv2a/pgraph/pgraph.c, hw/xbox/nv2a/pgraph/pgraph.h, tests/xbox/point_size/
0052-vertex-inline-ub-d3d.patch Convert inline UB_D3D attributes from BGRA to RGBA and add the vertex-inline unit test hw/xbox/nv2a/pgraph/vertex.c, tests/xbox/vertex_inline/
0053-gl-unpack-alignment.patch Read GL texture uploads at byte alignment so narrow 1 BPP textures are not corrupted hw/xbox/nv2a/pgraph/gl/texture.c
0054-glsl-point-size-scale.patch Apply the resolution scale once at gl_PointSize so programmable sprites keep their size hw/xbox/nv2a/pgraph/glsl/vsh.c, hw/xbox/nv2a/pgraph/glsl/vsh-ff.c, tests/xbox/glsl_point_size/
0055-glsl-point-sprite-orientation.patch Flip the point-sprite texture coordinate vertically and add the orientation test hw/xbox/nv2a/pgraph/glsl/psh.c, hw/xbox/nv2a/pgraph/glsl/psh.h, tests/xbox/glsl_point_sprite/

Some files appear in more than one patch because they carry more than one feature. The patch files are the provenance record for edits to existing upstream files; new XGrid-native files are ordinary commits in this repository.

New native modules

xemu/xgrid-core/

Path What it adds
abi/xgrid-core.c, abi/xgrid-core.h In-process start/stop/join/version, playback, screenshot, diagnostics, recording/replay, guest memory, disc and snapshot requests.
abi-baseline.json Version, upstream commit and ABI export list checked by scripts/core-baseline.ps1.
block/xgrid-iso.c Shared XDVDFS descriptor search and XGD game-partition offset detection.
block/xgridiso.c ISO/XISO block driver that maps the game partition to LBA 0.
block/xgridchd.c CHD block driver, decoding hunks on demand through libchdr.
block/xgridcci.c CCI block driver with LZ4 sectors through libCCI, split-part discovery and offset mapping.
block/xgridzar.c ZArchive block driver; entry-form ISO or synthesized file-tree XDVDFS volume.
display/xgrid-display.c, .h Core-side presentation filter, colour/geometry selection, frame pacing and the headless shared-memory frame sink (XGDS).
input/xgrid-input.c, .h Four-port shell input source (XGDI), one 48-byte record per Xbox pad (32-byte input + 16-byte rumble tail), plus the recorder/replayer hook.
input/xgrid-input-record.c, .h .xgin input recorder and virtual-time replayer for the four-pad stream.
control/xgrid-control.c, .h Token-authenticated loopback control channel for the separate-process host.
memory/xgrid-memory.c, .h RAM-only guest physical memory read/write and a polling hash for tools.
record/xgrid-record-mp4.c, record/xgrid-mp4.c, record/xgrid-record-avi.c, .h Core-side H.264 MP4 writer with x264, MJPEG AVI fallback, PCM audio tracks and the in-memory instant-replay ring.
thirdparty/libchdr/ Vendored libchdr 0.3.0 and its LZMA decoder (BSD-3-Clause).
thirdparty/libcci/ Vendored libCCI 0.1, built against the host LZ4 (GPL-2.0-or-later).
thirdparty/stb_image_write/ Vendored stb_image_write 1.16 baseline JPEG encoder (public domain or MIT).
meson.build Wires the drivers, display, input, recording and ABI into the same object set as the emulator.

The block drivers share one game-partition detector. It probes offset 0 first (optimized XISO) and then the retail XGD offsets 0x0FD90000, 0x02080000, 0x89D80000 and 0x18300000 (XGD2, XGD3, XGD2 hybrid and XGD1 in the driver's order). The descriptor is MICROSOFT*XBOX*MEDIA, also checked at its trailing 0x7EC position. The effect is that an image built for LBA 0 and a full Redump image produce the same guest view: the game starts at LBA 0.

Sega Chihiro

xemu/hw/xbox/chihiro/ is a 34-file port of the xemu-Playtest-v2 / XPSemu-Chihiro machine. It adds:

  • the Chihiro machine and media board (chihiro.c, chihiro-asic, chihiro-spd);
  • the 8051, MIPS and V850 helper processors, PIC, AN2131 USB and DES logic;
  • JVS input and cabinet profiles (chihiro-jvs, chihiro-cabinet.h);
  • HW210 and CRP-1231 card readers;
  • Sega 838 and V257 drive boards, force feedback and steering-wheel effects;
  • the netboard and linked-cabinet bridge;
  • the media-board flash, baseboard EEPROM and optional network firmware paths.

The DIMM is memory-backed through block/blkmemory.c and include/block/blkmemory.h, which are also new. The machine is selectable with sys.default_machine = 'chihiro', a Chihiro .bin image, or the shell's Enable Chihiro switch. It uses 128 MB of guest RAM, its own BIOS and no Xbox HDD.

Chihiro source keeps its original licenses (LGPL-2.0-or-later, with the PIC LGPL-2.1-or-later and DES BSD-3-Clause); provenance is in xemu/xemu-patches/0018-core-chihiro.patch, xemu/xemu-patches/0025-core-chihiro-gamepad-map.patch and THIRD_PARTY_NOTICES.md.

Direct3D 11 (removed)

A native Direct3D 11 renderer lived in xemu/hw/xbox/nv2a/pgraph/d3d11/ and pgraph/hlsl/ while the core was Windows-first. It was never enabled in a release. It has been removed so the core keeps two portable GPU paths (OpenGL and Vulkan) instead of maintaining a Windows-only third one; patch 0058-d3d11-removal.patch records the removal of its upstream hooks.

Other new files

File Purpose
block/blkmemory.c, include/block/blkmemory.h Memory-region-backed block driver used by the Chihiro DIMM.
audio/wasapiaudio.c Windows Audio Session API backend with shared/exclusive output, endpoint selection, device-loss recovery, an underrun counter and core statistics.
ui/xemu-run.h Fast-forward/shutdown entry points for the embedded core.
hw/xbox/nv2a/pgraph/vk/cache.c Digest-checked on-disk cache for Vulkan pipelines and generated SPIR-V modules.
XEMU_VERSION, XEMU_COMMIT Lineage base release and commit markers.
XEMU_REVIEWED_COMMIT Latest upstream commit reviewed for a selective port.
dependencies.json, msys2-packages.lock Native dependency inventory and the Windows build-host package lock.
GNUmakefile, XGrid.Xemu.Tree.csproj Build conveniences for the tracked tree and the solution anchor.
xemu-patches/*.patch Provenance for edits to existing upstream files.

Behavior differences

Process and window model

Upstream runs one xemu process with its own SDL window. XGrid builds the same objects as xgrid_core.dll as well, with a fixed image base and a 16 MB thread stack. The shell loads it with NativeLibrary.Load; the core starts one machine on a background thread and the shell calls the ABI.

The embedded mode hides the SDL window, titles it XGridCore, and reparents it into the game view. Library mode suppresses modal dialogs and returns startup errors to the shell instead of terminating the host. QEMU's global state remains single-use: one machine per process. A second in-process start is refused and the shell falls back to the separate process.

The Windows sigsetjmp/siglongjmp pair is replaced by a RtlCaptureContext/RtlRestoreContext shim because msvcrt rejects QEMU's jump buffer inside a managed host. This affects the CPU loop only and does not change emulation behavior.

Input

Upstream reads controllers through SDL. XGrid adds a 208-byte shared section (XGDI) with four 48-byte pad records (32-byte input plus a 16-byte rumble tail). The shell publishes keyboard and host-pad state (XInput on Windows, SDL3 on Linux X11) for players 1-4; the core binds a synthetic controller to each port the keyboard did not take. The section is a Windows named mapping or a POSIX shared-memory file. Wayland and macOS launches keep the core's own SDL input because the shell does not host their window. Bindings are not written into the core configuration.

The same input path feeds an optional .xgin recorder. It stores changed pad samples with virtual-time offsets and guest frame numbers; replay feeds them back ahead of the live section at the same virtual times. The shell selects the file, and a matching save state supplies the machine state. See Input recording and replay.

The Chihiro path is separate: its JVS input, mouse/light-gun pointers, player 2 aim, card insertion and force feedback are implemented in ui/xemu-input.c and the Chihiro devices. The shell deliberately disables its Xbox pad sink for a Chihiro launch so the arcade USB bus is not claimed by a shell pad.

Picture, filters and overlay

Upstream presents the core's picture directly and has no shell-owned filter selection. XGrid keeps the picture in the core and adds:

  • nearest, bilinear, scanline, CRT, sharp-bilinear, CRT-curved, bicubic, Lanczos, Scale2x, CRT slot, CRT shadow, CAS and FSR 1.0 presentation filters in the GPU final blit;
  • final-blit brightness, contrast, saturation and gamma adjustments, integer scaling and overscan cropping; the shell selects them through the ABI and the core applies them to its own picture;
  • the core has no user interface and draws no overlay; guest and output frame rates, frame times, draw calls, VRAM, renderer and audio statistics are published through the statistics ABI for the shell's Activity page;
  • a core-side presentation pacer with an unlimited or fixed frame-rate limit and optional skipping of missed presentation deadlines;
  • a headless XGDS sink for frame counting;
  • a core-side screenshot request that writes the PNG without the shell reading a frame.

The shell selects the filter/overlays/pacing through the ABI (or XGRID_PRESENT_FILTER/XGRID_FPS_OVERLAY/XGRID_DIAGNOSTIC_OVERLAY/ XGRID_FPS_LIMIT/XGRID_FRAME_SKIP for a separate process). Colour and geometry use xgrid_core_set_color_adjust and xgrid_core_set_geometry, or the display.color and display.geometry sections of xemu.toml. No shell frame canvas or per-frame Avalonia copy exists.

Playback

Upstream's run loop has no shell-facing pause/step/speed ABI. XGrid adds:

  • pause/resume queued on the core's main loop;
  • single-frame step while paused;
  • a 1–8× speed multiplier that scales QEMU_CLOCK_VIRTUAL and the vblank pace together, so guest timers, the Xbox TSC and presentation all speed up; the virtual-clock scale uses a seqlock because timer/vCPU threads read it while the shell changes it;
  • the loopback control channel, with the registered XGrid.SetSpeed window message as a fallback, so the separate process gets the same live speed control;
  • a 50 ms fallback when no display sink is publishing frames.

The shell exposes 4× on Space or Emulation → Fast-Forward and restores 1× on the next toggle, pause or session end.

Guest memory

Upstream has no host-facing memory API. XGrid adds RAM-only physical access for trainers, achievement watchers, save editors and TAS tooling:

  • xgrid_core_memory_read and xgrid_core_memory_write move at most 1 MiB per request through the core's main loop;
  • xgrid_core_memory_size reports the guest RAM size;
  • xgrid_core_memory_hash returns a 32-bit FNV-1a hash for polling change detection. It is not a CPU watchpoint.

Addresses are validated against RAM, so MMIO and device windows cannot be reached. The managed shell exposes the same calls through ICoreMemory; the control channel does not carry guest memory, so this remains an in-process feature.

sys.mem_limit also gains an experimental 256 value. The core maps the enum explicitly to 64, 128 or 256 MB, so all three use the same machine path; 256 MB is outside the default compatibility matrix.

Media

Upstream reads ISO/XISO and raw block media. XGrid adds four drivers and a shared detector:

Format Driver Decode
ISO/XISO xgridiso Direct, game partition mapped to LBA 0
CHD xgridchd libchdr hunks on demand
CCI xgridcci libCCI + host LZ4 sectors; split parts discovered
ZArchive xgridzar zstd blocks; entry-form ISO or synthesized XDVDFS tree

system/vl.c chooses the driver from the extension, and the same drivers are used for the initial disc and for a live disc change. CHD/CCI/ZAR are read-only.

Save states and snapshots

Upstream has its own snapshot UI. XGrid keeps the same QEMU/xemu snapshot machinery but exposes it to the shell as four named slots and one automatic session state. Requests are queued on the core's main loop because the block layer and the GL thumbnail require that thread; the shell polls status. A separate process reaches the same requests over the loopback control channel.

0019 changes the all-device snapshot path to skip devices that cannot snapshot. An explicit device list still gets the strict check. This is what lets a Chihiro snapshot skip the writable DIMM interface and use its dedicated chihiro_snapshots.qcow2.

Audio

Upstream exposes QEMU audio backends. XGrid adds a DirectSound device GUID to the QAPI options and passes it to IDirectSound_Initialize; the shell enumerates devices and stores the GUID. XGrid also adds the -audio-drivers probe, which lists the backends the binary actually registered before SDL/GL is initialized.

Machine selection and Chihiro hardware

Upstream always boots the Xbox machine. XGrid adds:

  • sys.default_machine (auto, xbox, chihiro) and sys.last_machine;
  • Chihiro BIOS/media-board/EEPROM paths and a dedicated 128 MB launch;
  • a FATX netboot image loaded into DIMM memory;
  • baseboard IDE IDENTIFY geometry and DMA service;
  • OHCI re-enumeration for the QC/SC USB devices;
  • SMC AV-pack/tray behavior for a machine without a DVD drive;
  • the FS454 SMBus device and EEPROM generation;
  • the Chihiro JVS, card, drive-board and netboard devices.

A .bin image selects Chihiro for that launch; the shell also writes default_machine = 'chihiro' when Enable Chihiro is on.

Windows presentation

0011 and 0015 fix two host-side presentation problems: the DXGI presenter no longer calls GL after the context is destroyed, and the WGL interop attachment uses a renderbuffer that keeps NVIDIA's native flip presentation active. These do not change emulation, but they prevent exits/crashes and a slow copy path on Windows.

Existing upstream files changed

The following table is the complete source/build file list for the comparison, with the feature that owns the change. Some files are listed more than once because they carry more than one feature.

File Change
.gitignore Keep the patch record tracked and ignore generated Meson wrap-hash sidecars.
audio/audio.c Register the WASAPI driver in the per-direction option factory.
audio/audio_template.h Map the WASAPI device to its per-direction options.
audio/dsoundaudio.c Parse a DirectSound device GUID and pass it to IDirectSound_Initialize.
audio/meson.build Build wasapiaudio.c when WASAPI is available.
block/meson.build Build blkmemory.c into the system sources.
block/snapshot.c Skip non-snapshot-capable devices in the all-device path; keep the strict check for explicit lists.
build.sh Keep the MinGW system libraries on the link line instead of in CFLAGS, so the Windows ARM64 build does not treat them as unused compile arguments.
config_spec.yml Add general.shader_cache_dir, display.color/display.geometry, sys.default_machine/last_machine, and the full chihiro.* schema.
hw/ide/core.c Chihiro baseboard IDENTIFY geometry, DIMM capacity and DMA service hook.
hw/usb/hcd-ohci.c Chihiro USB enumeration/re-enumeration hooks and port behavior.
hw/xbox/meson.build Build the chihiro subdirectory.
hw/xbox/mcpx/apu/monitor.c Feed the mixed APU frame buffer to the core recorder.
hw/xbox/nv2a/nv2a.c Renderer post_load hook; Chihiro shader-cache game-name hook (currently a no-op).
hw/xbox/nv2a/nv2a.h Declares the hooks above.
hw/xbox/nv2a/pgraph/gl/display.c Black out rows below the guest surface and clamp presentation edge sampling.
hw/xbox/nv2a/pgraph/gl/texture.c Upload texture rows at byte alignment for narrow 1 BPP formats.
hw/xbox/nv2a/pgraph/glsl/psh.c Use the orientation-corrected point-sprite coordinate.
hw/xbox/nv2a/pgraph/glsl/psh.h Emit a vertically flipped gl_PointCoord for point sprites.
hw/xbox/nv2a/pgraph/glsl/vsh.c Apply the resolution scale at the shared gl_PointSize assignment.
hw/xbox/nv2a/pgraph/glsl/vsh-ff.c Leave fixed-function oPts at native scale for the shared assignment.
hw/xbox/nv2a/pgraph/pgraph.c Route point-size writes through the begin/end check.
hw/xbox/nv2a/pgraph/pgraph.h Add the post_load renderer operation and pgraph_set_point_size.
hw/xbox/nv2a/pgraph/vertex.c Convert inline UB_D3D attributes from BGRA to RGBA.
hw/xbox/smbus_xbox_smc.c Chihiro AV pack, tray state and QuickReboot scratch handling.
hw/xbox/xbox.c Add the chihiro machine property, media/base boards, DIMM image load, FS454, QC/SC USB and save flush.
hw/xbox/xbox.h Add the Chihiro machine flag.
include/qemu/thread.h Add the host-controlled QEMU thread stack size.
include/system/cpu-timers.h Declare the virtual-clock scale.
include/system/os-win32.h Replace the Win32 sigsetjmp pair with the XGrid context shim; use the CRT pair on AArch64.
Makefile Read Meson build options from the configured build directory.
meson.build Add xgrid-core, xgrid_vulkan, xgrid_core.dll, and WASAPI detection and priority.
meson_options.txt Add xgrid_vulkan (off by default) and the wasapi feature.
qapi/audio.json Add the DirectSound device string option and the WASAPI device/exclusive options.
scripts/xemu-version.sh Use a POSIX shell and a POSIX version test so a Windows host cannot resolve bash to the WSL stub.
system/cpus.c Apply the virtual-clock scale.
system/vl.c Select Xbox/Chihiro, choose Chihiro firmware/EEPROM, skip the HDD/DVD for Chihiro and select XGrid disc drivers.
ui/meson.build Link CoreFoundation/IOKit on macOS for Chihiro pointer input.
ui/xemu-input.c Add the shell pad sink and the entire Chihiro JVS/gun/card/force-feedback input path.
ui/xemu-input.h Declare the new input hooks.
ui/xemu-notifications.h Add a warning notification entry point.
ui/xemu-settings.cc Add Chihiro machine detection/settings and media probing.
ui/xemu-settings.h Declare the Chihiro helpers.
ui/xemu-snapshots.c Open the dedicated snapshot store and read its metadata instead of the HDD.
ui/xemu-snapshots.h Declare the core-side screenshot request.
ui/xemu.c Add library mode, the audio probe, fast-forward, the display sink and the standalone run split.
ui/xemu-present.cc The presentation filter shader, colour/geometry uniforms and the screenshot/thumbnail readback, extracted from the removed UI subtree.
ui/win32-dxgi-present.cc Exit cleanup and WGL/DXGI interop presentation fixes.
util/oslib-win32.c Implement the context capture/restore shim.
util/qemu-thread-win32.c Use the configurable thread stack size.

Build and dependency changes

  • The tracked tree adds GNUmakefile, XEMU_VERSION, XEMU_COMMIT, XEMU_REVIEWED_COMMIT, dependencies.json, msys2-packages.lock and the solution anchor XGrid.Xemu.Tree.csproj.
  • Vulkan is gated by xgrid_vulkan (default off) instead of always probed. The Windows release build script turns it on; a Linux build only gets Vulkan when the build passes -Dxgrid_vulkan=true and the dependencies are present.
  • The dsp56300 downloader verifies the release archive SHA-256 for the host target before unpacking it.
  • The Windows DLL keeps SEH unwind data, uses image base 0x150000000 and a 16 MB stack, because QEMU TCG needs both in a host process.
  • Windows ARM64 uses the MinGW-w64 CRT setjmp/longjmp pair because the fixed-frame RtlCaptureContext shim cannot recover the caller stack there; the compatibility reporter is omitted from that build. 0028 also keeps the MinGW system libraries on the link line so clang does not reject them as unused compile arguments.
  • .gitignore keeps xemu-patches/*.patch tracked and ignores Meson wrap-hash sidecars.
  • The Rust dependency wraps present in the pristine 0.8.139 subproject set are not used by this build; Vulkan subprojects are fetched on demand.

What did not change

  • The Xbox machine, QEMU TCG CPU, MCPX/APU/ACI, IDE/ATAPI, USB/OHCI, SMBus and the retail boot chain remain the upstream implementation except for the Chihiro hooks listed above.
  • The OpenGL and Vulkan renderers keep their upstream rendering paths. an additional backend, not a replacement.
  • The XBE, XDVDFS and FATX readers and the upstream snapshot format are unchanged.
  • The standalone XGridCore.exe still exists and still uses the upstream UI. The XGrid shell uses the ABI or the separate process; it does not reimplement the Xbox.
  • Game compatibility is inherited from xemu 0.8.139, plus the media drivers and Chihiro support documented in Compatibility.

Rebuilding and checking the comparison

Build the tracked core:

pwsh -File scripts/build-native-xemu.ps1

Check the ABI baseline:

pwsh -File scripts/core-baseline.ps1

Compare a file against the pristine baseline without changing either tree:

git diff --no-index -- References2/xemu-0.8.139/hw/xbox/xbox.c xemu/hw/xbox/xbox.c

The pristine tree is an oracle, not a working copy. The current upstream revision, dependency locks and weekly report are described in Core lineage and upstream.

Related pages