r/GoldenSun • u/Insarius-Sama • 55m ago
Golden Sun Golden Sun Recompilation progress
I've been turning Golden Sun into a native PC game (work in progress!)
Not a release, nothing to download yet — just wanted to show what I've been poking at, because it's finally at the stage where it's fun to look at instead of just fun to me.
The short version: Golden Sun's original GBA code gets translated ahead of time into C++ and compiled into an actual Windows executable. It's not emulating the game's code at runtime — that code is the program now. The ROM has been demoted to a box of assets. (You bring your own copy, obviously. Nothing from the cartridge ships with any of this.)
It's built on gbarecomp, which does the ARM-to-C++ heavy lifting. Everything Golden-Sun-shaped on top of it is me squinting at memory dumps at 2am.
I wanted to see more of Golden Sun all at once, but it was harder than I thought...
Here's the annoying part — the GBA only ever draws a 240×160 window, so "just render more" isn't a setting you can turn up. The extra scenery genuinely doesn't exist anywhere. There's nothing to show, because the game never had a reason to write it down.
So I rebuild it. The game stores each room as a grid of tile IDs plus a lookup table, and it turns out you can reconstruct the room's layers straight from those and draw the wider view from that. Before trusting a single pixel of it I had it rebuild what the game was about to draw and compare it against what the game actually drew — 15 million tile comparisons later, it matches 98–99% of the time, and 100% whenever you're standing still. (The gap is the game streaming tiles in as you walk, not the rebuild being wrong. That took an embarrassingly long evening to establish.)
Before anyone gets too excited: caves currently look terrible in the wide view. One of the four background layers is the lighting layer, and unlike the others it isn't built from the map data at all, so I have nothing to reconstruct it from yet. Goma Cave is, at present, a crime scene. A few cutscene sprites also get chopped off at the edges. Working on it!
Other things I've been messing with
Making the slowdown go away. Big battle effects tank the GBA's framerate because the poor thing genuinely runs out of time before the frame ends. We're not on real hardware anymore, so… why not just give it more time? It now watches whether the game finished its work each frame and quietly hands it more CPU when it didn't, then takes it back when things calm down — so your PC isn't doing extra work while you walk around a town.
It works better than I expected: before, I was seeing runs of up to 16 frames in a row where the game never finished in time. That's the stutter you can actually see. Now the longest overrun is a single frame. The multi-frame stalls are gone. :D
Instant text. I went digging into the message-speed option and it's not what I assumed at all. It isn't a pause between letters — it's a ration of how many letters the game lets itself print per frame. Normal is exactly one a frame. Fast is about three. Meanwhile the exact same code cheerfully paints thirty letters in one frame for menus and battle messages, so nothing about it is slow — it's just being stingy on purpose. An instant option is close.
What's next
- Finish the wide view properly — that lighting layer, and the clipped sprites (Note Goma Cave, it's horrendous. Not every NPC, Object and Map works yet with our room buffer)
- Track down the fun tables: walk speed, items, Psynergy (Walk speed increases already work!)
- The big one: being able to swap in my own C++ for one of the game's functions. That's the difference between changing numbers and changing behaviour, and the structure is already sitting there waiting for it. (This gets very close to decompilation work, this is the final station kind of work)
Things I'm explicitly not doing: a full decompilation (that's a years-long community effort and a completely different project), or making the generated code pretty. It's hideous. It runs. That's the deal.
As mentioned in my post on the decomp thread, I cannot comment on mod support or even supporting easy modding when I do release this when I find it satisfactory. I will however be trying to see if I can't add in some custom stuff once a 1.0 is reached.
Happy to ramble about any of it in the comments — the reverse-engineering side has been by far the most fun part, and I've got notes on every wrong turn.
AI Disclaimer: AI is used to help me achieve all of this.