mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
loveplus: improve window searching for touch hook (#321)
## Link to GitHub Issue, if one exists Fixes #320 ## Description of change Replacing the existing logic that searches for game window to hook touch on. Eventually, we should fix all the other games that hook touch by matching on window title with a call to `FindProcessWindowBeginsWith`. ## Testing Tested with notepad open that was also titled `LovePlusAC`. Game hooked correctly when the game was in focus during boot, and also when notepad was in focus.
This commit is contained in:
@@ -30,16 +30,15 @@ namespace games::loveplus {
|
||||
if (!TOUCH_ATTACHED) {
|
||||
|
||||
// Find the game window.
|
||||
// We check the foreground window first, then fall back to searching for the window title
|
||||
// All game versions seem to have their model first in the window title
|
||||
HWND wnd = GetForegroundWindow();
|
||||
if (!string_begins_with(GetActiveWindowTitle(), "LovePlus")) {
|
||||
wnd = FindWindowBeginsWith(avs::game::MODEL);
|
||||
}
|
||||
HWND wnd = FindProcessWindowBeginsWith("LovePlusAC");
|
||||
|
||||
// attach touch hook
|
||||
if (wnd) {
|
||||
log_info("loveplus", "using window handle for touch: {}", fmt::ptr(wnd));
|
||||
log_info(
|
||||
"loveplus",
|
||||
"using window handle for touch: {} ({})",
|
||||
fmt::ptr(wnd),
|
||||
get_window_title(wnd));
|
||||
touch_create_wnd(wnd);
|
||||
} else {
|
||||
log_info("loveplus", "falling back to the DirectX window handle for touch");
|
||||
|
||||
Reference in New Issue
Block a user