Skip to content

Commit 7c305c1

Browse files
committed
added unhooking of wglSwapBuffers
1 parent 6e9eaae commit 7c305c1

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
runs-on: ubuntu-latest
6363
steps:
6464
- name: Download artifacts
65-
uses: actions/download-artifact@v3
65+
uses: actions/download-artifact@v4.3.0
6666
with:
6767
path: artifacts
6868

src/client/client.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,15 @@ unsafe fn hook_wgl_swap_buffers() {
322322
ORIGINAL_WGL_SWAPBUFFERS.set(detour).unwrap();
323323
println!("[WaspInput]: wglSwapBuffers successfully hooked.\r\n");
324324
}
325+
326+
pub unsafe fn unhook_wgl_swap_buffers() {
327+
let detour = ORIGINAL_WGL_SWAPBUFFERS
328+
.get()
329+
.expect("[WaspInput]: wglSwapBuffers hook not found\r\n");
330+
331+
detour
332+
.disable()
333+
.expect("[WaspInput]: Failed to disable wglSwapBuffers hook\r\n");
334+
335+
println!("[WaspInput]: wglSwapBuffers successfully unhooked.\r\n");
336+
}

src/shared/windows.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use windows::{
4040
},
4141
};
4242

43-
use crate::client::client::{start_thread, unhook_wndproc};
43+
use crate::client::client::{start_thread, unhook_wgl_swap_buffers, unhook_wndproc};
4444

4545
use super::memory::{MemoryManager, MEMORY_MANAGER};
4646

@@ -85,7 +85,10 @@ pub extern "system" fn DllMain(
8585
},
8686
0 => {
8787
println!("[WaspInput]: Detached.\r\n");
88-
unsafe { unhook_wndproc(hwnd.0 as u64) };
88+
unsafe {
89+
unhook_wndproc(hwnd.0 as u64);
90+
unhook_wgl_swap_buffers();
91+
};
8992
}
9093
_ => (),
9194
}

0 commit comments

Comments
 (0)