fix asstaticfunction with nonbase virtuals

This commit is contained in:
altalk23 2023-01-25 20:29:13 +03:00
parent fbf33adc6a
commit c9f41c784c

View file

@ -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 <class Class2, auto Function> \
template <class Class2> \
struct AsStaticFunction_##FunctionName_ { \
template <class FunctionType2> \
struct Impl {}; \
@ -21,15 +21,18 @@ namespace geode::modifier {
template <class Return, class Class, class... Params> \
struct Impl<Return (Class::*)(Params...)> { \
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<Params...>::func(&Class2::FunctionName_), self \
); \
return self2->Class2::FunctionName_(params...); \
} \
}; \
template <class Return, class Class, class... Params> \
struct Impl<Return (Class::*)(Params...) const> { \
static Return GEODE_CDECL_CALL function(Class const* self, Params... params) { \
auto self2 = addresser::rthunkAdjust(Function, self); \
auto self2 = addresser::rthunkAdjust( \
Resolve<Params...>::func(&Class2::FunctionName_), self \
); \
return self2->Class2::FunctionName_(params...); \
} \
}; \