Hey everyone!
I've been working on a community-driven recompilation project for Sonic the Hedgehog 4: Episode I (Xbox 360 version), targeting native ARM64 Android devices.
The project has now reached a point where I believe it would really benefit from the experience and knowledge of other developers, especially people familiar with Xbox 360 architecture, PowerPC, Xenos, Vulkan, ARM64, and low-level performance engineering.
GitHub repository:
https://github.com/GustavoCaruzoGoncalves/sonic-4-episode-1-definitive-edition-recompiled
What have I accomplished so far?
This is not an emulator running the Xbox 360 game.
The project uses Ahead-of-Time (AOT) recompilation, translating the original Xbox 360 PowerPC code into native ARM64 code through the XenonRecomp/ReXGlue ecosystem.
Current architecture:
\- Original Xbox 360 PowerPC game code.
\- Native ARM64 AOT recompilation.
\- ReXGlue runtime and Xbox 360 kernel HLE.
\- Xenos GPU command translation to Vulkan.
\- Android native application.
\- Adreno GPU support.
\- Touch controls.
\- Audio support.
The game successfully boots, reaches the menus, and runs the first stage on a physical POCO F7 (Snapdragon 8s Gen 4 / Adreno 825).
There is also a Windows D3D12 path in the repository, although it needs regression testing against the latest shared changes.
Performance improvements already achieved
We've conducted several controlled experiments and identified and fixed significant sources of unnecessary CPU work.
Some examples:
\- Eliminated a VBlank interrupt storm that was generating approximately 1.3 million interrupts per second.
\- Fixed an audio worker busy-spin.
\- Fixed unnecessary presenter pipeline recompilation.
\- Enabled classic Vulkan render passes on Android, substantially reducing command recording overhead.
\- Improved texture descriptor reuse.
\- Reduced unnecessary work in the write-watch fault handler.
\- Improved pipeline cache persistence.
\- Introduced a dedicated presentation queue.
Some measured results:
\- Process CPU usage reduced from approximately 4.30 to 2.57 cores after runtime fixes.
\- Classic render passes reduced command recording time from approximately 5.5 ms to 1.45 ms per frame in the tested workload.
\- A texture descriptor reuse experiment reduced measured command recording time by approximately 23.5%.
\- A dedicated presentation queue reduced frames exceeding 33 ms from 2.40% to 0.73% in a controlled comparison.
These results are documented in the repository, including experiment reports and profiling evidence.
But we still have a serious problem.
Despite these improvements, the game still has excessive computational overhead.
During actual gameplay, when Sonic starts moving through Splash Hill Zone, the game experiences noticeable stuttering.
The stuttering becomes more frequent as the level progresses and more objects and resources are processed.
The phone also gets hotter than I would expect from a game originally released for Xbox 360 in 2011/2012.
The POCO F7 is a powerful modern device, so I strongly suspect that we still have significant inefficiencies in our host runtime, graphics translation, synchronization, or resource management.
Some recent profiling suggests:
\- Remaining frame spikes are strongly correlated with "vkWaitForFences".
\- GPU resource streaming and render-to-texture operations remain expensive.
\- Approximately 200 texture reloads per second have been observed.
\- Xenos render-target resolve/untile operations contribute measurable GPU time.
\- Guest clock and timebase semantics still need further investigation.
We don't want to hide these problems by lowering graphics quality, skipping frames, or changing the original game behavior.
The goal is to make the recompilation itself genuinely efficient.
Where I would really appreciate help
I'm particularly interested in feedback from developers experienced with:
- Xbox 360 PowerPC architecture and AOT recompilation.
- XenonRecomp, ReXGlue, and Xenia internals.
- Xenos GPU architecture, EDRAM, render targets, resolves, and memexport.
- Vulkan performance on Qualcomm Adreno GPUs.
- ARM64 code generation and optimization.
- GPU synchronization, fences, swapchain depth, and presentation scheduling.
- Resource streaming, texture residency, and memory management.
- Profiling and diagnosing progressive gameplay stuttering.
I'd especially appreciate someone experienced with Xenia or other Xbox 360 recompilation projects taking a look at our implementation and challenging our current assumptions.
Perhaps we're overlooking an architectural issue that someone with more experience could identify much faster.
Why I'm making the project public
I don't want this to be a closed personal experiment.
I'd like to build a community around the project, receive technical reviews, learn from developers with more experience, and hopefully get contributions that help us improve the implementation.
The repository includes the source code, architecture documentation, experiment reports, build instructions, and current limitations.
The project is free and open to community contributions. It does not distribute the original game or copyrighted SEGA assets; contributors must provide their own legally obtained game data.
Repository:
https://github.com/GustavoCaruzoGoncalves/sonic-4-episode-1-definitive-edition-recompiled
Any technical feedback, architectural suggestions, code reviews, or contributions would be genuinely appreciated.
Even if you don't want to contribute code, I'd love to hear your thoughts on what could be causing this level of overhead in an Xbox 360 AOT recompilation running on modern ARM64 hardware.
Thanks!