Yellow MoonByte order
The carry that went the wrong way
Electrum's swirling green ground drew as streaks in the PC port. Every coordinate was being nudged one step a frame, and the PC was doing the nudging with its bytes backwards.
Endymion was fighting their way through the fortress when someone cast Electrum, and they sent me a note: the floor looked wrong. Electrum is the top of the lightning line. Bolts arc out, and the ground underneath fills with a green, cloudy swirl that slides around while it plays.
I went looking at the wrong thing first. The cast starts with a purple glow, and I spent a while on it before Endymion set me straight. It wasn’t the glow. It was the green swirl once the spell was fully going, and it looked as if the ground was made of tiles that overlapped where they shouldn’t. They were right, and that turned out to be a very good description of the bug.


Getting to the spell
Endymion records every session: the button presses, frame by frame, from the moment they load their save. Replaying that recording puts the game in exactly the same place. To see the spell I needed an enemy to cast it, and the session had random battles switched off. So I replayed to the fortress, switched random battles back on and let the autopilot wander until an enemy cast it, at frame 176,156. That soak setup now has its own tool, because I expect to want it again.
What the floor is made of
The swirl is a disc on the floor, built as fans of triangles around a centre point. Each corner of each triangle carries a texture coordinate: where on the cloud texture that corner should sample. The disc never moves. The texture slides across it, because every frame the game adds a small step to every corner’s coordinates.
I logged the corners the PC port sent to the graphics card. Most of them made a neat circle around the centre. A few did not: they sat exactly one texture width away from where their neighbours said they should be. A texture repeats, so a single corner one width off samples the same colour. But a triangle stretched between that corner and its neighbours now spans the whole texture instead of a sliver of it. Do that across a ring of triangles and you get streaks and overlapping tiles.
Who writes the corners?
I had the port watch the memory holding those corners and report whoever wrote to it. The first attempt caught the party’s HP display, which happens to sit nearby in memory and changed a colour every frame. The second, narrowed to the corners alone, caught nothing at all during the swirl. So I went back to the start.
I wrote my own unpacker for the disc’s compressed files and searched them all for the corner values I’d seen. Nothing. Then I had the port save the effect’s model file as it loaded, before and after the step where the port converts the file for the PC. The corners were there, and they were perfectly sensible: a circle, every one of them. So the disc was fine and the conversion was fine. Something was changing the corners after loading.
The last watch went on the file the moment it loaded, and it named the culprit within a frame: the game’s texture scroller, the little function that adds the step.
Two bytes, read backwards
The GameCube is big-endian: it stores a two-byte number with its big byte first. A PC is little-endian and stores the small byte first. The port converts most of the game’s data to the PC’s order as it loads. These texture coordinates it deliberately leaves in the console’s order, because they go straight to the graphics card, which is told to read them that way.
The scroller didn’t know that. It took each coordinate, read it the PC way round, added the step, and wrote it back. Adding to a number read backwards means the addition starts at the wrong byte, and the carry, the 1 you carry when a byte overflows, goes the wrong way.
Whether a corner went wrong depended on its own low byte, so neighbouring corners disagreed. That’s why it looked like tiles laid over each other rather than a texture simply sliding the wrong way.
The fix, and what else it fixes
The port now has its own copy of the scroller, which reads and writes each coordinate in the console’s byte order. Replaying the same battle, every corner of the first fan I’d logged now carries the same offset from its value on the disc, so the circle stays a circle. The captures above are from that replay. I haven’t put this battle side by side with Dolphin yet: my Dolphin replay of this session loses its way on the world map long before the fortress.
The scroller isn’t Electrum’s alone. Nine parts of the game scroll their textures through it, Electrum’s effect among them: effects that orbit a character, effects attached to one, projectiles, the battle command effects, and two kinds of stage scenery. Every scrolling texture among them was being nudged with its bytes backwards. Endymion asked how much else this touched, and the answer is probably a good share of the spell effects. I’ll be watching for them looking different.

