← Back to context

Comment by vintagedave

6 hours ago

I was quite interested in the patch -- am I right in thinking the DirectX library only exports a single function and _everything_ else is through DX interfaces?

I expected to see significantly more code, pass-through to the original DLL.

> am I right in thinking the DirectX library only exports a single function and _everything_ else is through DX interfaces

Yup! That's why I didn't have to create a gazillion passthrough functions.

The original DLL in my modern Windows installation has these 8 exports:

    DirectInputCreateA
    DirectInputCreateEx
    DirectInputCreateW
    DllCanUnloadNow
    DllGetClassObject
    DllRegisterServer
    DllUnregisterServer

The game only calls DirectInputCreateA, and the rest happens via the COM object that that function creates.

The author linked to the repo and the code is at https://github.com/seritools/castrol-honda-dinput-fix/blob/m...

Seems pretty straightforward. They hook DirectInputCreateA() and pass their own device enumeration wrapper with the offending flag removed.

  • The flag DIDEVTYPE_JOYSTICK was added by this fix not removed.

    The idea is, rather than handle up to 8 devices, otherwise UB and usually crash, handle up to 8 "joysticks" and disregard any beyond that.

    • I'd just use WineD3D in this case; I'm sure there's dinput.dll too ported to Wine for Windows.

    • Apologies, that's what I meant to say. I blame that on my lack of coffee today, my bad.