Fix mouse input at start when using borderless mode

This commit is contained in:
rebtd7 2021-03-16 09:49:38 -03:00
parent 91e999b33a
commit d5cf2b4bef
3 changed files with 10 additions and 5 deletions

View file

@ -199,10 +199,14 @@ void MainContext::FF13_InitializeGameAddresses()
ff13_party_screen_scissor_scaling_factor_4 = baseAddr + 0x668E91; ff13_party_screen_scissor_scaling_factor_4 = baseAddr + 0x668E91;
} }
void MainContext::ForceWindowActivate(const HWND hWnd) {
PostMessage(hWnd, WM_ACTIVATE, WA_INACTIVE, NULL);
PostMessage(hWnd, WM_ACTIVATE, WA_CLICKACTIVE, NULL);
}
void MainContext::FF13_OneTimeFixes() { void MainContext::FF13_OneTimeFixes() {
if (IsDXVK()) ForceWindowActivate(hWndFF13);
SetForegroundWindow(hWndFF13);
FF13_NOPIngameFrameRateLimitSetter(); FF13_NOPIngameFrameRateLimitSetter();
FF13_RemoveContinuousControllerScan(); FF13_RemoveContinuousControllerScan();
@ -309,8 +313,7 @@ void MainContext::FF13_SetFrameRateVariables()
void MainContext::FF13_2_OneTimeFixes() void MainContext::FF13_2_OneTimeFixes()
{ {
if (IsDXVK()) ForceWindowActivate(hWndFF13);
SetForegroundWindow(hWndFF13);
if (*ff13_2_frame_pacer_ptr_address) { if (*ff13_2_frame_pacer_ptr_address) {
**ff13_2_frame_pacer_ptr_address = MAX_FRAME_RATE_LIMIT; **ff13_2_frame_pacer_ptr_address = MAX_FRAME_RATE_LIMIT;

View file

@ -179,6 +179,7 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
pPresentationParameters->SwapEffect = pPresentationParameters->MultiSampleType == D3DMULTISAMPLE_NONE ? D3DSWAPEFFECT_DISCARD : D3DSWAPEFFECT_FLIP; pPresentationParameters->SwapEffect = pPresentationParameters->MultiSampleType == D3DMULTISAMPLE_NONE ? D3DSWAPEFFECT_DISCARD : D3DSWAPEFFECT_FLIP;
pPresentationParameters->Windowed = TRUE; pPresentationParameters->Windowed = TRUE;
pPresentationParameters->FullScreen_RefreshRateInHz = 0; pPresentationParameters->FullScreen_RefreshRateInHz = 0;
PrintLog("ForceWindowedMode"); PrintLog("ForceWindowedMode");
} }
} }

View file

@ -139,6 +139,7 @@ private:
void PrintVersionInfo(); void PrintVersionInfo();
void FF13_InitializeGameAddresses(); void FF13_InitializeGameAddresses();
void FF13_OneTimeFixes(); void FF13_OneTimeFixes();
void FF13_EnableControllerVibration(); void FF13_EnableControllerVibration();
void FF13_NOPIngameFrameRateLimitSetter(); void FF13_NOPIngameFrameRateLimitSetter();
@ -154,8 +155,8 @@ private:
void FF13_2_EnableControllerVibration(); void FF13_2_EnableControllerVibration();
void AdjustVertexData(const uint32_t width, const uint32_t height); void AdjustVertexData(const uint32_t width, const uint32_t height);
bool MatchesExpectedVertexStream(const float* pVertexStreamZeroData); bool MatchesExpectedVertexStream(const float* pVertexStreamZeroData);
void ForceWindowActivate(const HWND hWnd);
bool OneTimeFixInit(std::unique_ptr<wchar_t[]>& className, HWND hWnd); bool OneTimeFixInit(std::unique_ptr<wchar_t[]>& className, HWND hWnd);
std::atomic_bool otf_init = false; std::atomic_bool otf_init = false;