Falco Girgis is the go-to spokesperson for the Dreamcast modding and dev community, and he's always sharing new and exciting projects and milestones over on X. Take this latest announcement with footage of hardware captures of Sonic Adventure 2 co-op mode running on the Dreamcast at 60fps and with a 16:9 viewpoint.
Falco is a whizzkid; he recently announced his creation 'SH4ZAm', an 'assembly-optimized fast-math library, which is now replacing the entirety of Sega's own Ninja math library, which was included within their Katana SDK.'
The game has been cross-compiled for the Dreamcast's SH4 CPU, and after running @kylemayer's Sonic Adventure 2 decompilation through SH4ZAM, Falco has managed to get everything moving up from 30fps to 60fps and running smoothly, albeit after adding far too much oomph to the game at one point and having to dial it back to make it look less like you're in a fever dream while playing.
Hardware captures from several areas of Sonic Adventure 2's coop mode for the Sega Dreamcast, now with a 16:9 viewport aspect ratio, going from barely maintaining 30FPS to hitting 60FPS much of the time. Thanks to @kylemayer's decompilation, we have been able to soup the game up with v0.11.0 of SH4ZAM, my assembly optimized fast-math library, which is now replacing the entirety of Sega's own Ninja math library, which was included within their Katana SDK. Everything is now cross-compiled for the DC's SH4 CPU using the bleeding-edge GCC 17 development branch, with virtually every optimization flag enabled, including new ones from @EndoOleg, the maintainer of GCC's SH back-end. The code emitted is SIGNIFICANTLY more optimized than what was emitted from the primitive SHC compiler whcih SA2 was originally built with, plus we're now building hot translation units at -O3 and have -flto -fipa-pta and -ffast-math enabled globally. In addition to this, so far I have taken the following liberties: 1) Replaced the idiotic memcpy() routine that they were using (which is misnamed, because it's actually memmove), which was doing incredibly inefficient byte-by-byte copying in a basic for loop, with my hand-optimized shz_memmove() routine, which combines manual cache line prefetching and preallocation with using pairwise loads/stores in the FPU to copy up to 8 bytes at a time with pairwise floating-point loads an stores. 2) Replaced all of Sega's libc-style stuff from their <math.h> for single-precision floats, including rounding, truncation, ceiling, floor, and trigonometric routines with my own from SH4ZAM. 3) Replaced all of the interpolations in animation and movement code for vectors and quaternions with my own LERP and SLERP routines. 4) Replaced every single division within the hot paths whose denominators are guaranteed to be non-zero positive numbers with my fast approximations, built around abusing the fast reciprocal square root approximation instruction. I added probably half a dozen other micro tweaks to routines here-and-there, but those are some of the biggest ones. Stay tuned to see just how far we can push it with the GAINZ!
— Falco Girgis (@falco_girgis) December 1, 2026
In layman's terms, which is what I need when it comes to a mind like Falco's, the code has been optimised fully, creating the definitive edition of the game running on the beloved Dreamcast. Everything has been made more efficient. Falco has:
- Replaced the idiotic memcpy() routine, which was doing incredibly inefficient byte-by-byte copying in a basic for loop
- Replaced all of Sega's libc-style stuff from their <math.h> for single-precision floats.
- Replaced all of the interpolations in animation and movement code for vectors and quaternions with my own LERP and SLERP routines
- Replaced every single division within the hot paths whose denominators are guaranteed to be non-zero positive numbers with my fast approximations, built around abusing the fast reciprocal square root approximation instruction.
I'll be keeping an eye on Falco's socials for more information over the next couple of weeks, but progress is looking good so far!