Skip to content

Commit

Permalink
Fixed issues caused by refactoring config code to use a static structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Mar 6, 2024
1 parent 0f880f7 commit 9c4f670
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct config_s {
wchar_t wszPathToSystemXInput1_1 [MAX_PATH] = L"";
wchar_t wszPathToSystemXInput9_1_0 [MAX_PATH] = L"";
DWORD dwFillTheSwamp = 0x1;
} static config;
};

static volatile LONG __VP_DLL_Refs = 0UL;
extern config_s config;
extern volatile LONG __VP_DLL_Refs;
11 changes: 11 additions & 0 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#pragma comment (lib, "SKinHook/libMinHook64.lib")
#endif

config_s config;
volatile LONG __VP_DLL_Refs = 0UL;

static CreateFileA_pfn CreateFileA_Original = nullptr;
static CreateFileW_pfn CreateFileW_Original = nullptr;
static CreateFile2_pfn CreateFile2_Original = nullptr;
Expand Down Expand Up @@ -624,17 +627,25 @@ DllMain ( HMODULE hModule,
{
InterlockedIncrement (&__VP_DLL_Refs);

config = { };

#ifdef _M_IX86
GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_4, MAX_PATH);
GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_3, MAX_PATH);
GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_2, MAX_PATH);
GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_1, MAX_PATH);
GetSystemWow64DirectoryW (config.wszPathToSystemXInput9_1_0, MAX_PATH);
#else
GetSystemDirectoryW (config.wszPathToSystemXInput1_4, MAX_PATH);
GetSystemDirectoryW (config.wszPathToSystemXInput1_3, MAX_PATH);
GetSystemDirectoryW (config.wszPathToSystemXInput1_2, MAX_PATH);
GetSystemDirectoryW (config.wszPathToSystemXInput1_1, MAX_PATH);
GetSystemDirectoryW (config.wszPathToSystemXInput9_1_0, MAX_PATH);
#endif
PathAppendW (config.wszPathToSystemXInput1_4, L"XInput1_4.dll");
PathAppendW (config.wszPathToSystemXInput1_3, L"XInput1_3.dll");
PathAppendW (config.wszPathToSystemXInput1_2, L"XInput1_2.dll");
PathAppendW (config.wszPathToSystemXInput1_1, L"XInput1_1.dll");
PathAppendW (config.wszPathToSystemXInput9_1_0, L"XInput9_1_0.dll");

CRegKey hkValvePlug;
Expand Down

0 comments on commit 9c4f670

Please sign in to comment.