Skip to content

Commit d16e114

Browse files
committed
d3d9 skyrim
1 parent cb2d26e commit d16e114

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

src/d3d9/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ set_target_properties(dinput8_skyrim PROPERTIES
9191
# Deployment for Skyrim
9292
if(BIN_OUTPUT_DIR)
9393
add_custom_command(TARGET dinput8_skyrim POST_BUILD
94-
COMMAND ${CMAKE_COMMAND} -E make_directory "${BIN_OUTPUT_DIR}/skyrim"
94+
COMMAND ${CMAKE_COMMAND} -E make_directory "${BIN_OUTPUT_DIR}/d3d9_skyrim"
9595
COMMAND ${CMAKE_COMMAND} -E copy_if_different
9696
"$<TARGET_FILE:dinput8_skyrim>"
97-
"${BIN_OUTPUT_DIR}/skyrim/dinput8.dll"
98-
COMMENT "Copying Skyrim D3D9 proxy to skyrim/dinput8.dll"
97+
"${BIN_OUTPUT_DIR}/d3d9_skyrim/dinput8.dll"
98+
COMMENT "Copying Skyrim D3D9 proxy to d3d9_skyrim/dinput8.dll"
9999
)
100100
endif()
101101

src/d3d9/dx_overlay.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,29 @@ void OverlayRenderer::NewFrame() {
120120

121121
ImGui_ImplDX9_NewFrame();
122122
ImGui_ImplWin32_NewFrame();
123+
124+
if (m_visible && m_hWnd) {
125+
POINT cursorPos;
126+
if (GetCursorPos(&cursorPos)) {
127+
ScreenToClient(m_hWnd, &cursorPos);
128+
io.AddMousePosEvent((float)cursorPos.x, (float)cursorPos.y);
129+
}
130+
// Poll button state and feed it through the event queue
131+
io.AddMouseButtonEvent(0, (GetAsyncKeyState(VK_LBUTTON) & 0x8000) != 0);
132+
io.AddMouseButtonEvent(1, (GetAsyncKeyState(VK_RBUTTON) & 0x8000) != 0);
133+
io.AddMouseButtonEvent(2, (GetAsyncKeyState(VK_MBUTTON) & 0x8000) != 0);
134+
// Draw ImGui's own cursor on top – mirrors Community Shaders behaviour.
135+
// The game cursor can be hidden in certain states (in-game, menus with
136+
// hardware cursor hidden), so ImGui's software cursor is more reliable.
137+
io.MouseDrawCursor = true;
138+
} else {
139+
io.MouseDrawCursor = false;
140+
}
141+
142+
if (!m_visible) {
143+
io.ClearInputKeys();
144+
}
145+
123146
ImGui::NewFrame();
124147
}
125148

0 commit comments

Comments
 (0)