From b8cedae5275566ef30e4e862ac1aa68f2fb12de4 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Sat, 12 Dec 2020 23:45:16 +0100 Subject: [PATCH] PAD: windows: fix DInput --- pcsx2/PAD/Windows/Diagnostics.cpp | 2 +- pcsx2/PAD/Windows/DirectInput.cpp | 2 +- pcsx2/PAD/Windows/Global.h | 3 --- pcsx2/PAD/Windows/PADConfig.cpp | 12 ++++++------ 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pcsx2/PAD/Windows/Diagnostics.cpp b/pcsx2/PAD/Windows/Diagnostics.cpp index 3baa75facd..1b3bb9de20 100644 --- a/pcsx2/PAD/Windows/Diagnostics.cpp +++ b/pcsx2/PAD/Windows/Diagnostics.cpp @@ -158,6 +158,6 @@ void Diagnose(int id, HWND hWnd) else dm->EnableDevice(i); } - DialogBox(hInst, MAKEINTRESOURCE(IDD_DIAG), hWnd, DiagDialog); + DialogBox(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_DIAG), hWnd, DiagDialog); ClearKeyQueue(); } diff --git a/pcsx2/PAD/Windows/DirectInput.cpp b/pcsx2/PAD/Windows/DirectInput.cpp index d78b261fb1..2d0401bdff 100644 --- a/pcsx2/PAD/Windows/DirectInput.cpp +++ b/pcsx2/PAD/Windows/DirectInput.cpp @@ -76,7 +76,7 @@ IDirectInput8* GetDirectInput() { if (!di8d.lpDI8) { - if (FAILED(DirectInput8Create(hInst, 0x800, IID_IDirectInput8, (void**)&di8d.lpDI8, 0))) + if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), 0x800, IID_IDirectInput8, (void**)&di8d.lpDI8, 0))) return 0; } di8d.refCount++; diff --git a/pcsx2/PAD/Windows/Global.h b/pcsx2/PAD/Windows/Global.h index d684f4bd83..fcc2a55937 100644 --- a/pcsx2/PAD/Windows/Global.h +++ b/pcsx2/PAD/Windows/Global.h @@ -130,8 +130,5 @@ extern Window GSwin; #include "PS2Edefs.h" -#ifdef _MSC_VER -extern HINSTANCE hInst; -#endif // Needed for config screen void GetNameAndVersionString(wchar_t* out); \ No newline at end of file diff --git a/pcsx2/PAD/Windows/PADConfig.cpp b/pcsx2/PAD/Windows/PADConfig.cpp index ba5214486c..1a58a9dfd2 100644 --- a/pcsx2/PAD/Windows/PADConfig.cpp +++ b/pcsx2/PAD/Windows/PADConfig.cpp @@ -350,13 +350,13 @@ void PADsetSettingsDir(const char* dir) _wfopen_s(&temp, iniFileUSB, L"r"); if (!temp) { // File not found, possibly. - HRSRC res = FindResource(hInst, MAKEINTRESOURCE(IDR_INI1), RT_RCDATA); + HRSRC res = FindResource(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_INI1), RT_RCDATA); if (!res) return; - HGLOBAL data = LoadResource(hInst, res); + HGLOBAL data = LoadResource(GetModuleHandle(nullptr), res); if (!data) return; - size_t size = SizeofResource(hInst, res); + size_t size = SizeofResource(GetModuleHandle(nullptr), res); u8* fdata = (u8*)LockResource(data); _wfopen_s(&temp, iniFileUSB, L"w"); if (!temp) @@ -1375,7 +1375,7 @@ void AddTooltip(UINT id, HWND hWnd) HWND hWndTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hWnd, NULL, hInst, NULL); + hWnd, NULL, GetModuleHandle(nullptr), NULL); if (hWndTip == NULL) return; @@ -2502,7 +2502,7 @@ void UpdatePadPages() ZeroMemory(&psp, sizeof(psp)); psp.dwSize = sizeof(psp); psp.dwFlags = PSP_USETITLE | PSP_PREMATURE; - psp.hInstance = hInst; + psp.hInstance = GetModuleHandle(nullptr); psp.pfnDlgProc = DialogProc; psp.lParam = port | (slot << 1); psp.pszTitle = title; @@ -3089,7 +3089,7 @@ void Configure() ZeroMemory(&psp, sizeof(psp)); psp.dwSize = sizeof(psp); psp.dwFlags = PSP_USETITLE | PSP_PREMATURE; - psp.hInstance = hInst; + psp.hInstance = GetModuleHandle(nullptr); psp.pfnDlgProc = GeneralDialogProc; psp.pszTitle = L"General"; psp.pszTemplate = MAKEINTRESOURCE(IDD_GENERAL);