Skip to content

Commit b2fdb35

Browse files
committed
Fix mouse cursor visibility issues
1 parent 80913b1 commit b2fdb35

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

Patches/InputTweaks.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int32_t CanSave_Hook()
112112

113113
void DrawCursor_Hook()
114114
{
115-
if (HideMouseCursor || GetTransitionState() != FADE_NONE)
115+
if (HideMouseCursor)
116116
return;
117117

118118
orgDrawCursor.fun();
@@ -215,7 +215,6 @@ void UpdateMousePosition_Hook()
215215
} // If cursor is not visible, and has moved from 0:0, set cursor to visible and restore its position
216216
else if (HideMouseCursor && (GetMouseVerticalPosition() != 0 || GetMouseHorizontalPosition() != 0))
217217
{
218-
219218
CursorPosHandler.RestoreCursorPos();
220219

221220
LastCursorXPos = GetMouseHorizontalPosition();
@@ -253,7 +252,7 @@ void UpdateMousePosition_Hook()
253252
if (!(futureIndex == 0x01 && orgCanSave.fun() != 0x01))
254253
{
255254
#pragma warning(disable : 4244)
256-
* GetPauseMenuButtonIndexPointer() = futureIndex;
255+
*GetPauseMenuButtonIndexPointer() = futureIndex;
257256
}
258257
}
259258

Resources/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 2224
1+
#define BUILD_NUMBER 2225

Wrappers/d3d8/IDirect3DDevice8.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ HRESULT m_IDirect3DDevice8::DrawShadersAndScaledSurface()
14501450
ProxyInterface->GetRenderState(D3DRS_STENCILENABLE, &reStencilEnable);
14511451

14521452
// Get texture states
1453-
DWORD tsColorOP, tsColorArg1, tsColorArg2, tsAlphaOP, tsMinFilter, tsMagFilter, addressU[4], addressV[4];
1453+
DWORD tsColorOP, tsColorArg1, tsColorArg2, tsAlphaOP, tsMinFilter, tsMagFilter, addressU[4] = {}, addressV[4] = {};
14541454
ProxyInterface->GetTextureStageState(0, D3DTSS_COLOROP, &tsColorOP);
14551455
ProxyInterface->GetTextureStageState(0, D3DTSS_COLORARG1, &tsColorArg1);
14561456
ProxyInterface->GetTextureStageState(0, D3DTSS_COLORARG2, &tsColorArg2);
@@ -1706,6 +1706,7 @@ HRESULT m_IDirect3DDevice8::Present(CONST RECT* pSourceRect, CONST RECT* pDestRe
17061706
// Fix flashlight glitch in room 312
17071707
CheckRoom312Flashlight();
17081708

1709+
// Enable enhaced mouse cursor
17091710
if (EnableEnhancedMouse || EnhanceMouseCursor)
17101711
{
17111712
OverlayRef.RenderMouseCursor();
@@ -2733,8 +2734,8 @@ HRESULT m_IDirect3DDevice8::BeginScene()
27332734
RunPlayAdditionalSounds();
27342735
}
27352736

2736-
NeedToGrabScreenForWater = true;
2737-
RoachesDrawingCounter = 0;
2737+
NeedToGrabScreenForWater = true;
2738+
RoachesDrawingCounter = 0;
27382739
}
27392740

27402741
if (!isInScene)

Wrappers/d3d8/Overlay.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,24 @@ std::string Overlay::GetIGTString()
420420

421421
void Overlay::RenderMouseCursor()
422422
{
423-
if ((GetEventIndex() != EVENT_PAUSE_MENU && GetEventIndex() != EVENT_MEMO_LIST) || GetReadingMemoFlag() != 0 || GetTransitionState() != FADE_NONE)
423+
static BYTE* pMousePointerVisibleFlagPointer = GetMousePointerVisibleFlagPointer();
424+
if (pMousePointerVisibleFlagPointer)
425+
{
426+
if (GetTransitionState() != FADE_NONE)
427+
{
428+
*pMousePointerVisibleFlagPointer = 0;
429+
}
430+
else
431+
{
432+
*pMousePointerVisibleFlagPointer = 1;
433+
}
434+
}
435+
436+
if (!EnhanceMouseCursor || (GetEventIndex() != EVENT_PAUSE_MENU && GetEventIndex() != EVENT_MEMO_LIST) || GetReadingMemoFlag() != 0 || GetTransitionState() != FADE_NONE)
437+
{
424438
return;
439+
}
425440

426-
*GetMousePointerVisibleFlagPointer() = 1;
427441
SetShowCursorFlag_Hook();
428442
DrawCursor_Hook();
429443
}

0 commit comments

Comments
 (0)