From c344213cdadf9d2810933df30c2f9cd3098bea48 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Thu, 26 Dec 2024 11:29:42 +0100 Subject: [PATCH] functionHooks: wait for hyprland pages before returning addr for trampo ref #8845 ref #8845 --- src/plugins/HookSystem.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/HookSystem.cpp b/src/plugins/HookSystem.cpp index 38657a48daf..51fe7eee680 100644 --- a/src/plugins/HookSystem.cpp +++ b/src/plugins/HookSystem.cpp @@ -271,6 +271,8 @@ static uintptr_t seekNewPageAddr() { uint64_t lastStart = 0, lastEnd = 0; + bool anchoredToHyprland = false; + std::string line; while (std::getline(MAPS, line)) { CVarList props{line, 0, 's', true}; @@ -300,6 +302,14 @@ static uintptr_t seekNewPageAddr() { } if (start - lastEnd > PAGESIZE_VAR * 2) { + if (!line.contains("Hyprland") && !anchoredToHyprland) { + Debug::log(LOG, "seekNewPageAddr: skipping gap 0x{:x}-0x{:x}, not anchored to Hyprland code pages yet.", lastEnd, start); + lastStart = start; + lastEnd = end; + continue; + } else + anchoredToHyprland = true; + Debug::log(LOG, "seekNewPageAddr: found gap: 0x{:x}-0x{:x} ({} bytes)", lastEnd, start, start - lastEnd); MAPS.close(); return lastEnd;