Commit Graph

2 Commits

Author SHA1 Message Date
carlos a1862e0fdc video, apu: SDL2 framebuffer window and SDL2 audio device on POSIX
POSIX hosts had neither: fb_present.c is Win32 GDI with POSIX stubs, and
the xa2_* audio backend was stubbed inactive. A macOS or Linux build ran
with no picture and no sound.

fb_present_sdl.c is the framebuffer window for POSIX, opt-in with the same
RECOMP_FB_WINDOW switch. AppKit only runs on the main thread, so the shape
is inverted: a title hands its boot sequence to xbox_HostWindowMain(),
which keeps the window and the one SDL event loop on the main thread and
runs the guest on a pthread (at least the main stack; same QoS on macOS).
The flip copies the finished surface into one of three slots and publishes
it under a short mutex, so the executor never waits for the window. Same
640x480 surface convention and title bar as the GDI window. Without the
switch, headless, or with no display, the guest runs on the calling thread
as before. While the main thread pumps events, xinput_device.c only reads
the controllers.

apu_sdl2.c implements the xa2_* contract over SDL_QueueAudio, with the
XAudio2 backend's buffer size and depth (1024 x 3, a period refused while
the queue is full; SDL's queue does not count the buffer the device is
playing, so it is refused at two). RECOMP_HEADLESS=1 takes SDL's dummy driver unless
SDL_AUDIODRIVER is set.

SDL's SIGINT/SIGTERM handlers only post an SDL_QUIT that nothing reads
without a window, so every SDL entry point keeps the default handlers.

docs/runtime/README.md shows the POSIX main() a title needs: a
SIGSEGV/SIGBUS handler that calls xbox_PosixMmioFault, and the boot
sequence handed to xbox_HostWindowMain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 16:59:37 -07:00
sp00nz ef5ad3a734 Initial release: Xbox static recompilation toolkit
Complete toolchain for statically recompiling original Xbox (2001-2005) games
into native Windows executables. Includes:

- XBE parser, x86 disassembler, function identifier, and x86-to-C lifter
- 6-step pipeline documentation (parse, disassemble, identify, lift, runtime, debug)
- 8 technical deep dives (register model, memory layout, ICALLs, D3D, kernel, SEH, etc.)
- 3 Xbox format references (XBE, kernel exports, disc images)
- Runtime templates (recomp_types.h, xbox_memory.h, kernel_stubs.h)
- Candidate game analysis for future recompilation targets

Proven on Burnout 3: Takedown — 22,097 functions lifted from machine code to C.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 02:27:26 -08:00