A decompilation and port of Sonic Advance 2-a GameBoy Advance game written in C
39 comments
·March 28, 2025rossy
ac2u
Agreed, when Sonic Mania came along I often heard “the first 2D Sonic game since 3+K” and thought that people were forgetting the advance series. You could tell they were crafted by a team that respected the feel of the games that came before and understood that Sonic was a solid platformer with speed as a reward gameplay mechanic. Not to mention it had a colour palette that never confused the main character from the background, something I think mania gets wrong from time to time.
Gamemaster1379
I love projects like these. Between decomps and static analyzers, we've seen so many fantastic games modernized and ported.
Ocarina of Time is able to play natively on just about every system system imagineable (pretty sure native PS1 builds exist) Sonic Unleashed, previously an 360/PS3 exclusive, now can be played in ultra wide on PC natively.
Majoras Mask got a recent static deanalyzed PC port and has higher FOS and ultrawide mods.
Perfect Dark for the N64 has a native PC port with ultrawide and mouse and keyboard controls.
These are just a few off the top of my head.
saturn8601
>Ocarina of Time is able to play natively on just about every system system imagineable (pretty sure native PS1 builds exist)
You got me curious so I googled it, are you confusing it with a port for the Playstation Classic? Thats a modern console that uses a Android phone chip and emulates the PS1. I couldn't find any references to the original PS1 and I don't think any amount of wizard coding could get that game to run on such a resource constrained hardware. There is so much of that game that was only possible on N64 level hardware or better.
cubefox
It would probably be possible to rewrite the whole game to fit the hardware, change assets etc. Obviously that would be a major effort and not as simple as running it on a modern PC.
saturn8601
I don't think the PSX has enough ram to allow large open world and near instant movement from one open world to another. Yes there were things like streaming in textures like Spyro did but if you watch footage of Zelda 64 in the big open worlds I just can't see it being done that way on the PSX. Even spyro had long load times between worlds. There was a lot of innovation on the PSX in terms of genres but little to no major open world games.
doublerabbit
I think OP may of got titles confused.
Majora's Mask has been dissembled and then recompiled to native. They are currently working on Oceania of Time.
https://github.com/Zelda64Recomp/Zelda64Recomp
Shame I've never been a fan of Zelda.
ThatPlayer
Recompile and decompile are also different things. The goal of a recompile is a working binary for another platform (x86), while the goal of a decompile is source code.
https://github.com/Zelda64Recomp/Zelda64Recomp?tab=readme-ov...
https://github.com/zeldaret/oot is the seperate Ocarina of Time decompile project, and I believe is what the Playstation Classic port uses. They're also working on a Majora's Mask decompile, but it is incomplete. Probably why the recompile targeted that game first.
Gamemaster1379
Both Ocarina of time and Majoras Mask are able to run on PC. For Ocarina of Time, it was done through manual de compiling. For Majoras Mask, a static analyzer was used.
The codename for Ocarina of Time was Ship of Harkinian. The one for Majoras Mask is 2Ship2Harkinian.
Both can result in the same outcome, but the readability of underlying source differs
Gamemaster1379
Ah. I think you're right. I did confuse it with the PS Classic. I thought they had done an actual PSX port that lowered rendering to compensate. I must've been mistaken.
russellbeattie
I wonder how old codebases are managed at Sega. Is there a server somewhere where you can see the code and assets for all the various games they've published going back to the 80s? 90s? Is it walled off? In cold storage? Could some junior dev decide to go check out the original GBA Sonic code just for fun?
zorked
Probably most source code has been lost. Games were considered throwaway projects, executives barely knew what source code was, and game dev work was considered entry-level and low-status. The main source of 80s and early 90s code that we have are floppy disks that developers took home rather than the companies that published the games.
Consider that version control was something that was basically only used by Unix developers back then. E.g. DOOM, with a particularly technically proficient team, was developed by passing disks with source files around.
GabrielTFS
Sonic Advance 2 might be late enough that developers started to take that seriously, e.g. I recall hearing that earlier games like Ocarina of Time already were being developed using CVS, for instance, and another game from around that time that I specifically recall would be Pokemon Diamond & Pearl, developed in an SVN repository
freshollie
This may be true, but since the game was published by THQ in the west who then went bankrupt, no one knows who owns the rights to this game and so no one is likely to ever release it. If source was ever released we still wouldn't use it in the decompilation since that then becomes much more of a legal issue.
The spongebob movie GBA source was released recently: https://archive.org/details/the-spongebob-squarepants-movie-...
qingcharles
I was a gamedev in the mid-90s. We were using Visual SourceSafe, which was my first exposure to source control, but clearly others at the studio had been using source control for some time, so it must have been around in game dev for a little while before that, at least.
msk-lywenn
Shame... All those sprites and tile backgrounds are just begging for a DMCA take down. Why not just put up the tools that disassemble those from the ROM instead?
hnlmorg
If this were Nintendo then I’d agree but sega have always been really chilled about this so long as the community does t profit off their IP (which is a fair line to draw).
Because of this, you’ll fine tonnes of Sega fan stuff. From multiple active Phantasy Star Online servers through to entire fan-made Sonic games.
In fact iirc Sonic Mania started life as a fan game and Sega asked them to produce a full game.
ThatPlayer
Even Nintendo hasn't taken action for similar projects for Pokemon. They're also in nice and easy PNG format: https://github.com/pret/pokeplatinum/tree/main/res/pokemon
freshollie
Do you wanna develop that tool? The sprite and midi extraction is pretty complex in this game, it was much easier for us to extract them by hand and then in the future we will produce something which extracts them automatically. Until we have that tooling in place we don't plan to release any binaries.
rawbot
You'll get DMCA'd just by hosting the sprites and MIDIs. A binary is not the act that will get you DMCA'd.
freshollie
If that happens we will keep the repo private and develop the tooling to extract these in an automated way. As others have said, SEGA doesn't police their IP in this way. Checkout this game which has existed since the early 2000s https://www.srb2.org/
3np
Just omit the problematic parts from public? And perhaps you want to migrate to some more resilient and friendly host than github.com, while you still have a chance to redirect people. All it takes is one form submission to nuke your repo.
(Assuming you care about your work and sharing it. Sure "Sega is chill" so far but you are really pushing it here and giving them a great display of why they might want to reconsider)
GabrielTFS
SEGA seems to always have been a lot more generous with this kind of thing... Much of the disassembly or decompilation projects I've seen come out of old SEGA games include all the assets with them (e.g. look up disassemblies for the Genesis games), and ROM hacks are typically distributed as full ROMs - I've basically never seen SEGA use the DMCA against any disassemblies/decompilations/ROM hacks.
dpedu
Is it known how much of the decompiled code comes from the game's developers, versus some sort of SDK for the original platform?
freshollie
Dimps developed a "game engine" of sort for their GBA games. As far as I understand SA1 was the first implementation of this engine and then they iterated upon it for their future games. It's an extremely minimal engine, implements some helpers for rendering sprites and backgrounds, and a task system (since the GBA doesn't have threading or any task system in it's SDK).
You can see this SDK in the root of the src, everything in game was written specifically for the Sonic Advance trilogy.
aikinai
They might have used some middleware, but GBA had no SDK I believe.
mmaniac
The GBA SDK is pretty minimal in terms of library support. It's mostly functions for accessing save data plus wrappers around syscalls found in the bootrom. Those syscalls are some basic math functions, a few decompression algorithms, and an early version of the MusicPlayer2000 sound engine.
greeniskool
I wonder if the Android port of Advance 3 came in hand here. That version was ported to Java — and being unobfuscated, would've been a great reference point.
freshollie
It didn't. The Java port is an entirely different source. Essentially a re-write.
hobozilla
How good (or bad) is AI at mapping assembly back to C?
freshollie
For matching decompilations like this, pretty terrible. It can give a rough layout of a function with some branching, but it fails to create reasonable human like structs (which have to be inferred from the assembly), and matching what it has created can be the majority of the work. We did this without any AI assistance, but I relied on the Ghidra decompilation feature for outlining a functions layout (though even that had it's limitations).
The training data is just too minimal for this sort of thing. The decomp.me database would probably be really good to train a model on.
mikae1
Why are there suddenly so many decompilation projects? Has there been a technical leap?
mikae1
https://decomp.me perhaps?
nake89
This is amazing news. I loved this game as a kid. I still have my original gba and the game itself.
null
starkparker
Why distribute copyrighted PNGs in the code repo?
johnisgood
Where would you like it to be distributed for an old GameBoy game?
Man, I'm really keen for this. The GBA Sonic games are often slept on but I think they were amazing at recreating the feel of the original Mega Drive games, with great music and sprite work too. I've long thought they deserved a modern PC port in the style of Sonic 1 Forever or Sonic Origins, to free them from the cramped GBA screen.
Sonic fans have been making a lot of these unofficial, enhanced, moddable PC ports using decompilation, recompilation and emulation techniques, including Sonic 1 Forever, Sonic 3 A.I.R. and recently, the Sonic Unleashed PC port. PC (including Linux) is getting to be the definitive platform for playing a lot of these older Sonic games, which is great to see.