Skip to content

Commit

Permalink
Merge pull request #194 from chinosk6/main
Browse files Browse the repository at this point in the history
修复更新插件时无法关闭游戏的问题
  • Loading branch information
ChihyuenWang authored Jul 19, 2024
2 parents d8e56d9 + a493f0d commit e83cb82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
- name: install-dependencies
Expand Down
Binary file modified resources/legend_g_plugin.exe
Binary file not shown.
6 changes: 5 additions & 1 deletion src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ namespace
void* wndproc_orig = nullptr;

bool raceStart = false;

bool gameClosing = false;
LRESULT wndproc_hook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INPUT)
Expand Down Expand Up @@ -931,7 +931,11 @@ namespace
}
}
if (uMsg == WM_CLOSE) {
if (gameClosing) return reinterpret_cast<decltype(wndproc_hook)*>(wndproc_orig)(hWnd, uMsg, wParam, lParam);

gameClosing = true;
const int result = MessageBoxW(hWnd, L"Are you sure to exit?", L"Exit Game", MB_ICONQUESTION | MB_YESNO);
gameClosing = false;
if (result != IDYES) return FALSE;
}

Expand Down

0 comments on commit e83cb82

Please sign in to comment.