Skip to content

Commit f8e5ba4

Browse files
committed
iOS Jitless
1 parent b5e2bcb commit f8e5ba4

File tree

11 files changed

+225
-71
lines changed

11 files changed

+225
-71
lines changed

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,6 @@ class $nodeModify(MyCustomCreatorLayer, CustomCreatorLayer) {
4545
};
4646
```
4747
48-
## Modifying Base Classes of CCNodes
49-
50-
Using $baseModify, you can modify all nodes that inheret some class. In the following example, we modify all FLAlertLayers, not just FLAlertLayer itself. These are different than the above $nodeModify and $cobjectModify, as it requires a valid type to be passed in, thus it does not natively support modifying other mod's nodes without declaring the class beforehand.
51-
52-
```c++
53-
class $baseModify(MyFLAlertLayer, FLAlertLayer) {
54-
55-
void modify() {
56-
setScale(2.f);
57-
}
58-
59-
}
60-
```
61-
62-
If you still wish to modify another mod's nodes by their base class, you can do the following.
63-
Let's say we had a node called AlphasEpicNode, which in itself inherets CCNode, that a lot of nodes from AlphasEpicMod inherit. Because we are defining it beforehand (make sure the definition matches that of how it is in said mod), the mod can deduce it and it's own base class names and it will work as expected.
64-
65-
```c++
66-
class AlphasEpicNode : public CCNode {};
67-
class $baseModify(MyAlphasEpicNode, AlphasEpicNode) {
68-
69-
void modify() {
70-
setScale(2.f);
71-
}
72-
73-
}
74-
```
75-
7648
## General Utils
7749
7850
### AlphaUtils::Cocos namespace:

about.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,6 @@ class $nodeModify(MyCustomCreatorLayer, CustomCreatorLayer) {
4545
};
4646
```
4747
48-
## Modifying Base Classes of CCNodes
49-
50-
Using $baseModify, you can modify all nodes that inheret some class. In the following example, we modify all FLAlertLayers, not just FLAlertLayer itself. These are different than the above $nodeModify and $cobjectModify, as it requires a valid type to be passed in, thus it does not natively support modifying other mod's nodes without declaring the class beforehand.
51-
52-
```c++
53-
class $baseModify(MyFLAlertLayer, FLAlertLayer) {
54-
55-
void modify() {
56-
setScale(2.f);
57-
}
58-
59-
}
60-
```
61-
62-
If you still wish to modify another mod's nodes by their base class, you can do the following.
63-
Let's say we had a node called AlphasEpicNode, which in itself inherets CCNode, that a lot of nodes from AlphasEpicMod inherit. Because we are defining it beforehand (make sure the definition matches that of how it is in said mod), the mod can deduce it and it's own base class names and it will work as expected.
64-
65-
```c++
66-
class AlphasEpicNode : public CCNode {};
67-
class $baseModify(MyAlphasEpicNode, AlphasEpicNode) {
68-
69-
void modify() {
70-
setScale(2.f);
71-
}
72-
73-
}
74-
```
75-
7648
## General Utils
7749
7850
### AlphaUtils::Cocos namespace:

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.1.6
2+
- iOS rebuild
3+
- New icon
4+
15
# 1.1.5
26
- API fix
37

include/NodeModding.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace AlphaUtils {
5454
}
5555
};
5656

