-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/OmgRod/Geodify
- Loading branch information
Showing
29 changed files
with
234 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,49 @@ | ||
|
||
#pragma once | ||
#include <Geode/Geode.hpp> | ||
#include <Geode/modify/CCLayer.hpp> | ||
#include <Geode/modify/CCDirector.hpp> | ||
using namespace geode::prelude; | ||
|
||
|
||
#define REGISTER_HookBetter(Class) $execute { Betterhook::HookBetter::registerHook<Class>(); } | ||
namespace Betterhook { | ||
class HookBetter { | ||
public: | ||
static void registerHook(HookBetter* hook); | ||
template<typename T, typename = std::enable_if_t<std::is_base_of_v<HookBetter, T>>> | ||
static void registerHook() { registerHook(new T()); } | ||
static const std::vector<HookBetter*>& Hooks(); | ||
virtual void init(cocos2d::CCNode* Layer) = 0; | ||
virtual const char* PutLayer() const = 0; | ||
}; | ||
} | ||
#define Viper_Hookclass(className) \ | ||
class className : public CCLayer { \ | ||
public: \ | ||
void ____________________DONOTUSE__________________________ViperHookInit(); \ | ||
}; \ | ||
class $modify(CCLayer) { \ | ||
bool init() { \ | ||
if (!CCLayer::init()) return false; \ | ||
if (!Mod::get()->getSettingValue<bool>("external-mods")) { \ | ||
return true; \ | ||
} \ | ||
if (auto x = typeinfo_cast<className*>(this)) { \ | ||
queueInMainThread([=] {x->____________________DONOTUSE__________________________ViperHookInit();}); return true; \ | ||
} \ | ||
return true; \ | ||
} \ | ||
}; \ | ||
void className::____________________DONOTUSE__________________________ViperHookInit() | ||
// PLEASE DON'T USE THIS UNLESS FORCED APON | ||
#define Viper_Hookclass_Scene(unique,className) \ | ||
class unique##Sillyclass { \ | ||
public: \ | ||
void ____________________DONOTUSE__________________________ViperHookInit(CCNode* _This); \ | ||
}; \ | ||
class $modify(CCDirector) { \ | ||
static void onModify(auto& self) { \ | ||
(void)self.setHookPriority("CCDirector::willSwitchToScene", -999); \ | ||
} \ | ||
void willSwitchToScene(CCScene* scene) { \ | ||
CCDirector::willSwitchToScene(scene); \ | ||
if (!Mod::get()->getSettingValue<bool>("external-mods")) { \ | ||
return; \ | ||
}; \ | ||
if (CCLayer* child = scene->getChildByType<CCLayer>(0)) { \ | ||
if (child->getID() == className) { \ | ||
unique##Sillyclass sillyInstance; \ | ||
sillyInstance.____________________DONOTUSE__________________________ViperHookInit(child); \ | ||
}; \ | ||
} \ | ||
} \ | ||
}; \ | ||
void unique##Sillyclass::____________________DONOTUSE__________________________ViperHookInit(CCNode* _This) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.