mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
fix cross compiling for clang windowsgit status uwugit status
This commit is contained in:
parent
274ff02f9e
commit
c644b43468
3 changed files with 35 additions and 32 deletions
|
@ -15,6 +15,7 @@ class CC_DLL CCApplication : public CCApplicationProtocol
|
||||||
{
|
{
|
||||||
GEODE_FRIEND_MODIFY
|
GEODE_FRIEND_MODIFY
|
||||||
public:
|
public:
|
||||||
|
GEODE_MONOSTATE_CONSTRUCTOR_BEGIN(CCApplication)
|
||||||
CCApplication();
|
CCApplication();
|
||||||
virtual ~CCApplication();
|
virtual ~CCApplication();
|
||||||
|
|
||||||
|
|
|
@ -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, class FunctionType> \
|
||||||
struct AsStaticFunction_##FunctionName_ { \
|
struct AsStaticFunction_##FunctionName_ { \
|
||||||
template <class FunctionType2> \
|
template <class FunctionType2> \
|
||||||
struct Impl {}; \
|
struct Impl {}; \
|
||||||
|
@ -36,7 +36,7 @@ namespace geode::modifier {
|
||||||
return self2->Class2::FunctionName_(params...); \
|
return self2->Class2::FunctionName_(params...); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
static constexpr auto value = &Impl<decltype(Function)>::function; \
|
static constexpr auto value = &Impl<FunctionType>::function; \
|
||||||
};
|
};
|
||||||
|
|
||||||
GEODE_AS_STATIC_FUNCTION(constructor)
|
GEODE_AS_STATIC_FUNCTION(constructor)
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
|
|
||||||
#define GEODE_APPLY_MODIFY_FOR_FUNCTION(AddressIndex_, Convention_, ClassName_, FunctionName_, ...) \
|
#define GEODE_APPLY_MODIFY_FOR_FUNCTION(AddressIndex_, Convention_, ClassName_, FunctionName_, ...) \
|
||||||
do { \
|
do { \
|
||||||
constexpr auto b = Resolve<__VA_ARGS__>::func(&Base::FunctionName_); \
|
if constexpr (Unique::different< \
|
||||||
constexpr auto d = Resolve<__VA_ARGS__>::func(&Derived::FunctionName_); \
|
Resolve<__VA_ARGS__>::func(&Base::FunctionName_), \
|
||||||
if constexpr (Unique::different<b, d>()) { \
|
Resolve<__VA_ARGS__>::func(&Derived::FunctionName_)>()) { \
|
||||||
auto hook = Hook::create( \
|
auto hook = Hook::create( \
|
||||||
Mod::get(), \
|
Mod::get(), \
|
||||||
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
||||||
AsStaticFunction_##FunctionName_<Derived, d>::value, \
|
AsStaticFunction_##FunctionName_< \
|
||||||
|
Derived, \
|
||||||
|
decltype(Resolve<__VA_ARGS__>::func(&Derived::FunctionName_))>::value, \
|
||||||
#ClassName_ "::" #FunctionName_, \
|
#ClassName_ "::" #FunctionName_, \
|
||||||
tulip::hook::TulipConvention::Convention_ \
|
tulip::hook::TulipConvention::Convention_ \
|
||||||
); \
|
); \
|
||||||
|
@ -24,34 +26,34 @@
|
||||||
} \
|
} \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define GEODE_APPLY_MODIFY_FOR_CONSTRUCTOR(AddressIndex_, Convention_, ClassName_, ...) \
|
#define GEODE_APPLY_MODIFY_FOR_CONSTRUCTOR(AddressIndex_, Convention_, ClassName_, ...) \
|
||||||
do { \
|
do { \
|
||||||
if constexpr (HasConstructor<Derived>) { \
|
if constexpr (HasConstructor<Derived>) { \
|
||||||
constexpr auto d = Resolve<__VA_ARGS__>::func(&Derived::constructor); \
|
auto hook = Hook::create( \
|
||||||
auto hook = Hook::create( \
|
Mod::get(), \
|
||||||
Mod::get(), \
|
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
||||||
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
AsStaticFunction_##constructor< \
|
||||||
AsStaticFunction_##constructor<Derived, d>::value, \
|
Derived, \
|
||||||
#ClassName_ "::" #ClassName_, \
|
decltype(Resolve<__VA_ARGS__>::func(&Derived::constructor))>::value, \
|
||||||
tulip::hook::TulipConvention::Convention_ \
|
#ClassName_ "::" #ClassName_, \
|
||||||
); \
|
tulip::hook::TulipConvention::Convention_ \
|
||||||
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
|
); \
|
||||||
} \
|
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
|
||||||
|
} \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define GEODE_APPLY_MODIFY_FOR_DESTRUCTOR(AddressIndex_, Convention_, ClassName_) \
|
#define GEODE_APPLY_MODIFY_FOR_DESTRUCTOR(AddressIndex_, Convention_, ClassName_) \
|
||||||
do { \
|
do { \
|
||||||
if constexpr (HasDestructor<Derived>) { \
|
if constexpr (HasDestructor<Derived>) { \
|
||||||
constexpr auto d = Resolve<>::func(&Derived::destructor); \
|
auto hook = Hook::create( \
|
||||||
auto hook = Hook::create( \
|
Mod::get(), \
|
||||||
Mod::get(), \
|
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
||||||
reinterpret_cast<void*>(address<AddressIndex_>()), \
|
AsStaticFunction_##destructor<Derived, decltype(Resolve<>::func(&Derived::destructor))>::value, \
|
||||||
AsStaticFunction_##destructor<Derived, d>::value, \
|
#ClassName_ "::" #ClassName_, \
|
||||||
#ClassName_ "::" #ClassName_, \
|
tulip::hook::TulipConvention::Convention_ \
|
||||||
tulip::hook::TulipConvention::Convention_ \
|
); \
|
||||||
); \
|
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
|
||||||
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
|
} \
|
||||||
} \
|
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
namespace geode::modifier {
|
namespace geode::modifier {
|
||||||
|
|
Loading…
Reference in a new issue