crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
880 stars 78 forks source link

Alternate refcounting method #20

Closed CookiePLMonster closed 7 years ago

CookiePLMonster commented 7 years ago

With this change, underlying d3d9 resources don't have their refcounts changed by wrapper's AddRef and Release and instead they only get released once at wrapper destruction time. Instead of returning underlying resource's refcount from wrapper functions, now wrapper's refcounts are returned. This fixes cases where the game is doing something like

while(resource->Release() > 0);

Might also be a micro optimization since it issues less d3d calls (albeit refcount ones should be nearly no-ops).

Fixes #19

CookiePLMonster commented 7 years ago

Also switched the project to Unicode because... why not? W versions of WinAPI functions should be preferred these days and the only affected lines are

MessageBox(nullptr, TEXT("Failed to open debug log file \"d3d8.log\"!"), nullptr, MB_ICONWARNING);

const HMODULE module = LoadLibrary(TEXT("d3dx9_43.dll"));