57-
struct ModifyBaseInfo {
57+
/*struct ModifyBaseInfo {
5858
int priority;
5959
std::function<void(FieldCCObject*)> method;
6060
};
@@ -86,7 +86,7 @@ namespace AlphaUtils {
8686
BaseModding::get()->m_lock = false;
8787
});
8888
}
89-
};
89+
};*/
9090

9191
//remnants for compat
9292
struct ModifyInfo {
@@ -140,29 +140,29 @@ class GEODE_CONCAT(GEODE_CONCAT(derived, Hook), __LINE__) : AlphaUtils::NodeWrap
140140
};\
141141
struct derived : AlphaUtils::NodeWrapper<derived>
142142

143-
#define ALPHA_BASE_MODIFY_DECLARE(base, derived) \
143+
/*#define ALPHA_BASE_MODIFY_DECLARE(base, derived) \
144144
GEODE_CONCAT(GEODE_CONCAT(derived, __LINE__), Dummy);\
145145
struct derived;\
146146
class GEODE_CONCAT(GEODE_CONCAT(derived, Hook), __LINE__) : AlphaUtils::BaseWrapper<derived, base> {\
147147
private:\
148148
static inline AlphaUtils::ModifyBaseLoad<derived, base> s_apply{};\
149149
};\
150-
struct derived : AlphaUtils::BaseWrapper<derived, base>
150+
struct derived : AlphaUtils::BaseWrapper<derived, base>*/
151151

152152
#define MODIFY1(base) ALPHA_MODIFY_DECLARE(base, GEODE_CONCAT(hook, __LINE__))
153153
#define MODIFY2(derived, base) ALPHA_MODIFY_DECLARE(base, derived)
154154

155155
#define MODIFYNODE1(base) ALPHA_NODE_MODIFY_DECLARE(base, GEODE_CONCAT(hook, __LINE__))
156156
#define MODIFYNODE2(derived, base) ALPHA_NODE_MODIFY_DECLARE(base, derived)
157157

158-
#define MODIFYBASE1(base) ALPHA_BASE_MODIFY_DECLARE(base, GEODE_CONCAT(hook, __LINE__))
159-
#define MODIFYBASE2(derived, base) ALPHA_BASE_MODIFY_DECLARE(base, derived)
158+
/*#define MODIFYBASE1(base) ALPHA_BASE_MODIFY_DECLARE(base, GEODE_CONCAT(hook, __LINE__))
159+
#define MODIFYBASE2(derived, base) ALPHA_BASE_MODIFY_DECLARE(base, derived)*/
160160

161161
#define $nodeModify(...) \
162162
GEODE_INVOKE(GEODE_CONCAT(MODIFYNODE, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)
163163

164164
#define $objectModify(...) \
165165
GEODE_INVOKE(GEODE_CONCAT(MODIFY, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)
166166

167-
#define $baseModify(...) \
168-
GEODE_INVOKE(GEODE_CONCAT(MODIFYBASE, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)
167+
/*#define $baseModify(...) \
168+
GEODE_INVOKE(GEODE_CONCAT(MODIFYBASE, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)*/

include/Utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace AlphaUtils {
4949
return ret;
5050
}
5151

52-
static inline bool checkBaseClassNames(cocos2d::CCObject* obj, const std::string& name) {
52+
/*static inline bool checkBaseClassNames(cocos2d::CCObject* obj, const std::string& name) {
5353
if (!obj) return false;
5454
5555
auto basePtr = dynamic_cast<void*>(obj);
@@ -108,7 +108,7 @@ namespace AlphaUtils {
108108
);
109109
110110
return optionIdent;
111-
}
111+
}*/
112112

113113
//getChildByType but using a string instead for dynamic use.
114114
static inline std::optional<cocos2d::CCNode*> getChildByClassName(cocos2d::CCNode* node, std::string name, int index = 0) {

logo.png

7.82 KB
Loading

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.4.0",
2+
"geode": "4.6.1",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
@@ -23,6 +23,6 @@
2323
"community": "https://discord.gg/Txn2CA5dHF"
2424
},
2525
"tags": [
26-
"developer", "utility"
26+
"developer", "utility", "api"
2727
]
2828
}

new/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Alpha's Geode Utils
2+
3+
Miscellaneous Geode utils to make development easier:
4+
5+
## Modifying any CCObject
6+
7+
Familiar modify syntax as Geode, supporting fields. `class $objectModify(SomeObject)` or `class $nodeModify(SomeNode)`
8+
You can name the modified node/object the same way as well `class $objectModify(MySomeObject, SomeObject)` or `class $nodeModify(MySomeNode, SomeNode)`
9+
10+
$nodeModify and $objectModify do the same thing, except $nodeModify is a base of CCNode while $objectModify is a base of CCObject
11+
12+
To use this, you will create a `void modify()` method within that class and inside of there you can change the node to your hearts content. You can use the fields struct just like in Geode to add fields if needed.
13+
14+
To edit the priority (lets say another mod modifies the same node using this) you can add `static int modifyPrio()` to the class which should return an integer value that is the priority you wish to set.
15+
16+
**Full Example modifying BetterInfo's CustomCreatorLayer:**
17+
18+
```c++
19+
class $nodeModify(MyCustomCreatorLayer, CustomCreatorLayer) {
20+
21+
static int modifyPrio() {
22+
return 10;
23+
}
24+
25+
struct Fields {
26+
int m_number = 0;
27+
};
28+
29+
void modify() {
30+
31+
CCSprite* spr = CCSprite::createWithSpriteFrameName("GJ_playBtn_001.png");
32+
CCMenuItemSpriteExtra* btn = CCMenuItemSpriteExtra::create(spr, this, menu_selector(MyCustomCreatorLayer::onEpicButton));
33+
btn->setID("epic-button"_spr);
34+
35+
if (CCMenu* creatorButtonsMenu = typeinfo_cast<CCMenu*>(getChildByID("cvolton.betterinfo/creator-buttons-menu"))) {
36+
creatorButtonsMenu->addChild(btn);
37+
creatorButtonsMenu->updateLayout();
38+
}
39+
}
40+
41+
void onEpicButton(CCObject* obj) {
42+
log::info("m_number {}", m_fields->m_number);
43+
m_fields->m_number++;
44+
}
45+
};
46+
```
47+
48+
## Modifying Base Classes of CCNodes
49+
50+
Using $baseModify, you can modify all nodes that inheret some class. In the following example, we modify all FLAlertLayers, not just FLAlertLayer itself. These are different than the above $nodeModify and $cobjectModify, as it requires a valid type to be passed in, thus it does not natively support modifying other mod's nodes without declaring the class beforehand.
51+
52+
```c++
53+
class $baseModify(MyFLAlertLayer, FLAlertLayer) {
54+
55+
void modify() {
56+
setScale(2.f);
57+
}
58+
59+
}
60+
```
61+
62+
If you still wish to modify another mod's nodes by their base class, you can do the following.
63+
Let's say we had a node called AlphasEpicNode, which in itself inherets CCNode, that a lot of nodes from AlphasEpicMod inherit. Because we are defining it beforehand (make sure the definition matches that of how it is in said mod), the mod can deduce it and it's own base class names and it will work as expected.
64+
65+
```c++
66+
class AlphasEpicNode : public CCNode {};
67+
class $baseModify(MyAlphasEpicNode, AlphasEpicNode) {
68+
69+
void modify() {
70+
setScale(2.f);
71+
}
72+
73+
}
74+
```
75+
76+
## General Utils
77+
78+
### AlphaUtils::Cocos namespace:
79+
80+
Getting sprites while ignoring Texture Loader fallback:
81+
`std::optional<cocos2d::CCSprite*> getSprite(const char* sprName)`
82+
`std::optional<cocos2d::CCSprite*> getSpriteByFrameName(const char* sprFrameName)`
83+
84+
Getting a layer from the scene even during transition:
85+
`std::optional<cocos2d::CCNode*> getLayer()`
86+
`std::optional<cocos2d::CCNode*> getLayerByClassName(std::string className)`
87+
88+
Setting a node color by hex code:
89+
`bool setColorByHex(cocos2d::CCRGBAProtocol* node, std::string colorHex)`
90+
91+
Checking if a parent node contains a node anywhere in a tree:
92+
`bool hasNode(cocos2d::CCNode* child, cocos2d::CCNode* parent)`
93+
94+
Getting a child by class name dynamically:
95+
`std::optional<cocos2d::CCNode*> getChildByClassName(cocos2d::CCNode* node, std::string name, int index = 0)`
96+
97+
Getting a node's class name:
98+
`std::string getClassName(cocos2d::CCObject* obj, bool removeNamespace = false)`
99+
100+
### AlphaUtils::Misc namespace:
101+
102+
Getting a random number:
103+
`int getRandomNumber(int lower, int upper)`

new/about.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Alpha's Geode Utils
2+
3+
Miscellaneous Geode utils to make development easier:
4+
5+
## Modifying any CCObject
6+
7+
Familiar modify syntax as Geode, supporting fields. `class $objectModify(SomeObject)` or `class $nodeModify(SomeNode)`
8+
You can name the modified node/object the same way as well `class $objectModify(MySomeObject, SomeObject)` or `class $nodeModify(MySomeNode, SomeNode)`
9+
10+
$nodeModify and $objectModify do the same thing, except $nodeModify is a base of CCNode while $objectModify is a base of CCObject
11+
12+
To use this, you will create a `void modify()` method within that class and inside of there you can change the node to your hearts content. You can use the fields struct just like in Geode to add fields if needed.
13+
14+
To edit the priority (lets say another mod modifies the same node using this) you can add `static int modifyPrio()` to the class which should return an integer value that is the priority you wish to set.
15+
16+
**Full Example modifying BetterInfo's CustomCreatorLayer:**
17+
18+
```c++
19+
class $nodeModify(MyCustomCreatorLayer, CustomCreatorLayer) {
20+
21+
static int modifyPrio() {
22+
return 10;
23+
}
24+
25+
struct Fields {
26+
int m_number = 0;
27+
};
28+
29+
void modify() {
30+
31+
CCSprite* spr = CCSprite::createWithSpriteFrameName("GJ_playBtn_001.png");
32+
CCMenuItemSpriteExtra* btn = CCMenuItemSpriteExtra::create(spr, this, menu_selector(MyCustomCreatorLayer::onEpicButton));
33+
btn->setID("epic-button"_spr);
34+
35+
if (CCMenu* creatorButtonsMenu = typeinfo_cast<CCMenu*>(getChildByID("cvolton.betterinfo/creator-buttons-menu"))) {
36+
creatorButtonsMenu->addChild(btn);
37+
creatorButtonsMenu->updateLayout();
38+
}
39+
}
40+
41+
void onEpicButton(CCObject* obj) {
42+
log::info("m_number {}", m_fields->m_number);
43+
m_fields->m_number++;
44+
}
45+
};
46+
```
47+
48+
## Modifying Base Classes of CCNodes
49+
50+
Using $baseModify, you can modify all nodes that inheret some class. In the following example, we modify all FLAlertLayers, not just FLAlertLayer itself. These are different than the above $nodeModify and $cobjectModify, as it requires a valid type to be passed in, thus it does not natively support modifying other mod's nodes without declaring the class beforehand.
51+
52+
```c++
53+
class $baseModify(MyFLAlertLayer, FLAlertLayer) {
54+
55+
void modify() {
56+
setScale(2.f);
57+
}
58+
59+
}
60+
```
61+
62+
If you still wish to modify another mod's nodes by their base class, you can do the following.
63+
Let's say we had a node called AlphasEpicNode, which in itself inherets CCNode, that a lot of nodes from AlphasEpicMod inherit. Because we are defining it beforehand (make sure the definition matches that of how it is in said mod), the mod can deduce it and it's own base class names and it will work as expected.
64+
65+
```c++
66+
class AlphasEpicNode : public CCNode {};
67+
class $baseModify(MyAlphasEpicNode, AlphasEpicNode) {
68+
69+
void modify() {
70+
setScale(2.f);
71+
}
72+
73+
}
74+
```
75+
76+
## General Utils
77+
78+
### AlphaUtils::Cocos namespace:
79+
80+
Getting sprites while ignoring Texture Loader fallback:
81+
`std::optional<cocos2d::CCSprite*> getSprite(const char* sprName)`
82+
`std::optional<cocos2d::CCSprite*> getSpriteByFrameName(const char* sprFrameName)`
83+
84+
Getting a layer from the scene even during transition:
85+
`std::optional<cocos2d::CCNode*> getLayer()`
86+
`std::optional<cocos2d::CCNode*> getLayerByClassName(std::string className)`
87+
88+
Setting a node color by hex code:
89+
`bool setColorByHex(cocos2d::CCRGBAProtocol* node, std::string colorHex)`
90+
91+
Checking if a parent node contains a node anywhere in a tree:
92+
`bool hasNode(cocos2d::CCNode* child, cocos2d::CCNode* parent)`
93+
94+
Getting a child by class name dynamically:
95+
`std::optional<cocos2d::CCNode*> getChildByClassName(cocos2d::CCNode* node, std::string name, int index = 0)`
96+
97+
Getting a node's class name:
98+
`std::string getClassName(cocos2d::CCObject* obj, bool removeNamespace = false)`
99+
100+
### AlphaUtils::Misc namespace:
101+
102+
Getting a random number:
103+
`int getRandomNumber(int lower, int upper)`

src/NodeModding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ObjectModding* ObjectModding::get() {
3535
return instance;
3636
}
3737

38-
std::unordered_map<std::string, std::vector<ModifyBaseInfo>> BaseModding::getBasesToModify() {
38+
/*std::unordered_map<std::string, std::vector<ModifyBaseInfo>> BaseModding::getBasesToModify() {
3939
return m_basesToModify;
4040
}
4141
@@ -63,7 +63,7 @@ BaseModding* BaseModding::get() {
6363
instance = new BaseModding();
6464
}
6565
return instance;
66-
}
66+
}*/
6767

6868
std::unordered_map<std::string, std::vector<ModifyInfo>> NodeModding::getNodesToModify() {
6969
return m_nodesToModify;

0 commit comments

Comments
 (0)