From 0af7695e69553916ff442282ecd21717b6d0abfe Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:24:46 +0300 Subject: [PATCH 1/3] add log to adjust --- loader/include/Geode/modify/AsStaticFunction.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/include/Geode/modify/AsStaticFunction.hpp b/loader/include/Geode/modify/AsStaticFunction.hpp index e9570492..69e819bd 100644 --- a/loader/include/Geode/modify/AsStaticFunction.hpp +++ b/loader/include/Geode/modify/AsStaticFunction.hpp @@ -22,6 +22,7 @@ namespace geode::modifier { struct Impl { \ static Return GEODE_CDECL_CALL function(Class* self, Params... params) { \ auto self2 = addresser::rthunkAdjust(Function, self); \ + log::info("adjusted, normal {}, {}", self2, self);\ return self2->Class2::FunctionName_(params...); \ } \ }; \ From 20776b58d761e843f43a5ea5ac875dbeac1dfcec Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:29:13 +0300 Subject: [PATCH 2/3] fix asstaticfunction with nonbase virtuals --- loader/include/Geode/modify/AsStaticFunction.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/modify/AsStaticFunction.hpp b/loader/include/Geode/modify/AsStaticFunction.hpp index 69e819bd..a742992f 100644 --- a/loader/include/Geode/modify/AsStaticFunction.hpp +++ b/loader/include/Geode/modify/AsStaticFunction.hpp @@ -8,7 +8,7 @@ namespace geode::modifier { * A helper struct that generates a static function that calls the given function. */ #define GEODE_AS_STATIC_FUNCTION(FunctionName_) \ - template \ + template \ struct AsStaticFunction_##FunctionName_ { \ template \ struct Impl {}; \ @@ -21,15 +21,18 @@ namespace geode::modifier { template \ struct Impl { \ static Return GEODE_CDECL_CALL function(Class* self, Params... params) { \ - auto self2 = addresser::rthunkAdjust(Function, self); \ - log::info("adjusted, normal {}, {}", self2, self);\ + auto self2 = addresser::rthunkAdjust( \ + Resolve::func(&Class2::FunctionName_), self \ + ); \ return self2->Class2::FunctionName_(params...); \ } \ }; \ template \ struct Impl { \ static Return GEODE_CDECL_CALL function(Class const* self, Params... params) { \ - auto self2 = addresser::rthunkAdjust(Function, self); \ + auto self2 = addresser::rthunkAdjust( \ + Resolve::func(&Class2::FunctionName_), self \ + ); \ return self2->Class2::FunctionName_(params...); \ } \ }; \ From 9c48ff0e0faaf9fa87510fa1d12cf529725094ee Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:30:18 +0300 Subject: [PATCH 3/3] readd the function param --- loader/include/Geode/modify/AsStaticFunction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/modify/AsStaticFunction.hpp b/loader/include/Geode/modify/AsStaticFunction.hpp index a742992f..cbd00afd 100644 --- a/loader/include/Geode/modify/AsStaticFunction.hpp +++ b/loader/include/Geode/modify/AsStaticFunction.hpp @@ -8,7 +8,7 @@ namespace geode::modifier { * A helper struct that generates a static function that calls the given function. */ #define GEODE_AS_STATIC_FUNCTION(FunctionName_) \ - template \ + template \ struct AsStaticFunction_##FunctionName_ { \ template \ struct Impl {}; \