GeDoSaTo alt-tabbing crash fixed

I just fixed the alt-tabbing crash when downsampling.
This was the result of a bit more than 3 hours of heavy debugging today, after doing the same already (unsuccessfully) a few times previously over the week.

Basically, the issue has always been that my calls to device->Reset() returned a D3DERR_NOTAVAILABLE error code. According to the documentation that’s not even possible, but here we are.

My error when debugging this was assuming that similar issues as for “normal” programs could apply. So I spent most of my time trying to hunt down a resource/memory leak – the usual cause for failing calls to Reset(). I should have known that I am not someone who just leaks memory willy-nilly ;). By the way, Microsoft’s PIX works really well for memory leak debugging DirectX9 applications.

The actual cause was much more obscure, and directly related to what a rather insane piece of software GeDoSaTo is in the first place. Basically, while downsampling, GeDoSaTo manipulates the results of umpteen Windows API calls to give an application the illusion – as perfectly as possible – that it is running on a display featuring the downsampling resolution. As it turns out, when DirectX performs a Reset operation, it checks whether its resolution switching succeeded using one of these APIs. So, after many hours over weeks of debugging, the solution to the crash is simply to turn off all the relevant interception mechanisms while the Reset() call is happening.


DPfix source release

The source code for DPfix is now up on github.

I always planned to do this, but I decided to do so earlier rather than later for a few reasons:

  • 0.8 works perfectly for me, but causes problems on many other systems, and it’s very hard to “remotely” debug issues.
  • I’ll be really busy with work the rest of this week and throughout next week, so I can’t spend as much time on Deadly Premonition (or anything really) as I would like.
  • Someone asked for it.

Now, when I released DSfix I was a bit disappointed by the lack of external contributions. There were a few brave souls, and I’m very grateful, but overall 95% of the code in DSfix is still written by me and untouched.

I think the problem was at least partly a lack of documentation and guidelines on my part, so I just spent over 2 hours writing up a developer README for DPfix. Have a look if you are thinking about contributing, or if you simply want to get a better idea about how Deadly Premonition works or how I create these interceptors.