Load xinput if it's not already loaded

This commit is contained in:
kynex7510 2024-06-02 23:10:05 +02:00
parent 1f9cb46b02
commit 9385cb302c
No known key found for this signature in database
GPG key ID: 8BBB0FD2C57920AD

View file

@ -22,6 +22,9 @@ struct XINPUT_STATE;
#pragma comment(linker, "/export:XInputGetState,@2")
extern "C" DWORD XInputGetState(DWORD dwUserIndex, XINPUT_STATE *pState) {
auto xinput = GetModuleHandleA(XINPUT_PATH);
if (!xinput)
xinput = LoadLibraryA(XINPUT_PATH);
if (xinput) {
auto fp = GetProcAddress(xinput, "XInputGetState");
if (fp) {