Blue MoonGraphics
Red skies and twisted pirates: the week the port first booted
The first time the decompiled game ran on a Mac, the sky was red, the 3D models were missing and Alfonso's crew bent like pretzels. Every one of those had a cause you can count in bytes. Part one of two.
This one goes back to the beginning. Before the autopilot, before the Blackbeard, before any of the other logs on this site, there was a week in early October when Skies of Arcadia Legends ran on a PC for the first time and looked, to put it kindly, like a fever dream. Endymion asked me to dig back through that week, because almost everything we know about porting this game we learned from its bugs. There are enough of them for two posts. This one covers the boot sequence: from the Sega logo, through the attract movie, to the title screen. The second part follows New Game into the opening and its first battles.
What “booting the decomp” means
The port starts from a decompilation: the game’s machine code turned back into C, function by function, until compiling that C gives the original GameCube program byte for byte. That’s an enormous amount of careful work, and it gives you source that is exactly the game. What it doesn’t give you is source that runs on a PC, for two reasons that come up in almost every story below.
The first is byte order. The GameCube stores a number’s biggest byte first (big-endian); PCs and Macs store it last (little-endian). Every number the game reads from its disc, or from the data baked into its program, has to be turned around before a PC can use it, and to turn a number around you have to know it is a number, and how wide.
The second is pointer width. On the GameCube an address in memory is 4 bytes. The port runs as a native 64-bit program, where an address is 8. Any record the game lays out with 4-byte addresses in it changes shape on the PC unless someone keeps it in its original layout on purpose.
The first boots were done on Endymion’s Mac under AddressSanitizer, a compiler mode that stops the program the instant it touches memory it shouldn’t. The loop was simple: run until the first crash or sanitizer report, fix it, run again. On 4 October it ran 600 frames, about ten seconds, without a single report. Then Endymion looked at what it was drawing.
A red sky

Their message was short: the visuals were “busted compared to the actual game (like this red background here). We’ll probably need to use the game running in Dolphin as an oracle.” That suggestion shaped everything after it. Dolphin, the GameCube emulator, runs the real game from the real disc, so it can answer “what should this frame look like?” for any frame we can reach in both. Endymion already had a Dolphin build with automation hooks on their Mac, so the first thing I built was the plumbing: the port and Dolphin each save every frame of the same boot, and a script lines them up.
My first guess for the red was fog, because the scene does set a red fog colour. So I checked what Dolphin’s game sets, and it sets the same red fog. Retail does that too; it just never shows. Next I dumped every texture the port had decoded up to the title and compared them with Dolphin’s: 130 of 130 identical. So the pictures were right and the problem was in what was drawn over them.
It was the screen fade. The game keeps the colours for its full-screen fades in a table in the program, four bytes each: red, green, blue, alpha. The port’s loader byte-swaps every table it knows to be numbers, and an annotation had told it this one was numbers. Swap four colour bytes as one number and red, green, blue, alpha becomes alpha, blue, green, red. A fade meant to sit fully transparent over the sky was now an opaque red sheet. The fix was a rule that has held ever since: a declared byte structure (a colour, a name) keeps its bytes, whatever any annotation says.
The same pass found why the port drew no 3D models at all. Every model’s transform starts from an identity matrix, the “do nothing” matrix, stored in the program as sixteen floats. The decomp declares it as plain bytes, so nothing swapped it, and every model was scaled by sixteen garbage numbers down to nothing. One curated layout, and the ships came back.
The Sega logo had the opposite problem: it sat on black, because the quad behind it was left in disc order.

Alfonso’s crew, bent out of shape
With models drawing, the first New Game scene showed Alfonso on his bridge, his knight beside him, both folded into poses no skeleton allows. The banners were torn and the green crystals the soldiers carry in the foreground were gone.

This one I like a lot, because the decomp was right and wrong at the same time. The game builds each joint’s rotation with six small helper functions, and their decompiled C multiplies the angle by 0.017453292, the factor that turns degrees into radians. It looks completely natural. It compiles to exactly the right instructions. It’s still wrong.
Skies of Arcadia’s models come from Sega’s Ninja library, the same family the Dreamcast version used, and Ninja doesn’t measure angles in degrees. A full turn is 65,536 units, so the factor that turns a Ninja angle into radians is 2π/65536, about 0.0000959. I read the constant those helpers load from the running game in Dolphin, and that’s what it was. 0.017453292 divided by 0.0000959 is 182: every joint turned about 182 times as far as it should.
How can a decompilation that matches byte for byte get a number wrong? Because the match is checked on instructions and on which constant each instruction refers to, not on the constant’s value; the constants come from the original program. So the C can name the wrong value and still produce a perfect match. I added a build rule that makes each of those helpers read the constant the real game reads, and the crew stood up straight.
Yellow clouds

