mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
fix asstaticfunction with nonbase virtuals
This commit is contained in:
parent
fbf33adc6a
commit
c9f41c784c
1 changed files with 7 additions and 4 deletions
|
@ -8,7 +8,7 @@ namespace geode::modifier {
|
||||||
* A helper struct that generates a static function that calls the given function.
|
* A helper struct that generates a static function that calls the given function.
|
||||||
*/
|
*/
|
||||||
#define GEODE_AS_STATIC_FUNCTION(FunctionName_) \
|
#define GEODE_AS_STATIC_FUNCTION(FunctionName_) \
|
||||||
template <class Class2, auto Function> \
|
template <class Class2> \
|
||||||
struct AsStaticFunction_##FunctionName_ { \
|
struct AsStaticFunction_##FunctionName_ { \
|
||||||
template <class FunctionType2> \
|
template <class FunctionType2> \
|
||||||
struct Impl {}; \
|
struct Impl {}; \
|
||||||
|
@ -21,15 +21,18 @@ namespace geode::modifier {
|
||||||
template <class Return, class Class, class... Params> \
|
template <class Return, class Class, class... Params> \
|
||||||
struct Impl<Return (Class::*)(Params...)> { \
|
struct Impl<Return (Class::*)(Params...)> { \
|
||||||
static Return GEODE_CDECL_CALL function(Class* self, Params... params) { \
|
static Return GEODE_CDECL_CALL function(Class* self, Params... params) { \
|
||||||
auto self2 = addresser::rthunkAdjust(Function, self); \
|
auto self2 = addresser::rthunkAdjust( \
|
||||||
log::info("adjusted, normal {}, {}", self2, self);\
|
Resolve<Params...>::func(&Class2::FunctionName_), self \
|
||||||
|
); \
|
||||||
return self2->Class2::FunctionName_(params...); \
|
return self2->Class2::FunctionName_(params...); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
template <class Return, class Class, class... Params> \
|
template <class Return, class Class, class... Params> \
|
||||||
struct Impl<Return (Class::*)(Params...) const> { \
|
struct Impl<Return (Class::*)(Params...) const> { \
|
||||||
static Return GEODE_CDECL_CALL function(Class const* self, Params... params) { \
|
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...); \
|
return self2->Class2::FunctionName_(params...); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
|
|
Loading…
Reference in a new issue