From 375145e759689f7c88e5864f61315b90f50a65b3 Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Sun, 16 Feb 2025 04:52:01 -0700 Subject: [PATCH] include/std: std::ptr::relative_to_base_section not working anymore (#349) Fixes #348 In issue #348 it is stated that the pattern fails to find the variable baseAddress in the parent of the parent of the attribute function. One parent is required to access the variables on the pattern that is using the attribute. That pattern is used in the pattern that contains baseAddress as a pointer to an array of the children pattern and that seems to require an extra parent level to be added in order to access baseAddress without errors. The fix was tested on an xbe file extracted from an xbox cd rom and while it failed without the fix as stated in issue 348 with the fix it ran to completion without issues. --- patterns/xbeh.hexpat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patterns/xbeh.hexpat b/patterns/xbeh.hexpat index 93e4a1f..5dfd279 100644 --- a/patterns/xbeh.hexpat +++ b/patterns/xbeh.hexpat @@ -329,7 +329,7 @@ fn relative_to_base(auto pointer) { }; fn relative_to_base_section(auto pointer) { - return -parent.parent.baseAddress; + return -parent.parent.parent.baseAddress; }; bitfield LibraryFlags {