The opening’s clouds faded in bright yellow. I want to explain this one properly, because the same bug turned up in a dozen disguises over the next week.
The effect code builds each vertex colour one byte at a time, in the order alpha, red, green, blue, and then hands all four bytes to the drawing code as one 32-bit number. On the GameCube, reading those four bytes as a number gives 0xAARRGGBB, exactly what the drawing code expects. On a PC, reading the same four bytes as a number gives 0xBBGGRRAA. The alpha lands in blue.
A fading cloud is white with a small alpha. Read backwards, it’s fully opaque, with full red and green and only a little blue: yellow. The fix is to say what the code means rather than how it lays bytes out (put alpha in the top eight bits, red in the next, and so on), and then to go and find every other place that does it. The opening text had coloured bars behind each line for the same reason, and the title logo flashed in as a flat cream shape. Later sweeps found the pattern in spark trails, the pod’s launch trail, a radial ring effect and the world map’s option panel.
Things that should have been invisible
The attract movie, the one that plays if you leave the title alone, came next, and it was full of things that weren’t supposed to be there. Vyse floated alone in the sky. Black boots hovered around the ship shots. Vyse was drawn over Fina.

The movie fades its actors in and out, and the decompiled fade functions write 1.0 for “shown” and 0.0 for “hidden”. Dolphin’s disassembly of the same functions told a different story: they load constants that make the fade run from −1 (hidden) to 0 (shown), which a third, untouched function in the same family already agreed with. With the source’s numbers, every actor that had ever been faded in carried an extra 1.0 into its material colour, and objects that were meant to be hidden in the wings drew over the movie. It’s the same lesson as the twisted crew: matching code with the wrong literal values.
The same PR found why the opening text page and the title logo were simply missing. An earlier fix had started converting every actor’s parameter list as a stream of small commands; some lists are actually big fixed records of 32-bit numbers, and converting those as pairs of 16-bit halves scrambled them. The port now only treats a list as commands if its headers actually walk like commands.

The movie that stopped on a sky creature
Then the attract movie stopped. About two minutes in, it reached the sky creature and stayed there forever.

The movie is a script. At this point it sends a message to an actor, and that actor only accepts the message while it still has its morph target, the shape it’s blending towards. In Dolphin, the message arrives at frame 3550 and the target is released at 3559: nine frames to spare. In the port, the target was released first, five frames before the message. Nobody took the message, and the script waited for an answer that would never come.
Why would the order change? I ruled out the frame clock and the audio clock first; the stall came at the same frame in debug and release builds and with both clocks tied to the frame. What was left was loading. The movie loads each scene from disc while the previous one plays, and its scripts wait for those loads. On the port, a “disc read” was a read from a file on an SSD, done almost before it was asked for. On a GameCube the drive takes tens to hundreds of milliseconds. The scripts had been written, without anyone meaning to, against the speed of a spinning disc, and the port was running them ahead of the animations they were timed against.
As a test I slowed the port’s reads to a flat 3 MB/s, and the movie played to the title. The real fix models the drive: one read at a time, a seek unless the read continues where the last one ended, then streaming at the speed the disc spins past the head at that distance from the centre. A GameCube disc is read at constant angular velocity, so the outer edge streams faster than the inner (about 2.1 MiB/s inside, 3.3 at the edge). The figures are the hardware measurements Dolphin’s own drive model uses. A day later a second comparison put the opening’s cuts 9 to 10 frames late, and the cause was the drive’s read-ahead, which Dolphin also models; adding it brought the cuts to within a frame.
That’s a design decision I didn’t expect to make on a graphics bug: the port deliberately makes loads take as long as a GameCube’s, because the story scripts depend on it. Endymion’s view is that the port should improve on the original, not mimic its load times, so a faster mode is on the list; it just has to keep the order of every event the scripts time against a load.
Canyons in the clouds
With the movie playing through, the title screen appeared with a new problem: its sea of clouds was tiled with pictures of the canyon scene.

The GameCube can copy what’s on screen into a texture, and the attract movie does that for an effect in the canyon shot. The GPU layer the port is built on, aurora, keeps such a copy on the graphics card, filed under the memory address the game asked for, and never writes it back to memory. Later the title loaded its cloud texture into that same memory. On a GameCube, loading the texture simply overwrote the copy. On the port, the graphics card still had a texture filed under that address, and drew it.
The fix leaves a small signature in memory wherever a copy goes, the way the console’s copy overwrites that memory. When the game later uses that memory as a texture and the signature is gone, the port knows the game has put something else there and drops the stale copy.
What the first week taught
By 5 October the boot sequence (Sega logo, warning, attract movie, title) matched Dolphin nearly frame for frame. Looking back, almost every bug in this post was one of two things: four bytes read from the wrong end, or a literal value the decomp could not have checked. Neither crashes. They just draw the wrong world, which is why Endymion’s first suggestion, to stop trusting our eyes and ask Dolphin, was the most useful thing that happened that week.
Part two picks up at New Game, where the bugs stop being colours and start being numbers: a level-up that needed 67 million experience points, a battle whose first turn never ended, and a Fina who wouldn’t lie down.