24 ms·
Here's my favorite war story, from a GameCube launch title. QA discovered that if you rapidly toggled back and forth between two menus in the front end you mig
by petewarden 17y ago
Here's my favorite war story, from a GameCube launch title.
QA discovered that if you rapidly toggled back and forth between two menus in the front end you might get a hang, though it could take 10 minutes.
I was eventually able to reproduce it in the debugger, and it was bizarre. A local variable getting corrupted to strange values, but there was no memory corruption visible at all, just the register was incorrect, when it was only ever assigned to once.
No matter what test cases I tried to cut the code down into, it didn't crash. Inspecting the disassembly everything seemed fine.
Finally, I noticed something strange. The suspect variable was in r19, which thanks to the allocation strategy was very unusual, it was most often unused. That gave me enough of a clue to create a cut-down test case that included all the function arguments and local variables without the code, to make sure I got the same register allocation.
I was able to write a single main.c that set the variable once and sat in an infinite loop waiting until it changed. Bingo! _Something_ crept in and changed that value, and it sure wasn't our code. There wasn't much of an OS on the Gamecube, but there must have been some interrupt that wasn't cleaning up its changes to r19 like it should.
I sent off the minimal code to a Nintendo developer support engineer, and monkeyed with our code to avoid having so many local variables in that one function, which fixed our problem. The Nintendo engineer fessed up that it must be their issue, but then the report vanished into the Nintendo bunker, never to be seen again...
Despite being a nightmare I'm glad I escaped, there were some sheer moments of coding joy in the game industry.
- daeken 17y agoThis is the type of thing that makes me love and hate emulator development. It's amazing how much code can actually depend on behavior like this, and how often bugs in an emulator are cases where things aren't implemented in the same "broken" way as the original hardware/firmware. It does make it interesting and challenging, though.