summaryrefslogtreecommitdiff
path: root/src/plugins/HookSystem.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2024-12-26 11:29:42 +0100
committervaxerski <vaxry@vaxry.net>2024-12-26 11:31:59 +0100
commite75e2cdac79417ffdbbbe903f72668953483a4e7 (patch)
treeccf702c67496e4210df51055b377838e6665d858 /src/plugins/HookSystem.cpp
parent2eaa4d80a0ecb56fc16c8ad4077b1b1a7d28281f (diff)
functionHooks: wait for hyprland pages before returning addr for trampo
ref #8845
Diffstat (limited to 'src/plugins/HookSystem.cpp')
-rw-r--r--src/plugins/HookSystem.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/HookSystem.cpp b/src/plugins/HookSystem.cpp
index 38657a48..3baca5b1 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,19 @@ 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 if (!anchoredToHyprland) {
+ Debug::log(LOG, "seekNewPageAddr: Anchored to hyprland at 0x{:x}", start);
+ anchoredToHyprland = true;
+ lastStart = start;
+ lastEnd = end;
+ continue;
+ }
+
Debug::log(LOG, "seekNewPageAddr: found gap: 0x{:x}-0x{:x} ({} bytes)", lastEnd, start, start - lastEnd);
MAPS.close();
return lastEnd;