Fix mouse input when using DXVK
This commit is contained in:
parent
3a844cc3ca
commit
5a551b80b9
|
@ -136,12 +136,14 @@ HRESULT MainContext::CreateVertexBuffer(IDirect3DDevice9* pIDirect3DDevice9, UIN
|
|||
|
||||
return pIDirect3DDevice9->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle);
|
||||
}
|
||||
bool MainContext::OneTimeFixInit(std::unique_ptr<wchar_t[]>& className)
|
||||
bool MainContext::OneTimeFixInit(std::unique_ptr<wchar_t[]>& className, HWND hWnd)
|
||||
{
|
||||
if (wcscmp(className.get(), L"SQEX.CDev.Engine.Framework.MainWindow") == 0) {
|
||||
otf_init = true;
|
||||
hWndFF13 = hWnd;
|
||||
return true;
|
||||
}
|
||||
return otf_init;
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainContext::OneTimeFix()
|
||||
|
@ -201,6 +203,10 @@ void MainContext::FF13_InitializeGameAddresses()
|
|||
}
|
||||
|
||||
void MainContext::FF13_OneTimeFixes() {
|
||||
|
||||
if (IsDXVK())
|
||||
SetForegroundWindow(hWndFF13);
|
||||
|
||||
FF13_NOPIngameFrameRateLimitSetter();
|
||||
FF13_RemoveContinuousControllerScan();
|
||||
FF13_FixScissorRect();
|
||||
|
@ -305,6 +311,9 @@ void MainContext::FF13_SetFrameRateVariables()
|
|||
|
||||
void MainContext::FF13_2_OneTimeFixes()
|
||||
{
|
||||
if (IsDXVK())
|
||||
SetForegroundWindow(hWndFF13);
|
||||
|
||||
if (*ff13_2_frame_pacer_ptr_address) {
|
||||
**ff13_2_frame_pacer_ptr_address = MAX_FRAME_RATE_LIMIT;
|
||||
PrintLog("Frame pacer disabled");
|
||||
|
|
|
@ -203,25 +203,14 @@ bool MainContext::CheckWindow(HWND hWnd)
|
|||
bool class_found = config.GetWindowWindowClass().compare(className.get()) == 0;
|
||||
bool window_found = config.GetWindowWindowName().compare(windowName.get()) == 0;
|
||||
bool force = config.GetBorderlessAllWindows();
|
||||
bool ff13fix = OneTimeFixInit(className);
|
||||
bool ff13fix = OneTimeFixInit(className, hWnd);
|
||||
|
||||
return class_found || window_found || force || ff13fix;
|
||||
}
|
||||
|
||||
void MainContext::ApplyWindow(HWND hWnd)
|
||||
{
|
||||
HWND insertAfter = HWND_TOP;
|
||||
if (config.GetWindowTopMost() && !context.IsDXVK())
|
||||
insertAfter = HWND_TOPMOST;
|
||||
|
||||
SetWindowPos(hWnd, insertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
|
||||
SetFocus(hWnd);
|
||||
|
||||
// fixes DXVK window in background, no need to click anymore
|
||||
if (context.IsDXVK())
|
||||
SetForegroundWindow(hWnd);
|
||||
|
||||
if (config.GetOptionsAlwaysActive() || config.GetOptionsHideCursor() || IsDXVK())
|
||||
if (config.GetOptionsAlwaysActive() || config.GetOptionsHideCursor())
|
||||
{
|
||||
context.oldWndProc = (WNDPROC)context.TrueSetWindowLongA(hWnd, GWLP_WNDPROC, (LONG_PTR)context.WindowProc);
|
||||
}
|
||||
|
@ -273,7 +262,7 @@ LRESULT CALLBACK MainContext::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||
if (context.config.GetOptionsAlwaysActive())
|
||||
return TRUE;
|
||||
|
||||
if (!context.config.GetOptionsForceHideCursor() || context.IsDXVK())
|
||||
if (!context.config.GetOptionsForceHideCursor())
|
||||
while (::ShowCursor(TRUE) < 0);
|
||||
break;
|
||||
}
|
||||
|
@ -281,10 +270,9 @@ LRESULT CALLBACK MainContext::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||
case WM_ACTIVATEAPP:
|
||||
if (context.config.GetOptionsAlwaysActive())
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
if (context.config.GetOptionsForceHideCursor() || context.IsDXVK())
|
||||
if (context.config.GetOptionsForceHideCursor())
|
||||
while (::ShowCursor(FALSE) >= 0);
|
||||
|
||||
return CallWindowProc(context.oldWndProc, hWnd, uMsg, wParam, lParam);
|
||||
|
|
|
@ -65,8 +65,6 @@ private:
|
|||
enum class AutoFixes : u32
|
||||
{
|
||||
NONE = 0,
|
||||
RESIDENT_EVIL_4,
|
||||
KINGS_BOUNTY_LEGEND,
|
||||
FINAL_FANTASY_XIII,
|
||||
FINAL_FANTASY_XIII2,
|
||||
};
|
||||
|
@ -74,6 +72,7 @@ private:
|
|||
void EnableAutoFix();
|
||||
|
||||
AutoFixes autofix = AutoFixes::NONE;
|
||||
HWND hWndFF13 = 0;
|
||||
|
||||
std::mutex fix_mutex;
|
||||
|
||||
|
@ -140,7 +139,7 @@ private:
|
|||
void FF13_2_OneTimeFixes();
|
||||
void FF13_2_EnableControllerVibration();
|
||||
|
||||
bool OneTimeFixInit(std::unique_ptr<wchar_t[]>& className);
|
||||
bool OneTimeFixInit(std::unique_ptr<wchar_t[]>& className, HWND hWnd);
|
||||
std::atomic_bool otf_init = false;
|
||||
|
||||
static void Fix_Thread();
|
||||
|
|
Loading…
Reference in a new issue