TTG, please stop trying to detect DirectX by loading and unloading d3d9.dll

I think I've seen this code in pretty much all of your games:

  • HMODULE hD3d = LoadLibrary(TEXT("d3d9.dll")); // Also d3d9.dll
  • if (hD3d == NULL)
  • {
  • MessageBox(NULL, TEXT("Please install Direct3D.\n"), TEXT("Telltale Games"), MB_OK);
  • return 0;
  • }
  • // Other code here, not making use of hD3d at all
  • FreeLibrary(hD3d);

(Bullet points are to work around non-functioning multiline code markup)

This has been causing me a bit of trouble, and is completely necessary. First, about the trouble. There turns out to be a bug in NVIDIA's driver where if a program links a DLL at both load-time and run-time, and later unloads the same library with FreeLibrary(), the driver erroneously starts unhooking things. This gets especially annoying if I launch the game through Steam, where the overlay wouldn't work at all because the driver unhooked it. This is NVIDIA's fault, and I've already filed a bug report with them. However, on to the second part. This is completely unnecessary because if someone was actually missing Direct3D, the game wouldn't even begin loading, instead Windows will give the error "Application has failed to start because d3d9.dll was not found" (all imported functions have to be resolved successfully before Windows will even begin running program code). The code that would run if d3d9.dll wasn't present would never get executed. So it's a pointless waste of time and it triggers bugs. To make my Steam Overlay work again, I have to load the game into a debugger, find the offending code, and NOP out the instructions. It's very annoying, especially that I've done it about a dozen times now.

So going forwards, can you please stop putting this code in? It's pointless, and causes problems with badly written DirectX hooking programs. Yes, badly written hooking programs are faulty, but can we try to work together?

Comments

  • TelltaleMikeTelltaleMike Former Telltale Staff

    I apologize for any difficulties this has caused you. Thank you for your feedback. I will make sure to pass it along to the team for further investigation.

This discussion has been closed.