Skip to content

Commit aeaafe6

Browse files
committed
Fix a crash
1 parent d6c12af commit aeaafe6

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.9.3
2+
**NOTICE! Modifying nodes by ID will soon be depreciated. Once the next GD update comes out, I will be removing that feature in favor of modiifying nodes by their class name. This is the name BEFORE the one in quotes in DevTools. For example `ui/cvolton.betterinfo$ExtendedLevelInfo.json` will become `ui/ExtendedLevelInfo.json` and anything in the nodes folder will no longer work and should be placed in the UI folder.**
3+
- Fixed crash when pressing space on main menu for mac
4+
15
## 1.9.2
26
- Fix a memory leak when setting a font file on a CCLabelBMFont
37
- Remove batch node hack :P

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"geode": "4.1.1",
2+
"geode": "4.2.1",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
66
"mac": "2.2074"
77
},
8-
"version": "v1.9.2",
8+
"version": "v1.9.3",
99
"id": "alphalaneous.happy_textures",
1010
"name": "Happy Textures :3",
1111
"developer": "Alphalaneous",

src/Callbacks.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,29 @@ CCMenuItemSpriteExtra* Callbacks::getDummyButton() {
2828
return m_dummyButton;
2929
}
3030

31+
struct MenuLayerCallbacks : public CCNode {
32+
33+
void onPlay(CCObject* obj) {
34+
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, LevelSelectLayer::scene(0)));
35+
}
36+
37+
void onCreator(CCObject* obj) {
38+
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, CreatorLayer::scene()));
39+
}
40+
41+
void onGarage(CCObject* obj) {
42+
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, GJGarageLayer::scene()));
43+
}
44+
45+
};
46+
3147
void Callbacks::generateMenuLayerCallbacks() {
3248
CREATE_NORMAL(MenuLayer);
33-
REGISTER_CALLBACK(MenuLayer, onPlay);
49+
m_callbacks["MenuLayer"]["onPlay"] = std::pair<CCNode*, cocos2d::SEL_MenuHandler>(self, menu_selector(MenuLayerCallbacks::onPlay));
50+
m_callbacks["MenuLayer"]["onGarage"] = std::pair<CCNode*, cocos2d::SEL_MenuHandler>(self, menu_selector(MenuLayerCallbacks::onGarage));
51+
m_callbacks["MenuLayer"]["onCreator"] = std::pair<CCNode*, cocos2d::SEL_MenuHandler>(self, menu_selector(MenuLayerCallbacks::onCreator));
3452
REGISTER_CALLBACK(MenuLayer, onAchievements);
35-
REGISTER_CALLBACK(MenuLayer, onCreator);
3653
REGISTER_CALLBACK(MenuLayer, onDaily);
37-
REGISTER_CALLBACK(MenuLayer, onGarage);
3854
REGISTER_CALLBACK(MenuLayer, onMoreGames);
3955
REGISTER_CALLBACK(MenuLayer, onMyProfile);
4056
REGISTER_CALLBACK(MenuLayer, onOptions);

src/UIModding.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,12 +1572,18 @@ void UIModding::doUICheck(CCNode* node, bool afterTransition) {
15721572
unsigned long fileSize = 0;
15731573
unsigned char* buffer = CCFileUtils::sharedFileUtils()->getFileData(path.c_str(), "rb", &fileSize);
15741574

1575+
/*if (!buffer || fileSize == 0) {
1576+
path = "ui/nodes/" + nodeID + ".json";
1577+
buffer = CCFileUtils::sharedFileUtils()->getFileData(path.c_str(), "rb", &fileSize);
1578+
}*/
1579+
15751580
if (buffer && fileSize != 0) {
15761581

15771582
std::string data = std::string(reinterpret_cast<char*>(buffer), fileSize);
15781583
geode::Result<matjson::Value, matjson::ParseError> value = matjson::parse(data);
15791584

15801585
if (value.isOk()) {
1586+
log::warn("Modifying by ID with Happy Textures will soon be unsupported!");
15811587

15821588
matjson::Value expandedValue = value.unwrap();
15831589
if (expandedValue.isObject()) {

src/nodes/MenuLayer.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,6 @@ class $modify(MyMenuLayer, MenuLayer) {
1313
HOOK_LATEST("MenuLayer::init");
1414
}
1515

16-
void onPlay(CCObject* obj) {
17-
if (CCNode* node = typeinfo_cast<CCNode*>(obj)) {
18-
if (node->getUserObject("dummy"_spr)) {
19-
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, LevelSelectLayer::scene(0)));
20-
return;
21-
}
22-
}
23-
MenuLayer::onPlay(obj);
24-
}
25-
26-
void onCreator(CCObject* obj) {
27-
if (CCNode* node = typeinfo_cast<CCNode*>(obj)) {
28-
if (node->getUserObject("dummy"_spr)) {
29-
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, CreatorLayer::scene()));
30-
return;
31-
}
32-
}
33-
MenuLayer::onCreator(obj);
34-
}
35-
36-
void onGarage(CCObject* obj) {
37-
if (CCNode* node = typeinfo_cast<CCNode*>(obj)) {
38-
if (node->getUserObject("dummy"_spr)) {
39-
CCDirector::get()->pushScene(CCTransitionFade::create(0.5, GJGarageLayer::scene()));
40-
return;
41-
}
42-
}
43-
MenuLayer::onGarage(obj);
44-
}
45-
4616
bool init() {
4717
if (Callbacks::get()->m_ignoreUICheck) return MenuLayer::init();
4818

0 commit comments

Comments
 (0)