Skip to content

Commit 07a7394

Browse files
committed
Bug fixes
1 parent ad49d79 commit 07a7394

File tree

4 files changed

+131
-2
lines changed

4 files changed

+131
-2
lines changed

src/ModLayers/MenuLayer/FunctionLoader.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
#include <windows.h>
1111
#include <shellapi.h>
1212
#endif
13+
14+
// english or german
15+
// english : somewhere go find it
16+
// german : somewhere go find it
17+
1318
static geode::Loader* get();
1419
using namespace geode::prelude;
1520

@@ -33,6 +38,7 @@ bool RunAsAdmin(HWND hwnd, LPCSTR lpFile, LPCSTR lpParameters) {
3338
}
3439
#endif
3540

41+
3642
// separate hook to run tween after pages api updates the menu
3743

3844
class $modify(MenuLayer) {
@@ -44,12 +50,20 @@ class $modify(MenuLayer) {
4450
bool init() {
4551
if (!MenuLayer::init())
4652
return false;
53+
54+
if (!Mod::get()->getSettingValue<bool>("RunMainMenu")) {
55+
return true;
56+
};
57+
4758
runTween(this);
4859
compactmainmenuFix(this);
4960
return true;
5061
}
5162
};
5263

64+
// German
65+
// Der erste, der sich bewegt, ist schwul
66+
5367
class $modify(MenuLayer) {
5468
/*
5569
'ewww
@@ -117,6 +131,9 @@ mat (@mat.4) - 2024
117131
};
118132
};
119133

134+
// English
135+
// First one who moves is gay
136+
120137
bool init() {
121138
if (!MenuLayer::init())
122139
return false;

src/ModLayers/MenuLayer/ModifyHooks/MenuManipulation.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ static void setupMenuPositions(auto layer) {
7070
.layout(RowLayoutFix_IconProfile->setAxisAlignment(AxisAlignment::End))
7171
.contentSize({111.000f, 58.000f})
7272
.scale(0.575f);
73-
if (Loader::get()->isModLoaded("capeling.icon_profile_2.2")) {
73+
if (Loader::get()->isModLoaded("capeling.icon_profile")) {
7474
profileMenu->setRotationY(180);
7575
profileMenu->setRotationX(0);
7676
RowLayoutFix_IconProfile->setAxisAlignment(AxisAlignment::Start);
7777
}
7878
profileMenu->updateLayout();
7979
}
8080

81+
8182
if(CCNode* playerUsername = layer->getChildByID("player-username")){
8283
Build(playerUsername)
8384
.pos(winSize.width - 40, winSize.height - 20)

src/ModLayers/MenuLayer/ModifyHooks/addbuttons.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ static void addbuttons(auto layer) {
7070
};
7171
}
7272
}
73-
}
73+
} // fish react person above me
7474
layer->getChildByID("bottom-menu")->updateLayout();
7575
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#include <Geode/Geode.hpp>
2+
#include <UIBuilder.hpp>
3+
#include <Geode/ui/MDPopup.hpp>
4+
#include <Geode/cocos/menu_nodes/CCMenu.h>
5+
#include <Geode/modify/CCMenu.hpp>
6+
#include <Geode/utils/web.hpp>
7+
using namespace geode::prelude;
8+
class YoutubeButton : public CCLayer {
9+
public:
10+
void Link(CCObject*) {
11+
geode::utils::web::openLinkInBrowser("https://www.youtube.com/channel/UC3A8dtlO94rHEkn4Kz7aB7g");
12+
}
13+
};
14+
15+
CCNode* menu = nullptr;
16+
void inityoutubeandsuch() {
17+
geode::log::debug("Found ui");
18+
};
19+
inline bool isSpriteFrameName(CCNode* node, const char* name) {
20+
auto cache = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name);
21+
if (!cache) return false;
22+
23+
auto* texture = cache->getTexture();
24+
auto rect = cache->getRect();
25+
26+
if (auto* spr = typeinfo_cast<CCSprite*>(node)) {
27+
if (spr->getTexture() == texture && spr->getTextureRect() == rect) {
28+
return true;
29+
}
30+
} else if (auto* btn = typeinfo_cast<CCMenuItemSprite*>(node)) {
31+
auto* img = btn->getNormalImage();
32+
if (auto* spr = typeinfo_cast<CCSprite*>(img)) {
33+
if (spr->getTexture() == texture && spr->getTextureRect() == rect) {
34+
return true;
35+
}
36+
}
37+
}
38+
return false;
39+
}
40+
41+
inline CCNode* getChildBySpriteFrameName(CCNode* parent, const char* name) {
42+
for (auto child : CCArrayExt<CCNode*>(parent->getChildren())) {
43+
if (::isSpriteFrameName(static_cast<CCNode*>(child), name)) {
44+
return child;
45+
}
46+
}
47+
return nullptr;
48+
}
49+
50+
class $modify(CCMenu) {
51+
static void onModify(auto & self) { self.setHookPriority("CCMenu::addChild", 1000); };
52+
virtual void addChild(CCNode* Child, int zORDER, int tag) {
53+
CCMenu::addChild(Child, zORDER, tag);
54+
if (auto object = typeinfo_cast<CCMenuItemSpriteExtra*>(Child->getParent()->getChildren()->objectAtIndex(0))) {
55+
if (object == Child) {
56+
if (!object->getParent()) {
57+
return;
58+
};
59+
60+
if (menu == object->getParent()) {
61+
return;
62+
}
63+
if (!object->getParent()->getParent()) {
64+
return;
65+
}
66+
auto cccccc = object->getParent()->getParent();
67+
if (!cccccc) {
68+
return;
69+
}
70+
geode::Loader::get()->queueInMainThread([this,cccccc,object] {
71+
CCNode* a111111 = nullptr;
72+
for(auto items : CCArrayExt<CCNode*>(cccccc->getChildren())) {
73+
if (items->getChildrenCount() == 2) {
74+
a111111 = items;
75+
break;
76+
};
77+
}
78+
if (!a111111) {
79+
return;
80+
}
81+
if (a111111->getChildrenCount() < 2) {
82+
return;
83+
}
84+
cocos2d::CCNode* a22222 = typeinfo_cast<CCNode*>(a111111->getChildren()->objectAtIndex(0));
85+
if (!a22222) {
86+
return;
87+
}
88+
cocos2d::CCLabelBMFont* a333333 = getChildOfType<CCLabelBMFont>(a22222,0);
89+
if (!a333333) {
90+
return;
91+
}
92+
std::string id = a333333->getString();
93+
if (id == "(ID: muhammadgames.bettermenu)") {
94+
95+
menu = typeinfo_cast<CCMenu*>(typeinfo_cast<CCNode*>(a22222->getChildren()->objectAtIndex(7))->getChildren()->objectAtIndex(1));
96+
97+
inityoutubeandsuch();
98+
auto btn = CCSprite::createWithSpriteFrameName("gj_ytIcon_001.png");
99+
btn->setScale(0.7);
100+
auto btnee = CCMenuItemSpriteExtra::create(btn, menu, menu_selector(YoutubeButton::Link));
101+
btnee->setPosition(typeinfo_cast<CCMenuItemSpriteExtra*>(menu->getChildren()->objectAtIndex(0))->getPosition());
102+
typeinfo_cast<CCMenuItemSpriteExtra*>(menu->getChildren()->objectAtIndex(0))->removeFromParent();
103+
menu->addChild(btnee);
104+
typeinfo_cast<CCMenuItemSpriteExtra*>(menu->getChildren()->objectAtIndex(2))->removeFromParent();
105+
} else { return; }
106+
});
107+
108+
}
109+
}
110+
}
111+
}; //geode.loader/homepage.png

0 commit comments

Comments
 (0)