1- /* *
2- * Include the Geode headers.
3- */
41#include < Geode/Geode.hpp>
52
6- /* *
7- * Brings cocos2d and all Geode namespaces to the current scope.
8- */
93using namespace geode ::prelude;
104
11- /* *
12- * `$modify` lets you extend and modify GD's classes.
13- * To hook a function in Geode, simply $modify the class
14- * and write a new function definition with the signature of
15- * the function you want to hook.
16- *
17- * Here we use the overloaded `$modify` macro to set our own class name,
18- * so that we can use it for button callbacks.
19- *
20- * Notice the header being included, you *must* include the header for
21- * the class you are modifying, or you will get a compile error.
22- *
23- * Another way you could do this is like this:
24- *
25- * struct MyMenuLayer : Modify<MyMenuLayer, MenuLayer> {};
26- */
27- #include < Geode/modify/MenuLayer.hpp>
28- class $modify(MyMenuLayer, MenuLayer) {
29- /* *
30- * Typically classes in GD are initialized using the `init` function, (though not always!),
31- * so here we use it to add our own button to the bottom menu.
32- *
33- * Note that for all hooks, your signature has to *match exactly*,
34- * `void init()` would not place a hook!
35- */
36- bool init () {
37- /* *
38- * We call the original init function so that the
39- * original class is properly initialized.
40- */
41- if (!MenuLayer::init ()) {
42- return false ;
5+ #include < Geode/modify/GJAccountManager.hpp>
6+ class $modify(GJAccountManager) {
7+ void handleIt (bool _requestSentSuccessfully, std::string _response, std::string _tag, GJHttpType _httpType) {
8+ switch (_httpType) {
9+ case GJHttpType::kGJHttpTypeGetAccountBackupURL :
10+ case GJHttpType::kGJHttpTypeGetAccountSyncURL :
11+ _response = " https://gdbackup.141412.xyz" ;
12+ break ;
13+ default :
14+ return ;
4315 }
44-
45- /* *
46- * You can use methods from the `geode::log` namespace to log messages to the console,
47- * being useful for debugging and such. See this page for more info about logging:
48- * https://docs.geode-sdk.org/tutorials/logging
49- */
50- log::debug (" Hello from my MenuLayer::init hook! This layer has {} children." , this ->getChildrenCount ());
51-
52- /* *
53- * See this page for more info about buttons
54- * https://docs.geode-sdk.org/tutorials/buttons
55- */
56- auto myButton = CCMenuItemSpriteExtra::create (
57- CCSprite::createWithSpriteFrameName (" GJ_likeBtn_001.png" ),
58- this ,
59- /* *
60- * Here we use the name we set earlier for our modify class.
61- */
62- menu_selector (MyMenuLayer::onMyButton)
63- );
64-
65- /* *
66- * Here we access the `bottom-menu` node by its ID, and add our button to it.
67- * Node IDs are a Geode feature, see this page for more info about it:
68- * https://docs.geode-sdk.org/tutorials/nodetree
69- */
70- auto menu = this ->getChildByID (" bottom-menu" );
71- menu->addChild (myButton);
72-
73- /* *
74- * The `_spr` string literal operator just prefixes the string with
75- * your mod id followed by a slash. This is good practice for setting your own node ids.
76- */
77- myButton->setID (" my-button" _spr);
78-
79- /* *
80- * We update the layout of the menu to ensure that our button is properly placed.
81- * This is yet another Geode feature, see this page for more info about it:
82- * https://docs.geode-sdk.org/tutorials/layouts
83- */
84- menu->updateLayout ();
85-
86- /* *
87- * We return `true` to indicate that the class was properly initialized.
88- */
89- return true ;
90- }
91-
92- /* *
93- * This is the callback function for the button we created earlier.
94- * The signature for button callbacks must always be the same,
95- * return type `void` and taking a `CCObject*`.
96- */
97- void onMyButton (CCObject*) {
98- FLAlertLayer::create (" Geode" , " Hello from my custom mod!" , " OK" )->show ();
16+ GJAccountManager::handleIt (_requestSentSuccessfully, _response, _tag, _httpType);
9917 }
10018};
0 commit comments