Skip to content

Commit

Permalink
functionHooks: wait for hyprland pages before returning addr for trampo
Browse files Browse the repository at this point in the history
ref #8845

ref #8845
  • Loading branch information
vaxerski committed Dec 26, 2024
1 parent 2eaa4d8 commit c344213
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/HookSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c344213

Please sign in to comment.