Overlay Refacs: error handling, logging, asserts, OO

* In doPresent on failure return and clean up correctly
* More error handling, checking the results of WinAPI function calls
* Better debug logging (as in more, more detailed, more explicit)
* Add asserts to explicit about expected guarantees
* Remove unused GetViewport
* Better handling of DevState::dev
** Make device a constructor parameter of DevState.
It was set only directly after construction anyway.
** Make DevState::dev private with getter
** Add DevState methods releaseStateBlock and releaseTexture.
We had releaseData before, which with the new name is now more specific
about what it does. The other method extracts duplicate logic into the method.
Overlay Refacs: Add CriticalSection Mutex to reset functions. Remove commented out code.
Overlay: Change refcount logic

* Change from trible-count trying to hide by faking to using the native
count.
Overlay: d3d9: Remove Win8 specific code
Overlay: Fix findOriginalDevice

* Free device at the end
Overlay: Make DevState hold reference to device

* This is actually how it should be, as DevStates does hold a reference.
(However, being hooked into the Release method of the device and then
deleting DevState at some point makes this argumentation arguable.)
Overlay: Add Mutex to doPresent where possible

* doPresent searches for and uses DevState from devMap.
Thus, it should actually Mutex the entire method.
As this is not possible because of another (potential) Mutex down the code
path, add the Mutex where possible.

Doing it this way has a performance cost with unknown advantage. Also, the
DevState potentially disappearing while the method is being executed is
pretty stupid. But it is the best we can do right now.