fix cross compiling for clang windowsgit status uwugit status

This commit is contained in:
altalk23 2023-01-26 16:10:11 +03:00
parent 274ff02f9e
commit c644b43468
3 changed files with 35 additions and 32 deletions

View file

@ -15,6 +15,7 @@ class CC_DLL CCApplication : public CCApplicationProtocol
{
GEODE_FRIEND_MODIFY
public:
GEODE_MONOSTATE_CONSTRUCTOR_BEGIN(CCApplication)
CCApplication();
virtual ~CCApplication();

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, class FunctionType> \
struct AsStaticFunction_##FunctionName_ { \
template <class FunctionType2> \
struct Impl {}; \
@ -36,7 +36,7 @@ namespace geode::modifier {
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)

View file

@ -10,13 +10,15 @@
#define GEODE_APPLY_MODIFY_FOR_FUNCTION(AddressIndex_, Convention_, ClassName_, FunctionName_, ...) \
do { \
constexpr auto b = Resolve<__VA_ARGS__>::func(&Base::FunctionName_); \
constexpr auto d = Resolve<__VA_ARGS__>::func(&Derived::FunctionName_); \
if constexpr (Unique::different<b, d>()) { \
if constexpr (Unique::different< \
Resolve<__VA_ARGS__>::func(&Base::FunctionName_), \
Resolve<__VA_ARGS__>::func(&Derived::FunctionName_)>()) { \
auto hook = Hook::create( \
Mod::get(), \
reinterpret_cast<void*>(address<AddressIndex_>()), \
AsStaticFunction_##FunctionName_<Derived, d>::value, \
AsStaticFunction_##FunctionName_< \
Derived, \
decltype(Resolve<__VA_ARGS__>::func(&Derived::FunctionName_))>::value, \
#ClassName_ "::" #FunctionName_, \
tulip::hook::TulipConvention::Convention_ \
); \
@ -24,34 +26,34 @@
} \
} while (0);
#define GEODE_APPLY_MODIFY_FOR_CONSTRUCTOR(AddressIndex_, Convention_, ClassName_, ...) \
do { \
if constexpr (HasConstructor<Derived>) { \
constexpr auto d = Resolve<__VA_ARGS__>::func(&Derived::constructor); \
auto hook = Hook::create( \
Mod::get(), \
reinterpret_cast<void*>(address<AddressIndex_>()), \
AsStaticFunction_##constructor<Derived, d>::value, \
#ClassName_ "::" #ClassName_, \
tulip::hook::TulipConvention::Convention_ \
); \
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
} \
#define GEODE_APPLY_MODIFY_FOR_CONSTRUCTOR(AddressIndex_, Convention_, ClassName_, ...) \
do { \
if constexpr (HasConstructor<Derived>) { \
auto hook = Hook::create( \
Mod::get(), \
reinterpret_cast<void*>(address<AddressIndex_>()), \
AsStaticFunction_##constructor< \
Derived, \
decltype(Resolve<__VA_ARGS__>::func(&Derived::constructor))>::value, \
#ClassName_ "::" #ClassName_, \
tulip::hook::TulipConvention::Convention_ \
); \
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
} \
} while (0);
#define GEODE_APPLY_MODIFY_FOR_DESTRUCTOR(AddressIndex_, Convention_, ClassName_) \
do { \
if constexpr (HasDestructor<Derived>) { \
constexpr auto d = Resolve<>::func(&Derived::destructor); \
auto hook = Hook::create( \
Mod::get(), \
reinterpret_cast<void*>(address<AddressIndex_>()), \
AsStaticFunction_##destructor<Derived, d>::value, \
#ClassName_ "::" #ClassName_, \
tulip::hook::TulipConvention::Convention_ \
); \
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
} \
#define GEODE_APPLY_MODIFY_FOR_DESTRUCTOR(AddressIndex_, Convention_, ClassName_) \
do { \
if constexpr (HasDestructor<Derived>) { \
auto hook = Hook::create( \
Mod::get(), \
reinterpret_cast<void*>(address<AddressIndex_>()), \
AsStaticFunction_##destructor<Derived, decltype(Resolve<>::func(&Derived::destructor))>::value, \
#ClassName_ "::" #ClassName_, \
tulip::hook::TulipConvention::Convention_ \
); \
this->m_hooks[#ClassName_ "::" #ClassName_] = hook; \
} \
} while (0);
namespace geode::modifier {