$ show xenia-project/xenia
Xenia is a research-grade emulator for the Xbox 360, written in C++ with a focus on accuracy and performance. It translates PowerPC (PPC) guest code into x64 machine code via a custom JIT compiler (HIR → x64 backend) and emulates the Xenos GPU using D3D12 and Vulkan backends, including shader translation from Xbox ucode to HLSL/SPIR-V. The system also emulates kernel subsystems (XAM, Xboxkrnl), audio (XMA decoding via XAudio2/SDL), input (XInput, keyboard, SDL), and the virtual file system (STFS containers, disc images, host paths). The architecture is modular with clear subsystem boundaries (base, cpu, gpu, apu, hid, kernel, vfs, ui), each with platform-specific implementations for Windows, Linux, and Android. Key entry points include the main emulator window (xenia_main.cc), the CPU processor (processor.h), the GPU graphics system (graphics_system.h), and the kernel state manager (kernel_state.h). The emulator is primarily a desktop application but includes Android support and several standalone tools for shader compilation, GPU trace analysis, and API scanning.
The LLM identified 5 files worth highlighting for reuse:
Provides a lightweight arena allocator for temporary allocations used extensively in compiler passes. It allocates from a fixed-size buffer and can reset without deallocation, ideal for high-throughput scenarios where object lifetimes are well-scoped. Reusable as a standalone memory optimization pattern.
Implements a bit-level read/write stream with support for reading/writing arbitrary bit lengths, aligned byte operations, and copy. Used in GPU trace writing and other low-level serialization. The interface is clean and could be extracted for any project requiring bit-level I/O.
High-performance asynchronous logging system using a lock-free ring buffer (disruptor pattern). Supports multiple sinks (file, debug output, Android logcat) with structured log levels. The design minimizes contention and is suitable for any latency-sensitive application. The disruptor pattern is a non-obvious skill demonstrated here.
Efficient mutable string buffer with append operations and format methods. Avoids repeated allocations by maintaining a contiguous buffer. Reusable in any C++ project that needs to build strings incrementally without the overhead of std::string concatenation.
Macro-based Vulkan function pointer declarations that allow a clean, centralized way to load Vulkan instance-level functions. The pattern (define a macro and then include the .inc file multiple times with different macro definitions) is reusable for any Vulkan or similar API that requires dynamic function loading.