Skip to content

Commit e75e2cd

Browse files
committed
functionHooks: wait for hyprland pages before returning addr for trampo
ref #8845
1 parent 2eaa4d8 commit e75e2cd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/plugins/HookSystem.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ static uintptr_t seekNewPageAddr() {
271271

272272
uint64_t lastStart = 0, lastEnd = 0;
273273

274+
bool anchoredToHyprland = false;
275+
274276
std::string line;
275277
while (std::getline(MAPS, line)) {
276278
CVarList props{line, 0, 's', true};
@@ -300,6 +302,19 @@ static uintptr_t seekNewPageAddr() {
300302
}
301303

302304
if (start - lastEnd > PAGESIZE_VAR * 2) {
305+
if (!line.contains("Hyprland") && !anchoredToHyprland) {
306+
Debug::log(LOG, "seekNewPageAddr: skipping gap 0x{:x}-0x{:x}, not anchored to Hyprland code pages yet.", lastEnd, start);
307+
lastStart = start;
308+
lastEnd = end;
309+
continue;
310+
} else if (!anchoredToHyprland) {
311+
Debug::log(LOG, "seekNewPageAddr: Anchored to hyprland at 0x{:x}", start);
312+
anchoredToHyprland = true;
313+
lastStart = start;
314+
lastEnd = end;
315+
continue;
316+
}
317+
303318
Debug::log(LOG, "seekNewPageAddr: found gap: 0x{:x}-0x{:x} ({} bytes)", lastEnd, start, start - lastEnd);
304319
MAPS.close();
305320
return lastEnd;

0 commit comments

Comments
 (0)