Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复更新插件时无法关闭游戏的问题 #194

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading