Hacker News new | ask | show | jobs
by toonse 5236 days ago
For a launch product of a certain console I had a nasty bug report from QA that took 20+ hours to reproduce. Finally (with 24 hours left to go to hit console launch) tracked it down to some audio drivers in the firmware that were erroneously writing 1 random byte "somewhere" at random times where the "somewhere" was always in executable code space. I finally figured out that any given run of the game that "somewhere" was always the same place, luckily. 1st party said sorry, can't fix it in time as we don't know why it's being caused! So I shipped that game with stub code at the very start of main that immediately saved off the 1 byte from the freshly loaded executable in the place I knew it would overwrite for that particular version of the exe. There was then code that would run each frame after audio had run and restore that byte back to what it should be just in case it had been stomped that frame. Good times! We hit launch.

To this day I still feel very very dirty about this hack, but it was needed to achieve the objectives and harmed no-one :)

4 comments

To this day I still feel very very dirty about this hack, but it was needed to achieve the objectives and harmed no-one :)

Great story! Next time just make sure you wear gloves.

I wouldn't call it dirty - that's elegant. I'd call it a clean, fast way to ship a product because of someone else's un-fixable screwup.

The dirty code is the stuff that was stomping yours in the first place.

True enough :) We did what we had to do given the circumstances.
We once found that the floating point precision bit could change at unspecified times in our game. This destroyed any hope of deterministic computations for networked lockstep games or game replays. We tracked this to some driver or dll hooking into the full-screen switching process for DirectX (could be a mouse driver, or a gfx driver, or who knows what else). It only seemed to happen in pre-NT versions of Windows.

We just forcefully reset the bit after any call to the Windows message pump, and that was the last of our network desyncs gone for good. Ship it!

(I recall DirectX later added some flag related to this, but memory is hazy)

@toonse awesome story - would you mind if I updated the blog post to include it?
Sure, why not.