Skip to content

Commit

Permalink
Editor fullscreen bug patch
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
zziger committed Aug 7, 2023
1 parent ab7d9a2 commit 3fc3345
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/patches/EditorFullscreenBugPatch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// In the in-game level editor if you start a level test pressing F5
/// even when leaving fullscreen mode game window remains topmost.
/// This is caused by developers setting HWND_TOPMOST at SetWindowPos,
/// but when fullscreen is left it does not get cancelled.
/// This patch hooks respective fullscreen cancel function and
/// applies HWND_NOTOPMOST.

#include "Utils.h"
#include "events/EventManager.h"
#include "memory/HookManager.h"
#include "sdk/Game.h"

HOOK_FN(inline void, editor_leave_fullscreen, ARGS()) {
editor_leave_fullscreen_orig();
SetWindowPos(*sdk::Game::window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}

inline EventManager::Ready $editor_fullscreen_bug_patch([] {
HookManager::RegisterHook("55 8B EC C7 05 ? ? ? ? ? ? ? ? C7 05 ? ? ? ? ? ? ? ? 68 ? ? ? ? 6A", HOOK_REF_FORCE(editor_leave_fullscreen));
});

0 comments on commit 3fc3345

Please sign in to comment.