From 93482eb7c2c0f82718c4ea918f8e1189964a62e6 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:05:23 +0300 Subject: [PATCH 001/270] ninx was lazy to make a pr --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ab336f38..d67e0028 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4320,7 +4320,7 @@ class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate { static MoreOptionsLayer* create() = win 0x1de850; virtual bool init() = mac 0x43f470, win 0x1DE8F0; void addToggle(const char* name, const char* key, const char* info) = mac 0x440430, win 0x1df6b0; - void onKeybindings(cocos2d::CCObject* sender) = win 0x749d0; + void onKeybindings(cocos2d::CCObject* sender) = mac 0x4410e0, win 0x749d0; void onToggle(cocos2d::CCObject* sender) = mac 0x441370; } From 46e4cdb3b1cd1377c237c168cb9764fd727ae631 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:43:55 +0300 Subject: [PATCH 002/270] Compiles until linking --- CMakeLists.txt | 2 +- bindings/Cocos2d.bro | 194 ++++++++--------- bindings/GeometryDash.bro | 264 +++++++++++++++++++++++- codegen/src/BindingGen.cpp | 4 +- loader/src/platform/android/ModImpl.cpp | 3 +- 5 files changed, 365 insertions(+), 102 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99b5201f..f8e9e928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#3423a29") +CPMAddPackage("gh:geode-sdk/TulipHook#9f1938f") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 632ce503..00844294 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1,11 +1,11 @@ // clang-format off -[[link(win)]] +[[link(win, android)]] class cocos2d::CCActionTween { static cocos2d::CCActionTween* create(float, char const*, float, float) = mac 0x447590; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCActionManager { CCActionManager() { m_pTargets = nullptr; @@ -21,17 +21,17 @@ class cocos2d::CCActionManager { auto resumeTarget(cocos2d::CCObject*) = mac 0x10bd20; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCAnimate { static cocos2d::CCAnimate* create(cocos2d::CCAnimation*) = mac 0x1f8fc0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCAnimation { static auto createWithSpriteFrames(cocos2d::CCArray*, float) = mac 0x140df0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCApplication { virtual auto run(); virtual auto getCurrentLanguage() = mac 0x1a3f40, ios 0x10e508; @@ -39,13 +39,15 @@ class cocos2d::CCApplication { virtual auto openURL(char const*) = mac 0x1a4550, ios 0x10e7a4; virtual auto setAnimationInterval(double) = mac 0x1a3ee0, ios 0x10e494; static auto sharedApplication() = mac 0x1a3f30; + + [[link(win)]] bool getControllerConnected() const = mac 0x27d1b0; // ~CCApplication() = mac 0x1a3d10, ios 0x10e384; CCApplication() {} ~CCApplication() {} } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCArray { // auto addObject(cocos2d::CCObject*) = mac 0x419f90, ios 0x16504c; auto addObjectNew(cocos2d::CCObject*) = mac 0x41a450; @@ -67,27 +69,27 @@ class cocos2d::CCArray { // auto stringAtIndex(unsigned int) = mac 0x41a320; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCBezierTo { static cocos2d::CCBezierTo* create(float, cocos2d::_ccBezierConfig const&) = mac 0x1f6c10; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCBMFontConfiguration { static cocos2d::CCBMFontConfiguration* create(char const*) = mac 0x3450f0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCCallFunc { static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFunc) = mac 0x454d90; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCCallFuncO { static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFuncO, cocos2d::CCObject*) = mac 0x455940; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCClippingNode { CCClippingNode() { m_pStencil = nullptr; @@ -121,12 +123,12 @@ class cocos2d::CCClippingNode { // void updateConnected() = win 0xc7fb0; //} -[[link(win)]] +[[link(win, android)]] class cocos2d::CCDelayTime { static cocos2d::CCDelayTime* create(float) = mac 0x1f4380; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCDictionary { auto allKeys() = mac 0x190450, ios 0x2de774; auto count() = mac 0x190430; @@ -142,7 +144,7 @@ class cocos2d::CCDictionary { auto valueForKey(gd::string const&) = mac 0x1907a0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCDirector { CCDirector() {} ~CCDirector() {} @@ -185,7 +187,7 @@ class cocos2d::CCDirector { auto popSceneWithTransition(float, cocos2d::PopTransition) = mac 0x24a8b0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCDrawNode { CCDrawNode() = mac 0x378b40, win 0x6b9f0; auto clear() = mac 0x379e80; @@ -201,7 +203,7 @@ class cocos2d::CCDrawNode { virtual ~CCDrawNode() = mac 0x378cc0, win 0x6ba60; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCAction { CCAction() = mac 0x35b610, win 0x7a6d0; virtual ~CCAction() = mac 0x35b6b0, win 0x7a7f0; @@ -213,13 +215,13 @@ class cocos2d::CCAction { auto update(float time) = mac 0x35b890; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCFiniteTimeAction { // same as CCActionInterval::reverse i think auto reverse() = mac 0x1f2720; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCActionInterval { auto copyWithZone(cocos2d::CCZone* zone) = mac 0x1f2550; auto isDone() = mac 0x1f2640; @@ -229,32 +231,32 @@ class cocos2d::CCActionInterval { bool initWithDuration(float d) = mac 0x1f2510; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseBackIn { static cocos2d::CCEaseBackIn* create(cocos2d::CCActionInterval*) = mac 0x2a41b0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseElasticIn { static cocos2d::CCEaseElasticIn* create(cocos2d::CCActionInterval*, float) = mac 0x2a2e00; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseElasticOut { static cocos2d::CCEaseElasticOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a3080; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseIn { static cocos2d::CCEaseIn* create(cocos2d::CCActionInterval*, float) = mac 0x2a1960; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseInOut { static cocos2d::CCEaseInOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1d80; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEaseOut { static cocos2d::CCEaseOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1b70; } @@ -283,7 +285,7 @@ class cocos2d::CCEGLView { void onGLFWWindowSizeFunCallback(GLFWwindow* window, int width, int height); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCEGLViewProtocol { CCEGLViewProtocol() = win 0xbac00; virtual ~CCEGLViewProtocol() = win 0xbacc0; @@ -294,17 +296,17 @@ class cocos2d::CCEGLViewProtocol { virtual void setFrameSize(float, float) = mac 0x29d960; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCFadeOut { static cocos2d::CCFadeOut* create(float) = mac 0x1f7d80; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCFadeTo { static cocos2d::CCFadeTo* create(float, unsigned char) = mac 0x1f7ff0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCFileUtils : cocos2d::TypeInfo { static cocos2d::CCFileUtils* sharedFileUtils() = mac 0x377030, ios 0x159450; static void purgeFileUtils(); @@ -314,19 +316,19 @@ class cocos2d::CCFileUtils : cocos2d::TypeInfo { void removeAllPaths() = mac 0x241600; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCGLProgram { auto setUniformsForBuiltins() = mac 0x232c70; auto use() = mac 0x231d70; bool compileShader(unsigned int* shader, unsigned int type, const char* source) = mac 0x231a30; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCHide { static cocos2d::CCHide* create() = mac 0x4543e0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCIMEDelegate { ~CCIMEDelegate() { CCIMEDispatcher::sharedDispatcher()->removeDelegate(this); @@ -338,7 +340,7 @@ class cocos2d::CCIMEDelegate { } } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCIMEDispatcher { static auto sharedDispatcher() = mac 0x2773f0, ios 0x12d170; auto addDelegate(cocos2d::CCIMEDelegate*) = mac 0x277480, ios 0x12d204; @@ -347,7 +349,7 @@ class cocos2d::CCIMEDispatcher { void dispatchDeleteBackward() = mac 0x277af0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCImage { CCImage() = mac 0x24fa00, win 0xc5fd0; virtual ~CCImage() = mac 0x24fa80, win 0xc6100; @@ -356,20 +358,20 @@ class cocos2d::CCImage { auto initWithImageData(void*, int, cocos2d::CCImage::EImageFormat, int, int, int) = mac 0x24fcb0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCKeyboardDispatcher { bool dispatchKeyboardMSG(cocos2d::enumKeyCodes, bool) = mac 0xe8190; const char* keyToString(cocos2d::enumKeyCodes) = mac 0xe8450; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCKeyboardHandler { static cocos2d::CCKeyboardHandler* handlerWithDelegate(cocos2d::CCKeyboardDelegate*) = mac 0x242030; virtual auto initWithDelegate(cocos2d::CCKeyboardDelegate*) = mac 0x241ff0, ios 0x13f8b8; ~CCKeyboardHandler() = mac 0x241e90, ios 0x13f87c, win 0x99a10; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCKeypadHandler { static cocos2d::CCKeypadHandler* handlerWithDelegate(cocos2d::CCKeypadDelegate*) = mac 0x1ff2d0; virtual auto initWithDelegate(cocos2d::CCKeypadDelegate*) = mac 0x1ff290, ios 0x69; // iOS stub @@ -378,7 +380,7 @@ class cocos2d::CCKeypadHandler { } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCLabelBMFont { static cocos2d::CCLabelBMFont* create(char const*, char const*) = mac 0x347660; auto limitLabelWidth(float, float, float) = mac 0x34a6e0, ios 0x21b740; @@ -418,7 +420,7 @@ class cocos2d::CCLabelBMFont { virtual ~CCLabelBMFont() = mac 0x347e80, win 0x9be70; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCLabelTTF { static cocos2d::CCLabelTTF* create() = mac 0x1fa7e0; static cocos2d::CCLabelTTF* create(char const*, char const*, float) = mac 0x1fa840; @@ -426,7 +428,7 @@ class cocos2d::CCLabelTTF { virtual auto setString(char const*) = mac 0x1fad70; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCLayer { CCLayer() = mac 0x2725b0, ios 0xc7708, win 0xa15e0; virtual auto ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x2734d0, ios 0xc810c; @@ -467,7 +469,7 @@ class cocos2d::CCLayer { virtual ~CCLayer() = mac 0x2727b0, ios 0xc7848, win 0xa1940; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCLayerColor { CCLayerColor() = mac 0x274320, ios 0xc8aec, win 0xa1710; static cocos2d::CCLayerColor* create(cocos2d::_ccColor4B const&, float, float) = mac 0x2745e0; @@ -485,7 +487,7 @@ class cocos2d::CCLayerColor { virtual ~CCLayerColor() = mac 0x2743d0, ios 0x2743e0, win 0xa1a20; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCLayerRGBA { CCLayerRGBA() = mac 0x2738d0, ios 0xc85cc, win 0xa1890; virtual auto init() = mac 0x273b40, ios 0xc8de8; @@ -506,7 +508,7 @@ class cocos2d::CCLayerRGBA { virtual ~CCLayerRGBA() = mac 0x273aa0, ios 0xc77b0, win 0xa1b20; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMenu { auto alignItemsHorizontallyWithPadding(float) = mac 0x4393e0, ios 0x132508; auto alignItemsVerticallyWithPadding(float) = mac 0x439190; @@ -530,7 +532,7 @@ class cocos2d::CCMenu { cocos2d::CCMenuItem* itemForTouch(cocos2d::CCTouch*) = mac 0x438dd0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMenuItem { bool initWithTarget(cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1fb7f0; virtual ~CCMenuItem() = mac 0x1fb8e0, ios 0x2cdf4, win 0xab9c0; @@ -546,13 +548,13 @@ class cocos2d::CCMenuItem { auto rect() = mac 0x1fbb00, ios 0x2cf3c; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMenuItemImage { // virtual ~CCMenuItemImage() = mac 0x1febb0; virtual auto init() = mac 0x1fd750; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMenuItemLabel { virtual ~CCMenuItemLabel() = mac 0x1fc0d0; virtual auto activate() = mac 0x1fc240; @@ -565,7 +567,7 @@ class cocos2d::CCMenuItemLabel { virtual auto setLabel(cocos2d::CCNode*) = mac 0x1fbbc0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMenuItemSprite { // virtual ~CCMenuItemSprite() = mac 0x1feab0; virtual auto selected() = mac 0x1fd3f0, ios 0x2d2cc; @@ -585,7 +587,7 @@ class cocos2d::CCMenuItemSprite { static auto create(cocos2d::CCNode*, cocos2d::CCNode*, cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1fd2d0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMotionStreak { CCMotionStreak() = win 0xae310; virtual ~CCMotionStreak() = win 0xae450; @@ -596,30 +598,30 @@ class cocos2d::CCMotionStreak { virtual auto draw(); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMouseDispatcher { bool dispatchScrollMSG(float x, float y) = mac 0x2e8f40; void removeDelegate(cocos2d::CCMouseDelegate* delegate); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMouseHandler { static cocos2d::CCMouseHandler* handlerWithDelegate(cocos2d::CCMouseDelegate*) = mac 0x12ef80; virtual auto initWithDelegate(cocos2d::CCMouseDelegate*) = mac 0x12ef40, ios 0x43798; ~CCMouseHandler() = mac 0x12ede0, ios 0x4375c, win 0xb1fd0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMoveBy { static cocos2d::CCMoveBy* create(float, cocos2d::CCPoint const&) = mac 0x1f50e0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCMoveTo { static cocos2d::CCMoveTo* create(float, cocos2d::CCPoint const&) = mac 0x1f54d0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCNode { CCNode() = mac 0x122550, win 0x5e7d0; auto boundingBox() = mac 0x123030; @@ -739,7 +741,7 @@ class cocos2d::CCNode { virtual ~CCNode() = mac 0x122750, ios 0x6c98, win 0x5ea40; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCNodeRGBA { CCNodeRGBA() = mac 0x124b30, win 0x5e9d0; virtual ~CCNodeRGBA() = mac 0x124bb0, ios 0x15f748, win 0x5ebb0; @@ -758,7 +760,7 @@ class cocos2d::CCNodeRGBA { virtual auto setCascadeColorEnabled(bool) = mac 0x125340, ios 0x15fb80; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCObject { CCObject() = mac 0x250ca0, ios 0x43864, win 0x69230; auto acceptVisitor(cocos2d::CCDataVisitor&) = mac 0x250f30, ios 0x439f0; @@ -774,7 +776,7 @@ class cocos2d::CCObject { ~CCObject() = mac 0x250d20, ios 0x6ac0, win 0x69270; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCParticleSystem { CCParticleSystem() = win 0xb6650; virtual ~CCParticleSystem() = win 0xb68e0; @@ -785,7 +787,7 @@ class cocos2d::CCParticleSystem { auto stopSystem() = mac 0x46bd10; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCParticleSystemQuad { CCParticleSystemQuad() = win 0xb9bd0; virtual ~CCParticleSystemQuad() = win 0xb9c10; @@ -794,18 +796,18 @@ class cocos2d::CCParticleSystemQuad { auto setupVBO(); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCPoolManager { auto pop() = mac 0x214620; static cocos2d::CCPoolManager* sharedPoolManager() = mac 0x2142c0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRemoveSelf { static cocos2d::CCRemoveSelf* create(bool) = mac 0x454700; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRenderTexture { auto begin() = mac 0x35ce10; auto end() = mac 0x35d2c0; @@ -815,45 +817,45 @@ class cocos2d::CCRenderTexture { auto beginWithClear(float r, float g, float b, float a) = mac 0x35d010; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRepeat { static cocos2d::CCRepeat* create(cocos2d::CCFiniteTimeAction*, unsigned int) = mac 0x1f3230; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRepeatForever { static cocos2d::CCRepeatForever* create(cocos2d::CCActionInterval*) = mac 0x1f3920; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRotateBy { static cocos2d::CCRotateBy* create(float, float) = mac 0x1f4c50; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCRotateTo { static cocos2d::CCRotateTo* create(float, float) = mac 0x1f47b0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCScaleTo { static cocos2d::CCScaleTo* create(float, float) = mac 0x1f6ff0; static cocos2d::CCScaleTo* create(float, float, float) = mac 0x1f70f0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCScaleBy { static cocos2d::CCScaleTo* create(float, float) = mac 0x1f73c0; static cocos2d::CCScaleTo* create(float, float, float) = mac 0x1f7480; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCScene { static cocos2d::CCScene* create() = mac 0x13c140, ios 0x163070; auto getHighestChildZ() = mac 0x13c200, ios 0x1630e4; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCScheduler { auto scheduleSelector(cocos2d::SEL_SCHEDULE, cocos2d::CCObject*, float, unsigned int, float, bool) = mac 0x242b20; void scheduleSelector(cocos2d::SEL_SCHEDULE selector, cocos2d::CCObject* target, float interval, bool paused) { @@ -868,12 +870,12 @@ class cocos2d::CCScheduler { virtual void update(float delta) = mac 0x2446d0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSequence { static auto createWithVariableList(cocos2d::CCFiniteTimeAction*, va_list) = mac 0x1f2910; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSet { CCSet() = mac 0x45ad80, ios 0x10e870, win 0x699e0; static auto create() = mac 0x45b0b0; @@ -888,14 +890,14 @@ class cocos2d::CCSet { } } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCShaderCache { static auto sharedShaderCache() = mac 0xe6d10; auto programForKey(const char*) = mac 0xe7d40; void reloadDefaultShaders(); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSprite { virtual ~CCSprite() = mac 0x133430, ios 0x15b92c, win 0xd2f90; virtual auto init() = mac 0x132ef0, ios 0x15b488; @@ -970,7 +972,7 @@ class cocos2d::CCSprite { void setFlipY(bool) = mac 0x134c30; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSpriteBatchNode { static cocos2d::CCSpriteBatchNode* create(char const*, unsigned int) = mac 0xbb540; static auto createWithTexture(cocos2d::CCTexture2D*, unsigned int) = mac 0xbb310; @@ -995,28 +997,28 @@ class cocos2d::CCSpriteBatchNode { virtual auto getBlendFunc() = mac 0xbcd50, ios 0x131a60; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSpriteFrame { static auto createWithTexture(cocos2d::CCTexture2D*, cocos2d::CCRect const&, bool, cocos2d::CCPoint const&, cocos2d::CCSize const&) = mac 0x1ac7f0; static auto createWithTexture(cocos2d::CCTexture2D*, cocos2d::CCRect const&) = mac 0x1ac5c0; auto getTexture() = mac 0x1ad250; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCSpriteFrameCache { auto addSpriteFramesWithFile(char const*) = mac 0x199a10, ios 0x29e818; static cocos2d::CCSpriteFrameCache* sharedSpriteFrameCache() = mac 0x198970, ios 0x29dc4c; auto spriteFrameByName(char const*) = mac 0x19a7e0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCStandardTouchHandler { static cocos2d::CCStandardTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int) = mac 0x247f30; virtual auto initWithDelegate(cocos2d::CCTouchDelegate*, int) = mac 0x247ed0, ios 0x69; // iOS stub ~CCStandardTouchHandler() = mac 0x2482a0, ios 0x6d28, win 0xf5a40; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCString { // virtual ~CCString() = mac 0x44c590; virtual auto isEqual(cocos2d::CCObject const*) = mac 0x44c8f0, ios 0x1a1e6c; @@ -1032,7 +1034,7 @@ class cocos2d::CCString { auto intValue() const = mac 0x44c780, ios 0x1a1ca8; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTargetedTouchHandler { static cocos2d::CCTargetedTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int, bool) = mac 0x248010; auto initWithDelegate(cocos2d::CCTouchDelegate*, int, bool) = mac 0x2480f0, ios 0x69; // iOS stub @@ -1040,7 +1042,7 @@ class cocos2d::CCTargetedTouchHandler { } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTexture2D { CCTexture2D() = mac 0x246280, win 0xe9300; ~CCTexture2D() = mac 0x246350, win 0xe93f0; @@ -1065,7 +1067,7 @@ class cocos2d::CCTexture2D { auto setTexParameters(cocos2d::_ccTexParams*) = mac 0x247980; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTextureAtlas { CCTextureAtlas() = win 0xea680; virtual ~CCTextureAtlas() = win 0xea6c0; @@ -1073,12 +1075,12 @@ class cocos2d::CCTextureAtlas { auto mapBuffers(); } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTextFieldTTF { static auto textFieldWithPlaceHolder(char const*, char const*, float) = mac 0x126220; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTextureCache { auto addImage(char const*, bool) = mac 0x358120, ios 0xa8388; auto textureForKey(char const*) = mac 0x359050; @@ -1086,17 +1088,17 @@ class cocos2d::CCTextureCache { static cocos2d::CCTextureCache* sharedTextureCache() = mac 0x356e00, ios 0xa81ec; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTime { static auto gettimeofdayCocos2d(cocos2d::cc_timeval*, void*) = mac 0x19eac0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTintTo { static cocos2d::CCTintTo* create(float, unsigned char, unsigned char, unsigned char) = mac 0x1f82a0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTouch { auto getDelta() const = mac 0x38340; auto getLocationInView() const = mac 0x38250; @@ -1106,7 +1108,7 @@ class cocos2d::CCTouch { auto getStartLocation() const = mac 0x38310; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTouchDispatcher { auto addTargetedDelegate(cocos2d::CCTouchDelegate*, int, bool) = mac 0x281180; auto addStandardDelegate(cocos2d::CCTouchDelegate*, int) = mac 0x281060; @@ -1116,7 +1118,7 @@ class cocos2d::CCTouchDispatcher { void touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int) = mac 0x281a60; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTouchHandler { virtual auto initWithDelegate(cocos2d::CCTouchDelegate*, int) = mac 0x247d10, ios 0x69f8; auto getPriority() = mac 0x247c20; @@ -1126,19 +1128,19 @@ class cocos2d::CCTouchHandler { ~CCTouchHandler() = mac 0x247de0, ios 0x6ac0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::CCTransitionFade { static cocos2d::CCTransitionFade* create(float, cocos2d::CCScene*) = mac 0x8ea30, ios 0x12c244; } -[[link(win)]] +[[link(win, android)]] class cocos2d::ZipUtils { static auto compressString(gd::string, bool, int) = mac 0xe9a50; static auto decompressString(gd::string, bool, int) = mac 0xea380; static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**) = mac 0xe9cf0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::extension::CCControl { CCControl() {} virtual bool init() = mac 0x1a71c0; @@ -1162,7 +1164,7 @@ class cocos2d::extension::CCControl { auto isSelected() = mac 0x1a7ec0; } -[[link(win)]] +[[link(win, android)]] class cocos2d::extension::CCControlColourPicker { CCControlColourPicker() {} ~CCControlColourPicker() = mac 0x1aae30; @@ -1176,13 +1178,13 @@ class cocos2d::extension::CCControlColourPicker { } -[[link(win)]] +[[link(win, android)]] class cocos2d::extension::CCControlUtils { static cocos2d::extension::HSV HSVfromRGB(cocos2d::extension::RGBA) = mac 0x1e6750; static cocos2d::extension::RGBA RGBfromHSV(cocos2d::extension::HSV) = mac 0x1e6850; } -[[link(win)]] +[[link(win, android)]] class cocos2d::extension::CCScale9Sprite { CCScale9Sprite() = mac 0x211330; static cocos2d::extension::CCScale9Sprite* create(char const*) = mac 0x2130d0; @@ -1228,7 +1230,7 @@ class cocos2d::extension::CCScale9Sprite { virtual auto setSpriteFrame(cocos2d::CCSpriteFrame*) = mac 0x213a90; } -[[link(win)]] +[[link(win, android)]] class cocos2d::extension::CCScrollView { CCScrollView() = mac 0x214800; virtual ~CCScrollView() = mac 0x214c30; @@ -1247,7 +1249,7 @@ class cocos2d::extension::CCScrollView { virtual auto setTouchEnabled(bool) = mac 0x215250; } -[[link(win)]] +[[link(win, android)]] class cocos2d { static auto FNTConfigLoadFile(char const*) = mac 0x344f10; static auto ccGLUseProgram(GLuint) = mac 0x1ae540; @@ -1261,7 +1263,7 @@ class cocos2d { static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; } -[[link(win)]] +[[link(win, android)]] class DS_Dictionary { DS_Dictionary() = mac 0xbe9a0; ~DS_Dictionary() = mac 0x393c30; @@ -1274,7 +1276,7 @@ class DS_Dictionary { auto getObjectForKey(char const*) = mac 0xC4BB0; } -[[link(win)]] +[[link(win, android)]] class pugi::xml_document { xml_document() = mac 0x393a80; ~xml_document() = mac 0x393b50; diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ab336f38..cda687a4 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -18,18 +18,21 @@ class GDString { void testFunction(int a) = mac 0x100000; +[[link(android)]] class AchievementBar : cocos2d::CCNodeRGBA { static AchievementBar* create(const char* title, const char* desc, const char* icon, bool quest) = mac 0x379f80, win 0x3b120, ios 0x1a4784; PAD = win 0x24; } +[[link(android)]] class AchievementCell : cocos2d::CCLayer { void loadFromDict(cocos2d::CCDictionary*) = mac 0x10eaa0, win 0x59010; virtual bool init() = win 0x11070; } +[[link(android)]] class AchievementManager : cocos2d::CCNode { void getAllAchievements() = mac 0x434d60; static AchievementManager* sharedState() = mac 0x424420, win 0x7b10; @@ -40,6 +43,7 @@ class AchievementManager : cocos2d::CCNode { } +[[link(android)]] class AchievementNotifier : cocos2d::CCNode { void notifyAchievement(const char* title, const char* desc, const char* icon, bool quest) { m_queue->addObject(AchievementBar::create(title, desc, icon, quest)); @@ -57,16 +61,19 @@ class AchievementNotifier : cocos2d::CCNode { AchievementBar* m_currentAchievement; } +[[link(android)]] class AchievementsLayer : GJDropDownLayer { void customSetup() = mac 0x1bdea0, win 0x3c2f0; void loadPage(int) = mac 0x1be190, win 0x3c600; } +[[link(android)]] class AnimatedGameObject : GameObject, AnimatedSpriteDelegate, SpritePartDelegate { void playAnimation(int) = mac 0xc93d0, win 0x2539e0; void updateChildSpriteColor(cocos2d::_ccColor3B) = mac 0xc8450, win 0x2531f0; } +[[link(android)]] class AnimatedShopKeeper : CCAnimatedSprite { void animationFinished(const char*) {} @@ -78,10 +85,12 @@ class AnimatedShopKeeper : CCAnimatedSprite { bool m_unknown; } +[[link(android)]] class AnimatedSpriteDelegate { virtual void animationFinished(const char*) {} } +[[link(android)]] class AppDelegate : cocos2d::CCApplication, cocos2d::CCSceneDelegate { void bgScale() = mac 0x3aaab0; virtual bool applicationDidFinishLaunching() = mac 0x3aa900, win 0x3cbb0; @@ -109,6 +118,7 @@ class AppDelegate : cocos2d::CCApplication, cocos2d::CCSceneDelegate { bool m_unk4; } +[[link(android)]] class ArtistCell : TableViewCell { virtual void draw() = mac 0x11c980, win 0x59d40; // same as StatsCell virtual bool init() = mac 0x11c7c0, win 0x11250; @@ -119,6 +129,7 @@ class ArtistCell : TableViewCell { void* m_idk; } +[[link(android)]] class AudioEffectsLayer : cocos2d::CCLayerColor { void audioStep(float) = mac 0x271f40, win 0x3daa0; static AudioEffectsLayer* create(gd::string) = mac 0x271a00, win 0x3d850; @@ -136,6 +147,7 @@ class AudioEffectsLayer : cocos2d::CCLayerColor { bool m_unk1B4; } +[[link(android)]] class BoomListView : cocos2d::CCLayer, TableViewDelegate, TableViewDataSource { BoomListView() {} ~BoomListView() { @@ -170,6 +182,7 @@ class BoomListView : cocos2d::CCLayer, TableViewDelegate, TableViewDataSource { int m_currentPage; } +[[link(android)]] class BoomScrollLayer : cocos2d::CCLayer { BoomScrollLayer() = mac 0x1e42f0, win 0x11510; void instantMoveToPage(int page) = win 0x12330; @@ -182,6 +195,7 @@ class BoomScrollLayer : cocos2d::CCLayer { int m_page; } +[[link(android)]] class ButtonSprite : cocos2d::CCSprite { static ButtonSprite* create( const char* caption, @@ -265,6 +279,7 @@ class ButtonSprite : cocos2d::CCSprite { cocos2d::CCPoint m_spritePosition; } +[[link(android)]] class CCAnimatedSprite : cocos2d::CCSprite { void runAnimation(gd::string) = mac 0x1a6430, win 0x14f60; void tweenToAnimation(gd::string, float) = mac 0x1a65b0, win 0x15080; @@ -277,11 +292,13 @@ class CCAnimatedSprite : cocos2d::CCSprite { PAD = win 0x4; } +[[link(android)]] class CCAnimateFrameCache : cocos2d::CCObject { static CCAnimateFrameCache* sharedSpriteFrameCache() = mac 0x2e4df0, win 0x158f0; void addSpriteFramesWithFile(const char* file) = win 0x159b0; } +[[link(android)]] class CCBlockLayer : cocos2d::CCLayerColor { inline CCBlockLayer() {} virtual bool init() = mac 0x2a59c0, win 0x168d0; @@ -301,6 +318,7 @@ class CCBlockLayer : cocos2d::CCLayerColor { bool m_unknown2; } +[[link(android)]] class CCCircleWave : cocos2d::CCNode { static CCCircleWave* create(float, float, float, bool) = mac 0xbd270; static CCCircleWave* create(float, float, float, bool, bool) = mac 0xbd290, win 0x16c00; @@ -324,16 +342,19 @@ class CCCircleWave : cocos2d::CCNode { bool m_blendFuncDirty; } +[[link(android)]] class CCCircleWaveDelegate { virtual void circleWaveWillBeRemoved(CCCircleWave* wave) {} } +[[link(android)]] class CCContentLayer : cocos2d::CCLayerColor { inline CCContentLayer() {} static CCContentLayer* create(cocos2d::ccColor4B const& color, float width, float height) = win 0x172a0; virtual void setPosition(cocos2d::CCPoint const& pos) = mac 0x464c60, win 0x17400; } +[[link(android)]] class CCIndexPath : cocos2d::CCObject { static CCIndexPath* CCIndexPathWithSectionRow(int idk1, int idk2) = win 0x30e40; inline CCIndexPath() = default; @@ -341,11 +362,13 @@ class CCIndexPath : cocos2d::CCObject { int m_unknown2; } +[[link(android)]] class CCLightFlash { static CCLightFlash* create() = mac 0x295870, win 0x17920; void playEffect(cocos2d::CCPoint, cocos2d::_ccColor3B, float, float, float, float, float, float, float, float, float, float, float, float, float, float, int, bool, bool, float) = mac 0x295900, win 0x179f0; } +[[link(android)]] class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite { void useAnimationType(MenuAnimationType type) { m_startPosition = this->getNormalImage()->getPosition(); @@ -407,6 +430,7 @@ class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite { cocos2d::CCPoint m_startPosition; } +[[link(android)]] class CCMenuItemToggler : cocos2d::CCMenuItem { inline CCMenuItemToggler() : CCMenuItem(), m_onButton(nullptr), m_offButton(nullptr), m_toggled(false), m_notClickable(false) {} @@ -457,6 +481,7 @@ class CCMenuItemToggler : cocos2d::CCMenuItem { bool m_notClickable; } +[[link(android)]] class CCMoveCNode : cocos2d::CCNode { static CCMoveCNode* create() = mac 0x1842a0, win 0x121c70; ~CCMoveCNode() = mac 0x18b2c0; @@ -481,6 +506,7 @@ class CCMoveCNode : cocos2d::CCNode { GroupCommandObject* m_followCommand; } +[[link(android)]] class GroupCommandObject : cocos2d::CCNode { // too lazy to re rn // the ints are definitely real members but idk their types @@ -519,12 +545,14 @@ class GroupCommandObject : cocos2d::CCNode { bool m_184; } +[[link(android)]] class CCNodeContainer : cocos2d::CCNode { static CCNodeContainer* create() = mac 0xb1090, win 0x112370; virtual bool init() = mac 0xba950, win 0x33b40; void visit() = mac 0xba960, win 0x112420; } +[[link(android)]] class CCScrollLayerExt : cocos2d::CCLayer { inline CCScrollLayerExt() {} @@ -588,6 +616,7 @@ class CCScrollLayerExt : cocos2d::CCLayer { float m_peekLimitBottom; } +[[link(android)]] class CCScrollLayerExtDelegate { virtual void scrllViewWillBeginDecelerating(CCScrollLayerExt*) {} virtual void scrollViewDidEndDecelerating(CCScrollLayerExt*) {} @@ -597,10 +626,12 @@ class CCScrollLayerExtDelegate { virtual void scrollViewTouchEnd(CCScrollLayerExt*) {} } +[[link(android)]] class CCSpritePart : CCSpritePlus { } +[[link(android)]] class CCSpritePlus : cocos2d::CCSprite { virtual bool initWithSpriteFrameName(const char*) = mac 0x248670, win 0x1c1e0; virtual void setScaleX(float scale) = win 0x1c440; @@ -620,6 +651,7 @@ class CCSpritePlus : cocos2d::CCSprite { bool m_propagateFlipChanges; } +[[link(android)]] class CCTextInputNode : cocos2d::CCLayer, cocos2d::CCIMEDelegate, cocos2d::CCTextFieldDelegate { inline CCTextInputNode() : cocos2d::CCLayer(), cocos2d::CCIMEDelegate(), cocos2d::CCTextFieldDelegate(), m_caption(), m_allowedChars() { m_numberInput = false; @@ -735,10 +767,12 @@ class CCTextInputNode : cocos2d::CCLayer, cocos2d::CCIMEDelegate, cocos2d::CCTex bool m_forceOffset; } +[[link(android)]] class ChallengesPage { static ChallengesPage* create() = mac 0x1db350, win 0x3e050; } +[[link(android)]] class CheckpointObject : cocos2d::CCNode { static CheckpointObject* create() = mac 0x7e7d0, win 0x20DDD0; void getObject() = mac 0x7ef50; @@ -757,15 +791,18 @@ class CheckpointObject : cocos2d::CCNode { gd::string m_objectsStateString; } +[[link(android)]] class CollisionBlockPopup { static CollisionBlockPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x130010; void onNextItemID(cocos2d::CCObject*) = mac 0x130e60; } +[[link(android)]] class CollisionTriggerAction : cocos2d::CCNode { static CollisionTriggerAction* createFromString(gd::string) = mac 0x176ee0; } +[[link(android)]] class ColorAction : cocos2d::CCNode { static ColorAction* create() = mac 0x17c990, win 0x11ab10; static ColorAction* create(cocos2d::ccColor3B, cocos2d::ccColor3B, float, double, bool, int, float, float) = win 0x11ab60, mac 0x17cab0; @@ -793,12 +830,14 @@ class ColorAction : cocos2d::CCNode { PAD = mac 0x10; } +[[link(android)]] class ColorActionSprite : cocos2d::CCNode { float m_opacity; cocos2d::_ccColor3B m_f0124; cocos2d::_ccColor3B m_activeColor; } +[[link(android)]] class ColorChannelSprite : cocos2d::CCSprite { void updateBlending(bool) = mac 0x16e1d0, win 0x114710; void updateCopyLabel(int, bool) = mac 0x16ded0, win 0x114440; @@ -811,10 +850,12 @@ class ColorChannelSprite : cocos2d::CCSprite { cocos2d::CCLabelBMFont* m_blendingDot; } +[[link(android)]] class ColorSelectDelegate { virtual void colorSelectClosed(cocos2d::CCNode*) {} } +[[link(android)]] class ColorSelectLiveOverlay : FLAlertLayer { bool init(ColorAction*, ColorAction*, EffectGameObject*) = mac 0x2e2790, win 0x41db0; void sliderChanged(cocos2d::CCObject*) = mac 0x2e3830; @@ -828,6 +869,7 @@ class ColorSelectLiveOverlay : FLAlertLayer { bool m_detailMode; } +[[link(android)]] class ColorSelectPopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, TextInputDelegate, GJSpecialColorSelectDelegate { virtual void colorValueChanged(cocos2d::ccColor3B color) = mac 0x423320, win 0x46ee0; ColorSelectPopup() {} @@ -881,10 +923,12 @@ class ColorSelectPopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, bool m_copyColor; } +[[link(android)]] class ColorSetupDelegate { virtual void colorSetupClosed(int channel) {} } +[[link(android)]] class CommentCell : TableViewCell, LikeItemDelegate, FLAlertLayerProtocol { void loadFromComment(GJComment*) = mac 0x111c70, win 0x5f3d0; void onConfirmDelete(cocos2d::CCObject* sender) = mac 0x11d100, win 0x61140; @@ -898,12 +942,14 @@ class CommentCell : TableViewCell, LikeItemDelegate, FLAlertLayerProtocol { bool m_accountComment; } +[[link(android)]] class CommentUploadDelegate { virtual void commentUploadFinished(int) {} virtual void commentUploadFailed(int, CommentError) {} virtual void commentDeleteFailed(int, int) {} } +[[link(android)]] class ConfigureHSVWidget : cocos2d::CCNode { cocos2d::CCLabelBMFont* m_hueLabel; cocos2d::CCLabelBMFont* m_saturationLabel; @@ -914,6 +960,7 @@ class ConfigureHSVWidget : cocos2d::CCNode { cocos2d::ccHSVValue m_value; } +[[link(android)]] class CountTriggerAction : cocos2d::CCNode { static CountTriggerAction* createFromString(gd::string) = mac 0x1754f0; @@ -924,6 +971,7 @@ class CountTriggerAction : cocos2d::CCNode { bool m_multiActivate; } +[[link(android)]] class CreateGuidelinesLayer : FLAlertLayer, FLAlertLayerProtocol { void doClearGuidelines() = win 0x4cf60, mac 0x299690; void onStop(cocos2d::CCObject* sender) = win 0x4d2c0, mac 0x2990f0; @@ -933,6 +981,7 @@ class CreateGuidelinesLayer : FLAlertLayer, FLAlertLayerProtocol { gd::string m_guidelineString; } +[[link(android)]] class CreateMenuItem : CCMenuItemSpriteExtra { static CreateMenuItem* create(cocos2d::CCNode*, cocos2d::CCNode*, cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1c580, win 0x93db0; @@ -942,6 +991,7 @@ class CreateMenuItem : CCMenuItemSpriteExtra { int m_buildTab; } +[[link(android)]] class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, DialogDelegate { void onBack(cocos2d::CCObject*) = win 0x4fae0; void onChallenge(cocos2d::CCObject*) = mac 0x142960, win 0x4f1b0; @@ -962,6 +1012,7 @@ class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, Dialo static CreatorLayer* create() = win 0x4dda0; } +[[link(android)]] class CurrencyRewardLayer : cocos2d::CCLayer { inline CurrencyRewardLayer() {} ~CurrencyRewardLayer() = mac 0x447950, win 0x4ffb0; @@ -975,10 +1026,12 @@ class CurrencyRewardLayer : cocos2d::CCLayer { ) = win 0x50050; } +[[link(android)]] class CurrencyRewardDelegate { virtual void currencyWillExit(CurrencyRewardLayer*) {} } +[[link(android)]] class CustomListView : BoomListView { static CustomListView* create(cocos2d::CCArray*, float, float, int, BoomListType) = mac 0x10d410, win 0x57f90, ios 0x99154; inline static CustomListView* create(cocos2d::CCArray* entries, BoomListType type, float width, float height) { @@ -990,10 +1043,12 @@ class CustomListView : BoomListView { inline CustomListView() {} } +[[link(android)]] class CustomSongCell : TableViewCell { void loadFromObject(SongInfoObject*) = mac 0x110220, win 0x5e9f0; } +[[link(android)]] class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, GJDropDownLayerDelegate { bool init(LevelSettingsObject*) = mac 0xf06f0, win 0x65c10; void onArtists(cocos2d::CCObject*) = mac 0xf1950; @@ -1005,6 +1060,7 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G LevelSettingsLayer* m_levelSettingsLayer; } +[[link(android)]] class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerProtocol { bool init(SongInfoObject*, LevelSettingsObject*, bool, bool, bool, bool, bool hideBackground) = mac 0x37be20, win 0x685b0; void FLAlert_Clicked(FLAlertLayer*, bool) {} @@ -1018,6 +1074,7 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro PAD = win 0x30; } +[[link(android)]] class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate { void onNextColorChannel(cocos2d::CCObject* sender) = mac 0xe0270, win 0x56c80; void onSelectColor(cocos2d::CCObject* sender) = mac 0xdfdc0, win 0x577b0; @@ -1045,7 +1102,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele cocos2d::CCArray* m_colorButtons; cocos2d::CCArray* m_colorTabNodes; cocos2d::CCArray* m_textTabNodes; - PAD = win 0x4, mac 0x8; + PAD = win 0x4, mac 0x8, android 0x4; cocos2d::CCArray* m_detailTabNodes; int m_selectedMode; int m_customColorChannel; @@ -1072,6 +1129,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele bool m_customColorSelected; } +[[link(android)]] class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, LevelDownloadDelegate { static DailyLevelPage* create(bool weekly) = win 0x6a860; bool init(bool weekly) = mac 0x108C90, win 0x6a900; @@ -1082,6 +1140,7 @@ class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, bool m_weekly; } +[[link(android)]] class DialogLayer : cocos2d::CCLayerColor { static DialogLayer* create(DialogObject* dialog, int color) { return DialogLayer::createDialogLayer(dialog, nullptr, color); @@ -1108,10 +1167,12 @@ class DialogLayer : cocos2d::CCLayerColor { virtual void fadeInTextFinished(TextArea*) = mac 0x205930, win 0x6e070; } +[[link(android)]] class DialogDelegate { virtual void dialogClosed(DialogLayer*) {} } +[[link(android)]] class DialogObject : cocos2d::CCObject { DialogObject() {} @@ -1126,8 +1187,10 @@ class DialogObject : cocos2d::CCObject { bool m_canSkip; } +[[link(android)]] class DownloadMessageDelegate {} +[[link(android)]] class DrawGridLayer : cocos2d::CCLayer { static DrawGridLayer* get() { auto editorLayer = LevelEditorLayer::get(); @@ -1175,6 +1238,7 @@ class DrawGridLayer : cocos2d::CCLayer { float m_gridSize; } +[[link(android)]] class EditButtonBar : cocos2d::CCNode { void removeAllItems() { m_buttonArray->removeAllObjects(); @@ -1214,6 +1278,7 @@ class EditButtonBar : cocos2d::CCNode { cocos2d::CCArray* m_pagesArray; } +[[link(android)]] class EditLevelLayer : cocos2d::CCLayer, FLAlertLayerProtocol, TextInputDelegate, UploadActionDelegate, UploadPopupDelegate, SetIDPopupDelegate { static cocos2d::CCScene* scene(GJGameLevel* level) { auto scene = cocos2d::CCScene::create(); @@ -1237,10 +1302,12 @@ class EditLevelLayer : cocos2d::CCLayer, FLAlertLayerProtocol, TextInputDelegate cocos2d::CCLabelBMFont* m_someFont; } +[[link(android)]] class EditorOptionsLayer { void onButtonsPerRow(cocos2d::CCObject*) = mac 0x147b30; } +[[link(android)]] class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol { static EditorPauseLayer* get() { if (!EditorUI::get()) return nullptr; @@ -1289,6 +1356,7 @@ class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol { LevelEditorLayer* m_editorLayer; } +[[link(android)]] class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJRotationControlDelegate, GJScaleControlDelegate, MusicDownloadDelegate { static EditorUI* get() { auto lel = LevelEditorLayer::get(); @@ -1526,6 +1594,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ bool m_spaceKeyPressed; } +[[link(android)]] class EffectGameObject : GameObject { void updateLabel() { auto label = static_cast(this->getChildByTag(999)); @@ -1628,6 +1697,7 @@ class EffectGameObject : GameObject { PAD = mac 0x28, win 0x24; } +[[link(android)]] class EndLevelLayer { static EndLevelLayer* create() = mac 0x2787d0, win 0x94b50; @@ -1635,13 +1705,16 @@ class EndLevelLayer { void onEdit(cocos2d::CCObject* sender) = mac 0x27a640, win 0x96d30; } +[[link(android)]] class EndPortalObject : GameObject { static EndPortalObject* create() = mac 0x1da8f0, win 0x98a50; void updateColors(cocos2d::_ccColor3B) = mac 0x1dacb0, win 0x98eb0; } +[[link(android)]] class ExtendedLayer {} +[[link(android)]] class FLAlertLayer : cocos2d::CCLayerColor { inline virtual ~FLAlertLayer() { cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->decrementForcePrio(2); @@ -1710,10 +1783,12 @@ class FLAlertLayer : cocos2d::CCLayerColor { bool m_noAction; } +[[link(android)]] class FLAlertLayerProtocol { virtual void FLAlert_Clicked(FLAlertLayer*, bool) {} } +[[link(android)]] class FMODAudioEngine : cocos2d::CCNode { static FMODAudioEngine* sharedEngine() = mac 0x20ef80, win 0x239f0; void preloadEffect(gd::string filename) = win 0x24240; @@ -1746,19 +1821,23 @@ class FMODAudioEngine : cocos2d::CCNode { int m_musicOffset; } +[[link(android)]] class FMODSound : cocos2d::CCNode { static FMODSound* create(FMOD::Sound* sound) = win 0x246b0; FMOD::Sound* m_sound; } +[[link(android)]] class FriendRequestDelegate {} +[[link(android)]] class FriendsProfilePage : FLAlertLayer, FLAlertLayerProtocol, UploadActionDelegate, UploadPopupDelegate, UserListDelegate { static FriendsProfilePage* create(UserListType) = win 0x9ce80; bool init(UserListType) = win 0x9cf30; } +[[link(android)]] class GJAccountBackupDelegate { virtual bool backupAccountFailed(BackupAccountError) { return false; @@ -1768,12 +1847,14 @@ class GJAccountBackupDelegate { } } +[[link(android)]] class GJAccountDelegate { virtual bool accountStatusChanged() { return false; } } +[[link(android)]] class GJAccountLoginDelegate { virtual bool loginAccountFailed(AccountError) { return false; @@ -1783,6 +1864,7 @@ class GJAccountLoginDelegate { } } +[[link(android)]] class GJAccountManager : cocos2d::CCNode { static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50; @@ -1792,6 +1874,7 @@ class GJAccountManager : cocos2d::CCNode { int m_accountID; } +[[link(android)]] class GJAccountSyncDelegate { virtual bool syncAccountFailed(BackupAccountError) { return false; @@ -1801,6 +1884,7 @@ class GJAccountSyncDelegate { } } +[[link(android)]] class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate { cocos2d::CCLayer* getObjectLayer() { return m_objectLayer; @@ -1990,8 +2074,10 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate { PAD = mac 0x8, win 0x8; } +[[link(android)]] class GJChallengeDelegate {} +[[link(android)]] class GJChallengeItem : cocos2d::CCObject { GJChallengeType m_challengeType; @@ -2004,8 +2090,10 @@ class GJChallengeItem : cocos2d::CCObject { gd::string m_name; } +[[link(android)]] class GJColorSetupLayer {} +[[link(android)]] class GJComment : cocos2d::CCNode { ~GJComment() = mac 0x2dfd70, win 0xc3640; virtual bool init() = mac 0x2dfec0, win 0xc3ef0; @@ -2028,6 +2116,7 @@ class GJComment : cocos2d::CCNode { GJUserScore* m_userScore; } +[[link(android)]] class GJCommentListLayer : cocos2d::CCLayerColor { ~GJCommentListLayer() = mac 0x1482a0; static GJCommentListLayer* create(BoomListView*, char const*, cocos2d::_ccColor4B, float, float, bool) = mac 0x147d00, win 0x13a880; @@ -2035,11 +2124,13 @@ class GJCommentListLayer : cocos2d::CCLayerColor { BoomListView* m_list; } +[[link(android)]] class GJDailyLevelDelegate { virtual void dailyStatusFinished(bool) {} virtual void dailyStatusFailed(bool) {} } +[[link(android)]] class GJDropDownLayer : cocos2d::CCLayerColor { virtual void customSetup() {} virtual void enterLayer() = mac 0x3525c0, win 0x16970; @@ -2094,10 +2185,12 @@ class GJDropDownLayer : cocos2d::CCLayerColor { GJDropDownLayerDelegate* m_delegate; } +[[link(android)]] class GJDropDownLayerDelegate { virtual void dropDownLayerWillClose(GJDropDownLayer*) {} } +[[link(android)]] class GJEffectManager : cocos2d::CCNode { static GJEffectManager* get() { return GJEffectManager::fromGameLayer(); @@ -2263,6 +2356,7 @@ class GJEffectManager : cocos2d::CCNode { bool m_moveOptimizationEnabled; } +[[link(android)]] class GJGameLevel : cocos2d::CCNode { static GJGameLevel* createWithCoder(DS_Dictionary* dict) { auto ret = GJGameLevel::create(); @@ -2388,6 +2482,7 @@ class GJGameLevel : cocos2d::CCNode { gd::string m_personalBests; } +[[link(android)]] class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, GameRateDelegate, ListButtonBarDelegate, DialogDelegate { inline GJGarageLayer() { m_nameInput = nullptr; @@ -2448,10 +2543,12 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, bool m_updateSelector; } +[[link(android)]] class GJGroundLayer : cocos2d::CCLayer { void updateGroundWidth() = mac 0x356790, win 0x12dda0; } +[[link(android)]] class GJItemIcon : cocos2d::CCSprite { bool init( UnlockType, int, cocos2d::ccColor3B, cocos2d::ccColor3B, @@ -2469,10 +2566,12 @@ class GJItemIcon : cocos2d::CCSprite { static GJItemIcon* create(UnlockType _type, int _id, cocos2d::ccColor3B _col1, cocos2d::ccColor3B _col2, bool _un0, bool _un1, bool _un2, cocos2d::ccColor3B _col3) = mac 0x1bb330, win 0x12cbf0, ios 0x227188; } +[[link(android)]] class GJLevelScoreCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; } +[[link(android)]] class GJListLayer : cocos2d::CCLayerColor { ~GJListLayer() = mac 0x344350; static GJListLayer* create(BoomListView* target, const char* title, cocos2d::ccColor4B color, float width, float height) = mac 0x343e10, win 0x12e000; @@ -2480,6 +2579,7 @@ class GJListLayer : cocos2d::CCLayerColor { BoomListView* m_listView; } +[[link(android)]] class GJMapPack : cocos2d::CCNode { cocos2d::CCArray* m_levels; int m_packID; @@ -2497,22 +2597,27 @@ class GJMapPack : cocos2d::CCNode { static GJMapPack *create() = win 0xbffe0; } +[[link(android)]] class GJMessageCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; void loadFromMessage(GJUserMessage *) = win 0x64b60; } +[[link(android)]] class GJOptionsLayer : FLAlertLayer { static GJOptionsLayer* create() = mac 0x145ae0, win 0x0, ios 0x0; void addToggle(char const*, char const*, char const*) = mac 0x1464e0, win 0x0, ios 0x0; } +[[link(android)]] class GJRequestCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; } +[[link(android)]] class GJRewardDelegate {} +[[link(android)]] class GJRewardItem : cocos2d::CCObject { int m_chestID; int m_timeRemaining; @@ -2521,6 +2626,7 @@ class GJRewardItem : cocos2d::CCObject { bool m_unk; } +[[link(android)]] class GJRewardObject : cocos2d::CCObject { SpecialRewardItem m_specialRewardItem; UnlockType m_unlockType; @@ -2528,6 +2634,7 @@ class GJRewardObject : cocos2d::CCObject { int m_total; } +[[link(android)]] class GJRobotSprite : CCAnimatedSprite { // virtual ~GJRobotSprite() = mac 0x34aaf0; inlined on windows, RE and recreate virtual bool init() = mac 0x34ad50, win 0x145840; @@ -2550,6 +2657,7 @@ class GJRobotSprite : CCAnimatedSprite { CCSpritePart* m_headSpritePart; } +[[link(android)]] class GJRotationControl : cocos2d::CCLayer { void setAngle(float angle) { m_sliderPosition = cocos2d::CCPointMake(sinf(angle) * 60.0f, cosf(angle) * 60.0f); @@ -2569,12 +2677,14 @@ class GJRotationControl : cocos2d::CCLayer { int m_touchID; } +[[link(android)]] class GJRotationControlDelegate { virtual void angleChangeBegin() {} virtual void angleChangeEnded() {} virtual void angleChanged(float) {} } +[[link(android)]] class GJScaleControl : cocos2d::CCLayer { virtual bool init() = mac 0x31b30, win 0x94490; virtual bool ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x31d30, win 0x947a0; @@ -2592,12 +2702,14 @@ class GJScaleControl : cocos2d::CCLayer { GJScaleControlDelegate* m_delegate; } +[[link(android)]] class GJScaleControlDelegate { virtual void scaleChangeBegin() {} virtual void scaleChangeEnded() {} virtual void scaleChanged(float) {} } +[[link(android)]] class GJScoreCell : TableViewCell, FLAlertLayerProtocol { virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x11D8E0, win 0x624a0; void loadFromScore(GJUserScore* score) = mac 0x113AA0, win 0x61440; @@ -2608,6 +2720,7 @@ class GJScoreCell : TableViewCell, FLAlertLayerProtocol { GJUserScore* m_score; } +[[link(android)]] class GJSearchObject : cocos2d::CCNode { SearchType getType() { return m_searchType; @@ -2641,20 +2754,24 @@ class GJSearchObject : cocos2d::CCNode { bool m_songFilter; } +[[link(android)]] class GJSpecialColorSelect { static const char* textForColorIdx(int id) = mac 0x383a50, win 0x14e1d0, ios 0x113f6c; } +[[link(android)]] class GJSpecialColorSelectDelegate { virtual void colorSelectClosed(GJSpecialColorSelect*, int) {} } +[[link(android)]] class GJSpiderSprite : GJRobotSprite { // ~GJSpiderSprite() = mac 0x34c4a0; same as ~CCRobotSprite, fully merged on windows virtual bool init() = mac 0x34c700, win 0x146db0; static GJSpiderSprite* create() = mac 0x34c5b0, win 0x146cf0; } +[[link(android)]] class GJSpriteColor : cocos2d::CCNode { int m_colorID; int m_defaultColorID; @@ -2667,14 +2784,17 @@ class GJSpriteColor : cocos2d::CCNode { void resetCustomColorMode() = mac 0x342f10; } +[[link(android)]] class GJUserCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; } +[[link(android)]] class GJUserMessage : cocos2d::CCNode { virtual bool init() = win 0x33b40; } +[[link(android)]] class GJUserScore : cocos2d::CCNode { IconType getIconType() const { return m_iconType; @@ -2774,6 +2894,7 @@ class GJUserScore : cocos2d::CCNode { gd::string m_lastScoreAge; } +[[link(android)]] class GManager : cocos2d::CCNode { virtual void setup() = mac 0x26EE20, win 0x28F60; virtual void encodeDataTo(DS_Dictionary* data) {} @@ -2794,16 +2915,19 @@ class GManager : cocos2d::CCNode { bool m_quickSave; } +[[link(android)]] class GooglePlayDelegate { virtual void googlePlaySignedIn() {} } +[[link(android)]] class GooglePlayManager : cocos2d::CCNode { virtual bool init() = win 0x11070; static GooglePlayManager* sharedState() = win 0x295a0; } +[[link(android)]] class GameLevelManager : cocos2d::CCNode { cocos2d::CCArray* createAndGetScores(gd::string, GJScoreType) = win 0xa2780; GJGameLevel* createNewLevel() = mac 0x2b8180, win 0xa0db0; @@ -2924,6 +3048,7 @@ class GameLevelManager : cocos2d::CCNode { cocos2d::CCString* m_unkStr4; } +[[link(android)]] class GameManager : GManager { int getPlayerFrame() { return m_playerFrame; @@ -3156,6 +3281,7 @@ class GameManager : GManager { cocos2d::TextureQuality m_quality; } +[[link(android)]] class GameObject : CCSpritePlus { cocos2d::CCPoint getStartPosition() { return m_startPosition; @@ -3508,6 +3634,7 @@ class GameObject : CCSpritePlus { bool m_orbMultiActivate; } +[[link(android)]] class GameObjectCopy : cocos2d::CCObject { virtual ~GameObjectCopy() = mac 0xa3290; static GameObjectCopy* create(GameObject*) = mac 0x975a0, win 0x16c020; @@ -3515,8 +3642,10 @@ class GameObjectCopy : cocos2d::CCObject { GameObject* m_object; } +[[link(android)]] class GameRateDelegate {} +[[link(android)]] class GameSoundManager : cocos2d::CCNode { void disableMetering() = mac 0x362d80, win 0x257D0; void enableMetering() = mac 0x362d00, win 0x256F0; @@ -3539,6 +3668,7 @@ class GameSoundManager : cocos2d::CCNode { gd::string m_filePath; } +[[link(android)]] class GameStatsManager : cocos2d::CCNode { void awardCurrencyForLevel(GJGameLevel*) = mac 0x43600; void awardDiamondsForLevel(GJGameLevel*) = mac 0x43c60; @@ -3589,6 +3719,7 @@ class GameStatsManager : cocos2d::CCNode { cocos2d::CCDictionary* m_miscChests; } +[[link(android)]] class GameToolbox { static gd::string stringFromHSV(cocos2d::ccHSVValue hsv, const char* separator) = mac 0x28cf90; static cocos2d::ccHSVValue hsvFromString(gd::string str, char const* separator) = mac 0x28cc30, win 0x26da0; @@ -3601,6 +3732,7 @@ class GameToolbox { static cocos2d::ccColor3B multipliedColorValue(cocos2d::ccColor3B color1, cocos2d::ccColor3B color2, float factor) = win 0x26CE0; } +[[link(android)]] class GaragePage : cocos2d::CCLayer, ListButtonBarDelegate { static GaragePage* create(IconType type, GJGarageLayer* pGarage, cocos2d::SEL_MenuHandler pSelectCallback) { auto pRet = new GaragePage(); @@ -3627,12 +3759,15 @@ class GaragePage : cocos2d::CCLayer, ListButtonBarDelegate { PAD = win 0x4; } +[[link(android)]] class GauntletSelectLayer { static GauntletSelectLayer* create(int) = win 0x105120; } +[[link(android)]] class GhostTrailEffect {} +[[link(android)]] class HSVWidgetPopup : FLAlertLayer { bool init(cocos2d::_ccHSVValue value, HSVWidgetPopupDelegate* delegate, gd::string title); void onClose(cocos2d::CCObject* sender) = win 0x4a280; @@ -3641,10 +3776,12 @@ class HSVWidgetPopup : FLAlertLayer { HSVWidgetPopupDelegate* m_delegate; } +[[link(android)]] class HSVWidgetPopupDelegate { virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) {} } +[[link(android)]] class HardStreak : cocos2d::CCDrawNode { // ~HardStreak() = mac 0x5bf00; inlined on windows virtual bool init() = mac 0x5c090, win 0x14e430; @@ -3666,6 +3803,7 @@ class HardStreak : cocos2d::CCDrawNode { bool m_isSolid; } +[[link(android)]] class InfoAlertButton : CCMenuItemSpriteExtra { bool init(gd::string title, gd::string text, float scale) = win 0x14ef50; void activate() = win 0x14f050; @@ -3673,6 +3811,7 @@ class InfoAlertButton : CCMenuItemSpriteExtra { static InfoAlertButton* create(gd::string title, gd::string text, float scale) = win 0x14ed20, mac 0x2ecad0; } +[[link(android)]] class InfoLayer : FLAlertLayer, LevelCommentDelegate, CommentUploadDelegate, FLAlertLayerProtocol { bool init(GJGameLevel* level, GJUserScore* score) = mac 0x456850, win 0x14f5a0; void setupCommentsBrowser(cocos2d::CCArray* comments) = mac 0x458590, win 0x152270; @@ -3703,8 +3842,10 @@ class InfoLayer : FLAlertLayer, LevelCommentDelegate, CommentUploadDelegate, FLA bool m_commentHistory; } +[[link(android)]] class InheritanceNode : cocos2d::CCObject {} +[[link(android)]] class KeybindingsLayer : FLAlertLayer { void onClose(cocos2d::CCObject* sender) = win 0x49c60; void onPrevPage(cocos2d::CCObject* sender) = win 0x153cd0; @@ -3720,11 +3861,13 @@ class KeybindingsLayer : FLAlertLayer { cocos2d::CCNode* m_rightArrow; } +[[link(android)]] class LabelGameObject : GameObject { virtual bool init() = mac 0x2f5520, win 0x25b7c0; void setObjectColor(cocos2d::_ccColor3B const&) = mac 0xdbca0; } +[[link(android)]] class LeaderboardManagerDelegate { virtual void updateUserScoreFinished() {} virtual void updateUserScoreFailed() {} @@ -3732,11 +3875,13 @@ class LeaderboardManagerDelegate { virtual void loadLeaderboardFailed(const char*) {} } +[[link(android)]] class LeaderboardsLayer : cocos2d::CCLayer { static LeaderboardsLayer* create(LeaderboardState state) = mac 0x29F590, win 0x158710; bool init(LeaderboardState state) = mac 0x29f6d0, win 0x1587b0; } +[[link(android)]] class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerProtocol, SetIDPopupDelegate, SetTextPopupDelegate { static cocos2d::CCScene* scene(GJSearchObject* search) { auto scene = cocos2d::CCScene::create(); @@ -3775,6 +3920,7 @@ class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerPr int m_pageEndIdx; } +[[link(android)]] class LevelCell : TableViewCell { CCMenuItemSpriteExtra* m_button; GJGameLevel* m_level; @@ -3787,6 +3933,7 @@ class LevelCell : TableViewCell { inline LevelCell(char const* identifier, float parentHeight, float height) : TableViewCell(identifier, parentHeight, height) {} } +[[link(android)]] class LevelCommentDelegate { virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) {} virtual void loadCommentsFailed(char const*) {} @@ -3794,16 +3941,19 @@ class LevelCommentDelegate { virtual void setupPageInfo(gd::string, char const*) {} } +[[link(android)]] class LevelDeleteDelegate { virtual void levelDeleteFinished(int) {} virtual void levelDeleteFailed(int) {} } +[[link(android)]] class LevelDownloadDelegate { virtual void levelDownloadFinished(GJGameLevel*) {} virtual void levelDownloadFailed(int) {} } +[[link(android)]] class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { static LevelEditorLayer* get() { return GameManager::sharedState()->m_levelEditorLayer; @@ -4009,6 +4159,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { bool m_removingObjects; } +[[link(android)]] class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDelegate, RateLevelDelegate, LikeItemDelegate, FLAlertLayerProtocol, LevelDeleteDelegate, NumberInputDelegate, SetIDPopupDelegate { static LevelInfoLayer* create(GJGameLevel* level) = mac 0x15f290, win 0x175d50; bool init(GJGameLevel* level) = win 0x175df0, mac 0x15f520; @@ -4042,6 +4193,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg PAD = win 0x4, mac 0x8; } +[[link(android)]] class LevelLeaderboard : FLAlertLayer, LeaderboardManagerDelegate { void onChangeType(cocos2d::CCObject* sender) = mac 0x20e310, win 0x17d090; void onUpdate(cocos2d::CCObject* sender) = mac 0x20e240, win 0x17d1b0; @@ -4053,12 +4205,14 @@ class LevelLeaderboard : FLAlertLayer, LeaderboardManagerDelegate { LevelLeaderboardType m_type; } +[[link(android)]] class LevelManagerDelegate { virtual void loadLevelsFinished(cocos2d::CCArray *,char const*) {} virtual void loadLevelsFailed(char const*) {} virtual void setupPageInfo(gd::string,char const*) {} } +[[link(android)]] class LevelPage : cocos2d::CCLayer, DialogDelegate { PAD = mac 0x8, win 0x4; GJGameLevel* m_level; @@ -4066,6 +4220,7 @@ class LevelPage : cocos2d::CCLayer, DialogDelegate { void onInfo(cocos2d::CCObject* sender) = mac 0x23AAE0, win 0x189070; } +[[link(android)]] class LevelSearchLayer : cocos2d::CCLayer { static LevelSearchLayer* create() = win 0x17d9c0; virtual bool init() = mac 0x384770, win 0x17da60; @@ -4078,6 +4233,7 @@ class LevelSearchLayer : cocos2d::CCLayer { } +[[link(android)]] class LevelSelectLayer : cocos2d::CCLayer { static LevelSelectLayer* create(int lvl) = win 0x185500; @@ -4085,10 +4241,12 @@ class LevelSelectLayer : cocos2d::CCLayer { BoomScrollLayer* m_scrollLayer; } +[[link(android)]] class LevelSettingsDelegate { virtual void levelSettingsUpdated() {} } +[[link(android)]] class SecretLayer4 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer4* create() = mac 0x1ed500; static cocos2d::CCScene* scene() = mac 0x1ed4c0; @@ -4097,14 +4255,17 @@ class SecretLayer4 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, void showDialog(int message) = mac 0x1effd0; } +[[link(android)]] class SelectArtDelegate { virtual void selectArtClosed(SelectArtLayer*) {} } +[[link(android)]] class CustomSongLayerDelegate { virtual void customSongLayerClosed() {} } +[[link(android)]] class LevelSettingsLayer : FLAlertLayer, ColorSelectDelegate, SelectArtDelegate, FLAlertLayerProtocol, CustomSongLayerDelegate { static LevelSettingsLayer* create(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) = win 0x170d90; bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) = mac 0xa7e00, win 0x170e50; @@ -4135,6 +4296,7 @@ class LevelSettingsLayer : FLAlertLayer, ColorSelectDelegate, SelectArtDelegate, CustomSongWidget* m_customSongWidget; } +[[link(android)]] class LevelSettingsObject : cocos2d::CCNode { virtual ~LevelSettingsObject() = mac 0xa5650, win 0x16e800; virtual bool init() = mac 0xa5690, win 0x16e940; @@ -4173,17 +4335,21 @@ class LevelSettingsObject : cocos2d::CCNode { int m_groundLineIndex; } +[[link(android)]] class LevelUploadDelegate {} +[[link(android)]] class LevelUpdateDelegate { virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) {} virtual void levelUpdateFailed(int) {} } +[[link(android)]] class LikeItemDelegate { virtual void likedItem(LikeItemType, int, bool) {} } +[[link(android)]] class LikeItemLayer : FLAlertLayer { LikeItemType m_itemType; int m_itemID; @@ -4194,12 +4360,15 @@ class LikeItemLayer : FLAlertLayer { bool init(LikeItemType type, int itemID, int commentSourceID) = mac 0x35f900; } +[[link(android)]] class ListButtonBar : cocos2d::CCNode { BoomScrollLayer* m_scrollLayer; } +[[link(android)]] class ListButtonBarDelegate {} +[[link(android)]] class LoadingCircle : cocos2d::CCLayerColor { void setParentLayer(cocos2d::CCLayer* layer) { m_parentLayer = layer; @@ -4217,6 +4386,7 @@ class LoadingCircle : cocos2d::CCLayerColor { bool m_fade; } +[[link(android)]] class LoadingLayer : cocos2d::CCLayer { void setFromRefresh(bool value) { m_fromRefresh = value; @@ -4247,6 +4417,7 @@ class LoadingLayer : cocos2d::CCLayer { bool m_fromRefresh; } +[[link(android)]] class LocalLevelManager : GManager { static LocalLevelManager* sharedState() = mac 0x35dd60, win 0x18d260; inline static LocalLevelManager* get() { @@ -4264,11 +4435,13 @@ class LocalLevelManager : GManager { cocos2d::CCArray* m_localLevels; } +[[link(android)]] class MapPackCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; void loadFromMapPack(GJMapPack *) = win 0x5cac0; } +[[link(android)]] class MenuGameLayer : cocos2d::CCLayer { void resetPlayer() = mac 0x28fdc0, win 0x18f4b0; void destroyPlayer() = win 0x190100; @@ -4277,6 +4450,7 @@ class MenuGameLayer : cocos2d::CCLayer { void updateColors() = win 0x18edd0; } +[[link(android)]] class MenuLayer : cocos2d::CCLayer, FLAlertLayerProtocol, GooglePlayDelegate { inline MenuLayer() {} virtual ~MenuLayer() = mac 0x1d1230, win 0x190620; @@ -4308,14 +4482,17 @@ class MenuLayer : cocos2d::CCLayer, FLAlertLayerProtocol, GooglePlayDelegate { CCMenuItemSpriteExtra* m_profileBtn; } +[[link(android)]] class MessageListDelegate {} +[[link(android)]] class MoreSearchLayer : FLAlertLayer { static MoreSearchLayer* create() = mac 0x38ab40, win 0x182520; virtual bool init() = mac 0x3896b0, win 0x1825c0; void onClose(cocos2d::CCObject*) = mac 0x38aa40, win 0x1848f0; } +[[link(android)]] class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate { static MoreOptionsLayer* create() = win 0x1de850; virtual bool init() = mac 0x43f470, win 0x1DE8F0; @@ -4324,14 +4501,17 @@ class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate { void onToggle(cocos2d::CCObject* sender) = mac 0x441370; } +[[link(android)]] class MoreVideoOptionsLayer : FLAlertLayer { static MoreVideoOptionsLayer* create() = mac 0x443c10, win 0x1e24f0; virtual bool init() = mac 0x444150, win 0x1e2590; void onClose(cocos2d::CCObject*) = mac 0x444aa0; } +[[link(android)]] class MultilineBitmapFont : cocos2d::CCSprite {} +[[link(android)]] class MusicDownloadDelegate { virtual void downloadSongFailed(int, GJSongError) {} virtual void downloadSongFinished(SongInfoObject*) {} @@ -4340,6 +4520,7 @@ class MusicDownloadDelegate { virtual void songStateChanged() {} } +[[link(android)]] class MusicDownloadManager : cocos2d::CCNode, PlatformDownloadDelegate { void incrementPriorityForSong(int) = mac 0x2ef750; static MusicDownloadManager* sharedState() = mac 0x2ee4c0, win 0x1945b0; @@ -4354,12 +4535,15 @@ class MusicDownloadManager : cocos2d::CCNode, PlatformDownloadDelegate { int m_priority; } +[[link(android)]] class NumberInputDelegate { virtual void numberInputClosed(NumberInputLayer*) {} } +[[link(android)]] class NumberInputLayer {} +[[link(android)]] class OBB2D : cocos2d::CCNode { void calculateWithCenter(cocos2d::CCPoint, float, float, float) = mac 0x35a9c0, win 0x2bc10; static OBB2D* create(cocos2d::CCPoint, float, float, float) = mac 0x35a890, win 0x2ba80; @@ -4384,15 +4568,18 @@ class OBB2D : cocos2d::CCNode { cocos2d::CCPoint m_center; } +[[link(android)]] class ObjectManager : cocos2d::CCNode { static ObjectManager* instance() = win 0x2c2c0; void setup() = win 0x2c3b0; } +[[link(android)]] class KeysLayer : cocos2d::CCLayer { virtual bool init() = win 0x154560; } +[[link(android)]] class ObjectToolbox : cocos2d::CCNode { cocos2d::CCArray* allKeys() { return m_frameToKeyDict->allKeys(); @@ -4420,6 +4607,7 @@ class ObjectToolbox : cocos2d::CCNode { cocos2d::CCDictionary* m_keyToFrameDict; } +[[link(android)]] class OpacityEffectAction : cocos2d::CCNode { static OpacityEffectAction* create(float, float, float, int) = mac 0x1789f0; static OpacityEffectAction* createFromString(gd::string) = mac 0x178c10; @@ -4437,12 +4625,14 @@ class OpacityEffectAction : cocos2d::CCNode { float m_delta; } +[[link(android)]] class OnlineListDelegate { virtual void loadListFinished(cocos2d::CCArray*, const char*) {} virtual void loadListFailed(const char*) {} virtual void setupPageInfo(gd::string, const char*) {} } +[[link(android)]] class OptionsLayer : GJDropDownLayer, FLAlertLayerProtocol { static OptionsLayer* addToCurrentScene(bool noTransition) { auto layer = OptionsLayer::create(); @@ -4459,6 +4649,7 @@ class OptionsLayer : GJDropDownLayer, FLAlertLayerProtocol { cocos2d::CCMenu* m_optionsMenu; } +[[link(android)]] class PauseLayer : CCBlockLayer { static PauseLayer* create(bool) = mac 0x20b1e0, win 0x1e4570; void onEdit(cocos2d::CCObject*) = mac 0x20c630, win 0x1e60e0; @@ -4478,11 +4669,13 @@ class PauseLayer : CCBlockLayer { bool m_unknown2; } +[[link(android)]] class PlatformDownloadDelegate { virtual void downloadFinished(char const*) {} virtual void downloadFailed(char const*) {} } +[[link(android)]] class PlatformToolbox { static void hideCursor() = mac 0x27c340; static void showCursor() = mac 0x27c360; @@ -4500,6 +4693,7 @@ class PlatformToolbox { static void resizeWindow() = mac 0x27cfe0; } +[[link(android)]] class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, DialogDelegate { static PlayLayer* get() { return GameManager::sharedState()->getPlayLayer(); @@ -4828,6 +5022,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool m_disableGravityEffect; } +[[link(android)]] class PlayerCheckpoint : cocos2d::CCNode { // virtual ~PlayerCheckpoint() = mac 0x80760; inlined on windows static PlayerCheckpoint* create() = mac 0x7e8c0, win 0x20dc40; @@ -4848,6 +5043,7 @@ class PlayerCheckpoint : cocos2d::CCNode { bool m_hidden; } +[[link(android)]] class PlayerObject : GameObject, AnimatedSpriteDelegate { virtual ~PlayerObject() = mac 0x217220, win 0x1e6be0; virtual void update(float) = mac 0x218bf0, win 0x1e8200; @@ -5132,12 +5328,14 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { PAD = win 0x1c; } +[[link(android)]] class PointNode : cocos2d::CCObject { static PointNode* create(cocos2d::CCPoint point) = win 0x14ec80; cocos2d::CCPoint m_point; } +[[link(android)]] class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate { static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50; virtual void getUserInfoFailed(int) = mac 0x463FB0, win 0x2133e0; @@ -5155,15 +5353,18 @@ class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, Co cocos2d::CCArray* m_buttons; } +[[link(android)]] class PulseEffectAction : cocos2d::CCNode { static PulseEffectAction* createFromString(gd::string) = mac 0x179e90, win 0x1198a0; gd::string getSaveString() = mac 0x17a850, win 0x119e70; } +[[link(android)]] class RateLevelDelegate { virtual void rateLevelClosed() {} } +[[link(android)]] class RateStarsLayer : FLAlertLayer, UploadPopupDelegate, UploadActionDelegate { bool m_uploadFinished; bool m_isModSuggest; @@ -5182,14 +5383,17 @@ class RateStarsLayer : FLAlertLayer, UploadPopupDelegate, UploadActionDelegate { bool init(int levelID, bool isModSuggest) = mac 0x136050; } +[[link(android)]] class RetryLevelLayer { static RetryLevelLayer* create() = mac 0x28dd60, win 0x216390; } +[[link(android)]] class RewardsPage : FLAlertLayer { bool init() = mac 0xf3800, win 0x2178F0; } +[[link(android)]] class RingObject : EffectGameObject { bool create(char const*) = win 0x252220; bool init(char const*) = win 0x2522E0; @@ -5205,14 +5409,17 @@ class RingObject : EffectGameObject { virtual void triggerActivated(float) = win 0x252350; } +[[link(android)]] class ScrollingLayer : cocos2d::CCLayerColor { static ScrollingLayer* create(cocos2d::CCSize, cocos2d::CCPoint, float) = mac 0x41a900, win 0x2d8e0; } +[[link(android)]] class SelectArtLayer { static SelectArtLayer* create(SelectArtType type) = win 0x174b00; } +[[link(android)]] class SelectFontLayer : FLAlertLayer { static SelectFontLayer* create(LevelEditorLayer* lel) = win 0x137270; bool init(LevelEditorLayer* lel) = win 0x137310; @@ -5229,6 +5436,7 @@ class SelectFontLayer : FLAlertLayer { cocos2d::CCLabelBMFont* m_fontLabel; } +[[link(android)]] class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { bool init(GameObject* object, cocos2d::CCArray* objects) = mac 0x1947c0, win 0x22b670; void onNextGroupID1(cocos2d::CCObject*) = mac 0x1967a0, win 0x22d790; @@ -5265,10 +5473,12 @@ class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { int m_unknown; } +[[link(android)]] class SetIDLayer { static SetIDLayer* create(GameObject*) = mac 0x168f20, win 0x22eb90; } +[[link(android)]] class SetIDPopup : FLAlertLayer, TextInputDelegate { void valueChanged() = win 0x10a60; @@ -5277,14 +5487,17 @@ class SetIDPopup : FLAlertLayer, TextInputDelegate { static SetIDPopup *create(int, int, int, gd::string, gd::string, bool, int) = win 0x143130; } +[[link(android)]] class SetIDPopupDelegate { virtual void setIDPopupClosed(SetIDPopup*, int) {} } +[[link(android)]] class SetItemIDLayer { static SetItemIDLayer* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x5a830; } +[[link(android)]] class SetTargetIDLayer { static SetTargetIDLayer* create(EffectGameObject*, cocos2d::CCArray*, gd::string) = mac 0x159d20; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x15aed0; @@ -5292,10 +5505,12 @@ class SetTargetIDLayer { void updateTargetID() = mac 0x15b4a0; } +[[link(android)]] class SetTextPopupDelegate { virtual void setIDPopupClosed(void*, gd::string) {} } +[[link(android)]] class SetupAnimationPopup : FLAlertLayer { static SetupAnimationPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x208b70; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x209fc0; @@ -5303,6 +5518,7 @@ class SetupAnimationPopup : FLAlertLayer { void updateTargetID() = mac 0x20a910; } +[[link(android)]] class SetupCollisionTriggerPopup : FLAlertLayer { static SetupCollisionTriggerPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x1d6120; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x1d77b0; @@ -5312,6 +5528,7 @@ class SetupCollisionTriggerPopup : FLAlertLayer { void onClose(cocos2d::CCObject*) = win 0x235970; } +[[link(android)]] class SetupCountTriggerPopup : FLAlertLayer { static SetupCountTriggerPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x15c6c0; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x15dd40; @@ -5319,6 +5536,7 @@ class SetupCountTriggerPopup : FLAlertLayer { void updateTargetID() = mac 0x15e8a0; } +[[link(android)]] class SetupInstantCountPopup : FLAlertLayer { static SetupInstantCountPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x352c10; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x354520; @@ -5326,6 +5544,7 @@ class SetupInstantCountPopup : FLAlertLayer { void updateTargetID() = mac 0x355170; } +[[link(android)]] class SetupInteractObjectPopup : FLAlertLayer { static SetupInteractObjectPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x29a400; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x29bbc0; @@ -5333,6 +5552,7 @@ class SetupInteractObjectPopup : FLAlertLayer { void updateTargetID() = mac 0x29c120; } +[[link(android)]] class SetupObjectTogglePopup : FLAlertLayer { static SetupObjectTogglePopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x1c0860; bool init(EffectGameObject*, cocos2d::CCArray*) = mac 0x1c0a40; @@ -5341,6 +5561,7 @@ class SetupObjectTogglePopup : FLAlertLayer { void updateTargetID() = mac 0x1c2440; } +[[link(android)]] class SetupOpacityPopup : FLAlertLayer { static SetupOpacityPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x32b70, win 0x23ba30; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x340a0; @@ -5348,6 +5569,7 @@ class SetupOpacityPopup : FLAlertLayer { void updateTargetID() = mac 0x34760; } +[[link(android)]] class SetupPickupTriggerPopup : FLAlertLayer { static SetupPickupTriggerPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x35e70, win 0x23d4a0; void onItemIDArrow(cocos2d::CCObject*) = mac 0x37100; @@ -5359,6 +5581,7 @@ class SetupPickupTriggerPopup : FLAlertLayer { CCTextInputNode* m_countInput; } +[[link(android)]] class SetupPulsePopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, TextInputDelegate, GJSpecialColorSelectDelegate { virtual void colorValueChanged(cocos2d::ccColor3B color) = win 0x242660, mac 0x1ec680; SetupPulsePopup() {} @@ -5377,10 +5600,12 @@ class SetupPulsePopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, T int m_pulseMode; // 0x38c on mac } +[[link(android)]] class SetupShakePopup : FLAlertLayer { static SetupShakePopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x3adc00; } +[[link(android)]] class SetupSpawnPopup : FLAlertLayer { static SetupSpawnPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x139790; void createToggleButton(gd::string, cocos2d::SEL_MenuHandler, bool, cocos2d::CCMenu*, cocos2d::CCPoint, cocos2d::CCArray*) = mac 0x13b0e0; @@ -5406,6 +5631,7 @@ class SetupSpawnPopup : FLAlertLayer { bool m_editorDisable; } +[[link(android)]] class SetupTouchTogglePopup : FLAlertLayer { static SetupTouchTogglePopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x1576a0; void onTargetIDArrow(cocos2d::CCObject*) = mac 0x158b60; @@ -5413,6 +5639,7 @@ class SetupTouchTogglePopup : FLAlertLayer { void updateTargetID() = mac 0x159480; } +[[link(android)]] class SimplePlayer : cocos2d::CCSprite { SimplePlayer() {} void setSecondColor(const cocos2d::ccColor3B& color) { @@ -5447,6 +5674,7 @@ class SimplePlayer : cocos2d::CCSprite { bool m_hasGlowOutline; } +[[link(android)]] class Slider : cocos2d::CCLayer { void setValue(float val) { m_touchLogic->getThumb()->setValue(val); @@ -5469,6 +5697,7 @@ class Slider : cocos2d::CCLayer { float m_height; } +[[link(android)]] class SliderThumb : cocos2d::CCMenuItemImage { void setValue(float val) = mac 0x18ce80, win 0x2e1b0, ios 0x210db4; float getValue() { @@ -5483,6 +5712,7 @@ class SliderThumb : cocos2d::CCMenuItemImage { bool m_vertical; } +[[link(android)]] class SliderTouchLogic : cocos2d::CCMenu { SliderThumb* getThumb() const { return m_thumb; } @@ -5495,10 +5725,12 @@ class SliderTouchLogic : cocos2d::CCMenu { bool m_rotated; } +[[link(android)]] class SongCell : TableViewCell { void updateBGColor(int index) = win 0x5c6b0; } +[[link(android)]] class SongInfoLayer : FLAlertLayer { static SongInfoLayer* create(int songID) = win 0x250520; static SongInfoLayer* create(gd::string songName, gd::string artistName, gd::string downloadLink, gd::string artistNG, gd::string artistYT, gd::string artistFB) = win 0x250830; @@ -5509,6 +5741,7 @@ class SongInfoLayer : FLAlertLayer { gd::string m_artistFacebook; } +[[link(android)]] class SongInfoObject : cocos2d::CCNode { virtual ~SongInfoObject() = mac 0x2f2040, win 0x196600; virtual void encodeWithCoder(DS_Dictionary*) = mac 0x2f2c70, win 0x1975c0; @@ -5527,6 +5760,7 @@ class SongInfoObject : cocos2d::CCNode { LevelSettingsObject* m_levelSettings; } +[[link(android)]] class SpawnTriggerAction : cocos2d::CCNode { static SpawnTriggerAction* createFromString(gd::string) = mac 0x17bf50; @@ -5537,6 +5771,7 @@ class SpawnTriggerAction : cocos2d::CCNode { int m_uuid; } +[[link(android)]] class SpeedObject : cocos2d::CCNode { float m_unknown; float m_somethingToCompare; @@ -5544,8 +5779,10 @@ class SpeedObject : cocos2d::CCNode { float m_idk4; } +[[link(android)]] class SpritePartDelegate {} +[[link(android)]] class StartPosObject : EffectGameObject { static StartPosObject* create() = mac 0xda7c0, win 0x25aa40; void setSettings(LevelSettingsObject*) = mac 0xda910; @@ -5553,6 +5790,7 @@ class StartPosObject : EffectGameObject { LevelSettingsObject* m_levelSettings; } +[[link(android)]] class StatsCell : TableViewCell { inline StatsCell() {} inline StatsCell(char const* identifier, float parentHeight, float height) : TableViewCell(identifier, parentHeight, height) {} @@ -5560,10 +5798,12 @@ class StatsCell : TableViewCell { virtual void draw() = mac 0x11bf80, win 0x59d40; } +[[link(android)]] class StatsLayer : GJDropDownLayer { static StatsLayer* create() = win 0x25BCF0; } +[[link(android)]] class TableView : CCScrollLayerExt, CCScrollLayerExtDelegate { inline TableView() {} inline TableView(cocos2d::CCRect rect) : CCScrollLayerExt(rect) {} @@ -5608,7 +5848,7 @@ class TableView : CCScrollLayerExt, CCScrollLayerExtDelegate { bool m_cancellingTouches; } -[[depends(CCIndexPath)]] +[[depends(CCIndexPath), link(android)]] class TableViewCell : cocos2d::CCLayer { inline TableViewCell() {} inline ~TableViewCell() { @@ -5646,6 +5886,7 @@ class TableViewCell : cocos2d::CCLayer { cocos2d::CCLayer* m_mainLayer; } +[[link(android)]] class TableViewDataSource { virtual int numberOfRowsInSection(unsigned int, TableView*) { return 0; } virtual unsigned int numberOfSectionsInTableView(TableView*) { return 0; } @@ -5653,6 +5894,7 @@ class TableViewDataSource { virtual TableViewCell* cellForRowAtIndexPath(CCIndexPath&, TableView*) { return nullptr; } } +[[link(android)]] class TableViewDelegate { virtual void willTweenToIndexPath(CCIndexPath&, TableViewCell*, TableView*) {} virtual void didEndTweenToIndexPath(CCIndexPath&, TableView*) {} @@ -5663,6 +5905,7 @@ class TableViewDelegate { virtual void didSelectRowAtIndexPath(CCIndexPath&, TableView*) {} } +[[link(android)]] class TeleportPortalObject : GameObject { PAD = mac 0x8, win 0x4; TeleportPortalObject* m_orangePortal; @@ -5671,10 +5914,12 @@ class TeleportPortalObject : GameObject { bool m_teleportEase; } +[[link(android)]] class TextAlertPopup : cocos2d::CCNode { static TextAlertPopup* create(gd::string text, float time, float scale) = mac 0x157080, win 0x1450b0; } +[[link(android)]] class TextArea : cocos2d::CCSprite { // https://www.youtube.com/watch?v=1LVW7IUyKMg TextArea() = mac 0x19fba0, win 0x33110, ios 0x92c28; @@ -5695,6 +5940,7 @@ class TextArea : cocos2d::CCSprite { float m_height; // 0x20c } +[[link(android)]] class TextInputDelegate { virtual void textChanged(CCTextInputNode*) {} virtual void textInputOpened(CCTextInputNode*) {} @@ -5704,10 +5950,12 @@ class TextInputDelegate { virtual bool allowTextInput(CCTextInputNode*) {return true;} } +[[link(android)]] class ToggleTriggerAction : cocos2d::CCNode { static ToggleTriggerAction* createFromString(gd::string) = mac 0x1765e0; } +[[link(android)]] class TopArtistsLayer : FLAlertLayer { static TopArtistsLayer* create() = mac 0x192a90, win 0x25d8e0; virtual ~TopArtistsLayer() = win 0x25d7c0; @@ -5717,15 +5965,18 @@ class TopArtistsLayer : FLAlertLayer { void setupPageInfo(gd::string, char const*) = mac 0x193730; } +[[link(android)]] class TouchToggleAction : cocos2d::CCNode { static TouchToggleAction* createFromString(gd::string) = mac 0x177e10; } +[[link(android)]] class TriggerEffectDelegate { virtual void toggleGroupTriggered(int, bool) {} virtual void spawnGroup(int) {} } +[[link(android)]] class UILayer : cocos2d::CCLayerColor { static UILayer* create() = mac 0x27fd10, win 0x25f310; virtual bool init() = mac 0x27fe40, win 0x25f3b0; @@ -5747,6 +5998,7 @@ class UILayer : cocos2d::CCLayerColor { cocos2d::CCMenu* m_checkPointMenu; } +[[link(android)]] class UndoObject : cocos2d::CCObject { ~UndoObject() = mac 0xa2fd0; static UndoObject* create(GameObject*, UndoCommand) = mac 0x94ea0, win 0x16bc20; @@ -5759,11 +6011,13 @@ class UndoObject : cocos2d::CCObject { bool m_redo; } +[[link(android)]] class UploadActionDelegate { virtual void uploadActionFinished(int, int) {} virtual void uploadActionFailed(int, int) {} } +[[link(android)]] class UploadActionPopup : FLAlertLayer { UploadPopupDelegate* m_popupDelegate; TextArea* m_messageArea; @@ -5771,18 +6025,22 @@ class UploadActionPopup : FLAlertLayer { CCMenuItemSpriteExtra* m_closeBtn; } +[[link(android)]] class UploadMessageDelegate {} +[[link(android)]] class UploadPopupDelegate { virtual void onClosePopup() {} } +[[link(android)]] class UserInfoDelegate { virtual void getUserInfoFinished(GJUserScore *) {} virtual void getUserInfoFailed(int) {} virtual void userInfoChanged(GJUserScore *) {} } +[[link(android)]] class UserListDelegate { virtual void forceReloadList(UserListType) {} virtual void getUserListFailed(UserListType, GJErrorCode) {} @@ -5790,6 +6048,7 @@ class UserListDelegate { virtual void userListChanged(cocos2d::CCArray*, UserListType) {} } +[[link(android)]] class VideoOptionsLayer : FLAlertLayer { VideoOptionsLayer* create() = win 0x1e0d70; bool init() = win 0x1e0e10; @@ -5815,6 +6074,7 @@ class VideoOptionsLayer : FLAlertLayer { int m_currentResolution; } +[[link(android)]] class LevelTools { static gd::string base64EncodeString(gd::string) = mac 0x294470, win 0x18b310; static gd::string base64DecodeString(gd::string) = mac 0x294510, win 0x18b3b0; diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index eb4359c3..1b5e3735 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -62,7 +62,7 @@ public: )GEN"; // requires: type, member_name, array - char const* member_definition = R"GEN({private} {type} {member_name};{public} + char const* member_definition = R"GEN(/*make this private when android headers are done*/{public} {type} {member_name};{public} )GEN"; char const* pad_definition = R"GEN( GEODE_PAD({hardcode}); @@ -233,7 +233,7 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& } else if (auto fn = field.get_as()) { fb = &fn->prototype; - if (!codegen::platformNumber(fn->binds)) { + if (!codegen::platformNumber(fn->binds) && codegen::getStatus(field) != BindStatus::Binded) { used_format = format_strings::error_definition; if (fb->type != FunctionType::Normal) diff --git a/loader/src/platform/android/ModImpl.cpp b/loader/src/platform/android/ModImpl.cpp index e4d99fbd..998ed8d8 100644 --- a/loader/src/platform/android/ModImpl.cpp +++ b/loader/src/platform/android/ModImpl.cpp @@ -8,7 +8,8 @@ using namespace geode::prelude; Result<> Mod::Impl::loadPlatformBinary() { - auto so = dlopen((m_tempDirName / m_info.binaryName()).string().c_str(), RTLD_LAZY); + auto so = + dlopen((m_tempDirName / m_metadata.getBinaryName()).string().c_str(), RTLD_LAZY); if (so) { if (m_platformInfo) { delete m_platformInfo; From 175f488c23202079f190e57ae88f7ceff71622ca Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:50:13 +0300 Subject: [PATCH 003/270] Add android.cpp to test members --- loader/test/members/Android.cpp | 9 +++++++++ loader/test/members/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 loader/test/members/Android.cpp diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp new file mode 100644 index 00000000..87e81630 --- /dev/null +++ b/loader/test/members/Android.cpp @@ -0,0 +1,9 @@ +#include "Common.hpp" + +#ifdef GEODE_IS_ANDROID + +// Add known android struct members here + +// needed classes are ones in the ids folder and some generic ones (i think they are already done though so only ids) + +#endif \ No newline at end of file diff --git a/loader/test/members/CMakeLists.txt b/loader/test/members/CMakeLists.txt index c7a518f4..961d9986 100644 --- a/loader/test/members/CMakeLists.txt +++ b/loader/test/members/CMakeLists.txt @@ -4,7 +4,7 @@ set(PROJECT_NAME TestMembers) project(${PROJECT_NAME} VERSION 1.0.0) -add_library(${PROJECT_NAME} SHARED MacOS.cpp Windows.cpp) +add_library(${PROJECT_NAME} SHARED MacOS.cpp Windows.cpp Android.cpp) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) target_include_directories(${PROJECT_NAME} PRIVATE From 1d53ce76957a476e09a40084b979084d69930b6c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:59:12 +0300 Subject: [PATCH 004/270] Make missimg members private, ifdef missing ids --- codegen/src/BindingGen.cpp | 2 +- loader/src/ids/EditorPauseLayer.cpp | 4 ++++ loader/src/ids/LevelBrowserLayer.cpp | 4 ++++ loader/src/ids/LevelInfoLayer.cpp | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index 1b5e3735..6aa89a23 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -62,7 +62,7 @@ public: )GEN"; // requires: type, member_name, array - char const* member_definition = R"GEN(/*make this private when android headers are done*/{public} {type} {member_name};{public} + char const* member_definition = R"GEN( {private} {type} {member_name};{public} )GEN"; char const* pad_definition = R"GEN( GEODE_PAD({hardcode}); diff --git a/loader/src/ids/EditorPauseLayer.cpp b/loader/src/ids/EditorPauseLayer.cpp index 7c44a3f7..c1284360 100644 --- a/loader/src/ids/EditorPauseLayer.cpp +++ b/loader/src/ids/EditorPauseLayer.cpp @@ -2,6 +2,8 @@ #include +#if !defined(GEODE_IS_ANDROID) + using namespace geode::prelude; // special class for this because making it a CCMenuItemToggler would be very UB @@ -272,3 +274,5 @@ struct EditorPauseLayerIDs : Modify { return true; } }; + +#endif \ No newline at end of file diff --git a/loader/src/ids/LevelBrowserLayer.cpp b/loader/src/ids/LevelBrowserLayer.cpp index d3ef28e2..7723454b 100644 --- a/loader/src/ids/LevelBrowserLayer.cpp +++ b/loader/src/ids/LevelBrowserLayer.cpp @@ -4,6 +4,8 @@ #include #include +#if !defined(GEODE_IS_ANDROID) + using namespace geode::prelude; $register_ids(LevelBrowserLayer) { @@ -171,3 +173,5 @@ struct LevelBrowserLayerIDs : Modify { return true; } }; + +#endif \ No newline at end of file diff --git a/loader/src/ids/LevelInfoLayer.cpp b/loader/src/ids/LevelInfoLayer.cpp index d2f96629..5edfe252 100644 --- a/loader/src/ids/LevelInfoLayer.cpp +++ b/loader/src/ids/LevelInfoLayer.cpp @@ -3,6 +3,8 @@ #include #include +#if !defined(GEODE_IS_ANDROID) + $register_ids(LevelInfoLayer) { auto winSize = CCDirector::get()->getWinSize(); @@ -135,3 +137,5 @@ struct LevelInfoLayerIDs : Modify { return true; } }; + +#endif \ No newline at end of file From bb032cc160ed91eccc37b11cca5fba400d3a3dd2 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:25:28 +0300 Subject: [PATCH 005/270] Fix not linking to functions --- bindings/GeometryDash.bro | 17 ++++++++--------- codegen/src/BindingGen.cpp | 2 +- codegen/src/SourceGen.cpp | 6 +++--- loader/test/members/Android.cpp | 5 +++++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cda687a4..29b12d1d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2071,7 +2071,7 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate { int m_lastVisibleSection; bool m_objectsAreDisabled; bool m_blending; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; } [[link(android)]] @@ -3192,19 +3192,18 @@ class GameManager : GManager { bool m_switchModes; bool m_toFullscreen; bool m_reloading; - bool m_unknown0; - PAD = mac 0x4, win 0x4; + PAD = mac 0x5, win 0x5, android 0x1; cocos2d::CCDictionary* m_valueKeeper; cocos2d::CCDictionary* m_unlockValueKeeper; cocos2d::CCDictionary* m_customObjectDict; double m_adTimer; double m_adCache; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; double m_unknownDouble; // TODO: according to wylie's decomp this pad was 0x4, gd.h has it as 0x8 (and its correct) // i have a feeling android gm and windows gm are different structs // so the extra member could be here (for windows) - PAD = mac 0x4, win 0x8; + PAD = mac 0x4, win 0x8, android 0x8; bool m_loaded; gd::string m_unknownString; PlayLayer* m_playLayer; @@ -4871,7 +4870,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool m_debugPauseOff; bool m_shouldSmoothCamera; float unused_4e0; - PAD = mac 0x4, win 0x4; + PAD = mac 0x4, win 0x4, android 0x4; cocos2d::CCDrawNode* unknown4e8; float m_camera4f0; int unused4f4; @@ -4885,7 +4884,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, float unknown510; float unknown514; float unknown518; - PAD = mac 0x4, win 0x4; + PAD = mac 0x4, win 0x4, android 0x4; StartPosObject* m_startPos; CheckpointObject* m_startPosCheckpoint; EndPortalObject* m_endPortal; @@ -4918,7 +4917,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, float unknown5c4; GJGroundLayer* m_bottomGround; GJGroundLayer* m_topGround; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; bool m_isDead; bool m_startCameraAtCorner; bool m_cameraYLocked; @@ -4952,7 +4951,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, int unknown680; int m_activeGravityEffects; int m_gravityEffectStatus; // ?? - PAD = mac 0x4, win 0x4; + PAD = mac 0x4, win 0x4, android 0x4; cocos2d::CCArray* m_gravitySprites; bool unk428; bool m_shouldRecordActions; diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index 6aa89a23..c1d5b015 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -62,7 +62,7 @@ public: )GEN"; // requires: type, member_name, array - char const* member_definition = R"GEN( {private} {type} {member_name};{public} + char const* member_definition = R"GEN({private} {type} {member_name};{public} )GEN"; char const* pad_definition = R"GEN( GEODE_PAD({hardcode}); diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 35f58962..eee73f19 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -157,9 +157,9 @@ std::string generateBindingSource(Root const& root) { // yeah there are no inlines on cocos } else if (auto fn = f.get_as()) { - if ((c.links & codegen::platform) != Platform::None) { - continue; - } + // if ((c.links & codegen::platform) != Platform::None) { + // continue; + // } if (codegen::getStatus(f) != BindStatus::Unbindable) { continue; } diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 87e81630..fb5a10fd 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -6,4 +6,9 @@ // needed classes are ones in the ids folder and some generic ones (i think they are already done though so only ids) +GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x138); +GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x13c); + +GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); + #endif \ No newline at end of file From 4e8f7866bf7e70b2890c20a8b398769fc4000ccc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:38:03 +0300 Subject: [PATCH 006/270] Playlayer is different on android? --- bindings/GeometryDash.bro | 1 + loader/test/members/Android.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 29b12d1d..023c7cc4 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4862,6 +4862,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void xPosForTime(float) = mac 0x7d140, win 0x208840; ~PlayLayer() = mac 0x6b090, win 0x1fafc0; + // there is 0x10 more for android between this and ccdrawnode float unused4c8; bool unused4cc; bool m_hasCheated; diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index fb5a10fd..ed8129cb 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -9,6 +9,12 @@ GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x138); GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x13c); -GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); +static_assert(sizeof(GJBaseGameLayer) == 0x2cc); + +// GEODE_MEMBER_CHECK(PlayLayer, unknown4e8, 0x2e8); +// GEODE_MEMBER_CHECK(PlayLayer, m_endPortal, 0x324); +// GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c); +// GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); +// GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); #endif \ No newline at end of file From 0e324c444c98f0c67708bdb28caf215e7b187775 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:49:24 +0300 Subject: [PATCH 007/270] Add android gd string and comment out addresses for now --- codegen/src/AddressGen.cpp | 2 +- loader/src/platform/android/gdstdlib.cpp | 61 ++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 loader/src/platform/android/gdstdlib.cpp diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index bc154b1c..295ccbde 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -122,7 +122,7 @@ std::string generateAddressHeader(Root const& root) { } else if (codegen::getStatus(field) == BindStatus::Binded && fn->prototype.type == FunctionType::Normal) { address_str = fmt::format( - "addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))", + "0/*addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))*/", str_if("Non", !fn->prototype.is_virtual), codegen::getParameterTypes(fn->prototype), field.parent, diff --git a/loader/src/platform/android/gdstdlib.cpp b/loader/src/platform/android/gdstdlib.cpp new file mode 100644 index 00000000..d4ec8653 --- /dev/null +++ b/loader/src/platform/android/gdstdlib.cpp @@ -0,0 +1,61 @@ +#include + +#ifdef GEODE_IS_ANDROID + +namespace gd { + namespace { + static inline auto emptyInternalString() { + return reinterpret_cast<_internal_string*>( + *reinterpret_cast(geode::base::get() + 0x75fb24) + sizeof(_internal_string) + ); + } + } + + string::string() : m_data(nullptr) { + m_data = emptyInternalString(); + } + + string::string(char const* ok) : m_data(nullptr) { + reinterpret_cast(geode::base::get() + 0x506c08)(this, ok); + } + + string::string(string const& ok) : m_data(nullptr) { + if (*(string**)(&ok) == nullptr) return; + reinterpret_cast(geode::base::get() + 0x506634)(this, ok); + } + + string& string::operator=(char const* ok) { + this->~string(); + new (this) string(ok); + return *this; + } + + string& string::operator=(string const& ok) { + this->~string(); + new (this) string(ok); + return *this; + } + + string::~string() { + if (m_data == nullptr) return; + reinterpret_cast(geode::base::get() + 0x5054bc)( + &m_data[-1] + ); + } + + bool string::operator<(string const& other) const { + return std::string(*this) < std::string(other); + } + + bool string::operator==(string const& other) const { + return std::string(*this) == std::string(other); + } + + // TODO: these need to stay for old mods linking against geode <1.2.0, remove in 2.0.0 + template class map; + template class map; + template class map; + template class map; +} + +#endif \ No newline at end of file From 7bfc4e438e2ba2f190adf7dd461ced99e3b229d3 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:53:24 +0300 Subject: [PATCH 008/270] readd the thingy but uhh --- codegen/src/SourceGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index eee73f19..000dd6dd 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -157,9 +157,9 @@ std::string generateBindingSource(Root const& root) { // yeah there are no inlines on cocos } else if (auto fn = f.get_as()) { - // if ((c.links & codegen::platform) != Platform::None) { - // continue; - // } + if (is_cocos_class(c.name) && (c.links & codegen::platform) != Platform::None) { + continue; + } if (codegen::getStatus(f) != BindStatus::Unbindable) { continue; } From 4715072c8612909c2db89a8cfee43d6ee472f739 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:56:51 +0300 Subject: [PATCH 009/270] Add platform specific funcs --- loader/src/platform/android/util.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 35e6f597..f8d52e3e 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -30,4 +30,18 @@ geode::Result utils::file:: return geode::Err("This function is currently unimplemented"); } +void geode::utils::game::launchLoaderUninstaller(bool deleteSaveData) { + log::error("Launching Geode uninstaller is not supported on android"); +} + +void geode::utils::game::exit() { + // Not implemented + log::error("Exiting the game is not implemented on android"); +} + +void geode::utils::game::restart() { + // Not implemented + log::error("Restarting the game is not implemented on android"); +} + #endif From 21866a033a1a9e8ace36403baa6e62285e1272a0 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Thu, 14 Sep 2023 17:38:31 +0300 Subject: [PATCH 010/270] improve utils::file::read* error checking --- loader/src/utils/file.cpp | 71 ++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index 8df76c0d..1f8a7ad6 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -21,48 +21,51 @@ using namespace geode::prelude; using namespace geode::utils::file; Result utils::file::readString(ghc::filesystem::path const& path) { + if (!ghc::filesystem::exists(path)) + return Err("File does not exist"); + #if _WIN32 std::ifstream in(path.wstring(), std::ios::in | std::ios::binary); #else std::ifstream in(path.string(), std::ios::in | std::ios::binary); #endif - if (in) { - std::string contents; - in.seekg(0, std::ios::end); - contents.resize((const size_t)in.tellg()); - in.seekg(0, std::ios::beg); - in.read(&contents[0], contents.size()); - in.close(); - return Ok(contents); - } - return Err("Unable to open file"); + if (!in) + return Err("Unable to open file"); + + std::string contents; + in.seekg(0, std::ios::end); + contents.resize((const size_t)in.tellg()); + in.seekg(0, std::ios::beg); + in.read(&contents[0], contents.size()); + in.close(); + return Ok(contents); } Result utils::file::readJson(ghc::filesystem::path const& path) { - auto str = utils::file::readString(path); - - if (str) { - try { - return Ok(json::parse(str.value())); - } catch(std::exception const& e) { - return Err("Unable to parse JSON: " + std::string(e.what())); - } - } else { - return Err("Unable to open file"); + if (!str) + return Err(str.unwrapErr()); + try { + return Ok(json::parse(str.value())); + } + catch(std::exception const& e) { + return Err("Unable to parse JSON: " + std::string(e.what())); } } Result utils::file::readBinary(ghc::filesystem::path const& path) { + if (!ghc::filesystem::exists(path)) + return Err("File does not exist"); + #if _WIN32 std::ifstream in(path.wstring(), std::ios::in | std::ios::binary); #else std::ifstream in(path.string(), std::ios::in | std::ios::binary); #endif - if (in) { - return Ok(ByteVector(std::istreambuf_iterator(in), {})); - } - return Err("Unable to open file"); + if (!in) + return Err("Unable to open file"); + + return Ok(ByteVector(std::istreambuf_iterator(in), {})); } Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string const& data) { @@ -72,14 +75,14 @@ Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string #else file.open(path.string()); #endif - if (file.is_open()) { - file << data; + if (!file.is_open()) { file.close(); - - return Ok(); + return Err("Unable to open file"); } + + file << data; file.close(); - return Err("Unable to open file"); + return Ok(); } Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector const& data) { @@ -89,14 +92,14 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector #else file.open(path.string(), std::ios::out | std::ios::binary); #endif - if (file.is_open()) { - file.write(reinterpret_cast(data.data()), data.size()); + if (!file.is_open()) { file.close(); - - return Ok(); + return Err("Unable to open file"); } + + file.write(reinterpret_cast(data.data()), data.size()); file.close(); - return Err("Unable to open file"); + return Ok(); } Result<> utils::file::createDirectory(ghc::filesystem::path const& path) { From 9a28e58639db72526b7e50d684b52ae31333fc6d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:07:53 +0300 Subject: [PATCH 011/270] add GEODE_HIDDEN to _spr --- loader/include/Geode/loader/Mod.hpp | 2 +- loader/src/loader/ModImpl.cpp | 5 ++--- loader/src/loader/ModImpl.hpp | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index bdc57981..0cf2ed64 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -398,6 +398,6 @@ namespace geode { }; } -inline char const* operator"" _spr(char const* str, size_t) { +GEODE_HIDDEN inline char const* operator"" _spr(char const* str, size_t) { return geode::Mod::get()->expandSpriteName(str); } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index dcb8e662..6ffacdc0 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -572,14 +572,13 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - static std::unordered_map expanded = {}; - if (expanded.count(name)) return expanded[name]; + if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; auto exps = m_metadata.getID() + "/" + name; memcpy(exp, exps.c_str(), exps.size() + 1); - expanded[name] = exp; + m_expandedSprites[name] = exp; return exp; } diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index 7e983d09..a8bdc09f 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -57,6 +57,13 @@ namespace geode { * Whether the mod resources are loaded or not */ bool m_resourcesLoaded = false; + /** + * Whether logging is enabled for this mod + */ + bool m_loggingEnabled = true; + + std::unordered_map m_expandedSprites; + ModRequestedAction m_requestedAction = ModRequestedAction::None; From a571fbbcaee0e8ffb4b5ad19c2073698c94908f4 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:13:12 +0300 Subject: [PATCH 012/270] Macos updateModifierKeys --- bindings/Cocos2d.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 632ce503..4d1d2dab 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -360,6 +360,7 @@ class cocos2d::CCImage { class cocos2d::CCKeyboardDispatcher { bool dispatchKeyboardMSG(cocos2d::enumKeyCodes, bool) = mac 0xe8190; const char* keyToString(cocos2d::enumKeyCodes) = mac 0xe8450; + void updateModifierKeys(bool shft, bool ctrl, bool alt, bool cmd) = mac 0xe8430; } [[link(win)]] From 3559064b45a113020a288c1b1a71dc23d591ba0b Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 14 Sep 2023 16:31:39 -0300 Subject: [PATCH 013/270] add mangler for gd::string symbols --- codegen/src/AddressGen.cpp | 10 ++- codegen/src/AndroidSymbol.hpp | 143 ++++++++++++++++++++++++++++++++++ codegen/src/Shared.hpp | 9 +++ codegen/src/SourceGen.cpp | 4 +- 4 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 codegen/src/AndroidSymbol.hpp diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index 295ccbde..0e969dbe 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -1,4 +1,5 @@ #include "Shared.hpp" +#include "AndroidSymbol.hpp" namespace { namespace format_strings { @@ -120,9 +121,16 @@ std::string generateAddressHeader(Root const& root) { address_str = fmt::format("base::get() + 0x{:x}", codegen::platformNumber(fn->binds)); } } + else if (codegen::shouldAndroidBind(fn)) { + auto const mangled = generateAndroidSymbol(c, fn); + address_str = fmt::format( + "reinterpret_cast(dlsym(reinterpret_cast(geode::base::get()), \"{}\"))", + mangled + ); + } else if (codegen::getStatus(field) == BindStatus::Binded && fn->prototype.type == FunctionType::Normal) { address_str = fmt::format( - "0/*addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))*/", + "addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))", str_if("Non", !fn->prototype.is_virtual), codegen::getParameterTypes(fn->prototype), field.parent, diff --git a/codegen/src/AndroidSymbol.hpp b/codegen/src/AndroidSymbol.hpp new file mode 100644 index 00000000..dbb936e5 --- /dev/null +++ b/codegen/src/AndroidSymbol.hpp @@ -0,0 +1,143 @@ +#pragma once + +#include "Shared.hpp" + +#include +#include +#include +#include + +std::string mangleIdent(std::string_view str) { + if (str.find("::") != -1) { + std::string result = "N"; + auto s = str; + do { + const auto i = s.find("::"); + const auto t = s.substr(0, i); + result += std::to_string(t.size()) + std::string(t); + if (i == -1) s = ""; + else + s = s.substr(i + 2); + } while(s.size()); + return result + "E"; + } else { + return std::to_string(str.size()) + std::string(str); + } +}; + +std::string intToString(unsigned int value, unsigned int radix) { + static constexpr char base36[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::string result; + do { + unsigned int remainder = value % radix; + value /= radix; + result.insert(result.begin(), base36[remainder]); + } while (value); + return result; +} + +std::string lookForSeen(std::vector& seen, std::string mangled) { + for (int i = 0; i < seen.size(); ++i) { + if (seen[i] == mangled) { + if (i == 0) return "S_"; + // yes, its base 36 + return "S" + intToString(i - 1, 36) + "_"; + } + } + return ""; +} + +std::string subsSeen(std::vector& seen, std::string mangled, bool subs) { + if (!subs) return mangled; + if (mangled.empty()) return mangled; + if (auto x = lookForSeen(seen, mangled); !x.empty()) return x; + seen.push_back(mangled); + return mangled; +} + +std::string mangleType(std::vector& seen, std::string name, bool subs = true) { + if (name == "int") return "i"; + if (name == "float") return "f"; + if (name == "bool") return "b"; + if (name == "char") return "c"; + if (name == "gd::string") return "Ss"; + if (name == "cocos2d::ccColor3B") return mangleType(seen, "cocos2d::_ccColor3B", subs); + // too lazy + if (name == "gd::map") return "St3mapISsSsSt4lessISsESaISt4pairIKSsSsEEE"; + if (name == "cocos2d::SEL_MenuHandler") { + const auto a = mangleType(seen, "cocos2d::CCObject", subs); + const auto b = mangleType(seen, "cocos2d::CCObject*", subs); + const auto fnptr = subsSeen(seen, "Fv" + b + "E", subs); + return subsSeen(seen, "M" + a + fnptr, subs); + } + if (name.find('*') == name.size() - 1) { + auto inner = mangleType(seen, name.substr(0, name.size() - 1), false); + if (auto x = lookForSeen(seen, "P" + inner); !x.empty()) return x; + inner = mangleType(seen, name.substr(0, name.size() - 1), subs); + return subsSeen(seen, "P" + inner, subs); + } + if (name.find('&') == name.size() - 1) { + auto inner = mangleType(seen, name.substr(0, name.size() - 1), false); + if (auto x = lookForSeen(seen, "R" + inner); !x.empty()) return x; + inner = mangleType(seen, name.substr(0, name.size() - 1), subs); + return subsSeen(seen, "R" + inner, subs); + } + if (auto i = name.find("const"); i != -1) { + std::string inner; + // at the end of the name + if (i == name.size() - 5) { + inner = mangleType(seen, name.substr(0, i - 1)); + } else if (i == 0) { + inner = mangleType(seen, name.substr(6)); + } else { + inner = "v"; + std::cout << "um " << name << std::endl; + } + return subsSeen(seen, "K" + inner, subs); + } + + if (name.find("::") != -1) { + std::string result = ""; + std::string substituted = ""; + auto s = name; + do { + const auto i = s.find("::"); + const auto t = s.substr(0, i); + auto part = std::to_string(t.size()) + std::string(t); + if (auto x = lookForSeen(seen, result + part); !x.empty()) { + substituted = x; + } else { + substituted = subsSeen(seen, substituted + part, subs); + } + result += part; + + if (i == -1) s = ""; + else s = s.substr(i + 2); + } while(s.size()); + if (substituted.size() == 3 && substituted[0] == 'S') + return substituted; + return "N" + substituted + "E"; + } else { + return subsSeen(seen, mangleIdent(name), subs); + } +}; + +std::string generateAndroidSymbol(const Class& clazz, const FunctionBindField* fn) { + auto& decl = fn->prototype; + + std::string mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name); + if (decl.args.empty()) { + mangledSymbol += "v"; + } else { + std::vector seen; + static constexpr auto firstPart = [](std::string_view str, std::string_view sep) { + return str.substr(0, str.find(sep)); + }; + // this is S_ + seen.push_back(mangleIdent(firstPart(clazz.name, "::"))); + for (auto& [ty, _] : decl.args) { + mangledSymbol += mangleType(seen, ty.name); + } + } + return mangledSymbol; +} \ No newline at end of file diff --git a/codegen/src/Shared.hpp b/codegen/src/Shared.hpp index c8e07b6f..a2a69443 100644 --- a/codegen/src/Shared.hpp +++ b/codegen/src/Shared.hpp @@ -129,6 +129,15 @@ namespace codegen { return BindStatus::Unbindable; } + inline bool shouldAndroidBind(const FunctionBindField* fn) { + if (codegen::platform == Platform::Android) { + for (auto& [type, name] : fn->prototype.args) { + if (can_find(type.name, "gd::")) return true; + } + } + return false; + } + inline BindStatus getStatus(Field const& field) { return getStatusWithPlatform(codegen::platform, field); } diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 000dd6dd..230a31fc 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -198,10 +198,10 @@ std::string generateBindingSource(Root const& root) { ) { used_declare_format = format_strings::declare_virtual_error; } - else if (codegen::getStatus(f) != BindStatus::NeedsBinding) { + else if (codegen::getStatus(f) != BindStatus::NeedsBinding && !codegen::shouldAndroidBind(fn)) { continue; } - + if (!used_declare_format) { switch (fn->prototype.type) { From 372ea0e78c49527396f642b04449dea424820905 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 08:17:40 +0300 Subject: [PATCH 014/270] remove the expand sprite log --- codegen/src/SourceGen.cpp | 2 +- loader/src/loader/ModImpl.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 35f58962..26a911a1 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -198,7 +198,7 @@ std::string generateBindingSource(Root const& root) { ) { used_declare_format = format_strings::declare_virtual_error; } - else if (codegen::getStatus(f) != BindStatus::NeedsBinding) { + else if (codegen::getStatus(f) != BindStatus::NeedsBinding && !android_has_boobs(f)) { continue; } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 1f2a8573..bc21fc9f 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -592,7 +592,6 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - log::debug("Expanding sprite name {} for {}", name, m_metadata.getID()); if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; From 3b359726f86e943e74cfc8e269ebe815e67b7686 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 08:20:18 +0300 Subject: [PATCH 015/270] Remove the thing that was left when i was explaining to mat what to edit on the codegen to support android --- codegen/src/SourceGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 26a911a1..35f58962 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -198,7 +198,7 @@ std::string generateBindingSource(Root const& root) { ) { used_declare_format = format_strings::declare_virtual_error; } - else if (codegen::getStatus(f) != BindStatus::NeedsBinding && !android_has_boobs(f)) { + else if (codegen::getStatus(f) != BindStatus::NeedsBinding) { continue; } From 887f82fc1d9f0ab25c54a88e983ce9c79552bd4c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:04:12 +0300 Subject: [PATCH 016/270] remove link from platform toolbox --- bindings/GeometryDash.bro | 1 - codegen/src/AddressGen.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 023c7cc4..bdc1bcf3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4674,7 +4674,6 @@ class PlatformDownloadDelegate { virtual void downloadFailed(char const*) {} } -[[link(android)]] class PlatformToolbox { static void hideCursor() = mac 0x27c340; static void showCursor() = mac 0x27c360; diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index 0e969dbe..0db80e7c 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -112,7 +112,6 @@ std::string generateAddressHeader(Root const& root) { continue; } - if (codegen::getStatus(field) == BindStatus::NeedsBinding || codegen::platformNumber(field)) { if (is_cocos_class(field.parent) && codegen::platform == Platform::Windows) { address_str = fmt::format("base::getCocos() + 0x{:x}", codegen::platformNumber(fn->binds)); From 889bb77e6d95321a2f9bba1b09a41ae048748bf7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:08:38 +0300 Subject: [PATCH 017/270] make cc_dll attribute hidden on mac --- .../Geode/cocos/platform/android/CCPlatformDefine.h | 8 ++------ .../include/Geode/cocos/platform/ios/CCPlatformDefine.h | 8 ++------ .../include/Geode/cocos/platform/mac/CCPlatformDefine.h | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h index 93fe1c46..3f9a88d1 100644 --- a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL +#define ACTUAL_CC_DLL #define CC_NO_MESSAGE_PSEUDOASSERT(cond) \ if (!(cond)) { \ diff --git a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h index 74bc5d07..4ebf2830 100644 --- a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL __attribute__((visibility("hidden"))) +#define ACTUAL_CC_DLL #define CC_ASSERT(cond) assert(cond) diff --git a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h index e542eecb..0b2e2623 100644 --- a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL __attribute__((visibility("hidden"))) +#define ACTUAL_CC_DLL #if CC_DISABLE_ASSERT > 0 From 7cc534aaf90ff34e052b18745824e019e2c729f7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:16:45 +0300 Subject: [PATCH 018/270] add geodehidden to gd classes for macos --- codegen/src/BindingGen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index eb4359c3..6969f4a6 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -29,7 +29,7 @@ namespace { namespace format_strings { )GEN"; char const* class_start = R"GEN( -class {class_name}{base_classes} {{ +class {hidden}{class_name}{base_classes} {{ public: static constexpr auto CLASS_NAME = "{class_name}"; )GEN"; @@ -185,7 +185,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& single_output += fmt::format(::format_strings::class_start, fmt::arg("class_name", cls.name), - fmt::arg("base_classes", supers) + fmt::arg("base_classes", supers), + fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) ); // what. From dc8e34d8b88ef8d473cee64ea1ed5eb9aa67518e Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 18:37:04 +0300 Subject: [PATCH 019/270] Update tuliphook --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8e9e928..ad961b7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#9f1938f") +CPMAddPackage("gh:geode-sdk/TulipHook#086ea58") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies From 9906a8ff7893f4a63e176a574d466bab9d96bfa1 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:38:15 +0300 Subject: [PATCH 020/270] fix android empty string --- loader/src/platform/android/gdstdlib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/platform/android/gdstdlib.cpp b/loader/src/platform/android/gdstdlib.cpp index d4ec8653..b37ae929 100644 --- a/loader/src/platform/android/gdstdlib.cpp +++ b/loader/src/platform/android/gdstdlib.cpp @@ -6,7 +6,7 @@ namespace gd { namespace { static inline auto emptyInternalString() { return reinterpret_cast<_internal_string*>( - *reinterpret_cast(geode::base::get() + 0x75fb24) + sizeof(_internal_string) + geode::base::get() + 0x75fb24 + sizeof(_internal_string) ); } } From 7c55b215d15cfb2a6f1a3c473400fdcf1c1e0575 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:59:55 +0300 Subject: [PATCH 021/270] comment string dtor & add +1 to dlsym --- codegen/src/AddressGen.cpp | 4 ++-- loader/src/platform/android/gdstdlib.cpp | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index 0db80e7c..aa7b3a33 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -122,8 +122,8 @@ std::string generateAddressHeader(Root const& root) { } else if (codegen::shouldAndroidBind(fn)) { auto const mangled = generateAndroidSymbol(c, fn); - address_str = fmt::format( - "reinterpret_cast(dlsym(reinterpret_cast(geode::base::get()), \"{}\"))", + address_str = fmt::format( // thumb + "reinterpret_cast(dlsym(reinterpret_cast(geode::base::get()), \"{}\")) + 1", mangled ); } diff --git a/loader/src/platform/android/gdstdlib.cpp b/loader/src/platform/android/gdstdlib.cpp index b37ae929..da52cff9 100644 --- a/loader/src/platform/android/gdstdlib.cpp +++ b/loader/src/platform/android/gdstdlib.cpp @@ -38,9 +38,7 @@ namespace gd { string::~string() { if (m_data == nullptr) return; - reinterpret_cast(geode::base::get() + 0x5054bc)( - &m_data[-1] - ); + // reinterpret_cast(geode::base::get() + 0x5054bc)(this); } bool string::operator<(string const& other) const { From 4294177be6fb8a5fa26753a5a29a7eabdc79042a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:37:18 +0300 Subject: [PATCH 022/270] gd opens rn lol! but i commented like everything --- CMakeLists.txt | 2 +- loader/include/Geode/platform/android.hpp | 5 +-- loader/src/cocos2d-ext/CCFileUtils.cpp | 1 + loader/src/hooks/LoadingLayer.cpp | 4 +++ loader/src/hooks/persist.cpp | 12 +++---- loader/src/hooks/save.cpp | 22 ++++++------- loader/src/hooks/update.cpp | 2 ++ loader/src/ids/CCTextInputNode.cpp | 38 +++++++++++----------- loader/src/loader/LoaderImpl.cpp | 32 +++++++++--------- loader/src/loader/ModImpl.cpp | 2 +- loader/src/platform/android/LoaderImpl.cpp | 2 +- loader/src/platform/android/gdstdlib.cpp | 11 ++++++- loader/src/platform/android/util.cpp | 4 +-- loader/src/utils/web.cpp | 8 +++++ 14 files changed, 83 insertions(+), 62 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad961b7f..9bca4f8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#086ea58") +CPMAddPackage("gh:geode-sdk/TulipHook#5959b87") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies diff --git a/loader/include/Geode/platform/android.hpp b/loader/include/Geode/platform/android.hpp index ce2b8e4d..e19402bc 100644 --- a/loader/include/Geode/platform/android.hpp +++ b/loader/include/Geode/platform/android.hpp @@ -9,10 +9,7 @@ namespace geode { } namespace geode::base { - GEODE_NOINLINE inline uintptr_t get() { - static uintptr_t base = reinterpret_cast(dlopen("libcocos2dcpp.so", RTLD_LAZY)); - return base; - } + /*GEODE_NOINLINE inline*/ uintptr_t get(); } namespace geode::cast { diff --git a/loader/src/cocos2d-ext/CCFileUtils.cpp b/loader/src/cocos2d-ext/CCFileUtils.cpp index a88d1ec5..22dd8224 100644 --- a/loader/src/cocos2d-ext/CCFileUtils.cpp +++ b/loader/src/cocos2d-ext/CCFileUtils.cpp @@ -84,6 +84,7 @@ void CCFileUtils::updatePaths() { struct FileUtilsUpdatePaths : Modify { static CCFileUtils* sharedFileUtils() { + log::debug("im here"); static bool doAddPaths = true; auto ret = CCFileUtils::sharedFileUtils(); diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 93e82f07..24ed70ad 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -29,6 +29,10 @@ struct CustomLoadingLayer : Modify { // hook bool init(bool fromReload) { + if (!fromReload) { + LoaderImpl::get()->addSearchPaths(); + } + CCFileUtils::get()->updatePaths(); if (!LoadingLayer::init(fromReload)) return false; diff --git a/loader/src/hooks/persist.cpp b/loader/src/hooks/persist.cpp index 3f216069..7be7ca06 100644 --- a/loader/src/hooks/persist.cpp +++ b/loader/src/hooks/persist.cpp @@ -4,9 +4,9 @@ using namespace geode::prelude; #include -struct SceneSwitch : Modify { - void willSwitchToScene(CCScene* scene) { - AchievementNotifier::willSwitchToScene(scene); - SceneManager::get()->willSwitchToScene(scene); - } -}; +// struct SceneSwitch : Modify { +// void willSwitchToScene(CCScene* scene) { +// AchievementNotifier::willSwitchToScene(scene); +// SceneManager::get()->willSwitchToScene(scene); +// } +// }; diff --git a/loader/src/hooks/save.cpp b/loader/src/hooks/save.cpp index c3dfde14..bdbf1bd3 100644 --- a/loader/src/hooks/save.cpp +++ b/loader/src/hooks/save.cpp @@ -4,17 +4,17 @@ using namespace geode::prelude; #include -struct SaveLoader : Modify { - void trySaveGame() { - log::info("Saving..."); +// struct SaveLoader : Modify { +// void trySaveGame() { +// log::info("Saving..."); - auto r = Loader::get()->saveData(); - if (!r) { - log::info("{}", r.unwrapErr()); - } +// auto r = Loader::get()->saveData(); +// if (!r) { +// log::info("{}", r.unwrapErr()); +// } - log::info("Saved"); +// log::info("Saved"); - return AppDelegate::trySaveGame(); - } -}; +// return AppDelegate::trySaveGame(); +// } +// }; diff --git a/loader/src/hooks/update.cpp b/loader/src/hooks/update.cpp index 287fb783..128484f4 100644 --- a/loader/src/hooks/update.cpp +++ b/loader/src/hooks/update.cpp @@ -6,6 +6,8 @@ using namespace geode::prelude; struct FunctionQueue : Modify { void update(float dt) { + log::debug("Scheduler update"); + LoaderImpl::get()->executeGDThreadQueue(); return CCScheduler::update(dt); } diff --git a/loader/src/ids/CCTextInputNode.cpp b/loader/src/ids/CCTextInputNode.cpp index 037cac29..6f4759e8 100644 --- a/loader/src/ids/CCTextInputNode.cpp +++ b/loader/src/ids/CCTextInputNode.cpp @@ -6,26 +6,26 @@ // ignoreAnchorPointForPosition which causes the content size of // text input nodes to be way off -struct $modify(CCTextInputNode) { - bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) { - if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font)) - return false; +// struct $modify(CCTextInputNode) { +// bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) { +// if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font)) +// return false; - this->ignoreAnchorPointForPosition(false); - this->fixPosition(); +// this->ignoreAnchorPointForPosition(false); +// this->fixPosition(); - return true; - } +// return true; +// } - void fixPosition() { - if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) { - this->setAnchorPoint(m_placeholderLabel->getAnchorPoint()); - m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint); - } - } +// void fixPosition() { +// if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) { +// this->setAnchorPoint(m_placeholderLabel->getAnchorPoint()); +// m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint); +// } +// } - void updateLabel(gd::string text) { - CCTextInputNode::updateLabel(text); - this->fixPosition(); - } -}; +// void updateLabel(gd::string text) { +// CCTextInputNode::updateLabel(text); +// this->fixPosition(); +// } +// }; diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 8b955b53..05dc7d67 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -87,7 +87,7 @@ Result<> Loader::Impl::setup() { this->createDirectories(); - this->addSearchPaths(); + // this->addSearchPaths(); this->refreshModGraph(); @@ -97,8 +97,8 @@ Result<> Loader::Impl::setup() { } void Loader::Impl::addSearchPaths() { - CCFileUtils::get()->addPriorityPath(dirs::getGeodeResourcesDir().string().c_str()); - CCFileUtils::get()->addPriorityPath(dirs::getModRuntimeDir().string().c_str()); + // CCFileUtils::get()->addPriorityPath(dirs::getGeodeResourcesDir().string().c_str()); + // CCFileUtils::get()->addPriorityPath(dirs::getModRuntimeDir().string().c_str()); } void Loader::Impl::updateResources() { @@ -218,7 +218,7 @@ void Loader::Impl::updateModResources(Mod* mod) { if (mod != Mod::get()) { // geode.loader resource is stored somewhere else, which is already added anyway auto searchPathRoot = dirs::getModRuntimeDir() / mod->getID() / "resources"; - CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); + // CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); } // only thing needs previous setup is spritesheets @@ -232,19 +232,19 @@ void Loader::Impl::updateModResources(Mod* mod) { log::debug("Adding sheet {}", sheet); auto png = sheet + ".png"; auto plist = sheet + ".plist"; - auto ccfu = CCFileUtils::get(); + // auto ccfu = CCFileUtils::get(); - if (png == std::string(ccfu->fullPathForFilename(png.c_str(), false)) || - plist == std::string(ccfu->fullPathForFilename(plist.c_str(), false))) { - log::warn( - R"(The resource dir of "{}" is missing "{}" png and/or plist files)", - mod->getID(), sheet - ); - } - else { - CCTextureCache::get()->addImage(png.c_str(), false); - CCSpriteFrameCache::get()->addSpriteFramesWithFile(plist.c_str()); - } + // if (png == std::string(ccfu->fullPathForFilename(png.c_str(), false)) || + // plist == std::string(ccfu->fullPathForFilename(plist.c_str(), false))) { + // log::warn( + // R"(The resource dir of "{}" is missing "{}" png and/or plist files)", + // mod->getID(), sheet + // ); + // } + // else { + // CCTextureCache::get()->addImage(png.c_str(), false); + // CCSpriteFrameCache::get()->addSpriteFramesWithFile(plist.c_str()); + // } } } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 1f2a8573..501a30d9 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -44,7 +44,7 @@ Result<> Mod::Impl::setup() { } if (!m_resourcesLoaded) { auto searchPathRoot = dirs::getModRuntimeDir() / m_metadata.getID() / "resources"; - CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); + // CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); m_resourcesLoaded = true; } diff --git a/loader/src/platform/android/LoaderImpl.cpp b/loader/src/platform/android/LoaderImpl.cpp index 62b2def3..89ac0144 100644 --- a/loader/src/platform/android/LoaderImpl.cpp +++ b/loader/src/platform/android/LoaderImpl.cpp @@ -24,7 +24,7 @@ namespace { } void Loader::Impl::platformMessageBox(char const* title, std::string const& info) { - cocos2d::CCMessageBox(info.c_str(), title); + // cocos2d::CCMessageBox(info.c_str(), title); } void Loader::Impl::logConsoleMessageWithSeverity(std::string const& msg, Severity severity) { diff --git a/loader/src/platform/android/gdstdlib.cpp b/loader/src/platform/android/gdstdlib.cpp index da52cff9..c96fd588 100644 --- a/loader/src/platform/android/gdstdlib.cpp +++ b/loader/src/platform/android/gdstdlib.cpp @@ -2,6 +2,14 @@ #ifdef GEODE_IS_ANDROID +namespace geode::base { + uintptr_t get() { + static uintptr_t base = (reinterpret_cast(&UILayer::create) - 0x20f168) & (~0x1); + // static uintptr_t base = reinterpret_cast(dlopen("libcocos2dcpp.so", RTLD_NOW)); + return base; + } +} + namespace gd { namespace { static inline auto emptyInternalString() { @@ -38,7 +46,8 @@ namespace gd { string::~string() { if (m_data == nullptr) return; - // reinterpret_cast(geode::base::get() + 0x5054bc)(this); + + reinterpret_cast(geode::base::get() + 0x5054bc)(this); } bool string::operator<(string const& other) const { diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index f8d52e3e..10eae65a 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -10,11 +10,11 @@ using namespace geode::prelude; #include ghc::filesystem::path dirs::getGameDir() { - return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str()); + return ghc::filesystem::path("/data/user/0/com.geode.launcher/files/"/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/); } ghc::filesystem::path dirs::getSaveDir() { - return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str()); + return ghc::filesystem::path("/data/user/0/com.geode.launcher/files/"/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/); } void utils::web::openLinkInBrowser(std::string const& url) { diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 9bc7cd99..dd6f6ba9 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -32,6 +32,8 @@ namespace geode::utils::fetch { Result<> web::fetchFile( std::string const& url, ghc::filesystem::path const& into, FileProgressCallback prog ) { + return Err("Not implemented"); + auto curl = curl_easy_init(); if (!curl) return Err("Curl not initialized!"); @@ -70,6 +72,8 @@ Result<> web::fetchFile( } Result web::fetchBytes(std::string const& url) { + return Err("Not implemented"); + auto curl = curl_easy_init(); if (!curl) return Err("Curl not initialized!"); @@ -108,6 +112,8 @@ Result web::fetchJSON(std::string const& url) { } Result web::fetch(std::string const& url) { + return Err("Not implemented"); + auto curl = curl_easy_init(); if (!curl) return Err("Curl not initialized!"); @@ -207,6 +213,8 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const std::thread([this]() { AWAIT_RESUME(); + return this->error("Not implemented", -1); + auto curl = curl_easy_init(); if (!curl) { return this->error("Curl not initialized", -1); From 86de5ff7ddfde485bcbe4bdba03db961c2fb3f47 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 00:17:45 +0300 Subject: [PATCH 023/270] uncomment some stuff --- CMakeLists.txt | 2 +- codegen/src/AddressGen.cpp | 2 +- loader/src/cocos2d-ext/CCFileUtils.cpp | 1 - loader/src/hooks/LoadingLayer.cpp | 52 ++++++++++++---------- loader/src/hooks/update.cpp | 2 - loader/src/ids/CCTextInputNode.cpp | 38 ++++++++-------- loader/src/loader/LoaderImpl.cpp | 32 +++++++------ loader/src/platform/android/LoaderImpl.cpp | 2 +- 8 files changed, 65 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bca4f8c..4a426343 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#5959b87") +CPMAddPackage("gh:geode-sdk/TulipHook#5ba74ed") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index aa7b3a33..9acb8c78 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -123,7 +123,7 @@ std::string generateAddressHeader(Root const& root) { else if (codegen::shouldAndroidBind(fn)) { auto const mangled = generateAndroidSymbol(c, fn); address_str = fmt::format( // thumb - "reinterpret_cast(dlsym(reinterpret_cast(geode::base::get()), \"{}\")) + 1", + "reinterpret_cast(dlsym(dlopen(\"libcocos2dcpp.so\", RTLD_NOW), \"{}\"))", mangled ); } diff --git a/loader/src/cocos2d-ext/CCFileUtils.cpp b/loader/src/cocos2d-ext/CCFileUtils.cpp index 22dd8224..a88d1ec5 100644 --- a/loader/src/cocos2d-ext/CCFileUtils.cpp +++ b/loader/src/cocos2d-ext/CCFileUtils.cpp @@ -84,7 +84,6 @@ void CCFileUtils::updatePaths() { struct FileUtilsUpdatePaths : Modify { static CCFileUtils* sharedFileUtils() { - log::debug("im here"); static bool doAddPaths = true; auto ret = CCFileUtils::sharedFileUtils(); diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 24ed70ad..12cef689 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -29,12 +29,6 @@ struct CustomLoadingLayer : Modify { // hook bool init(bool fromReload) { - if (!fromReload) { - LoaderImpl::get()->addSearchPaths(); - } - - CCFileUtils::get()->updatePaths(); - if (!LoadingLayer::init(fromReload)) return false; auto winSize = CCDirector::sharedDirector()->getWinSize(); @@ -49,6 +43,8 @@ struct CustomLoadingLayer : Modify { } void setupLoadingMods() { + CCFileUtils::get()->updatePaths(); + if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) { this->updateLoadedModsLabel(); this->waitLoadAssets(); @@ -59,6 +55,8 @@ struct CustomLoadingLayer : Modify { } void setupLoaderResources() { + LoaderImpl::get()->addSearchPaths(); + // verify loader resources if (!LoaderImpl::get()->verifyLoaderResources()) { this->setSmallText("Downloading Loader Resources"); @@ -112,7 +110,7 @@ struct CustomLoadingLayer : Modify { } int getTotalStep() { - return 18; + return 17; } void updateLoadingBar() { @@ -141,23 +139,29 @@ struct CustomLoadingLayer : Modify { } // hook - void loadAssets() { - switch (m_fields->m_geodeLoadStep) { - case 0: - if (this->skipOnRefresh()) this->setupLoadingMods(); - break; - case 1: - if (this->skipOnRefresh()) this->setupLoaderResources(); - break; - case 2: - this->setupModResources(); - break; - case 3: - default: - this->setSmallText("Loading game resources"); - LoadingLayer::loadAssets(); - break; - } + void loadAssets() { + log::debug("Load step {}", this->getCurrentStep()); + if (m_loadStep == 14) { + switch (m_fields->m_geodeLoadStep) { + case 0: + if (this->skipOnRefresh()) this->setupLoadingMods(); + break; + case 1: + if (this->skipOnRefresh()) this->setupLoaderResources(); + break; + case 2: + this->setupModResources(); + break; + case 3: + default: + LoadingLayer::loadAssets(); + this->updateLoadingBar(); + break; + } + return; + } + this->setSmallText("Loading game resources"); + LoadingLayer::loadAssets(); this->updateLoadingBar(); } }; diff --git a/loader/src/hooks/update.cpp b/loader/src/hooks/update.cpp index 128484f4..287fb783 100644 --- a/loader/src/hooks/update.cpp +++ b/loader/src/hooks/update.cpp @@ -6,8 +6,6 @@ using namespace geode::prelude; struct FunctionQueue : Modify { void update(float dt) { - log::debug("Scheduler update"); - LoaderImpl::get()->executeGDThreadQueue(); return CCScheduler::update(dt); } diff --git a/loader/src/ids/CCTextInputNode.cpp b/loader/src/ids/CCTextInputNode.cpp index 6f4759e8..037cac29 100644 --- a/loader/src/ids/CCTextInputNode.cpp +++ b/loader/src/ids/CCTextInputNode.cpp @@ -6,26 +6,26 @@ // ignoreAnchorPointForPosition which causes the content size of // text input nodes to be way off -// struct $modify(CCTextInputNode) { -// bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) { -// if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font)) -// return false; +struct $modify(CCTextInputNode) { + bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) { + if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font)) + return false; -// this->ignoreAnchorPointForPosition(false); -// this->fixPosition(); + this->ignoreAnchorPointForPosition(false); + this->fixPosition(); -// return true; -// } + return true; + } -// void fixPosition() { -// if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) { -// this->setAnchorPoint(m_placeholderLabel->getAnchorPoint()); -// m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint); -// } -// } + void fixPosition() { + if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) { + this->setAnchorPoint(m_placeholderLabel->getAnchorPoint()); + m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint); + } + } -// void updateLabel(gd::string text) { -// CCTextInputNode::updateLabel(text); -// this->fixPosition(); -// } -// }; + void updateLabel(gd::string text) { + CCTextInputNode::updateLabel(text); + this->fixPosition(); + } +}; diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 05dc7d67..86a03f54 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -87,8 +87,6 @@ Result<> Loader::Impl::setup() { this->createDirectories(); - // this->addSearchPaths(); - this->refreshModGraph(); m_isSetup = true; @@ -97,8 +95,8 @@ Result<> Loader::Impl::setup() { } void Loader::Impl::addSearchPaths() { - // CCFileUtils::get()->addPriorityPath(dirs::getGeodeResourcesDir().string().c_str()); - // CCFileUtils::get()->addPriorityPath(dirs::getModRuntimeDir().string().c_str()); + CCFileUtils::get()->addPriorityPath(dirs::getGeodeResourcesDir().string().c_str()); + CCFileUtils::get()->addPriorityPath(dirs::getModRuntimeDir().string().c_str()); } void Loader::Impl::updateResources() { @@ -218,7 +216,7 @@ void Loader::Impl::updateModResources(Mod* mod) { if (mod != Mod::get()) { // geode.loader resource is stored somewhere else, which is already added anyway auto searchPathRoot = dirs::getModRuntimeDir() / mod->getID() / "resources"; - // CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); + CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); } // only thing needs previous setup is spritesheets @@ -232,19 +230,19 @@ void Loader::Impl::updateModResources(Mod* mod) { log::debug("Adding sheet {}", sheet); auto png = sheet + ".png"; auto plist = sheet + ".plist"; - // auto ccfu = CCFileUtils::get(); + auto ccfu = CCFileUtils::get(); - // if (png == std::string(ccfu->fullPathForFilename(png.c_str(), false)) || - // plist == std::string(ccfu->fullPathForFilename(plist.c_str(), false))) { - // log::warn( - // R"(The resource dir of "{}" is missing "{}" png and/or plist files)", - // mod->getID(), sheet - // ); - // } - // else { - // CCTextureCache::get()->addImage(png.c_str(), false); - // CCSpriteFrameCache::get()->addSpriteFramesWithFile(plist.c_str()); - // } + if (png == std::string(ccfu->fullPathForFilename(png.c_str(), false)) || + plist == std::string(ccfu->fullPathForFilename(plist.c_str(), false))) { + log::warn( + R"(The resource dir of "{}" is missing "{}" png and/or plist files)", + mod->getID(), sheet + ); + } + else { + CCTextureCache::get()->addImage(png.c_str(), false); + CCSpriteFrameCache::get()->addSpriteFramesWithFile(plist.c_str()); + } } } diff --git a/loader/src/platform/android/LoaderImpl.cpp b/loader/src/platform/android/LoaderImpl.cpp index 89ac0144..62b2def3 100644 --- a/loader/src/platform/android/LoaderImpl.cpp +++ b/loader/src/platform/android/LoaderImpl.cpp @@ -24,7 +24,7 @@ namespace { } void Loader::Impl::platformMessageBox(char const* title, std::string const& info) { - // cocos2d::CCMessageBox(info.c_str(), title); + cocos2d::CCMessageBox(info.c_str(), title); } void Loader::Impl::logConsoleMessageWithSeverity(std::string const& msg, Severity severity) { From 20d5e079bc72ed4bb508d7b500bd35544c191ca7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 01:10:56 +0300 Subject: [PATCH 024/270] Fix tuliphook alignment intervener issue --- CMakeLists.txt | 2 +- loader/src/hooks/LoadingLayer.cpp | 3 +-- loader/src/hooks/save.cpp | 22 +++++++++++----------- loader/src/utils/web.cpp | 13 +++++++++++++ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a426343..e53924f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#5ba74ed") +CPMAddPackage("gh:geode-sdk/TulipHook#41a18a1") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 12cef689..ca048b64 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -44,7 +44,7 @@ struct CustomLoadingLayer : Modify { void setupLoadingMods() { CCFileUtils::get()->updatePaths(); - + if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) { this->updateLoadedModsLabel(); this->waitLoadAssets(); @@ -140,7 +140,6 @@ struct CustomLoadingLayer : Modify { // hook void loadAssets() { - log::debug("Load step {}", this->getCurrentStep()); if (m_loadStep == 14) { switch (m_fields->m_geodeLoadStep) { case 0: diff --git a/loader/src/hooks/save.cpp b/loader/src/hooks/save.cpp index bdbf1bd3..c3dfde14 100644 --- a/loader/src/hooks/save.cpp +++ b/loader/src/hooks/save.cpp @@ -4,17 +4,17 @@ using namespace geode::prelude; #include -// struct SaveLoader : Modify { -// void trySaveGame() { -// log::info("Saving..."); +struct SaveLoader : Modify { + void trySaveGame() { + log::info("Saving..."); -// auto r = Loader::get()->saveData(); -// if (!r) { -// log::info("{}", r.unwrapErr()); -// } + auto r = Loader::get()->saveData(); + if (!r) { + log::info("{}", r.unwrapErr()); + } -// log::info("Saved"); + log::info("Saved"); -// return AppDelegate::trySaveGame(); -// } -// }; + return AppDelegate::trySaveGame(); + } +}; diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index dd6f6ba9..08d77846 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -220,6 +220,8 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const return this->error("Curl not initialized", -1); } + log::debug("curl init {}", curl); + // resulting byte array ByteVector ret; // output file if downloading to file. unique_ptr because not always @@ -312,17 +314,28 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const } ); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); + log::debug("curl opts"); auto res = curl_easy_perform(curl); + log::debug("curl perform"); + if (res != CURLE_OK) { long code = 0; + log::debug("curl fail"); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); + log::debug("curl cleanup"); curl_easy_cleanup(curl); + log::debug("end"); return this->error("Fetch failed: " + std::string(curl_easy_strerror(res)), code); } + log::debug("curl cleanup 2"); curl_easy_cleanup(curl); + log::debug("end 2"); + AWAIT_RESUME(); + log::debug("end 3"); + // if something is still holding a handle to this // request, then they may still cancel it m_finished = true; From a6a47bf6cff23c64f44adb6b1e9f164035efccbc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 09:48:48 +0300 Subject: [PATCH 025/270] Fix #239 and revert GEODE_HIDDENs --- codegen/src/BindingGen.cpp | 6 +++--- .../cocos/platform/ios/CCPlatformDefine.h | 2 +- .../cocos/platform/mac/CCPlatformDefine.h | 2 +- .../src/ui/internal/info/DevProfilePopup.cpp | 17 ++++++++------- .../src/ui/internal/info/DevProfilePopup.hpp | 10 ++++++--- .../src/ui/internal/list/InstallListCell.cpp | 21 ++++++++----------- .../src/ui/internal/list/InstallListCell.hpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 6 ++++-- 8 files changed, 35 insertions(+), 31 deletions(-) diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index 6969f4a6..199e2555 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -29,7 +29,7 @@ namespace { namespace format_strings { )GEN"; char const* class_start = R"GEN( -class {hidden}{class_name}{base_classes} {{ +class {class_name}{base_classes} {{ public: static constexpr auto CLASS_NAME = "{class_name}"; )GEN"; @@ -185,8 +185,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& single_output += fmt::format(::format_strings::class_start, fmt::arg("class_name", cls.name), - fmt::arg("base_classes", supers), - fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) + fmt::arg("base_classes", supers)//, + // fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) ); // what. diff --git a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h index 4ebf2830..df4e4242 100644 --- a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h @@ -3,7 +3,7 @@ #include -#define CC_DLL __attribute__((visibility("hidden"))) +#define CC_DLL //__attribute__((visibility("hidden"))) #define ACTUAL_CC_DLL #define CC_ASSERT(cond) assert(cond) diff --git a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h index 0b2e2623..8ccb4edd 100644 --- a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h @@ -3,7 +3,7 @@ #include -#define CC_DLL __attribute__((visibility("hidden"))) +#define CC_DLL //__attribute__((visibility("hidden"))) #define ACTUAL_CC_DLL diff --git a/loader/src/ui/internal/info/DevProfilePopup.cpp b/loader/src/ui/internal/info/DevProfilePopup.cpp index f5146e84..6571b078 100644 --- a/loader/src/ui/internal/info/DevProfilePopup.cpp +++ b/loader/src/ui/internal/info/DevProfilePopup.cpp @@ -5,8 +5,9 @@ #include "../list/ModListCell.hpp" #include "../list/ModListLayer.hpp" -bool DevProfilePopup::setup(std::string const& developer) { +bool DevProfilePopup::setup(std::string const& developer, ModListLayer* list) { m_noElasticity = true; + m_layer = list; this->setTitle("Mods by " + developer); @@ -18,7 +19,7 @@ bool DevProfilePopup::setup(std::string const& developer) { for (auto& mod : Loader::get()->getAllMods()) { if (mod->getDeveloper() == developer) { auto cell = ModCell::create( - mod, nullptr, ModListDisplay::Concise, { 358.f, 40.f } + mod, m_layer, ModListDisplay::Concise, { 358.f, 40.f } ); cell->disableDeveloperButton(); items->addObject(cell); @@ -31,7 +32,7 @@ bool DevProfilePopup::setup(std::string const& developer) { continue; } auto cell = IndexItemCell::create( - item, nullptr, ModListDisplay::Concise, { 358.f, 40.f } + item, m_layer, ModListDisplay::Concise, { 358.f, 40.f } ); cell->disableDeveloperButton(); items->addObject(cell); @@ -39,18 +40,18 @@ bool DevProfilePopup::setup(std::string const& developer) { // mods list auto listSize = CCSize { 358.f, 160.f }; - auto list = ListView::create(items, 40.f, listSize.width, listSize.height); - list->setPosition(winSize / 2 - listSize / 2); - m_mainLayer->addChild(list); + auto cellList = ListView::create(items, 40.f, listSize.width, listSize.height); + cellList->setPosition(winSize / 2 - listSize / 2); + m_mainLayer->addChild(cellList); addListBorders(m_mainLayer, winSize / 2, listSize); return true; } -DevProfilePopup* DevProfilePopup::create(std::string const& developer) { +DevProfilePopup* DevProfilePopup::create(std::string const& developer, ModListLayer* list) { auto ret = new DevProfilePopup(); - if (ret && ret->init(420.f, 260.f, developer)) { + if (ret && ret->init(420.f, 260.f, developer, list)) { ret->autorelease(); return ret; } diff --git a/loader/src/ui/internal/info/DevProfilePopup.hpp b/loader/src/ui/internal/info/DevProfilePopup.hpp index af47a572..5ff3b631 100644 --- a/loader/src/ui/internal/info/DevProfilePopup.hpp +++ b/loader/src/ui/internal/info/DevProfilePopup.hpp @@ -4,10 +4,14 @@ using namespace geode::prelude; -class DevProfilePopup : public Popup { +class ModListLayer; + +class DevProfilePopup : public Popup { protected: - bool setup(std::string const& developer) override; + ModListLayer* m_layer; + + bool setup(std::string const& developer, ModListLayer* list) override; public: - static DevProfilePopup* create(std::string const& developer); + static DevProfilePopup* create(std::string const& developer, ModListLayer* list); }; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index 07daca20..352d8aaf 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -53,24 +53,21 @@ void InstallListCell::setupInfo( } this->addChild(m_titleLabel); - m_developerBtn = nullptr; + m_creatorLabel = nullptr; if (developer) { auto creatorStr = "by " + *developer; - auto creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt"); - creatorLabel->setScale(.34f); + m_creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt"); + m_creatorLabel->setScale(.34f); if (inactive) { - creatorLabel->setColor({ 163, 163, 163 }); + m_creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = CCMenuItemSpriteExtra::create( - creatorLabel, this, menu_selector(InstallListCell::onViewDev) - ); - m_developerBtn->setPosition( + m_creatorLabel->setPosition( m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f + - creatorLabel->getScaledContentSize().width / 2, + m_creatorLabel->getScaledContentSize().width / 2, m_height / 2 ); - m_menu->addChild(m_developerBtn); + m_menu->addChild(m_creatorLabel); } this->setupVersion(version); @@ -96,7 +93,7 @@ void InstallListCell::setupVersion(std::variantsetScale(.2f); m_versionLabel->setPosition( m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f + - (m_developerBtn ? m_developerBtn->getScaledContentSize().width + 3.f : 0.f), + (m_creatorLabel ? m_creatorLabel->getScaledContentSize().width + 3.f : 0.f), m_titleLabel->getPositionY() - 1.f ); m_versionLabel->setColor({ 0, 255, 0 }); @@ -123,7 +120,7 @@ void InstallListCell::setupInfo(ModMetadata const& metadata, bool inactive) { } void InstallListCell::onViewDev(CCObject*) { - DevProfilePopup::create(getDeveloper())->show(); + // DevProfilePopup::create(getDeveloper(), m_layer)->show(); } bool InstallListCell::init(InstallListPopup* list, CCSize const& size) { diff --git a/loader/src/ui/internal/list/InstallListCell.hpp b/loader/src/ui/internal/list/InstallListCell.hpp index f2fd677c..ce5927ea 100644 --- a/loader/src/ui/internal/list/InstallListCell.hpp +++ b/loader/src/ui/internal/list/InstallListCell.hpp @@ -21,7 +21,7 @@ protected: float m_height; InstallListPopup* m_layer = nullptr; CCMenu* m_menu = nullptr; - CCMenuItemSpriteExtra* m_developerBtn = nullptr; + CCLabelBMFont* m_creatorLabel = nullptr; CCLabelBMFont* m_titleLabel = nullptr; CCLabelBMFont* m_versionLabel = nullptr; TagNode* m_tagLabel = nullptr; diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index bb855607..f715132f 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -178,7 +178,7 @@ void ModListCell::setupInfo( } void ModListCell::onViewDev(CCObject*) { - DevProfilePopup::create(this->getDeveloper())->show(); + DevProfilePopup::create(this->getDeveloper(), m_layer)->show(); } bool ModListCell::init(ModListLayer* list, CCSize const& size) { @@ -227,7 +227,9 @@ void ModCell::onEnable(CCObject* sender) { else { tryOrAlert(m_mod->disable(), "Error disabling mod"); } - m_layer->reloadList(); + if (m_layer) { + m_layer->reloadList(); + } } void ModCell::onUnresolvedInfo(CCObject*) { From 2723588f212e126b96655052926d6d7e0cd77811 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:46:26 +0300 Subject: [PATCH 026/270] Fix nested lists in md --- loader/src/ui/nodes/MDTextArea.cpp | 20 ++++++++++++++++++-- loader/src/ui/nodes/TextRenderer.cpp | 6 +++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 051d5bcd..c6afcda2 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -209,6 +209,7 @@ struct MDParser { static float s_codeStart; static size_t s_orderedListNum; static std::vector s_codeSpans; + static bool s_breakListLine; static int parseText(MD_TEXTTYPE type, MD_CHAR const* rawText, MD_SIZE size, void* mdtextarea) { auto textarea = static_cast(mdtextarea); @@ -364,6 +365,10 @@ struct MDParser { renderer->pushIndent(g_indent); s_isOrderedList = type == MD_BLOCKTYPE::MD_BLOCK_OL; s_orderedListNum = 0; + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } } break; @@ -377,6 +382,10 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } renderer->pushOpacity(renderer->getCurrentOpacity() / 2); auto lidetail = static_cast(detail); if (s_isOrderedList) { @@ -387,6 +396,7 @@ struct MDParser { renderer->renderString("• "); } renderer->popOpacity(); + s_breakListLine = true; } break; @@ -446,7 +456,13 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_UL: { renderer->popIndent(); - renderer->breakLine(); + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } + if (renderer->getCurrentIndent() == 0) { + renderer->breakLine(); + } } break; @@ -489,7 +505,6 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { - renderer->breakLine(); } break; @@ -626,6 +641,7 @@ size_t MDParser::s_orderedListNum = 0; bool MDParser::s_isCodeBlock = false; float MDParser::s_codeStart = 0; decltype(MDParser::s_codeSpans) MDParser::s_codeSpans = {}; +bool MDParser::s_breakListLine = false; void MDTextArea::updateLabel() { m_renderer->begin(m_content, CCPointZero, m_size); diff --git a/loader/src/ui/nodes/TextRenderer.cpp b/loader/src/ui/nodes/TextRenderer.cpp index fe2c712d..ca7396b3 100644 --- a/loader/src/ui/nodes/TextRenderer.cpp +++ b/loader/src/ui/nodes/TextRenderer.cpp @@ -341,8 +341,8 @@ std::vector TextRenderer::renderStringEx( auto lastIndent = m_indentationStack.size() > 1 ? m_indentationStack.at(m_indentationStack.size() - 1) : .0f; - if (m_cursor.x == m_origin.x + lastIndent && this->getCurrentIndent() > .0f) { - m_cursor.x += this->getCurrentIndent(); + if (m_cursor.x < m_origin.x + this->getCurrentIndent()) { + m_cursor.x = this->getCurrentIndent(); } auto createLabel = [&]() -> bool { @@ -487,7 +487,7 @@ void TextRenderer::breakLine(float incY) { } if (h > y) y = h; m_cursor.y -= y; - m_cursor.x = m_origin.x + getCurrentIndent(); + m_cursor.x = m_origin.x; } float TextRenderer::adjustLineAlignment() { From 9eadc2a577d57495eeb261288c87b782de2591b8 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 09:57:40 +0300 Subject: [PATCH 027/270] oh right i need to fix the search paths again --- CHANGELOG.md | 9 +++++++++ VERSION | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 180b2d85..62ac6b63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Geode Changelog +## v1.3.2 + * Fix alignment of some textures (8f39c38) + * Bring back unknown problems (0663569) + * Fix some Windows 7 incompatibility (2d2bdd1) + * Remove enabled from the crashlogs (5b7d318) + * Make index unzipping async (7c582f1) + * Fix mods by developer crashing when mod was toggled (a6a47bf) + * Fix nested lists in the markdown (2723588) + ## v1.3.1 * Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d) diff --git a/VERSION b/VERSION index 6261a05b..d5e98f72 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.3.2 \ No newline at end of file From aa55ebe8aa2920968c0262305f647dbf072f0db0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:01:45 +0300 Subject: [PATCH 028/270] fix search paths - season 1 episode 4 --- loader/src/loader/ModImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 6ffacdc0..73849f7a 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -43,7 +43,8 @@ Result<> Mod::Impl::setup() { log::warn("Unable to load data for \"{}\": {}", m_metadata.getID(), loadRes.unwrapErr()); } if (!m_resourcesLoaded) { - LoaderImpl::get()->updateModResources(m_self); + auto searchPathRoot = dirs::getModRuntimeDir() / m_metadata.getID() / "resources"; + CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); m_resourcesLoaded = true; } From 9498ae23d1bb4f81237abdc7018e8d809cb15416 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:02:47 +0300 Subject: [PATCH 029/270] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62ac6b63..f454003e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Make index unzipping async (7c582f1) * Fix mods by developer crashing when mod was toggled (a6a47bf) * Fix nested lists in the markdown (2723588) + * Fix search paths (8f39c38, aa55ebe) ## v1.3.1 * Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d) From e9502be4235b5d42dba2a3723e3546fe509b4062 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:14:08 +0300 Subject: [PATCH 030/270] github actions test --- cmake/GeodeFile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 4c7efaff..f44b7d26 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -307,6 +307,8 @@ function(package_geode_resources_now proname src dest header_dest) if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_HASH EQUAL -1) file(SHA256 ${file} COMPUTED_HASH) + file(SIZE ${file} FILE_SIZE) + message(STATUS "Hashed ${file} to ${COMPUTED_HASH} (${FILE_SIZE} bytes)") list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n") # list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n") From 5856f5fde080e89c55c2ef71dafa4accc2d1c9a9 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:38:11 +0300 Subject: [PATCH 031/270] Trying to fix hashes by enforcing LF --- .gitignore | 17 +++++++++++++---- loader/CMakeLists.txt | 7 +++++-- loader/resources/{about.md => about.md.in} | 0 loader/resources/{support.md => support.md.in} | 0 loader/src/loader/LoaderImpl.hpp | 1 - loader/src/ui/internal/info/ModInfoPopup.cpp | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) rename loader/resources/{about.md => about.md.in} (100%) rename loader/resources/{support.md => support.md.in} (100%) diff --git a/.gitignore b/.gitignore index 6149f067..e8badae0 100644 --- a/.gitignore +++ b/.gitignore @@ -45,20 +45,29 @@ build2 build-docs/ bin +# Ignore docs folders docs/** docs +# Ignore codegenned files loader/src/internal/about.hpp loader/src/internal/resources.hpp loader/resources/mod.json loader/resources/version loader/resources/blanks/rename.js +loader/resources/about.md loader/resources/changelog.md +loader/resources/support.md + +# Ignore generated files +installer/mac/*.pkg +installer/windows/*.exe + +# Ignore fod's include directories which are stored in this funny file fods-catgirl-hideout.txt + +# Ignore I don't even know what that is probably fod's flash testing script test-docs.bat -# krita files too because alk is funny +# Ignore krita files too because we don't want our project files shaking my head **/*.kra - -installer/mac/*.pkg -installer/windows/*.exe \ No newline at end of file diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 4258f77a..422bf8d5 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -27,10 +27,13 @@ execute_process( ) # Package info file for internal representation +set(GEODE_RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources) configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json) file(READ resources/mod.json LOADER_MOD_JSON) -configure_file(${GEODE_ROOT_PATH}/VERSION ${CMAKE_CURRENT_SOURCE_DIR}/resources/version COPYONLY) -configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${CMAKE_CURRENT_SOURCE_DIR}/resources/changelog.md COPYONLY) +configure_file(${GEODE_ROOT_PATH}/VERSION ${GEODE_RESOURCES_PATH}/version COPYONLY) +configure_file(${GEODE_RESOURCES_PATH}/about.md.in ${GEODE_RESOURCES_PATH}/about.md NEWLINE_STYLE LF) +configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${GEODE_RESOURCES_PATH}/changelog.md NEWLINE_STYLE LF) +configure_file(${GEODE_RESOURCES_PATH}/support.md.in ${GEODE_RESOURCES_PATH}/support.md NEWLINE_STYLE LF) configure_file(src/internal/about.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.hpp) # Source files diff --git a/loader/resources/about.md b/loader/resources/about.md.in similarity index 100% rename from loader/resources/about.md rename to loader/resources/about.md.in diff --git a/loader/resources/support.md b/loader/resources/support.md.in similarity index 100% rename from loader/resources/support.md rename to loader/resources/support.md.in diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index 92468f2a..38d618eb 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -13,7 +13,6 @@ #include #include #include "ModImpl.hpp" -#include #include #include #include diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 1ec147d1..10c0ab37 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -4,6 +4,7 @@ #include "../list/ModListLayer.hpp" #include "../settings/ModSettingsPopup.hpp" #include +#include #include #include From fda43ec617e59829f466fbded9607921ca02316c Mon Sep 17 00:00:00 2001 From: qimiko <25387744+qimiko@users.noreply.github.com> Date: Sat, 16 Sep 2023 03:53:24 -0700 Subject: [PATCH 032/270] fix web request crash --- cmake/Platform.cmake | 2 +- loader/src/utils/web.cpp | 1200 +++++++++++++++++++------------------- 2 files changed, 597 insertions(+), 605 deletions(-) diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 22602b4b..cf5d4241 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -78,10 +78,10 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Android") ) target_link_libraries(${PROJECT_NAME} INTERFACE - ${GEODE_LOADER_PATH}/include/link/android/libcocos2dcpp.so ${GEODE_LOADER_PATH}/include/link/android/libcurl.a ${GEODE_LOADER_PATH}/include/link/android/libssl.a ${GEODE_LOADER_PATH}/include/link/android/libcrypto.a + ${GEODE_LOADER_PATH}/include/link/android/libcocos2dcpp.so log ) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 08d77846..f7da4fc3 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -1,604 +1,596 @@ -#include -#include -#include -#include -#include -#include - -using namespace geode::prelude; -using namespace web; - -namespace geode::utils::fetch { - static size_t writeBytes(char* data, size_t size, size_t nmemb, void* str) { - as(str)->insert(as(str)->end(), data, data + size * nmemb); - return size * nmemb; - } - - static size_t writeString(char* data, size_t size, size_t nmemb, void* str) { - as(str)->append(data, size * nmemb); - return size * nmemb; - } - - static size_t writeBinaryData(char* data, size_t size, size_t nmemb, void* file) { - as(file)->write(data, size * nmemb); - return size * nmemb; - } - - static int progress(void* ptr, double total, double now, double, double) { - return (*as(ptr))(now, total) != true; - } -} - -Result<> web::fetchFile( - std::string const& url, ghc::filesystem::path const& into, FileProgressCallback prog -) { - return Err("Not implemented"); - - auto curl = curl_easy_init(); - - if (!curl) return Err("Curl not initialized!"); - - std::ofstream file(into, std::ios::out | std::ios::binary); - - if (!file.is_open()) { - return Err("Unable to open output file"); - } - - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &file); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - if (prog) { - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, utils::fetch::progress); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); - } - auto res = curl_easy_perform(curl); - if (res != CURLE_OK) { - curl_easy_cleanup(curl); - return Err("Fetch failed: " + std::string(curl_easy_strerror(res))); - } - - char* ct; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - if ((res == CURLE_OK) && ct) { - curl_easy_cleanup(curl); - return Ok(); - } - curl_easy_cleanup(curl); - return Err("Error getting info: " + std::string(curl_easy_strerror(res))); -} - -Result web::fetchBytes(std::string const& url) { - return Err("Not implemented"); - - auto curl = curl_easy_init(); - - if (!curl) return Err("Curl not initialized!"); - - ByteVector ret; - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); - auto res = curl_easy_perform(curl); - if (res != CURLE_OK) { - curl_easy_cleanup(curl); - return Err("Fetch failed"); - } - - char* ct; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - if ((res == CURLE_OK) && ct) { - curl_easy_cleanup(curl); - return Ok(ret); - } - curl_easy_cleanup(curl); - return Err("Error getting info: " + std::string(curl_easy_strerror(res))); -} - -Result web::fetchJSON(std::string const& url) { - std::string res; - GEODE_UNWRAP_INTO(res, fetch(url)); - try { - return Ok(json::parse(res)); - } - catch (std::exception& e) { - return Err(e.what()); - } -} - -Result web::fetch(std::string const& url) { - return Err("Not implemented"); - - auto curl = curl_easy_init(); - - if (!curl) return Err("Curl not initialized!"); - - std::string ret; - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeString); - auto res = curl_easy_perform(curl); - if (res != CURLE_OK) { - curl_easy_cleanup(curl); - return Err("Fetch failed"); - } - - char* ct; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - if ((res == CURLE_OK) && ct) { - curl_easy_cleanup(curl); - return Ok(ret); - } - curl_easy_cleanup(curl); - return Err("Error getting info: " + std::string(curl_easy_strerror(res))); -} - -class SentAsyncWebRequest::Impl { -private: - enum class Status { - Paused, - Running, - Finished, - Cancelled, - CleanedUp, - }; - std::string m_id; - std::string m_url; - std::vector m_thens; - std::vector m_expects; - std::vector m_progresses; - std::vector m_cancelleds; - Status m_status = Status::Paused; - std::atomic m_paused = true; - std::atomic m_cancelled = false; - std::atomic m_finished = false; - std::atomic m_cleanedUp = false; - std::condition_variable m_statusCV; - std::mutex m_statusMutex; - SentAsyncWebRequest* m_self; - - mutable std::mutex m_mutex; - AsyncWebRequestData m_extra; - std::variant m_target; - std::vector m_httpHeaders; - - - template - friend class AsyncWebResult; - friend class AsyncWebRequest; - - void pause(); - void resume(); - void error(std::string const& error, int code); - void doCancel(); - -public: - Impl(SentAsyncWebRequest* self, AsyncWebRequest const&, std::string const& id); - void cancel(); - bool finished() const; - - friend class SentAsyncWebRequest; -}; - -static std::unordered_map RUNNING_REQUESTS{}; -static std::mutex RUNNING_REQUESTS_MUTEX; - -SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const& req, std::string const& id) : - m_id(id), m_url(req.m_url), m_target(req.m_target), m_extra(req.extra()), m_httpHeaders(req.m_httpHeaders) { - -#define AWAIT_RESUME() \ - {\ - auto lock = std::unique_lock(m_statusMutex);\ - m_statusCV.wait(lock, [this]() { \ - return !m_paused; \ - });\ - if (m_cancelled) {\ - this->doCancel();\ - return;\ - }\ - }\ - - if (req.m_then) m_thens.push_back(req.m_then); - if (req.m_progress) m_progresses.push_back(req.m_progress); - if (req.m_cancelled) m_cancelleds.push_back(req.m_cancelled); - if (req.m_expect) m_expects.push_back(req.m_expect); - - std::thread([this]() { - AWAIT_RESUME(); - - return this->error("Not implemented", -1); - - auto curl = curl_easy_init(); - if (!curl) { - return this->error("Curl not initialized", -1); - } - - log::debug("curl init {}", curl); - - // resulting byte array - ByteVector ret; - // output file if downloading to file. unique_ptr because not always - // initialized but don't wanna manually managed memory - std::unique_ptr file = nullptr; - - // into file - if (std::holds_alternative(m_target)) { - file = std::make_unique( - std::get(m_target), std::ios::out | std::ios::binary - ); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, file.get()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); - } - // into stream - else if (std::holds_alternative(m_target)) { - curl_easy_setopt(curl, CURLOPT_WRITEDATA, std::get(m_target)); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); - } - // into memory - else { - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); - } - curl_easy_setopt(curl, CURLOPT_URL, m_url.c_str()); - // No need to verify SSL, we trust our domains :-) - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); - // User Agent - curl_easy_setopt(curl, CURLOPT_USERAGENT, m_extra.m_userAgent.c_str()); - - // Headers - curl_slist* headers = nullptr; - for (auto& header : m_httpHeaders) { - headers = curl_slist_append(headers, header.c_str()); - } - - // Post request - if (m_extra.m_isPostRequest || m_extra.m_customRequest.size()) { - if (m_extra.m_isPostRequest) { - curl_easy_setopt(curl, CURLOPT_POST, 1L); - } - else { - curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, m_extra.m_customRequest.c_str()); - } - if (m_extra.m_isJsonRequest) { - headers = curl_slist_append(headers, "Content-Type: application/json"); - } - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, m_extra.m_postFields.c_str()); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, m_extra.m_postFields.size()); - } - - // Track progress - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - // Follow redirects - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - // Fail if response code is 4XX or 5XX - curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); - - // Headers end - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - - struct ProgressData { - SentAsyncWebRequest::Impl* self; - std::ofstream* file; - } data{this, file.get()}; - - curl_easy_setopt( - curl, - CURLOPT_PROGRESSFUNCTION, - +[](void* ptr, double total, double now, double, double) -> int { - auto data = static_cast(ptr); - auto lock = std::unique_lock(data->self->m_statusMutex); - data->self->m_statusCV.wait(lock, [data]() { - return !data->self->m_paused; - }); - if (data->self->m_cancelled) { - if (data->file) { - data->file->close(); - } - return 1; - } - Loader::get()->queueInMainThread([self = data->self, now, total]() { - std::lock_guard _(self->m_mutex); - for (auto& prog : self->m_progresses) { - prog(*self->m_self, now, total); - } - }); - return 0; - } - ); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); - log::debug("curl opts"); - auto res = curl_easy_perform(curl); - log::debug("curl perform"); - - if (res != CURLE_OK) { - long code = 0; - log::debug("curl fail"); - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); - log::debug("curl cleanup"); - curl_easy_cleanup(curl); - log::debug("end"); - return this->error("Fetch failed: " + std::string(curl_easy_strerror(res)), code); - } - log::debug("curl cleanup 2"); - curl_easy_cleanup(curl); - - log::debug("end 2"); - - AWAIT_RESUME(); - - log::debug("end 3"); - - // if something is still holding a handle to this - // request, then they may still cancel it - m_finished = true; - - Loader::get()->queueInMainThread([this, ret]() { - std::lock_guard _(m_mutex); - for (auto& then : m_thens) { - then(*m_self, ret); - } - std::lock_guard __(RUNNING_REQUESTS_MUTEX); - RUNNING_REQUESTS.erase(m_id); - }); - }).detach(); -} - -void SentAsyncWebRequest::Impl::doCancel() { - if (m_cleanedUp) return; - m_cleanedUp = true; - - // remove file if downloaded to one - if (std::holds_alternative(m_target)) { - auto path = std::get(m_target); - if (ghc::filesystem::exists(path)) { - try { - ghc::filesystem::remove(path); - } - catch (...) { - } - } - } - - Loader::get()->queueInMainThread([this]() { - std::lock_guard _(m_mutex); - for (auto& canc : m_cancelleds) { - canc(*m_self); - } - }); - - this->error("Request cancelled", -1); -} - -void SentAsyncWebRequest::Impl::cancel() { - m_cancelled = true; - // if already finished, cancel anyway to clean up - if (m_finished) { - this->doCancel(); - } -} - -void SentAsyncWebRequest::Impl::pause() { - m_paused = true; - m_statusCV.notify_all(); -} - -void SentAsyncWebRequest::Impl::resume() { - m_paused = false; - m_statusCV.notify_all(); -} - -bool SentAsyncWebRequest::Impl::finished() const { - return m_finished; -} - -void SentAsyncWebRequest::Impl::error(std::string const& error, int code) { - auto lock = std::unique_lock(m_statusMutex); - m_statusCV.wait(lock, [this]() { - return !m_paused; - }); - Loader::get()->queueInMainThread([this, error, code]() { - { - std::lock_guard _(m_mutex); - for (auto& expect : m_expects) { - expect(error, code); - } - } - std::lock_guard _(RUNNING_REQUESTS_MUTEX); - RUNNING_REQUESTS.erase(m_id); - }); -} - -SentAsyncWebRequest::SentAsyncWebRequest() : m_impl() {} -SentAsyncWebRequest::~SentAsyncWebRequest() {} - -std::shared_ptr SentAsyncWebRequest::create(AsyncWebRequest const& request, std::string const& id) { - auto ret = std::make_shared(); - ret->m_impl = std::move(std::make_shared(ret.get(), request, id)); - return ret; -} -void SentAsyncWebRequest::doCancel() { - return m_impl->doCancel(); -} - -void SentAsyncWebRequest::cancel() { - return m_impl->cancel(); -} - -void SentAsyncWebRequest::pause() { - return m_impl->pause(); -} - -void SentAsyncWebRequest::resume() { - return m_impl->resume(); -} - -bool SentAsyncWebRequest::finished() const { - return m_impl->finished(); -} - -void SentAsyncWebRequest::error(std::string const& error, int code) { - return m_impl->error(error, code); -} - -AsyncWebRequestData& AsyncWebRequest::extra() { - if (!m_extra) { - m_extra = new AsyncWebRequestData(); - } - return *m_extra; -} - -AsyncWebRequestData const& AsyncWebRequest::extra() const { - if (!m_extra) { - m_extra = new AsyncWebRequestData(); - } - return *m_extra; -} - -AsyncWebRequest& AsyncWebRequest::join(std::string const& requestID) { - m_joinID = requestID; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::userAgent(std::string const& userAgent) { - this->extra().m_userAgent = userAgent; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::postRequest() { - this->extra().m_isPostRequest = true; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::customRequest(std::string const& request) { - this->extra().m_customRequest = request; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::postFields(std::string const& fields) { - this->extra().m_postFields = fields; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::postFields(json::Value const& fields) { - this->extra().m_isJsonRequest = true; - return this->postFields(fields.dump()); -} - -AsyncWebRequest& AsyncWebRequest::header(std::string const& header) { - m_httpHeaders.push_back(header); - return *this; -} - -AsyncWebResponse AsyncWebRequest::fetch(std::string const& url) { - m_url = url; - return AsyncWebResponse(*this); -} - -AsyncWebRequest& AsyncWebRequest::expect(AsyncExpect handler) { - m_expect = [handler](std::string const& info, auto) { - return handler(info); - }; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::expect(AsyncExpectCode handler) { - m_expect = handler; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::progress(AsyncProgress progress) { - m_progress = progress; - return *this; -} - -AsyncWebRequest& AsyncWebRequest::cancelled(AsyncCancelled cancelledFunc) { - m_cancelled = cancelledFunc; - return *this; -} - -SentAsyncWebRequestHandle AsyncWebRequest::send() { - if (this->extra().m_sent) return nullptr; - this->extra().m_sent = true; - - std::lock_guard __(RUNNING_REQUESTS_MUTEX); - - // pause all running requests - for (auto& [_, req] : RUNNING_REQUESTS) { - req->pause(); - } - - SentAsyncWebRequestHandle ret; - - static size_t COUNTER = 0; - if (m_joinID && RUNNING_REQUESTS.count(m_joinID.value())) { - auto& req = RUNNING_REQUESTS.at(m_joinID.value()); - std::lock_guard _(req->m_impl->m_mutex); - if (m_then) req->m_impl->m_thens.push_back(m_then); - if (m_progress) req->m_impl->m_progresses.push_back(m_progress); - if (m_expect) req->m_impl->m_expects.push_back(m_expect); - if (m_cancelled) req->m_impl->m_cancelleds.push_back(m_cancelled); - ret = req; - } - else { - auto id = m_joinID.value_or("__anon_request_" + std::to_string(COUNTER++)); - ret = SentAsyncWebRequest::create(*this, id); - RUNNING_REQUESTS.insert({id, ret}); - } - - // resume all running requests - for (auto& [_, req] : RUNNING_REQUESTS) { - req->resume(); - } - - return ret; -} - -AsyncWebRequest::~AsyncWebRequest() { - this->send(); - delete m_extra; -} - -AsyncWebResult AsyncWebResponse::into(std::ostream& stream) { - m_request.m_target = &stream; - return this->as(+[](ByteVector const&) -> Result { - return Ok(std::monostate()); - }); -} - -AsyncWebResult AsyncWebResponse::into(ghc::filesystem::path const& path) { - m_request.m_target = path; - return this->as(+[](ByteVector const&) -> Result { - return Ok(std::monostate()); - }); -} - -AsyncWebResult AsyncWebResponse::text() { - return this->as(+[](ByteVector const& bytes) -> Result { - return Ok(std::string(bytes.begin(), bytes.end())); - }); -} - -AsyncWebResult AsyncWebResponse::bytes() { - return this->as(+[](ByteVector const& bytes) -> Result { - return Ok(bytes); - }); -} - -AsyncWebResult AsyncWebResponse::json() { - return this->as(+[](ByteVector const& bytes) -> Result { - try { - return Ok(json::parse(std::string(bytes.begin(), bytes.end()))); - } - catch (std::exception& e) { - return Err(std::string(e.what())); - } - }); -} +#include +#include +#include +#include +#include +#include + +using namespace geode::prelude; +using namespace web; + +namespace geode::utils::fetch { + static size_t writeBytes(char* data, size_t size, size_t nmemb, void* str) { + as(str)->insert(as(str)->end(), data, data + size * nmemb); + return size * nmemb; + } + + static size_t writeString(char* data, size_t size, size_t nmemb, void* str) { + as(str)->append(data, size * nmemb); + return size * nmemb; + } + + static size_t writeBinaryData(char* data, size_t size, size_t nmemb, void* file) { + as(file)->write(data, size * nmemb); + return size * nmemb; + } + + static int progress(void* ptr, double total, double now, double, double) { + return (*as(ptr))(now, total) != true; + } +} + +Result<> web::fetchFile( + std::string const& url, ghc::filesystem::path const& into, FileProgressCallback prog +) { + auto curl = curl_easy_init(); + + if (!curl) return Err("Curl not initialized!"); + + std::ofstream file(into, std::ios::out | std::ios::binary); + + if (!file.is_open()) { + return Err("Unable to open output file"); + } + + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &file); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + if (prog) { + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, utils::fetch::progress); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); + } + auto res = curl_easy_perform(curl); + if (res != CURLE_OK) { + curl_easy_cleanup(curl); + return Err("Fetch failed: " + std::string(curl_easy_strerror(res))); + } + + char* ct; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + if ((res == CURLE_OK) && ct) { + curl_easy_cleanup(curl); + return Ok(); + } + curl_easy_cleanup(curl); + return Err("Error getting info: " + std::string(curl_easy_strerror(res))); +} + +Result web::fetchBytes(std::string const& url) { + auto curl = curl_easy_init(); + + if (!curl) return Err("Curl not initialized!"); + + ByteVector ret; + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); + auto res = curl_easy_perform(curl); + if (res != CURLE_OK) { + curl_easy_cleanup(curl); + return Err("Fetch failed"); + } + + char* ct; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + if ((res == CURLE_OK) && ct) { + curl_easy_cleanup(curl); + return Ok(ret); + } + curl_easy_cleanup(curl); + return Err("Error getting info: " + std::string(curl_easy_strerror(res))); +} + +Result web::fetchJSON(std::string const& url) { + std::string res; + GEODE_UNWRAP_INTO(res, fetch(url)); + try { + return Ok(json::parse(res)); + } + catch (std::exception& e) { + return Err(e.what()); + } +} + +Result web::fetch(std::string const& url) { + auto curl = curl_easy_init(); + + if (!curl) return Err("Curl not initialized!"); + + std::string ret; + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeString); + auto res = curl_easy_perform(curl); + if (res != CURLE_OK) { + curl_easy_cleanup(curl); + return Err("Fetch failed"); + } + + char* ct; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + if ((res == CURLE_OK) && ct) { + curl_easy_cleanup(curl); + return Ok(ret); + } + curl_easy_cleanup(curl); + return Err("Error getting info: " + std::string(curl_easy_strerror(res))); +} + +class SentAsyncWebRequest::Impl { +private: + enum class Status { + Paused, + Running, + Finished, + Cancelled, + CleanedUp, + }; + std::string m_id; + std::string m_url; + std::vector m_thens; + std::vector m_expects; + std::vector m_progresses; + std::vector m_cancelleds; + Status m_status = Status::Paused; + std::atomic m_paused = true; + std::atomic m_cancelled = false; + std::atomic m_finished = false; + std::atomic m_cleanedUp = false; + std::condition_variable m_statusCV; + std::mutex m_statusMutex; + SentAsyncWebRequest* m_self; + + mutable std::mutex m_mutex; + AsyncWebRequestData m_extra; + std::variant m_target; + std::vector m_httpHeaders; + + + template + friend class AsyncWebResult; + friend class AsyncWebRequest; + + void pause(); + void resume(); + void error(std::string const& error, int code); + void doCancel(); + +public: + Impl(SentAsyncWebRequest* self, AsyncWebRequest const&, std::string const& id); + void cancel(); + bool finished() const; + + friend class SentAsyncWebRequest; +}; + +static std::unordered_map RUNNING_REQUESTS{}; +static std::mutex RUNNING_REQUESTS_MUTEX; + +SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const& req, std::string const& id) : + m_id(id), m_url(req.m_url), m_target(req.m_target), m_extra(req.extra()), m_httpHeaders(req.m_httpHeaders) { + +#define AWAIT_RESUME() \ + {\ + auto lock = std::unique_lock(m_statusMutex);\ + m_statusCV.wait(lock, [this]() { \ + return !m_paused; \ + });\ + if (m_cancelled) {\ + this->doCancel();\ + return;\ + }\ + }\ + + if (req.m_then) m_thens.push_back(req.m_then); + if (req.m_progress) m_progresses.push_back(req.m_progress); + if (req.m_cancelled) m_cancelleds.push_back(req.m_cancelled); + if (req.m_expect) m_expects.push_back(req.m_expect); + + std::thread([this]() { + AWAIT_RESUME(); + + auto curl = curl_easy_init(); + if (!curl) { + return this->error("Curl not initialized", -1); + } + + log::debug("curl init {}", curl); + + // resulting byte array + ByteVector ret; + // output file if downloading to file. unique_ptr because not always + // initialized but don't wanna manually managed memory + std::unique_ptr file = nullptr; + + // into file + if (std::holds_alternative(m_target)) { + file = std::make_unique( + std::get(m_target), std::ios::out | std::ios::binary + ); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, file.get()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); + } + // into stream + else if (std::holds_alternative(m_target)) { + curl_easy_setopt(curl, CURLOPT_WRITEDATA, std::get(m_target)); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBinaryData); + } + // into memory + else { + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); + } + curl_easy_setopt(curl, CURLOPT_URL, m_url.c_str()); + // No need to verify SSL, we trust our domains :-) + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + // User Agent + curl_easy_setopt(curl, CURLOPT_USERAGENT, m_extra.m_userAgent.c_str()); + + // Headers + curl_slist* headers = nullptr; + for (auto& header : m_httpHeaders) { + headers = curl_slist_append(headers, header.c_str()); + } + + // Post request + if (m_extra.m_isPostRequest || m_extra.m_customRequest.size()) { + if (m_extra.m_isPostRequest) { + curl_easy_setopt(curl, CURLOPT_POST, 1L); + } + else { + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, m_extra.m_customRequest.c_str()); + } + if (m_extra.m_isJsonRequest) { + headers = curl_slist_append(headers, "Content-Type: application/json"); + } + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, m_extra.m_postFields.c_str()); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, m_extra.m_postFields.size()); + } + + // Track progress + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + // Follow redirects + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + // Fail if response code is 4XX or 5XX + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); + + // Headers end + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + struct ProgressData { + SentAsyncWebRequest::Impl* self; + std::ofstream* file; + } data{this, file.get()}; + + curl_easy_setopt( + curl, + CURLOPT_PROGRESSFUNCTION, + +[](void* ptr, double total, double now, double, double) -> int { + auto data = static_cast(ptr); + auto lock = std::unique_lock(data->self->m_statusMutex); + data->self->m_statusCV.wait(lock, [data]() { + return !data->self->m_paused; + }); + if (data->self->m_cancelled) { + if (data->file) { + data->file->close(); + } + return 1; + } + Loader::get()->queueInMainThread([self = data->self, now, total]() { + std::lock_guard _(self->m_mutex); + for (auto& prog : self->m_progresses) { + prog(*self->m_self, now, total); + } + }); + return 0; + } + ); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); + log::debug("curl opts"); + auto res = curl_easy_perform(curl); + log::debug("curl perform"); + + if (res != CURLE_OK) { + long code = 0; + log::debug("curl fail"); + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); + log::debug("curl cleanup"); + curl_easy_cleanup(curl); + log::debug("end"); + return this->error("Fetch failed: " + std::string(curl_easy_strerror(res)), code); + } + log::debug("curl cleanup 2"); + curl_easy_cleanup(curl); + + log::debug("end 2"); + + AWAIT_RESUME(); + + log::debug("end 3"); + + // if something is still holding a handle to this + // request, then they may still cancel it + m_finished = true; + + Loader::get()->queueInMainThread([this, ret]() { + std::lock_guard _(m_mutex); + for (auto& then : m_thens) { + then(*m_self, ret); + } + std::lock_guard __(RUNNING_REQUESTS_MUTEX); + RUNNING_REQUESTS.erase(m_id); + }); + }).detach(); +} + +void SentAsyncWebRequest::Impl::doCancel() { + if (m_cleanedUp) return; + m_cleanedUp = true; + + // remove file if downloaded to one + if (std::holds_alternative(m_target)) { + auto path = std::get(m_target); + if (ghc::filesystem::exists(path)) { + try { + ghc::filesystem::remove(path); + } + catch (...) { + } + } + } + + Loader::get()->queueInMainThread([this]() { + std::lock_guard _(m_mutex); + for (auto& canc : m_cancelleds) { + canc(*m_self); + } + }); + + this->error("Request cancelled", -1); +} + +void SentAsyncWebRequest::Impl::cancel() { + m_cancelled = true; + // if already finished, cancel anyway to clean up + if (m_finished) { + this->doCancel(); + } +} + +void SentAsyncWebRequest::Impl::pause() { + m_paused = true; + m_statusCV.notify_all(); +} + +void SentAsyncWebRequest::Impl::resume() { + m_paused = false; + m_statusCV.notify_all(); +} + +bool SentAsyncWebRequest::Impl::finished() const { + return m_finished; +} + +void SentAsyncWebRequest::Impl::error(std::string const& error, int code) { + auto lock = std::unique_lock(m_statusMutex); + m_statusCV.wait(lock, [this]() { + return !m_paused; + }); + Loader::get()->queueInMainThread([this, error, code]() { + { + std::lock_guard _(m_mutex); + for (auto& expect : m_expects) { + expect(error, code); + } + } + std::lock_guard _(RUNNING_REQUESTS_MUTEX); + RUNNING_REQUESTS.erase(m_id); + }); +} + +SentAsyncWebRequest::SentAsyncWebRequest() : m_impl() {} +SentAsyncWebRequest::~SentAsyncWebRequest() {} + +std::shared_ptr SentAsyncWebRequest::create(AsyncWebRequest const& request, std::string const& id) { + auto ret = std::make_shared(); + ret->m_impl = std::move(std::make_shared(ret.get(), request, id)); + return ret; +} +void SentAsyncWebRequest::doCancel() { + return m_impl->doCancel(); +} + +void SentAsyncWebRequest::cancel() { + return m_impl->cancel(); +} + +void SentAsyncWebRequest::pause() { + return m_impl->pause(); +} + +void SentAsyncWebRequest::resume() { + return m_impl->resume(); +} + +bool SentAsyncWebRequest::finished() const { + return m_impl->finished(); +} + +void SentAsyncWebRequest::error(std::string const& error, int code) { + return m_impl->error(error, code); +} + +AsyncWebRequestData& AsyncWebRequest::extra() { + if (!m_extra) { + m_extra = new AsyncWebRequestData(); + } + return *m_extra; +} + +AsyncWebRequestData const& AsyncWebRequest::extra() const { + if (!m_extra) { + m_extra = new AsyncWebRequestData(); + } + return *m_extra; +} + +AsyncWebRequest& AsyncWebRequest::join(std::string const& requestID) { + m_joinID = requestID; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::userAgent(std::string const& userAgent) { + this->extra().m_userAgent = userAgent; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::postRequest() { + this->extra().m_isPostRequest = true; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::customRequest(std::string const& request) { + this->extra().m_customRequest = request; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::postFields(std::string const& fields) { + this->extra().m_postFields = fields; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::postFields(json::Value const& fields) { + this->extra().m_isJsonRequest = true; + return this->postFields(fields.dump()); +} + +AsyncWebRequest& AsyncWebRequest::header(std::string const& header) { + m_httpHeaders.push_back(header); + return *this; +} + +AsyncWebResponse AsyncWebRequest::fetch(std::string const& url) { + m_url = url; + return AsyncWebResponse(*this); +} + +AsyncWebRequest& AsyncWebRequest::expect(AsyncExpect handler) { + m_expect = [handler](std::string const& info, auto) { + return handler(info); + }; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::expect(AsyncExpectCode handler) { + m_expect = handler; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::progress(AsyncProgress progress) { + m_progress = progress; + return *this; +} + +AsyncWebRequest& AsyncWebRequest::cancelled(AsyncCancelled cancelledFunc) { + m_cancelled = cancelledFunc; + return *this; +} + +SentAsyncWebRequestHandle AsyncWebRequest::send() { + if (this->extra().m_sent) return nullptr; + this->extra().m_sent = true; + + std::lock_guard __(RUNNING_REQUESTS_MUTEX); + + // pause all running requests + for (auto& [_, req] : RUNNING_REQUESTS) { + req->pause(); + } + + SentAsyncWebRequestHandle ret; + + static size_t COUNTER = 0; + if (m_joinID && RUNNING_REQUESTS.count(m_joinID.value())) { + auto& req = RUNNING_REQUESTS.at(m_joinID.value()); + std::lock_guard _(req->m_impl->m_mutex); + if (m_then) req->m_impl->m_thens.push_back(m_then); + if (m_progress) req->m_impl->m_progresses.push_back(m_progress); + if (m_expect) req->m_impl->m_expects.push_back(m_expect); + if (m_cancelled) req->m_impl->m_cancelleds.push_back(m_cancelled); + ret = req; + } + else { + auto id = m_joinID.value_or("__anon_request_" + std::to_string(COUNTER++)); + ret = SentAsyncWebRequest::create(*this, id); + RUNNING_REQUESTS.insert({id, ret}); + } + + // resume all running requests + for (auto& [_, req] : RUNNING_REQUESTS) { + req->resume(); + } + + return ret; +} + +AsyncWebRequest::~AsyncWebRequest() { + this->send(); + delete m_extra; +} + +AsyncWebResult AsyncWebResponse::into(std::ostream& stream) { + m_request.m_target = &stream; + return this->as(+[](ByteVector const&) -> Result { + return Ok(std::monostate()); + }); +} + +AsyncWebResult AsyncWebResponse::into(ghc::filesystem::path const& path) { + m_request.m_target = path; + return this->as(+[](ByteVector const&) -> Result { + return Ok(std::monostate()); + }); +} + +AsyncWebResult AsyncWebResponse::text() { + return this->as(+[](ByteVector const& bytes) -> Result { + return Ok(std::string(bytes.begin(), bytes.end())); + }); +} + +AsyncWebResult AsyncWebResponse::bytes() { + return this->as(+[](ByteVector const& bytes) -> Result { + return Ok(bytes); + }); +} + +AsyncWebResult AsyncWebResponse::json() { + return this->as(+[](ByteVector const& bytes) -> Result { + try { + return Ok(json::parse(std::string(bytes.begin(), bytes.end()))); + } + catch (std::exception& e) { + return Err(std::string(e.what())); + } + }); +} From 81de161b3e112e47ad283a20fe3ce1305604c8f8 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:09:05 +0300 Subject: [PATCH 033/270] reunify resources.zip --- .github/workflows/build.yml | 13 ++----------- .github/workflows/draft.yml | 6 ++---- loader/src/loader/LoaderImpl.cpp | 4 ++-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8597aa34..ab892a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,19 +146,11 @@ jobs: files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb dest: geode-${{ steps.ref.outputs.hash }}-win.zip - # TODO change in 2.0.0 - name: Zip Windows Resources - uses: vimtor/action-zip@v1.1 - with: - files: geode-win/resources - dest: resources-win.zip - - # This is basically a hack because of line endings. Blame windows. - - name: Zip MacOS Resources uses: vimtor/action-zip@v1.1 with: files: geode-mac/resources - dest: resources-mac.zip + dest: resources.zip - name: Update Nightly Release uses: andelf/nightly-release@main @@ -174,5 +166,4 @@ jobs: ./geode-installer-${{ steps.ref.outputs.hash }}-win.exe ./geode-${{ steps.ref.outputs.hash }}-mac.zip ./geode-${{ steps.ref.outputs.hash }}-win.zip - ./resources-win.zip - ./resources-mac.zip + ./resources.zip diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index 34f757d2..d6051f79 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -28,8 +28,7 @@ jobs: mv dev/geode-installer-*-win.exe geode-installer-v${{ steps.ref.outputs.version }}-win.exe mv dev/geode-*-mac.zip geode-v${{ steps.ref.outputs.version }}-mac.zip mv dev/geode-*-win.zip geode-v${{ steps.ref.outputs.version }}-win.zip - mv dev/resources-win.zip resources-win.zip - mv dev/resources-mac.zip resources-mac.zip + mv dev/resources.zip resources.zip - name: Create Draft Release uses: softprops/action-gh-release@v1 @@ -49,5 +48,4 @@ jobs: ./geode-installer-v${{ steps.ref.outputs.version }}-win.exe ./geode-v${{ steps.ref.outputs.version }}-mac.zip ./geode-v${{ steps.ref.outputs.version }}-win.zip - ./resources-win.zip - ./resources-mac.zip + ./resources.zip diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 197676f5..52727ff0 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -777,7 +777,7 @@ void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { .json() .then([this](json::Value const& json) { this->tryDownloadLoaderResources(fmt::format( - "https://github.com/geode-sdk/geode/releases/download/{}/resources-" GEODE_PLATFORM_SHORT_IDENTIFIER ".zip", + "https://github.com/geode-sdk/geode/releases/download/{}/resources.zip", this->getVersion().toString() ), true); }) @@ -805,7 +805,7 @@ void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { // find release asset for (auto asset : root.needs("assets").iterate()) { auto obj = asset.obj(); - if (obj.needs("name").template get() == "resources-" GEODE_PLATFORM_SHORT_IDENTIFIER ".zip") { + if (obj.needs("name").template get() == "resources.zip") { this->tryDownloadLoaderResources( obj.needs("browser_download_url").template get(), false From 444fd0b2c152989eb2a83ded461a4d529562cb59 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:10:06 +0300 Subject: [PATCH 034/270] Update version and changelog --- CHANGELOG.md | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f454003e..307f1b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Geode Changelog +## v1.3.3 + * Reunify resources.zip (81de161) + ## v1.3.2 * Fix alignment of some textures (8f39c38) * Bring back unknown problems (0663569) diff --git a/VERSION b/VERSION index d5e98f72..785cda80 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.2 \ No newline at end of file +1.3.3 \ No newline at end of file From 2e7a30597022d752cfe27233d47a8bf4cb19480f Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 16 Sep 2023 14:19:31 +0300 Subject: [PATCH 035/270] fix job names in build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab892a8c..a0cdd586 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,13 +146,13 @@ jobs: files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb dest: geode-${{ steps.ref.outputs.hash }}-win.zip - - name: Zip Windows Resources + - name: Zip Resources uses: vimtor/action-zip@v1.1 with: files: geode-mac/resources dest: resources.zip - - name: Update Nightly Release + - name: Update Development Release uses: andelf/nightly-release@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e070fba8cbed2947a0ce3b31a2ef1cfd37e862bf Mon Sep 17 00:00:00 2001 From: qimiko <25387744+qimiko@users.noreply.github.com> Date: Sat, 16 Sep 2023 04:52:34 -0700 Subject: [PATCH 036/270] remove hardcodes for directory --- loader/src/platform/android/util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 10eae65a..78d33be4 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -10,11 +10,11 @@ using namespace geode::prelude; #include ghc::filesystem::path dirs::getGameDir() { - return ghc::filesystem::path("/data/user/0/com.geode.launcher/files/"/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/); + return CCFileUtils::sharedFileUtils()->getWritablePath().c_str(); } ghc::filesystem::path dirs::getSaveDir() { - return ghc::filesystem::path("/data/user/0/com.geode.launcher/files/"/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/); + return CCFileUtils::sharedFileUtils()->getWritablePath().c_str(); } void utils::web::openLinkInBrowser(std::string const& url) { From ed46326159fb0b31861022b6779c1123b4f41dc0 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:58:46 +0300 Subject: [PATCH 037/270] I will calmly talk to whoever decided no break space to be alt + space --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 307f1b5a..64e9486b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## v1.3.3 * Reunify resources.zip (81de161) -## v1.3.2 +## v1.3.2 * Fix alignment of some textures (8f39c38) * Bring back unknown problems (0663569) * Fix some Windows 7 incompatibility (2d2bdd1) From 28480a6dc4e88f92f3a413dcc22c0402b061d162 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:38:14 +0300 Subject: [PATCH 038/270] download latest loader resource if folder doesnt exist and the version doesnt exist --- loader/src/loader/LoaderImpl.cpp | 119 +++++++++++++++---------------- 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index a339b222..c281e202 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -740,14 +740,12 @@ void Loader::Impl::tryDownloadLoaderResources( .expect([this, tryLatestOnError](std::string const& info, int code) { // if the url was not found, try downloading latest release instead // (for development versions) - if (code == 404 && tryLatestOnError) { - this->downloadLoaderResources(true); - } - else { - ResourceDownloadEvent( - UpdateFailed("Unable to download resources: " + info) - ).post(); + if (code == 404) { + log::warn("Unable to download resources: {}", info); } + ResourceDownloadEvent( + UpdateFailed("Unable to download resources: " + info) + ).post(); }) .progress([](auto&, double now, double total) { ResourceDownloadEvent( @@ -768,65 +766,66 @@ void Loader::Impl::updateSpecialFiles() { } void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { - if (!useLatestRelease) { - web::AsyncWebRequest() - .join("loader-tag-exists-check") - .userAgent("github_api/1.0") - .fetch(fmt::format( - "https://api.github.com/repos/geode-sdk/geode/git/ref/tags/{}", + web::AsyncWebRequest() + .join("loader-tag-exists-check") + .userAgent("github_api/1.0") + .fetch(fmt::format( + "https://api.github.com/repos/geode-sdk/geode/git/ref/tags/{}", + this->getVersion().toString() + )) + .json() + .then([this](json::Value const& json) { + this->tryDownloadLoaderResources(fmt::format( + "https://github.com/geode-sdk/geode/releases/download/{}/resources.zip", this->getVersion().toString() - )) - .json() - .then([this](json::Value const& json) { - this->tryDownloadLoaderResources(fmt::format( - "https://github.com/geode-sdk/geode/releases/download/{}/resources.zip", - this->getVersion().toString() - ), true); - }) - .expect([this](std::string const& info, int code) { - if (code == 404) { - log::debug("Loader version {} does not exist on Github, not downloading the resources", this->getVersion().toString()); - ResourceDownloadEvent( - UpdateFinished() - ).post(); + ), true); + }) + .expect([=](std::string const& info, int code) { + if (code == 404) { + if (useLatestRelease) { + log::debug("Loader version {} does not exist on Github, downloading latest resources", this->getVersion().toString()); + fetchLatestGithubRelease( + [this](json::Value const& raw) { + auto json = raw; + JsonChecker checker(json); + auto root = checker.root("[]").obj(); + + // find release asset + for (auto asset : root.needs("assets").iterate()) { + auto obj = asset.obj(); + if (obj.needs("name").template get() == "resources.zip") { + this->tryDownloadLoaderResources( + obj.needs("browser_download_url").template get(), + false + ); + return; + } + } + + ResourceDownloadEvent( + UpdateFailed("Unable to find resources in latest GitHub release") + ).post(); + }, + [this](std::string const& info) { + ResourceDownloadEvent( + UpdateFailed("Unable to download resources: " + info) + ).post(); + } + ); } else { - ResourceDownloadEvent( - UpdateFailed("Unable to check if tag exists: " + info) - ).post(); + log::debug("Loader version {} does not exist on Github, not downloading the resources", this->getVersion().toString()); } - }); - } - else { - fetchLatestGithubRelease( - [this](json::Value const& raw) { - auto json = raw; - JsonChecker checker(json); - auto root = checker.root("[]").obj(); - - // find release asset - for (auto asset : root.needs("assets").iterate()) { - auto obj = asset.obj(); - if (obj.needs("name").template get() == "resources.zip") { - this->tryDownloadLoaderResources( - obj.needs("browser_download_url").template get(), - false - ); - return; - } - } - ResourceDownloadEvent( - UpdateFailed("Unable to find resources in latest GitHub release") - ).post(); - }, - [this](std::string const& info) { - ResourceDownloadEvent( - UpdateFailed("Unable to download resources: " + info) + UpdateFinished() ).post(); } - ); - } + else { + ResourceDownloadEvent( + UpdateFailed("Unable to check if tag exists: " + info) + ).post(); + } + }); } bool Loader::Impl::verifyLoaderResources() { @@ -844,7 +843,7 @@ bool Loader::Impl::verifyLoaderResources() { ghc::filesystem::is_directory(resourcesDir) )) { log::debug("Resources directory does not exist"); - this->downloadLoaderResources(); + this->downloadLoaderResources(true); return false; } From bf1d47244f4d6bc6cec681b16fbc02f029a926d0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:11:36 +0300 Subject: [PATCH 039/270] hardcode path utils to external for now --- loader/src/platform/android/util.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 78d33be4..37fdf550 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -10,11 +10,19 @@ using namespace geode::prelude; #include ghc::filesystem::path dirs::getGameDir() { - return CCFileUtils::sharedFileUtils()->getWritablePath().c_str(); + return ghc::filesystem::path( + "/storage/emulated/0/Android/data/com.geode.launcher/files/game" + // "/data/user/0/com.geode.launcher/files/" + /*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/ + ); } ghc::filesystem::path dirs::getSaveDir() { - return CCFileUtils::sharedFileUtils()->getWritablePath().c_str(); + return ghc::filesystem::path( + "/storage/emulated/0/Android/data/com.geode.launcher/files/save" + // "/data/user/0/com.geode.launcher/files/" + /*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/ + ); } void utils::web::openLinkInBrowser(std::string const& url) { From d33c508d482eee7effb3611c46e359b474c26e57 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:22:30 +0300 Subject: [PATCH 040/270] move unzipped to inside data --- loader/src/loader/Dirs.cpp | 4 ---- loader/src/platform/android/util.cpp | 7 +++++++ loader/src/platform/mac/util.mm | 4 ++++ loader/src/platform/windows/util.cpp | 4 ++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/loader/src/loader/Dirs.cpp b/loader/src/loader/Dirs.cpp index 7cb3ab7c..59aacc52 100644 --- a/loader/src/loader/Dirs.cpp +++ b/loader/src/loader/Dirs.cpp @@ -35,10 +35,6 @@ ghc::filesystem::path dirs::getModsSaveDir() { return getGeodeSaveDir() / "mods"; } -ghc::filesystem::path dirs::getModRuntimeDir() { - return dirs::getGeodeDir() / "unzipped"; -} - ghc::filesystem::path dirs::getModConfigDir() { return dirs::getGeodeDir() / "config"; } diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 37fdf550..8145a529 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -25,6 +25,13 @@ ghc::filesystem::path dirs::getSaveDir() { ); } +ghc::filesystem::path dirs::getModRuntimeDir() { + return ghc::filesystem::path( + "/data/user/0/com.geode.launcher/files/geode/unzipped" + ); + // return dirs::getGeodeDir() / "unzipped"; +} + void utils::web::openLinkInBrowser(std::string const& url) { CCApplication::sharedApplication()->openURL(url.c_str()); } diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index 6a100715..31111cfa 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -200,6 +200,10 @@ ghc::filesystem::path dirs::getSaveDir() { return path; } +ghc::filesystem::path dirs::getModRuntimeDir() { + return dirs::getGeodeDir() / "unzipped"; +} + void geode::utils::game::exit() { if (CCApplication::sharedApplication() && (GameManager::get()->m_playLayer || GameManager::get()->m_levelEditorLayer)) { diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index ee26861f..68e7ad52 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -158,6 +158,10 @@ ghc::filesystem::path dirs::getSaveDir() { return path; } +ghc::filesystem::path dirs::getModRuntimeDir() { + return dirs::getGeodeDir() / "unzipped"; +} + void geode::utils::game::exit() { if (CCApplication::sharedApplication() && (GameManager::get()->m_playLayer || GameManager::get()->m_levelEditorLayer)) { From b3ac20d2a7bda35f89ec33d4bbbf560b551c47f7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 19:03:31 +0300 Subject: [PATCH 041/270] fix resources again --- loader/src/hooks/LoadingLayer.cpp | 6 ++---- loader/src/loader/LoaderImpl.cpp | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index ca048b64..27c15824 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -29,6 +29,8 @@ struct CustomLoadingLayer : Modify { // hook bool init(bool fromReload) { + CCFileUtils::get()->updatePaths(); + if (!LoadingLayer::init(fromReload)) return false; auto winSize = CCDirector::sharedDirector()->getWinSize(); @@ -43,8 +45,6 @@ struct CustomLoadingLayer : Modify { } void setupLoadingMods() { - CCFileUtils::get()->updatePaths(); - if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) { this->updateLoadedModsLabel(); this->waitLoadAssets(); @@ -55,8 +55,6 @@ struct CustomLoadingLayer : Modify { } void setupLoaderResources() { - LoaderImpl::get()->addSearchPaths(); - // verify loader resources if (!LoaderImpl::get()->verifyLoaderResources()) { this->setSmallText("Downloading Loader Resources"); diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index c281e202..6baa2bd8 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -87,6 +87,8 @@ Result<> Loader::Impl::setup() { this->createDirectories(); + this->addSearchPaths(); + this->refreshModGraph(); m_isSetup = true; From 81078e2effbbacd1aaeb7124cee8613d6a184a3b Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:20:49 -0300 Subject: [PATCH 042/270] update tuliphook --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e53924f8..f1ebe0fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#41a18a1") +CPMAddPackage("gh:geode-sdk/TulipHook#f2bed6c") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies From 77a6f8685dbdba38915ea3a0948aeec03a1bb2e9 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:15:42 -0300 Subject: [PATCH 043/270] revert because im silly --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1ebe0fe..e53924f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#f2bed6c") +CPMAddPackage("gh:geode-sdk/TulipHook#41a18a1") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies From 45d3be890321be11f2e2d17b73bc32e02ba195e4 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:25:15 -0300 Subject: [PATCH 044/270] change these to createDirectoryAll --- loader/src/loader/LoaderImpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 6baa2bd8..44ae6c77 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -45,11 +45,11 @@ void Loader::Impl::createDirectories() { try { ghc::filesystem::remove_all(dirs::getModRuntimeDir()); } catch(...) {} (void) utils::file::createDirectoryAll(dirs::getGeodeResourcesDir()); - (void) utils::file::createDirectory(dirs::getModConfigDir()); - (void) utils::file::createDirectory(dirs::getModsDir()); - (void) utils::file::createDirectory(dirs::getGeodeLogDir()); - (void) utils::file::createDirectory(dirs::getTempDir()); - (void) utils::file::createDirectory(dirs::getModRuntimeDir()); + (void) utils::file::createDirectoryAll(dirs::getModConfigDir()); + (void) utils::file::createDirectoryAll(dirs::getModsDir()); + (void) utils::file::createDirectoryAll(dirs::getGeodeLogDir()); + (void) utils::file::createDirectoryAll(dirs::getTempDir()); + (void) utils::file::createDirectoryAll(dirs::getModRuntimeDir()); if (!ranges::contains(m_modSearchDirectories, dirs::getModsDir())) { m_modSearchDirectories.push_back(dirs::getModsDir()); From 418e1be2f62b51f581c2600ca6d3345e77891b84 Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sat, 16 Sep 2023 23:38:26 +0200 Subject: [PATCH 045/270] Replaced the unknown in Slider with the accurate name Note for other occurences, if it's a node and it has 2 floats as fields, 99% of the time it's rob adding the accurate width and height rather than fixing the content size --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d67e0028..8062f47d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5465,7 +5465,7 @@ class Slider : cocos2d::CCLayer { SliderTouchLogic* m_touchLogic; cocos2d::CCSprite* m_sliderBar; cocos2d::CCSprite* m_groove; - float m_unknown; + float m_width; float m_height; } From 1ab86bd5c12a5275752a883b66dfd7293cc0d85e Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sat, 16 Sep 2023 22:29:11 -0300 Subject: [PATCH 046/270] create temp ci script --- .github/workflows/build-android.yml | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/build-android.yml diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml new file mode 100644 index 00000000..d1502403 --- /dev/null +++ b/.github/workflows/build-android.yml @@ -0,0 +1,57 @@ +name: Build Android + +on: + workflow_dispatch: + push: + branches: + - '**' # every branch + - '!no-build-**' # unless marked as no-build + +jobs: + build: + name: Build Android + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r25c + add-to-path: false + + - name: Download CLI + uses: robinraju/release-downloader@v1.8 + with: + repository: geode-sdk/cli + latest: true + fileName: '*-linux.zip' + tarBall: false + zipBall: false + out-file-path: "cli" + + - name: Setup CLI + run: | + 7z x "${{ github.workspace }}/cli/*-linux.zip" -o"${{ github.workspace }}/cli" + chmod +x $GITHUB_WORKSPACE/cli/geode + echo "${{ github.workspace }}/cli" >> $GITHUB_PATH + + - name: Configure + env: + NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + ANDROID_ABI: armeabi-v7a + MIN_SDK_VERSION: 24 + run: | + sudo apt install ninja-build + cmake -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=android-$MIN_SDK_VERSION -DCMAKE_BUILD_TYPE=Debug -DGEODE_DONT_BUILD_TEST_MODS=1 -G Ninja -B build + + - name: Build + run: | + cmake --build build --config Debug + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: geode-android + path: ./bin/nightly/*.so From 23cd456860589eb6c3dd13891231dcf0a7b7ab24 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Sep 2023 14:23:13 -0300 Subject: [PATCH 047/270] fix CCNode::removeChildByID not being exported properly --- loader/include/Geode/cocos/base_nodes/CCNode.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/loader/include/Geode/cocos/base_nodes/CCNode.h b/loader/include/Geode/cocos/base_nodes/CCNode.h index 51817e3c..944001e0 100644 --- a/loader/include/Geode/cocos/base_nodes/CCNode.h +++ b/loader/include/Geode/cocos/base_nodes/CCNode.h @@ -700,12 +700,6 @@ public: * @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise. */ virtual void removeChildByTag(int tag, bool cleanup); - /** - * Removes a child from the container by its ID. - * @param id The ID of the node - * @note Geode addition - */ - void removeChildByID(std::string const& id); /** * Removes all children from the container with a cleanup. * @@ -890,6 +884,13 @@ public: */ GEODE_DLL CCNode* getChildByIDRecursive(std::string const& id); + /** + * Removes a child from the container by its ID. + * @param id The ID of the node + * @note Geode addition + */ + GEODE_DLL void removeChildByID(std::string const& id); + /** * Add a child before a specified existing child * @param child The node to add. The node may not be a child of another From 19b0f726340b206331a7f2e7dda1590ceeeeec3b Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Sep 2023 14:41:27 -0300 Subject: [PATCH 048/270] some stuff for rgb color input --- bindings/Cocos2d.bro | 15 +++++++++++---- bindings/GeometryDash.bro | 10 +++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index b4fe4069..61b8a093 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1165,16 +1165,23 @@ class cocos2d::extension::CCControl { auto isSelected() = mac 0x1a7ec0; } -[[link(win, android)]] + class cocos2d::extension::CCControlColourPicker { - CCControlColourPicker() {} + [[link(win)]] + CCControlColourPicker() {} + [[link(win)]] ~CCControlColourPicker() = mac 0x1aae30; - auto setColorValue(cocos2d::_ccColor3B const&) = mac 0x1aac10; + [[link(win, android)]] + auto setColorValue(cocos2d::_ccColor3B const&) = mac 0x1aac10; + [[link(win)]] auto ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x1aae10; + [[link(win)]] auto init() = mac 0x1aa400; + [[link(win)]] static auto colourPicker() = mac 0x1aaa30; + [[link(win)]] cocos2d::ccColor3B const& getColorValue() const { - return m_rgb; + return m_rgb; } } diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 1b35b0ed..3e3ef066 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -909,14 +909,14 @@ class ColorSelectPopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, int m_copyChannelID; bool m_copyOpacity; ConfigureHSVWidget* m_hsvWidget; - PAD = win 0x10, mac 0x10; + PAD = win 0x10, mac 0x10, android 0x10; cocos2d::CCArray* m_unk254; cocos2d::CCArray* m_unk258; CCTextInputNode* m_textInput2; - PAD = win 0x4, mac 0x8; + PAD = win 0x4, mac 0x8, android 0x4; CCMenuItemToggler* m_toggler3; CCMenuItemToggler* m_toggler4; - PAD = win 0x8, mac 0x10; + PAD = win 0x8, mac 0x10, android 0x8; cocos2d::CCArray* m_unk274; bool m_spawnTrigger; bool m_multiTrigger; @@ -5592,10 +5592,10 @@ class SetupPulsePopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, T cocos2d::extension::CCControlColourPicker* m_colorPicker; - PAD = win 0x30, mac 0x60; + PAD = win 0x30, mac 0x60, android 0x30; cocos2d::CCSprite* m_currentColorSpr; cocos2d::CCSprite* m_prevColorSpr; - PAD = win 0x64, mac 0xac; + PAD = win 0x64, mac 0xac, android 0x64; int m_pulseMode; // 0x38c on mac } From e7e5ee7f26d109373861eadcb34a04459c3d922e Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Sep 2023 15:01:34 -0300 Subject: [PATCH 049/270] add some opengl functions here, for now --- loader/CMakeLists.txt | 5 +++++ loader/src/platform/android/main.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 422bf8d5..50f844e1 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -149,6 +149,11 @@ if (APPLE) file(COPY ${GEODE_LOADER_PATH}/include/link/libfmod.dylib DESTINATION ${GEODE_BIN_PATH}/nightly) endif() +if (ANDROID) + # needed to define some opengl functions + target_link_libraries(${PROJECT_NAME} EGL) +endif() + target_include_directories(${PROJECT_NAME} PRIVATE src/ src/loader/ diff --git a/loader/src/platform/android/main.cpp b/loader/src/platform/android/main.cpp index 5f669411..3fd948b8 100644 --- a/loader/src/platform/android/main.cpp +++ b/loader/src/platform/android/main.cpp @@ -5,7 +5,17 @@ #include "../load.hpp" #include +// idk where to put this +#include +PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOESEXT = 0; +PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOESEXT = 0; +PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOESEXT = 0; + extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* reserved) { + glGenVertexArraysOESEXT = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES"); + glBindVertexArrayOESEXT = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES"); + glDeleteVertexArraysOESEXT = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"); + geodeEntry(nullptr); return JNI_VERSION_1_1; } From 07c627825343b0ba8f7353c74c0147b1ce37a402 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 10:09:17 +0300 Subject: [PATCH 050/270] fix CCArrayExt::operator[] return type --- loader/include/Geode/utils/cocos.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index d8a66905..edc4fd2e 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -953,7 +953,7 @@ namespace geode::cocos { return m_arr ? m_arr->count() : 0; } - T operator[](size_t index) { + T* operator[](size_t index) { return static_cast(m_arr->objectAtIndex(index)); } From ca4010e3e3364b612aa9e750618c9fe5da91034b Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 15:40:04 +0300 Subject: [PATCH 051/270] ccGLBindTexture2DN, macNumberOfDraws, ccIncrementGLDraws --- bindings/Cocos2d.bro | 5 +++++ loader/include/Geode/cocos/include/ccMacros.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4d1d2dab..8a2f037b 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1256,10 +1256,15 @@ class cocos2d { static auto ccDrawSolidRect(cocos2d::CCPoint, cocos2d::CCPoint, cocos2d::_ccColor4F) = mac 0xecf00; static auto ccGLEnableVertexAttribs(unsigned int) = mac 0x1ae740; static auto ccGLBindTexture2D(GLuint) = mac 0x1ae610; + static auto ccGLBindTexture2DN(GLuint, GLuint) = mac 0x1ae650; static float ccpDistance(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0x1aaf90; static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; + + static uintptr_t macNumberOfDraws() { + return geode::base::get() + 0x69ae90; + } } [[link(win)]] diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index 0c98e27a..e2e61514 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -247,6 +247,13 @@ It should work same as apples CFSwapInt32LittleToHost(..) */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ +static inline GEODE_INLINE void ccIncrementGLDraws(int n) { +#ifdef GEODE_IS_MACOS + *reinterpret_cast(macNumberOfDraws()) += n; +#else + CC_INCREMENT_GL_DRAWS(n); +#endif +} /*******************/ /** Notifications **/ From 2726a82e64543550be6ce02dfc60bbcbec05d93a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:15:45 +0300 Subject: [PATCH 052/270] Please Die --- loader/include/Geode/cocos/include/ccMacros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index e2e61514..ada46fa8 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -247,9 +247,9 @@ It should work same as apples CFSwapInt32LittleToHost(..) */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -static inline GEODE_INLINE void ccIncrementGLDraws(int n) { +static GEODE_INLINE void ccIncrementGLDraws(int n) { #ifdef GEODE_IS_MACOS - *reinterpret_cast(macNumberOfDraws()) += n; + *reinterpret_cast(geode::cocos2d::macNumberOfDraws()) += n; #else CC_INCREMENT_GL_DRAWS(n); #endif From 264c9e4a6453b63b5eefbe67a9151bfbfe107a7f Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:18:55 +0300 Subject: [PATCH 053/270] bet its this --- loader/include/Geode/cocos/include/ccMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index ada46fa8..e18e2580 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -249,7 +249,7 @@ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ static GEODE_INLINE void ccIncrementGLDraws(int n) { #ifdef GEODE_IS_MACOS - *reinterpret_cast(geode::cocos2d::macNumberOfDraws()) += n; + *reinterpret_cast(cocos2d::macNumberOfDraws()) += n; #else CC_INCREMENT_GL_DRAWS(n); #endif From 7d1897dbd6c80f0c9a6e4e07cf0c5d8b3232a347 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:24:27 +0300 Subject: [PATCH 054/270] ifx hope --- bindings/Cocos2d.bro | 3 +++ loader/include/Geode/cocos/include/ccMacros.h | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 8a2f037b..4202a171 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1265,6 +1265,9 @@ class cocos2d { static uintptr_t macNumberOfDraws() { return geode::base::get() + 0x69ae90; } + static void CC_INCREMENT_GL_DRAWS(int n) { + *reinterpret_cast(macNumberOfDraws()) += n; + } } [[link(win)]] diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index e18e2580..b675bd7c 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -246,14 +246,9 @@ It should work same as apples CFSwapInt32LittleToHost(..) The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; +#ifndef GEODE_IS_MACOS #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -static GEODE_INLINE void ccIncrementGLDraws(int n) { -#ifdef GEODE_IS_MACOS - *reinterpret_cast(cocos2d::macNumberOfDraws()) += n; -#else - CC_INCREMENT_GL_DRAWS(n); #endif -} /*******************/ /** Notifications **/ From 07f3acb0f9bcc17a0c1bbb71c5a87ab8acb847d7 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:42:23 +0300 Subject: [PATCH 055/270] revert cc increment gl draws let someone else do it i dont have a mac to test --- bindings/Cocos2d.bro | 18 +++++++++++------- loader/include/Geode/cocos/include/ccMacros.h | 2 -- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4202a171..4a269ead 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1261,15 +1261,19 @@ class cocos2d { static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; - - static uintptr_t macNumberOfDraws() { - return geode::base::get() + 0x69ae90; - } - static void CC_INCREMENT_GL_DRAWS(int n) { - *reinterpret_cast(macNumberOfDraws()) += n; - } } +//uintptr_t macNumberOfDraws() { +// return geode::base::get() + 0x69ae90; +//} +//void ccIncrementGLDraws(int n) { +//#ifdef GEODE_IS_MACOS +// *reinterpret_cast(macNumberOfDraws()) += n; +//#else +// CC_INCREMENT_GL_DRAWS(n); +//#endif +//} + [[link(win)]] class DS_Dictionary { DS_Dictionary() = mac 0xbe9a0; diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index b675bd7c..0c98e27a 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -246,9 +246,7 @@ It should work same as apples CFSwapInt32LittleToHost(..) The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; -#ifndef GEODE_IS_MACOS #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -#endif /*******************/ /** Notifications **/ From 100fc665008a636705ded9bbb1798b48548ac199 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:48:06 +0000 Subject: [PATCH 056/270] Add new class (SecretLayer2) only win offsets because I dont have a mac. `onSubmit` and `updateSearchLabel` from @Jouca, everything else found by me. --- bindings/GeometryDash.bro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 8062f47d..371ed416 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4089,6 +4089,15 @@ class LevelSettingsDelegate { virtual void levelSettingsUpdated() {} } +class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { + static SecretLayer2* create() = win 0x21FD70; + + bool init() = win 0x21FE10; + bool onSubmit(cocos2d::CCObject*) = win 0x221ac0; + void updateSearchLabel(const char* text) = win 0x222FC0; + void showCompletedLevel() = win 0x220C10; +} + class SecretLayer4 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer4* create() = mac 0x1ed500; static cocos2d::CCScene* scene() = mac 0x1ed4c0; From 266bdc3491e36ed279337eba32e7accc1038be6f Mon Sep 17 00:00:00 2001 From: Cvolton Date: Fri, 15 Sep 2023 13:24:50 +0200 Subject: [PATCH 057/270] Update LevelInfoLayer bindings --- bindings/GeometryDash.bro | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d67e0028..9f368269 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4022,6 +4022,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300; + void updateLabelValues() = mac 0x164090, win 0x17b170; PAD = win 0x4, mac 0x8; cocos2d::CCMenu* m_playBtnMenu; @@ -4031,13 +4032,13 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg CCMenuItemSpriteExtra* m_starRateBtn; CCMenuItemSpriteExtra* m_demonRateBtn; PAD = win 0x4, mac 0x8; - CCMenuItemToggler* m_toggler; - cocos2d::CCLabelBMFont* m_label0; - cocos2d::CCLabelBMFont* m_label1; - cocos2d::CCLabelBMFont* m_label2; - cocos2d::CCLabelBMFont* m_label3; - cocos2d::CCLabelBMFont* m_label4; - cocos2d::CCLabelBMFont* m_label5; + CCMenuItemToggler* m_ldmToggler; + cocos2d::CCLabelBMFont* m_ldmLabel; + cocos2d::CCLabelBMFont* m_lengthLabel; + cocos2d::CCLabelBMFont* m_downloadsLabel; + cocos2d::CCLabelBMFont* m_likesLabel; + cocos2d::CCLabelBMFont* m_orbsLabel; + cocos2d::CCLabelBMFont* m_folderLabel; CCMenuItemSpriteExtra* m_cloneBtn; PAD = win 0x4, mac 0x8; } @@ -5542,6 +5543,8 @@ class SpeedObject : cocos2d::CCNode { float m_somethingToCompare; float m_idk3; float m_idk4; + + static SpeedObject* create(GameObject*, int, float) = win 0x20DE70; } class SpritePartDelegate {} From cf8fbbad7160bac376947f015f9f6ab6fb87fe2d Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Mon, 18 Sep 2023 23:01:03 -0400 Subject: [PATCH 058/270] Allow for StringSetting character filters --- loader/include/Geode/loader/Setting.hpp | 5 +++++ loader/src/loader/Setting.cpp | 1 + loader/src/ui/internal/settings/GeodeSettingNode.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/loader/include/Geode/loader/Setting.hpp b/loader/include/Geode/loader/Setting.hpp index fca764c9..5425687a 100644 --- a/loader/include/Geode/loader/Setting.hpp +++ b/loader/include/Geode/loader/Setting.hpp @@ -96,6 +96,11 @@ namespace geode { */ std::optional match; + /** + * The CCTextInputNode's allowed character filter + */ + std::optional filter; + static Result parse(JsonMaybeObject& obj); }; diff --git a/loader/src/loader/Setting.cpp b/loader/src/loader/Setting.cpp index ccce4622..e5dcda72 100644 --- a/loader/src/loader/Setting.cpp +++ b/loader/src/loader/Setting.cpp @@ -62,6 +62,7 @@ Result StringSetting::parse(JsonMaybeObject& obj) { StringSetting sett; parseCommon(sett, obj); obj.has("match").into(sett.match); + obj.has("filter").into(sett.filter); return Ok(sett); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 70b14542..28a37e1e 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -324,6 +324,11 @@ bool StringSettingNode::setup(StringSettingValue* setting, float width) { m_input = InputNode::create(width / 2 - 10.f, "Text", "chatFont.fnt"); m_input->setPosition({ -(width / 2 - 70.f) / 2, .0f }); m_input->setScale(.65f); + + if (setting->castDefinition().filter.has_value()) { + m_input->getInput()->setAllowedChars(setting->castDefinition().filter.value()); + } + m_input->getInput()->setDelegate(this); m_menu->addChild(m_input); From 140f38bee0d0d7a0e5ae77280e0e07ebe992195c Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:14:59 -0400 Subject: [PATCH 059/270] Make MDTextArea fit within provided size (and look better) --- loader/src/ui/nodes/MDTextArea.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index c6afcda2..fb5e2046 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -109,8 +109,8 @@ bool MDTextArea::init(std::string const& str, CCSize const& size) { if (!CCLayer::init()) return false; m_text = str; - m_size = size; - this->setContentSize(size); + m_size = size - CCSize { 15.f, 0.f }; + this->setContentSize(m_size); m_renderer = TextRenderer::create(); CC_SAFE_RETAIN(m_renderer); @@ -118,8 +118,8 @@ bool MDTextArea::init(std::string const& str, CCSize const& size) { m_bgSprite->setScale(.5f); m_bgSprite->setColor({ 0, 0, 0 }); m_bgSprite->setOpacity(75); - m_bgSprite->setContentSize(size * 2 + CCSize { 25.f, 25.f }); - m_bgSprite->setPosition(size / 2); + m_bgSprite->setContentSize(size * 2); + m_bgSprite->setPosition(m_size / 2); this->addChild(m_bgSprite); m_scrollLayer = ScrollLayer::create({ 0, 0, m_size.width, m_size.height }, true); @@ -695,7 +695,16 @@ void MDTextArea::updateLabel() { m_renderer->end(); - m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize()); + if (m_content->getContentSize().height > m_size.height) { + // Generate bottom padding + m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize() + CCSize { 0.f, 12.5 }); + m_content->setPositionY(10.f); + } else { + m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize()); + m_content->setPositionY(-2.5f); + } + + m_scrollLayer->moveToTop(); } From 3ee606e7b95b172e3d14cd39d11eb55d26e90082 Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:18:21 -0400 Subject: [PATCH 060/270] Update patchnotes and set version to 1.3.4 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e9486b..ed989299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Geode Changelog +## v1.3.4 + * Implement string setting character filters (cf8fbba) + * Update bindings + ## v1.3.3 * Reunify resources.zip (81de161) diff --git a/VERSION b/VERSION index 785cda80..8c9698aa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.3 \ No newline at end of file +1.3.4 \ No newline at end of file From a942a45adc4f28e39aa61a096f6019d6c457903e Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Wed, 20 Sep 2023 00:56:55 +0300 Subject: [PATCH 061/270] follow redirects on all util::web requests --- loader/src/utils/web.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 9bc7cd99..8dccd048 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -79,6 +79,7 @@ Result web::fetchBytes(std::string const& url) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); auto res = curl_easy_perform(curl); if (res != CURLE_OK) { @@ -118,6 +119,7 @@ Result web::fetch(std::string const& url) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeString); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); auto res = curl_easy_perform(curl); if (res != CURLE_OK) { curl_easy_cleanup(curl); From b71bfb921a238fca6cbbb10910fc40a7b2c8ea30 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Wed, 20 Sep 2023 03:17:10 +0000 Subject: [PATCH 062/270] Add more funcs to EndLevelLayer also inherit CCLayer in case someone wants to hook customSetup and do stuff there again only win offsets because i dont have a mac --- bindings/GeometryDash.bro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cd058ffd..1a4848bb 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1628,9 +1628,12 @@ class EffectGameObject : GameObject { PAD = mac 0x28, win 0x24; } -class EndLevelLayer { +class EndLevelLayer : cocos2d::CCLayer { static EndLevelLayer* create() = mac 0x2787d0, win 0x94b50; + void customSetup() = win 0x94cb0; + const char* getCoinString(void* p0) = win 0x96270; + const char* getEndText() = win 0x964A0; void onMenu(cocos2d::CCObject* sender) = mac 0x27a500, win 0x96c10; void onEdit(cocos2d::CCObject* sender) = mac 0x27a640, win 0x96d30; } From 6502285dd02650dd2803f93d6913ff10ac1b8494 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:29:49 +0300 Subject: [PATCH 063/270] add ccconfig --- bindings/Cocos2d.bro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4d1d2dab..fafc9eed 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -121,6 +121,11 @@ class cocos2d::CCClippingNode { // void updateConnected() = win 0xc7fb0; //} +[[link(win)]] +class cocos2d::CCConfiguration { + void gatherGPUInfo() = mac 0x2a6e10; +} + [[link(win)]] class cocos2d::CCDelayTime { static cocos2d::CCDelayTime* create(float) = mac 0x1f4380; From 152dc7edcf31691cd5d9a923b70387b4a562d40c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:07:25 +0300 Subject: [PATCH 064/270] Add MenuItemSprite --- bindings/Cocos2d.bro | 5 + loader/include/Geode/ui/MenuItemSprite.hpp | 47 ++++++++++ loader/include/Geode/ui/MenuItemToggle.hpp | 43 +++++++++ loader/include/Geode/utils/MiniFunction.hpp | 24 +++++ loader/src/ui/internal/list/ModListLayer.cpp | 4 +- loader/src/ui/nodes/MenuItemSprite.cpp | 98 ++++++++++++++++++++ 6 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 loader/include/Geode/ui/MenuItemSprite.hpp create mode 100644 loader/include/Geode/ui/MenuItemToggle.hpp create mode 100644 loader/src/ui/nodes/MenuItemSprite.cpp diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index bde65aff..6f617e76 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -264,6 +264,11 @@ class cocos2d::CCEaseOut { static cocos2d::CCEaseOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1b70; } +[[link(win)]] +class cocos2d::CCEaseBounceOut { + static cocos2d::CCEaseBounceOut* create(cocos2d::CCActionInterval*) = mac 0x2a3b40; +} + [[link(win)]] class cocos2d::CCEGLView { CCEGLView(); diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp new file mode 100644 index 00000000..113eb80d --- /dev/null +++ b/loader/include/Geode/ui/MenuItemSprite.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include "../utils/MiniFunction.hpp" + +#pragma warning(disable : 4275) + +namespace geode { + class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { + protected: + + MenuItemSprite(); + ~MenuItemSprite() override; + + public: + static MenuItemSprite* create( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + static MenuItemSprite* create( + cocos2d::CCNode* normalSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + bool init( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + void runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator); + void runActionOnSprites(utils::MiniFunction generator); + + utils::MiniFunction m_selectedAction; + utils::MiniFunction m_unselectedAction; + utils::MiniFunction m_activateAction; + + void activate() override; + void selected() override; + void unselected() override; + + void setImage(cocos2d::CCNode* image); + void setNormalImage(cocos2d::CCNode* image) override; + void setDisabledImage(cocos2d::CCNode* image) override; + void setSelectedImage(cocos2d::CCNode* image) override; + }; +} diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp new file mode 100644 index 00000000..6399773a --- /dev/null +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include "MenuItemSprite.hpp" + +#pragma warning(disable : 4275) + +namespace geode { + class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { + protected: + MenuItemSprite* m_offButton; + MenuItemSprite* m_onButton; + bool m_toggled; + + MenuItemToggle(); + ~MenuItemToggle() override; + + public: + static MenuItemToggle* create( + cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + bool init( + cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + void setOffButton(MenuItemSprite* button); + void setOnButton(MenuItemSprite* button); + MenuItemSprite* getOffButton() const; + MenuItemSprite* getOnButton() const; + + bool isToggled() const; + void toggle(bool enabled); + + void setScale(float scale) override; + void activate() override; + void selected() override; + void unselected() override; + void setEnabled(bool enabled) override; + }; +} diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index edb66052..72cf1e19 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -123,6 +123,30 @@ namespace geode::utils { return *this; } + template + requires(MiniFunctionCallable && !std::is_same_v, MiniFunction>) + MiniFunction& operator=(Callable&& func) { + delete m_state; + m_state = new MiniFunctionState, Ret, Args...>(std::forward(func)); + return *this; + } + + template + requires(!MiniFunctionCallable && std::is_pointer_v && std::is_function_v>) + MiniFunction& operator=(FunctionPointer func) { + delete m_state; + m_state = new MiniFunctionStatePointer(func); + return *this; + } + + template + requires(std::is_member_function_pointer_v) + MiniFunction& operator=(MemberFunctionPointer func) { + delete m_state; + m_state = new MiniFunctionStateMemberPointer(func); + return *this; + } + Ret operator()(Args... args) const { if (!m_state) return Ret(); return m_state->call(args...); diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index a06e745c..e950a521 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,6 +16,8 @@ #include #include +#include + #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -259,7 +261,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = CCMenuItemSpriteExtra::create( + auto backBtn = MenuItemSprite::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp new file mode 100644 index 00000000..cb6ec2a2 --- /dev/null +++ b/loader/src/ui/nodes/MenuItemSprite.cpp @@ -0,0 +1,98 @@ +#include + +using namespace geode::prelude; + +MenuItemSprite* MenuItemSprite::create( + cocos2d::CCNode* normalSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + return MenuItemSprite::create(normalSprite, nullptr, target, callback); +} + +MenuItemSprite* MenuItemSprite::create( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + auto ret = new MenuItemSprite(); + if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} + +MenuItemSprite::MenuItemSprite() {} + +MenuItemSprite::~MenuItemSprite() { +} + +void MenuItemSprite::setImage(cocos2d::CCNode* image) { + if (image) { + image->setAnchorPoint({ 0.5f, 0.5f }); + image->setPosition(image->getContentSize() / 2); + } +} + +// why are the members private like what +void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setNormalImage(image); + this->setImage(image); +} +void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setDisabledImage(image); + this->setImage(image); +} +void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setSelectedImage(image); + this->setImage(image); +} + +bool MenuItemSprite::init( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + if (!CCMenuItemSprite::initWithNormalSprite(normalSprite, disabledSprite, nullptr, target, callback)) return false; + + m_selectedAction = []() -> cocos2d::CCAction* { + return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.3f, 1.26f)); + }; + m_unselectedAction = []() -> cocos2d::CCAction* { + return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.4f, 1.0f)); + }; + m_activateAction = []() -> cocos2d::CCAction* { + return cocos2d::CCScaleTo::create(0.f, 1.0f); + }; + + return true; +} + +void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { + if (sprite) { + sprite->stopAllActions(); + if (generator) sprite->runAction(generator); + } +} + +void MenuItemSprite::runActionOnSprites(MiniFunction generator) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); +} + +void MenuItemSprite::activate() { + this->runActionOnSprites(m_activateAction); + CCMenuItem::activate(); +} +void MenuItemSprite::selected() { + if (!m_bEnabled) return; + CCMenuItem::selected(); + + this->runActionOnSprites(m_selectedAction); +} +void MenuItemSprite::unselected() { + if (!m_bEnabled) return; + CCMenuItem::unselected(); + + this->runActionOnSprites(m_unselectedAction); +} \ No newline at end of file From e8b98e48f558af95ea14fc902a0a26967be24fc5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:20 +0300 Subject: [PATCH 065/270] Fix some stuff related to menuitemspriteextra but gonna revert --- loader/include/Geode/UI.hpp | 1 + ...ItemSprite.hpp => MenuItemSpriteExtra.hpp} | 13 +++-- loader/include/Geode/ui/MenuItemToggle.hpp | 14 +++--- loader/src/hooks/MenuLayer.cpp | 2 +- loader/src/ui/internal/info/ModInfoPopup.cpp | 20 ++++---- loader/src/ui/internal/info/ModInfoPopup.hpp | 5 +- .../src/ui/internal/list/InstallListCell.cpp | 5 +- .../src/ui/internal/list/InstallListPopup.cpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 17 +++---- loader/src/ui/internal/list/ModListCell.hpp | 5 +- loader/src/ui/internal/list/ModListLayer.cpp | 16 +++--- loader/src/ui/internal/list/ModListLayer.hpp | 9 ++-- .../src/ui/internal/list/ProblemsListCell.cpp | 4 +- .../ui/internal/settings/GeodeSettingNode.cpp | 12 ++--- .../ui/internal/settings/GeodeSettingNode.hpp | 24 ++++----- .../ui/internal/settings/ModSettingsPopup.cpp | 6 +-- .../ui/internal/settings/ModSettingsPopup.hpp | 2 +- loader/src/ui/nodes/ColorPickPopup.cpp | 2 +- loader/src/ui/nodes/MDPopup.cpp | 4 +- ...ItemSprite.cpp => MenuItemSpriteExtra.cpp} | 49 +++++++++++-------- loader/test/dependency/main.cpp | 6 +-- 21 files changed, 115 insertions(+), 103 deletions(-) rename loader/include/Geode/ui/{MenuItemSprite.hpp => MenuItemSpriteExtra.hpp} (81%) rename loader/src/ui/nodes/{MenuItemSprite.cpp => MenuItemSpriteExtra.cpp} (58%) diff --git a/loader/include/Geode/UI.hpp b/loader/include/Geode/UI.hpp index 2330064c..fc326ce6 100644 --- a/loader/include/Geode/UI.hpp +++ b/loader/include/Geode/UI.hpp @@ -10,6 +10,7 @@ #include "ui/ListView.hpp" #include "ui/MDPopup.hpp" #include "ui/MDTextArea.hpp" +#include "ui/MenuItemSpriteExtra.hpp" #include "ui/Notification.hpp" #include "ui/Popup.hpp" #include "ui/SceneManager.hpp" diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSpriteExtra.hpp similarity index 81% rename from loader/include/Geode/ui/MenuItemSprite.hpp rename to loader/include/Geode/ui/MenuItemSpriteExtra.hpp index 113eb80d..776519ed 100644 --- a/loader/include/Geode/ui/MenuItemSprite.hpp +++ b/loader/include/Geode/ui/MenuItemSpriteExtra.hpp @@ -6,19 +6,20 @@ #pragma warning(disable : 4275) namespace geode { - class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { + class GEODE_DLL MenuItemSpriteExtra : public cocos2d::CCMenuItemSprite { protected: + bool m_scaleSprites; - MenuItemSprite(); - ~MenuItemSprite() override; + MenuItemSpriteExtra(); + ~MenuItemSpriteExtra() override; public: - static MenuItemSprite* create( + static MenuItemSpriteExtra* create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - static MenuItemSprite* create( + static MenuItemSpriteExtra* create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); @@ -39,6 +40,8 @@ namespace geode { void selected() override; void unselected() override; + void setScaleSprites(bool scale); + void setImage(cocos2d::CCNode* image); void setNormalImage(cocos2d::CCNode* image) override; void setDisabledImage(cocos2d::CCNode* image) override; diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp index 6399773a..2e704c8a 100644 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -1,15 +1,15 @@ #pragma once #include -#include "MenuItemSprite.hpp" +#include "MenuItemSpriteExtra.hpp" #pragma warning(disable : 4275) namespace geode { class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { protected: - MenuItemSprite* m_offButton; - MenuItemSprite* m_onButton; + MenuItemSpriteExtra* m_offButton; + MenuItemSpriteExtra* m_onButton; bool m_toggled; MenuItemToggle(); @@ -26,10 +26,10 @@ namespace geode { cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - void setOffButton(MenuItemSprite* button); - void setOnButton(MenuItemSprite* button); - MenuItemSprite* getOffButton() const; - MenuItemSprite* getOnButton() const; + void setOffButton(MenuItemSpriteExtra* button); + void setOnButton(MenuItemSpriteExtra* button); + MenuItemSpriteExtra* getOffButton() const; + MenuItemSpriteExtra* getOnButton() const; bool isToggled() const; void toggle(bool enabled); diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 869d1bce..4bddc8f1 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -77,7 +77,7 @@ struct CustomMenuLayer : Modify { auto bottomMenu = static_cast(this->getChildByID("bottom-menu")); - auto btn = CCMenuItemSpriteExtra::create( + auto btn = MenuItemSpriteExtra::create( m_fields->m_geodeButton, this, static_cast(geodeBtnSelector) ); diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 945e5ec4..d1c5c230 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -151,13 +151,13 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.85f); - m_infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); + m_infoBtn = MenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); m_infoBtn->setPosition(LAYER_SIZE.width / 2 - 25.f, LAYER_SIZE.height / 2 - 25.f); m_buttonMenu->addChild(m_infoBtn); // repo button if (metadata.getRepository()) { - auto repoBtn = CCMenuItemSpriteExtra::create( + auto repoBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("github.png"_spr), this, menu_selector(ModInfoPopup::onRepository) @@ -168,7 +168,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { // support button if (metadata.getSupportInfo()) { - auto supportBtn = CCMenuItemSpriteExtra::create( + auto supportBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("gift.png"_spr), this, menu_selector(ModInfoPopup::onSupport) @@ -181,7 +181,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { closeSpr->setScale(.8f); auto closeBtn = - CCMenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); + MenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); closeBtn->setPosition(-LAYER_SIZE.width / 2 + 3.f, LAYER_SIZE.height / 2 - 3.f); m_buttonMenu->addChild(closeBtn); @@ -399,7 +399,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { settingsSpr->setScale(.65f); auto settingsBtn = - CCMenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); + MenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); settingsBtn->setPosition(-LAYER_SIZE.width / 2 + 25.f, -LAYER_SIZE.height / 2 + 25.f); m_buttonMenu->addChild(settingsBtn); @@ -410,7 +410,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); configSpr->setScale(.65f); - auto configBtn = CCMenuItemSpriteExtra::create( + auto configBtn = MenuItemSpriteExtra::create( configSpr, this, menu_selector(LocalModInfoPopup::onOpenConfigDir) ); configBtn->setPosition(-LAYER_SIZE.width / 2 + 65.f, -LAYER_SIZE.height / 2 + 25.f); @@ -451,7 +451,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ButtonSprite::create("Uninstall", "bigFont.fnt", "GJ_button_05.png", .6f); uninstallBtnSpr->setScale(.6f); - auto uninstallBtn = CCMenuItemSpriteExtra::create( + auto uninstallBtn = MenuItemSpriteExtra::create( uninstallBtnSpr, this, menu_selector(LocalModInfoPopup::onUninstall) ); uninstallBtn->setPosition(-85.f, 75.f); @@ -467,7 +467,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); + m_installBtn = MenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); m_installBtn->setPosition(-8.0f, 75.f); m_buttonMenu->addChild(m_installBtn); @@ -536,7 +536,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); issuesBtnSpr->setScale(.75f); - auto issuesBtn = CCMenuItemSpriteExtra::create( + auto issuesBtn = MenuItemSpriteExtra::create( issuesBtnSpr, this, menu_selector(LocalModInfoPopup::onIssues) ); issuesBtn->setPosition(0.f, -LAYER_SIZE.height / 2 + 25.f); @@ -726,7 +726,7 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = CCMenuItemSpriteExtra::create( + m_installBtn = MenuItemSpriteExtra::create( m_installBtnSpr, this, menu_selector(IndexItemInfoPopup::onInstall) ); m_installBtn->setPosition(-143.0f, 75.f); diff --git a/loader/src/ui/internal/info/ModInfoPopup.hpp b/loader/src/ui/internal/info/ModInfoPopup.hpp index 808cd918..e9ab045a 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.hpp +++ b/loader/src/ui/internal/info/ModInfoPopup.hpp @@ -6,6 +6,7 @@ #include #include #include +#include using namespace geode::prelude; @@ -31,8 +32,8 @@ protected: ModListLayer* m_layer = nullptr; DownloadStatusNode* m_installStatus = nullptr; IconButtonSprite* m_installBtnSpr; - CCMenuItemSpriteExtra* m_installBtn; - CCMenuItemSpriteExtra* m_infoBtn; + MenuItemSpriteExtra* m_installBtn; + MenuItemSpriteExtra* m_infoBtn; CCLabelBMFont* m_latestVersionLabel = nullptr; CCLabelBMFont* m_minorVersionLabel = nullptr; MDTextArea* m_detailsArea; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index 352d8aaf..ce309181 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -1,7 +1,6 @@ #include "InstallListCell.hpp" #include "InstallListPopup.hpp" #include -#include #include #include #include @@ -213,7 +212,7 @@ bool IndexItemInstallListCell::init( versionSelectSpr->setScale(.7f); auto versionSelectBtn = - CCMenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); + MenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); versionSelectBtn->setAnchorPoint({1.f, .5f}); versionSelectBtn->setPosition({m_toggle->getPositionX() - m_toggle->getContentSize().width - 5, m_height / 2}); m_menu->addChild(versionSelectBtn); @@ -372,7 +371,7 @@ bool SelectVersionCell::init(IndexItemHandle item, SelectVersionPopup* versionPo ); selectSpr->setScale(.6f); - auto selectBtn = CCMenuItemSpriteExtra::create( + auto selectBtn = MenuItemSpriteExtra::create( selectSpr, this, menu_selector(SelectVersionCell::onSelected) ); selectBtn->setAnchorPoint({1.f, .5f}); diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index e561ca9b..2acbb670 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -22,7 +22,7 @@ bool InstallListPopup::setup(IndexItemHandle item, MiniFunctionsetScale(.6f); - auto installBtn = CCMenuItemSpriteExtra::create( + auto installBtn = MenuItemSpriteExtra::create( installBtnSpr, this, menu_selector(InstallListPopup::onInstall) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index 061e6dcb..b1614011 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -2,7 +2,6 @@ #include "ModListLayer.hpp" #include "../info/ModInfoPopup.hpp" #include -#include #include #include #include @@ -144,7 +143,7 @@ void ModListCell::setupInfo( creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = CCMenuItemSpriteExtra::create( + m_developerBtn = MenuItemSpriteExtra::create( creatorLabel, this, menu_selector(ModListCell::onViewDev) ); m_columnMenu->addChild(m_developerBtn); @@ -292,7 +291,7 @@ bool ModCell::init( exMark->setScale(.5f); m_unresolvedExMark = - CCMenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); + MenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); m_unresolvedExMark->setVisible(false); m_menu->addChild(m_unresolvedExMark); @@ -300,7 +299,7 @@ bool ModCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); + auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -335,7 +334,7 @@ bool ModCell::init( } } - auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); + auto viewBtn = MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); m_menu->addChild(viewBtn); } @@ -395,7 +394,7 @@ bool IndexItemCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); + auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -403,7 +402,7 @@ bool IndexItemCell::init( viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); m_menu->addChild(viewBtn); } @@ -517,7 +516,7 @@ bool InvalidGeodeFileCell::init( whySpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); + MenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); menu->addChild(viewBtn); return true; @@ -635,7 +634,7 @@ bool ProblemsCell::init( viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); m_menu->addChild(viewBtn); m_menu->updateLayout(); diff --git a/loader/src/ui/internal/list/ModListCell.hpp b/loader/src/ui/internal/list/ModListCell.hpp index 28e253d9..446f5b06 100644 --- a/loader/src/ui/internal/list/ModListCell.hpp +++ b/loader/src/ui/internal/list/ModListCell.hpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace geode::prelude; @@ -22,8 +23,8 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_description; CCMenuItemToggler* m_enableToggle = nullptr; - CCMenuItemSpriteExtra* m_unresolvedExMark; - CCMenuItemSpriteExtra* m_developerBtn; + MenuItemSpriteExtra* m_unresolvedExMark; + MenuItemSpriteExtra* m_developerBtn; SpacerNode* m_spacer = nullptr; CCMenu* m_columnMenu = nullptr; CCMenu* m_labelMenu = nullptr; diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index e950a521..7f44d9ae 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,8 +16,6 @@ #include #include -#include - #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -261,7 +259,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSprite::create( + auto backBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); @@ -272,7 +270,7 @@ bool ModListLayer::init() { auto reloadSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png"); reloadSpr->setScale(.8f); auto reloadBtn = - CCMenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); + MenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); reloadBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 30.0f); m_menu->addChild(reloadBtn); @@ -281,7 +279,7 @@ bool ModListLayer::init() { "gj_folderBtn_001.png", .7f, CircleBaseColor::Green, CircleBaseSize::Small ); auto openBtn = - CCMenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); + MenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); openBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 80.0f); m_menu->addChild(openBtn); @@ -396,7 +394,7 @@ void ModListLayer::createSearchControl() { filterSpr->setScale(.7f); m_filterBtn = - CCMenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); + MenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); m_filterBtn->setPosition(-10.f, 0.f); menu->addChild(m_filterBtn); @@ -404,14 +402,14 @@ void ModListLayer::createSearchControl() { auto searchSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png"); searchSpr->setScale(.7f); - m_searchBtn = CCMenuItemSpriteExtra::create(searchSpr, this, nullptr); + m_searchBtn = MenuItemSpriteExtra::create(searchSpr, this, nullptr); m_searchBtn->setPosition(-35.f, 0.f); menu->addChild(m_searchBtn); auto searchClearSpr = CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png"); searchClearSpr->setScale(.7f); - m_searchClearBtn = CCMenuItemSpriteExtra::create( + m_searchClearBtn = MenuItemSpriteExtra::create( searchClearSpr, this, menu_selector(ModListLayer::onResetSearch) ); m_searchClearBtn->setPosition(-35.f, 0.f); @@ -563,7 +561,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional const if (!m_checkForUpdatesBtn) { auto checkSpr = ButtonSprite::create("Check for Updates"); checkSpr->setScale(.7f); - m_checkForUpdatesBtn = CCMenuItemSpriteExtra::create( + m_checkForUpdatesBtn = MenuItemSpriteExtra::create( checkSpr, this, menu_selector(ModListLayer::onCheckForUpdates) ); m_checkForUpdatesBtn->setPosition(0, -winSize.height / 2 + 40.f); diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index 0afa2839..f9a3780a 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include using namespace geode::prelude; @@ -54,13 +55,13 @@ protected: CCMenuItemToggler* m_installedTabBtn; CCMenuItemToggler* m_downloadTabBtn; CCMenuItemToggler* m_featuredTabBtn; - CCMenuItemSpriteExtra* m_searchBtn; - CCMenuItemSpriteExtra* m_searchClearBtn; - CCMenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; + MenuItemSpriteExtra* m_searchBtn; + MenuItemSpriteExtra* m_searchClearBtn; + MenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; CCNode* m_searchBG = nullptr; CCTextInputNode* m_searchInput = nullptr; LoadingCircle* m_loadingCircle = nullptr; - CCMenuItemSpriteExtra* m_filterBtn; + MenuItemSpriteExtra* m_filterBtn; ModListQuery m_query; ModListDisplay m_display = ModListDisplay::Concise; EventListener m_indexListener; diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index faa2086b..4b545b70 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -1,7 +1,7 @@ #include "ProblemsListCell.hpp" #include "ProblemsListPopup.hpp" #include -#include +#include #include #include #include @@ -115,7 +115,7 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); m_menu->addChild(viewBtn); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 28a37e1e..4f603e5d 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -74,7 +74,7 @@ Slider* createSlider(C* node, GeodeSettingValue* setting, float width) { template std::pair< - CCMenuItemSpriteExtra*, CCMenuItemSpriteExtra* + MenuItemSpriteExtra*, MenuItemSpriteExtra* > createArrows(C* node, GeodeSettingValue* setting, float width, bool big) { auto yPos = setting->castDefinition().controls.slider ? 5.f : 0.f; auto decArrowSpr = CCSprite::createWithSpriteFrameName( @@ -83,7 +83,7 @@ std::pair< decArrowSpr->setFlipX(true); decArrowSpr->setScale(.3f); - auto decArrow = CCMenuItemSpriteExtra::create( + auto decArrow = MenuItemSpriteExtra::create( decArrowSpr, node, menu_selector(C::onArrow) ); decArrow->setPosition(-width / 2 + (big ? 65.f : 80.f), yPos); @@ -97,7 +97,7 @@ std::pair< ); incArrowSpr->setScale(.3f); - auto incArrow = CCMenuItemSpriteExtra::create( + auto incArrow = MenuItemSpriteExtra::create( incArrowSpr, node, menu_selector(C::onArrow) ); incArrow->setTag(big ? @@ -377,7 +377,7 @@ bool FileSettingNode::setup(FileSettingValue* setting, float width) { auto fileBtnSpr = CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"); fileBtnSpr->setScale(.5f); - auto fileBtn = CCMenuItemSpriteExtra::create( + auto fileBtn = MenuItemSpriteExtra::create( fileBtnSpr, this, menu_selector(FileSettingNode::onPickFile) ); fileBtn->setPosition(.0f, .0f); @@ -410,7 +410,7 @@ bool ColorSettingNode::setup(ColorSettingValue* setting, float width) { m_colorSpr->setColor(m_uncommittedValue); m_colorSpr->setScale(.65f); - auto button = CCMenuItemSpriteExtra::create( + auto button = MenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorSettingNode::onSelectColor) ); button->setPositionX(-10.f); @@ -445,7 +445,7 @@ bool ColorAlphaSettingNode::setup(ColorAlphaSettingValue* setting, float width) m_colorSpr->updateOpacity(m_uncommittedValue.a / 255.f); m_colorSpr->setScale(.65f); - auto button = CCMenuItemSpriteExtra::create( + auto button = MenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorAlphaSettingNode::onSelectColor) ); button->setPositionX(-10.f); diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.hpp b/loader/src/ui/internal/settings/GeodeSettingNode.hpp index c32a6066..2a320b53 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.hpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -40,7 +40,7 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_nameLabel; CCLabelBMFont* m_errorLabel; - CCMenuItemSpriteExtra* m_resetBtn; + MenuItemSpriteExtra* m_resetBtn; bool init(GeodeSettingValue* setting, float width) { if (!SettingNode::init(setting)) @@ -81,7 +81,7 @@ protected: auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.6f); - auto infoBtn = CCMenuItemSpriteExtra::create( + auto infoBtn = MenuItemSpriteExtra::create( infoSpr, this, menu_selector(GeodeSettingNode::onDescription) ); infoBtn->setPosition( @@ -97,7 +97,7 @@ protected: auto resetBtnSpr = CCSprite::createWithSpriteFrameName("reset-gold.png"_spr); resetBtnSpr->setScale(.5f); - m_resetBtn = CCMenuItemSpriteExtra::create( + m_resetBtn = MenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(GeodeSettingNode::onReset) ); m_resetBtn->setPosition( @@ -210,10 +210,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - CCMenuItemSpriteExtra* m_decArrow = nullptr; - CCMenuItemSpriteExtra* m_incArrow = nullptr; - CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; - CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; + MenuItemSpriteExtra* m_decArrow = nullptr; + MenuItemSpriteExtra* m_incArrow = nullptr; + MenuItemSpriteExtra* m_bigDecArrow = nullptr; + MenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; @@ -239,10 +239,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - CCMenuItemSpriteExtra* m_decArrow = nullptr; - CCMenuItemSpriteExtra* m_incArrow = nullptr; - CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; - CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; + MenuItemSpriteExtra* m_decArrow = nullptr; + MenuItemSpriteExtra* m_incArrow = nullptr; + MenuItemSpriteExtra* m_bigDecArrow = nullptr; + MenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.cpp b/loader/src/ui/internal/settings/ModSettingsPopup.cpp index 60f4b6f6..369041a1 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.cpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.cpp @@ -90,7 +90,7 @@ bool ModSettingsPopup::setup(Mod* mod) { m_applyBtnSpr = ButtonSprite::create("Apply", "goldFont.fnt", "GJ_button_01.png", .7f); m_applyBtnSpr->setScale(.7f); - m_applyBtn = CCMenuItemSpriteExtra::create( + m_applyBtn = MenuItemSpriteExtra::create( m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply) ); m_applyBtn->setPosition(.0f, -m_size.height / 2 + 20.f); @@ -99,7 +99,7 @@ bool ModSettingsPopup::setup(Mod* mod) { auto resetBtnSpr = ButtonSprite::create("Reset All", "goldFont.fnt", "GJ_button_05.png", .7f); resetBtnSpr->setScale(.7f); - auto resetBtn = CCMenuItemSpriteExtra::create( + auto resetBtn = MenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(ModSettingsPopup::onResetAll) ); resetBtn->setPosition(-m_size.width / 2 + 45.f, -m_size.height / 2 + 20.f); @@ -109,7 +109,7 @@ bool ModSettingsPopup::setup(Mod* mod) { ButtonSprite::create("Open Folder", "goldFont.fnt", "GJ_button_05.png", .7f); openDirBtnSpr->setScale(.7f); - auto openDirBtn = CCMenuItemSpriteExtra::create( + auto openDirBtn = MenuItemSpriteExtra::create( openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory) ); openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f); diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.hpp b/loader/src/ui/internal/settings/ModSettingsPopup.hpp index 834214d5..d861e241 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.hpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.hpp @@ -10,7 +10,7 @@ class ModSettingsPopup : public Popup, public SettingNodeDelegate { protected: Mod* m_mod; std::vector m_settings; - CCMenuItemSpriteExtra* m_applyBtn; + MenuItemSpriteExtra* m_applyBtn; ButtonSprite* m_applyBtnSpr; void settingValueChanged(SettingNode*) override; diff --git a/loader/src/ui/nodes/ColorPickPopup.cpp b/loader/src/ui/nodes/ColorPickPopup.cpp index 0fafb50f..db7b6a10 100644 --- a/loader/src/ui/nodes/ColorPickPopup.cpp +++ b/loader/src/ui/nodes/ColorPickPopup.cpp @@ -157,7 +157,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) { okBtnSpr->setScale(.7f); auto okBtn = - CCMenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); + MenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); okBtn->setPosition(.0f, -m_size.height / 2 + 20.f); m_buttonMenu->addChild(okBtn); diff --git a/loader/src/ui/nodes/MDPopup.cpp b/loader/src/ui/nodes/MDPopup.cpp index 2f0929da..39d5153e 100644 --- a/loader/src/ui/nodes/MDPopup.cpp +++ b/loader/src/ui/nodes/MDPopup.cpp @@ -24,14 +24,14 @@ bool MDPopup::setup( auto btnSpr = ButtonSprite::create(btn1Text); - auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); + auto btn = MenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); btn->setTag(0); m_buttonMenu->addChild(btn); if (btn2Text) { auto btn2Spr = ButtonSprite::create(btn2Text); - auto btn2 = CCMenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); + auto btn2 = MenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); btn2->setTag(1); m_buttonMenu->addChild(btn2); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSpriteExtra.cpp similarity index 58% rename from loader/src/ui/nodes/MenuItemSprite.cpp rename to loader/src/ui/nodes/MenuItemSpriteExtra.cpp index cb6ec2a2..64a71e64 100644 --- a/loader/src/ui/nodes/MenuItemSprite.cpp +++ b/loader/src/ui/nodes/MenuItemSpriteExtra.cpp @@ -1,19 +1,19 @@ -#include +#include using namespace geode::prelude; -MenuItemSprite* MenuItemSprite::create( +MenuItemSpriteExtra* MenuItemSpriteExtra::create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - return MenuItemSprite::create(normalSprite, nullptr, target, callback); + return MenuItemSpriteExtra::create(normalSprite, nullptr, target, callback); } -MenuItemSprite* MenuItemSprite::create( +MenuItemSpriteExtra* MenuItemSpriteExtra::create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - auto ret = new MenuItemSprite(); + auto ret = new MenuItemSpriteExtra(); if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { ret->autorelease(); return ret; @@ -22,12 +22,12 @@ MenuItemSprite* MenuItemSprite::create( return nullptr; } -MenuItemSprite::MenuItemSprite() {} +MenuItemSpriteExtra::MenuItemSpriteExtra() : m_scaleSprites(false) {} -MenuItemSprite::~MenuItemSprite() { +MenuItemSpriteExtra::~MenuItemSpriteExtra() { } -void MenuItemSprite::setImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { if (image) { image->setAnchorPoint({ 0.5f, 0.5f }); image->setPosition(image->getContentSize() / 2); @@ -35,20 +35,20 @@ void MenuItemSprite::setImage(cocos2d::CCNode* image) { } // why are the members private like what -void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setNormalImage(cocos2d::CCNode* image) { CCMenuItemSprite::setNormalImage(image); this->setImage(image); } -void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setDisabledImage(cocos2d::CCNode* image) { CCMenuItemSprite::setDisabledImage(image); this->setImage(image); } -void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setSelectedImage(cocos2d::CCNode* image) { CCMenuItemSprite::setSelectedImage(image); this->setImage(image); } -bool MenuItemSprite::init( +bool MenuItemSpriteExtra::init( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { @@ -67,32 +67,41 @@ bool MenuItemSprite::init( return true; } -void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { +void MenuItemSpriteExtra::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { if (sprite) { sprite->stopAllActions(); if (generator) sprite->runAction(generator); } } -void MenuItemSprite::runActionOnSprites(MiniFunction generator) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); +void MenuItemSpriteExtra::runActionOnSprites(MiniFunction generator) { + if (m_scaleSprites) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); + } + else { + if (auto action = generator()) this->runAction(action); + } } -void MenuItemSprite::activate() { +void MenuItemSpriteExtra::activate() { this->runActionOnSprites(m_activateAction); CCMenuItem::activate(); } -void MenuItemSprite::selected() { +void MenuItemSpriteExtra::selected() { if (!m_bEnabled) return; CCMenuItem::selected(); this->runActionOnSprites(m_selectedAction); } -void MenuItemSprite::unselected() { +void MenuItemSpriteExtra::unselected() { if (!m_bEnabled) return; CCMenuItem::unselected(); this->runActionOnSprites(m_unselectedAction); +} + +void MenuItemSpriteExtra::setScaleSprites(bool scale) { + m_scaleSprites = scale; } \ No newline at end of file diff --git a/loader/test/dependency/main.cpp b/loader/test/dependency/main.cpp index 2f6bd35d..4a2713b6 100644 --- a/loader/test/dependency/main.cpp +++ b/loader/test/dependency/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "main.hpp" @@ -92,7 +92,7 @@ protected: } else { btnSpr->setColor({ 200, 200, 200 }); } - auto btn = CCMenuItemSpriteExtra::create( + auto btn = MenuItemSpriteExtra::create( btnSpr, this, menu_selector(MySettingNode::onSelect) ); btn->setTag(static_cast(icon)); @@ -113,7 +113,7 @@ protected: } m_currentIcon = static_cast(sender->getTag()); static_cast( - static_cast(sender)->getNormalImage() + static_cast(sender)->getNormalImage() )->setColor({ 0, 255, 0 }); this->dispatchChanged(); } From dcc40f11e1161cfd6e7dcb6512e3b2be72e6068f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:30 +0300 Subject: [PATCH 066/270] Revert "Fix some stuff related to menuitemspriteextra but gonna revert" This reverts commit e8b98e48f558af95ea14fc902a0a26967be24fc5. --- loader/include/Geode/UI.hpp | 1 - ...ItemSpriteExtra.hpp => MenuItemSprite.hpp} | 13 ++--- loader/include/Geode/ui/MenuItemToggle.hpp | 14 +++--- loader/src/hooks/MenuLayer.cpp | 2 +- loader/src/ui/internal/info/ModInfoPopup.cpp | 20 ++++---- loader/src/ui/internal/info/ModInfoPopup.hpp | 5 +- .../src/ui/internal/list/InstallListCell.cpp | 5 +- .../src/ui/internal/list/InstallListPopup.cpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 17 ++++--- loader/src/ui/internal/list/ModListCell.hpp | 5 +- loader/src/ui/internal/list/ModListLayer.cpp | 16 +++--- loader/src/ui/internal/list/ModListLayer.hpp | 9 ++-- .../src/ui/internal/list/ProblemsListCell.cpp | 4 +- .../ui/internal/settings/GeodeSettingNode.cpp | 12 ++--- .../ui/internal/settings/GeodeSettingNode.hpp | 24 ++++----- .../ui/internal/settings/ModSettingsPopup.cpp | 6 +-- .../ui/internal/settings/ModSettingsPopup.hpp | 2 +- loader/src/ui/nodes/ColorPickPopup.cpp | 2 +- loader/src/ui/nodes/MDPopup.cpp | 4 +- ...ItemSpriteExtra.cpp => MenuItemSprite.cpp} | 49 ++++++++----------- loader/test/dependency/main.cpp | 6 +-- 21 files changed, 103 insertions(+), 115 deletions(-) rename loader/include/Geode/ui/{MenuItemSpriteExtra.hpp => MenuItemSprite.hpp} (81%) rename loader/src/ui/nodes/{MenuItemSpriteExtra.cpp => MenuItemSprite.cpp} (58%) diff --git a/loader/include/Geode/UI.hpp b/loader/include/Geode/UI.hpp index fc326ce6..2330064c 100644 --- a/loader/include/Geode/UI.hpp +++ b/loader/include/Geode/UI.hpp @@ -10,7 +10,6 @@ #include "ui/ListView.hpp" #include "ui/MDPopup.hpp" #include "ui/MDTextArea.hpp" -#include "ui/MenuItemSpriteExtra.hpp" #include "ui/Notification.hpp" #include "ui/Popup.hpp" #include "ui/SceneManager.hpp" diff --git a/loader/include/Geode/ui/MenuItemSpriteExtra.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp similarity index 81% rename from loader/include/Geode/ui/MenuItemSpriteExtra.hpp rename to loader/include/Geode/ui/MenuItemSprite.hpp index 776519ed..113eb80d 100644 --- a/loader/include/Geode/ui/MenuItemSpriteExtra.hpp +++ b/loader/include/Geode/ui/MenuItemSprite.hpp @@ -6,20 +6,19 @@ #pragma warning(disable : 4275) namespace geode { - class GEODE_DLL MenuItemSpriteExtra : public cocos2d::CCMenuItemSprite { + class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { protected: - bool m_scaleSprites; - MenuItemSpriteExtra(); - ~MenuItemSpriteExtra() override; + MenuItemSprite(); + ~MenuItemSprite() override; public: - static MenuItemSpriteExtra* create( + static MenuItemSprite* create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - static MenuItemSpriteExtra* create( + static MenuItemSprite* create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); @@ -40,8 +39,6 @@ namespace geode { void selected() override; void unselected() override; - void setScaleSprites(bool scale); - void setImage(cocos2d::CCNode* image); void setNormalImage(cocos2d::CCNode* image) override; void setDisabledImage(cocos2d::CCNode* image) override; diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp index 2e704c8a..6399773a 100644 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -1,15 +1,15 @@ #pragma once #include -#include "MenuItemSpriteExtra.hpp" +#include "MenuItemSprite.hpp" #pragma warning(disable : 4275) namespace geode { class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { protected: - MenuItemSpriteExtra* m_offButton; - MenuItemSpriteExtra* m_onButton; + MenuItemSprite* m_offButton; + MenuItemSprite* m_onButton; bool m_toggled; MenuItemToggle(); @@ -26,10 +26,10 @@ namespace geode { cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - void setOffButton(MenuItemSpriteExtra* button); - void setOnButton(MenuItemSpriteExtra* button); - MenuItemSpriteExtra* getOffButton() const; - MenuItemSpriteExtra* getOnButton() const; + void setOffButton(MenuItemSprite* button); + void setOnButton(MenuItemSprite* button); + MenuItemSprite* getOffButton() const; + MenuItemSprite* getOnButton() const; bool isToggled() const; void toggle(bool enabled); diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 4bddc8f1..869d1bce 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -77,7 +77,7 @@ struct CustomMenuLayer : Modify { auto bottomMenu = static_cast(this->getChildByID("bottom-menu")); - auto btn = MenuItemSpriteExtra::create( + auto btn = CCMenuItemSpriteExtra::create( m_fields->m_geodeButton, this, static_cast(geodeBtnSelector) ); diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index d1c5c230..945e5ec4 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -151,13 +151,13 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.85f); - m_infoBtn = MenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); + m_infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); m_infoBtn->setPosition(LAYER_SIZE.width / 2 - 25.f, LAYER_SIZE.height / 2 - 25.f); m_buttonMenu->addChild(m_infoBtn); // repo button if (metadata.getRepository()) { - auto repoBtn = MenuItemSpriteExtra::create( + auto repoBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("github.png"_spr), this, menu_selector(ModInfoPopup::onRepository) @@ -168,7 +168,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { // support button if (metadata.getSupportInfo()) { - auto supportBtn = MenuItemSpriteExtra::create( + auto supportBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("gift.png"_spr), this, menu_selector(ModInfoPopup::onSupport) @@ -181,7 +181,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { closeSpr->setScale(.8f); auto closeBtn = - MenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); + CCMenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); closeBtn->setPosition(-LAYER_SIZE.width / 2 + 3.f, LAYER_SIZE.height / 2 - 3.f); m_buttonMenu->addChild(closeBtn); @@ -399,7 +399,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { settingsSpr->setScale(.65f); auto settingsBtn = - MenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); + CCMenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); settingsBtn->setPosition(-LAYER_SIZE.width / 2 + 25.f, -LAYER_SIZE.height / 2 + 25.f); m_buttonMenu->addChild(settingsBtn); @@ -410,7 +410,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); configSpr->setScale(.65f); - auto configBtn = MenuItemSpriteExtra::create( + auto configBtn = CCMenuItemSpriteExtra::create( configSpr, this, menu_selector(LocalModInfoPopup::onOpenConfigDir) ); configBtn->setPosition(-LAYER_SIZE.width / 2 + 65.f, -LAYER_SIZE.height / 2 + 25.f); @@ -451,7 +451,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ButtonSprite::create("Uninstall", "bigFont.fnt", "GJ_button_05.png", .6f); uninstallBtnSpr->setScale(.6f); - auto uninstallBtn = MenuItemSpriteExtra::create( + auto uninstallBtn = CCMenuItemSpriteExtra::create( uninstallBtnSpr, this, menu_selector(LocalModInfoPopup::onUninstall) ); uninstallBtn->setPosition(-85.f, 75.f); @@ -467,7 +467,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = MenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); + m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); m_installBtn->setPosition(-8.0f, 75.f); m_buttonMenu->addChild(m_installBtn); @@ -536,7 +536,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); issuesBtnSpr->setScale(.75f); - auto issuesBtn = MenuItemSpriteExtra::create( + auto issuesBtn = CCMenuItemSpriteExtra::create( issuesBtnSpr, this, menu_selector(LocalModInfoPopup::onIssues) ); issuesBtn->setPosition(0.f, -LAYER_SIZE.height / 2 + 25.f); @@ -726,7 +726,7 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = MenuItemSpriteExtra::create( + m_installBtn = CCMenuItemSpriteExtra::create( m_installBtnSpr, this, menu_selector(IndexItemInfoPopup::onInstall) ); m_installBtn->setPosition(-143.0f, 75.f); diff --git a/loader/src/ui/internal/info/ModInfoPopup.hpp b/loader/src/ui/internal/info/ModInfoPopup.hpp index e9ab045a..808cd918 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.hpp +++ b/loader/src/ui/internal/info/ModInfoPopup.hpp @@ -6,7 +6,6 @@ #include #include #include -#include using namespace geode::prelude; @@ -32,8 +31,8 @@ protected: ModListLayer* m_layer = nullptr; DownloadStatusNode* m_installStatus = nullptr; IconButtonSprite* m_installBtnSpr; - MenuItemSpriteExtra* m_installBtn; - MenuItemSpriteExtra* m_infoBtn; + CCMenuItemSpriteExtra* m_installBtn; + CCMenuItemSpriteExtra* m_infoBtn; CCLabelBMFont* m_latestVersionLabel = nullptr; CCLabelBMFont* m_minorVersionLabel = nullptr; MDTextArea* m_detailsArea; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index ce309181..352d8aaf 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -1,6 +1,7 @@ #include "InstallListCell.hpp" #include "InstallListPopup.hpp" #include +#include #include #include #include @@ -212,7 +213,7 @@ bool IndexItemInstallListCell::init( versionSelectSpr->setScale(.7f); auto versionSelectBtn = - MenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); + CCMenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); versionSelectBtn->setAnchorPoint({1.f, .5f}); versionSelectBtn->setPosition({m_toggle->getPositionX() - m_toggle->getContentSize().width - 5, m_height / 2}); m_menu->addChild(versionSelectBtn); @@ -371,7 +372,7 @@ bool SelectVersionCell::init(IndexItemHandle item, SelectVersionPopup* versionPo ); selectSpr->setScale(.6f); - auto selectBtn = MenuItemSpriteExtra::create( + auto selectBtn = CCMenuItemSpriteExtra::create( selectSpr, this, menu_selector(SelectVersionCell::onSelected) ); selectBtn->setAnchorPoint({1.f, .5f}); diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index 2acbb670..e561ca9b 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -22,7 +22,7 @@ bool InstallListPopup::setup(IndexItemHandle item, MiniFunctionsetScale(.6f); - auto installBtn = MenuItemSpriteExtra::create( + auto installBtn = CCMenuItemSpriteExtra::create( installBtnSpr, this, menu_selector(InstallListPopup::onInstall) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index b1614011..061e6dcb 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -2,6 +2,7 @@ #include "ModListLayer.hpp" #include "../info/ModInfoPopup.hpp" #include +#include #include #include #include @@ -143,7 +144,7 @@ void ModListCell::setupInfo( creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = MenuItemSpriteExtra::create( + m_developerBtn = CCMenuItemSpriteExtra::create( creatorLabel, this, menu_selector(ModListCell::onViewDev) ); m_columnMenu->addChild(m_developerBtn); @@ -291,7 +292,7 @@ bool ModCell::init( exMark->setScale(.5f); m_unresolvedExMark = - MenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); + CCMenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); m_unresolvedExMark->setVisible(false); m_menu->addChild(m_unresolvedExMark); @@ -299,7 +300,7 @@ bool ModCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); + auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -334,7 +335,7 @@ bool ModCell::init( } } - auto viewBtn = MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); + auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); m_menu->addChild(viewBtn); } @@ -394,7 +395,7 @@ bool IndexItemCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); + auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -402,7 +403,7 @@ bool IndexItemCell::init( viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); m_menu->addChild(viewBtn); } @@ -516,7 +517,7 @@ bool InvalidGeodeFileCell::init( whySpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); + CCMenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); menu->addChild(viewBtn); return true; @@ -634,7 +635,7 @@ bool ProblemsCell::init( viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); m_menu->addChild(viewBtn); m_menu->updateLayout(); diff --git a/loader/src/ui/internal/list/ModListCell.hpp b/loader/src/ui/internal/list/ModListCell.hpp index 446f5b06..28e253d9 100644 --- a/loader/src/ui/internal/list/ModListCell.hpp +++ b/loader/src/ui/internal/list/ModListCell.hpp @@ -5,7 +5,6 @@ #include #include #include -#include using namespace geode::prelude; @@ -23,8 +22,8 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_description; CCMenuItemToggler* m_enableToggle = nullptr; - MenuItemSpriteExtra* m_unresolvedExMark; - MenuItemSpriteExtra* m_developerBtn; + CCMenuItemSpriteExtra* m_unresolvedExMark; + CCMenuItemSpriteExtra* m_developerBtn; SpacerNode* m_spacer = nullptr; CCMenu* m_columnMenu = nullptr; CCMenu* m_labelMenu = nullptr; diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index 7f44d9ae..e950a521 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,6 +16,8 @@ #include #include +#include + #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -259,7 +261,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSpriteExtra::create( + auto backBtn = MenuItemSprite::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); @@ -270,7 +272,7 @@ bool ModListLayer::init() { auto reloadSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png"); reloadSpr->setScale(.8f); auto reloadBtn = - MenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); + CCMenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); reloadBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 30.0f); m_menu->addChild(reloadBtn); @@ -279,7 +281,7 @@ bool ModListLayer::init() { "gj_folderBtn_001.png", .7f, CircleBaseColor::Green, CircleBaseSize::Small ); auto openBtn = - MenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); + CCMenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); openBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 80.0f); m_menu->addChild(openBtn); @@ -394,7 +396,7 @@ void ModListLayer::createSearchControl() { filterSpr->setScale(.7f); m_filterBtn = - MenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); + CCMenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); m_filterBtn->setPosition(-10.f, 0.f); menu->addChild(m_filterBtn); @@ -402,14 +404,14 @@ void ModListLayer::createSearchControl() { auto searchSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png"); searchSpr->setScale(.7f); - m_searchBtn = MenuItemSpriteExtra::create(searchSpr, this, nullptr); + m_searchBtn = CCMenuItemSpriteExtra::create(searchSpr, this, nullptr); m_searchBtn->setPosition(-35.f, 0.f); menu->addChild(m_searchBtn); auto searchClearSpr = CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png"); searchClearSpr->setScale(.7f); - m_searchClearBtn = MenuItemSpriteExtra::create( + m_searchClearBtn = CCMenuItemSpriteExtra::create( searchClearSpr, this, menu_selector(ModListLayer::onResetSearch) ); m_searchClearBtn->setPosition(-35.f, 0.f); @@ -561,7 +563,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional const if (!m_checkForUpdatesBtn) { auto checkSpr = ButtonSprite::create("Check for Updates"); checkSpr->setScale(.7f); - m_checkForUpdatesBtn = MenuItemSpriteExtra::create( + m_checkForUpdatesBtn = CCMenuItemSpriteExtra::create( checkSpr, this, menu_selector(ModListLayer::onCheckForUpdates) ); m_checkForUpdatesBtn->setPosition(0, -winSize.height / 2 + 40.f); diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index f9a3780a..0afa2839 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include using namespace geode::prelude; @@ -55,13 +54,13 @@ protected: CCMenuItemToggler* m_installedTabBtn; CCMenuItemToggler* m_downloadTabBtn; CCMenuItemToggler* m_featuredTabBtn; - MenuItemSpriteExtra* m_searchBtn; - MenuItemSpriteExtra* m_searchClearBtn; - MenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; + CCMenuItemSpriteExtra* m_searchBtn; + CCMenuItemSpriteExtra* m_searchClearBtn; + CCMenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; CCNode* m_searchBG = nullptr; CCTextInputNode* m_searchInput = nullptr; LoadingCircle* m_loadingCircle = nullptr; - MenuItemSpriteExtra* m_filterBtn; + CCMenuItemSpriteExtra* m_filterBtn; ModListQuery m_query; ModListDisplay m_display = ModListDisplay::Concise; EventListener m_indexListener; diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index 4b545b70..faa2086b 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -1,7 +1,7 @@ #include "ProblemsListCell.hpp" #include "ProblemsListPopup.hpp" #include -#include +#include #include #include #include @@ -115,7 +115,7 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); m_menu->addChild(viewBtn); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 4f603e5d..28a37e1e 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -74,7 +74,7 @@ Slider* createSlider(C* node, GeodeSettingValue* setting, float width) { template std::pair< - MenuItemSpriteExtra*, MenuItemSpriteExtra* + CCMenuItemSpriteExtra*, CCMenuItemSpriteExtra* > createArrows(C* node, GeodeSettingValue* setting, float width, bool big) { auto yPos = setting->castDefinition().controls.slider ? 5.f : 0.f; auto decArrowSpr = CCSprite::createWithSpriteFrameName( @@ -83,7 +83,7 @@ std::pair< decArrowSpr->setFlipX(true); decArrowSpr->setScale(.3f); - auto decArrow = MenuItemSpriteExtra::create( + auto decArrow = CCMenuItemSpriteExtra::create( decArrowSpr, node, menu_selector(C::onArrow) ); decArrow->setPosition(-width / 2 + (big ? 65.f : 80.f), yPos); @@ -97,7 +97,7 @@ std::pair< ); incArrowSpr->setScale(.3f); - auto incArrow = MenuItemSpriteExtra::create( + auto incArrow = CCMenuItemSpriteExtra::create( incArrowSpr, node, menu_selector(C::onArrow) ); incArrow->setTag(big ? @@ -377,7 +377,7 @@ bool FileSettingNode::setup(FileSettingValue* setting, float width) { auto fileBtnSpr = CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"); fileBtnSpr->setScale(.5f); - auto fileBtn = MenuItemSpriteExtra::create( + auto fileBtn = CCMenuItemSpriteExtra::create( fileBtnSpr, this, menu_selector(FileSettingNode::onPickFile) ); fileBtn->setPosition(.0f, .0f); @@ -410,7 +410,7 @@ bool ColorSettingNode::setup(ColorSettingValue* setting, float width) { m_colorSpr->setColor(m_uncommittedValue); m_colorSpr->setScale(.65f); - auto button = MenuItemSpriteExtra::create( + auto button = CCMenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorSettingNode::onSelectColor) ); button->setPositionX(-10.f); @@ -445,7 +445,7 @@ bool ColorAlphaSettingNode::setup(ColorAlphaSettingValue* setting, float width) m_colorSpr->updateOpacity(m_uncommittedValue.a / 255.f); m_colorSpr->setScale(.65f); - auto button = MenuItemSpriteExtra::create( + auto button = CCMenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorAlphaSettingNode::onSelectColor) ); button->setPositionX(-10.f); diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.hpp b/loader/src/ui/internal/settings/GeodeSettingNode.hpp index 2a320b53..c32a6066 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.hpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -40,7 +40,7 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_nameLabel; CCLabelBMFont* m_errorLabel; - MenuItemSpriteExtra* m_resetBtn; + CCMenuItemSpriteExtra* m_resetBtn; bool init(GeodeSettingValue* setting, float width) { if (!SettingNode::init(setting)) @@ -81,7 +81,7 @@ protected: auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.6f); - auto infoBtn = MenuItemSpriteExtra::create( + auto infoBtn = CCMenuItemSpriteExtra::create( infoSpr, this, menu_selector(GeodeSettingNode::onDescription) ); infoBtn->setPosition( @@ -97,7 +97,7 @@ protected: auto resetBtnSpr = CCSprite::createWithSpriteFrameName("reset-gold.png"_spr); resetBtnSpr->setScale(.5f); - m_resetBtn = MenuItemSpriteExtra::create( + m_resetBtn = CCMenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(GeodeSettingNode::onReset) ); m_resetBtn->setPosition( @@ -210,10 +210,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - MenuItemSpriteExtra* m_decArrow = nullptr; - MenuItemSpriteExtra* m_incArrow = nullptr; - MenuItemSpriteExtra* m_bigDecArrow = nullptr; - MenuItemSpriteExtra* m_bigIncArrow = nullptr; + CCMenuItemSpriteExtra* m_decArrow = nullptr; + CCMenuItemSpriteExtra* m_incArrow = nullptr; + CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; + CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; @@ -239,10 +239,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - MenuItemSpriteExtra* m_decArrow = nullptr; - MenuItemSpriteExtra* m_incArrow = nullptr; - MenuItemSpriteExtra* m_bigDecArrow = nullptr; - MenuItemSpriteExtra* m_bigIncArrow = nullptr; + CCMenuItemSpriteExtra* m_decArrow = nullptr; + CCMenuItemSpriteExtra* m_incArrow = nullptr; + CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; + CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.cpp b/loader/src/ui/internal/settings/ModSettingsPopup.cpp index 369041a1..60f4b6f6 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.cpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.cpp @@ -90,7 +90,7 @@ bool ModSettingsPopup::setup(Mod* mod) { m_applyBtnSpr = ButtonSprite::create("Apply", "goldFont.fnt", "GJ_button_01.png", .7f); m_applyBtnSpr->setScale(.7f); - m_applyBtn = MenuItemSpriteExtra::create( + m_applyBtn = CCMenuItemSpriteExtra::create( m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply) ); m_applyBtn->setPosition(.0f, -m_size.height / 2 + 20.f); @@ -99,7 +99,7 @@ bool ModSettingsPopup::setup(Mod* mod) { auto resetBtnSpr = ButtonSprite::create("Reset All", "goldFont.fnt", "GJ_button_05.png", .7f); resetBtnSpr->setScale(.7f); - auto resetBtn = MenuItemSpriteExtra::create( + auto resetBtn = CCMenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(ModSettingsPopup::onResetAll) ); resetBtn->setPosition(-m_size.width / 2 + 45.f, -m_size.height / 2 + 20.f); @@ -109,7 +109,7 @@ bool ModSettingsPopup::setup(Mod* mod) { ButtonSprite::create("Open Folder", "goldFont.fnt", "GJ_button_05.png", .7f); openDirBtnSpr->setScale(.7f); - auto openDirBtn = MenuItemSpriteExtra::create( + auto openDirBtn = CCMenuItemSpriteExtra::create( openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory) ); openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f); diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.hpp b/loader/src/ui/internal/settings/ModSettingsPopup.hpp index d861e241..834214d5 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.hpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.hpp @@ -10,7 +10,7 @@ class ModSettingsPopup : public Popup, public SettingNodeDelegate { protected: Mod* m_mod; std::vector m_settings; - MenuItemSpriteExtra* m_applyBtn; + CCMenuItemSpriteExtra* m_applyBtn; ButtonSprite* m_applyBtnSpr; void settingValueChanged(SettingNode*) override; diff --git a/loader/src/ui/nodes/ColorPickPopup.cpp b/loader/src/ui/nodes/ColorPickPopup.cpp index db7b6a10..0fafb50f 100644 --- a/loader/src/ui/nodes/ColorPickPopup.cpp +++ b/loader/src/ui/nodes/ColorPickPopup.cpp @@ -157,7 +157,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) { okBtnSpr->setScale(.7f); auto okBtn = - MenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); + CCMenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); okBtn->setPosition(.0f, -m_size.height / 2 + 20.f); m_buttonMenu->addChild(okBtn); diff --git a/loader/src/ui/nodes/MDPopup.cpp b/loader/src/ui/nodes/MDPopup.cpp index 39d5153e..2f0929da 100644 --- a/loader/src/ui/nodes/MDPopup.cpp +++ b/loader/src/ui/nodes/MDPopup.cpp @@ -24,14 +24,14 @@ bool MDPopup::setup( auto btnSpr = ButtonSprite::create(btn1Text); - auto btn = MenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); + auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); btn->setTag(0); m_buttonMenu->addChild(btn); if (btn2Text) { auto btn2Spr = ButtonSprite::create(btn2Text); - auto btn2 = MenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); + auto btn2 = CCMenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); btn2->setTag(1); m_buttonMenu->addChild(btn2); diff --git a/loader/src/ui/nodes/MenuItemSpriteExtra.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp similarity index 58% rename from loader/src/ui/nodes/MenuItemSpriteExtra.cpp rename to loader/src/ui/nodes/MenuItemSprite.cpp index 64a71e64..cb6ec2a2 100644 --- a/loader/src/ui/nodes/MenuItemSpriteExtra.cpp +++ b/loader/src/ui/nodes/MenuItemSprite.cpp @@ -1,19 +1,19 @@ -#include +#include using namespace geode::prelude; -MenuItemSpriteExtra* MenuItemSpriteExtra::create( +MenuItemSprite* MenuItemSprite::create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - return MenuItemSpriteExtra::create(normalSprite, nullptr, target, callback); + return MenuItemSprite::create(normalSprite, nullptr, target, callback); } -MenuItemSpriteExtra* MenuItemSpriteExtra::create( +MenuItemSprite* MenuItemSprite::create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - auto ret = new MenuItemSpriteExtra(); + auto ret = new MenuItemSprite(); if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { ret->autorelease(); return ret; @@ -22,12 +22,12 @@ MenuItemSpriteExtra* MenuItemSpriteExtra::create( return nullptr; } -MenuItemSpriteExtra::MenuItemSpriteExtra() : m_scaleSprites(false) {} +MenuItemSprite::MenuItemSprite() {} -MenuItemSpriteExtra::~MenuItemSpriteExtra() { +MenuItemSprite::~MenuItemSprite() { } -void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { +void MenuItemSprite::setImage(cocos2d::CCNode* image) { if (image) { image->setAnchorPoint({ 0.5f, 0.5f }); image->setPosition(image->getContentSize() / 2); @@ -35,20 +35,20 @@ void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { } // why are the members private like what -void MenuItemSpriteExtra::setNormalImage(cocos2d::CCNode* image) { +void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { CCMenuItemSprite::setNormalImage(image); this->setImage(image); } -void MenuItemSpriteExtra::setDisabledImage(cocos2d::CCNode* image) { +void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { CCMenuItemSprite::setDisabledImage(image); this->setImage(image); } -void MenuItemSpriteExtra::setSelectedImage(cocos2d::CCNode* image) { +void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { CCMenuItemSprite::setSelectedImage(image); this->setImage(image); } -bool MenuItemSpriteExtra::init( +bool MenuItemSprite::init( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { @@ -67,41 +67,32 @@ bool MenuItemSpriteExtra::init( return true; } -void MenuItemSpriteExtra::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { +void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { if (sprite) { sprite->stopAllActions(); if (generator) sprite->runAction(generator); } } -void MenuItemSpriteExtra::runActionOnSprites(MiniFunction generator) { - if (m_scaleSprites) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); - } - else { - if (auto action = generator()) this->runAction(action); - } +void MenuItemSprite::runActionOnSprites(MiniFunction generator) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); } -void MenuItemSpriteExtra::activate() { +void MenuItemSprite::activate() { this->runActionOnSprites(m_activateAction); CCMenuItem::activate(); } -void MenuItemSpriteExtra::selected() { +void MenuItemSprite::selected() { if (!m_bEnabled) return; CCMenuItem::selected(); this->runActionOnSprites(m_selectedAction); } -void MenuItemSpriteExtra::unselected() { +void MenuItemSprite::unselected() { if (!m_bEnabled) return; CCMenuItem::unselected(); this->runActionOnSprites(m_unselectedAction); -} - -void MenuItemSpriteExtra::setScaleSprites(bool scale) { - m_scaleSprites = scale; } \ No newline at end of file diff --git a/loader/test/dependency/main.cpp b/loader/test/dependency/main.cpp index 4a2713b6..2f6bd35d 100644 --- a/loader/test/dependency/main.cpp +++ b/loader/test/dependency/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "main.hpp" @@ -92,7 +92,7 @@ protected: } else { btnSpr->setColor({ 200, 200, 200 }); } - auto btn = MenuItemSpriteExtra::create( + auto btn = CCMenuItemSpriteExtra::create( btnSpr, this, menu_selector(MySettingNode::onSelect) ); btn->setTag(static_cast(icon)); @@ -113,7 +113,7 @@ protected: } m_currentIcon = static_cast(sender->getTag()); static_cast( - static_cast(sender)->getNormalImage() + static_cast(sender)->getNormalImage() )->setColor({ 0, 255, 0 }); this->dispatchChanged(); } From a43dcc84cbd6aaab508e38273cfca1597e1dbae0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:42 +0300 Subject: [PATCH 067/270] Revert "Add MenuItemSprite" This reverts commit 152dc7edcf31691cd5d9a923b70387b4a562d40c. --- bindings/Cocos2d.bro | 5 - loader/include/Geode/ui/MenuItemSprite.hpp | 47 ---------- loader/include/Geode/ui/MenuItemToggle.hpp | 43 --------- loader/include/Geode/utils/MiniFunction.hpp | 24 ----- loader/src/ui/internal/list/ModListLayer.cpp | 4 +- loader/src/ui/nodes/MenuItemSprite.cpp | 98 -------------------- 6 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 loader/include/Geode/ui/MenuItemSprite.hpp delete mode 100644 loader/include/Geode/ui/MenuItemToggle.hpp delete mode 100644 loader/src/ui/nodes/MenuItemSprite.cpp diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 6f617e76..bde65aff 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -264,11 +264,6 @@ class cocos2d::CCEaseOut { static cocos2d::CCEaseOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1b70; } -[[link(win)]] -class cocos2d::CCEaseBounceOut { - static cocos2d::CCEaseBounceOut* create(cocos2d::CCActionInterval*) = mac 0x2a3b40; -} - [[link(win)]] class cocos2d::CCEGLView { CCEGLView(); diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp deleted file mode 100644 index 113eb80d..00000000 --- a/loader/include/Geode/ui/MenuItemSprite.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include "../utils/MiniFunction.hpp" - -#pragma warning(disable : 4275) - -namespace geode { - class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { - protected: - - MenuItemSprite(); - ~MenuItemSprite() override; - - public: - static MenuItemSprite* create( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - static MenuItemSprite* create( - cocos2d::CCNode* normalSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - bool init( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - void runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator); - void runActionOnSprites(utils::MiniFunction generator); - - utils::MiniFunction m_selectedAction; - utils::MiniFunction m_unselectedAction; - utils::MiniFunction m_activateAction; - - void activate() override; - void selected() override; - void unselected() override; - - void setImage(cocos2d::CCNode* image); - void setNormalImage(cocos2d::CCNode* image) override; - void setDisabledImage(cocos2d::CCNode* image) override; - void setSelectedImage(cocos2d::CCNode* image) override; - }; -} diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp deleted file mode 100644 index 6399773a..00000000 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include "MenuItemSprite.hpp" - -#pragma warning(disable : 4275) - -namespace geode { - class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { - protected: - MenuItemSprite* m_offButton; - MenuItemSprite* m_onButton; - bool m_toggled; - - MenuItemToggle(); - ~MenuItemToggle() override; - - public: - static MenuItemToggle* create( - cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - bool init( - cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - void setOffButton(MenuItemSprite* button); - void setOnButton(MenuItemSprite* button); - MenuItemSprite* getOffButton() const; - MenuItemSprite* getOnButton() const; - - bool isToggled() const; - void toggle(bool enabled); - - void setScale(float scale) override; - void activate() override; - void selected() override; - void unselected() override; - void setEnabled(bool enabled) override; - }; -} diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index 72cf1e19..edb66052 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -123,30 +123,6 @@ namespace geode::utils { return *this; } - template - requires(MiniFunctionCallable && !std::is_same_v, MiniFunction>) - MiniFunction& operator=(Callable&& func) { - delete m_state; - m_state = new MiniFunctionState, Ret, Args...>(std::forward(func)); - return *this; - } - - template - requires(!MiniFunctionCallable && std::is_pointer_v && std::is_function_v>) - MiniFunction& operator=(FunctionPointer func) { - delete m_state; - m_state = new MiniFunctionStatePointer(func); - return *this; - } - - template - requires(std::is_member_function_pointer_v) - MiniFunction& operator=(MemberFunctionPointer func) { - delete m_state; - m_state = new MiniFunctionStateMemberPointer(func); - return *this; - } - Ret operator()(Args... args) const { if (!m_state) return Ret(); return m_state->call(args...); diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index e950a521..a06e745c 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,8 +16,6 @@ #include #include -#include - #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -261,7 +259,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSprite::create( + auto backBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp deleted file mode 100644 index cb6ec2a2..00000000 --- a/loader/src/ui/nodes/MenuItemSprite.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include - -using namespace geode::prelude; - -MenuItemSprite* MenuItemSprite::create( - cocos2d::CCNode* normalSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - return MenuItemSprite::create(normalSprite, nullptr, target, callback); -} - -MenuItemSprite* MenuItemSprite::create( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - auto ret = new MenuItemSprite(); - if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { - ret->autorelease(); - return ret; - } - CC_SAFE_DELETE(ret); - return nullptr; -} - -MenuItemSprite::MenuItemSprite() {} - -MenuItemSprite::~MenuItemSprite() { -} - -void MenuItemSprite::setImage(cocos2d::CCNode* image) { - if (image) { - image->setAnchorPoint({ 0.5f, 0.5f }); - image->setPosition(image->getContentSize() / 2); - } -} - -// why are the members private like what -void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setNormalImage(image); - this->setImage(image); -} -void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setDisabledImage(image); - this->setImage(image); -} -void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setSelectedImage(image); - this->setImage(image); -} - -bool MenuItemSprite::init( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - if (!CCMenuItemSprite::initWithNormalSprite(normalSprite, disabledSprite, nullptr, target, callback)) return false; - - m_selectedAction = []() -> cocos2d::CCAction* { - return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.3f, 1.26f)); - }; - m_unselectedAction = []() -> cocos2d::CCAction* { - return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.4f, 1.0f)); - }; - m_activateAction = []() -> cocos2d::CCAction* { - return cocos2d::CCScaleTo::create(0.f, 1.0f); - }; - - return true; -} - -void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { - if (sprite) { - sprite->stopAllActions(); - if (generator) sprite->runAction(generator); - } -} - -void MenuItemSprite::runActionOnSprites(MiniFunction generator) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); -} - -void MenuItemSprite::activate() { - this->runActionOnSprites(m_activateAction); - CCMenuItem::activate(); -} -void MenuItemSprite::selected() { - if (!m_bEnabled) return; - CCMenuItem::selected(); - - this->runActionOnSprites(m_selectedAction); -} -void MenuItemSprite::unselected() { - if (!m_bEnabled) return; - CCMenuItem::unselected(); - - this->runActionOnSprites(m_unselectedAction); -} \ No newline at end of file From e87d52b7f02768c520392defac0e121a929f29cf Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 14:34:35 +0200 Subject: [PATCH 068/270] Add Windows bindings for PauseLayer buttons --- bindings/GeometryDash.bro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9f368269..3e93e98b 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4470,6 +4470,9 @@ class PauseLayer : CCBlockLayer { virtual void customSetup() = mac 0x20b300, win 0x1e4620; void onRestart(cocos2d::CCObject* sender) = win 0x1e6040; + void onPracticeMode(cocos2d::CCObject* sender) = win 0x1e5f30; + void onNormalMode(cocos2d::CCObject* sender) = win 0x1e5f60; + void onResume(cocos2d::CCObject* sender) = win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; From c60728446e69e29d13b41e3d83bac05570482bbf Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 15:10:03 +0200 Subject: [PATCH 069/270] Add Mac bindings for PauseLayer --- bindings/GeometryDash.bro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 3e93e98b..86438325 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4469,10 +4469,10 @@ class PauseLayer : CCBlockLayer { void createToggleButton(gd::string caption, cocos2d::SEL_MenuHandler callback, bool on, cocos2d::CCMenu* menu, cocos2d::CCPoint pos) = mac 0x20c890, win 0x1e5570; virtual void customSetup() = mac 0x20b300, win 0x1e4620; - void onRestart(cocos2d::CCObject* sender) = win 0x1e6040; - void onPracticeMode(cocos2d::CCObject* sender) = win 0x1e5f30; - void onNormalMode(cocos2d::CCObject* sender) = win 0x1e5f60; - void onResume(cocos2d::CCObject* sender) = win 0x1e5fa0; + void onRestart(cocos2d::CCObject* sender) = mac 0x20c860, win 0x1e6040; + void onPracticeMode(cocos2d::CCObject* sender) = mac 0x20c6d0, win 0x1e5f30; + void onNormalMode(cocos2d::CCObject* sender) = mac 0x20c720, win 0x1e5f60; + void onResume(cocos2d::CCObject* sender) = mac 0x20c760, win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; From 2a85c41eed7c6f260a8fd9e1a26183031caeb407 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 16:45:05 +0200 Subject: [PATCH 070/270] Add EditorPauseLayer::onResume to bindings --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 86438325..424993cd 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1272,7 +1272,7 @@ class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol { bool init(LevelEditorLayer*) = mac 0x13c7a0, win 0x730e0, ios 0x280cb8; void onExitEditor(cocos2d::CCObject* sender) = mac 0x13f180, win 0x75660; void playStep2() = mac 0x13f040, win 0x75440; - void onResume(cocos2d::CCObject* sender) = win 0x74fe0; + void onResume(cocos2d::CCObject* sender) = mac 0x13e170, win 0x74fe0; void onSaveAndPlay(cocos2d::CCObject* sender) = mac 0x13e1b0, win 0x753d0; void onSaveAndExit(cocos2d::CCObject* sender) = mac 0x13e230, win 0x75620; void onSave(cocos2d::CCObject* sender) = mac 0x13e290, win 0x755a0; From e98c1128968884d658ed8025467659d0459942da Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sat, 23 Sep 2023 18:44:59 +0200 Subject: [PATCH 071/270] Added 3 missing members to CCAnimateFrameCache I'm not entirely sure what they're for, I simply found that they exist --- bindings/GeometryDash.bro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6277683a..b6f7a3eb 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -280,6 +280,10 @@ class CCAnimatedSprite : cocos2d::CCSprite { class CCAnimateFrameCache : cocos2d::CCObject { static CCAnimateFrameCache* sharedSpriteFrameCache() = mac 0x2e4df0, win 0x158f0; void addSpriteFramesWithFile(const char* file) = win 0x159b0; + + cocos2d::CCDictionary* m_unknown1; + cocos2d::CCDictionary* m_unknown2; + cocos2d::CCDictionary* m_unknown3; } class CCBlockLayer : cocos2d::CCLayerColor { From 78e0e15e13dede1810c32c2a46cda8a8c2e25d0a Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sat, 23 Sep 2023 18:59:28 -0300 Subject: [PATCH 072/270] fix debug on windows --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99b5201f..657a3d52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,6 +218,11 @@ else() set(GEODE_PLATFORM_BIN_PATH ${GEODE_BIN_PATH}/${PROJECT_VERSION}/${GEODE_PLATFORM_BINARY}) endif() +if (WIN32) + # This allows you to compile in debug mode + add_compile_definitions(_HAS_ITERATOR_DEBUGGING=0) +endif() + if (PROJECT_IS_TOP_LEVEL) add_subdirectory(loader) From 9fa76b41ea8a8124b229484651145cab1a5c0f68 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 24 Sep 2023 01:20:14 +0200 Subject: [PATCH 073/270] Remove pad in LLM --- bindings/GeometryDash.bro | 1 - 1 file changed, 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b6f7a3eb..ba25be6c 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4275,7 +4275,6 @@ class LocalLevelManager : GManager { cocos2d::CCDictionary* getAllLevelsInDict() = mac 0x35e3d0, win 0x18d7c0; - PAD = mac 0x4, win 0x1C; cocos2d::CCDictionary* m_loadData; cocos2d::CCDictionary* m_levelData; cocos2d::CCArray* m_localLevels; From 696a2caf1fcb5050d6ba827322e4f42f108a2ad4 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:16:33 +0300 Subject: [PATCH 074/270] Make codegen sources private visibility --- CMakeLists.txt | 1 + loader/include/Geode/modify/Addresses.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 657a3d52..40e286c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,7 @@ target_include_directories(GeodeCodegenSources PRIVATE ${GEODE_LOADER_PATH}/include/Geode/cocos/extensions ${GEODE_LOADER_PATH}/include/Geode/fmod ) +set_target_properties(GeodeCodegenSources PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_features(GeodeCodegenSources PUBLIC cxx_std_20) if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(GeodeCodegenSources INTERFACE diff --git a/loader/include/Geode/modify/Addresses.hpp b/loader/include/Geode/modify/Addresses.hpp index 4f0d9518..bea14fdf 100644 --- a/loader/include/Geode/modify/Addresses.hpp +++ b/loader/include/Geode/modify/Addresses.hpp @@ -5,7 +5,7 @@ namespace geode::modifier { template - uintptr_t address(); + GEODE_HIDDEN uintptr_t address(); Result handlerMetadataForAddress(uintptr_t address); } From 0d62940c895a1cb4df34d2fc7d79805f150a163c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:25:59 +0300 Subject: [PATCH 075/270] add deadstrip to stripping macos strips in strip --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e286c3..fd0548ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,12 @@ target_include_directories(GeodeCodegenSources PRIVATE ) set_target_properties(GeodeCodegenSources PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_features(GeodeCodegenSources PUBLIC cxx_std_20) + +if (APPLE) + target_compile_options(GeodeCodegenSources PUBLIC -ffunction-sections -fdata-sections) + target_link_options(GeodeCodegenSources PUBLIC -dead_strip) +endif() + if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(GeodeCodegenSources INTERFACE "${GEODE_LOADER_PATH}/include/Geode/Bindings.hpp" From e189e89ff2dada9a2fec08bde1adb6f45dd14854 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 20:30:11 +0300 Subject: [PATCH 076/270] Aggressive issue template changes --- .github/ISSUE_TEMPLATE/crash-report.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index a0f69868..1876861b 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -1,7 +1,14 @@ name: Crash Report -description: Report a bug that crashes the game or prevents startup caused by Geode Loader (not individual mods). +description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others). labels: [ "unverified", "crash" ] body: + - type: checkboxes + attributes: + label: Geode Issue + description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. + options: + - label: I confirm that this crash is directly related to Geode Loader. + required: true - type: dropdown id: platform attributes: From 0b5c9c9b5ad24957631593995f2f35bb29b4dce7 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 14:37:25 -0300 Subject: [PATCH 077/270] fix callconv on this one function for some reason the fmod c functions arent stdcall on the dll, need to fix this for the other functions later --- loader/include/Geode/fmod/fmod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/fmod/fmod.h b/loader/include/Geode/fmod/fmod.h index c12bc9e4..43f26439 100644 --- a/loader/include/Geode/fmod/fmod.h +++ b/loader/include/Geode/fmod/fmod.h @@ -31,7 +31,7 @@ FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy); /* FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started. */ -FMOD_RESULT F_API FMOD_System_Create (FMOD_SYSTEM **system); +FMOD_RESULT /*F_API*/ FMOD_System_Create (FMOD_SYSTEM **system); FMOD_RESULT F_API FMOD_System_Release (FMOD_SYSTEM *system); /* From a20ee0d1fe4216266e97a60ac02db31c83a008cb Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 21:00:26 +0300 Subject: [PATCH 078/270] add some betteredit funcs --- bindings/Cocos2d.bro | 4 +++- bindings/GeometryDash.bro | 33 +++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index bde65aff..4ded4041 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -386,6 +386,7 @@ class cocos2d::CCKeypadHandler { [[link(win)]] class cocos2d::CCLabelBMFont { + CCLabelBMFont() = mac 0x347b60; static cocos2d::CCLabelBMFont* create(char const*, char const*) = mac 0x347660; auto limitLabelWidth(float, float, float) = mac 0x34a6e0, ios 0x21b740; auto setFntFile(char const*) = mac 0x34a5f0; @@ -393,7 +394,7 @@ class cocos2d::CCLabelBMFont { static auto create() = mac 0x3473f0; virtual auto init() = mac 0x347b10, ios 0x2198e0; - bool initWithString(const char* str, const char* fnt, float width, cocos2d::CCTextAlignment align, cocos2d::CCPoint offset); + bool initWithString(const char* str, const char* fnt, float width, cocos2d::CCTextAlignment align, cocos2d::CCPoint offset) = mac 0x347710; virtual auto setScaleX(float) = mac 0x34a5b0, ios 0x21b6e8; virtual auto setScaleY(float) = mac 0x34a5d0, ios 0x21b714; virtual auto setScale(float) = mac 0x34a590, ios 0x21b6bc; @@ -1263,6 +1264,7 @@ class cocos2d { static auto ccGLBindTexture2D(GLuint) = mac 0x1ae610; static auto ccGLBindTexture2DN(GLuint, GLuint) = mac 0x1ae650; static float ccpDistance(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0x1aaf90; + static auto ccDrawLine(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0xeccc0; static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ba25be6c..cb619b42 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -909,6 +909,8 @@ class CommentUploadDelegate { } class ConfigureHSVWidget : cocos2d::CCNode { + bool init(int abs, cocos2d::ccHSVValue val) = win 0x4a3f0, mac 0x237310; + void updateLabels() = win 0x4adf0, mac 0x237df0; cocos2d::CCLabelBMFont* m_hueLabel; cocos2d::CCLabelBMFont* m_saturationLabel; cocos2d::CCLabelBMFont* m_brightnessLabel; @@ -1030,7 +1032,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele void onClose(cocos2d::CCObject*) = mac 0xdf660, win 0x57ac0; void updateSelected(int channelID) = mac 0xe0970, win 0x57850; bool init(GameObject* target, cocos2d::CCArray* targets) = mac 0xdd560, win 0x53e00; - void onHSV(cocos2d::CCObject* sender) = win 0x567c0; + void onHSV(cocos2d::CCObject* sender) = win 0x567c0, mac 0xdfa00; void toggleVisible() = mac 0xe1140, win 0x56fb0; void highlightSelected(ButtonSprite* target) = mac 0xe0aa0, win 0x579d0; void updateCustomColorLabels() = mac 0xdff40, win 0x576d0; @@ -1039,8 +1041,8 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele // inlined in most places void updateChannelLabel(int channel) = mac 0xe06e0, win 0x56f50; virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) = win 0x56990; - virtual void colorSelectClosed(cocos2d::CCNode*) = mac 0xe0c70, win 0x564a0; - virtual void textChanged(CCTextInputNode* input) = mac 0xe16a0, win 0x574d0; + virtual void colorSelectClosed(cocos2d::CCNode*) = mac 0xe0610, win 0x564a0; + virtual void textChanged(CCTextInputNode* input) = mac 0xe1470, win 0x574d0; inline CustomizeObjectLayer() {} ~CustomizeObjectLayer() = win 0x53c30; @@ -1140,7 +1142,7 @@ class DrawGridLayer : cocos2d::CCLayer { } bool init(cocos2d::CCNode* grid, LevelEditorLayer* editor) = win 0x16c4d0; - void draw() = win 0x16ce90; + virtual void draw() = win 0x16ce90, mac 0xa3c40; virtual void update(float) = win 0x16cd80; void clearPlayerPoints() { m_playerNodePoints->removeAllObjects(); @@ -1356,8 +1358,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void onCreateButton(cocos2d::CCObject* sender) = mac 0x1fd70, win 0x854f0; CCMenuItemSpriteExtra* getSpriteButton(const char* sprite, cocos2d::SEL_MenuHandler callback, cocos2d::CCMenu* menu, float scale) = mac 0xb500, win 0x78bf0; cocos2d::CCPoint offsetForKey(int objID) = win 0x92310; - void updateDeleteMenu() = win 0x7c5d0; - void updateCreateMenu(bool updateTab) = mac 0x1e960, win 0x85530; + void updateDeleteMenu() = win 0x7c5d0, mac 0x1e960; + void updateCreateMenu(bool updateTab) = mac 0x1ba80, win 0x85530; void toggleMode(cocos2d::CCObject* sender) = mac 0x187b0, win 0x7ad20; void zoomIn(cocos2d::CCObject* sender) = mac 0xc0c0, win 0x877c0; void zoomOut(cocos2d::CCObject* sender) = mac 0xc120, win 0x87830; @@ -1425,6 +1427,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void sliderChanged(cocos2d::CCObject* slider) = mac 0xaed0, win 0x78cc0; void repositionObjectsToCenter(cocos2d::CCArray* objs, cocos2d::CCPoint center, bool ignoreGroupParent) = mac 0x1fcd0, win 0x88410; virtual void draw() = win 0x8fbe0; + float valueFromXPos(float val) = win 0x78e30, mac 0x1c810; bool m_isPlayingMusic; EditButtonBar* m_buttonBar; @@ -3602,7 +3605,7 @@ class GameToolbox { static cocos2d::CCDictionary* stringSetupToDict(gd::string text, char const* delimeter) = mac 0x28d700, win 0x272a0; static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, cocos2d::CCArray* toggleArray) = mac 0x28bc90, win 0x25fe0; static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, float checkboxScale, float labelSize, float maxWidth, cocos2d::CCPoint labelOffset, const char* unknown, bool anchorHorizontally, int toggleTag, cocos2d::CCArray* toggleArray) = mac 0x28bdd0, win 0x25fe0; - static cocos2d::ccColor3B transformColor(cocos2d::ccColor3B const& src, cocos2d::ccHSVValue hsv) = win 0x26a60; + static cocos2d::ccColor3B transformColor(cocos2d::ccColor3B const& src, cocos2d::ccHSVValue hsv) = win 0x26a60, mac 0x28c950; static void alignItemsHorisontally(cocos2d::CCArray* array, float pad, cocos2d::CCPoint start, bool idk) = win 0x25b20; static gd::map stringSetupToMap(gd::string, char const*) = mac 0x28d4c0; static cocos2d::ccColor3B multipliedColorValue(cocos2d::ccColor3B color1, cocos2d::ccColor3B color2, float factor) = win 0x26CE0; @@ -3641,7 +3644,7 @@ class GauntletSelectLayer { class GhostTrailEffect {} class HSVWidgetPopup : FLAlertLayer { - bool init(cocos2d::_ccHSVValue value, HSVWidgetPopupDelegate* delegate, gd::string title); + bool init(cocos2d::_ccHSVValue value, HSVWidgetPopupDelegate* delegate, gd::string title) = win 0x49f10, mac 0x236d30; void onClose(cocos2d::CCObject* sender) = win 0x4a280; ConfigureHSVWidget* m_configureWidget; @@ -3760,6 +3763,7 @@ class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerPr void updateLevelsLabel() = mac 0x255450, win 0x15c350; void onRefresh(cocos2d::CCObject* sender) = mac 0x253090; void onInfo(cocos2d::CCObject* sender) = mac 0x253170, win 0x15cb00; + void onNew(cocos2d::CCObject* sender) = win 0x15cbf0, mac 0x252ac0; static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00; PAD = win 0x4, mac 0x8; @@ -4019,7 +4023,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDelegate, RateLevelDelegate, LikeItemDelegate, FLAlertLayerProtocol, LevelDeleteDelegate, NumberInputDelegate, SetIDPopupDelegate { static LevelInfoLayer* create(GJGameLevel* level) = mac 0x15f290, win 0x175d50; bool init(GJGameLevel* level) = win 0x175df0, mac 0x15f520; - void onGarage(cocos2d::CCObject* sender) = win 0x177c10; + void onGarage(cocos2d::CCObject* sender) = win 0x177c10, mac 0x163ac0; void onViewProfile(cocos2d::CCObject* sender) = mac 0x1617d0, win 0x17ac90; void onLevelInfo(cocos2d::CCObject* sender) = mac 0x163880, win 0x17acf0; void setupProgressBars() = win 0x177fc0; @@ -4490,8 +4494,8 @@ class PauseLayer : CCBlockLayer { void onResume(cocos2d::CCObject* sender) = mac 0x20c760, win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; - void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; - void sfxSliderChanged(cocos2d::CCObject* sender) = win 0x1ddfa0; + void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0, mac 0x20cb00; + void sfxSliderChanged(cocos2d::CCObject* sender) = win 0x1ddfa0, mac 0x20cb40; bool m_unknown; bool m_unknown2; @@ -5259,6 +5263,9 @@ class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { void updateZOrder() = win 0x22e3d0; void onAddGroup(cocos2d::CCObject* sender) = mac 0x1967d0, win 0x22de20; void onClose(cocos2d::CCObject* sender) = mac 0x1966a0, win 0x22e830; + void onEditorLayer(CCObject* sender) = win 0x22d690, mac 0x196800; + void onEditorLayer2(CCObject* sender) = win 0x22d710, mac 0x196a40; + void onZOrder(CCObject* sender) = win 0x22de80, mac 0x196920; GameObject* m_targetObject; cocos2d::CCArray* m_targetObjects; @@ -5369,12 +5376,14 @@ class SetupOpacityPopup : FLAlertLayer { class SetupPickupTriggerPopup : FLAlertLayer { static SetupPickupTriggerPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x35e70, win 0x23d4a0; + bool init(EffectGameObject* obj, cocos2d::CCArray* arr) = win 0x23d550, mac 0x36070; void onItemIDArrow(cocos2d::CCObject*) = mac 0x37100; void onNextItemID(cocos2d::CCObject*) = mac 0x37260; void textChanged(CCTextInputNode*) = mac 0x37ca0; void updateItemID() = mac 0x37ab0, win 0x23e4f0; - PAD = win 0xc; + PAD = win 0xc, mac 0x18; + CCTextInputNode* m_itemIDInput; CCTextInputNode* m_countInput; } From 3a319394e30cfa18295b8689e9289dfb7cb6e42e Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:16:43 -0300 Subject: [PATCH 079/270] fix HardStreak::updateStroke --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cb619b42..af6bb748 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3667,7 +3667,7 @@ class HardStreak : cocos2d::CCDrawNode { void reset() = mac 0x5c930; void resumeStroke() = mac 0x5c210; void stopStroke() = mac 0x5c8f0, win 0x14e460; - void updateStroke(float) = mac 0x5c240, win 0x14e530; + callback void updateStroke(float) = mac 0x5c240, win 0x14e530; cocos2d::CCArray* m_pointsArr; cocos2d::CCPoint m_currentPoint; From 53b533f1d8516fdefa39eba9089083d47b2e70e6 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:40:42 -0300 Subject: [PATCH 080/270] fix missing cocos2d:: --- bindings/GeometryDash.bro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index af6bb748..6937aed5 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5263,9 +5263,9 @@ class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { void updateZOrder() = win 0x22e3d0; void onAddGroup(cocos2d::CCObject* sender) = mac 0x1967d0, win 0x22de20; void onClose(cocos2d::CCObject* sender) = mac 0x1966a0, win 0x22e830; - void onEditorLayer(CCObject* sender) = win 0x22d690, mac 0x196800; - void onEditorLayer2(CCObject* sender) = win 0x22d710, mac 0x196a40; - void onZOrder(CCObject* sender) = win 0x22de80, mac 0x196920; + void onEditorLayer(cocos2d::CCObject* sender) = win 0x22d690, mac 0x196800; + void onEditorLayer2(cocos2d::CCObject* sender) = win 0x22d710, mac 0x196a40; + void onZOrder(cocos2d::CCObject* sender) = win 0x22de80, mac 0x196920; GameObject* m_targetObject; cocos2d::CCArray* m_targetObjects; From 30a41e54b7aaabc43a55a11169c8e4b883bf1d6c Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 24 Sep 2023 20:49:20 +0200 Subject: [PATCH 081/270] Add GJGameLevel::savePercentage This commit is dedicated to Crystal Client ninXout Windows 7, Windows 8, Windows 9, Windows 10, and Windows 11 --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6937aed5..b097d128 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2291,7 +2291,7 @@ class GJGameLevel : cocos2d::CCNode { void getLengthKey(int) = mac 0x2dbba0; void getNormalPercent() = mac 0x2b8b20; void levelWasAltered() = mac 0x2db530, win 0xbd550; - void savePercentage(int, bool, int, int, bool) = mac 0x2db700; + void savePercentage(int, bool, int, int, bool) = mac 0x2db700, win 0xbd5c0; void dataLoaded(DS_Dictionary* dict) = mac 0x2dc0e0, win 0xbded0, ios 0x6fca4; GJDifficulty getAverageDifficulty() = win 0xbd9b0; gd::string getUnpackedLevelDescription() = mac 0x2DDB50, win 0xbf890; From 0ac539788464e49efdbc8e6fd9a25666e45de0b4 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 21:46:41 -0300 Subject: [PATCH 082/270] add PlayLayer::startGame --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b097d128..d90c5274 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4648,7 +4648,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void spawnFirework() = mac 0x74200; void spawnParticle(char const*, int, cocos2d::tCCPositionType, cocos2d::CCPoint) = mac 0x76330; void spawnPlayer2() = mac 0x7d170, win 0x2089e0; - void startGame() = mac 0x726b0; + void startGame() = mac 0x726b0, win 0x1fd390; void startMusic() = mac 0x72910, win 0x20C8F0; void startRecording() = mac 0x7fec0; void startRecordingDelayed() = mac 0x7fed0; From 60e707d6a492f44e0f279f96550735cec7e99be2 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 22:11:27 -0300 Subject: [PATCH 083/270] add PlayLayer::toggleGhostEffect --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d90c5274..345401cd 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4664,7 +4664,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void toggleBGEffectVisibility(bool) = mac 0x7fe80; void toggleDualMode(GameObject*, bool, PlayerObject*, bool) = mac 0x7bf90, win 0x208880; void toggleFlipped(bool, bool) = mac 0x7bdc0, win 0x20ab20; - void toggleGhostEffect(int) = mac 0x7fe40; + void toggleGhostEffect(int) = mac 0x7fe40, win 0x1f8930; void toggleGlitter(bool) = mac 0x70e00, win 0x20a0d0; void togglePracticeMode(bool) = mac 0x7f9e0, win 0x20d0d0; void toggleProgressbar() = mac 0x6eeb0, win 0x208160; From 0949d86b32fd1a18947cd810b909ce1e6f0d057c Mon Sep 17 00:00:00 2001 From: ninXout Date: Mon, 25 Sep 2023 18:03:41 -0400 Subject: [PATCH 084/270] Add CCTransitionFade::initWithDuration for mac --- bindings/Cocos2d.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4ded4041..b31a8d3a 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1136,6 +1136,7 @@ class cocos2d::CCTouchHandler { [[link(win)]] class cocos2d::CCTransitionFade { static cocos2d::CCTransitionFade* create(float, cocos2d::CCScene*) = mac 0x8ea30, ios 0x12c244; + virtual bool initWithDuration(float t, cocos2d::CCScene* scene, cocos2d::ccColor3B const& color) = mac 0x8e930; } [[link(win)]] From ea4341b38ad70130c0324c67a57da56b2d34fc21 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Mon, 25 Sep 2023 19:23:29 -0300 Subject: [PATCH 085/270] some missing geode custom ctors --- .../cocos/layers_scenes_transitions_nodes/CCTransition.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h index 8ebcda4e..d55ec10d 100644 --- a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h +++ b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h @@ -90,6 +90,7 @@ protected: bool m_bIsSendCleanupToScene; public: + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionScene, CCScene) /** * @js ctor */ @@ -147,6 +148,7 @@ public: * @js ctor */ CCTransitionSceneOriented(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionSceneOriented, CCTransitionScene) /** * @js NA * @lua NA @@ -171,6 +173,7 @@ public: * @js ctor */ CCTransitionRotoZoom(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionRotoZoom, CCTransitionScene) /** * @js NA * @lua NA @@ -623,6 +626,7 @@ public: * @js ctor */ CCTransitionFade(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionFade, CCTransitionScene) /** * @js NA * @lua NA From 90ea3920345937f9c43508a756021e190fd7c827 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:30:26 +0000 Subject: [PATCH 086/270] Add a bunch of mac offsets might add more but this is necessary for a mod im doing --- bindings/GeometryDash.bro | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 345401cd..dd72341d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1765,8 +1765,8 @@ class FMODSound : cocos2d::CCNode { class FriendRequestDelegate {} class FriendsProfilePage : FLAlertLayer, FLAlertLayerProtocol, UploadActionDelegate, UploadPopupDelegate, UserListDelegate { - static FriendsProfilePage* create(UserListType) = win 0x9ce80; - bool init(UserListType) = win 0x9cf30; + static FriendsProfilePage* create(UserListType) = win 0x9ce80, mac 0x3a9570; + bool init(UserListType) = win 0x9cf30, mac 0x3a9770; } class GJAccountBackupDelegate { @@ -4026,9 +4026,9 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void onGarage(cocos2d::CCObject* sender) = win 0x177c10, mac 0x163ac0; void onViewProfile(cocos2d::CCObject* sender) = mac 0x1617d0, win 0x17ac90; void onLevelInfo(cocos2d::CCObject* sender) = mac 0x163880, win 0x17acf0; - void setupProgressBars() = win 0x177fc0; + void setupProgressBars() = win 0x177fc0, mac 0x1627e0; void setupLevelInfo() = mac 0x161C80, win 0x178680; - void downloadLevel() = win 0x177d90; + void downloadLevel() = win 0x177d90, mac 0x161b90; void onPlay(cocos2d::CCObject* sender) = mac 0x161840, win 0x179730; virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; @@ -4104,9 +4104,9 @@ class LevelSettingsDelegate { class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer2* create() = win 0x21FD70; - bool init() = win 0x21FE10; - bool onSubmit(cocos2d::CCObject*) = win 0x221ac0; - void updateSearchLabel(const char* text) = win 0x222FC0; + bool init() = win 0x21FE10, mac 0x25fe70; + bool onSubmit(cocos2d::CCObject*) = win 0x221ac0, mac 0x2611a0; + void updateSearchLabel(const char* text) = win 0x222FC0, mac 0x260e10; void showCompletedLevel() = win 0x220C10; } From c0947265e0be7081c066e7fb1f6052bbdbef15fd Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:22:35 +0200 Subject: [PATCH 087/270] add GJAccountManager::getGJP i didn't find either of those but thanks Coloride for win and Firee for mac --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index dd72341d..f174b9a1 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1795,6 +1795,7 @@ class GJAccountLoginDelegate { class GJAccountManager : cocos2d::CCNode { static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50; + gd::string getGJP() = mac 0x89520, win 0x10abb0; PAD = mac 0x8, win 0x4; gd::string m_password; From 5c0369109b91da9ca8606450feef9e9fc3a0b21c Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:57:34 +0000 Subject: [PATCH 088/270] Update SimplePlayer bindings why werent these found earlier --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index f174b9a1..c99ca6ef 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5461,9 +5461,9 @@ class SimplePlayer : cocos2d::CCSprite { static SimplePlayer* create(int iconID) = mac 0x1b6140, win 0x12bd80; void updatePlayerFrame(int iconID, IconType iconType) = mac 0x1b62f0, win 0x12c650; void updateColors() = mac 0x1ba1f0, win 0x12c440, ios 0x224f2c; - void setFrames(const char* firstLayer, const char* secondLayer, const char* birdDome, const char* outlineSprite, const char* detailSprite) = win 0x12c9e0; + void setFrames(const char* firstLayer, const char* secondLayer, const char* birdDome, const char* outlineSprite, const char* detailSprite) = mac 0x1bca10, win 0x12c9e0; virtual void setColor(const cocos2d::ccColor3B& color) = mac 0x1bc9b0, win 0x12c410; - virtual void setOpacity(unsigned char opacity) = win 0x12cb90; + virtual void setOpacity(unsigned char opacity) = mac 0x135370, win 0x12cb90; cocos2d::CCSprite* m_firstLayer; cocos2d::CCSprite* m_secondLayer; From 499f2569cbe7e413835039e4dfff0442c7fca7c5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:12:00 +0300 Subject: [PATCH 089/270] readd the nullptr check in InstallListPopup::createCells --- loader/src/ui/internal/list/InstallListPopup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index e561ca9b..42beb812 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -113,7 +113,7 @@ CCArray* InstallListPopup::createCells(std::unordered_mapisUninstalled()*/item.mod->getMetadata().getID() == "geode.loader") { + if (item.mod && /*!item.mod->isUninstalled()*/item.mod->getMetadata().getID() == "geode.loader") { bottom.push_back(ModInstallListCell::create(item.mod, this, this->getCellSize())); for (auto const& dep : item.mod->getMetadata().getDependencies()) { queue.push(dep); From dd0179c42ae1bbc3b626e55d58bd475bcc400b5e Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:27:11 +0300 Subject: [PATCH 090/270] Fix garagelayer ids on not logged in users --- bindings/GeometryDash.bro | 1 + loader/src/ids/GJGarageLayer.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index c99ca6ef..e4088c89 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1801,6 +1801,7 @@ class GJAccountManager : cocos2d::CCNode { gd::string m_password; gd::string m_username; int m_accountID; + int m_playerID; } class GJAccountSyncDelegate { diff --git a/loader/src/ids/GJGarageLayer.cpp b/loader/src/ids/GJGarageLayer.cpp index 57d644c5..b4ea8425 100644 --- a/loader/src/ids/GJGarageLayer.cpp +++ b/loader/src/ids/GJGarageLayer.cpp @@ -7,8 +7,11 @@ using namespace geode::prelude; $register_ids(GJGarageLayer) { + // the lock does not exist for not logged in users + auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0; + setIDSafe(this, 2, "username-label"); - setIDSafe(this, 6, "player-icon"); + setIDSafe(this, 6 + loggedInOffset, "player-icon"); auto winSize = CCDirector::get()->getWinSize(); @@ -39,7 +42,7 @@ $register_ids(GJGarageLayer) { setIDs( this, - 10, + 10 + loggedInOffset, "cube-selection-menu", "ship-selection-menu", "ball-selection-menu", From 9a1e085d185eed679c374c9eb6be96c573bd7a5a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:35:14 +0300 Subject: [PATCH 091/270] add GJAccountManager::get --- bindings/GeometryDash.bro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e4088c89..e652c130 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1795,6 +1795,9 @@ class GJAccountLoginDelegate { class GJAccountManager : cocos2d::CCNode { static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50; + static GJAccountManager* get() { + return GJAccountManager::sharedState(); + } gd::string getGJP() = mac 0x89520, win 0x10abb0; PAD = mac 0x8, win 0x4; From a5c626647e379e82f702867644aab008e480004f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:04:26 +0300 Subject: [PATCH 092/270] add some be bindings --- bindings/GeometryDash.bro | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e652c130..2f8bbeba 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1309,6 +1309,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void create(LevelEditorLayer*) = mac 0x8a80, win 0x76270; cocos2d::CCArray* createCustomItems() = mac 0x1ddf0, win 0x7a370; + void onDeleteCustomItem(CCObject* pSender) = win 0x7a280, mac 0x29860; + void onNewCustomItem(CCObject* pSender) = win 0x79fd0, mac 0x24480; void deselectAll() = mac 0x1f300, win 0x86af0; void onDeselectAll(cocos2d::CCObject*) = mac 0x19cd0, win 0x86ac0; void disableButton(CreateMenuItem*) = mac 0x1c0f0, win 0x78af0; @@ -2596,21 +2598,21 @@ class GJScaleControl : cocos2d::CCLayer { virtual void ccTouchMoved(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x31e60, win 0x94840; virtual void ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x31fb0, win 0x94940; virtual void ccTouchCancelled(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x32060, win 0x2dea0; // shared with many others - void updateLabel(float value) = win 0x94990; + void updateLabel(float value) = win 0x94990, mac 0x31c90; void loadValues(GameObject* obj, cocos2d::CCArray* objs) = win 0x94590, mac 0x24f40; Slider* m_slider; unsigned int m_touchID; float m_value; - PAD = mac 0x8, win 0x4; + bool m_shouldSnapAt1; cocos2d::CCLabelBMFont* m_label; GJScaleControlDelegate* m_delegate; } class GJScaleControlDelegate { + virtual void scaleChanged(float) {} virtual void scaleChangeBegin() {} virtual void scaleChangeEnded() {} - virtual void scaleChanged(float) {} } class GJScoreCell : TableViewCell, FLAlertLayerProtocol { From ccde9a28b00c0c43895d27f96f83c97c537473b8 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:27:37 +0300 Subject: [PATCH 093/270] update crash report issue template --- .github/ISSUE_TEMPLATE/crash-report.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 1876861b..3b75839c 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -7,7 +7,10 @@ body: label: Geode Issue description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. options: - - label: I confirm that this crash is directly related to Geode Loader. + - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. + description: | + Please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. required: true - type: dropdown id: platform From 20733278af129fef2f49752bb21f083fcc59578e Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:28:53 +0300 Subject: [PATCH 094/270] fix last commit --- .github/ISSUE_TEMPLATE/crash-report.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 3b75839c..a5d6a8aa 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -5,12 +5,12 @@ body: - type: checkboxes attributes: label: Geode Issue - description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. + description: | + The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. options: - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. - description: | - Please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. - Failing to do this will get your issue *closed without explanation*. required: true - type: dropdown id: platform From 51c2546e12d2c146973c8a6a786fae5fad481fe9 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:30:02 +0300 Subject: [PATCH 095/270] label doesnt support markdown github please add a way to preview issue templates smh --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index a5d6a8aa..9e882af8 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -10,7 +10,7 @@ body: When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. Failing to do this will get your issue *closed without explanation*. options: - - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. + - label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself. required: true - type: dropdown id: platform From 381e0ec43ac7c31e687b0eaafeb807ce252308fc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 08:13:54 +0300 Subject: [PATCH 096/270] uilayer --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2f8bbeba..4149adcf 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5778,7 +5778,7 @@ class UILayer : cocos2d::CCLayerColor { virtual void keyDown(cocos2d::enumKeyCodes key) = mac 0x280470, win 0x25f890; virtual void keyUp(cocos2d::enumKeyCodes key) = mac 0x280600, win 0x25fa10; UILayer() = win 0x25f230; - ~UILayer() = win 0x25fef0; + ~UILayer() = win 0x25fef0, mac 0x280c90; PAD = mac 0x16, win 0x8, android 0x8; cocos2d::CCMenu* m_checkPointMenu; From 5d5b90e67cbc501423b4cdb1786f95309959b880 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 08:14:50 +0300 Subject: [PATCH 097/270] add the cocos namespace --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 4149adcf..ac814eef 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1309,8 +1309,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void create(LevelEditorLayer*) = mac 0x8a80, win 0x76270; cocos2d::CCArray* createCustomItems() = mac 0x1ddf0, win 0x7a370; - void onDeleteCustomItem(CCObject* pSender) = win 0x7a280, mac 0x29860; - void onNewCustomItem(CCObject* pSender) = win 0x79fd0, mac 0x24480; + void onDeleteCustomItem(cocos2d::CCObject* pSender) = win 0x7a280, mac 0x29860; + void onNewCustomItem(cocos2d::CCObject* pSender) = win 0x79fd0, mac 0x24480; void deselectAll() = mac 0x1f300, win 0x86af0; void onDeselectAll(cocos2d::CCObject*) = mac 0x19cd0, win 0x86ac0; void disableButton(CreateMenuItem*) = mac 0x1c0f0, win 0x78af0; From 6a3f8e01cedd4ae67af0f1f3a24b6dd35a5c9459 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 30 Sep 2023 18:13:40 +0300 Subject: [PATCH 098/270] mac CCNode::convertTo*SpaceAR reimpl --- bindings/Cocos2d.bro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index b31a8d3a..9694c00b 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -638,6 +638,12 @@ class cocos2d::CCNode { virtual auto cleanup() = mac 0x123100, ios 0x15e3a4; auto convertToNodeSpace(cocos2d::CCPoint const&) = mac 0x124750, ios 0x15f55c; auto convertToWorldSpace(cocos2d::CCPoint const&) = mac 0x124790; + cocos2d::CCPoint convertToNodeSpaceAR(cocos2d::CCPoint const& worldPoint) { + return convertToNodeSpace(worldPoint) - getAnchorPointInPoints(); + } + cocos2d::CCPoint convertToWorldSpaceAR(cocos2d::CCPoint const& nodePoint) { + return convertToWorldSpace(nodePoint + getAnchorPointInPoints()); + } static cocos2d::CCNode* create() = mac 0x1230a0; virtual auto draw() = mac 0x123840, ios 0x15e974; auto getActionByTag(int) = mac 0x123ee0; From c768742dd4d68432d4fe27654c9db96210c27a56 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 19:22:51 +0300 Subject: [PATCH 099/270] Add the checkbox to bug report --- .github/ISSUE_TEMPLATE/bug-report.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 8847d1ff..1c0a4994 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,7 +1,17 @@ name: Bug Report -description: Report a bug where something is not working as expected in Geode Loader (not specific mods), which does not crash the game. +description: Report a Geode bug (not mods themselves) where something is not working as expected in Geode Loader (not mods created by others), which does not crash the game. labels: [ "unverified", "bug" ] body: + - type: checkboxes + attributes: + label: Geode Issue + description: | + The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. + When submitting a bug report, please make sure that the bug is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. + options: + - label: I confirm that this bug is NOT related to a mod but directly to Geode Loader itself. + required: true - type: dropdown id: platform attributes: From 3e7b1d7e19d2c3574bfdb4f8bcc66f0fea758092 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 12:57:55 +0300 Subject: [PATCH 100/270] Update crash-report.yml --- .github/ISSUE_TEMPLATE/crash-report.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 9e882af8..636b5b0a 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -2,16 +2,17 @@ name: Crash Report description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others). labels: [ "unverified", "crash" ] body: - - type: checkboxes + - type: input + id: geode-confirmation attributes: label: Geode Issue description: | The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. - When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. - options: - - label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself. - required: true + placeholder: "Please, read the text above." + validations: + required: true - type: dropdown id: platform attributes: From cca9e95c6e894a51f8e5aa5692c32f620947cd91 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 12:58:21 +0300 Subject: [PATCH 101/270] Update crash-report.yml --- .github/ISSUE_TEMPLATE/crash-report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 636b5b0a..776fbc64 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -11,8 +11,8 @@ body: When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. placeholder: "Please, read the text above." - validations: - required: true + validations: + required: true - type: dropdown id: platform attributes: From 66bdbb288808a3db86d6139609253a100054937b Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 13:00:58 +0300 Subject: [PATCH 102/270] it's below oops --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 776fbc64..fc0a62f3 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -10,7 +10,7 @@ body: The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. - placeholder: "Please, read the text above." + placeholder: "Please, read the text below." validations: required: true - type: dropdown From fd40288064327796905cc9b3ae32d2288c9a2cdd Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 13:02:02 +0300 Subject: [PATCH 103/270] and this is above --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index fc0a62f3..f4c372a4 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -8,7 +8,7 @@ body: label: Geode Issue description: | The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. - When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field above. Failing to do this will get your issue *closed without explanation*. placeholder: "Please, read the text below." validations: From dd066d9b1e1302c808cb67031d28ecf757ca2201 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:28:10 -0300 Subject: [PATCH 104/270] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed989299..094bce59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Geode Changelog +## v1.3.5 + * Follow redirect in web::utils functions (a942a45) + * Lots of bindings + * Make codegen symbols private visibility (696a2ca) + * Add deadstrip to macos (0d62940) + * Readd the nullptr check in InstallListPopup::createCells (499f256) + * Fix garagelayer ids on not logged in users (dd0179c) + ## v1.3.4 * Implement string setting character filters (cf8fbba) * Update bindings From 4b82a0fb952b45cef40d3e34de10280a163e5a08 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:28:33 -0300 Subject: [PATCH 105/270] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8c9698aa..80e78df6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.4 \ No newline at end of file +1.3.5 From fed73fefd6d6174d47d2f771633e13494c0ff0aa Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:23:48 +0300 Subject: [PATCH 106/270] Revert loading layer --- loader/src/hooks/LoadingLayer.cpp | 43 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 27c15824..00c5e80e 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -108,7 +108,7 @@ struct CustomLoadingLayer : Modify { } int getTotalStep() { - return 17; + return 18; } void updateLoadingBar() { @@ -137,28 +137,23 @@ struct CustomLoadingLayer : Modify { } // hook - void loadAssets() { - if (m_loadStep == 14) { - switch (m_fields->m_geodeLoadStep) { - case 0: - if (this->skipOnRefresh()) this->setupLoadingMods(); - break; - case 1: - if (this->skipOnRefresh()) this->setupLoaderResources(); - break; - case 2: - this->setupModResources(); - break; - case 3: - default: - LoadingLayer::loadAssets(); - this->updateLoadingBar(); - break; - } - return; - } - this->setSmallText("Loading game resources"); - LoadingLayer::loadAssets(); + void loadAssets() { + switch (m_fields->m_geodeLoadStep) { + case 0: + if (this->skipOnRefresh()) this->setupLoadingMods(); + break; + case 1: + if (this->skipOnRefresh()) this->setupLoaderResources(); + break; + case 2: + this->setupModResources(); + break; + case 3: + default: + this->setSmallText("Loading game resources"); + LoadingLayer::loadAssets(); + break; + } this->updateLoadingBar(); } -}; +}; \ No newline at end of file From 506bb05c4c7693a276bc6c0b0e3250da984a952e Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:42:54 +0300 Subject: [PATCH 107/270] Implement the new broma codege --- bindings/GeometryDash.bro | 9 --------- codegen/CMakeLists.txt | 2 +- codegen/src/AddressGen.cpp | 6 +++++- codegen/src/BindingGen.cpp | 14 +++++++++++--- codegen/src/ModifyGen.cpp | 8 ++++++-- codegen/src/Shared.hpp | 17 +++++++++++------ codegen/src/SourceGen.cpp | 6 +++++- loader/test/members/Android.cpp | 10 +++++----- 8 files changed, 44 insertions(+), 28 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 64d3b151..3df5611d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4264,15 +4264,6 @@ class LevelSettingsDelegate { virtual void levelSettingsUpdated() {} } -class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { - static SecretLayer2* create() = win 0x21FD70; - - bool init() = win 0x21FE10, mac 0x25fe70; - bool onSubmit(cocos2d::CCObject*) = win 0x221ac0, mac 0x2611a0; - void updateSearchLabel(const char* text) = win 0x222FC0, mac 0x260e10; - void showCompletedLevel() = win 0x220C10; -} - [[link(android)]] class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer2* create() = win 0x21FD70; diff --git a/codegen/CMakeLists.txt b/codegen/CMakeLists.txt index 2e3833a5..35ee9b31 100644 --- a/codegen/CMakeLists.txt +++ b/codegen/CMakeLists.txt @@ -4,7 +4,7 @@ project(Codegen LANGUAGES C CXX) include(../cmake/CPM.cmake) CPMAddPackage("gh:fmtlib/fmt#9.1.0") -CPMAddPackage("gh:geode-sdk/Broma#460f82d") +CPMAddPackage("gh:geode-sdk/Broma#93f401a") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp diff --git a/codegen/src/AddressGen.cpp b/codegen/src/AddressGen.cpp index 9acb8c78..7adc690b 100644 --- a/codegen/src/AddressGen.cpp +++ b/codegen/src/AddressGen.cpp @@ -79,6 +79,8 @@ std::string generateAddressHeader(Root const& root) { output += format_strings::address_begin; for (auto& f : root.functions) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + std::string address_str; if (codegen::getStatus(f) == BindStatus::Binded) { @@ -104,6 +106,8 @@ std::string generateAddressHeader(Root const& root) { for (auto& c : root.classes) { for (auto& field : c.fields) { + if (codegen::getStatus(field) == BindStatus::Missing) continue; + std::string address_str; auto fn = field.get_as(); @@ -112,7 +116,7 @@ std::string generateAddressHeader(Root const& root) { continue; } - if (codegen::getStatus(field) == BindStatus::NeedsBinding || codegen::platformNumber(field)) { + if (codegen::getStatus(field) == BindStatus::NeedsBinding || codegen::platformNumber(field) != -1) { if (is_cocos_class(field.parent) && codegen::platform == Platform::Windows) { address_str = fmt::format("base::getCocos() + 0x{:x}", codegen::platformNumber(fn->binds)); } diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index 5d8f7c8e..2fe4d5f9 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -131,6 +131,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& single_output += format_strings::class_includes; for (auto& f : root.functions) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + FunctionProto const* fb = &f.prototype; char const* used_format = format_strings::function_definition; @@ -202,6 +204,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& bool unimplementedField = false; for (auto field : cls.fields) { + if (codegen::getStatus(field) == BindStatus::Missing) continue; + MemberFunctionProto* fb; char const* used_format = format_strings::function_definition; @@ -221,9 +225,13 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& } else if (auto p = field.get_as()) { auto hardcode = codegen::platformNumber(p->amount); - if (hardcode) { + if (hardcode > 0) { single_output += fmt::format(format_strings::pad_definition, fmt::arg("hardcode", hardcode)); - } else { + } + else if (hardcode == 0) { + single_output += " // no padding\n"; + } + else { unimplementedField = true; } continue; @@ -234,7 +242,7 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& } else if (auto fn = field.get_as()) { fb = &fn->prototype; - if (!codegen::platformNumber(fn->binds) && codegen::getStatus(field) != BindStatus::Binded) { + if (codegen::platformNumber(fn->binds) == -1 && codegen::getStatus(field) != BindStatus::Binded) { used_format = format_strings::error_definition; if (fb->type != FunctionType::Normal) diff --git a/codegen/src/ModifyGen.cpp b/codegen/src/ModifyGen.cpp index 937cd527..9bf5ea16 100644 --- a/codegen/src/ModifyGen.cpp +++ b/codegen/src/ModifyGen.cpp @@ -57,7 +57,7 @@ namespace geode::modifier {{ std::string generateModifyHeader(Root const& root, ghc::filesystem::path const& singleFolder) { std::string output; - for (auto& c : root.classes) { + for (auto& c : root.classes) { if (c.name == "cocos2d") continue; std::string filename = (codegen::getUnqualifiedClassName(c.name) + ".hpp"); @@ -83,6 +83,8 @@ std::string generateModifyHeader(Root const& root, ghc::filesystem::path const& std::string statics; std::set used; for (auto& f : c.fields) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + if (auto fn = f.get_as()) { if (fn->prototype.type == FunctionType::Normal && !used.count(fn->prototype.name)) { used.insert(fn->prototype.name); @@ -102,13 +104,15 @@ std::string generateModifyHeader(Root const& root, ghc::filesystem::path const& // modify for (auto& f : c.fields) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + auto fn = f.get_as(); if (!fn) { continue; } - if (codegen::getStatus(f) == BindStatus::NeedsBinding || codegen::platformNumber(f)) { + if (codegen::getStatus(f) == BindStatus::NeedsBinding || codegen::platformNumber(f) != -1) { } else if (codegen::getStatus(f) == BindStatus::Binded && fn->prototype.type == FunctionType::Normal) { diff --git a/codegen/src/Shared.hpp b/codegen/src/Shared.hpp index a2a69443..ef0e41a0 100644 --- a/codegen/src/Shared.hpp +++ b/codegen/src/Shared.hpp @@ -51,7 +51,8 @@ inline bool is_cocos_class(std::string const& str) { enum class BindStatus { Binded, NeedsBinding, - Unbindable + Unbindable, + Missing, }; struct codegen_error : std::runtime_error { @@ -91,7 +92,7 @@ namespace codegen { inline Platform platform; - inline uintptr_t platformNumberWithPlatform(Platform p, PlatformNumber const& pn) { + inline ptrdiff_t platformNumberWithPlatform(Platform p, PlatformNumber const& pn) { switch (p) { case Platform::Mac: return pn.mac; case Platform::Windows: return pn.win; @@ -102,7 +103,7 @@ namespace codegen { } } - inline uintptr_t platformNumber(PlatformNumber const& p) { + inline ptrdiff_t platformNumber(PlatformNumber const& p) { return platformNumberWithPlatform(codegen::platform, p); } @@ -114,17 +115,21 @@ namespace codegen { } inline BindStatus getStatusWithPlatform(Platform p, Field const& field) { + if ((field.missing & p) != Platform::None) return BindStatus::Missing; + if (auto fn = field.get_as()) { - if ((fn->links & p) != Platform::None) return BindStatus::Binded; - if (platformNumberWithPlatform(p, fn->binds)) return BindStatus::NeedsBinding; + if ((field.links & p) != Platform::None) return BindStatus::Binded; + if (platformNumberWithPlatform(p, fn->binds) != -1) return BindStatus::NeedsBinding; } return BindStatus::Unbindable; } inline BindStatus getStatusWithPlatform(Platform p, Function const& f) { + if ((f.missing & p) != Platform::None) return BindStatus::Missing; + if ((f.links & p) != Platform::None) return BindStatus::Binded; - if (platformNumberWithPlatform(p, f.binds)) return BindStatus::NeedsBinding; + if (platformNumberWithPlatform(p, f.binds) != -1) return BindStatus::NeedsBinding; return BindStatus::Unbindable; } diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 230a31fc..ddba3630 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -135,6 +135,8 @@ std::string generateBindingSource(Root const& root) { std::string output(format_strings::source_start); for (auto& f : root.functions) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + if (codegen::getStatus(f) != BindStatus::NeedsBinding) { continue; } @@ -153,6 +155,8 @@ std::string generateBindingSource(Root const& root) { for (auto& c : root.classes) { for (auto& f : c.fields) { + if (codegen::getStatus(f) == BindStatus::Missing) continue; + if (auto i = f.get_as()) { // yeah there are no inlines on cocos } @@ -193,7 +197,7 @@ std::string generateBindingSource(Root const& root) { if ( codegen::getStatus(f) == BindStatus::Unbindable && - !codegen::platformNumber(fn->binds) && + codegen::platformNumber(fn->binds) == -1 && fn->prototype.is_virtual && fn->prototype.type != FunctionType::Dtor ) { used_declare_format = format_strings::declare_virtual_error; diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index ed8129cb..47871bc7 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -11,10 +11,10 @@ GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x13c); static_assert(sizeof(GJBaseGameLayer) == 0x2cc); -// GEODE_MEMBER_CHECK(PlayLayer, unknown4e8, 0x2e8); -// GEODE_MEMBER_CHECK(PlayLayer, m_endPortal, 0x324); -// GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c); -// GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); -// GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); +GEODE_MEMBER_CHECK(PlayLayer, unknown4e8, 0x2e8); +GEODE_MEMBER_CHECK(PlayLayer, m_endPortal, 0x324); +GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c); +GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); +GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); #endif \ No newline at end of file From a0deb6ab964234b9403af9afee599763a3d983dd Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:54:11 +0300 Subject: [PATCH 108/270] Fix the missing stuff and fix playlayer --- bindings/GeometryDash.bro | 6 +++++- codegen/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 3df5611d..62ade59f 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4897,11 +4897,15 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool unused4cc; bool m_hasCheated; geode::SeedValueRS m_dontSave; + [[missing(android)]] int unknown4d8; + [[missing(android)]] bool m_debugPauseOff; + [[missing(android)]] bool m_shouldSmoothCamera; + [[missing(android)]] float unused_4e0; - PAD = mac 0x4, win 0x4, android 0x4; + PAD = mac 0x4, win 0x4, android 0x0; cocos2d::CCDrawNode* unknown4e8; float m_camera4f0; int unused4f4; diff --git a/codegen/CMakeLists.txt b/codegen/CMakeLists.txt index 35ee9b31..2bd4a39d 100644 --- a/codegen/CMakeLists.txt +++ b/codegen/CMakeLists.txt @@ -4,7 +4,7 @@ project(Codegen LANGUAGES C CXX) include(../cmake/CPM.cmake) CPMAddPackage("gh:fmtlib/fmt#9.1.0") -CPMAddPackage("gh:geode-sdk/Broma#93f401a") +CPMAddPackage("gh:geode-sdk/Broma#38a3bba") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp From a50b48791e7423c6be1fea2c7168ef68dfa8b7f5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:58:16 +0300 Subject: [PATCH 109/270] fix GJAccountManager on android --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 62ade59f..e11ba2b9 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1884,7 +1884,7 @@ class GJAccountManager : cocos2d::CCNode { } gd::string getGJP() = mac 0x89520, win 0x10abb0; - PAD = mac 0x8, win 0x4; + PAD = mac 0x8, win 0x4, android 0x4; gd::string m_password; gd::string m_username; int m_accountID; From b0ab2f95f6dd2bf2aa878e2e205f9adc0521261b Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:00:38 +0300 Subject: [PATCH 110/270] fix the funny wrong signatures --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e11ba2b9..abf408c7 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -955,7 +955,7 @@ class CommentUploadDelegate { [[link(android)]] class ConfigureHSVWidget : cocos2d::CCNode { - bool init(int abs, cocos2d::ccHSVValue val) = win 0x4a3f0, mac 0x237310; + bool init(cocos2d::ccHSVValue val, bool abs) = win 0x4a3f0, mac 0x237310; void updateLabels() = win 0x4adf0, mac 0x237df0; cocos2d::CCLabelBMFont* m_hueLabel; cocos2d::CCLabelBMFont* m_saturationLabel; @@ -1711,7 +1711,7 @@ class EndLevelLayer : cocos2d::CCLayer { static EndLevelLayer* create() = mac 0x2787d0, win 0x94b50; void customSetup() = win 0x94cb0; - const char* getCoinString(void* p0) = win 0x96270; + const char* getCoinString() = win 0x96270; const char* getEndText() = win 0x964A0; void onMenu(cocos2d::CCObject* sender) = mac 0x27a500, win 0x96c10; void onEdit(cocos2d::CCObject* sender) = mac 0x27a640, win 0x96d30; From fc58ab79efea50babce4f5cafc5113fd31c3c277 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:36:44 +0300 Subject: [PATCH 111/270] c++ abi can go burn in gaseous tungsten --- bindings/GeometryDash.bro | 14 ++++++------- codegen/src/AndroidSymbol.hpp | 18 +++++++++++++--- codegen/src/Shared.hpp | 1 + loader/include/Geode/DefaultInclude.hpp | 10 ++++----- .../Geode/cocos/platform/android/CCEGLView.h | 2 ++ loader/include/Geode/modify/Field.hpp | 2 +- loader/src/hooks/LoadingLayer.cpp | 21 +++++++++++++++++++ loader/src/platform/android/main.cpp | 4 ++++ loader/test/members/Android.cpp | 2 ++ 9 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index abf408c7..edaa7047 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3611,7 +3611,7 @@ class GameObject : CCSpritePlus { bool m_unk3D9; bool m_isSelected; int m_globalClickCounter; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; bool m_shouldUpdateColorSprite; float m_multiScaleMultiplier; bool m_isGroupParent; @@ -3624,20 +3624,20 @@ class GameObject : CCSpritePlus { int m_editorLayer; int m_editorLayer2; int m_unk414; - PAD = mac 0xc, win 0xc; + PAD = mac 0xc, win 0xc, android 0xc; cocos2d::CCPoint m_firstPosition; bool m_unk42C; bool m_unk42D; - PAD = mac 0x6, win 0x6; + PAD = mac 0x6, win 0x6, android 0x6; bool m_isAnimated; - PAD = mac 0x7, win 0x7; + PAD = mac 0x7, win 0x7, android 0x7; bool m_hasEffectLine; bool m_specialUnk43d; - PAD = mac 0x1, win 0x1; + PAD = mac 0x1, win 0x1, android 0x1; bool m_hasDurationLine; bool m_isTriggerable; bool m_triggeredInEditor; - PAD = mac 0x6, win 0x6; + PAD = mac 0x6, win 0x6, android 0x6; bool m_highDetail; ColorActionSprite* m_colorActionSpriteBase; ColorActionSprite* m_colorActionSpriteDetail; @@ -3646,7 +3646,7 @@ class GameObject : CCSpritePlus { bool m_unk459; bool m_unk45A; bool m_wasForcedRotatedPositionUpdateIdk; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; bool m_orbMultiActivate; } diff --git a/codegen/src/AndroidSymbol.hpp b/codegen/src/AndroidSymbol.hpp index dbb936e5..3917fd1b 100644 --- a/codegen/src/AndroidSymbol.hpp +++ b/codegen/src/AndroidSymbol.hpp @@ -7,9 +7,9 @@ #include #include -std::string mangleIdent(std::string_view str) { +std::string mangleIdent(std::string_view str, bool ne = true) { if (str.find("::") != -1) { - std::string result = "N"; + std::string result = ne ? "N" : ""; auto s = str; do { const auto i = s.find("::"); @@ -19,7 +19,7 @@ std::string mangleIdent(std::string_view str) { else s = s.substr(i + 2); } while(s.size()); - return result + "E"; + return result + (ne ? "E" : ""); } else { return std::to_string(str.size()) + std::string(str); } @@ -125,6 +125,18 @@ std::string mangleType(std::vector& seen, std::string name, bool su std::string generateAndroidSymbol(const Class& clazz, const FunctionBindField* fn) { auto& decl = fn->prototype; + if (decl.type != FunctionType::Normal) { + // ctor and dtor + switch (decl.type) { + case FunctionType::Ctor: + return "_ZN" + mangleIdent(clazz.name, false) + "C2Ev"; + case FunctionType::Dtor: + return "_ZN" + mangleIdent(clazz.name, false) + "D2Ev"; + default: + throw std::runtime_error("Unknown function type"); + } + } + std::string mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name); if (decl.args.empty()) { mangledSymbol += "v"; diff --git a/codegen/src/Shared.hpp b/codegen/src/Shared.hpp index ef0e41a0..c4e57278 100644 --- a/codegen/src/Shared.hpp +++ b/codegen/src/Shared.hpp @@ -136,6 +136,7 @@ namespace codegen { inline bool shouldAndroidBind(const FunctionBindField* fn) { if (codegen::platform == Platform::Android) { + if (fn->prototype.type != FunctionType::Normal) return true; for (auto& [type, name] : fn->prototype.args) { if (can_find(type.name, "gd::")) return true; } diff --git a/loader/include/Geode/DefaultInclude.hpp b/loader/include/Geode/DefaultInclude.hpp index 523aa876..87d7b1a6 100644 --- a/loader/include/Geode/DefaultInclude.hpp +++ b/loader/include/Geode/DefaultInclude.hpp @@ -81,8 +81,7 @@ namespace geode { GEODE_IOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ : Class_() {}) \ - GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ - : Class_() {}) + GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) #define GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_) \ GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \ @@ -91,8 +90,8 @@ namespace geode { : Base_(geode::CutoffConstructor, fill){}) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ : Class_() {}) \ - GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ - : Class_() {}) + GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ + : Base_(geode::CutoffConstructor, fill){}) #define GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ @@ -106,7 +105,8 @@ namespace geode { #define GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_) \ GEODE_WINDOWS(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \ - GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \ + GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ + : Base_(geode::CutoffConstructor, fill){}) \ GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \ : Base_(geode::CutoffConstructor, fill){}) \ GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \ diff --git a/loader/include/Geode/cocos/platform/android/CCEGLView.h b/loader/include/Geode/cocos/platform/android/CCEGLView.h index a45d16ad..eed2465d 100644 --- a/loader/include/Geode/cocos/platform/android/CCEGLView.h +++ b/loader/include/Geode/cocos/platform/android/CCEGLView.h @@ -34,6 +34,8 @@ class CC_DLL CCEGLView : public CCEGLViewProtocol { GEODE_FRIEND_MODIFY public: + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCEGLView, CCEGLViewProtocol) + CCEGLView(); virtual ~CCEGLView(); diff --git a/loader/include/Geode/modify/Field.hpp b/loader/include/Geode/modify/Field.hpp index 7a140f7d..8cf95add 100644 --- a/loader/include/Geode/modify/Field.hpp +++ b/loader/include/Geode/modify/Field.hpp @@ -58,7 +58,7 @@ namespace geode::modifier { using Intermediate = Modify; // Padding used for guaranteeing any member of parents // will be in between sizeof(Intermediate) and sizeof(Parent) - uintptr_t m_padding; + alignas(Base) uintptr_t m_padding; public: // the constructor that constructs the fields. diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 00c5e80e..c8d24680 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -156,4 +156,25 @@ struct CustomLoadingLayer : Modify { } this->updateLoadingBar(); } +}; + +#include +struct FieldTest : Modify { + int field = 0x10101010; + + bool init(GJGameLevel* level) { + if (!PlayLayer::init(level)) return false; + log::debug("GameManager 1 {}", GameManager::sharedState()); + log::debug("PlayLayer 1 {}", PlayLayer::get()); + m_fields->field += 0x20202020; + log::debug("GameManager 2 {}", GameManager::sharedState()); + log::debug("PlayLayer 2 {}", PlayLayer::get()); + return true; + } + + void update(float dt) { + log::debug("GameManager {}", GameManager::sharedState()); + log::debug("PlayLayer {}", PlayLayer::get()); + PlayLayer::update(dt); + } }; \ No newline at end of file diff --git a/loader/src/platform/android/main.cpp b/loader/src/platform/android/main.cpp index 3fd948b8..471b162e 100644 --- a/loader/src/platform/android/main.cpp +++ b/loader/src/platform/android/main.cpp @@ -20,4 +20,8 @@ extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* rese return JNI_VERSION_1_1; } +extern "C" [[gnu::visibility("default")]] void emptyFunction(void*) { + // empty +} + #endif \ No newline at end of file diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 47871bc7..56373556 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -17,4 +17,6 @@ GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c); GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); +static_assert(sizeof(GameObject) == 0x42c); + #endif \ No newline at end of file From 90d55d05268d396c4de7fc0047cdd5457e241501 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:37:26 +0300 Subject: [PATCH 112/270] revert web --- loader/src/utils/web.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 88569b3e..7675f46c 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -214,8 +214,6 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const return this->error("Curl not initialized", -1); } - log::debug("curl init {}", curl); - // resulting byte array ByteVector ret; // output file if downloading to file. unique_ptr because not always @@ -308,28 +306,17 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const } ); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); - log::debug("curl opts"); auto res = curl_easy_perform(curl); - log::debug("curl perform"); - if (res != CURLE_OK) { long code = 0; - log::debug("curl fail"); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); - log::debug("curl cleanup"); curl_easy_cleanup(curl); - log::debug("end"); return this->error("Fetch failed: " + std::string(curl_easy_strerror(res)), code); } - log::debug("curl cleanup 2"); curl_easy_cleanup(curl); - log::debug("end 2"); - AWAIT_RESUME(); - log::debug("end 3"); - // if something is still holding a handle to this // request, then they may still cancel it m_finished = true; @@ -595,4 +582,4 @@ AsyncWebResult AsyncWebResponse::json() { return Err(std::string(e.what())); } }); -} +} \ No newline at end of file From c950787693b747736caf68c97aa94734c6ab2f62 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:38:50 +0300 Subject: [PATCH 113/270] remove the field tests --- loader/src/hooks/LoadingLayer.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index c8d24680..93e82f07 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -157,24 +157,3 @@ struct CustomLoadingLayer : Modify { this->updateLoadingBar(); } }; - -#include -struct FieldTest : Modify { - int field = 0x10101010; - - bool init(GJGameLevel* level) { - if (!PlayLayer::init(level)) return false; - log::debug("GameManager 1 {}", GameManager::sharedState()); - log::debug("PlayLayer 1 {}", PlayLayer::get()); - m_fields->field += 0x20202020; - log::debug("GameManager 2 {}", GameManager::sharedState()); - log::debug("PlayLayer 2 {}", PlayLayer::get()); - return true; - } - - void update(float dt) { - log::debug("GameManager {}", GameManager::sharedState()); - log::debug("PlayLayer {}", PlayLayer::get()); - PlayLayer::update(dt); - } -}; \ No newline at end of file From d964048f2de08df77fe102c8e218136f74f7ab00 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:29:59 +0300 Subject: [PATCH 114/270] fix ctor mangling with params --- codegen/src/AndroidSymbol.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/src/AndroidSymbol.hpp b/codegen/src/AndroidSymbol.hpp index 3917fd1b..a00fb0c3 100644 --- a/codegen/src/AndroidSymbol.hpp +++ b/codegen/src/AndroidSymbol.hpp @@ -125,19 +125,19 @@ std::string mangleType(std::vector& seen, std::string name, bool su std::string generateAndroidSymbol(const Class& clazz, const FunctionBindField* fn) { auto& decl = fn->prototype; - if (decl.type != FunctionType::Normal) { - // ctor and dtor - switch (decl.type) { - case FunctionType::Ctor: - return "_ZN" + mangleIdent(clazz.name, false) + "C2Ev"; - case FunctionType::Dtor: - return "_ZN" + mangleIdent(clazz.name, false) + "D2Ev"; - default: - throw std::runtime_error("Unknown function type"); - } - } - std::string mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name); + std::string mangledSymbol; + switch (decl.type) { + case FunctionType::Ctor: + mangledSymbol = "_ZN" + mangleIdent(clazz.name, false) + "C2E"; + break; + case FunctionType::Dtor: + mangledSymbol = "_ZN" + mangleIdent(clazz.name, false) + "D2E"; + break; + default: + mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name); + break; + } if (decl.args.empty()) { mangledSymbol += "v"; } else { From 6bd6c6b3202b719ea281be6d0a0307c88557434f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:40:04 +0300 Subject: [PATCH 115/270] reenable persist --- loader/src/hooks/persist.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/loader/src/hooks/persist.cpp b/loader/src/hooks/persist.cpp index 7be7ca06..3f216069 100644 --- a/loader/src/hooks/persist.cpp +++ b/loader/src/hooks/persist.cpp @@ -4,9 +4,9 @@ using namespace geode::prelude; #include -// struct SceneSwitch : Modify { -// void willSwitchToScene(CCScene* scene) { -// AchievementNotifier::willSwitchToScene(scene); -// SceneManager::get()->willSwitchToScene(scene); -// } -// }; +struct SceneSwitch : Modify { + void willSwitchToScene(CCScene* scene) { + AchievementNotifier::willSwitchToScene(scene); + SceneManager::get()->willSwitchToScene(scene); + } +}; From 8f342440230d91086c4706d3f61d8c5bbc416b9f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:07:33 +0300 Subject: [PATCH 116/270] android m_shouldTryToKick --- bindings/GeometryDash.bro | 2 +- loader/test/members/Android.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index edaa7047..dd93183f 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5030,7 +5030,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool m_delayedResetLevel; int m_lastDeathPercent; bool unk4C4; - PAD = mac 0xb, win 0xb; + PAD = mac 0xb, win 0xb, android 0xb; bool unk4D0; bool unk4D1; cocos2d::CCArray* unk4D4; diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 56373556..893242bb 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -16,6 +16,7 @@ GEODE_MEMBER_CHECK(PlayLayer, m_endPortal, 0x324); GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c); GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); +GEODE_MEMBER_CHECK(PlayLayer, m_shouldTryToKick, 0x4e0); static_assert(sizeof(GameObject) == 0x42c); From 238d1b7de9e8820954fa9db764aea0a6e245ddd0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:18:40 +0300 Subject: [PATCH 117/270] implement android game::exit --- bindings/GeometryDash.bro | 1 + loader/src/platform/android/util.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index dd93183f..d1b6e949 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4501,6 +4501,7 @@ class MenuLayer : cocos2d::CCLayer, FLAlertLayerProtocol, GooglePlayDelegate { void onFacebook(cocos2d::CCObject*) = win 0x191960; void onTwitter(cocos2d::CCObject*) = win 0x191980; void onYouTube(cocos2d::CCObject*) = win 0x1919A0; + void endGame(); static cocos2d::CCScene* scene(bool) = mac 0x1d12d0, win 0x190720, ios 0x19e57c; cocos2d::CCSprite* m_googlePlaySprite; diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 8145a529..6135b77a 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -50,8 +50,11 @@ void geode::utils::game::launchLoaderUninstaller(bool deleteSaveData) { } void geode::utils::game::exit() { - // Not implemented - log::error("Exiting the game is not implemented on android"); + CCDirector::get()->getActionManager()->addAction(CCSequence::create( + CCDelayTime::create(0.5f), + CCCallFunc::create(nullptr, callfunc_selector(MenuLayer::endGame)), + nullptr + ), CCDirector::get()->getRunningScene(), false);; } void geode::utils::game::restart() { From 7de21d91772c030aa703e7dbdaa472500f7d31b6 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:41:25 +0300 Subject: [PATCH 118/270] Fix latest resources downloading --- loader/src/hooks/LoadingLayer.cpp | 4 ++++ loader/src/loader/LoaderImpl.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 93e82f07..5bc171bb 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -57,12 +57,14 @@ struct CustomLoadingLayer : Modify { void setupLoaderResources() { // verify loader resources if (!LoaderImpl::get()->verifyLoaderResources()) { + log::debug("Downloading Loader Resources"); this->setSmallText("Downloading Loader Resources"); this->addChild(EventListenerNode::create( this, &CustomLoadingLayer::updateResourcesProgress )); } else { + log::debug("Loading Loader Resources"); this->setSmallText("Loading Loader Resources"); LoaderImpl::get()->updateSpecialFiles(); this->continueLoadAssets(); @@ -77,10 +79,12 @@ struct CustomLoadingLayer : Modify { )); }, [&](UpdateFinished) { + log::debug("Downloaded Loader Resources"); this->setSmallText("Downloaded Loader Resources"); this->continueLoadAssets(); }, [&](UpdateFailed const& error) { + log::debug("Failed Loader Resources"); LoaderImpl::get()->platformMessageBox( "Error updating resources", error + ".\n" diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 44ae6c77..8c2e056d 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -814,6 +814,7 @@ void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { ).post(); } ); + return; } else { log::debug("Loader version {} does not exist on Github, not downloading the resources", this->getVersion().toString()); From fedf96edd9dd07ad00412a386fd0c5e43c71c3c5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:21:23 +0300 Subject: [PATCH 119/270] enable editorpause ids --- loader/src/ids/EditorPauseLayer.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/loader/src/ids/EditorPauseLayer.cpp b/loader/src/ids/EditorPauseLayer.cpp index c1284360..7c44a3f7 100644 --- a/loader/src/ids/EditorPauseLayer.cpp +++ b/loader/src/ids/EditorPauseLayer.cpp @@ -2,8 +2,6 @@ #include -#if !defined(GEODE_IS_ANDROID) - using namespace geode::prelude; // special class for this because making it a CCMenuItemToggler would be very UB @@ -274,5 +272,3 @@ struct EditorPauseLayerIDs : Modify { return true; } }; - -#endif \ No newline at end of file From 2a0c08c5d1eb021d93c644ba45aed663a3423faa Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:44:37 +0300 Subject: [PATCH 120/270] some broma stuff --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d1b6e949..fb38211b 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1212,7 +1212,7 @@ class DrawGridLayer : cocos2d::CCLayer { m_player2NodePoints->removeAllObjects(); } - void loadTimeMarkers(gd::string guidelines) = mac 0x94010; + void loadTimeMarkers(gd::string guidelines) = mac 0x94010, win 0x16cab0; std::array* m_commonLines; std::array* m_yellowGuidelines; @@ -4358,7 +4358,7 @@ class LevelSettingsObject : cocos2d::CCNode { bool m_isFlipped; GJGameLevel* m_level; gd::string m_guidelineString; - int m_unknown; + int m_defaultSongID; int m_colorPage; int m_groundLineIndex; } From 63940f2ce93fcf29926f7a7fcb6b7ea9ff1fef68 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 1 Oct 2023 17:29:42 +0200 Subject: [PATCH 121/270] Improve Android bindings --- bindings/GeometryDash.bro | 29 ++++++++++++++-------------- loader/src/ids/LevelBrowserLayer.cpp | 6 +----- loader/src/ids/LevelInfoLayer.cpp | 6 +----- loader/test/members/Android.cpp | 6 ++++++ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index fb38211b..2cb6d72a 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -981,7 +981,8 @@ class CountTriggerAction : cocos2d::CCNode { class CreateGuidelinesLayer : FLAlertLayer, FLAlertLayerProtocol { void doClearGuidelines() = win 0x4cf60, mac 0x299690; void onStop(cocos2d::CCObject* sender) = win 0x4d2c0, mac 0x2990f0; - PAD = win 0x4, mac 0x8; + + void* m_unk; LevelSettingsObject* m_levelSettings; PAD = win 0x1c; gd::string m_guidelineString; @@ -1139,10 +1140,10 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, LevelDownloadDelegate { static DailyLevelPage* create(bool weekly) = win 0x6a860; bool init(bool weekly) = mac 0x108C90, win 0x6a900; - virtual void updateTimers(float) = mac 0x109780, win 0x6bef0; + void updateTimers(float) = mac 0x109780, win 0x6bef0; virtual void show() = mac 0x10a4b0, win 0x3f360; - PAD = mac 0x29, win 0x15; + PAD = mac 0x29, win 0x15, android 0x15; bool m_weekly; } @@ -3015,7 +3016,7 @@ class GameLevelManager : cocos2d::CCNode { int m_dailyTimeLeft; int m_dailyID; int m_dailyIDUnk; - PAD = mac 0x10, win 0x4; + PAD = mac 0x10, win 0x4, android 0x4; int m_weeklyTimeLeft; int m_weeklyID; int m_weeklyIDUnk; @@ -3283,7 +3284,7 @@ class GameManager : GManager { bool m_showedRateDiffDialog; bool m_showedRateStarDialog; bool m_showedLowDetailDialog; - PAD = mac 0x3c, win 0x30; + PAD = mac 0x3c, win 0x30, android 0x30; int m_bootups; bool m_hasRatedGame; bool m_unk0; @@ -3706,14 +3707,14 @@ class GameStatsManager : cocos2d::CCNode { void storeUserCoin(char const*) = mac 0x42890; bool isItemUnlocked(UnlockType type, int id) = win 0xfbb80; - PAD = mac 0x50, win 0x28; + PAD = mac 0x50, win 0x28, android 0x24; cocos2d::CCDictionary* m_dailyChests; cocos2d::CCDictionary* m_worldAdvertChests; cocos2d::CCDictionary* m_activeChallenges; cocos2d::CCDictionary* m_upcomingChallenges; - PAD = mac 0x18, win 0xc; + PAD = mac 0x18, win 0xc, android 0xc; cocos2d::CCDictionary* m_playerStats; - PAD = mac 0x50, win 0x10; + PAD = mac 0x50, win 0x10, android 0x34; cocos2d::CCDictionary* m_completedLevels; cocos2d::CCDictionary* m_verifiedUserCoins; cocos2d::CCDictionary* m_pendingUserCoins; @@ -3917,7 +3918,7 @@ class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerPr void onNew(cocos2d::CCObject* sender) = win 0x15cbf0, mac 0x252ac0; static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00; - PAD = win 0x4, mac 0x8; + void* m_unk; TextArea* m_noInternet; GJListLayer* m_list; CCMenuItemSpriteExtra* m_rightArrow; @@ -4192,14 +4193,14 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300; void updateLabelValues() = mac 0x164090, win 0x17b170; - PAD = win 0x4, mac 0x8; + void* m_unk1; cocos2d::CCMenu* m_playBtnMenu; GJGameLevel* m_level; cocos2d::CCArray* m_unknown; CCMenuItemSpriteExtra* m_likeBtn; CCMenuItemSpriteExtra* m_starRateBtn; CCMenuItemSpriteExtra* m_demonRateBtn; - PAD = win 0x4, mac 0x8; + void* m_unk2; CCMenuItemToggler* m_ldmToggler; cocos2d::CCLabelBMFont* m_ldmLabel; cocos2d::CCLabelBMFont* m_lengthLabel; @@ -4208,7 +4209,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg cocos2d::CCLabelBMFont* m_orbsLabel; cocos2d::CCLabelBMFont* m_folderLabel; CCMenuItemSpriteExtra* m_cloneBtn; - PAD = win 0x4, mac 0x8; + void* m_unk3; } [[link(android)]] @@ -4232,7 +4233,7 @@ class LevelManagerDelegate { [[link(android)]] class LevelPage : cocos2d::CCLayer, DialogDelegate { - PAD = mac 0x8, win 0x4; + void* m_unk; GJGameLevel* m_level; void onInfo(cocos2d::CCObject* sender) = mac 0x23AAE0, win 0x189070; @@ -5425,7 +5426,7 @@ class RetryLevelLayer { [[link(android)]] class RewardsPage : FLAlertLayer { - bool init() = mac 0xf3800, win 0x2178F0; + virtual bool init() = mac 0xf3800, win 0x2178F0; } [[link(android)]] diff --git a/loader/src/ids/LevelBrowserLayer.cpp b/loader/src/ids/LevelBrowserLayer.cpp index 7723454b..ddd701bf 100644 --- a/loader/src/ids/LevelBrowserLayer.cpp +++ b/loader/src/ids/LevelBrowserLayer.cpp @@ -4,8 +4,6 @@ #include #include -#if !defined(GEODE_IS_ANDROID) - using namespace geode::prelude; $register_ids(LevelBrowserLayer) { @@ -172,6 +170,4 @@ struct LevelBrowserLayerIDs : Modify { return true; } -}; - -#endif \ No newline at end of file +}; \ No newline at end of file diff --git a/loader/src/ids/LevelInfoLayer.cpp b/loader/src/ids/LevelInfoLayer.cpp index 5edfe252..ecaea7ac 100644 --- a/loader/src/ids/LevelInfoLayer.cpp +++ b/loader/src/ids/LevelInfoLayer.cpp @@ -3,8 +3,6 @@ #include #include -#if !defined(GEODE_IS_ANDROID) - $register_ids(LevelInfoLayer) { auto winSize = CCDirector::get()->getWinSize(); @@ -136,6 +134,4 @@ struct LevelInfoLayerIDs : Modify { return true; } -}; - -#endif \ No newline at end of file +}; \ No newline at end of file diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 893242bb..740e938d 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -8,6 +8,7 @@ GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x138); GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x13c); +GEODE_MEMBER_CHECK(GameManager, m_canGetLevelSaveData, 0x28c); static_assert(sizeof(GJBaseGameLayer) == 0x2cc); @@ -20,4 +21,9 @@ GEODE_MEMBER_CHECK(PlayLayer, m_shouldTryToKick, 0x4e0); static_assert(sizeof(GameObject) == 0x42c); +GEODE_MEMBER_CHECK(GameStatsManager, m_dailyChests, 0x110); +GEODE_MEMBER_CHECK(GameStatsManager, m_completedLevels, 0x164); + +GEODE_MEMBER_CHECK(DailyLevelPage, m_weekly, 0x1ed); + #endif \ No newline at end of file From 728dc22c7a93076e33a1e6210f95c50338216b0e Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:41:43 -0300 Subject: [PATCH 122/270] some missing paddings --- bindings/GeometryDash.bro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2cb6d72a..ba5855e5 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5043,12 +5043,12 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool m_shouldTryToKick; float m_kickCheckDeltaSnapshot; int m_accumulatedKickCounter; - PAD = mac 0x4, win 0x4; + PAD = mac 0x4, win 0x4, android 0x8; double unk508; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; double unk518; double unk520; - PAD = mac 0x4, win 0x4; + PAD = mac 0x4, win 0x4, android 0x4; bool m_hasGlitter; bool m_isBgEffectOff; bool unk52F; From 2847beed8ffbf29ff51ebd81d388fbf3cb442b90 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:45:17 +0300 Subject: [PATCH 123/270] most requested feature of all time --- loader/src/ui/internal/list/ModListLayer.cpp | 4 ++++ loader/src/ui/internal/list/ModListLayer.hpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index a06e745c..5783d15c 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -638,6 +638,10 @@ void ModListLayer::onExit(CCObject*) { ); } +void ModListLayer::keyBackClicked() { + this->onExit(nullptr); +} + void ModListLayer::onReload(CCObject*) { this->reloadList(); } diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index 0afa2839..1d2b7a98 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -82,6 +82,9 @@ protected: void createSearchControl(); void onIndexUpdate(IndexUpdateEvent* event); + // most requested feature of all time + void keyBackClicked() override; + CCArray* createModCells(ModListType type, ModListQuery const& query); CCSize getCellSize() const; CCSize getListSize() const; From 9c842de37183a9e60cc6622e24745bb5acbec8c6 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:21:31 +0000 Subject: [PATCH 124/270] Add a lot of mac bindings why werent these added before, only 1 mac missing from DailyLevelPage --- bindings/GeometryDash.bro | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ac814eef..c3d0d9c6 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -951,15 +951,15 @@ class CreateMenuItem : CCMenuItemSpriteExtra { class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, DialogDelegate { void onBack(cocos2d::CCObject*) = win 0x4fae0; void onChallenge(cocos2d::CCObject*) = mac 0x142960, win 0x4f1b0; - void onLeaderboards(cocos2d::CCObject*) = win 0x4ed20; + void onLeaderboards(cocos2d::CCObject*) = mac 0x142920, win 0x4ed20; void onMyLevels(cocos2d::CCObject*) = mac 0x142b70, win 0x4eaa0; void onSavedLevels(cocos2d::CCObject*) = mac 0x142860, win 0x4ebe0; - void onDailyLevel(cocos2d::CCObject*) = win 0x4f170; - void onWeeklyLevel(cocos2d::CCObject*) = win 0x4f190; - void onFeaturedLevels(cocos2d::CCObject*) = win 0x4edf0; - void onFameLevels(cocos2d::CCObject*) = win 0x4ee70; - void onMapPacks(cocos2d::CCObject*) = win 0x4efb0; - void onOnlineLevels(cocos2d::CCObject*) = win 0x4ef60; + void onDailyLevel(cocos2d::CCObject*) = mac 0x142980, win 0x4f170; + void onWeeklyLevel(cocos2d::CCObject*) = mac 0x1429a0, win 0x4f190; + void onFeaturedLevels(cocos2d::CCObject*) = mac 0x142a20, win 0x4edf0; + void onFameLevels(cocos2d::CCObject*) = mac 0x142a80, win 0x4ee70; + void onMapPacks(cocos2d::CCObject*) = mac 0x1429c0, win 0x4efb0; + void onOnlineLevels(cocos2d::CCObject*) = mac 0x142ae0, win 0x4ef60; void onGauntlets(cocos2d::CCObject*) = mac 0x142b20, win 0x4f0a0; void onSecretVault(cocos2d::CCObject*) = win 0x4f1d0; void onTreasureRoom(cocos2d::CCObject*) = win 0x4f540; @@ -1079,7 +1079,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele } class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, LevelDownloadDelegate { - static DailyLevelPage* create(bool weekly) = win 0x6a860; + static DailyLevelPage* create(bool weekly) = mac 0x108ac0, win 0x6a860; bool init(bool weekly) = mac 0x108C90, win 0x6a900; virtual void updateTimers(float) = mac 0x109780, win 0x6bef0; virtual void show() = mac 0x10a4b0, win 0x3f360; From 9fa9284726ff440f2a313227a2fbe968f9e227d2 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 23:25:13 +0300 Subject: [PATCH 125/270] add not working clipboard --- bindings/GeometryDash.bro | 18 +++++++++--------- loader/src/platform/android/util.cpp | 8 ++++++++ loader/test/members/Android.cpp | 2 ++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ba5855e5..ee4b2a04 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1502,10 +1502,10 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ bool m_isPlayingMusic; EditButtonBar* m_buttonBar; - PAD = mac 0x8, win 0x4; + PAD = mac 0x8, win 0x4, android 0x4; cocos2d::CCArray* m_hideableUIElementArray; float m_gridSize; - PAD = mac 0x18, win 0x14; + PAD = mac 0x18, win 0x14, android 0x14; bool m_moveModifier; bool m_swipeModifier; int m_rotationTouchID; @@ -1579,7 +1579,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ CCMenuItemSpriteExtra* m_layerNextBtn; CCMenuItemSpriteExtra* m_layerPrevBtn; CCMenuItemSpriteExtra* m_goToBaseBtn; - PAD = mac 0x10, win 0x8; + PAD = mac 0x10, win 0x8, android 0x8; int m_selectedCreateObjectID; cocos2d::CCArray* m_createButtonArray; cocos2d::CCArray* m_customObjectButtonArray; @@ -1588,16 +1588,16 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ LevelEditorLayer* m_editorLayer; cocos2d::CCPoint m_swipeStart; cocos2d::CCPoint m_swipeEnd; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; cocos2d::CCPoint m_lastTouchPoint; cocos2d::CCPoint m_cameraTest; - PAD = mac 0x8, win 0x8; + PAD = mac 0x8, win 0x8, android 0x8; GameObject* m_selectedObject; - PAD = mac 0x8, win 0x4; + PAD = mac 0x8, win 0x4, android 0x4; bool m_unk2cc; bool m_freeMovingObject; gd::string m_clipboard; - PAD = mac 0x10, win 0x8; + PAD = mac 0x10, win 0x8, android 0x8; int m_selectedTab; int m_timesSelected; PAD = win 0x20; @@ -1704,7 +1704,7 @@ class EffectGameObject : GameObject { bool m_dynamicBlock; int m_itemBlockAID; int m_pickupMode; - PAD = mac 0x28, win 0x24; + PAD = mac 0x28, win 0x24, android 0x24; } [[link(android)]] @@ -5950,7 +5950,7 @@ class TableViewDelegate { [[link(android)]] class TeleportPortalObject : GameObject { - PAD = mac 0x8, win 0x4; + PAD = mac 0x8, win 0x4, android 0x4; TeleportPortalObject* m_orangePortal; bool m_isYellowPortal; float m_teleportYOffset; diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 6135b77a..8da055a5 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -9,6 +9,14 @@ using namespace geode::prelude; #include #include +bool utils::clipboard::write(std::string const& data) { + return false; +} + +std::string utils::clipboard::read() { + return ""; +} + ghc::filesystem::path dirs::getGameDir() { return ghc::filesystem::path( "/storage/emulated/0/Android/data/com.geode.launcher/files/game" diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 740e938d..6e622039 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -26,4 +26,6 @@ GEODE_MEMBER_CHECK(GameStatsManager, m_completedLevels, 0x164); GEODE_MEMBER_CHECK(DailyLevelPage, m_weekly, 0x1ed); +GEODE_MEMBER_CHECK(TeleportPortalObject, m_orangePortal, 0x430); + #endif \ No newline at end of file From c4af616a2a5c8ce9e689f3def8fb91ee32529692 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 23:44:17 +0300 Subject: [PATCH 126/270] fix editorui android --- bindings/GeometryDash.bro | 18 +++++++++--------- loader/test/members/Android.cpp | 5 +++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ee4b2a04..58835641 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -416,9 +416,9 @@ class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite { return true; } - void activate() = mac 0x125730, win 0x191c0; - void selected() = mac 0x125840, win 0x19270; - void unselected() = mac 0x125a70, win 0x19430; + virtual void activate() = mac 0x125730, win 0x191c0; + virtual void selected() = mac 0x125840, win 0x19270; + virtual void unselected() = mac 0x125a70, win 0x19430; float m_scaleMultiplier; float m_baseScale; @@ -474,10 +474,10 @@ class CCMenuItemToggler : cocos2d::CCMenuItem { void setSizeMult(float) = mac 0x38a40, win 0x19850; void toggle(bool) = mac 0x38950, win 0x199b0, ios 0xf5848; bool init(cocos2d::CCNode* off, cocos2d::CCNode* on, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler handler) = mac 0x38500, win 0x196e0; - void activate() = mac 0x38bc0, win 0x198d0, ios 0xf59ac; - void selected() = mac 0x38b80, win 0x198a0; - void unselected() = mac 0x38c00, win 0x19900; - void setEnabled(bool enabled) = mac 0x38c40, win 0x19930; + virtual void activate() = mac 0x38bc0, win 0x198d0, ios 0xf59ac; + virtual void selected() = mac 0x38b80, win 0x198a0; + virtual void unselected() = mac 0x38c00, win 0x19900; + virtual void setEnabled(bool enabled) = mac 0x38c40, win 0x19930; CCMenuItemSpriteExtra* m_offButton; CCMenuItemSpriteExtra* m_onButton; @@ -1530,7 +1530,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ bool m_unkSwipeRelated; PAD = mac 0x2, win 0x2, android 0x2; bool m_updateTimeMarkers; - PAD = mac 0x8, win 0x8, android 0x2; + PAD = mac 0x8, win 0x8, android 0x8; cocos2d::CCArray* m_unknownArray2; PAD = mac 0x8, win 0x8, android 0x8; cocos2d::CCArray* m_selectedObjects; @@ -3823,7 +3823,7 @@ class HardStreak : cocos2d::CCDrawNode { [[link(android)]] class InfoAlertButton : CCMenuItemSpriteExtra { bool init(gd::string title, gd::string text, float scale) = win 0x14ef50; - void activate() = win 0x14f050; + virtual void activate() = win 0x14f050; inline InfoAlertButton() {} static InfoAlertButton* create(gd::string title, gd::string text, float scale) = win 0x14ed20, mac 0x2ecad0; } diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 6e622039..dd8ff7b5 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -28,4 +28,9 @@ GEODE_MEMBER_CHECK(DailyLevelPage, m_weekly, 0x1ed); GEODE_MEMBER_CHECK(TeleportPortalObject, m_orangePortal, 0x430); +GEODE_MEMBER_CHECK(EditorUI, m_rotationControl, 0x16c); +GEODE_MEMBER_CHECK(EditorUI, m_updateTimeMarkers, 0x1a4); +GEODE_MEMBER_CHECK(EditorUI, m_selectedObjects, 0x1bc); +GEODE_MEMBER_CHECK(EditorUI, m_selectedObject, 0x2c4); + #endif \ No newline at end of file From 877b6449626078783abde9cb13ecb04e75c1ea74 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 1 Oct 2023 23:58:16 +0300 Subject: [PATCH 127/270] fix ccmenuitemsprite virtuals --- loader/include/Geode/platform/android.hpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/loader/include/Geode/platform/android.hpp b/loader/include/Geode/platform/android.hpp index e19402bc..149d6bb2 100644 --- a/loader/include/Geode/platform/android.hpp +++ b/loader/include/Geode/platform/android.hpp @@ -2,6 +2,8 @@ #include +#include "ItaniumCast.hpp" + namespace geode { struct PlatformInfo { void* m_so; @@ -11,11 +13,3 @@ namespace geode { namespace geode::base { /*GEODE_NOINLINE inline*/ uintptr_t get(); } - -namespace geode::cast { - template - After typeinfo_cast(Before ptr) { - // yall have symbols smh - return dynamic_cast(ptr); - } -} From 7f277a77e1f7b6c9223684cf026de7b14389dc7c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sun, 1 Oct 2023 23:59:44 +0200 Subject: [PATCH 128/270] Added a simple text area UI node (#277) --- loader/include/Geode/ui/TextArea.hpp | 60 +++++++ loader/src/ui/nodes/TextArea.cpp | 228 +++++++++++++++++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 loader/include/Geode/ui/TextArea.hpp create mode 100644 loader/src/ui/nodes/TextArea.cpp diff --git a/loader/include/Geode/ui/TextArea.hpp b/loader/include/Geode/ui/TextArea.hpp new file mode 100644 index 00000000..0ac0cf31 --- /dev/null +++ b/loader/include/Geode/ui/TextArea.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include +#include + +namespace geode { + /** + * A class which provides a textarea with proper alignment and some extra features like: + * + * - Max lines + * - Changing all aspects after creation + * - Custom text alignment + * - Automatic line wrapping and cutoff + * - Line padding + * + * Contact me on Discord (\@smjs) if you have any questions, suggestions or bugs. + */ + class GEODE_DLL SimpleTextArea : public cocos2d::CCNode { + cocos2d::CCMenu* m_container; + std::string m_font; + std::string m_text; + std::vector m_lines; + cocos2d::CCTextAlignment m_alignment; + size_t m_maxLines; + float m_scale; + float m_lineHeight; + float m_linePadding; + bool m_artificialWidth; + public: + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale); + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width); + + void setFont(const std::string& font); + std::string getFont(); + void setAlignment(const cocos2d::CCTextAlignment alignment); + cocos2d::CCTextAlignment getAlignment(); + void setText(const std::string& text); + std::string getText(); + void setMaxLines(const size_t maxLines); + size_t getMaxLines(); + void setWidth(const float width); + float getWidth(); + void setScale(const float scale); + float getScale(); + void setLinePadding(const float padding); + float getLinePadding(); + std::vector getLines(); + float getHeight(); + float getLineHeight(); + private: + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + + SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + cocos2d::CCLabelBMFont* createLabel(const std::string& text, const float top); + cocos2d::CCLabelBMFont* moveOverflow(cocos2d::CCLabelBMFont* line, const char c, const float top); + float calculateOffset(cocos2d::CCLabelBMFont* label); + void updateLines(); + void updateContents(); + }; +} \ No newline at end of file diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp new file mode 100644 index 00000000..4af0518b --- /dev/null +++ b/loader/src/ui/nodes/TextArea.cpp @@ -0,0 +1,228 @@ +#include + +using namespace geode::prelude; + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale = 1) { + return SimpleTextArea::create(font, text, scale, 500, false); +} + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width) { + return SimpleTextArea::create(font, text, scale, width, true); +} + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) { + SimpleTextArea* instance = new SimpleTextArea(font, text, scale, width, artificialWidth); + + if (instance && instance->init()) { + instance->autorelease(); + + return instance; + } else { + CC_SAFE_DELETE(instance); + + return nullptr; + } +} + +SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) { + m_font = font; + m_text = text; + m_maxLines = 0; + m_scale = scale; + m_linePadding = 0; + m_artificialWidth = artificialWidth; + m_container = CCMenu::create(); + + this->setAnchorPoint({ 0.5f, 0.5f }); + m_container->setPosition({ 0, 0 }); + m_container->setAnchorPoint({ 0, 1 }); + m_container->setContentSize({ width, 0 }); + + this->addChild(m_container); + this->updateContents(); +} + +void SimpleTextArea::setFont(const std::string& font) { + m_font = font; + + this->updateContents(); +} + +std::string SimpleTextArea::getFont() { + return m_font; +} + +void SimpleTextArea::setAlignment(const CCTextAlignment alignment) { + m_alignment = alignment; + + this->updateContents(); +} + +CCTextAlignment SimpleTextArea::getAlignment() { + return m_alignment; +} + +void SimpleTextArea::setText(const std::string& text) { + m_text = text; + + this->updateContents(); +} + +std::string SimpleTextArea::getText() { + return m_text; +} + +void SimpleTextArea::setMaxLines(const size_t maxLines) { + m_maxLines = maxLines; + + this->updateContents(); +} + +size_t SimpleTextArea::getMaxLines() { + return m_maxLines; +} + +void SimpleTextArea::setWidth(const float width) { + m_artificialWidth = true; + + this->setContentSize({ width, this->getContentSize().height }); + m_container->setContentSize(this->getContentSize()); +} + +float SimpleTextArea::getWidth() { + return m_container->getContentSize().width; +} + +void SimpleTextArea::setScale(const float scale) { + m_scale = scale; + + this->updateContents(); +} + +float SimpleTextArea::getScale() { + return m_scale; +} + +void SimpleTextArea::setLinePadding(const float padding) { + m_linePadding = padding; + + this->updateContents(); +} + +float SimpleTextArea::getLinePadding() { + return m_linePadding; +} + +std::vector SimpleTextArea::getLines() { + return m_lines; +} + +float SimpleTextArea::getHeight() { + return m_container->getContentSize().height; +} + +float SimpleTextArea::getLineHeight() { + return m_lineHeight; +} + +CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float top) { + CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); + + label->setScale(m_scale); + label->setAnchorPoint({ 0, 0 }); + label->setPosition({ 0, top }); + + return label; +} + +CCLabelBMFont* SimpleTextArea::moveOverflow(CCLabelBMFont* line, const char c, const float top) { + const std::string text = line->getString(); + const char back = text.back(); + const bool lastIsSpace = back == ' '; + CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); + + if (!lastIsSpace) { + if (text[text.size() - 2] == ' ') { + line->setString(text.substr(0, text.size() - 1).c_str()); + } else { + line->setString((text.substr(0, text.size() - 1) + '-').c_str()); + } + } + + m_lines.push_back(newLine); + + return newLine; +} + +float SimpleTextArea::calculateOffset(CCLabelBMFont* label) { + return m_linePadding + label->getContentSize().height * m_scale; +} + +void SimpleTextArea::updateLines() { + float top = 0; + CCLabelBMFont* line = this->createLabel("", top); + m_lines = { line }; + + for (const char c : m_text) { + if (m_maxLines && m_lines.size() > m_maxLines) { + CCLabelBMFont* last = m_lines.at(m_maxLines - 1); + const std::string text = last->getString(); + + m_lines.pop_back(); + last->setString(text.substr(0, text.size() - 3).append("...").c_str()); + + break; + } else if (c == '\n') { + line = this->createLabel("", top -= this->calculateOffset(line)); + + m_lines.push_back(line); + } else if (m_artificialWidth && line->getContentSize().width >= this->getWidth()) { + line = this->moveOverflow(line, c, top -= this->calculateOffset(line)); + } else { + const std::string text = line->getString(); + + line->setString((text + c).c_str()); + } + } +} + +void SimpleTextArea::updateContents() { + this->updateLines(); + const size_t lineCount = m_lines.size(); + const float width = this->getWidth(); + + if (lineCount > 0) { + m_lineHeight = m_lines.back()->getContentSize().height * m_scale; + } else { + m_lineHeight = 0; + } + + float height = m_lineHeight * lineCount + m_linePadding * (lineCount - 1); + + this->setContentSize({ width, height }); + m_container->setContentSize(this->getContentSize()); + m_container->removeAllChildren(); + + height -= m_lineHeight; + + for (CCLabelBMFont* line : m_lines) { + const float y = height + line->getPositionY(); + + switch (m_alignment) { + case kCCTextAlignmentLeft: { + line->setAnchorPoint({ 0, 0 }); + line->setPosition({ 0, y }); + } break; + case kCCTextAlignmentCenter: { + line->setAnchorPoint({ 0.5f, 0 }); + line->setPosition({ width / 2, y }); + } break; + case kCCTextAlignmentRight: { + line->setAnchorPoint({ 1, 0 }); + line->setPosition({ width, y }); + } break; + } + + m_container->addChild(line); + } +} \ No newline at end of file From 16aa697ac75fb574700abf94822e96ba46a2acca Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Mon, 2 Oct 2023 00:11:31 +0200 Subject: [PATCH 129/270] Added a filter to only test offsets on bindings --- .github/workflows/test-offsets.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-offsets.yml b/.github/workflows/test-offsets.yml index 66cfcf47..dde5de3c 100644 --- a/.github/workflows/test-offsets.yml +++ b/.github/workflows/test-offsets.yml @@ -3,6 +3,8 @@ name: Test Offsets on: workflow_dispatch: push: + paths: + - 'bindings/**' # only when adjusting bindings branches: - '**' # every branch - '!no-build-**' # unless marked as no-build From 44fa9c6f69d5663dc9e9c770dfdb17033f0dd3a6 Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Mon, 2 Oct 2023 00:15:14 +0200 Subject: [PATCH 130/270] Added an additional path to cover in offset tests --- .github/workflows/test-offsets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-offsets.yml b/.github/workflows/test-offsets.yml index dde5de3c..23403f67 100644 --- a/.github/workflows/test-offsets.yml +++ b/.github/workflows/test-offsets.yml @@ -5,6 +5,7 @@ on: push: paths: - 'bindings/**' # only when adjusting bindings + - 'loader/test/members/**' branches: - '**' # every branch - '!no-build-**' # unless marked as no-build From 777cf38df09b06b23060690277b89b069d3b977a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:37:09 +0300 Subject: [PATCH 131/270] implement threaded unzipping and revert typeinfo cast (but its ugly) --- loader/include/Geode/loader/Loader.hpp | 3 +- loader/include/Geode/platform/android.hpp | 10 +- loader/src/hooks/LoadingLayer.cpp | 27 ++++-- loader/src/loader/LoaderImpl.cpp | 93 +++++++++++++++---- loader/src/loader/LoaderImpl.hpp | 7 +- loader/src/loader/ModImpl.cpp | 22 +++-- loader/src/loader/ModImpl.hpp | 3 + .../src/ui/internal/list/ProblemsListCell.cpp | 5 + 8 files changed, 133 insertions(+), 37 deletions(-) diff --git a/loader/include/Geode/loader/Loader.hpp b/loader/include/Geode/loader/Loader.hpp index f9dd1815..030dc0ca 100644 --- a/loader/include/Geode/loader/Loader.hpp +++ b/loader/include/Geode/loader/Loader.hpp @@ -32,7 +32,8 @@ namespace geode { LoadFailed, EnableFailed, MissingDependency, - PresentIncompatibility + PresentIncompatibility, + UnzipFailed }; Type type; std::variant cause; diff --git a/loader/include/Geode/platform/android.hpp b/loader/include/Geode/platform/android.hpp index 149d6bb2..e19402bc 100644 --- a/loader/include/Geode/platform/android.hpp +++ b/loader/include/Geode/platform/android.hpp @@ -2,8 +2,6 @@ #include -#include "ItaniumCast.hpp" - namespace geode { struct PlatformInfo { void* m_so; @@ -13,3 +11,11 @@ namespace geode { namespace geode::base { /*GEODE_NOINLINE inline*/ uintptr_t get(); } + +namespace geode::cast { + template + After typeinfo_cast(Before ptr) { + // yall have symbols smh + return dynamic_cast(ptr); + } +} diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 5bc171bb..c765def5 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -9,30 +9,38 @@ using namespace geode::prelude; struct CustomLoadingLayer : Modify { CCLabelBMFont* m_smallLabel = nullptr; + CCLabelBMFont* m_smallLabel2 = nullptr; int m_geodeLoadStep = 0; + int m_totalMods = 0; void updateLoadedModsLabel() { auto allMods = Loader::get()->getAllMods(); auto count = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) { return item->isEnabled(); }); - auto totalCount = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) { - return item->shouldLoad(); - }); - auto str = fmt::format("Geode: Loaded {}/{} mods", count, totalCount); + auto str = fmt::format("Geode: Loaded {}/{} mods", count, m_totalMods); this->setSmallText(str); + auto currentMod = LoaderImpl::get()->m_currentlyLoadingMod; + auto modName = currentMod ? currentMod->getName() : "Unknown"; + this->setSmallText2(modName); } void setSmallText(std::string const& text) { m_fields->m_smallLabel->setString(text.c_str()); } + void setSmallText2(std::string const& text) { + m_fields->m_smallLabel2->setString(text.c_str()); + } + // hook bool init(bool fromReload) { CCFileUtils::get()->updatePaths(); if (!LoadingLayer::init(fromReload)) return false; + m_totalMods = Loader::get()->getAllMods().size(); + auto winSize = CCDirector::sharedDirector()->getWinSize(); m_fields->m_smallLabel = CCLabelBMFont::create("", "goldFont.fnt"); @@ -41,6 +49,12 @@ struct CustomLoadingLayer : Modify { m_fields->m_smallLabel->setID("geode-small-label"); this->addChild(m_fields->m_smallLabel); + m_fields->m_smallLabel2 = CCLabelBMFont::create("", "goldFont.fnt"); + m_fields->m_smallLabel2->setPosition(winSize.width / 2, 15.f); + m_fields->m_smallLabel2->setScale(.45f); + m_fields->m_smallLabel2->setID("geode-small-label"); + this->addChild(m_fields->m_smallLabel2); + return true; } @@ -51,6 +65,7 @@ struct CustomLoadingLayer : Modify { } else { this->continueLoadAssets(); + this->setSmallText2(""); } } @@ -108,11 +123,11 @@ struct CustomLoadingLayer : Modify { } int getCurrentStep() { - return m_fields->m_geodeLoadStep + m_loadStep + 1; + return m_fields->m_geodeLoadStep + m_loadStep + 1 + LoaderImpl::get()->m_refreshedModCount; } int getTotalStep() { - return 18; + return 18 + m_totalMods; } void updateLoadingBar() { diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 8c2e056d..529e327c 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -388,7 +388,7 @@ void Loader::Impl::buildModGraph() { void Loader::Impl::loadModGraph(Mod* node, bool early) { if (early && !node->needsEarlyLoad()) { - m_modsToLoad.push(node); + m_modsToLoad.push_back(node); return; } @@ -402,32 +402,82 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { if (node->isEnabled()) { for (auto const& dep : node->m_impl->m_dependants) { - this->loadModGraph(dep, early); + m_modsToLoad.push_front(dep); } log::popNest(); return; } - if (node->shouldLoad()) { - log::debug("Load"); - auto res = node->m_impl->loadBinary(); + m_currentlyLoadingMod = node; + m_refreshingModCount += 1; + m_refreshedModCount += 1; + + auto unzipFunction = [this, node]() { + log::debug("Unzip"); + auto res = node->m_impl->unzipGeodeFile(node->getMetadata()); + return res; + }; + + auto loadFunction = [this, node, early]() { + if (node->shouldLoad()) { + log::debug("Load"); + auto res = node->m_impl->loadBinary(); + if (!res) { + m_problems.push_back({ + LoadProblem::Type::LoadFailed, + node, + res.unwrapErr() + }); + log::error("Failed to load binary: {}", res.unwrapErr()); + log::popNest(); + m_refreshingModCount -= 1; + return; + } + + for (auto const& dep : node->m_impl->m_dependants) { + m_modsToLoad.push_front(dep); + } + } + + m_refreshingModCount -= 1; + + log::popNest(); + }; + + if (early) { + auto res = unzipFunction(); if (!res) { m_problems.push_back({ - LoadProblem::Type::LoadFailed, + LoadProblem::Type::UnzipFailed, node, res.unwrapErr() }); - log::error("Failed to load binary: {}", res.unwrapErr()); + log::error("Failed to unzip: {}", res.unwrapErr()); log::popNest(); + m_refreshingModCount -= 1; return; } - - for (auto const& dep : node->m_impl->m_dependants) { - this->loadModGraph(dep, early); - } + loadFunction(); + } + else { + std::thread([=]() { + auto res = unzipFunction(); + queueInMainThread([=]() { + if (!res) { + m_problems.push_back({ + LoadProblem::Type::UnzipFailed, + node, + res.unwrapErr() + }); + log::error("Failed to unzip: {}", res.unwrapErr()); + log::popNest(); + m_refreshingModCount -= 1; + return; + } + loadFunction(); + }); + }).detach(); } - - log::popNest(); } void Loader::Impl::findProblems() { @@ -568,12 +618,19 @@ void Loader::Impl::refreshModGraph() { else m_loadingState = LoadingState::Mods; - queueInMainThread([]() { - Loader::get()->m_impl->continueRefreshModGraph(); + queueInMainThread([&]() { + this->continueRefreshModGraph(); }); } void Loader::Impl::continueRefreshModGraph() { + if (m_refreshingModCount != 0) { + queueInMainThread([&]() { + this->continueRefreshModGraph(); + }); + return; + } + log::info("Continuing mod graph refresh..."); log::pushNest(); @@ -585,7 +642,7 @@ void Loader::Impl::continueRefreshModGraph() { log::pushNest(); this->loadModGraph(m_modsToLoad.front(), false); log::popNest(); - m_modsToLoad.pop(); + m_modsToLoad.pop_front(); if (m_modsToLoad.empty()) m_loadingState = LoadingState::Problems; break; @@ -608,8 +665,8 @@ void Loader::Impl::continueRefreshModGraph() { log::info("Took {}s", static_cast(time) / 1000.f); if (m_loadingState != LoadingState::Done) { - queueInMainThread([]() { - Loader::get()->m_impl->continueRefreshModGraph(); + queueInMainThread([&]() { + this->continueRefreshModGraph(); }); } diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index ab6f4b1a..af790a5e 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -58,7 +58,7 @@ namespace geode { std::vector m_modSearchDirectories; std::vector m_problems; std::unordered_map m_mods; - std::queue m_modsToLoad; + std::deque m_modsToLoad; std::vector m_texturePaths; bool m_isSetup = false; @@ -83,6 +83,11 @@ namespace geode { std::mutex m_nextModAccessMutex; Mod* m_nextMod = nullptr; + Mod* m_currentlyLoadingMod = nullptr; + + int m_refreshingModCount = 0; + int m_refreshedModCount = 0; + void provideNextMod(Mod* mod); Mod* takeNextMod(); void releaseNextMod(); diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 393916cf..d97c5b0f 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -568,21 +568,25 @@ Result<> Mod::Impl::createTempDir() { return Err("Unable to create mod runtime directory"); } - // Unzip .geode file into temp dir - GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(m_metadata.getPath())); - if (!unzip.hasEntry(m_metadata.getBinaryName())) { - return Err( - fmt::format("Unable to find platform binary under the name \"{}\"", m_metadata.getBinaryName()) - ); - } - GEODE_UNWRAP(unzip.extractAllTo(tempPath)); - // Mark temp dir creation as succesful m_tempDirName = tempPath; return Ok(); } +Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) { + // Unzip .geode file into temp dir + GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath())); + if (!unzip.hasEntry(metadata.getBinaryName())) { + return Err( + fmt::format("Unable to find platform binary under the name \"{}\"", metadata.getBinaryName()) + ); + } + GEODE_UNWRAP(unzip.extractAllTo(dirs::getModRuntimeDir() / metadata.getID())); + + return Ok(); +} + ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { auto dir = dirs::getModConfigDir() / m_metadata.getID(); if (create) { diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index 55e5c88d..598d3388 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -75,6 +75,9 @@ namespace geode { Result<> unloadPlatformBinary(); Result<> createTempDir(); + // called on a separate thread + Result<> unzipGeodeFile(ModMetadata metadata); + void setupSettings(); std::string getID() const; diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index faa2086b..fbca7944 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -87,6 +87,11 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize icon = "info-alert.png"_spr; message = fmt::format("{} is incompatible with {}", cause, problem.message); break; + case LoadProblem::Type::UnzipFailed: + icon = "info-alert.png"_spr; + message = fmt::format("{} has failed unzipping", cause); + m_longMessage = problem.message; + break; } m_problem = std::move(problem); From 5c765c6798299d260ecf864d298a24ce15238203 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:15:20 +0300 Subject: [PATCH 132/270] Implement modified date check on geode files for unzip --- loader/src/loader/LoaderImpl.cpp | 21 +++++++++++++-------- loader/src/loader/LoaderImpl.hpp | 3 +++ loader/src/loader/ModImpl.cpp | 28 +++++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 529e327c..d652d5e7 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -41,9 +41,6 @@ void Loader::Impl::createDirectories() { ghc::filesystem::create_directory(dirs::getSaveDir()); #endif - // try deleting geode/unzipped if it already exists - try { ghc::filesystem::remove_all(dirs::getModRuntimeDir()); } catch(...) {} - (void) utils::file::createDirectoryAll(dirs::getGeodeResourcesDir()); (void) utils::file::createDirectoryAll(dirs::getModConfigDir()); (void) utils::file::createDirectoryAll(dirs::getModsDir()); @@ -411,6 +408,7 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { m_currentlyLoadingMod = node; m_refreshingModCount += 1; m_refreshedModCount += 1; + m_lateRefreshedModCount += early ? 0 : 1; auto unzipFunction = [this, node]() { log::debug("Unzip"); @@ -631,10 +629,16 @@ void Loader::Impl::continueRefreshModGraph() { return; } + if (m_lateRefreshedModCount > 0) { + auto end = std::chrono::high_resolution_clock::now(); + auto time = std::chrono::duration_cast(end - m_timerBegin).count(); + log::info("Took {}s", static_cast(time) / 1000.f); + } + log::info("Continuing mod graph refresh..."); log::pushNest(); - auto begin = std::chrono::high_resolution_clock::now(); + m_timerBegin = std::chrono::high_resolution_clock::now(); switch (m_loadingState) { case LoadingState::Mods: @@ -652,6 +656,11 @@ void Loader::Impl::continueRefreshModGraph() { this->findProblems(); log::popNest(); m_loadingState = LoadingState::Done; + { + auto end = std::chrono::high_resolution_clock::now(); + auto time = std::chrono::duration_cast(end - m_timerBegin).count(); + log::info("Took {}s", static_cast(time) / 1000.f); + } break; default: m_loadingState = LoadingState::Done; @@ -660,10 +669,6 @@ void Loader::Impl::continueRefreshModGraph() { break; } - auto end = std::chrono::high_resolution_clock::now(); - auto time = std::chrono::duration_cast(end - begin).count(); - log::info("Took {}s", static_cast(time) / 1000.f); - if (m_loadingState != LoadingState::Done) { queueInMainThread([&]() { this->continueRefreshModGraph(); diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index af790a5e..e697edd2 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -87,6 +87,9 @@ namespace geode { int m_refreshingModCount = 0; int m_refreshedModCount = 0; + int m_lateRefreshedModCount = 0; + + std::chrono::time_point m_timerBegin; void provideNextMod(Mod* mod); Mod* takeNextMod(); diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index d97c5b0f..7075349f 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -3,6 +3,7 @@ #include "ModMetadataImpl.hpp" #include "about.hpp" +#include #include #include #include @@ -576,13 +577,38 @@ Result<> Mod::Impl::createTempDir() { Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) { // Unzip .geode file into temp dir + auto tempDir = dirs::getModRuntimeDir() / metadata.getID(); + + auto datePath = tempDir / "modified-at"; + std::string currentHash = file::readString(datePath).unwrapOr(""); + + auto modifiedDate = ghc::filesystem::last_write_time(metadata.getPath()); + auto modifiedCount = std::chrono::duration_cast(modifiedDate.time_since_epoch()); + auto modifiedHash = std::to_string(modifiedCount.count()); + if (currentHash == modifiedHash) { + log::debug("Same hash detected, skipping unzip"); + return Ok(); + } + log::debug("Hash mismatch detected, unzipping"); + + std::error_code ec; + ghc::filesystem::remove_all(tempDir, ec); + if (ec) { + return Err("Unable to delete temp dir: " + ec.message()); + } + + auto res = file::writeString(datePath, modifiedHash); + if (!res) { + log::warn("Failed to write modified date of geode zip"); + } + GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath())); if (!unzip.hasEntry(metadata.getBinaryName())) { return Err( fmt::format("Unable to find platform binary under the name \"{}\"", metadata.getBinaryName()) ); } - GEODE_UNWRAP(unzip.extractAllTo(dirs::getModRuntimeDir() / metadata.getID())); + GEODE_UNWRAP(unzip.extractAllTo(tempDir)); return Ok(); } From 0ed1a41426bb5bead62af93e6eb76e7b41168954 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:37:02 +0300 Subject: [PATCH 133/270] Fix unzip modify date & add verifying text --- loader/src/hooks/LoadingLayer.cpp | 30 +++++++++++++++++------------- loader/src/loader/ModImpl.cpp | 6 ++++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index c765def5..3cdf20e7 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -70,20 +70,24 @@ struct CustomLoadingLayer : Modify { } void setupLoaderResources() { + log::debug("Verifying Loader Resources"); + this->setSmallText("Verifying Loader Resources"); // verify loader resources - if (!LoaderImpl::get()->verifyLoaderResources()) { - log::debug("Downloading Loader Resources"); - this->setSmallText("Downloading Loader Resources"); - this->addChild(EventListenerNode::create( - this, &CustomLoadingLayer::updateResourcesProgress - )); - } - else { - log::debug("Loading Loader Resources"); - this->setSmallText("Loading Loader Resources"); - LoaderImpl::get()->updateSpecialFiles(); - this->continueLoadAssets(); - } + Loader::get()->queueInMainThread([&]() { + if (!LoaderImpl::get()->verifyLoaderResources()) { + log::debug("Downloading Loader Resources"); + this->setSmallText("Downloading Loader Resources"); + this->addChild(EventListenerNode::create( + this, &CustomLoadingLayer::updateResourcesProgress + )); + } + else { + log::debug("Loading Loader Resources"); + this->setSmallText("Loading Loader Resources"); + LoaderImpl::get()->updateSpecialFiles(); + this->continueLoadAssets(); + } + }); } void updateResourcesProgress(ResourceDownloadEvent* event) { diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 7075349f..adf335f5 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -596,11 +596,13 @@ Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) { if (ec) { return Err("Unable to delete temp dir: " + ec.message()); } - + + (void)utils::file::createDirectoryAll(tempDir); auto res = file::writeString(datePath, modifiedHash); if (!res) { - log::warn("Failed to write modified date of geode zip"); + log::warn("Failed to write modified date of geode zip: {}", res.unwrapErr()); } + GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath())); if (!unzip.hasEntry(metadata.getBinaryName())) { From 8dd2e15c383f7829a4e5db0a3c5a54b32dc2076f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:50:10 +0300 Subject: [PATCH 134/270] fix dynamic cast --- loader/include/Geode/platform/ItaniumCast.hpp | 42 +++++++------------ loader/include/Geode/platform/android.hpp | 8 +--- loader/src/hooks/DynamicCastFix.cpp | 21 +++++----- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/loader/include/Geode/platform/ItaniumCast.hpp b/loader/include/Geode/platform/ItaniumCast.hpp index 93cd024e..8f90d179 100644 --- a/loader/include/Geode/platform/ItaniumCast.hpp +++ b/loader/include/Geode/platform/ItaniumCast.hpp @@ -1,8 +1,6 @@ #pragma once namespace geode::cast { - using uinthalf_t = uint32_t; - using inthalf_t = int32_t; struct DummyClass { virtual ~DummyClass() {} @@ -14,8 +12,10 @@ namespace geode::cast { struct DummyMultipleClass : DummySingleClass, DummyClass2 {}; + struct VtableType; + struct ClassTypeinfoType { - void** m_typeinfoVtable; + VtableType* m_typeinfoVtable; char const* m_typeinfoName; }; @@ -23,16 +23,17 @@ namespace geode::cast { ClassTypeinfoType* m_baseClassTypeinfo; }; -#pragma pack(push, 1) - struct MultipleClassSingleEntryType { ClassTypeinfoType* m_baseClassTypeinfo; - uint8_t m_visibilityFlag; - inthalf_t m_offset; - uint8_t m_padding[sizeof(inthalf_t) - 1]; - }; + intptr_t m_metadata; -#pragma pack(pop) + uint8_t visibilityFlag() const { + return m_metadata & 0xFF; + } + intptr_t offset() const { + return m_metadata >> 8; + } + }; struct MultipleClassTypeinfoType : ClassTypeinfoType { uint32_t m_flags; @@ -41,7 +42,7 @@ namespace geode::cast { }; struct VtableTypeinfoType { - inthalf_t m_offset; + intptr_t m_offset; ClassTypeinfoType* m_typeinfo; }; @@ -51,36 +52,25 @@ namespace geode::cast { struct CompleteVtableType : VtableTypeinfoType, VtableType {}; - inline void** typeinfoVtableOf(void* ptr) { - auto vftable = *reinterpret_cast(ptr); - - auto typeinfoPtr = - static_cast(static_cast(vftable)); - - return typeinfoPtr->m_typeinfo->m_typeinfoVtable; - } - inline void* traverseTypeinfoFor( void* ptr, ClassTypeinfoType const* typeinfo, char const* afterIdent ) { - DummySingleClass dummySingleClass; - DummyMultipleClass dummyMultipleClass; - { auto optionIdent = typeinfo->m_typeinfoName; if (std::strcmp(optionIdent, afterIdent) == 0) { return ptr; } } - if (typeinfo->m_typeinfoVtable == typeinfoVtableOf(&dummySingleClass)) { + auto typeinfoVtableName = static_cast(typeinfo->m_typeinfoVtable)->m_typeinfo->m_typeinfoName; + if (std::strcmp(typeinfoVtableName, "N10__cxxabiv120__si_class_type_infoE") == 0) { auto siTypeinfo = static_cast(typeinfo); return traverseTypeinfoFor(ptr, siTypeinfo->m_baseClassTypeinfo, afterIdent); } - else if (typeinfo->m_typeinfoVtable == typeinfoVtableOf(&dummyMultipleClass)) { + else if (std::strcmp(typeinfoVtableName, "N10__cxxabiv121__vmi_class_type_infoE") == 0) { auto vmiTypeinfo = static_cast(typeinfo); for (int i = 0; i < vmiTypeinfo->m_numBaseClass; ++i) { auto& entry = vmiTypeinfo->m_baseClasses[i]; - auto optionPtr = reinterpret_cast(ptr) + entry.m_offset; + auto optionPtr = reinterpret_cast(ptr) + entry.offset(); auto ret = traverseTypeinfoFor(optionPtr, entry.m_baseClassTypeinfo, afterIdent); if (ret != nullptr) return ret; } diff --git a/loader/include/Geode/platform/android.hpp b/loader/include/Geode/platform/android.hpp index e19402bc..31c7edeb 100644 --- a/loader/include/Geode/platform/android.hpp +++ b/loader/include/Geode/platform/android.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include "ItaniumCast.hpp" namespace geode { struct PlatformInfo { @@ -12,10 +13,3 @@ namespace geode::base { /*GEODE_NOINLINE inline*/ uintptr_t get(); } -namespace geode::cast { - template - After typeinfo_cast(Before ptr) { - // yall have symbols smh - return dynamic_cast(ptr); - } -} diff --git a/loader/src/hooks/DynamicCastFix.cpp b/loader/src/hooks/DynamicCastFix.cpp index 3986eeae..5a17e56f 100644 --- a/loader/src/hooks/DynamicCastFix.cpp +++ b/loader/src/hooks/DynamicCastFix.cpp @@ -1,19 +1,20 @@ #include - -#ifdef GEODE_IS_MACOS +#include using namespace geode::prelude; - #include - #include - $execute { // this replaces the call to __dynamic_cast with a call to our own // this is needed because the transitions in cocos uses dynamic cast to check // layers, which fail on user layers due to typeinfo not matching - (void)Mod::get()->patch( - reinterpret_cast(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal) - ); -} -#endif \ No newline at end of file + #if defined(GEODE_IS_MACOS) + (void)Mod::get()->patch( + reinterpret_cast(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal) + ); + #elif defined(GEODE_IS_ANDROID) + (void)Mod::get()->addHook(reinterpret_cast(base::get() + 0x519a8c), &cast::typeinfoCastInternal, "__dynamic_cast"); + #endif + + +} \ No newline at end of file From d3235663ae6beef8269f76d1ece95f14bb0a843a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:01:01 +0300 Subject: [PATCH 135/270] update tuliphook --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6ce0923..dfcd33fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) set(TULIP_LINK_SOURCE ON) endif() set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -CPMAddPackage("gh:geode-sdk/TulipHook#41a18a1") +CPMAddPackage("gh:geode-sdk/TulipHook#d2132de") set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE) # Silence warnings from dependencies From 03673606440a3e0f47fe9be615fc6a4a8ab8c888 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:03:58 +0300 Subject: [PATCH 136/270] Add text input node fix --- loader/src/hooks/TextInputNodeFix.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 loader/src/hooks/TextInputNodeFix.cpp diff --git a/loader/src/hooks/TextInputNodeFix.cpp b/loader/src/hooks/TextInputNodeFix.cpp new file mode 100644 index 00000000..73aa6051 --- /dev/null +++ b/loader/src/hooks/TextInputNodeFix.cpp @@ -0,0 +1,18 @@ +#include + +#ifdef GEODE_IS_ANDROID + +using namespace geode::prelude; + +struct TextNodeFix : Modify { + bool onTextFieldInsertText(cocos2d::CCTextFieldTTF* field, char const* text, int count) { + auto change = count >= this->m_maxLabelLength ? 1 : 0; + + this->m_maxLabelLength += change; + auto ret = CCTextInputNode::onTextFieldInsertText(field, text, count); + this->m_maxLabelLength -= change; + return ret; + } +}; + +#endif \ No newline at end of file From d194cbe3b7b6595db93ba278f7abce864c5b0a07 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:05:27 +0300 Subject: [PATCH 137/270] remove this-> --- loader/src/hooks/TextInputNodeFix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/src/hooks/TextInputNodeFix.cpp b/loader/src/hooks/TextInputNodeFix.cpp index 73aa6051..18541761 100644 --- a/loader/src/hooks/TextInputNodeFix.cpp +++ b/loader/src/hooks/TextInputNodeFix.cpp @@ -6,11 +6,11 @@ using namespace geode::prelude; struct TextNodeFix : Modify { bool onTextFieldInsertText(cocos2d::CCTextFieldTTF* field, char const* text, int count) { - auto change = count >= this->m_maxLabelLength ? 1 : 0; + auto change = count >= m_maxLabelLength ? 1 : 0; - this->m_maxLabelLength += change; + m_maxLabelLength += change; auto ret = CCTextInputNode::onTextFieldInsertText(field, text, count); - this->m_maxLabelLength -= change; + m_maxLabelLength -= change; return ret; } }; From 3b8dbfa4d324e8ebd52f99e58afb876182debe1f Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:07:33 +0200 Subject: [PATCH 138/270] Added 2 additional methods to GameStatsManager One of these (set stat) might be a risk to expose so I'm not 100% sure if you guys want it covered or not --- bindings/GeometryDash.bro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index c3d0d9c6..6c4f3f0e 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3564,7 +3564,8 @@ class GameStatsManager : cocos2d::CCNode { int getBaseCurrencyForLevel(GJGameLevel*) = mac 0x43470, win 0xf8530; GJChallengeItem* getChallenge(int id) = mac 0x451f0, win 0xa2fb0; void getSecretCoinKey(char const*) = mac 0x429f0; - int getStat(char const*) = mac 0x3d310, win 0xf3580; + int getStat(char const* type) = mac 0x3d310, win 0xf3580; + void setStat(char const* type, int amount) = win 0xf3690; void hasPendingUserCoin(char const*) = mac 0x42730, win 0xf7c50; void hasSecretCoin(char const*) = mac 0x40730, win 0xf7dc0; void hasUserCoin(char const*) = mac 0x427e0, win 0xf7ae0; @@ -3576,6 +3577,7 @@ class GameStatsManager : cocos2d::CCNode { void storeSecretCoin(char const*) = mac 0x42a10; void storeUserCoin(char const*) = mac 0x42890; bool isItemUnlocked(UnlockType type, int id) = win 0xfbb80; + void checkAchievement(char const* type) = win 0xf37c0 PAD = mac 0x50, win 0x28; cocos2d::CCDictionary* m_dailyChests; From 2d172704efed8fa996f330be0a6d60e664d8da8c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:29:40 +0200 Subject: [PATCH 139/270] Fixed a typo in my last change to game stats manager (#281) * Added 2 additional methods to GameStatsManager One of these (set stat) might be a risk to expose so I'm not 100% sure if you guys want it covered or not * Fixed a typo in my last change to game stats manager --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6c4f3f0e..54dc755f 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3577,7 +3577,7 @@ class GameStatsManager : cocos2d::CCNode { void storeSecretCoin(char const*) = mac 0x42a10; void storeUserCoin(char const*) = mac 0x42890; bool isItemUnlocked(UnlockType type, int id) = win 0xfbb80; - void checkAchievement(char const* type) = win 0xf37c0 + void checkAchievement(char const* type) = win 0xf37c0; PAD = mac 0x50, win 0x28; cocos2d::CCDictionary* m_dailyChests; From a985d5a8c564dc2a8d5a36577d3c33b8495dffe9 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:51:12 +0300 Subject: [PATCH 140/270] implement utils except file utils but i tried ok --- loader/src/platform/android/main.cpp | 2 +- loader/src/platform/android/util.cpp | 77 ++++++++++++++++++++++++++-- loader/src/platform/mac/util.mm | 2 +- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/loader/src/platform/android/main.cpp b/loader/src/platform/android/main.cpp index 471b162e..f1500146 100644 --- a/loader/src/platform/android/main.cpp +++ b/loader/src/platform/android/main.cpp @@ -17,7 +17,7 @@ extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* rese glDeleteVertexArraysOESEXT = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"); geodeEntry(nullptr); - return JNI_VERSION_1_1; + return JNI_VERSION_1_6; } extern "C" [[gnu::visibility("default")]] void emptyFunction(void*) { diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 8da055a5..dacc4a84 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -9,14 +9,41 @@ using namespace geode::prelude; #include #include +#include +#include + bool utils::clipboard::write(std::string const& data) { + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "writeClipboard", "(Ljava/lang/String;)V")) { + jstring stringArg1 = t.env->NewStringUTF(data.c_str()); + + t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1); + + t.env->DeleteLocalRef(stringArg1); + t.env->DeleteLocalRef(t.classID); + return true; + } return false; } std::string utils::clipboard::read() { + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "readClipboard", "()Ljava/lang/String;")) { + jstring stringResult = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID); + + std::string result = JniHelper::jstring2string(stringResult); + + t.env->DeleteLocalRef(stringResult); + t.env->DeleteLocalRef(t.classID); + return result; + } return ""; } +CCPoint cocos::getMousePos() { + return CCPoint(0, 0); +} + ghc::filesystem::path dirs::getGameDir() { return ghc::filesystem::path( "/storage/emulated/0/Android/data/com.geode.launcher/files/game" @@ -44,7 +71,17 @@ void utils::web::openLinkInBrowser(std::string const& url) { CCApplication::sharedApplication()->openURL(url.c_str()); } -bool utils::file::openFolder(ghc::filesystem::path const&) { +bool utils::file::openFolder(ghc::filesystem::path const& path) { + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "openFolder", "(Ljava/lang/String;)Z")) { + jstring stringArg1 = t.env->NewStringUTF(path.string().c_str()); + + jboolean result = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg1); + + t.env->DeleteLocalRef(stringArg1); + t.env->DeleteLocalRef(t.classID); + return result; + } return false; } @@ -58,16 +95,50 @@ void geode::utils::game::launchLoaderUninstaller(bool deleteSaveData) { } void geode::utils::game::exit() { + if (CCApplication::sharedApplication() && + (GameManager::get()->m_playLayer || GameManager::get()->m_levelEditorLayer)) { + log::error("Cannot exit in PlayLayer or LevelEditorLayer!"); + return; + } + AppDelegate::get()->trySaveGame(); + // AppDelegate::get()->showLoadingCircle(false, true); + CCDirector::get()->getActionManager()->addAction(CCSequence::create( CCDelayTime::create(0.5f), CCCallFunc::create(nullptr, callfunc_selector(MenuLayer::endGame)), nullptr - ), CCDirector::get()->getRunningScene(), false);; + ), CCDirector::get()->getRunningScene(), false); } void geode::utils::game::restart() { + if (CCApplication::sharedApplication() && + (GameManager::get()->m_playLayer || GameManager::get()->m_levelEditorLayer)) { + log::error("Cannot restart in PlayLayer or LevelEditorLayer!"); + return; + } + + class Exit : public CCObject { + public: + void restart() { + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "restartGame", "()V")) { + t.env->CallStaticVoidMethod(t.classID, t.methodID); + + t.env->DeleteLocalRef(t.classID); + } + } + }; // Not implemented - log::error("Restarting the game is not implemented on android"); + // log::error("Restarting the game is not implemented on android"); + + AppDelegate::get()->trySaveGame(); + // AppDelegate::get()->showLoadingCircle(false, true); + + CCDirector::get()->getActionManager()->addAction(CCSequence::create( + CCDelayTime::create(0.5f), + CCCallFunc::create(nullptr, callfunc_selector(Exit::restart)), + nullptr + ), CCDirector::get()->getRunningScene(), false); } #endif diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index 31111cfa..e0971265 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -207,7 +207,7 @@ ghc::filesystem::path dirs::getModRuntimeDir() { void geode::utils::game::exit() { if (CCApplication::sharedApplication() && (GameManager::get()->m_playLayer || GameManager::get()->m_levelEditorLayer)) { - log::error("Cannot restart in PlayLayer or LevelEditorLayer!"); + log::error("Cannot exit in PlayLayer or LevelEditorLayer!"); return; } From 0e8865546c8ab96cbb182ce13b316df40fbfc72c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:28:15 +0200 Subject: [PATCH 141/270] Fixed alignment issues caused by unallocated memory and bad anchor points Simply put, alignment had no default assignment, causing undefined behavior, this also revealed some bad anchor points which could be optimized --- loader/src/ui/nodes/TextArea.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 4af0518b..9dce696f 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -30,6 +30,7 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_alignment = kCCTextAlignmentLeft; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); @@ -129,7 +130,6 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); label->setScale(m_scale); - label->setAnchorPoint({ 0, 0 }); label->setPosition({ 0, top }); return label; @@ -203,26 +203,24 @@ void SimpleTextArea::updateContents() { m_container->setContentSize(this->getContentSize()); m_container->removeAllChildren(); - height -= m_lineHeight; - for (CCLabelBMFont* line : m_lines) { const float y = height + line->getPositionY(); switch (m_alignment) { case kCCTextAlignmentLeft: { - line->setAnchorPoint({ 0, 0 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 0 }); + line->setAnchorPoint({ 0.5f, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { - line->setAnchorPoint({ 1, 0 }); + line->setAnchorPoint({ 1, 1 }); line->setPosition({ width, y }); } break; } m_container->addChild(line); } -} \ No newline at end of file +} From 36c461ace47e2939c1f37709ee4514cb0c08d5ba Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:33:59 +0200 Subject: [PATCH 142/270] Fixed alignment issues caused by unallocated memory and bad anchor points (#282) --- loader/src/ui/nodes/TextArea.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 4af0518b..9dce696f 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -30,6 +30,7 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_alignment = kCCTextAlignmentLeft; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); @@ -129,7 +130,6 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); label->setScale(m_scale); - label->setAnchorPoint({ 0, 0 }); label->setPosition({ 0, top }); return label; @@ -203,26 +203,24 @@ void SimpleTextArea::updateContents() { m_container->setContentSize(this->getContentSize()); m_container->removeAllChildren(); - height -= m_lineHeight; - for (CCLabelBMFont* line : m_lines) { const float y = height + line->getPositionY(); switch (m_alignment) { case kCCTextAlignmentLeft: { - line->setAnchorPoint({ 0, 0 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 0 }); + line->setAnchorPoint({ 0.5f, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { - line->setAnchorPoint({ 1, 0 }); + line->setAnchorPoint({ 1, 1 }); line->setPosition({ width, y }); } break; } m_container->addChild(line); } -} \ No newline at end of file +} From f563c4678e2a278b67ae059f30f2c13e77b0d9dd Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:50:16 +0300 Subject: [PATCH 143/270] Only hash markdown files --- cmake/GeodeFile.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index f44b7d26..8f1a8ddd 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -294,9 +294,10 @@ function(package_geode_resources_now proname src dest header_dest) # "LOADER_RESOURCE_FILES {\n" ) - list(APPEND HASHED_EXTENSIONS ".png") - list(APPEND HASHED_EXTENSIONS ".mp3") - list(APPEND HASHED_EXTENSIONS ".ogg") + # yeah don't think we need to check too many stuff + # list(APPEND HASHED_EXTENSIONS ".png") + # list(APPEND HASHED_EXTENSIONS ".mp3") + # list(APPEND HASHED_EXTENSIONS ".ogg") list(APPEND HASHED_EXTENSIONS ".md") foreach(file ${RESOURCE_FILES}) From 66e36b3a389700bb953534f916ae89fa728f7689 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:09:42 +0300 Subject: [PATCH 144/270] this handler sometimes doesnt work --- .../platform/android/backtrace/ScopedFd.hpp | 55 +++ .../platform/android/backtrace/execinfo.hpp | 191 +++++++++ loader/src/platform/android/crashlog.cpp | 376 +++++++++++++++++- 3 files changed, 618 insertions(+), 4 deletions(-) create mode 100644 loader/src/platform/android/backtrace/ScopedFd.hpp create mode 100644 loader/src/platform/android/backtrace/execinfo.hpp diff --git a/loader/src/platform/android/backtrace/ScopedFd.hpp b/loader/src/platform/android/backtrace/ScopedFd.hpp new file mode 100644 index 00000000..701d7ebc --- /dev/null +++ b/loader/src/platform/android/backtrace/ScopedFd.hpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#pragma once + +#include + +class ScopedFd final { + public: + explicit ScopedFd(int fd) : fd_(fd) { + } + + ScopedFd() : fd_(-1) { + } + + ~ScopedFd() { + reset(-1); + } + + void reset(int fd = -1) { + fd_ = fd; + } + + int get() const { + return fd_; + } + + private: + int fd_; +}; diff --git a/loader/src/platform/android/backtrace/execinfo.hpp b/loader/src/platform/android/backtrace/execinfo.hpp new file mode 100644 index 00000000..893cac93 --- /dev/null +++ b/loader/src/platform/android/backtrace/execinfo.hpp @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ScopedFd.hpp" + +struct StackState { + void** frames; + int frame_count; + int cur_frame = 0; + + StackState(void** frames, int frame_count) : frames(frames), frame_count(frame_count) {} +}; + +static _Unwind_Reason_Code TraceFunction(_Unwind_Context* context, void* arg) { + // The instruction pointer is pointing at the instruction after the return + // call on all architectures. + // Modify the pc to point at the real function. + uintptr_t ip = _Unwind_GetIP(context); + if (ip != 0) { +#if defined(__arm__) + // If the ip is suspiciously low, do nothing to avoid a segfault trying + // to access this memory. + if (ip >= 4096) { + // Check bits [15:11] of the first halfword assuming the instruction + // is 32 bits long. If the bits are any of these values, then our + // assumption was correct: + // b11101 + // b11110 + // b11111 + // Otherwise, this is a 16 bit instruction. + uint16_t value = (*reinterpret_cast(ip - 2)) >> 11; + if (value == 0x1f || value == 0x1e || value == 0x1d) { + ip -= 4; + } else { + ip -= 2; + } + } +#elif defined(__aarch64__) + // All instructions are 4 bytes long, skip back one instruction. + ip -= 4; +#elif defined(__i386__) || defined(__x86_64__) + // It's difficult to decode exactly where the previous instruction is, + // so subtract 1 to estimate where the instruction lives. + ip--; +#endif + } + + StackState* state = static_cast(arg); + state->frames[state->cur_frame++] = reinterpret_cast(ip); + return (state->cur_frame >= state->frame_count) ? _URC_END_OF_STACK : _URC_NO_REASON; +} + +int backtrace(void** buffer, int size) { + if (size <= 0) { + return 0; + } + + StackState state(buffer, size); + _Unwind_Backtrace(TraceFunction, &state); + return state.cur_frame; +} + +void backtrace_symbols_fd(void* const* buffer, int size, int fd); + +char** backtrace_symbols(void* const* buffer, int size) { + if (size <= 0) { + return nullptr; + } + // Do this calculation first in case the user passes in a bad value. + size_t ptr_size; + if (__builtin_mul_overflow(sizeof(char*), size, &ptr_size)) { + return nullptr; + } + ScopedFd fd(syscall(SYS_memfd_create, "backtrace_symbols_fd", MFD_CLOEXEC)); + // ScopedFd fd(memfd_create("backtrace_symbols_fd", MFD_CLOEXEC)); + if (fd.get() == -1) { + return nullptr; + } + backtrace_symbols_fd(buffer, size, fd.get()); + + // Get the size of the file. + off_t file_size = lseek(fd.get(), 0, SEEK_END); + if (file_size <= 0) { + return nullptr; + } + + // The interface for backtrace_symbols indicates that only the single + // returned pointer must be freed by the caller. Therefore, allocate a + // buffer that includes the memory for the strings and all of the pointers. + // Add one byte at the end just in case the file didn't end with a '\n'. + size_t symbol_data_size; + if (__builtin_add_overflow(ptr_size, file_size, &symbol_data_size) || + __builtin_add_overflow(symbol_data_size, 1, &symbol_data_size)) { + return nullptr; + } + + uint8_t* symbol_data = reinterpret_cast(malloc(symbol_data_size)); + if (symbol_data == nullptr) { + return nullptr; + } + + // Copy the string data into the buffer. + char* cur_string = reinterpret_cast(&symbol_data[ptr_size]); + // If this fails, the read won't read back the correct number of bytes. + lseek(fd.get(), 0, SEEK_SET); + ssize_t num_read = read(fd.get(), cur_string, file_size); + fd.reset(-1); + if (num_read != file_size) { + free(symbol_data); + return nullptr; + } + + // Make sure the last character in the file is '\n'. + if (cur_string[file_size] != '\n') { + cur_string[file_size++] = '\n'; + } + + for (int i = 0; i < size; i++) { + (reinterpret_cast(symbol_data))[i] = cur_string; + cur_string = strchr(cur_string, '\n'); + if (cur_string == nullptr) { + free(symbol_data); + return nullptr; + } + cur_string[0] = '\0'; + cur_string++; + } + return reinterpret_cast(symbol_data); +} + +// This function should do no allocations if possible. +void backtrace_symbols_fd(void* const* buffer, int size, int fd) { + if (size <= 0 || fd < 0) { + return; + } + + for (int frame_num = 0; frame_num < size; frame_num++) { + void* address = buffer[frame_num]; + Dl_info info; + if (dladdr(address, &info) != 0) { + if (info.dli_fname != nullptr) { + write(fd, info.dli_fname, strlen(info.dli_fname)); + } + if (info.dli_sname != nullptr) { + dprintf(fd, "(%s+0x%" PRIxPTR ") ", info.dli_sname, + reinterpret_cast(address) - reinterpret_cast(info.dli_saddr)); + } else { + dprintf(fd, "(+%p) ", info.dli_saddr); + } + } + + dprintf(fd, "[%p]\n", address); + } +} diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index 2f83c5cf..6f1812e8 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -2,16 +2,384 @@ #ifdef GEODE_IS_ANDROID -ghc::filesystem::path crashlog::getCrashLogDirectory() { - return geode::dirs::getSaveDir(); +using namespace geode::prelude; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "backtrace/execinfo.hpp" + +static constexpr size_t FRAME_SIZE = 64; +static std::mutex s_mutex; +static std::condition_variable s_cv; +static int s_signal = 0; +static siginfo_t* s_siginfo = nullptr; +static ucontext_t* s_context = nullptr; +static size_t s_backtraceSize = 0; +static std::array s_backtrace; + +static std::string_view getSignalCodeString() { + switch(s_signal) { + case SIGSEGV: return "SIGSEGV: Segmentation Fault"; + case SIGINT: return "SIGINT: Interactive attention signal, (usually ctrl+c)"; + case SIGFPE: + switch(s_siginfo->si_code) { + case FPE_INTDIV: return "SIGFPE: (integer divide by zero)"; + case FPE_INTOVF: return "SIGFPE: (integer overflow)"; + case FPE_FLTDIV: return "SIGFPE: (floating-point divide by zero)"; + case FPE_FLTOVF: return "SIGFPE: (floating-point overflow)"; + case FPE_FLTUND: return "SIGFPE: (floating-point underflow)"; + case FPE_FLTRES: return "SIGFPE: (floating-point inexact result)"; + case FPE_FLTINV: return "SIGFPE: (floating-point invalid operation)"; + case FPE_FLTSUB: return "SIGFPE: (subscript out of range)"; + default: return "SIGFPE: Arithmetic Exception"; + } + case SIGILL: + switch(s_siginfo->si_code) { + case ILL_ILLOPC: return "SIGILL: (illegal opcode)"; + case ILL_ILLOPN: return "SIGILL: (illegal operand)"; + case ILL_ILLADR: return "SIGILL: (illegal addressing mode)"; + case ILL_ILLTRP: return "SIGILL: (illegal trap)"; + case ILL_PRVOPC: return "SIGILL: (privileged opcode)"; + case ILL_PRVREG: return "SIGILL: (privileged register)"; + case ILL_COPROC: return "SIGILL: (coprocessor error)"; + case ILL_BADSTK: return "SIGILL: (internal stack error)"; + default: return "SIGILL: Illegal Instruction"; + } + case SIGTERM: return "SIGTERM: a termination request was sent to the program"; + case SIGABRT: return "SIGABRT: usually caused by an abort() or assert()"; + case SIGBUS: return "SIGBUS: Bus error (bad memory access)"; + default: return "Unknown signal code"; + } } +static std::string getImageName(Elf32_Phdr const* image) { + if (image == nullptr) { + return ""; + } + std::string imageName;// = image->imageFilePath; + if (imageName.empty()) { + imageName = ""; + } + return imageName; +} + +// static std::vector getAllImages() { +// std::vector images; +// struct task_dyld_info dyldInfo; +// mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; +// if (task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyldInfo, &count) == KERN_SUCCESS) { +// struct dyld_all_image_infos* imageInfos = (struct dyld_all_image_infos*)dyldInfo.all_image_info_addr; + +// for (size_t i = 0; i < imageInfos->infoArrayCount; ++i) { +// images.push_back(&imageInfos->infoArray[i]); +// } +// } + +// return images; +// } + +static Elf32_Phdr const* imageFromAddress(void const* addr) { + if (addr == nullptr) { + return nullptr; + } + + // auto loadedImages = getAllImages(); + // std::sort(loadedImages.begin(), loadedImages.end(), [](auto const a, auto const b) { + // return (uintptr_t)a->imageLoadAddress < (uintptr_t)b->imageLoadAddress; + // }); + // auto iter = std::upper_bound(loadedImages.begin(), loadedImages.end(), addr, [](auto const addr, auto const image) { + // return (uintptr_t)addr < (uintptr_t)image->imageLoadAddress; + // }); + + // if (iter == loadedImages.begin()) { + // return nullptr; + // } + // --iter; + + // auto image = *iter; + // // auto imageSize = getImageSize((struct mach_header_64 const*)image->imageLoadAddress); + // auto imageAddress = (uintptr_t)image->imageLoadAddress; + // if ((uintptr_t)addr >= imageAddress/* && (uintptr_t)addr < imageAddress + imageSize*/) { + // return image; + // } + return nullptr; +} + +static Mod* modFromAddress(void const* addr) { + if (addr == nullptr) { + return nullptr; + } + // auto image = imageFromAddress(addr); + // if (image == nullptr) { + // return nullptr; + // } + + // ghc::filesystem::path imagePath = getImageName(image); + // if (!ghc::filesystem::exists(imagePath)) { + // return nullptr; + // } + // auto geodePath = dirs::getGameDir() / "Frameworks" / "Geode.dylib"; + // if (ghc::filesystem::equivalent(imagePath, geodePath)) { + // return Mod::get(); + // } + + // for (auto& mod : Loader::get()->getAllMods()) { + // if (!mod->isEnabled() || !ghc::filesystem::exists(mod->getBinaryPath())) { + // continue; + // } + // if (ghc::filesystem::equivalent(imagePath, mod->getBinaryPath())) { + // return mod; + // } + // } + return nullptr; +} + +static std::string getInfo(void* address, Mod* faultyMod) { + std::stringstream stream; + stream << "Faulty Lib: " << getImageName(imageFromAddress(address)) << "\n"; + stream << "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "") << "\n"; + stream << "Instruction Address: " << address << "\n"; + stream << "Signal Code: " << std::hex << s_signal << " (" << getSignalCodeString() << ")" << std::dec << "\n"; + return stream.str(); +} + +static struct sigaction oldActionSEGV; +static struct sigaction oldActionBUS; +static struct sigaction oldActionILL; + +extern "C" void signalHandler(int signal, siginfo_t* signalInfo, void* vcontext) { + auto context = reinterpret_cast(vcontext); + s_backtraceSize = 0; + // s_backtraceSize = backtrace(s_backtrace.data(), FRAME_SIZE); + + // for some reason this is needed, dont ask me why + // s_backtrace[1] = reinterpret_cast(context->uc_mcontext.fault_address); + // if (s_backtraceSize < FRAME_SIZE) { + // s_backtrace[s_backtraceSize] = nullptr; + // } + + { + std::unique_lock lock(s_mutex); + s_signal = signal; + s_siginfo = signalInfo; + s_context = context; + } + + s_cv.notify_all(); + std::unique_lock lock(s_mutex); + s_cv.wait(lock, [] { return s_signal == 0; }); + // std::_Exit(EXIT_FAILURE); + + switch (signal) { + case SIGSEGV: + sigaction(signal, &oldActionSEGV, nullptr); + oldActionSEGV.sa_sigaction(signal, signalInfo, vcontext); + break; + case SIGBUS: + sigaction(signal, &oldActionBUS, nullptr); + oldActionBUS.sa_sigaction(signal, signalInfo, vcontext); + break; + case SIGILL: + sigaction(signal, &oldActionILL, nullptr); + oldActionILL.sa_sigaction(signal, signalInfo, vcontext); + break; + } +} + +static std::string getStacktrace() { + std::stringstream stacktrace; + + if (s_backtraceSize == 0) { + return stacktrace.str(); + } + + auto messages = backtrace_symbols(s_backtrace.data(), s_backtraceSize); + if (s_backtraceSize < FRAME_SIZE) { + messages[s_backtraceSize] = nullptr; + } + + + for (int i = 1; i < s_backtraceSize; ++i) { + auto message = std::string(messages[i]); + + // TODO: parse the message + stacktrace << message << "\n"; + + + // auto stream = std::stringstream(message); + // int index; + // std::string binary; + // uintptr_t address; + // std::string function; + // uintptr_t offset; + // std::string line; + + // stream >> index; + + // if (!lines.eof()) { + // std::getline(lines, line); + // } + // std::getline(stream, binary); + // auto cutoff = binary.find("0x"); + // stream = std::stringstream(binary.substr(cutoff)); + // binary = geode::utils::string::trim(binary.substr(0, cutoff)); + // stream >> std::hex >> address >> std::dec; + + // if (!line.empty()) { + // // log::debug("address: {}", address); + // auto image = imageFromAddress(reinterpret_cast(address)); + // // log::debug("image: {}", image); + // stacktrace << " - " << std::showbase << std::hex; + + // if (image) { + // auto baseAddress = image->imageLoadAddress; + // auto imageName = getImageName(image); + // stacktrace << imageName << " + " << (address - (uintptr_t)baseAddress); + // } + // else { + // stacktrace << address; + // } + // stacktrace << std::dec; + // stacktrace << ": " << line << "\n"; + // } + // else { + // std::getline(stream, function); + // cutoff = function.find("+"); + // stream = std::stringstream(function.substr(cutoff)); + // stream >> offset; + // function = geode::utils::string::trim(function.substr(0, cutoff)); + + // { + // int status; + // auto demangle = abi::__cxa_demangle(function.c_str(), 0, 0, &status); + // if (status == 0) { + // function = demangle; + // } + // free(demangle); + // } + + // stacktrace << "- " << binary; + // stacktrace << " @ " << std::showbase << std::hex << address << std::dec; + // stacktrace << " (" << function << " + " << offset << ")\n"; + // } + } + + free(messages); + + return stacktrace.str(); +} + +static std::string getRegisters() { + std::stringstream registers; + + auto context = s_context; + auto& ctx = context->uc_mcontext; + + // geez + registers << std::showbase << std::hex /*<< std::setfill('0') << std::setw(16) */; + registers << "r0: " << ctx.arm_r0 << "\n"; + registers << "r1: " << ctx.arm_r1 << "\n"; + registers << "r2: " << ctx.arm_r2 << "\n"; + registers << "r3: " << ctx.arm_r3 << "\n"; + registers << "r4: " << ctx.arm_r4 << "\n"; + registers << "r5: " << ctx.arm_r5 << "\n"; + registers << "r6: " << ctx.arm_r6 << "\n"; + registers << "r7: " << ctx.arm_r7 << "\n"; + registers << "r8: " << ctx.arm_r8 << "\n"; + registers << "r9: " << ctx.arm_r9 << "\n"; + registers << "r10: " << ctx.arm_r10 << "\n"; + registers << "r11: " << ctx.arm_fp << "\n"; + registers << "r12: " << ctx.arm_ip << "\n"; + registers << "sp: " << ctx.arm_sp << "\n"; + registers << "lr: " << ctx.arm_lr << "\n"; + registers << "pc: " << ctx.arm_pc << "\n"; + registers << "cpsr: " << ctx.arm_cpsr << "\n"; + + return registers.str(); +} + +static void handlerThread() { + std::unique_lock lock(s_mutex); + s_cv.wait(lock, [] { return s_signal != 0; }); + + auto signalAddress = reinterpret_cast(s_context->uc_mcontext.fault_address); + // Mod* faultyMod = nullptr; + // for (int i = 1; i < s_backtraceSize; ++i) { + // auto mod = modFromAddress(s_backtrace[i]); + // if (mod != nullptr) { + // faultyMod = mod; + // break; + // } + // } + Mod* faultyMod = modFromAddress(signalAddress); + + auto text = crashlog::writeCrashlog(faultyMod, getInfo(signalAddress, faultyMod), getStacktrace(), getRegisters()); + + log::error("Geode crashed!\n{}", text); + + s_signal = 0; + s_cv.notify_all(); + + log::debug("Notified"); +} + +static bool s_lastLaunchCrashed; + bool crashlog::setupPlatformHandler() { - return false; + struct sigaction action; + action.sa_sigaction = &signalHandler; + action.sa_flags = SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGSEGV, &action, &oldActionSEGV); + // I'd rather not track interrupt lol + // sigaction(SIGINT, &action, nullptr); + // sigaction(SIGFPE, &action, nullptr); + sigaction(SIGILL, &action, &oldActionILL); + // sigaction(SIGTERM, &action, nullptr); + // sigaction(SIGABRT, &action, nullptr); + sigaction(SIGBUS, &action, &oldActionBUS); + + std::thread(&handlerThread).detach(); + + auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed"; + if (ghc::filesystem::exists(lastCrashedFile)) { + s_lastLaunchCrashed = true; + try { + ghc::filesystem::remove(lastCrashedFile); + } + catch (...) { + } + } + return true; } bool crashlog::didLastLaunchCrash() { - return false; + return s_lastLaunchCrashed; } +ghc::filesystem::path crashlog::getCrashLogDirectory() { + return dirs::getGeodeDir() / "crashlogs"; +} + +// ghc::filesystem::path crashlog::getCrashLogDirectory() { +// return geode::dirs::getSaveDir(); +// } + +// bool crashlog::setupPlatformHandler() { +// return false; +// } + +// bool crashlog::didLastLaunchCrash() { +// return false; +// } + #endif From 35c018e66145289ced0fea6534de10701c452beb Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:02:59 +0300 Subject: [PATCH 145/270] even more broken --- loader/src/platform/android/crashlog.cpp | 143 ++++++++++++++++++++--- 1 file changed, 125 insertions(+), 18 deletions(-) diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index 6f1812e8..8c4f4f82 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -335,28 +335,135 @@ static void handlerThread() { static bool s_lastLaunchCrashed; bool crashlog::setupPlatformHandler() { - struct sigaction action; - action.sa_sigaction = &signalHandler; - action.sa_flags = SA_SIGINFO; - sigemptyset(&action.sa_mask); - sigaction(SIGSEGV, &action, &oldActionSEGV); - // I'd rather not track interrupt lol - // sigaction(SIGINT, &action, nullptr); - // sigaction(SIGFPE, &action, nullptr); - sigaction(SIGILL, &action, &oldActionILL); - // sigaction(SIGTERM, &action, nullptr); - // sigaction(SIGABRT, &action, nullptr); - sigaction(SIGBUS, &action, &oldActionBUS); + auto pidFile = crashlog::getCrashLogDirectory() / "last-pid"; - std::thread(&handlerThread).detach(); + int lastPid = 0; + + if (ghc::filesystem::exists(pidFile)) { + + auto res = file::readString(pidFile); + if (!res) { + log::warn("Failed to read last-pid file: {}", res.error()); + } + else { + lastPid = std::stoi(res.unwrap()); + } + + std::error_code ec; + ghc::filesystem::remove(pidFile, ec); + + if (ec) { + log::warn("Failed to remove last-pid file: {}", ec.message()); + } + } + + auto res = file::writeString(pidFile, std::to_string(getpid())); + if (!res) { + log::warn("Failed to write last-pid file: {}", res.error()); + } + + lastPid = 1513; + + + if (lastPid == 0) { + return true; + } + + // TODO: get logcat crash + + std::string logcatCrash = R"RAW( +F/libc (31506): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xccb00000 in tid 31584 (GLThread 215445), pid 31506 (.geode.launcher) +F/DEBUG (31618): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +F/DEBUG (31618): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' +F/DEBUG (31618): Revision: '7' +F/DEBUG (31618): ABI: 'arm' +F/DEBUG (31618): pid: 31506, tid: 31584, name: GLThread 215445 >>> com.geode.launcher <<< +F/DEBUG (31618): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xccb00000 +F/DEBUG (31618): r0 ccafffe0 r1 ccafffe4 r2 ffefb73c r3 00000000 +F/DEBUG (31618): r4 00000000 r5 c7e4af50 r6 c7e49400 r7 3c888889 +F/DEBUG (31618): r8 c2dcf000 r9 cf8a7000 r10 cd1c6800 r11 cf8a7000 +F/DEBUG (31618): ip eff2b5f0 sp cd1c6680 lr c921095d pc efe9ef2c +F/DEBUG (31618): +F/DEBUG (31618): backtrace: +F/DEBUG (31618): #00 pc 00019f2c /system/lib/libc.so (memcpy+96) +F/DEBUG (31618): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) +F/DEBUG (31618): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) +F/DEBUG (31618): #03 pc 00000617 +F/libc ( 836): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcd680000 in tid 901 (GLThread 215582), pid 836 (.geode.launcher) +F/DEBUG ( 933): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +F/DEBUG ( 933): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' +F/DEBUG ( 933): Revision: '7' +F/DEBUG ( 933): ABI: 'arm' +F/DEBUG ( 933): pid: 836, tid: 901, name: GLThread 215582 >>> com.geode.launcher <<< +F/DEBUG ( 933): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcd680000 +F/DEBUG ( 933): r0 cd67ffd0 r1 cd67fff4 r2 ffe935fc r3 00000000 +F/DEBUG ( 933): r4 00000000 r5 cc6fa350 r6 cc6f8800 r7 3c888889 +F/DEBUG ( 933): r8 c2990300 r9 ed1e0600 r10 caec3800 r11 ed1e0600 +F/DEBUG ( 933): ip eff2b5f0 sp caec3680 lr c94fe95d pc efe9ef30 +F/DEBUG ( 933): +F/DEBUG ( 933): backtrace: +F/DEBUG ( 933): #00 pc 00019f30 /system/lib/libc.so (memcpy+100) +F/DEBUG ( 933): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) +F/DEBUG ( 933): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) +F/DEBUG ( 933): #03 pc 00000617 +F/libc ( 1071): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc9c00000 in tid 1228 (GLThread 215607), pid 1071 (.geode.launcher) +F/DEBUG ( 1377): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +F/DEBUG ( 1377): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' +F/DEBUG ( 1377): Revision: '7' +F/DEBUG ( 1377): ABI: 'arm' +F/DEBUG ( 1377): pid: 1071, tid: 1228, name: GLThread 215607 >>> com.geode.launcher <<< +F/DEBUG ( 1377): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc9c00000 +F/DEBUG ( 1377): r0 c9bfffe0 r1 c9bfffe4 r2 ffb862fc r3 00000000 +F/DEBUG ( 1377): r4 00000000 r5 c1bf2b50 r6 c1bf1000 r7 3c888889 +F/DEBUG ( 1377): r8 c7d34200 r9 ed1e6e00 r10 cd0d2800 r11 ed1e6e00 +F/DEBUG ( 1377): ip eff2b5f0 sp cd0d2680 lr c900c95d pc efe9ef2c +F/DEBUG ( 1377): +F/DEBUG ( 1377): backtrace: +F/DEBUG ( 1377): #00 pc 00019f2c /system/lib/libc.so (memcpy+96) +F/DEBUG ( 1377): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) +F/DEBUG ( 1377): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) +F/DEBUG ( 1377): #03 pc 00000617 +F/libc ( 1513): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc8500000 in tid 1658 (GLThread 215649), pid 1513 (.geode.launcher) +F/DEBUG ( 1752): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +F/DEBUG ( 1752): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' +F/DEBUG ( 1752): Revision: '7' +F/DEBUG ( 1752): ABI: 'arm' +F/DEBUG ( 1752): pid: 1513, tid: 1658, name: GLThread 215649 >>> com.geode.launcher <<< +F/DEBUG ( 1752): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc8500000 +F/DEBUG ( 1752): r0 c84fffc0 r1 c84fffe4 r2 ffb13634 r3 00000008 +F/DEBUG ( 1752): r4 00000000 r5 c83e0750 r6 c83dec00 r7 3c888889 +F/DEBUG ( 1752): r8 e41cad00 r9 ed9fbc00 r10 cd38f800 r11 ed9fbc00 +F/DEBUG ( 1752): ip 00000000 sp cd38f680 lr c951195d pc efe9ef30 +F/DEBUG ( 1752): +F/DEBUG ( 1752): backtrace: +F/DEBUG ( 1752): #00 pc 00019f30 /system/lib/libc.so (memcpy+100) +F/DEBUG ( 1752): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) +F/DEBUG ( 1752): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) +F/DEBUG ( 1752): #03 pc 00000617 + )RAW"; + + std::string crashTrace; + auto findLast = logcatCrash.find_last_of(fmt::format("pid {} (.geode.launcher)", lastPid)); + if (findLast != std::string::npos) { + auto begin = logcatCrash.substr(0, findLast).find_last_of("F/libc"); + if (begin != std::string::npos) { + crashTrace = logcatCrash.substr(begin); + } + } + else { + return true; + } + + auto text = crashlog::writeCrashlog(nullptr, "", crashTrace, ""); + s_lastLaunchCrashed = true; auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed"; if (ghc::filesystem::exists(lastCrashedFile)) { - s_lastLaunchCrashed = true; - try { - ghc::filesystem::remove(lastCrashedFile); - } - catch (...) { + std::error_code ec; + ghc::filesystem::remove(lastCrashedFile, ec); + + if (ec) { + log::warn("Failed to remove last-crashed file: {}", ec.message()); } } return true; From c450962ede6b5024662d7855b5757589aabb7df6 Mon Sep 17 00:00:00 2001 From: ninXout <58670749+ninXout@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:21:04 -0400 Subject: [PATCH 146/270] Add 2 DrawGridLayer functions, fix FMODAudioEngine on mac --- bindings/GeometryDash.bro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 54dc755f..d60c3688 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1141,9 +1141,9 @@ class DrawGridLayer : cocos2d::CCLayer { return editorLayer->m_drawGridLayer; } - bool init(cocos2d::CCNode* grid, LevelEditorLayer* editor) = win 0x16c4d0; + bool init(cocos2d::CCNode* grid, LevelEditorLayer* editor) = win 0x16c4d0, mac 0x2729a0; virtual void draw() = win 0x16ce90, mac 0xa3c40; - virtual void update(float) = win 0x16cd80; + virtual void update(float) = win 0x16cd80, mac 0xa3b30; void clearPlayerPoints() { m_playerNodePoints->removeAllObjects(); m_player2NodePoints->removeAllObjects(); @@ -1736,7 +1736,7 @@ class FMODAudioEngine : cocos2d::CCNode { virtual void update(float) = win 0x23b20; cocos2d::CCDictionary* m_dictionary; - std::string m_filePath; + gd::string m_filePath; float m_backgroundMusicVolume; float m_effectsVolume; float m_pulse1; @@ -3847,7 +3847,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { virtual void calculateColorValues(EffectGameObject*, EffectGameObject*, int, float, ColorActionSprite*, GJEffectManager*) = mac 0x9c590, win 0x166f90; virtual void addToGroup(GameObject*, int, bool) = mac 0x9dab0, win 0x167310; virtual void removeFromGroup(GameObject*, int) = mac 0x9db60, win 0x1673a0; - virtual void timeForXPos(float) = mac 0x9c7d0, win 0x167210; + virtual float timeForXPos(float) = mac 0x9c7d0, win 0x167210; virtual void xPosForTime(float) = mac 0x9c800, win 0x167250; virtual void levelSettingsUpdated() = mac 0x93f30, win 0x1606c0; static LevelEditorLayer* create(GJGameLevel* level) = mac 0x90fb0, win 0x15ed60, ios 0x261628; From a6c04dd7155c5c2d5eebdbbf7863c8b5de98deba Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Fri, 6 Oct 2023 00:38:10 +0300 Subject: [PATCH 147/270] add SetupRotatePopup stuff --- bindings/GeometryDash.bro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d60c3688..4d282ddf 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5414,6 +5414,11 @@ class SetupPulsePopup : FLAlertLayer, cocos2d::extension::ColorPickerDelegate, T int m_pulseMode; // 0x38c on mac } +class SetupRotatePopup : FLAlertLayer { + void onClose(cocos2d::CCObject*) = win 0x244150; + virtual void keyBackClicked() = win 0x2441a0; +} + class SetupShakePopup : FLAlertLayer { static SetupShakePopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x3adc00; } From 7c9da85f9d74e569ccf3cd76c20230258ed5d7d7 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 7 Oct 2023 16:40:38 +0300 Subject: [PATCH 148/270] add CCCallFuncND::create on mac --- bindings/Cocos2d.bro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 9694c00b..900aae67 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -87,6 +87,11 @@ class cocos2d::CCCallFuncO { static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFuncO, cocos2d::CCObject*) = mac 0x455940; } +[[link(win)]] +class cocos2d::CCCallFuncND { + static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFuncND, void*) = mac 0x455470; +} + [[link(win)]] class cocos2d::CCClippingNode { CCClippingNode() { From a01b29dcdf06f50b22ced4a167bdca4bd7134d43 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 7 Oct 2023 17:33:38 +0300 Subject: [PATCH 149/270] add EditorUI::deactivateScaleControl --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 4d282ddf..af43a9d3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1410,6 +1410,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void onSettings(cocos2d::CCObject* sender) = win 0x77fe0; void activateRotationControl(cocos2d::CCObject* sender) = win 0x8fe70, mac 0x24480; void activateScaleControl(cocos2d::CCObject* sender) = mac 0x24c80, win 0x889b0; + void deactivateScaleControl() = win 0x88bf0, mac 0xb290; void dynamicGroupUpdate(bool idk) = win 0x8ad10; void createRockOutline() = win 0x89c10; void createRockEdges() = win 0x88ec0; From 64f6870f823063edc3a8b356676a4bb191c3efc3 Mon Sep 17 00:00:00 2001 From: Ashton <38200084+Alphatism@users.noreply.github.com> Date: Sun, 8 Oct 2023 01:52:55 -0400 Subject: [PATCH 150/270] Add some more bindings --- bindings/GeometryDash.bro | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index af43a9d3..d9a6a7e9 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2438,10 +2438,14 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, void onDartIcon(cocos2d::CCObject* sender) = win 0x128420; void onRobotIcon(cocos2d::CCObject* sender) = win 0x1286d0; void onSpiderIcon(cocos2d::CCObject* sender) = win 0x128890; + void onPlayerDeathEffect(cocos2d::CCObject* sender) = win 0x128a50; + void onPlayerTrail(cocos2d::CCObject* sender) = win 0x128af0; void onShards(cocos2d::CCObject* sender) = win 0x12ad70; void onBack(cocos2d::CCObject* sender) = win 0x12adf0; void onShop(cocos2d::CCObject* sender) = win 0x12ad90; void setupColorSelect() = mac 0x1b7500; + void showCircleWave() = win 0x12aad0; + void showBlackCircleWave() = win 0x12a9d0; PAD = mac 0x10, win 0x8; CCTextInputNode* m_nameInput; SimplePlayer* m_playerPreview; @@ -2553,6 +2557,7 @@ class GJRobotSprite : CCAnimatedSprite { virtual void hideSecondary() = mac 0x34c3b0, win 0x146c90; static GJRobotSprite* create() = mac 0x34ac00, win 0x1457a0; void updateColor02(cocos2d::_ccColor3B) = mac 0x34bbd0, win 0x1461c0; + void updateGlowColor(cocos2d::_ccColor3B, bool) = win 0x1460C0; void updateFrame(int) = mac 0x34bdd0, win 0x146700; void hideGlow() = mac 0x34b860; @@ -4040,8 +4045,13 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void setupLevelInfo() = mac 0x161C80, win 0x178680; void downloadLevel() = win 0x177d90, mac 0x161b90; void onPlay(cocos2d::CCObject* sender) = mac 0x161840, win 0x179730; + void onBack(cocos2d::CCObject* sender) = mac 0x163810, win 0x17C110; + void onDelete(cocos2d::CCObject* sender) = mac 0x162f30, win 0x17A2B0; + virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; + virtual void keyBackClicked() = win 0x17C1D0; + void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300; void updateLabelValues() = mac 0x164090, win 0x17b170; @@ -4227,6 +4237,7 @@ class LikeItemLayer : FLAlertLayer { class ListButtonBar : cocos2d::CCNode { BoomScrollLayer* m_scrollLayer; + void switchedPage(int page) = win 0x29c50; } class ListButtonBarDelegate {} @@ -5049,7 +5060,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { PAD = mac 0x14, win 0x14; bool m_unk4D4; cocos2d::CCArray* m_particleSystems; - bool m_unk4DC; + bool m_hasGlow; bool m_isHidden; int m_hasGhostTrail; GhostTrailEffect* m_ghostTrail; From f57601d0b5c955d9182c6c3077d62c52f1979a6d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:38:17 +0300 Subject: [PATCH 151/270] file picker --- CMakeLists.txt | 2 +- cmake/GeodeFile.cmake | 3 + loader/include/Geode/utils/file.hpp | 15 ++ loader/src/platform/android/crashlog.cpp | 201 ++++++------------ loader/src/platform/android/util.cpp | 115 +++++++++- .../ui/internal/settings/GeodeSettingNode.cpp | 11 +- 6 files changed, 203 insertions(+), 144 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfcd33fa..1244fb93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,8 +71,8 @@ set(GEODE_BIN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(GEODE_LOADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/loader) set(GEODE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -include(cmake/GeodeFile.cmake) include(cmake/Platform.cmake) +include(cmake/GeodeFile.cmake) include(cmake/CPM.cmake) if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 8f1a8ddd..4c3fe779 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -188,6 +188,9 @@ function(setup_geode_mod proname) elseif (APPLE) file(GLOB libs ${dir}/*.dylib) list(APPEND libs_to_link ${libs}) + elseif (ANDROID) + file(GLOB libs ${dir}/*.so) + list(APPEND libs_to_link ${libs}) else() message(FATAL_ERROR "Library extension not defined on this platform") endif() diff --git a/loader/include/Geode/utils/file.hpp b/loader/include/Geode/utils/file.hpp index 9e932c57..495d2d50 100644 --- a/loader/include/Geode/utils/file.hpp +++ b/loader/include/Geode/utils/file.hpp @@ -244,16 +244,31 @@ namespace geode::utils::file { /** * Prompt the user to pick a file using the system's file system picker + * @note Will not work on Android, use the callback version instead * @param mode Type of file selection prompt to show * @param options Picker options */ GEODE_DLL Result pickFile(PickMode mode, FilePickOptions const& options); + + GEODE_DLL void pickFile( + PickMode mode, FilePickOptions const& options, + utils::MiniFunction callback, + utils::MiniFunction failed = {} + ); + /** * Prompt the user to pick a bunch of files for opening using the system's file system picker + * @note Will not work on Android, use the callback version instead * @param options Picker options */ GEODE_DLL Result> pickFiles(FilePickOptions const& options); + GEODE_DLL void pickFiles( + FilePickOptions const& options, + utils::MiniFunction)> callback, + utils::MiniFunction failed = {} + ); + class GEODE_DLL FileWatchEvent : public Event { protected: ghc::filesystem::path m_path; diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index 8c4f4f82..e1ed7bd9 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -334,159 +334,90 @@ static void handlerThread() { static bool s_lastLaunchCrashed; -bool crashlog::setupPlatformHandler() { - auto pidFile = crashlog::getCrashLogDirectory() / "last-pid"; +// bool crashlog::setupPlatformHandler() { +// auto pidFile = crashlog::getCrashLogDirectory() / "last-pid"; - int lastPid = 0; +// int lastPid = 0; - if (ghc::filesystem::exists(pidFile)) { +// if (ghc::filesystem::exists(pidFile)) { - auto res = file::readString(pidFile); - if (!res) { - log::warn("Failed to read last-pid file: {}", res.error()); - } - else { - lastPid = std::stoi(res.unwrap()); - } +// auto res = file::readString(pidFile); +// if (!res) { +// log::warn("Failed to read last-pid file: {}", res.error()); +// } +// else { +// lastPid = std::stoi(res.unwrap()); +// } - std::error_code ec; - ghc::filesystem::remove(pidFile, ec); +// std::error_code ec; +// ghc::filesystem::remove(pidFile, ec); - if (ec) { - log::warn("Failed to remove last-pid file: {}", ec.message()); - } - } +// if (ec) { +// log::warn("Failed to remove last-pid file: {}", ec.message()); +// } +// } - auto res = file::writeString(pidFile, std::to_string(getpid())); - if (!res) { - log::warn("Failed to write last-pid file: {}", res.error()); - } +// auto res = file::writeString(pidFile, std::to_string(getpid())); +// if (!res) { +// log::warn("Failed to write last-pid file: {}", res.error()); +// } - lastPid = 1513; +// lastPid = 1513; - if (lastPid == 0) { - return true; - } +// if (lastPid == 0) { +// return true; +// } - // TODO: get logcat crash +// // TODO: get logcat crash - std::string logcatCrash = R"RAW( -F/libc (31506): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xccb00000 in tid 31584 (GLThread 215445), pid 31506 (.geode.launcher) -F/DEBUG (31618): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -F/DEBUG (31618): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' -F/DEBUG (31618): Revision: '7' -F/DEBUG (31618): ABI: 'arm' -F/DEBUG (31618): pid: 31506, tid: 31584, name: GLThread 215445 >>> com.geode.launcher <<< -F/DEBUG (31618): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xccb00000 -F/DEBUG (31618): r0 ccafffe0 r1 ccafffe4 r2 ffefb73c r3 00000000 -F/DEBUG (31618): r4 00000000 r5 c7e4af50 r6 c7e49400 r7 3c888889 -F/DEBUG (31618): r8 c2dcf000 r9 cf8a7000 r10 cd1c6800 r11 cf8a7000 -F/DEBUG (31618): ip eff2b5f0 sp cd1c6680 lr c921095d pc efe9ef2c -F/DEBUG (31618): -F/DEBUG (31618): backtrace: -F/DEBUG (31618): #00 pc 00019f2c /system/lib/libc.so (memcpy+96) -F/DEBUG (31618): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) -F/DEBUG (31618): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) -F/DEBUG (31618): #03 pc 00000617 -F/libc ( 836): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcd680000 in tid 901 (GLThread 215582), pid 836 (.geode.launcher) -F/DEBUG ( 933): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -F/DEBUG ( 933): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' -F/DEBUG ( 933): Revision: '7' -F/DEBUG ( 933): ABI: 'arm' -F/DEBUG ( 933): pid: 836, tid: 901, name: GLThread 215582 >>> com.geode.launcher <<< -F/DEBUG ( 933): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcd680000 -F/DEBUG ( 933): r0 cd67ffd0 r1 cd67fff4 r2 ffe935fc r3 00000000 -F/DEBUG ( 933): r4 00000000 r5 cc6fa350 r6 cc6f8800 r7 3c888889 -F/DEBUG ( 933): r8 c2990300 r9 ed1e0600 r10 caec3800 r11 ed1e0600 -F/DEBUG ( 933): ip eff2b5f0 sp caec3680 lr c94fe95d pc efe9ef30 -F/DEBUG ( 933): -F/DEBUG ( 933): backtrace: -F/DEBUG ( 933): #00 pc 00019f30 /system/lib/libc.so (memcpy+100) -F/DEBUG ( 933): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) -F/DEBUG ( 933): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) -F/DEBUG ( 933): #03 pc 00000617 -F/libc ( 1071): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc9c00000 in tid 1228 (GLThread 215607), pid 1071 (.geode.launcher) -F/DEBUG ( 1377): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -F/DEBUG ( 1377): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' -F/DEBUG ( 1377): Revision: '7' -F/DEBUG ( 1377): ABI: 'arm' -F/DEBUG ( 1377): pid: 1071, tid: 1228, name: GLThread 215607 >>> com.geode.launcher <<< -F/DEBUG ( 1377): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc9c00000 -F/DEBUG ( 1377): r0 c9bfffe0 r1 c9bfffe4 r2 ffb862fc r3 00000000 -F/DEBUG ( 1377): r4 00000000 r5 c1bf2b50 r6 c1bf1000 r7 3c888889 -F/DEBUG ( 1377): r8 c7d34200 r9 ed1e6e00 r10 cd0d2800 r11 ed1e6e00 -F/DEBUG ( 1377): ip eff2b5f0 sp cd0d2680 lr c900c95d pc efe9ef2c -F/DEBUG ( 1377): -F/DEBUG ( 1377): backtrace: -F/DEBUG ( 1377): #00 pc 00019f2c /system/lib/libc.so (memcpy+96) -F/DEBUG ( 1377): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) -F/DEBUG ( 1377): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) -F/DEBUG ( 1377): #03 pc 00000617 -F/libc ( 1513): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc8500000 in tid 1658 (GLThread 215649), pid 1513 (.geode.launcher) -F/DEBUG ( 1752): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -F/DEBUG ( 1752): Build fingerprint: 'samsung/j7y17ltexx/j7y17lte:9/PPR1.180610.011/J730FXWU8CUG1:user/release-keys' -F/DEBUG ( 1752): Revision: '7' -F/DEBUG ( 1752): ABI: 'arm' -F/DEBUG ( 1752): pid: 1513, tid: 1658, name: GLThread 215649 >>> com.geode.launcher <<< -F/DEBUG ( 1752): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc8500000 -F/DEBUG ( 1752): r0 c84fffc0 r1 c84fffe4 r2 ffb13634 r3 00000008 -F/DEBUG ( 1752): r4 00000000 r5 c83e0750 r6 c83dec00 r7 3c888889 -F/DEBUG ( 1752): r8 e41cad00 r9 ed9fbc00 r10 cd38f800 r11 ed9fbc00 -F/DEBUG ( 1752): ip 00000000 sp cd38f680 lr c951195d pc efe9ef30 -F/DEBUG ( 1752): -F/DEBUG ( 1752): backtrace: -F/DEBUG ( 1752): #00 pc 00019f30 /system/lib/libc.so (memcpy+100) -F/DEBUG ( 1752): #01 pc 00336959 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x336000) (GJEffectManager::updateSpawnTriggers(float)+64) -F/DEBUG ( 1752): #02 pc 0021b279 /data/app/com.robtopx.geometryjump-xzzAmj1_bAwPLWKGJk5srA==/lib/arm/libcocos2dcpp.so (offset 0x219000) (PlayLayer::update(float)+480) -F/DEBUG ( 1752): #03 pc 00000617 - )RAW"; +// std::string logcatCrash = R"RAW()RAW"; - std::string crashTrace; - auto findLast = logcatCrash.find_last_of(fmt::format("pid {} (.geode.launcher)", lastPid)); - if (findLast != std::string::npos) { - auto begin = logcatCrash.substr(0, findLast).find_last_of("F/libc"); - if (begin != std::string::npos) { - crashTrace = logcatCrash.substr(begin); - } - } - else { - return true; - } +// std::string crashTrace; +// auto findLast = logcatCrash.find_last_of(fmt::format("pid {} (.geode.launcher)", lastPid)); +// if (findLast != std::string::npos) { +// auto begin = logcatCrash.substr(0, findLast).find_last_of("F/libc"); +// if (begin != std::string::npos) { +// crashTrace = logcatCrash.substr(begin); +// } +// } +// else { +// return true; +// } - auto text = crashlog::writeCrashlog(nullptr, "", crashTrace, ""); - s_lastLaunchCrashed = true; +// auto text = crashlog::writeCrashlog(nullptr, "", crashTrace, ""); +// s_lastLaunchCrashed = true; - auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed"; - if (ghc::filesystem::exists(lastCrashedFile)) { - std::error_code ec; - ghc::filesystem::remove(lastCrashedFile, ec); +// auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed"; +// if (ghc::filesystem::exists(lastCrashedFile)) { +// std::error_code ec; +// ghc::filesystem::remove(lastCrashedFile, ec); - if (ec) { - log::warn("Failed to remove last-crashed file: {}", ec.message()); - } - } - return true; -} - -bool crashlog::didLastLaunchCrash() { - return s_lastLaunchCrashed; -} - -ghc::filesystem::path crashlog::getCrashLogDirectory() { - return dirs::getGeodeDir() / "crashlogs"; -} - -// ghc::filesystem::path crashlog::getCrashLogDirectory() { -// return geode::dirs::getSaveDir(); -// } - -// bool crashlog::setupPlatformHandler() { -// return false; +// if (ec) { +// log::warn("Failed to remove last-crashed file: {}", ec.message()); +// } +// } +// return true; // } // bool crashlog::didLastLaunchCrash() { -// return false; +// return s_lastLaunchCrashed; // } +// ghc::filesystem::path crashlog::getCrashLogDirectory() { +// return dirs::getGeodeDir() / "crashlogs"; +// } + +ghc::filesystem::path crashlog::getCrashLogDirectory() { + return geode::dirs::getSaveDir(); +} + +bool crashlog::setupPlatformHandler() { + return false; +} + +bool crashlog::didLastLaunchCrash() { + return false; +} + #endif diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index dacc4a84..05175cf2 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -85,9 +85,118 @@ bool utils::file::openFolder(ghc::filesystem::path const& path) { return false; } -geode::Result utils::file:: - pickFile(geode::utils::file::PickMode, geode::utils::file::FilePickOptions const&) { - return geode::Err("This function is currently unimplemented"); + +static utils::MiniFunction s_fileCallback; +static utils::MiniFunction)> s_filesCallback; +static utils::MiniFunction s_failedCallback; + +extern "C" +JNIEXPORT void JNICALL Java_com_geode_launcher_utils_GeodeUtils_selectFileCallback( + JNIEnv *env, + jobject, + jstring data +) { + auto isCopy = jboolean(); + auto dataStr = env->GetStringUTFChars(data, &isCopy); + + log::debug("Selected file: {}", dataStr); + + s_fileCallback(dataStr); +} + +extern "C" +JNIEXPORT void JNICALL Java_com_geode_launcher_utils_GeodeUtils_selectFilesCallback( + JNIEnv *env, + jobject, + jobjectArray datas +) { + auto isCopy = jboolean(); + auto count = env->GetArrayLength(datas); + auto result = std::vector(); + for (int i = 0; i < count; i++) { + auto data = (jstring)env->GetObjectArrayElement(datas, i); + auto dataStr = env->GetStringUTFChars(data, &isCopy); + result.push_back(dataStr); + + log::debug("Selected file {}: {}", i, dataStr); + } + + s_filesCallback(result); +} + +extern "C" +JNIEXPORT void JNICALL Java_com_geode_launcher_utils_GeodeUtils_failedCallback( + JNIEnv *env, + jobject +) { + if (s_failedCallback) s_failedCallback(); +} + +Result file::pickFile(file::PickMode mode, file::FilePickOptions const& options) { + return Err("Use the callback version"); +} + +void file::pickFile( + PickMode mode, FilePickOptions const& options, + utils::MiniFunction callback, + utils::MiniFunction failed +) { + s_fileCallback = callback; + s_failedCallback = failed; + + std::string method; + switch (mode) { + case file::PickMode::OpenFile: + method = "selectFile"; + break; + case file::PickMode::SaveFile: + method = "createFile"; + break; + case file::PickMode::OpenFolder: + method = "selectFolder"; + break; + } + + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", method.c_str(), "(Ljava/lang/String;)Z")) { + jstring stringArg1 = t.env->NewStringUTF(options.defaultPath.value_or(ghc::filesystem::path()).string().c_str()); + + jboolean result = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg1); + + t.env->DeleteLocalRef(stringArg1); + t.env->DeleteLocalRef(t.classID); + if (result) { + return; + } + } + if (s_failedCallback) s_failedCallback(); +} + +Result> file::pickFiles(file::FilePickOptions const& options) { + return Err("Use the callback version"); +} + +void file::pickFiles( + FilePickOptions const& options, + utils::MiniFunction)> callback, + utils::MiniFunction failed +) { + s_filesCallback = callback; + s_failedCallback = failed; + + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "selectFiles", "(Ljava/lang/String;)Z")) { + jstring stringArg1 = t.env->NewStringUTF(options.defaultPath.value_or(ghc::filesystem::path()).string().c_str()); + + jboolean result = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg1); + + t.env->DeleteLocalRef(stringArg1); + t.env->DeleteLocalRef(t.classID); + if (result) { + return; + } + } + if (s_failedCallback) s_failedCallback(); } void geode::utils::game::launchLoaderUninstaller(bool deleteSaveData) { diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 28a37e1e..f9e7da30 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -355,16 +355,17 @@ void FileSettingNode::valueChanged(bool updateText) { } void FileSettingNode::onPickFile(CCObject*) { - if (auto path = file::pickFile( + file::pickFile( file::PickMode::OpenFile, { dirs::getGameDir(), setting()->castDefinition().controls.filters + }, + [&](auto path) { + m_uncommittedValue = path; + this->valueChanged(true); } - )) { - m_uncommittedValue = path.unwrap(); - this->valueChanged(true); - } + ); } bool FileSettingNode::setup(FileSettingValue* setting, float width) { From df459dec3cf16dad069507162b455f492c4162e5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:11:32 +0300 Subject: [PATCH 152/270] new pick files to other platforms --- loader/src/platform/android/util.cpp | 8 +++---- loader/src/platform/mac/util.mm | 32 ++++++++++++++++++++++++++-- loader/src/platform/windows/util.cpp | 28 ++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/loader/src/platform/android/util.cpp b/loader/src/platform/android/util.cpp index 05175cf2..29f2c547 100644 --- a/loader/src/platform/android/util.cpp +++ b/loader/src/platform/android/util.cpp @@ -138,8 +138,8 @@ Result file::pickFile(file::PickMode mode, file::FilePick void file::pickFile( PickMode mode, FilePickOptions const& options, - utils::MiniFunction callback, - utils::MiniFunction failed + MiniFunction callback, + MiniFunction failed ) { s_fileCallback = callback; s_failedCallback = failed; @@ -178,8 +178,8 @@ Result> file::pickFiles(file::FilePickOptions void file::pickFiles( FilePickOptions const& options, - utils::MiniFunction)> callback, - utils::MiniFunction failed + MiniFunction)> callback, + MiniFunction failed ) { s_filesCallback = callback; s_failedCallback = failed; diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index e0971265..9c1ec590 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -145,7 +145,7 @@ void utils::web::openLinkInBrowser(std::string const& url) { } @end -Result utils::file::pickFile( +Result file::pickFile( file::PickMode mode, file::FilePickOptions const& options ) { auto result = [FileDialog filePickerWithMode:mode options:options multiple: false]; @@ -157,13 +157,41 @@ Result utils::file::pickFile( } } -Result> utils::file::pickFiles( +GEODE_DLL void file::pickFile( + PickMode mode, FilePickOptions const& options, + MiniFunction callback, + MiniFunction failed +) { + auto result = file::pickFile(mode, options); + + if (result.isOk()) { + callback(std::move(result.unwrap())); + } else { + failed(); + } +} + +Result> file::pickFiles( file::FilePickOptions const& options ) { //return Err("utils::file::pickFiles is not implemented"); return [FileDialog filePickerWithMode: file::PickMode::OpenFile options:options multiple:true]; } +GEODE_DLL void file::pickFiles( + FilePickOptions const& options, + MiniFunction callback, + MiniFunction failed +) { + auto result = file::pickFiles(options); + + if (result.isOk()) { + callback(std::move(result.unwrap())); + } else { + failed(); + } +} + CCPoint cocos::getMousePos() { auto windowFrame = NSApp.mainWindow.frame; auto viewFrame = NSApp.mainWindow.contentView.frame; diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index 68e7ad52..c779bef5 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -97,6 +97,20 @@ Result utils::file::pickFile( return Ok(path); } +GEODE_DLL void file::pickFile( + PickMode mode, FilePickOptions const& options, + MiniFunction callback, + MiniFunction failed +) { + auto result = file::pickFile(mode, options); + + if (result.isOk()) { + callback(std::move(result.unwrap())); + } else { + failed(); + } +} + Result> utils::file::pickFiles( file::FilePickOptions const& options ) { @@ -105,6 +119,20 @@ Result> utils::file::pickFiles( return Ok(paths); } +GEODE_DLL void file::pickFiles( + FilePickOptions const& options, + MiniFunction callback, + MiniFunction failed +) { + auto result = file::pickFiles(options); + + if (result.isOk()) { + callback(std::move(result.unwrap())); + } else { + failed(); + } +} + void utils::web::openLinkInBrowser(std::string const& url) { ShellExecuteA(0, 0, url.c_str(), 0, 0, SW_SHOW); } From d4a760d6edc7f33a0f4b2efa3b4a5812cc452735 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 8 Oct 2023 20:40:59 +0300 Subject: [PATCH 153/270] LevelSelectLayer::init --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d9a6a7e9..fc72ee99 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4112,6 +4112,7 @@ class LevelSearchLayer : cocos2d::CCLayer { class LevelSelectLayer : cocos2d::CCLayer { static LevelSelectLayer* create(int lvl) = win 0x185500; + bool init(int lvl) = win 0x1855a0, mac 0x2384e0; PAD = win 0x10; BoomScrollLayer* m_scrollLayer; From cc812160f4b954335a5be0a170e354baf12dc91f Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:01:47 -0300 Subject: [PATCH 154/270] add the cursed hasBeenActivatedByPlayer --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index fc72ee99..671feb06 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3309,7 +3309,7 @@ class GameObject : CCSpritePlus { void groupWasDisabled() = mac 0x33b110; void groupWasEnabled() = mac 0x33b0f0; void hasBeenActivated() = mac 0x342a80; - void hasBeenActivatedByPlayer(GameObject*) = mac 0x342a50; + bool hasBeenActivatedByPlayer(GameObject*) = mac 0x342a50, win 0xEF110; void hasSecondaryColor() = mac 0x342f80; void ignoreEnter() = mac 0x3352a0; void ignoreFade() = mac 0x335290; From 0a113744821b2a79d30b54e4b137bd36a0cbd752 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:02:22 -0300 Subject: [PATCH 155/270] fix GEODE_CLI force caching when not found --- cmake/GeodeFile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index f44b7d26..8348624d 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -1,7 +1,7 @@ set(GEODE_CLI_MINIMUM_VERSION 1.0.5) # Find Geode CLI -if (NOT DEFINED GEODE_CLI) +if (NOT DEFINED GEODE_CLI OR GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND") find_program(GEODE_CLI NAMES geode.exe geode-cli.exe geode geode-cli PATHS ${CLI_PATH}) endif() From 2f031487a398b0ad18de0ebf95d0eadc3ac5500c Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:07:24 -0300 Subject: [PATCH 156/270] fix outdated link --- cmake/GeodeFile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 8348624d..1c67a290 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -59,7 +59,7 @@ function(setup_geode_mod proname) if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND") message(FATAL_ERROR "setup_geode_mod called, but Geode CLI was not found - " - "Please install CLI: https://docs.geode-sdk.org/info/installcli/" + "Please install CLI: https://docs.geode-sdk.org/" ) return() endif() From 1eb72efa9a9ca523ca15e22c27cb7182787fda05 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:32:21 +0200 Subject: [PATCH 157/270] fix return types of timeForXPos and timeForXPos2 --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 671feb06..21ad2ed4 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4681,8 +4681,8 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void switchToRobotMode(PlayerObject*, GameObject*, bool) = mac 0x7bc80; void switchToRollMode(PlayerObject*, GameObject*, bool) = mac 0x7bbe0; void switchToSpiderMode(PlayerObject*, GameObject*, bool) = mac 0x7bd20; - void timeForXPos(float) = mac 0x7d120, win 0x2087d0; - void timeForXPos2(float, bool) = mac 0x293eb0, win 0x1fd3d0; + float timeForXPos(float) = mac 0x7d120, win 0x2087d0; + float timeForXPos2(float, bool) = mac 0x293eb0, win 0x1fd3d0; void toggleBGEffectVisibility(bool) = mac 0x7fe80; void toggleDualMode(GameObject*, bool, PlayerObject*, bool) = mac 0x7bf90, win 0x208880; void toggleFlipped(bool, bool) = mac 0x7bdc0, win 0x20ab20; From 572386c291133fb6faa16cc6badd38d95dd56ffb Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Sat, 7 Oct 2023 20:49:16 +0200 Subject: [PATCH 158/270] add callback to PlayLayer::timeForXPos fixes a crash when trying to use the function --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 21ad2ed4..a7eabf57 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4681,7 +4681,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void switchToRobotMode(PlayerObject*, GameObject*, bool) = mac 0x7bc80; void switchToRollMode(PlayerObject*, GameObject*, bool) = mac 0x7bbe0; void switchToSpiderMode(PlayerObject*, GameObject*, bool) = mac 0x7bd20; - float timeForXPos(float) = mac 0x7d120, win 0x2087d0; + callback float timeForXPos(float) = mac 0x7d120, win 0x2087d0; float timeForXPos2(float, bool) = mac 0x293eb0, win 0x1fd3d0; void toggleBGEffectVisibility(bool) = mac 0x7fe80; void toggleDualMode(GameObject*, bool, PlayerObject*, bool) = mac 0x7bf90, win 0x208880; From a08c8e6b6f2842d9eaad9dc2d840f252f9be9147 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Sat, 7 Oct 2023 16:00:03 +0200 Subject: [PATCH 159/270] add android paddings to PlayerObject same as windows except for the first pad --- bindings/GeometryDash.bro | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6ab08b3c..04a6ea0c 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5236,18 +5236,18 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { void yStartDown() = mac 0x22e9b0; void yStartUp() = mac 0x22e990; - PAD = mac 0x14, win 0x14; + PAD = mac 0x14, win 0x14, android 0x10; bool m_unk480; cocos2d::CCNode* m_unk484; cocos2d::CCDictionary* m_collisionLog; cocos2d::CCDictionary* m_collisionLog1; GameObject* m_collidedSlope; - PAD = mac 0x30, win 0x1c; + PAD = mac 0x30, win 0x1c, android 0x1c; bool m_unk4B0; cocos2d::CCSprite* m_unk4B4; int m_collidedGroundObjectUniqueID; int m_collidedCeilObjectUniqueID; - PAD = mac 0x14, win 0x14; + PAD = mac 0x14, win 0x14, android 0x14; bool m_unk4D4; cocos2d::CCArray* m_particleSystems; bool m_unk4DC; @@ -5279,13 +5279,13 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { bool m_unk53E; bool m_unk53F; bool m_isCheckpointQueued; - PAD = mac 0xf, win 0xf; + PAD = mac 0xf, win 0xf, android 0xf; double m_lastJumpTime; double m_unk558; double m_unk560; - PAD = mac 0x1c, win 0x1c; + PAD = mac 0x1c, win 0x1c, android 0x1c; float m_decelerationRate; - PAD = mac 0x13, win 0x13; + PAD = mac 0x13, win 0x13, android 0x13; bool m_hasHitRing; GameObject* m_objectSnappedTo; CheckpointObject* m_checkpoint; @@ -5303,14 +5303,14 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { void* m_unk5D0; cocos2d::CCParticleSystemQuad* m_unk5D4; cocos2d::CCParticleSystemQuad* m_unk5D8; - PAD = mac 0x20, win 0x20; + PAD = mac 0x20, win 0x20, android 0x20; // int m_streakID; // float m_wellIdk; // PAD = win 0x10; bool m_unk5FC; bool m_unk5FD; bool m_hasHitPortal; - PAD = mac 0xb, win 0xb; + PAD = mac 0xb, win 0xb, android 0xb; bool m_unknown73d; cocos2d::_ccColor3B m_unknown73e; cocos2d::_ccColor3B m_unknown741; @@ -5357,13 +5357,13 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { bool m_unk684; bool m_unk685; double m_unk688; - PAD = win 0x4; + PAD = win 0x4, android 0x4; float m_meteringValue; float m_groundHeight; float m_unk69C; - PAD = win 0x4; + PAD = win 0x4, android 0x4; std::array m_unk6A4; - PAD = win 0x1c; + PAD = win 0x1c, android 0x1c; } [[link(android)]] From 960fa056af945fb230fab9134b8412206ffa5c99 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Tue, 10 Oct 2023 08:46:48 +0300 Subject: [PATCH 160/270] Bring back the checkbox --- .github/ISSUE_TEMPLATE/crash-report.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index f4c372a4..9e882af8 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -2,17 +2,16 @@ name: Crash Report description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others). labels: [ "unverified", "crash" ] body: - - type: input - id: geode-confirmation + - type: checkboxes attributes: label: Geode Issue description: | The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. - When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field above. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. Failing to do this will get your issue *closed without explanation*. - placeholder: "Please, read the text below." - validations: - required: true + options: + - label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself. + required: true - type: dropdown id: platform attributes: From 42a1a33c532a4c86546ee0b0eb55dcfd3b9f0382 Mon Sep 17 00:00:00 2001 From: SMJSGaming Date: Tue, 10 Oct 2023 19:19:12 +0200 Subject: [PATCH 161/270] Added word wrappers, colors and optimizations to text area --- loader/include/Geode/ui/TextArea.hpp | 33 ++++-- loader/src/ui/nodes/TextArea.cpp | 168 +++++++++++++++++++-------- 2 files changed, 146 insertions(+), 55 deletions(-) diff --git a/loader/include/Geode/ui/TextArea.hpp b/loader/include/Geode/ui/TextArea.hpp index 0ac0cf31..c923d4e4 100644 --- a/loader/include/Geode/ui/TextArea.hpp +++ b/loader/include/Geode/ui/TextArea.hpp @@ -4,36 +4,47 @@ #include namespace geode { + enum WrappingMode { + NO_WRAP, + WORD_WRAP, + CUTOFF_WRAP + }; + /** * A class which provides a textarea with proper alignment and some extra features like: * * - Max lines * - Changing all aspects after creation * - Custom text alignment - * - Automatic line wrapping and cutoff + * - Configurable and automatic word wrapping * - Line padding * * Contact me on Discord (\@smjs) if you have any questions, suggestions or bugs. */ class GEODE_DLL SimpleTextArea : public cocos2d::CCNode { + static SimpleTextArea* create(const std::string& text, const std::string& font = "chatFont.fnt", const float scale = 1); + static SimpleTextArea* create(const std::string& text, const std::string& font, const float scale, const float width); + cocos2d::CCMenu* m_container; std::string m_font; std::string m_text; std::vector m_lines; + cocos2d::ccColor4B m_color; cocos2d::CCTextAlignment m_alignment; + WrappingMode m_wrappingMode; size_t m_maxLines; float m_scale; float m_lineHeight; float m_linePadding; - bool m_artificialWidth; - public: - static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale); - static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width); void setFont(const std::string& font); std::string getFont(); + void setColor(const cocos2d::ccColor4B& color); + cocos2d::ccColor4B getColor(); void setAlignment(const cocos2d::CCTextAlignment alignment); cocos2d::CCTextAlignment getAlignment(); + void setWrappingMode(const WrappingMode mode); + WrappingMode getWrappingMode(); void setText(const std::string& text); std::string getText(); void setMaxLines(const size_t maxLines); @@ -50,11 +61,17 @@ namespace geode { private: static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + bool m_shouldUpdate; + bool m_artificialWidth; + SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); cocos2d::CCLabelBMFont* createLabel(const std::string& text, const float top); - cocos2d::CCLabelBMFont* moveOverflow(cocos2d::CCLabelBMFont* line, const char c, const float top); float calculateOffset(cocos2d::CCLabelBMFont* label); - void updateLines(); - void updateContents(); + void charIteration(const std::function& overflowHandling); + void updateLinesNoWrap(); + void updateLinesWordWrap(); + void updateLinesCutoffWrap(); + void updateContainer(); + virtual void draw() override; }; } \ No newline at end of file diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 9dce696f..a2b74717 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -2,11 +2,11 @@ using namespace geode::prelude; -SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale = 1) { - return SimpleTextArea::create(font, text, scale, 500, false); +SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale) { + return SimpleTextArea::create(font, text, scale, CCDirector::sharedDirector()->getWinSize().width / 2, false); } -SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width) { +SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale, const float width) { return SimpleTextArea::create(font, text, scale, width, true); } @@ -30,9 +30,12 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_color = { 0xFF, 0xFF, 0xFF, 0xFF }; m_alignment = kCCTextAlignmentLeft; + m_wrappingMode = WORD_WRAP; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); + m_shouldUpdate = true; this->setAnchorPoint({ 0.5f, 0.5f }); m_container->setPosition({ 0, 0 }); @@ -40,33 +43,47 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_container->setContentSize({ width, 0 }); this->addChild(m_container); - this->updateContents(); } void SimpleTextArea::setFont(const std::string& font) { m_font = font; - - this->updateContents(); + m_shouldUpdate = true; } std::string SimpleTextArea::getFont() { return m_font; } +void SimpleTextArea::setColor(const ccColor4B& color) { + m_color = color; + m_shouldUpdate = true; +} + +ccColor4B SimpleTextArea::getColor() { + return m_color; +} + void SimpleTextArea::setAlignment(const CCTextAlignment alignment) { m_alignment = alignment; - - this->updateContents(); + m_shouldUpdate = true; } CCTextAlignment SimpleTextArea::getAlignment() { return m_alignment; } +void SimpleTextArea::setWrappingMode(const WrappingMode mode) { + m_wrappingMode = mode; + m_shouldUpdate = true; +} + +WrappingMode SimpleTextArea::getWrappingMode() { + return m_wrappingMode; +} + void SimpleTextArea::setText(const std::string& text) { m_text = text; - - this->updateContents(); + m_shouldUpdate = true; } std::string SimpleTextArea::getText() { @@ -75,8 +92,7 @@ std::string SimpleTextArea::getText() { void SimpleTextArea::setMaxLines(const size_t maxLines) { m_maxLines = maxLines; - - this->updateContents(); + m_shouldUpdate = true; } size_t SimpleTextArea::getMaxLines() { @@ -85,6 +101,7 @@ size_t SimpleTextArea::getMaxLines() { void SimpleTextArea::setWidth(const float width) { m_artificialWidth = true; + m_shouldUpdate = true; this->setContentSize({ width, this->getContentSize().height }); m_container->setContentSize(this->getContentSize()); @@ -96,8 +113,7 @@ float SimpleTextArea::getWidth() { void SimpleTextArea::setScale(const float scale) { m_scale = scale; - - this->updateContents(); + m_shouldUpdate = true; } float SimpleTextArea::getScale() { @@ -106,8 +122,7 @@ float SimpleTextArea::getScale() { void SimpleTextArea::setLinePadding(const float padding) { m_linePadding = padding; - - this->updateContents(); + m_shouldUpdate = true; } float SimpleTextArea::getLinePadding() { @@ -131,34 +146,17 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float label->setScale(m_scale); label->setPosition({ 0, top }); + label->setColor({ m_color.r, m_color.g, m_color.b }); + label->setOpacity(m_color.a); return label; } -CCLabelBMFont* SimpleTextArea::moveOverflow(CCLabelBMFont* line, const char c, const float top) { - const std::string text = line->getString(); - const char back = text.back(); - const bool lastIsSpace = back == ' '; - CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); - - if (!lastIsSpace) { - if (text[text.size() - 2] == ' ') { - line->setString(text.substr(0, text.size() - 1).c_str()); - } else { - line->setString((text.substr(0, text.size() - 1) + '-').c_str()); - } - } - - m_lines.push_back(newLine); - - return newLine; -} - float SimpleTextArea::calculateOffset(CCLabelBMFont* label) { return m_linePadding + label->getContentSize().height * m_scale; } -void SimpleTextArea::updateLines() { +void SimpleTextArea::charIteration(const std::function& overflowHandling) { float top = 0; CCLabelBMFont* line = this->createLabel("", top); m_lines = { line }; @@ -173,21 +171,87 @@ void SimpleTextArea::updateLines() { break; } else if (c == '\n') { - line = this->createLabel("", top -= this->calculateOffset(line)); - - m_lines.push_back(line); - } else if (m_artificialWidth && line->getContentSize().width >= this->getWidth()) { - line = this->moveOverflow(line, c, top -= this->calculateOffset(line)); + m_lines.push_back(line = this->createLabel("", top -= this->calculateOffset(line))); + } else if (m_artificialWidth && line->getContentSize().width * m_scale >= this->getWidth()) { + m_lines.push_back(line = overflowHandling(line, c, top -= this->calculateOffset(line))); } else { - const std::string text = line->getString(); - - line->setString((text + c).c_str()); + line->setString((std::string(line->getString()) + c).c_str()); } } } -void SimpleTextArea::updateContents() { - this->updateLines(); +void SimpleTextArea::updateLinesNoWrap() { + std::stringstream stream(m_text); + std::string part; + float top = 0; + + while (std::getline(stream, part)) { + if (m_maxLines && m_lines.size() >= m_maxLines) { + CCLabelBMFont* last = m_lines.at(m_maxLines - 1); + const std::string text = last->getString(); + + last->setString(text.substr(0, text.size() - 3).append("...").c_str()); + + break; + } else { + CCLabelBMFont* line = this->createLabel(part, 0); + + top -= this->calculateOffset(line); + + m_lines.push_back(line); + } + } +} + +void SimpleTextArea::updateLinesWordWrap() { + this->charIteration([this](CCLabelBMFont* line, const char c, const float top) { + static std::string delimiters(" `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|"); + + if (delimiters.find(c) == std::string_view::npos) { + const std::string text = line->getString(); + const size_t position = text.find_last_of(delimiters) + 1; + + line->setString(text.substr(0, position).c_str()); + + return this->createLabel(text.substr(position) + c, top); + } else { + return this->createLabel(std::string(c, c != ' '), top); + } + }); +} + +void SimpleTextArea::updateLinesCutoffWrap() { + this->charIteration([this](CCLabelBMFont* line, const char c, const float top) { + const std::string text = line->getString(); + const char back = text.back(); + const bool lastIsSpace = back == ' '; + CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); + + if (!lastIsSpace) { + if (text[text.size() - 2] == ' ') { + line->setString(text.substr(0, text.size() - 1).c_str()); + } else { + line->setString((text.substr(0, text.size() - 1) + '-').c_str()); + } + } + + return newLine; + }); +} + +void SimpleTextArea::updateContainer() { + switch (m_wrappingMode) { + case NO_WRAP: { + this->updateLinesNoWrap(); + } break; + case WORD_WRAP: { + this->updateLinesWordWrap(); + } break; + case CUTOFF_WRAP: { + this->updateLinesCutoffWrap(); + } break; + } + const size_t lineCount = m_lines.size(); const float width = this->getWidth(); @@ -212,7 +276,7 @@ void SimpleTextArea::updateContents() { line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 1 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { @@ -224,3 +288,13 @@ void SimpleTextArea::updateContents() { m_container->addChild(line); } } + +void SimpleTextArea::draw() { + CCNode::draw(); + + if (m_shouldUpdate) { + this->updateContainer(); + + m_shouldUpdate = false; + } +} \ No newline at end of file From c87e8f6b8dad32d466966d8dfea386ff8443f757 Mon Sep 17 00:00:00 2001 From: Catto_ <57293929+CattoDev@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:23:52 +0200 Subject: [PATCH 162/270] Add processSelectObjects for windows (#292) --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index a7eabf57..8693dcd3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1431,6 +1431,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void repositionObjectsToCenter(cocos2d::CCArray* objs, cocos2d::CCPoint center, bool ignoreGroupParent) = mac 0x1fcd0, win 0x88410; virtual void draw() = win 0x8fbe0; float valueFromXPos(float val) = win 0x78e30, mac 0x1c810; + void processSelectObjects(cocos2d::CCArray*) = win 0x86f70; bool m_isPlayingMusic; EditButtonBar* m_buttonBar; From b4fbea51e29d5db4a9d1001f29cdf4124cc9f484 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Tue, 10 Oct 2023 18:44:37 -0300 Subject: [PATCH 163/270] only write checksum file after unzipping --- loader/src/loader/Index.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index acb95064..6340c360 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -252,7 +252,7 @@ private: friend class Index; void cleanupItems(); - void downloadIndex(); + void downloadIndex(std::string commitHash = ""); void checkForUpdates(); void updateFromLocalTree(); void installNext(size_t index, IndexInstallList const& list); @@ -296,7 +296,7 @@ bool Index::hasTriedToUpdate() const { return m_impl->m_triedToUpdate; } -void Index::Impl::downloadIndex() { +void Index::Impl::downloadIndex(std::string commitHash) { log::debug("Downloading index"); IndexUpdateEvent(UpdateProgress(0, "Beginning download")).post(); @@ -307,7 +307,7 @@ void Index::Impl::downloadIndex() { .join("index-download") .fetch("https://github.com/geode-sdk/mods/zipball/main") .into(targetFile) - .then([this, targetFile](auto) { + .then([this, targetFile, commitHash](auto) { auto targetDir = dirs::getIndexDir() / "v0"; // delete old unzipped index try { @@ -333,6 +333,10 @@ void Index::Impl::downloadIndex() { // remove the directory github adds to the root of the zip (void)flattenGithubRepo(targetDir); + if (!commitHash.empty()) { + auto const checksumPath = dirs::getIndexDir() / ".checksum"; + (void)file::writeString(checksumPath, commitHash); + } Loader::get()->queueInMainThread([this] { // update index @@ -387,8 +391,7 @@ void Index::Impl::checkForUpdates() { } // otherwise save hash and download source else { - (void)file::writeString(checksum, newSHA); - this->downloadIndex(); + this->downloadIndex(newSHA); } }) .expect([](std::string const& err) { From 924b7921aeb37aa735f006f3cefbd22a05125440 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:52:00 +0300 Subject: [PATCH 164/270] add LevelEditorLayer::getNextColorChannel to win --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 8693dcd3..2d22e793 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3873,7 +3873,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { cocos2d::CCArray* createObjectsFromString(gd::string, bool) = mac 0x94730, win 0x160980; void getLastObjectX() = mac 0x9c860, win 0x167290; gd::string getLevelString() = mac 0x97790, win 0x162480; - void getNextColorChannel() = mac 0x9a610; + int getNextColorChannel() = mac 0x9a610, win 0x164e10; void getNextFreeBlockID(cocos2d::CCArray*) = mac 0x9a4e0; int getNextFreeGroupID(cocos2d::CCArray*) = mac 0x9a1b0, win 0x164ae0; void getNextFreeItemID(cocos2d::CCArray*) = mac 0x9a390; From 8762714c23f5fd7dc451d1e3f30f6e412334fcad Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:56:33 +0300 Subject: [PATCH 165/270] only show update indicator if mod is enabled --- loader/src/loader/Index.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index 6340c360..ff1d4b1d 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -594,7 +594,7 @@ bool Index::isUpdateAvailable(IndexItemHandle item) const { bool Index::areUpdatesAvailable() const { for (auto& mod : Loader::get()->getAllMods()) { auto item = this->getMajorItem(mod->getID()); - if (item && item->getMetadata().getVersion() > mod->getVersion()) { + if (item && item->getMetadata().getVersion() > mod->getVersion() && mod->isEnabled()) { return true; } } From 449ee464bec4583a7a042776996f4de09ff253b0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:02:06 +0300 Subject: [PATCH 166/270] fix pickfiles --- loader/src/platform/mac/util.mm | 2 +- loader/src/platform/windows/util.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index 9c1ec590..13ef876f 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -180,7 +180,7 @@ Result> file::pickFiles( GEODE_DLL void file::pickFiles( FilePickOptions const& options, - MiniFunction callback, + MiniFunction)> callback, MiniFunction failed ) { auto result = file::pickFiles(options); diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index c779bef5..e84c71ab 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -121,7 +121,7 @@ Result> utils::file::pickFiles( GEODE_DLL void file::pickFiles( FilePickOptions const& options, - MiniFunction callback, + MiniFunction)> callback, MiniFunction failed ) { auto result = file::pickFiles(options); From 0bdb0df70225a3a008bf79b98175d9202efc84ae Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:03:54 +0300 Subject: [PATCH 167/270] this code is still very sad --- loader/include/Geode/c++stl/gnustl.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/loader/include/Geode/c++stl/gnustl.hpp b/loader/include/Geode/c++stl/gnustl.hpp index b47afad8..668c0333 100644 --- a/loader/include/Geode/c++stl/gnustl.hpp +++ b/loader/include/Geode/c++stl/gnustl.hpp @@ -405,9 +405,7 @@ namespace gd { } ~vector() { - for (auto i = m_start; i != m_finish; ++i) { - delete i; - } + if (m_start) delete m_start; } size_t size() const { From b55e6465ce7ba5013b44dfe74dc981b1f13fa99f Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:23:13 -0300 Subject: [PATCH 168/270] fix gnustl vector dtor --- loader/include/Geode/c++stl/gnustl.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/c++stl/gnustl.hpp b/loader/include/Geode/c++stl/gnustl.hpp index 668c0333..a7d87cb6 100644 --- a/loader/include/Geode/c++stl/gnustl.hpp +++ b/loader/include/Geode/c++stl/gnustl.hpp @@ -405,7 +405,12 @@ namespace gd { } ~vector() { - if (m_start) delete m_start; + if (m_start) { + for (auto& x : *this) { + x.~T(); + } + delete m_start; + } } size_t size() const { From c967b520dfebd92fc88d60ef6099115c85b2e96c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 11 Oct 2023 22:16:12 +0300 Subject: [PATCH 169/270] fix the index notif staying on all the time --- loader/include/Geode/ui/SceneManager.hpp | 1 + loader/src/ui/nodes/Notification.cpp | 1 - loader/src/ui/nodes/SceneManager.cpp | 5 +++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/ui/SceneManager.hpp b/loader/include/Geode/ui/SceneManager.hpp index 2539f182..2077f49b 100644 --- a/loader/include/Geode/ui/SceneManager.hpp +++ b/loader/include/Geode/ui/SceneManager.hpp @@ -13,6 +13,7 @@ namespace geode { class GEODE_DLL SceneManager { protected: cocos2d::CCArray* m_persistedNodes; + cocos2d::CCScene* m_lastScene = nullptr; bool setup(); diff --git a/loader/src/ui/nodes/Notification.cpp b/loader/src/ui/nodes/Notification.cpp index f9bad08b..449ddde2 100644 --- a/loader/src/ui/nodes/Notification.cpp +++ b/loader/src/ui/nodes/Notification.cpp @@ -173,7 +173,6 @@ void Notification::show() { auto winSize = CCDirector::get()->getWinSize(); this->setPosition(winSize.width / 2, winSize.height / 4); this->setZOrder(CCScene::get()->getHighestChildZ() + 100); - CCScene::get()->addChild(this); } SceneManager::get()->keepAcrossScenes(this); m_showing = true; diff --git a/loader/src/ui/nodes/SceneManager.cpp b/loader/src/ui/nodes/SceneManager.cpp index 0ec112d7..ee7a4247 100644 --- a/loader/src/ui/nodes/SceneManager.cpp +++ b/loader/src/ui/nodes/SceneManager.cpp @@ -23,6 +23,10 @@ SceneManager::~SceneManager() { } void SceneManager::keepAcrossScenes(CCNode* node) { + if (m_lastScene) { + node->removeFromParentAndCleanup(false); + m_lastScene->addChild(node); + } m_persistedNodes->addObject(node); } @@ -36,4 +40,5 @@ void SceneManager::willSwitchToScene(CCScene* scene) { node->removeFromParentAndCleanup(false); scene->addChild(node); } + m_lastScene = scene; } From 451c2b10f6b31ec4130220e94bcb7932328eb86e Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Fri, 13 Oct 2023 06:18:15 -0500 Subject: [PATCH 170/270] symbols --- bindings/Cocos2d.bro | 1 + bindings/GeometryDash.bro | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index b26400b2..991a6988 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1232,6 +1232,7 @@ class cocos2d::extension::CCScale9Sprite { class cocos2d::extension::CCScrollView { CCScrollView() = mac 0x214800; virtual ~CCScrollView() = mac 0x214c30; + static auto create(cocos2d::CCSize, cocos2d::CCNode*) = mac 0x214cd0; virtual auto init() = mac 0x214fb0; virtual auto setContentSize(cocos2d::CCSize const&) = mac 0x215eb0; virtual auto getContentSize() const = mac 0x215e90; diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ab336f38..f31be6d1 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1724,7 +1724,7 @@ class FMODAudioEngine : cocos2d::CCNode { virtual void update(float) = win 0x23b20; cocos2d::CCDictionary* m_dictionary; - std::string m_filePath; + gd::string m_filePath; float m_backgroundMusicVolume; float m_effectsVolume; float m_pulse1; @@ -2432,9 +2432,9 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, cocos2d::CCSprite* m_colorSelector2; CCMenuItemSpriteExtra* m_unkButton0x148; CCMenuItemSpriteExtra* m_unkButton0x14c; - PAD = win 0x8; + PAD = win 0x8, mac 0x10; cocos2d::CCArray* m_pagesArray; - PAD = win 0x8; + PAD = win 0x8, mac 0x10; CCMenuItemToggler* m_tabToggleCube; CCMenuItemToggler* m_tabToggleShip; CCMenuItemToggler* m_tabToggleBall; @@ -2444,7 +2444,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, CCMenuItemToggler* m_tabToggleSpider; CCMenuItemToggler* m_tabToggleSpecial; CCMenuItemToggler* m_tabToggleDeathEffect; - PAD = win 0x4; + PAD = win 0x4, mac 0x8; bool m_updateSelector; } @@ -4071,7 +4071,7 @@ class LevelSearchLayer : cocos2d::CCLayer { virtual bool init() = mac 0x384770, win 0x17da60; GJSearchObject* getSearchObject(SearchType, gd::string) = mac 0x388a50, win 0x1805f0; void onMoreOptions(cocos2d::CCObject*) = win 0x17f500; - void onSearch(cocos2d::CCObject*) = win 0x180fc0; + void onSearch(cocos2d::CCObject*) = mac 0x386a70, win 0x180fc0; PAD = mac 0x18, win 0xC; CCTextInputNode* m_searchInput; From bf2022aee4e9e63fc9607d33d78e8f85c48561f8 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Fri, 13 Oct 2023 19:21:13 +0200 Subject: [PATCH 171/270] fix MoreSearchLayer::create on Mac --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2d22e793..7a16adfd 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4354,7 +4354,7 @@ class MenuLayer : cocos2d::CCLayer, FLAlertLayerProtocol, GooglePlayDelegate { class MessageListDelegate {} class MoreSearchLayer : FLAlertLayer { - static MoreSearchLayer* create() = mac 0x38ab40, win 0x182520; + static MoreSearchLayer* create() = mac 0x388180, win 0x182520; virtual bool init() = mac 0x3896b0, win 0x1825c0; void onClose(cocos2d::CCObject*) = mac 0x38aa40, win 0x1848f0; } From 5c87d62dccfa9054c8877d2d926936e0f3cf1615 Mon Sep 17 00:00:00 2001 From: Catto_ <57293929+CattoDev@users.noreply.github.com> Date: Fri, 13 Oct 2023 21:58:08 +0200 Subject: [PATCH 172/270] Add files via upload --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 7a16adfd..91ff855e 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1431,7 +1431,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void repositionObjectsToCenter(cocos2d::CCArray* objs, cocos2d::CCPoint center, bool ignoreGroupParent) = mac 0x1fcd0, win 0x88410; virtual void draw() = win 0x8fbe0; float valueFromXPos(float val) = win 0x78e30, mac 0x1c810; - void processSelectObjects(cocos2d::CCArray*) = win 0x86f70; + void processSelectObjects(cocos2d::CCArray*) = win 0x86f70, mac 0x24110; bool m_isPlayingMusic; EditButtonBar* m_buttonBar; From 2b4825ae1335b408dc17b53972c2454f63e3413c Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 13 Oct 2023 23:57:07 +0300 Subject: [PATCH 173/270] bindings stuff --- bindings/GeometryDash.bro | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 7a16adfd..e113e63b 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1730,11 +1730,13 @@ class FLAlertLayerProtocol { class FMODAudioEngine : cocos2d::CCNode { static FMODAudioEngine* sharedEngine() = mac 0x20ef80, win 0x239f0; + void setupAudioEngine() = win 0x23a70; void preloadEffect(gd::string filename) = win 0x24240; bool isBackgroundMusicPlaying() = win 0x24050; bool isBackgroundMusicPlaying(gd::string path) = win 0x24080; void playBackgroundMusic(gd::string path, bool fade, bool paused) = win 0x23d80; - + void setBackgroundMusicTime(float time) = win 0x23fb0; + virtual void update(float) = win 0x23b20; cocos2d::CCDictionary* m_dictionary; @@ -2682,7 +2684,7 @@ class GJSpiderSprite : GJRobotSprite { class GJSpriteColor : cocos2d::CCNode { int m_colorID; int m_defaultColorID; - float m_unk_0F4; + float m_opacity; cocos2d::ccHSVValue m_hsv; bool m_usesHSV; float unk_10C; @@ -3282,15 +3284,16 @@ class GameObject : CCSpritePlus { void addToTempOffset(float, float) = mac 0x335700; void calculateOrientedBox() = mac 0x342b20, win 0xef1a0; void canChangeCustomColor() = mac 0x342db0; - cocos2d::_ccColor3B& colorForMode(int, bool) = mac 0x343460, win 0xef8d0; float groupOpacityMod() = win 0xebda0; + cocos2d::_ccColor3B& colorForMode(int colorMode, bool isMain) = mac 0x343460, win 0xef8d0; + cocos2d::_ccColor3B& groupColor(cocos2d::_ccColor3B const&, bool) = win 0xef9e0; + cocos2d::_ccColor3B& getActiveColorForMode(int, bool) = mac 0x343860, win 0xefb10; void commonSetup() = mac 0x2f5570, win 0xcfac0; void copyGroups(GameObject*) = mac 0x33ae30, win 0xeb9d0; static GameObject* createWithFrame(const char*) = mac 0x2f5490, win 0xcf8f0; static GameObject* createWithKey(int) = mac 0x2f4ce0, win 0xcf4f0; void destroyObject() = mac 0x336a00; void determineSlopeDirection() = mac 0x33a9e0, win 0xeb670; - cocos2d::_ccColor3B& getActiveColorForMode(int, bool) = mac 0x343860, win 0xefb10; void getBallFrame(int) = mac 0x341bf0; cocos2d::CCPoint getBoxOffset() = mac 0x3353d0, win 0xef350; const cocos2d::_ccColor3B& getColorIndex() = mac 0x343b90; @@ -3350,8 +3353,7 @@ class GameObject : CCSpritePlus { bool canAllowMultiActivate() = mac 0x343ca0, win 0xf06b0; void createGroupContainer(int size) = mac 0x33aca0, win 0xeb870; - bool m_unk3; - bool m_isBlueMaybe; + cocos2d::_ccColor3B m_color; float m_unk2; float m_unk; float m_unk3f; @@ -3454,7 +3456,7 @@ class GameObject : CCSpritePlus { int m_objectID; bool m_unk364; bool m_unk365; - bool m_unk366; + bool m_ignoreEnter; bool m_ignoreFade; bool m_unk368; bool m_unk369; @@ -4683,7 +4685,8 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void switchToRollMode(PlayerObject*, GameObject*, bool) = mac 0x7bbe0; void switchToSpiderMode(PlayerObject*, GameObject*, bool) = mac 0x7bd20; callback float timeForXPos(float) = mac 0x7d120, win 0x2087d0; - float timeForXPos2(float, bool) = mac 0x293eb0, win 0x1fd3d0; + float timeForXPos2(float, bool) = mac 0x293eb0, win 0x208800; + callback float xPosForTime(float) = mac 0x7d140, win 0x208840; void toggleBGEffectVisibility(bool) = mac 0x7fe80; void toggleDualMode(GameObject*, bool, PlayerObject*, bool) = mac 0x7bf90, win 0x208880; void toggleFlipped(bool, bool) = mac 0x7bdc0, win 0x20ab20; @@ -4712,7 +4715,6 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, virtual void visit() = mac 0x75ef0, win 0x200020; void visitWithColorFlash() = mac 0x761f0, win 0x200190; void willSwitchToMode(int, PlayerObject*) = mac 0x7b9e0; - void xPosForTime(float) = mac 0x7d140, win 0x208840; ~PlayLayer() = mac 0x6b090, win 0x1fafc0; float unused4c8; @@ -4743,7 +4745,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, EndPortalObject* m_endPortal; cocos2d::CCArray* m_checkpoints; cocos2d::CCArray* m_speedObjects; - cocos2d::CCArray* unk340; + cocos2d::CCArray* m_allSpeedObjects; cocos2d::CCArray* unk344; cocos2d::CCSprite* unk348; float m_backgroundRepeat; @@ -4917,7 +4919,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { void boostPlayer(float) = mac 0x21d6b0, win 0x1f8f30; void bumpPlayer(float, int) = mac 0x22d890; void buttonDown(PlayerButton) = mac 0x22b7e0; - void checkSnapJumpToObject(GameObject*) = mac 0x2217f0; + void checkSnapJumpToObject(GameObject*) = mac 0x2217f0, win 0x1ece70; bool collidedWithObject(float fl, GameObject* obj) { auto rect = obj->getObjectRect(); return collidedWithObject(fl, obj, rect); @@ -5594,12 +5596,11 @@ class SpawnTriggerAction : cocos2d::CCNode { } class SpeedObject : cocos2d::CCNode { - float m_unknown; - float m_somethingToCompare; - float m_idk3; - float m_idk4; + Speed m_speed; + float m_xPos; + GameObject* m_object; - static SpeedObject* create(GameObject*, int, float) = win 0x20DE70; + static SpeedObject* create(GameObject* object, Speed speed, float x) = win 0x20de70; } class SpritePartDelegate {} From 4ec869ee1dac88ac24e66c9af8d7ab203913e32a Mon Sep 17 00:00:00 2001 From: Catto_ <57293929+CattoDev@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:11:48 +0200 Subject: [PATCH 174/270] processSelectObjects mac binding --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e113e63b..968962a3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1431,7 +1431,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void repositionObjectsToCenter(cocos2d::CCArray* objs, cocos2d::CCPoint center, bool ignoreGroupParent) = mac 0x1fcd0, win 0x88410; virtual void draw() = win 0x8fbe0; float valueFromXPos(float val) = win 0x78e30, mac 0x1c810; - void processSelectObjects(cocos2d::CCArray*) = win 0x86f70; + void processSelectObjects(cocos2d::CCArray*) = win 0x86f70, mac 0x24110; bool m_isPlayingMusic; EditButtonBar* m_buttonBar; From c03b30e8bd5b45083f50496cc6f3452ac4b5b647 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 14 Oct 2023 20:14:25 +0300 Subject: [PATCH 175/270] some GameObject members --- bindings/GeometryDash.bro | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 968962a3..ee7d9eec 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3324,7 +3324,15 @@ class GameObject : CCSpritePlus { void loadGroupsFromString(gd::string str) = mac 0x33b380, win 0xebcb0; static GameObject* objectFromString(gd::string, bool) = mac 0x33b720, win 0xebe50; void playShineEffect() = mac 0x2fa9d0, win 0xeab20; - void quickUpdatePosition() = mac 0x335790; + //void quickUpdatePosition() = mac 0x335790; + // inlined on windows + void quickUpdatePosition() { + cocos2d::CCPoint newPos = getRealPosition(); + this->setPosition(newPos); + if (m_detailSprite && !m_hasDetailColor) { + m_detailSprite->setPosition(newPos); + } + } void removeGlow() = mac 0x2f7f70; void resetGroupDisabled() = mac 0x2fa7e0; void saveActiveColors() = mac 0x33d250, win 0xee3e0; @@ -3510,8 +3518,8 @@ class GameObject : CCSpritePlus { int m_unk414; PAD = mac 0xc, win 0xc; cocos2d::CCPoint m_firstPosition; - bool m_unk42C; - bool m_unk42D; + bool m_queuedForPositionUpdate; + bool m_shouldUpdateFirstPosition; PAD = mac 0x6, win 0x6; bool m_isAnimated; PAD = mac 0x7, win 0x7; @@ -3528,7 +3536,7 @@ class GameObject : CCSpritePlus { GJEffectManager* m_effectManager; bool m_unk458; bool m_unk459; - bool m_unk45A; + bool m_inOptimizedGroup; bool m_wasForcedRotatedPositionUpdateIdk; PAD = mac 0x8, win 0x8; bool m_orbMultiActivate; From def813e6f3695d4f2d9a797bef3cfd1e44befe91 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Sun, 15 Oct 2023 02:32:18 +0300 Subject: [PATCH 176/270] custom song widget members and functions --- bindings/GeometryDash.bro | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 968962a3..10cd86d9 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1012,16 +1012,46 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G } class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerProtocol { - bool init(SongInfoObject*, LevelSettingsObject*, bool, bool, bool, bool, bool hideBackground) = mac 0x37be20, win 0x685b0; + bool init(SongInfoObject*, LevelSettingsObject*, bool, bool, bool, bool, bool) = mac 0x37be20, win 0x685b0; void FLAlert_Clicked(FLAlertLayer*, bool) {} void loadSongInfoFinished(SongInfoObject*) {} + void startDownload() = win 0x69610; + void startMonitorDownload() = win 0x696b0; + void updatePlaybackBtn() = win 0x69970; + void updateSongInfo() = win 0x69bf0; void updateSongObject(SongInfoObject* song) = win 0x69280, mac 0x37d690; + void onCancelDownload(CCObject*) = win 0x693b0; + void onDownload(CCObject*) = win 0x69540; + void onGetSongInfo(CCObject*) = win 0x69490; + void onMore(CCObject*) = win 0x68e20; + void onPlayback(CCObject*) = win 0x697b0; + void onSelect(CCObject*) = win 0x69760; SongInfoObject* m_songInfo; - PAD = win 0x1C; + cocos2d::CCMenu* m_buttonMenu; + cocos2d::CCLabelBMFont* m_songLabel; + cocos2d::CCLabelBMFont* m_artistLabel; + cocos2d::CCLabelBMFont* m_songIDLabel; + cocos2d::CCLabelBMFont* m_errorLabel; CCMenuItemSpriteExtra* m_downloadBtn; - PAD = win 0x30; + CCMenuItemSpriteExtra* m_cancelDownloadBtn; + CCMenuItemSpriteExtra* m_selectSongBtn; + CCMenuItemSpriteExtra* m_getSongInfoBtn; + CCMenuItemSpriteExtra* m_playMusicBtn; + CCMenuItemSpriteExtra* m_moreBtn; + cocos2d::CCSprite* m_sliderGroove; + cocos2d::CCSprite* m_sliderBar; + LevelSettingsObject* m_levelSettings; + bool m_showSelectSongBtn; + bool m_showPlayMusicBtn; + bool m_showDownloadButtons; + bool m_isNotDownloading; + bool m_hasDefaultSong; + PAD = win 0x3; + int m_customSongID; + bool m_unkBool; + PAD = win 0x3; } class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate { From b941ee2c7cb8ddb52af55ed56aafb4b9354e387b Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Sun, 15 Oct 2023 02:35:52 +0300 Subject: [PATCH 177/270] bye bye pads --- bindings/GeometryDash.bro | 2 -- 1 file changed, 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 10cd86d9..61f1b37a 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1048,10 +1048,8 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro bool m_showDownloadButtons; bool m_isNotDownloading; bool m_hasDefaultSong; - PAD = win 0x3; int m_customSongID; bool m_unkBool; - PAD = win 0x3; } class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDelegate, ColorSelectDelegate, ColorSetupDelegate { From c12a64f93b1a40d3842e6f401490a6daf40fd0b3 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:01:21 -0300 Subject: [PATCH 178/270] update ndk to r26b --- .github/workflows/build-android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index d1502403..c74d522a 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -18,7 +18,7 @@ jobs: - uses: nttld/setup-ndk@v1 id: setup-ndk with: - ndk-version: r25c + ndk-version: r26b add-to-path: false - name: Download CLI From 6a3a2c9714e00ad7b5519af85beb0c2f0cf3fab1 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:12:32 +0300 Subject: [PATCH 179/270] fix bros and remove update dir on start --- bindings/Cocos2d.bro | 5 ----- bindings/GeometryDash.bro | 12 ++++++------ loader/src/platform/android/main.cpp | 7 +++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 9e85414b..c873de2a 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -94,11 +94,6 @@ class cocos2d::CCCallFuncND { static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFuncND, void*) = mac 0x455470; } -[[link(win, android)]] -class cocos2d::CCCallFuncND { - static auto create(cocos2d::CCObject*, cocos2d::SEL_CallFuncND, void*) = mac 0x455470; -} - [[link(win, android)]] class cocos2d::CCClippingNode { CCClippingNode() { diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 76b62e67..bc74d688 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1078,12 +1078,12 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro void updatePlaybackBtn() = win 0x69970; void updateSongInfo() = win 0x69bf0; void updateSongObject(SongInfoObject* song) = win 0x69280, mac 0x37d690; - void onCancelDownload(CCObject*) = win 0x693b0; - void onDownload(CCObject*) = win 0x69540; - void onGetSongInfo(CCObject*) = win 0x69490; - void onMore(CCObject*) = win 0x68e20; - void onPlayback(CCObject*) = win 0x697b0; - void onSelect(CCObject*) = win 0x69760; + void onCancelDownload(cocos2d::CCObject*) = win 0x693b0; + void onDownload(cocos2d::CCObject*) = win 0x69540; + void onGetSongInfo(cocos2d::CCObject*) = win 0x69490; + void onMore(cocos2d::CCObject*) = win 0x68e20; + void onPlayback(cocos2d::CCObject*) = win 0x697b0; + void onSelect(cocos2d::CCObject*) = win 0x69760; SongInfoObject* m_songInfo; cocos2d::CCMenu* m_buttonMenu; diff --git a/loader/src/platform/android/main.cpp b/loader/src/platform/android/main.cpp index f1500146..b8015ef4 100644 --- a/loader/src/platform/android/main.cpp +++ b/loader/src/platform/android/main.cpp @@ -16,6 +16,13 @@ extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* rese glBindVertexArrayOESEXT = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES"); glDeleteVertexArraysOESEXT = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"); + auto updatePath = geode::dirs::getGameDir() / "update"; + std::error_code ec; + ghc::filesystem::remove_all(updatePath, ec); + if (ec) { + geode::log::warn("Failed to remove update directory: {}", ec.message()); + } + geodeEntry(nullptr); return JNI_VERSION_1_6; } From 4acca436e81fa543f97b13fbd7c0d0b7421bb745 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:17:29 +0300 Subject: [PATCH 180/270] who named these functions please use the android signatures i beg you --- bindings/GeometryDash.bro | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index bc74d688..9ded142b 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2565,14 +2565,14 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, void onDartIcon(cocos2d::CCObject* sender) = win 0x128420; void onRobotIcon(cocos2d::CCObject* sender) = win 0x1286d0; void onSpiderIcon(cocos2d::CCObject* sender) = win 0x128890; - void onPlayerDeathEffect(cocos2d::CCObject* sender) = win 0x128a50; - void onPlayerTrail(cocos2d::CCObject* sender) = win 0x128af0; + void onDeathEffect(cocos2d::CCObject* sender) = win 0x128a50; + void onTrail(cocos2d::CCObject* sender) = win 0x128af0; void onShards(cocos2d::CCObject* sender) = win 0x12ad70; void onBack(cocos2d::CCObject* sender) = win 0x12adf0; void onShop(cocos2d::CCObject* sender) = win 0x12ad90; void setupColorSelect() = mac 0x1b7500; - void showCircleWave() = win 0x12aad0; - void showBlackCircleWave() = win 0x12a9d0; + void playRainbowEffect() = win 0x12aad0; + void playShadowEffect() = win 0x12a9d0; PAD = mac 0x10, win 0x8; CCTextInputNode* m_nameInput; SimplePlayer* m_playerPreview; @@ -3810,7 +3810,7 @@ class GaragePage : cocos2d::CCLayer, ListButtonBarDelegate { return nullptr; } - void listButtonBarSwitchedPage(ListButtonBar* bar, int idk) = win 0x12bb40; + virtual void listButtonBarSwitchedPage(ListButtonBar* bar, int idk) = win 0x12bb40; inline GaragePage() {} bool init(IconType type, GJGarageLayer* pGarage, cocos2d::SEL_MenuHandler pSelectCallback) = mac 0x1bb710, win 0x12af70, ios 0x225d5c; @@ -4445,7 +4445,7 @@ class LikeItemLayer : FLAlertLayer { [[link(android)]] class ListButtonBar : cocos2d::CCNode { BoomScrollLayer* m_scrollLayer; - void switchedPage(int page) = win 0x29c50; + void goToPage(int page) = win 0x29c50; } [[link(android)]] @@ -5878,7 +5878,7 @@ class SpeedObject : cocos2d::CCNode { float m_xPos; GameObject* m_object; - static SpeedObject* create(GameObject* object, Speed speed, float x) = win 0x20de70; + static SpeedObject* create(GameObject* object, int speed, float x) = win 0x20de70; } [[link(android)]] From cd012df57e4551d38c57ab6e5d45f28da70694df Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:26:24 +0300 Subject: [PATCH 181/270] i missed this one alphaaaaaa --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9ded142b..608fd6ef 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2566,7 +2566,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, void onRobotIcon(cocos2d::CCObject* sender) = win 0x1286d0; void onSpiderIcon(cocos2d::CCObject* sender) = win 0x128890; void onDeathEffect(cocos2d::CCObject* sender) = win 0x128a50; - void onTrail(cocos2d::CCObject* sender) = win 0x128af0; + void onSpecialIcon(cocos2d::CCObject* sender) = win 0x128af0; void onShards(cocos2d::CCObject* sender) = win 0x12ad70; void onBack(cocos2d::CCObject* sender) = win 0x12adf0; void onShop(cocos2d::CCObject* sender) = win 0x12ad90; From 57a475b3b78ea6bff5e3ec38f11ce35f753b5ddf Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:43:21 +0300 Subject: [PATCH 182/270] add the logcat writer --- loader/src/internal/crashlog.cpp | 2 +- loader/src/internal/crashlog.hpp | 2 ++ loader/src/platform/android/crashlog.cpp | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/loader/src/internal/crashlog.cpp b/loader/src/internal/crashlog.cpp index 7f698616..76459efc 100644 --- a/loader/src/internal/crashlog.cpp +++ b/loader/src/internal/crashlog.cpp @@ -3,7 +3,7 @@ using namespace geode::prelude; -static std::string getDateString(bool filesafe) { +std::string crashlog::getDateString(bool filesafe) { auto const now = std::time(nullptr); auto const tm = *std::localtime(&now); std::ostringstream oss; diff --git a/loader/src/internal/crashlog.hpp b/loader/src/internal/crashlog.hpp index 4ed85293..4590bbc3 100644 --- a/loader/src/internal/crashlog.hpp +++ b/loader/src/internal/crashlog.hpp @@ -26,4 +26,6 @@ namespace crashlog { ghc::filesystem::path GEODE_DLL getCrashLogDirectory(); std::string GEODE_DLL writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers); + + std::string getDateString(bool filesafe); } diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index e1ed7bd9..2ceac82e 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -15,6 +15,10 @@ using namespace geode::prelude; #include #include + +#include +#include + #include "backtrace/execinfo.hpp" static constexpr size_t FRAME_SIZE = 64; @@ -413,6 +417,19 @@ ghc::filesystem::path crashlog::getCrashLogDirectory() { } bool crashlog::setupPlatformHandler() { + auto path = crashlog::getCrashLogDirectory() / (getDateString(true) + ".log"); + + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "writeLogcatCrashBuffer", "(Ljava/lang/String;)Z")) { + jstring stringArg1 = t.env->NewStringUTF(path.string().c_str()); + + jboolean result = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg1); + + t.env->DeleteLocalRef(stringArg1); + t.env->DeleteLocalRef(t.classID); + return result; + } + return false; } From 241fed492ca829e4a7cb363681d50b3d501a5b56 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:31:30 +0300 Subject: [PATCH 183/270] android crashlog implemented gg --- loader/src/internal/crashlog.cpp | 6 +- loader/src/internal/crashlog.hpp | 11 +++ loader/src/load.cpp | 2 + loader/src/platform/android/crashlog.cpp | 110 ++++++++++++++++++++--- loader/src/platform/mac/crashlog.mm | 2 + loader/src/platform/windows/crashlog.cpp | 2 + 6 files changed, 117 insertions(+), 16 deletions(-) diff --git a/loader/src/internal/crashlog.cpp b/loader/src/internal/crashlog.cpp index 76459efc..60240c7d 100644 --- a/loader/src/internal/crashlog.cpp +++ b/loader/src/internal/crashlog.cpp @@ -16,13 +16,13 @@ std::string crashlog::getDateString(bool filesafe) { return oss.str(); } -static void printGeodeInfo(std::stringstream& stream) { +void crashlog::printGeodeInfo(std::stringstream& stream) { stream << "Loader Version: " << Loader::get()->getVersion().toString() << "\n" << "Installed mods: " << Loader::get()->getAllMods().size() << "\n" << "Problems: " << Loader::get()->getProblems().size() << "\n"; } -static void printMods(std::stringstream& stream) { +void crashlog::printMods(std::stringstream& stream) { auto mods = Loader::get()->getAllMods(); if (mods.empty()) { stream << "\n"; @@ -30,7 +30,7 @@ static void printMods(std::stringstream& stream) { using namespace std::string_view_literals; for (auto& mod : mods) { stream << fmt::format("{} | [{}] {}\n", - mod->isEnabled() ? "x"sv : " "sv, + mod->isEnabled() ? "x"sv : mod->shouldLoad() ? "~"sv : " "sv, mod->getVersion().toString(), mod->getID() ); } diff --git a/loader/src/internal/crashlog.hpp b/loader/src/internal/crashlog.hpp index 4590bbc3..8174758f 100644 --- a/loader/src/internal/crashlog.hpp +++ b/loader/src/internal/crashlog.hpp @@ -13,6 +13,12 @@ namespace crashlog { * @returns True if the handler was successfully installed, false otherwise */ bool GEODE_DLL setupPlatformHandler(); + + /** + * Setup platform-specific crashlog handler for post-launch + */ + void GEODE_DLL setupPlatformHandlerPost(); + /** * Check if previous launch of GD crashed unexpectedly * @returns True if the launch crashed, false otherwise or if indeterminate @@ -28,4 +34,9 @@ namespace crashlog { std::string GEODE_DLL writeCrashlog(geode::Mod* faultyMod, std::string const& info, std::string const& stacktrace, std::string const& registers); std::string getDateString(bool filesafe); + + void printGeodeInfo(std::stringstream& stream); + void printMods(std::stringstream& stream); + + } diff --git a/loader/src/load.cpp b/loader/src/load.cpp index 85e05d42..09586af7 100644 --- a/loader/src/load.cpp +++ b/loader/src/load.cpp @@ -88,6 +88,8 @@ int geodeEntry(void* platformData) { return 1; } + crashlog::setupPlatformHandlerPost(); + log::info("Set up loader"); // download and install new loader update in the background diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index 2ceac82e..41c4e272 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -336,7 +336,7 @@ static void handlerThread() { log::debug("Notified"); } -static bool s_lastLaunchCrashed; +static bool s_lastLaunchCrashed = false; // bool crashlog::setupPlatformHandler() { // auto pidFile = crashlog::getCrashLogDirectory() / "last-pid"; @@ -413,28 +413,112 @@ static bool s_lastLaunchCrashed; // } ghc::filesystem::path crashlog::getCrashLogDirectory() { - return geode::dirs::getSaveDir(); + return dirs::getGeodeDir() / "crashlogs"; } -bool crashlog::setupPlatformHandler() { - auto path = crashlog::getCrashLogDirectory() / (getDateString(true) + ".log"); +int writeAndGetPid() { + auto pidFile = crashlog::getCrashLogDirectory() / "last-pid"; - JniMethodInfo t; - if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "writeLogcatCrashBuffer", "(Ljava/lang/String;)Z")) { - jstring stringArg1 = t.env->NewStringUTF(path.string().c_str()); + int lastPid = 0; - jboolean result = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg1); + if (ghc::filesystem::exists(pidFile)) { - t.env->DeleteLocalRef(stringArg1); - t.env->DeleteLocalRef(t.classID); - return result; + auto res = file::readString(pidFile); + if (!res) { + log::warn("Failed to read last-pid file: {}", res.error()); + } + else { + lastPid = std::stoi(res.unwrap()); + } + + std::error_code ec; + ghc::filesystem::remove(pidFile, ec); + + if (ec) { + log::warn("Failed to remove last-pid file: {}", ec.message()); + } } - return false; + auto res = file::writeString(pidFile, std::to_string(getpid())); + if (!res) { + log::warn("Failed to write last-pid file: {}", res.error()); + } + + return lastPid; +} + +void printModsAndroid(std::stringstream& stream) { + auto mods = Loader::get()->getAllMods(); + if (mods.empty()) { + stream << "\n"; + } + using namespace std::string_view_literals; + for (auto& mod : mods) { + stream << fmt::format("{} | [{}] {}\n", + mod->shouldLoad() ? "x"sv : " "sv, + mod->getVersion().toString(), mod->getID() + ); + } +} + +static std::string s_result; +bool crashlog::setupPlatformHandler() { + JniMethodInfo t; + + if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "getLogcatCrashBuffer", "()Ljava/lang/String;")) { + jstring stringResult = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID); + + s_result = JniHelper::jstring2string(stringResult); + + t.env->DeleteLocalRef(stringResult); + t.env->DeleteLocalRef(t.classID); + + if (s_result.empty()) { + return false; + } + } + else return false; + + auto lastPid = writeAndGetPid(); + + auto index = s_result.rfind(fmt::format("pid {}", lastPid)); + if (index != std::string::npos) { + auto begin = s_result.substr(0, index).rfind("F/libc"); + if (begin != std::string::npos) { + s_result = s_result.substr(begin); + } + s_lastLaunchCrashed = true; + + } + + return true; +} + +void crashlog::setupPlatformHandlerPost() { + if (s_result.empty()) return; + + std::stringstream ss; + ss << "Geode crashed!\n"; + ss << "Please submit this crash report to the developer of the mod that caused it.\n"; + ss << "\n== Geode Information ==\n"; + crashlog::printGeodeInfo(ss); + + ss << "\n== Installed Mods ==\n"; + printModsAndroid(ss); + + ss << "\n== Crash Report (Logcat) ==\n"; + ss << s_result; + + std::ofstream actualFile; + actualFile.open( + crashlog::getCrashLogDirectory() / (crashlog::getDateString(true) + ".log"), std::ios::app + ); + actualFile << ss.rdbuf() << std::flush; + actualFile.close(); } bool crashlog::didLastLaunchCrash() { - return false; + return s_lastLaunchCrashed; } #endif diff --git a/loader/src/platform/mac/crashlog.mm b/loader/src/platform/mac/crashlog.mm index 7a104e86..882f2961 100644 --- a/loader/src/platform/mac/crashlog.mm +++ b/loader/src/platform/mac/crashlog.mm @@ -382,6 +382,8 @@ bool crashlog::setupPlatformHandler() { return true; } +void crashlog::setupPlatformHandlerPost() {} + bool crashlog::didLastLaunchCrash() { return s_lastLaunchCrashed; } diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index 19784522..fb43eaa4 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -252,6 +252,8 @@ bool crashlog::didLastLaunchCrash() { return g_lastLaunchCrashed; } +void crashlog::setupPlatformHandlerPost() {} + ghc::filesystem::path crashlog::getCrashLogDirectory() { return dirs::getGeodeDir() / "crashlogs"; } From 69ac4649606742f9a12d433cba33efe0373fcc46 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:44:41 +0300 Subject: [PATCH 184/270] Add profilepage virtuals --- bindings/GeometryDash.bro | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 608fd6ef..77653256 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5437,6 +5437,22 @@ class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, Co virtual void keyBackClicked() = mac 0x464A60, win 0x49C80; void loadPageFromUserInfo(GJUserScore* score) = mac 0x460480, win 0x210040; + virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x463340; + virtual void commentDeleteFailed(int, int) = mac 0x4648e0; + virtual void commentUploadFailed(int, CommentError) = mac 0x464800; + virtual void commentUploadFinished(int) = mac 0x464770; + virtual void getUserInfoFinished(GJUserScore*) = mac 0x463cd0; + virtual void loadCommentsFailed(char const*) = mac 0x464340; + virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) = mac 0x464250; + virtual void onClosePopup(UploadActionPopup*) = mac 0x463510; + virtual void registerWithTouchDispatcher() = mac 0x464a60; + virtual void setupPageInfo(gd::string, char const*) = mac 0x464410; + virtual void show() = mac 0x4639c0; + virtual void updateUserScoreFailed() = mac 0x463920; + virtual void updateUserScoreFinished() = mac 0x463850; + virtual void uploadActionFailed(int, int) = mac 0x463710; + virtual void uploadActionFinished(int, int) = mac 0x463570; + GJUserScore* m_score; int m_accountID; PAD = mac 0x44, win 0x38, android 0x24; From 944ab383b48112ba5cd7def34a2100e6e0af0f09 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:48:40 +0300 Subject: [PATCH 185/270] funny virtual warning --- loader/include/Geode/ui/TextArea.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/include/Geode/ui/TextArea.hpp b/loader/include/Geode/ui/TextArea.hpp index c923d4e4..1fb1eea5 100644 --- a/loader/include/Geode/ui/TextArea.hpp +++ b/loader/include/Geode/ui/TextArea.hpp @@ -51,8 +51,8 @@ namespace geode { size_t getMaxLines(); void setWidth(const float width); float getWidth(); - void setScale(const float scale); - float getScale(); + void setScale(const float scale) override; + float getScale() override; void setLinePadding(const float padding); float getLinePadding(); std::vector getLines(); From bfe9e8d945a0e976952a2c0353f7d85cf46f309c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:59:43 +0300 Subject: [PATCH 186/270] windows profilepage virtuals --- bindings/GeometryDash.bro | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 77653256..5619fab3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5437,21 +5437,21 @@ class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, Co virtual void keyBackClicked() = mac 0x464A60, win 0x49C80; void loadPageFromUserInfo(GJUserScore* score) = mac 0x460480, win 0x210040; - virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x463340; - virtual void commentDeleteFailed(int, int) = mac 0x4648e0; - virtual void commentUploadFailed(int, CommentError) = mac 0x464800; - virtual void commentUploadFinished(int) = mac 0x464770; - virtual void getUserInfoFinished(GJUserScore*) = mac 0x463cd0; - virtual void loadCommentsFailed(char const*) = mac 0x464340; - virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) = mac 0x464250; - virtual void onClosePopup(UploadActionPopup*) = mac 0x463510; - virtual void registerWithTouchDispatcher() = mac 0x464a60; - virtual void setupPageInfo(gd::string, char const*) = mac 0x464410; - virtual void show() = mac 0x4639c0; - virtual void updateUserScoreFailed() = mac 0x463920; - virtual void updateUserScoreFinished() = mac 0x463850; - virtual void uploadActionFailed(int, int) = mac 0x463710; - virtual void uploadActionFinished(int, int) = mac 0x463570; + virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x463340, win 0x2128B0; + virtual void commentDeleteFailed(int, int) = mac 0x4648e0, win 0x213D20; + virtual void commentUploadFailed(int, CommentError) = mac 0x464800, win 0x213C40; + virtual void commentUploadFinished(int) = mac 0x464770, win 0x213B90; + virtual void getUserInfoFinished(GJUserScore*) = mac 0x463cd0, win 0x213350; + virtual void loadCommentsFailed(char const*) = mac 0x464340, win 0x2139A0; + virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) = mac 0x464250, win 0x213940; + virtual void onClosePopup(UploadActionPopup*) = mac 0x463510, win 0x2129F0; + virtual void registerWithTouchDispatcher() = mac 0x464a60, win 0x16990; + virtual void setupPageInfo(gd::string, char const*) = mac 0x464410, win 0x213A00; + virtual void show() = mac 0x4639c0, win 0x212d60; + virtual void updateUserScoreFailed() = mac 0x463920, win 0x212D20; + virtual void updateUserScoreFinished() = mac 0x463850, win 0x212C30; + virtual void uploadActionFailed(int, int) = mac 0x463710, win 0x212B20; + virtual void uploadActionFinished(int, int) = mac 0x463570, win 0x212A30; GJUserScore* m_score; int m_accountID; From 6a01f9bebbbb93a61336f9567f494f33c6465f14 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:16:46 +0300 Subject: [PATCH 187/270] Add changelog for 1.4.0 but i probably missed like 20 million things --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 094bce59..96e27d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Geode Changelog +## v1.4.0 + * Add Android support !!!! + * Implement every Geode functionality except openFolder + * Requires the Geode launcher in order to be used + * Fixes the text input node allowing typing for 1 less character + * Uses `logcat` in order to get crash reports, so reopening the game is required to generate them + * Broma requires classes to be added `[[link(android)]]` in order to be linked + * All Geode and GD files are stored in `Android/data/com.geode.launcher/files` + * Game files in `games`, save files in `save` + * Allow logging to be disabled per mod (6d599a5) + * Mod cells use layouts (114fa46) + * MacOS console is now separate (182984d) + * Add uninstall button to Geode mod (Only functional in Windows currently) (a738320) + * Make new version label invisible on download (0f179da) + * Fix the toggling of disabled dependencies (cd89ef1) + * Fix spritesheet issues (ef47647) + * Change `LoadingLayer` (ef47647) + * Make mod info popup top a layout (dd806e0) + * Add `GEODE_HIDDEN` to inline unique functions (71a79ab) + * Fix big mod icons (26a6c7e) + * Fix `CCNode::removeChildByID` export (23cd456) + * Make `MDTextArea` fit its size (140f38b) + * Enable ESC/Back to go back in Geode mod list (2847bee) + * Add `SimpleTextArea` (7f277a7) + * Check modified date when unzipping `.geode` files (5c765c6) + * Only hash markdown files on resource checking (f563c46) + ## v1.3.5 * Follow redirect in web::utils functions (a942a45) * Lots of bindings From 6cc010f43f2f6a1610b6ce6482c1ffd960d3e37d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:17:28 +0300 Subject: [PATCH 188/270] the funny no break space --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96e27d02..3d61cbbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Geode Changelog -## v1.4.0 +## v1.4.0 * Add Android support !!!! * Implement every Geode functionality except openFolder * Requires the Geode launcher in order to be used @@ -248,7 +248,7 @@ Thank you to [Fleeym](https://github.com/Fleeym/Fleeym) for contributing to this * Fix recursive comparison in VersionTag * `geode/unzipped` is now deleted on startup if it exists -## v1.0.0-beta.9 +## v1.0.0-beta.9 * Fix multiple modifiers not being able to have fields on same class due to having same field index * Add `Result::ok` and `Result::err` for converting the `Result` into `std::optional` @@ -316,7 +316,7 @@ Thank you to [Fleeym](https://github.com/Fleeym/Fleeym) for contributing to this - Something related to codegen and addresser? I have no clue what it does, so you probably won't have either - MacOS minimum version bumped to 10.14 -## v1.0.0-beta.2 +## v1.0.0-beta.2 * Fixed bug where `Mod::getSavedValue` would cause a crash due to trying operator on a null JSON value * Fixed bug where loading would crash if one of the mods' binaries failed to load From 089303345e1ba5adf1cb9c286e0d6a694dad941c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:19:17 +0300 Subject: [PATCH 189/270] fix the typo --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d61cbbc..33df95f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ ## v1.4.0 * Add Android support !!!! - * Implement every Geode functionality except openFolder + * Implement every Geode functionality except `utils::file::openFolder` * Requires the Geode launcher in order to be used * Fixes the text input node allowing typing for 1 less character * Uses `logcat` in order to get crash reports, so reopening the game is required to generate them * Broma requires classes to be added `[[link(android)]]` in order to be linked * All Geode and GD files are stored in `Android/data/com.geode.launcher/files` - * Game files in `games`, save files in `save` + * Game files in `game`, save files in `save` * Allow logging to be disabled per mod (6d599a5) * Mod cells use layouts (114fa46) * MacOS console is now separate (182984d) From 9558afa8a912dd453ae37bb1c15cdf66f35c477c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:51:08 +0300 Subject: [PATCH 190/270] remove unused codegen code in android --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1244fb93..317af9ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,6 +191,9 @@ target_compile_features(GeodeCodegenSources PUBLIC cxx_std_20) if (APPLE) target_compile_options(GeodeCodegenSources PUBLIC -ffunction-sections -fdata-sections) target_link_options(GeodeCodegenSources PUBLIC -dead_strip) +elseif(ANDROID) + target_compile_options(GeodeCodegenSources PUBLIC -ffunction-sections -fdata-sections) + target_link_options(GeodeCodegenSources PUBLIC -Wl,--gc-sections) endif() if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) From f8c5e9748b1455c512e70022eaa95235ff6c1f10 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:05:08 +0300 Subject: [PATCH 191/270] Strip debug symbols on release for android --- cmake/GeodeFile.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index a77f175a..401b4616 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -208,6 +208,17 @@ function(setup_geode_mod proname) set_target_properties(${proname} PROPERTIES PREFIX "") set_target_properties(${proname} PROPERTIES OUTPUT_NAME ${MOD_ID}) + if (ANDROID) + if (CMAKE_BUILD_TYPE STREQUAL "Release") + add_custom_command( + TARGET "${PROJECT_NAME}" POST_BUILD + DEPENDS "${PROJECT_NAME}" + COMMAND $<$:${CMAKE_STRIP}> + ARGS -S $ + ) + endif() + endif() + endfunction() function(create_geode_file proname) From cac2cbc7742cdf4b1dc3da0004d0bfc93e8f2e87 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:20:47 +0300 Subject: [PATCH 192/270] fix field alignment by doing max --- loader/include/Geode/modify/Field.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/loader/include/Geode/modify/Field.hpp b/loader/include/Geode/modify/Field.hpp index 8cf95add..82a7e751 100644 --- a/loader/include/Geode/modify/Field.hpp +++ b/loader/include/Geode/modify/Field.hpp @@ -1,9 +1,9 @@ #pragma once +#include "../utils/MiniFunction.hpp" #include "Traits.hpp" #include -#include "../utils/MiniFunction.hpp" #include #include @@ -49,8 +49,7 @@ namespace geode::modifier { } }; - [[deprecated("Will be removed in 1.0.0")]] - GEODE_DLL size_t getFieldIndexForClass(size_t hash); + [[deprecated("Will be removed in 1.0.0")]] GEODE_DLL size_t getFieldIndexForClass(size_t hash); GEODE_DLL size_t getFieldIndexForClass(char const* name); template @@ -58,7 +57,7 @@ namespace geode::modifier { using Intermediate = Modify; // Padding used for guaranteeing any member of parents // will be in between sizeof(Intermediate) and sizeof(Parent) - alignas(Base) uintptr_t m_padding; + alignas(std::max(alignof(Base), alignof(uintptr_t))) uintptr_t m_padding; public: // the constructor that constructs the fields. @@ -120,7 +119,7 @@ namespace geode::modifier { reinterpret_cast(offsetField) - sizeof(Intermediate) ); } - + Parent* self() { return this->operator Parent*(); } From 18a5dc706f58518548593fa48c193648e1562e85 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:27:00 +0300 Subject: [PATCH 193/270] remove the bandaid that no one knows what it does --- cmake/GeodeFile.cmake | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 401b4616..d4a59375 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -130,27 +130,14 @@ function(setup_geode_mod proname) set(HAS_HEADERS Off) endif() - # todo: figure out how to either not make cmake shit itself and print out --binary path/to/dll "" or - # make cli not shit itself when it sees that - if (HAS_HEADERS) - add_custom_target(${proname}_PACKAGE ALL - DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json - COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} - --binary $ $ - --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode - ${INSTALL_ARG} - VERBATIM USES_TERMINAL - ) - else() - add_custom_target(${proname}_PACKAGE ALL - DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json - COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} - --binary $ - --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode - ${INSTALL_ARG} - VERBATIM USES_TERMINAL - ) - endif() + add_custom_target(${proname}_PACKAGE ALL + DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json + COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} + --binary $ + --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode + ${INSTALL_ARG} + VERBATIM USES_TERMINAL + ) # Add dependency dir to include path if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/geode-deps") From 94b8b327669347c39fba3260468cddd77a8a8f7e Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:37:34 -0300 Subject: [PATCH 194/270] add android build to main workflow --- .github/workflows/build-android.yml | 57 ----------------------------- .github/workflows/build.yml | 48 ++++++++++++++++++++++-- .github/workflows/draft.yml | 2 + 3 files changed, 47 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/build-android.yml diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml deleted file mode 100644 index c74d522a..00000000 --- a/.github/workflows/build-android.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build Android - -on: - workflow_dispatch: - push: - branches: - - '**' # every branch - - '!no-build-**' # unless marked as no-build - -jobs: - build: - name: Build Android - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r26b - add-to-path: false - - - name: Download CLI - uses: robinraju/release-downloader@v1.8 - with: - repository: geode-sdk/cli - latest: true - fileName: '*-linux.zip' - tarBall: false - zipBall: false - out-file-path: "cli" - - - name: Setup CLI - run: | - 7z x "${{ github.workspace }}/cli/*-linux.zip" -o"${{ github.workspace }}/cli" - chmod +x $GITHUB_WORKSPACE/cli/geode - echo "${{ github.workspace }}/cli" >> $GITHUB_PATH - - - name: Configure - env: - NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - ANDROID_ABI: armeabi-v7a - MIN_SDK_VERSION: 24 - run: | - sudo apt install ninja-build - cmake -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=android-$MIN_SDK_VERSION -DCMAKE_BUILD_TYPE=Debug -DGEODE_DONT_BUILD_TEST_MODS=1 -G Ninja -B build - - - name: Build - run: | - cmake --build build --config Debug - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: geode-android - path: ./bin/nightly/*.so diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0cdd586..fd54c88e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: - name: Windows os: windows-latest id: win + cli_id: win extra_flags: -T host=x64 -A win32 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEODE_DEBUG=On # uncomment to use vs clang-cl and ninja #extra_flags: > @@ -34,6 +35,7 @@ jobs: - name: macOS os: macos-latest id: mac + cli_id: mac extra_flags: > -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ @@ -43,6 +45,21 @@ jobs: cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode' package_cmd: './installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg' installer_path: './installer/mac/geode-installer-mac.pkg' + + - name: Android + os: ubuntu-latest + id: android + cli_id: linux + extra_flags: > + -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake + -DANDROID_ABI=$ANDROID_ABI + -DANDROID_PLATFORM=android-$MIN_SDK_VERSION + -DGEODE_DONT_BUILD_TEST_MODS=1 + -G Ninja + cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode' + package_cmd: '' + installer_path: '' + name: Build ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} @@ -57,7 +74,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1 with: key: ${{ matrix.config.os }} - if: matrix.config.id == 'mac' + if: matrix.config.id != 'win' - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1.12.1 @@ -65,22 +82,38 @@ jobs: arch: amd64_x86 if: matrix.config.id == 'win' + - name: Setup NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26b + add-to-path: false + if: matrix.config.id == 'android' + - name: Download CLI uses: robinraju/release-downloader@v1.8 with: repository: geode-sdk/cli latest: true - fileName: '*-${{ matrix.config.id }}.zip' + fileName: '*-${{ matrix.config.cli_id }}.zip' tarBall: false zipBall: false out-file-path: "cli" - name: Setup CLI run: | - 7z x "${{ github.workspace }}/cli/*-${{ matrix.config.id }}.zip" -o"${{ github.workspace }}/cli" + 7z x "${{ github.workspace }}/cli/*-${{ matrix.config.cli_id }}.zip" -o"${{ github.workspace }}/cli" ${{ matrix.config.cli_cmd }} echo "${{ github.workspace }}/cli" >> $GITHUB_PATH + - name: Setup Android Env + run: | + echo "NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV" + echo "ANDROID_ABI=armeabi-v7a" >> "$GITHUB_ENV" + echo "MIN_SDK_VERSION=24" >> "$GITHUB_ENV" + sudo apt install ninja-build + if: matrix.config.id == 'android' + - name: Configure run: > cmake -B ${{ github.workspace }}/build @@ -101,12 +134,14 @@ jobs: - name: Package Installer run: ${{ matrix.config.package_cmd }} + if: matrix.config.id != 'android' - name: Upload Installer uses: actions/upload-artifact@v3 with: name: geode-installer-${{ matrix.config.id }} path: ${{ matrix.config.installer_path }} + if: matrix.config.id != 'android' publish: name: Publish @@ -146,6 +181,12 @@ jobs: files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb dest: geode-${{ steps.ref.outputs.hash }}-win.zip + - name: Zip Android Artifacts + uses: vimtor/action-zip@v1.1 + with: + files: geode-android/Geode.so + dest: geode-${{ steps.ref.outputs.hash }}-android.zip + - name: Zip Resources uses: vimtor/action-zip@v1.1 with: @@ -166,4 +207,5 @@ jobs: ./geode-installer-${{ steps.ref.outputs.hash }}-win.exe ./geode-${{ steps.ref.outputs.hash }}-mac.zip ./geode-${{ steps.ref.outputs.hash }}-win.zip + ./geode-${{ steps.ref.outputs.hash }}-android.zip ./resources.zip diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index d6051f79..f6bc7604 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -28,6 +28,7 @@ jobs: mv dev/geode-installer-*-win.exe geode-installer-v${{ steps.ref.outputs.version }}-win.exe mv dev/geode-*-mac.zip geode-v${{ steps.ref.outputs.version }}-mac.zip mv dev/geode-*-win.zip geode-v${{ steps.ref.outputs.version }}-win.zip + mv dev/geode-*-android.zip geode-v${{ steps.ref.outputs.version }}-android.zip mv dev/resources.zip resources.zip - name: Create Draft Release @@ -48,4 +49,5 @@ jobs: ./geode-installer-v${{ steps.ref.outputs.version }}-win.exe ./geode-v${{ steps.ref.outputs.version }}-mac.zip ./geode-v${{ steps.ref.outputs.version }}-win.zip + ./geode-v${{ steps.ref.outputs.version }}-android.zip ./resources.zip From 5ec0a6ad7f2e0dda2be2ad2104d8868294c6223b Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:40:24 +0300 Subject: [PATCH 195/270] Readd fod's thing that apparently adds the .lib --- cmake/GeodeFile.cmake | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index d4a59375..b11d5e9c 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -130,14 +130,26 @@ function(setup_geode_mod proname) set(HAS_HEADERS Off) endif() - add_custom_target(${proname}_PACKAGE ALL - DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json - COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} - --binary $ - --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode - ${INSTALL_ARG} - VERBATIM USES_TERMINAL - ) + if (HAS_HEADERS AND WIN32) + # this adds the .lib file on windows, which is needed for linking with the headers + add_custom_target(${proname}_PACKAGE ALL + DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json + COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} + --binary $ $ + --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode + ${INSTALL_ARG} + VERBATIM USES_TERMINAL + ) + else() + add_custom_target(${proname}_PACKAGE ALL + DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json + COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} + --binary $ + --output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode + ${INSTALL_ARG} + VERBATIM USES_TERMINAL + ) + endif() # Add dependency dir to include path if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/geode-deps") From 2f95a133bece84097ac63dacfc9a329340eafabc Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:08:20 -0300 Subject: [PATCH 196/270] change min sdk version to 23 --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd54c88e..f0ae16bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,8 +52,8 @@ jobs: cli_id: linux extra_flags: > -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake - -DANDROID_ABI=$ANDROID_ABI - -DANDROID_PLATFORM=android-$MIN_SDK_VERSION + -DANDROID_ABI=armeabi-v7a + -DANDROID_PLATFORM=android-23 -DGEODE_DONT_BUILD_TEST_MODS=1 -G Ninja cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode' @@ -109,8 +109,6 @@ jobs: - name: Setup Android Env run: | echo "NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV" - echo "ANDROID_ABI=armeabi-v7a" >> "$GITHUB_ENV" - echo "MIN_SDK_VERSION=24" >> "$GITHUB_ENV" sudo apt install ninja-build if: matrix.config.id == 'android' From 619fb6aa6966a98cd3a3b6fe1df83acf886a9a4a Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 15 Oct 2023 18:47:32 +0200 Subject: [PATCH 197/270] Bindings: Fix ProfilePage and CommentCell virtuals --- bindings/GeometryDash.bro | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 5619fab3..29cd7568 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -937,8 +937,8 @@ class CommentCell : TableViewCell, LikeItemDelegate, FLAlertLayerProtocol { void loadFromComment(GJComment*) = mac 0x111c70, win 0x5f3d0; void onConfirmDelete(cocos2d::CCObject* sender) = mac 0x11d100, win 0x61140; void onLike(cocos2d::CCObject* sender) = mac 0x11d000, win 0x60F90; - virtual void FLAlert_Clicked(FLAlertLayer* layer, bool btn) = mac 0x11d540, win 0x61260; virtual void likedItem(LikeItemType type, int id, bool special) = mac 0x11d340, win 0x61070; + virtual void FLAlert_Clicked(FLAlertLayer* layer, bool btn) = mac 0x11d540, win 0x61260; cocos2d::CCSprite* m_iconSprite; cocos2d::CCLabelBMFont* m_likeLabel; @@ -5428,30 +5428,30 @@ class PointNode : cocos2d::CCObject { [[link(android)]] class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate { static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50; - virtual void getUserInfoFailed(int) = mac 0x463FB0, win 0x2133e0; - virtual void userInfoChanged(GJUserScore*) = mac 0x464070, win 0x213430; bool init(int accountID, bool idk) = mac 0x45f170, win 0x20ef00; void onMyLevels(cocos2d::CCObject*) = mac 0x462d70, win 0x211bb0; void onUpdate(cocos2d::CCObject*) = mac 0x460150, win 0x20fa20; void onClose(cocos2d::CCObject*) = mac 0x45fd20, win 0x49C60; - virtual void keyBackClicked() = mac 0x464A60, win 0x49C80; void loadPageFromUserInfo(GJUserScore* score) = mac 0x460480, win 0x210040; - virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x463340, win 0x2128B0; - virtual void commentDeleteFailed(int, int) = mac 0x4648e0, win 0x213D20; - virtual void commentUploadFailed(int, CommentError) = mac 0x464800, win 0x213C40; - virtual void commentUploadFinished(int) = mac 0x464770, win 0x213B90; - virtual void getUserInfoFinished(GJUserScore*) = mac 0x463cd0, win 0x213350; - virtual void loadCommentsFailed(char const*) = mac 0x464340, win 0x2139A0; - virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) = mac 0x464250, win 0x213940; - virtual void onClosePopup(UploadActionPopup*) = mac 0x463510, win 0x2129F0; virtual void registerWithTouchDispatcher() = mac 0x464a60, win 0x16990; - virtual void setupPageInfo(gd::string, char const*) = mac 0x464410, win 0x213A00; + virtual void keyBackClicked() = mac 0x464A60, win 0x49C80; virtual void show() = mac 0x4639c0, win 0x212d60; - virtual void updateUserScoreFailed() = mac 0x463920, win 0x212D20; + virtual void FLAlert_Clicked(FLAlertLayer*, bool) = mac 0x463340, win 0x2128B0; virtual void updateUserScoreFinished() = mac 0x463850, win 0x212C30; - virtual void uploadActionFailed(int, int) = mac 0x463710, win 0x212B20; + virtual void updateUserScoreFailed() = mac 0x463920, win 0x212D20; + virtual void getUserInfoFinished(GJUserScore*) = mac 0x463cd0, win 0x213350; + virtual void getUserInfoFailed(int) = mac 0x463FB0, win 0x2133e0; + virtual void userInfoChanged(GJUserScore*) = mac 0x464070, win 0x213430; + virtual void loadCommentsFinished(cocos2d::CCArray*, char const*) = mac 0x464250, win 0x213940; + virtual void loadCommentsFailed(char const*) = mac 0x464340, win 0x2139A0; + virtual void setupPageInfo(gd::string, char const*) = mac 0x464410, win 0x213A00; + virtual void commentUploadFinished(int) = mac 0x464770, win 0x213B90; + virtual void commentUploadFailed(int, CommentError) = mac 0x464800, win 0x213C40; + virtual void commentDeleteFailed(int, int) = mac 0x4648e0, win 0x213D20; + virtual void onClosePopup(UploadActionPopup*) = mac 0x463510, win 0x2129F0; virtual void uploadActionFinished(int, int) = mac 0x463570, win 0x212A30; + virtual void uploadActionFailed(int, int) = mac 0x463710, win 0x212B20; GJUserScore* m_score; int m_accountID; From 9694b35d774e133ec517ca0d4f6dab281e5dcebe Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:59:33 +0200 Subject: [PATCH 198/270] Fix FLAlertLayer m_scrollingLayer not being a ScrollingLayer --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9f529127..62e507a9 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1746,7 +1746,7 @@ class FLAlertLayer : cocos2d::CCLayerColor { cocos2d::ccColor3B m_color2; ButtonSprite* m_button1; ButtonSprite* m_button2; - cocos2d::CCLayerColor* m_scrollingLayer; + ScrollingLayer* m_scrollingLayer; int m_joystickConnected; bool m_containsBorder; bool m_noAction; From c783a02f3fcfbb8b22ef679b54a10f2444bc0dfb Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:02:28 +0200 Subject: [PATCH 199/270] add virtual CCBlockLayer::customSetup --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 29cd7568..688919ee 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -308,6 +308,7 @@ class CCBlockLayer : cocos2d::CCLayerColor { virtual bool init() = mac 0x2a59c0, win 0x168d0; virtual void draw() = mac 0x2a5c20, win 0x16a80; // same as GJDropDownLayer virtual void registerWithTouchDispatcher() = mac 0x2a5ad0, win 0x16990; // shared with many + virtual void customSetup() = win 0x7640; virtual void enterLayer() = mac 0x2a5aa0, win 0x16970; virtual void exitLayer() = mac 0x2a5b40, win 0x169e0; // same as PauseLayer, EditorPauseLayer virtual void showLayer(bool) = mac 0x2a5b90, win 0x16a20; // same as PauseLayer, EditorPauseLayer From d181260a9b231908d77c78e177a3f5785f03baf7 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:16:51 +0200 Subject: [PATCH 200/270] Add some ScrollingLayer members --- bindings/GeometryDash.bro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 62e507a9..cb4535c8 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5291,6 +5291,8 @@ class RingObject : EffectGameObject { class ScrollingLayer : cocos2d::CCLayerColor { static ScrollingLayer* create(cocos2d::CCSize, cocos2d::CCPoint, float) = mac 0x41a900, win 0x2d8e0; + cocos2d::CCLayer* m_scrollLayer; + cocos2d::CCNode* m_parent; } class SelectArtLayer { From f74d434f46e217d1179fc31b992eefe6fcde83f9 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:31:29 +0200 Subject: [PATCH 201/270] Add m_layerHeight --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cb4535c8..9732c7ab 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5293,6 +5293,7 @@ class ScrollingLayer : cocos2d::CCLayerColor { static ScrollingLayer* create(cocos2d::CCSize, cocos2d::CCPoint, float) = mac 0x41a900, win 0x2d8e0; cocos2d::CCLayer* m_scrollLayer; cocos2d::CCNode* m_parent; + float m_layerHeight; } class SelectArtLayer { From 11d61c65f67bfabc6a6f96a7ba3644d75e4de766 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:41:41 +0200 Subject: [PATCH 202/270] Add pad thingys --- bindings/GeometryDash.bro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9732c7ab..cefdea68 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5291,9 +5291,11 @@ class RingObject : EffectGameObject { class ScrollingLayer : cocos2d::CCLayerColor { static ScrollingLayer* create(cocos2d::CCSize, cocos2d::CCPoint, float) = mac 0x41a900, win 0x2d8e0; + PAD = win 0x28; + float m_layerHeight; + PAD = win 0x4; cocos2d::CCLayer* m_scrollLayer; cocos2d::CCNode* m_parent; - float m_layerHeight; } class SelectArtLayer { From bbec2c4d732f2ac26c5888792b63141e5d55c4d0 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Mon, 16 Oct 2023 15:10:15 +0200 Subject: [PATCH 203/270] Bindings: Fix DailyLevelPage updateTimers calling convention --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 688919ee..114afdd1 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1169,7 +1169,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, LevelDownloadDelegate { static DailyLevelPage* create(bool weekly) = mac 0x108ac0, win 0x6a860; bool init(bool weekly) = mac 0x108C90, win 0x6a900; - void updateTimers(float) = mac 0x109780, win 0x6bef0; + callback void updateTimers(float) = mac 0x109780, win 0x6bef0; virtual void show() = mac 0x10a4b0, win 0x3f360; PAD = mac 0x29, win 0x15, android 0x15; From 6f2044ca92c070045104d7efe0a1f81fb313828d Mon Sep 17 00:00:00 2001 From: Cvolton Date: Mon, 16 Oct 2023 17:15:05 +0200 Subject: [PATCH 204/270] add missing GJRewardTypes --- loader/include/Geode/Enums.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp index c7fd1006..2e0983aa 100644 --- a/loader/include/Geode/Enums.hpp +++ b/loader/include/Geode/Enums.hpp @@ -295,7 +295,9 @@ enum class GJRewardType { Unknown = 0x0, Small = 0x1, - Large = 0x2 + Large = 0x2, + SmallTreasure = 0x3, + LargeTreasure = 0x4 }; enum class IconType { From 8ca3b9fce2dbaa87a2d75549abc89a46a5303967 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:47:20 +0300 Subject: [PATCH 205/270] thank you cvolton --- loader/src/ui/internal/GeodeUI.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/loader/src/ui/internal/GeodeUI.cpp b/loader/src/ui/internal/GeodeUI.cpp index 99d936b2..9a599c1f 100644 --- a/loader/src/ui/internal/GeodeUI.cpp +++ b/loader/src/ui/internal/GeodeUI.cpp @@ -17,18 +17,13 @@ void geode::openIssueReportPopup(Mod* mod) { if (mod->getMetadata().getIssues()) { MDPopup::create( "Issue Report", - mod->getMetadata().getIssues().value().info + - "\n\n" + "Please report the issue to the mod that caused the crash.\n" "If your issue relates to a game crash, please include the " "latest crash log(s) from `" + dirs::getCrashlogsDir().string() + "`", - "OK", (mod->getMetadata().getIssues().value().url ? "Open URL" : ""), + "OK", "", [mod](bool btn2) { - if (btn2) { - web::openLinkInBrowser( - mod->getMetadata().getIssues().value().url.value() - ); - } + } )->show(); } From 8c74e3357f2b39f0341af3cd2ecbd524bd27ef88 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:48:38 +0300 Subject: [PATCH 206/270] thank you mat --- loader/src/ui/internal/GeodeUI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/src/ui/internal/GeodeUI.cpp b/loader/src/ui/internal/GeodeUI.cpp index 9a599c1f..c6db6ad1 100644 --- a/loader/src/ui/internal/GeodeUI.cpp +++ b/loader/src/ui/internal/GeodeUI.cpp @@ -21,9 +21,9 @@ void geode::openIssueReportPopup(Mod* mod) { "If your issue relates to a game crash, please include the " "latest crash log(s) from `" + dirs::getCrashlogsDir().string() + "`", - "OK", "", + "OK", "Open Folder", [mod](bool btn2) { - + utils::openFolder(dirs::getCrashlogsDir()) } )->show(); } From 17f892169c9822da86302eaa17d098d3ecce3279 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:48:47 +0300 Subject: [PATCH 207/270] i forgot semicolon --- loader/src/ui/internal/GeodeUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/ui/internal/GeodeUI.cpp b/loader/src/ui/internal/GeodeUI.cpp index c6db6ad1..a0622728 100644 --- a/loader/src/ui/internal/GeodeUI.cpp +++ b/loader/src/ui/internal/GeodeUI.cpp @@ -23,7 +23,7 @@ void geode::openIssueReportPopup(Mod* mod) { dirs::getCrashlogsDir().string() + "`", "OK", "Open Folder", [mod](bool btn2) { - utils::openFolder(dirs::getCrashlogsDir()) + utils::openFolder(dirs::getCrashlogsDir()); } )->show(); } From 902385fd1b9415c7e5a400a8cb8d699fc6f2b281 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:49:28 +0300 Subject: [PATCH 208/270] fix namespace --- loader/src/ui/internal/GeodeUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/ui/internal/GeodeUI.cpp b/loader/src/ui/internal/GeodeUI.cpp index a0622728..e5104989 100644 --- a/loader/src/ui/internal/GeodeUI.cpp +++ b/loader/src/ui/internal/GeodeUI.cpp @@ -23,7 +23,7 @@ void geode::openIssueReportPopup(Mod* mod) { dirs::getCrashlogsDir().string() + "`", "OK", "Open Folder", [mod](bool btn2) { - utils::openFolder(dirs::getCrashlogsDir()); + file::openFolder(dirs::getCrashlogsDir()); } )->show(); } From b7d475b526012aad7c143b8188b1190098c498ea Mon Sep 17 00:00:00 2001 From: Catto_ <57293929+CattoDev@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:58:23 +0200 Subject: [PATCH 209/270] Mac bindings --- bindings/GeometryDash.bro | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cefdea68..a9a68361 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -253,7 +253,7 @@ class ButtonSprite : cocos2d::CCSprite { void updateBGImage(const char*) = mac 0x502d0, win 0x13af0; static ButtonSprite* create(char const*, float) = mac 0x4fa60; void setString(const char* txt) = mac 0x4fec0, win 0x14030; - void updateSpriteBGSize() = win 0x13c00; + void updateSpriteBGSize() = mac 0x4f5d0, win 0x13c00; void setColor(cocos2d::ccColor3B color) = mac 0x50410, win 0x143e0; PAD = mac 0x18, win 0x18; @@ -261,7 +261,7 @@ class ButtonSprite : cocos2d::CCSprite { cocos2d::CCSprite* m_subSprite; cocos2d::CCSprite* m_subBGSprite; cocos2d::extension::CCScale9Sprite* m_BGSprite; - PAD = win 0x8; + PAD = mac 0xC, win 0x8; cocos2d::CCPoint m_spritePosition; } @@ -1021,12 +1021,12 @@ class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerPro void updatePlaybackBtn() = win 0x69970; void updateSongInfo() = win 0x69bf0; void updateSongObject(SongInfoObject* song) = win 0x69280, mac 0x37d690; - void onCancelDownload(CCObject*) = win 0x693b0; - void onDownload(CCObject*) = win 0x69540; - void onGetSongInfo(CCObject*) = win 0x69490; - void onMore(CCObject*) = win 0x68e20; - void onPlayback(CCObject*) = win 0x697b0; - void onSelect(CCObject*) = win 0x69760; + void onCancelDownload(cocos2d::CCObject*) = win 0x693b0; + void onDownload(cocos2d::CCObject*) = win 0x69540; + void onGetSongInfo(cocos2d::CCObject*) = win 0x69490; + void onMore(cocos2d::CCObject*) = win 0x68e20; + void onPlayback(cocos2d::CCObject*) = win 0x697b0; + void onSelect(cocos2d::CCObject*) = win 0x69760; SongInfoObject* m_songInfo; cocos2d::CCMenu* m_buttonMenu; @@ -1448,8 +1448,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void onPasteState(cocos2d::CCObject* sender) = mac 0x19ee0, win 0x884c0; void onGroupSticky(cocos2d::CCObject* sender) = mac 0xc180, win 0x87a80; void onUngroupSticky(cocos2d::CCObject* sender) = mac 0xc1d0, win 0x87ac0; - void onGoToLayer(cocos2d::CCObject* sender) = win 0x886b0; - void onGoToBaseLayer(cocos2d::CCObject* sender) = win 0x88790; + void onGoToLayer(cocos2d::CCObject* sender) = mac 0x19fa0, win 0x886b0; + void onGoToBaseLayer(cocos2d::CCObject* sender) = mac 0x1a270, win 0x88790; void onToggleGuide(cocos2d::CCObject* sender) = mac 0x19da0, win 0x79160; void editColor(cocos2d::CCObject* sender) = mac 0x19190, win 0x8d3c0; void alignObjects(cocos2d::CCArray* objs, bool alignY) = mac 0x2cea0, win 0x8f320; From 836307c9ff7f3eb04792608ea558e297e2ac7fec Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:54:45 -0400 Subject: [PATCH 210/270] Add bindings --- bindings/GeometryDash.bro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index a9a68361..1542452e 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1240,6 +1240,7 @@ class EditButtonBar : cocos2d::CCNode { int rowCount, int columnCount ) = mac 0x350e60, win 0x6e450; + bool init(cocos2d::CCArray* buttons, int, bool, int rowCount, int columnCount, cocos2d::CCPoint pos) = win 0x6e550; cocos2d::CCPoint m_position; int m_unknown; bool m_unknownBool; @@ -1414,6 +1415,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void editGroup(cocos2d::CCObject* sender) = win 0x8d720; void moveObjectCall(cocos2d::CCObject* sender) = mac 0x29830, win 0x8db30; void moveObjectCall(EditCommand command) = mac 0x29b80, win 0x8db50; + cocos2d::CCPoint* moveForCommand(cocos2d::CCPoint* point, EditCommand command) = win 0x8d890; void transformObjectCall(cocos2d::CCObject* sender) = mac 0x29860, win 0x8def0; void transformObjectCall(EditCommand command) = mac 0x29d90, win 0x8df10; void transformObject(GameObject* obj, EditCommand command, bool snap) = mac 0x2b0b0, win 0x8e250; From 043e5a0a2ee4ac2de56f6b66a99b3dc4ef27c360 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 22 Oct 2023 15:16:29 +0200 Subject: [PATCH 211/270] Fix PAD in GJGarageLayer (#312) --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 1542452e..701d1813 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2479,7 +2479,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, void setupColorSelect() = mac 0x1b7500; void showCircleWave() = win 0x12aad0; void showBlackCircleWave() = win 0x12a9d0; - PAD = mac 0x10, win 0x8; + PAD = mac 0x10, win 0x4; CCTextInputNode* m_nameInput; SimplePlayer* m_playerPreview; PAD = mac 0x10, win 0x8; From 626b86c328597686a3198de38319a2c900f6f2d0 Mon Sep 17 00:00:00 2001 From: Sergei Baigerov Date: Sun, 22 Oct 2023 21:17:17 +0800 Subject: [PATCH 212/270] Add RateLevelLayer and other bindings --- bindings/GeometryDash.bro | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 701d1813..8b8bd4e8 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4096,6 +4096,8 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300; void updateLabelValues() = mac 0x164090, win 0x17b170; + void onRate(cocos2d::CCObject* sender) = win 0x17a530; + PAD = win 0x4, mac 0x8; cocos2d::CCMenu* m_playBtnMenu; GJGameLevel* m_level; @@ -5264,8 +5266,15 @@ class RateStarsLayer : FLAlertLayer, UploadPopupDelegate, UploadActionDelegate { UploadActionPopup* m_rateAction; RateLevelDelegate* m_rateDelegate; - static RateStarsLayer* create(int levelID, bool isModSuggest) = mac 0x135e50; - bool init(int levelID, bool isModSuggest) = mac 0x136050; + static RateStarsLayer* create(int levelID, bool isModSuggest) = mac 0x135e50, win 0x2155f0; + bool init(int levelID, bool isModSuggest) = mac 0x136050, win 0x2156a0; +} + +class RateLevelLayer : FLAlertLayer { + RateLevelLayer() = win 0x214a80; + virtual ~RateLevelLayer() = win 0x214b40; + + bool init(int levelID) = win 0x214cb0; } class RetryLevelLayer { From 746966c423215f394d8c9b1195f4cd8b926807fd Mon Sep 17 00:00:00 2001 From: Mazin Eltahawy <115370428+meltah@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:38:09 +0300 Subject: [PATCH 213/270] Make `CCTextInputNode` work in nested hierarchies (#317) --- loader/src/hooks/CCTextInputNode.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 loader/src/hooks/CCTextInputNode.cpp diff --git a/loader/src/hooks/CCTextInputNode.cpp b/loader/src/hooks/CCTextInputNode.cpp new file mode 100644 index 00000000..eb488f8b --- /dev/null +++ b/loader/src/hooks/CCTextInputNode.cpp @@ -0,0 +1,27 @@ +#include + +using namespace geode::prelude; + +// rob only uses `CCTextInputNode`s in mostly-flat hierarchies, which still +// happen to work with the weird vanilla code. this fix makes it work even in +// deep hierarchies, because the vanilla code uses `getParent` and manually +// calculates the child location in the world space based on that rather than +// using `convertToNodeSpace`. + +struct CCTextInputNodeFix : Modify { + bool ccTouchBegan(CCTouch* touch, CCEvent* event) { + CCPoint pos = this->convertTouchToNodeSpace(touch); + CCSize size = this->getContentSize(); + + pos += m_textField->getAnchorPoint() * size; + + if (pos.x < 0 || pos.x > size.width || pos.y < 0 || pos.y > size.height) + return false; + if (!m_delegate->allowTextInput(this)) + return false; + + this->onClickTrackNode(true); + + return true; + } +}; From 2d8e988ce3fcdc2197c1466e1967aa84b0cdcb32 Mon Sep 17 00:00:00 2001 From: Mazin Eltahawy <115370428+meltah@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:46:21 +0300 Subject: [PATCH 214/270] Add null check for `m_delegate` (#318) * fix formatting * Add null check for `m_delegate` --------- Co-authored-by: Mazin Eltahawy Co-authored-by: mat <26722564+matcool@users.noreply.github.com> --- loader/src/hooks/CCTextInputNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/hooks/CCTextInputNode.cpp b/loader/src/hooks/CCTextInputNode.cpp index eb488f8b..950474e0 100644 --- a/loader/src/hooks/CCTextInputNode.cpp +++ b/loader/src/hooks/CCTextInputNode.cpp @@ -17,7 +17,7 @@ struct CCTextInputNodeFix : Modify { if (pos.x < 0 || pos.x > size.width || pos.y < 0 || pos.y > size.height) return false; - if (!m_delegate->allowTextInput(this)) + if (m_delegate && !m_delegate->allowTextInput(this)) return false; this->onClickTrackNode(true); From d6de1187d36cc45ae2520085f4800e5ee4059a62 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 22 Oct 2023 10:53:40 -0300 Subject: [PATCH 215/270] avoid convertTouchToNodeSpace because of mac --- loader/src/hooks/CCTextInputNode.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/loader/src/hooks/CCTextInputNode.cpp b/loader/src/hooks/CCTextInputNode.cpp index 950474e0..b94681f1 100644 --- a/loader/src/hooks/CCTextInputNode.cpp +++ b/loader/src/hooks/CCTextInputNode.cpp @@ -10,10 +10,9 @@ using namespace geode::prelude; struct CCTextInputNodeFix : Modify { bool ccTouchBegan(CCTouch* touch, CCEvent* event) { - CCPoint pos = this->convertTouchToNodeSpace(touch); - CCSize size = this->getContentSize(); - - pos += m_textField->getAnchorPoint() * size; + auto const touchPos = touch->getLocation(); + auto const size = this->getContentSize(); + auto const pos = this->convertToNodeSpace(touchPos) + m_textField->getAnchorPoint() * size; if (pos.x < 0 || pos.x > size.width || pos.y < 0 || pos.y > size.height) return false; From b17ca9ae4bb3faec3519b1831a9300b5d82c4daf Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 11:01:14 -0500 Subject: [PATCH 216/270] docs change lmao --- loader/include/Geode/utils/web.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/web.hpp b/loader/include/Geode/utils/web.hpp index f87313d4..b64c63a3 100644 --- a/loader/include/Geode/utils/web.hpp +++ b/loader/include/Geode/utils/web.hpp @@ -194,7 +194,7 @@ namespace geode::utils::web { * URL to fetch from the internet asynchronously * @param url URL of the data to download. Redirects will be * automatically followed - * @returns Same AsyncWebRequest + * @returns An AsyncWebResponse object */ AsyncWebResponse fetch(std::string const& url); /** From 23bfc22d1159286546f52cece509954fc0e80abb Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 11:50:58 -0500 Subject: [PATCH 217/270] someone made an oopsie in SentAsyncWebRequest::Impl's constructor --- loader/src/utils/web.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 7675f46c..6bfea64d 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -187,7 +187,7 @@ static std::unordered_map RUNNING_REQUES static std::mutex RUNNING_REQUESTS_MUTEX; SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const& req, std::string const& id) : - m_id(id), m_url(req.m_url), m_target(req.m_target), m_extra(req.extra()), m_httpHeaders(req.m_httpHeaders) { + m_self(self), m_id(id), m_url(req.m_url), m_target(req.m_target), m_extra(req.extra()), m_httpHeaders(req.m_httpHeaders) { #define AWAIT_RESUME() \ {\ @@ -296,6 +296,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const } return 1; } + Loader::get()->queueInMainThread([self = data->self, now, total]() { std::lock_guard _(self->m_mutex); for (auto& prog : self->m_progresses) { From 278869ec68fc45e42e949b38e0503bf012e35941 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:41:20 -0500 Subject: [PATCH 218/270] add my binding --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2bf7c1d3..9ea588aa 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1061,6 +1061,7 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G bool init(LevelSettingsObject*) = mac 0xf06f0, win 0x65c10; void onArtists(cocos2d::CCObject*) = mac 0xf1950; void onSongBrowser(cocos2d::CCObject*) = mac 0xf18a0, win 0x67080; + void onSearch(cocos2d::CCObject*) = mac 0xf1ad0, win 0x66de0; LevelSettingsObject* m_levelSettings; CCTextInputNode* m_songIDInput; From 9cae54679756b993cf9d6b17215ff51c19c7ceaf Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:43:15 -0500 Subject: [PATCH 219/270] add binding --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e6239966..91387bac 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -998,6 +998,7 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G bool init(LevelSettingsObject*) = mac 0xf06f0, win 0x65c10; void onArtists(cocos2d::CCObject*) = mac 0xf1950; void onSongBrowser(cocos2d::CCObject*) = mac 0xf18a0, win 0x67080; + void onSearch(cocos2d::CCObject*) = mac 0xf1ad0, win 0x66de0; LevelSettingsObject* m_levelSettings; CCTextInputNode* m_songIDInput; From 9186ecadc51dcde0ebf85306aaa691552838ff77 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 14:57:59 -0500 Subject: [PATCH 220/270] add thing --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9ea588aa..2ae29af0 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1017,7 +1017,7 @@ class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, Dialo void onTreasureRoom(cocos2d::CCObject*) = win 0x4f540; virtual void sceneWillResume() = mac 0x1438F0, win 0x4fb50; virtual bool init() = mac 0x141c10, win 0x4de40; - static CreatorLayer* create() = win 0x4dda0; + static CreatorLayer* create() = mac 0x141b10, win 0x4dda0; } [[link(android)]] From 62b06c26156b1e7fef060cc65f27e95b8ed450bc Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 22 Oct 2023 15:00:01 -0500 Subject: [PATCH 221/270] creator layer symbol --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index dabc81c0..0c681d69 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -965,7 +965,7 @@ class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, Dialo void onTreasureRoom(cocos2d::CCObject*) = win 0x4f540; virtual void sceneWillResume() = mac 0x1438F0, win 0x4fb50; virtual bool init() = mac 0x141c10, win 0x4de40; - static CreatorLayer* create() = win 0x4dda0; + static CreatorLayer* create() = mac 0x141b10, win 0x4dda0; } class CurrencyRewardLayer : cocos2d::CCLayer { From 27ed63e71009623e9a9f605b5c0a565b3a6f730e Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:12:09 -0300 Subject: [PATCH 222/270] Bump minimum required CMake version in codegen gets rid of a warning :-) --- codegen/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/CMakeLists.txt b/codegen/CMakeLists.txt index 2e3833a5..ab311f5f 100644 --- a/codegen/CMakeLists.txt +++ b/codegen/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.21 FATAL_ERROR) project(Codegen LANGUAGES C CXX) include(../cmake/CPM.cmake) From fdd78aca3fa0a8aa69968a7ffd5b594482697f57 Mon Sep 17 00:00:00 2001 From: dank_meme01 Date: Mon, 23 Oct 2023 23:19:15 +0200 Subject: [PATCH 223/270] display messages of unhandled c++ exceptions --- loader/src/platform/windows/crashlog.cpp | 63 +++++++++++++++---- .../src/platform/windows/ehdata_structs.hpp | 46 ++++++++++++++ 2 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 loader/src/platform/windows/ehdata_structs.hpp diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index 19784522..a2fb66c9 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -20,6 +20,7 @@ #include #include #include +#include "ehdata_structs.hpp" using namespace geode::prelude; @@ -199,19 +200,55 @@ static std::string getRegisters(PCONTEXT context) { static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) { std::stringstream stream; - stream << "Faulty Module: " - << getModuleName(handleFromAddress(info->ExceptionRecord->ExceptionAddress), true) - << "\n" - << "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "") << "\n" - << "Exception Code: " << std::hex << info->ExceptionRecord->ExceptionCode << " (" - << getExceptionCodeString(info->ExceptionRecord->ExceptionCode) << ")" << std::dec - << "\n" - << "Exception Flags: " << info->ExceptionRecord->ExceptionFlags << "\n" - << "Exception Address: " << info->ExceptionRecord->ExceptionAddress << " ("; - printAddr(stream, info->ExceptionRecord->ExceptionAddress, false); - stream << ")" - << "\n" - << "Number Parameters: " << info->ExceptionRecord->NumberParameters << "\n"; + + if (info->ExceptionRecord->ExceptionCode == EH_EXCEPTION_NUMBER) { + // This executes when a C++ exception was thrown and not handled. + // https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273 + + bool isStdException = false; + + auto exceptionRecord = info->ExceptionRecord; + auto exceptionObject = exceptionRecord->ExceptionInformation[1]; + + auto throwInfo = reinterpret_cast<_ThrowInfo*>(exceptionRecord->ExceptionInformation[2]); + auto catchableTypeArray = reinterpret_cast<_CatchableTypeArray*>(throwInfo->pCatchableTypeArray); + auto ctaSize = catchableTypeArray->nCatchableTypes; + + for (int i = 0; i < ctaSize; i++) { + auto catchableType = reinterpret_cast<_CatchableType*>(catchableTypeArray->arrayOfCatchableTypes[i]); + auto ctDescriptor = reinterpret_cast<_TypeDescriptor*>(catchableType->pType); + auto classname = ctDescriptor->name; + + if (strcmp(classname, ".?AVexception@std@@") == 0) { + isStdException = true; + break; + } + } + + if (isStdException) { + auto excObject = reinterpret_cast(exceptionObject); + // stream << "C++ Exception Type: " << typeid(excObject).name() << "\n"; // always const std::exception * + stream << "C++ Exception: " << excObject->what() << "\n"; + } else { + stream << "C++ Exception: \n"; + } + + stream << "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "") << "\n"; + } else { + stream << "Faulty Module: " + << getModuleName(handleFromAddress(info->ExceptionRecord->ExceptionAddress), true) + << "\n" + << "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "") << "\n" + << "Exception Code: " << std::hex << info->ExceptionRecord->ExceptionCode << " (" + << getExceptionCodeString(info->ExceptionRecord->ExceptionCode) << ")" << std::dec + << "\n" + << "Exception Flags: " << info->ExceptionRecord->ExceptionFlags << "\n" + << "Exception Address: " << info->ExceptionRecord->ExceptionAddress << " ("; + printAddr(stream, info->ExceptionRecord->ExceptionAddress, false); + stream << ")" + << "\n" + << "Number Parameters: " << info->ExceptionRecord->NumberParameters << "\n"; + } return stream.str(); } diff --git a/loader/src/platform/windows/ehdata_structs.hpp b/loader/src/platform/windows/ehdata_structs.hpp new file mode 100644 index 00000000..14d0b94a --- /dev/null +++ b/loader/src/platform/windows/ehdata_structs.hpp @@ -0,0 +1,46 @@ +#pragma once +// All of those are defined in but the header fails to compile for some reason. + +#define EH_EXCEPTION_NUMBER ('msc' | 0xE0000000) + +typedef struct _PMD +{ + int mdisp; + int pdisp; + int vdisp; +} _PMD; + +typedef void (*_PMFN) (void); + +#pragma warning (disable:4200) +#pragma pack (push, _TypeDescriptor, 8) +typedef struct _TypeDescriptor +{ + const void *pVFTable; + void *spare; + char name []; +} _TypeDescriptor; +#pragma pack (pop, _TypeDescriptor) +#pragma warning (default:4200) + +typedef const struct _s__CatchableType { + unsigned int properties; + _TypeDescriptor *pType; + _PMD thisDisplacement; + int sizeOrOffset; + _PMFN copyFunction; +} _CatchableType; + +#pragma warning (disable:4200) +typedef const struct _s__CatchableTypeArray { + int nCatchableTypes; + _CatchableType *arrayOfCatchableTypes []; +} _CatchableTypeArray; +#pragma warning (default:4200) + +typedef const struct _s__ThrowInfo { + unsigned int attributes; + _PMFN pmfnUnwind; + int (__cdecl *pForwardCompat) (...); + _CatchableTypeArray *pCatchableTypeArray; +} _ThrowInfo; \ No newline at end of file From 0d0916262239fd5f15c2f9c4b78db739e916eb1e Mon Sep 17 00:00:00 2001 From: dank_meme01 Date: Tue, 24 Oct 2023 12:05:37 +0200 Subject: [PATCH 224/270] some exception handling improvements --- loader/src/platform/windows/crashlog.cpp | 15 ++++++++------- loader/src/platform/windows/ehdata_structs.hpp | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index a2fb66c9..81de1733 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -205,19 +205,20 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) { // This executes when a C++ exception was thrown and not handled. // https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273 + // since you can throw virtually anything, we need to figure out if it's an std::exception* or not bool isStdException = false; - auto exceptionRecord = info->ExceptionRecord; + auto* exceptionRecord = info->ExceptionRecord; auto exceptionObject = exceptionRecord->ExceptionInformation[1]; - auto throwInfo = reinterpret_cast<_ThrowInfo*>(exceptionRecord->ExceptionInformation[2]); - auto catchableTypeArray = reinterpret_cast<_CatchableTypeArray*>(throwInfo->pCatchableTypeArray); + auto* throwInfo = reinterpret_cast<_ThrowInfo*>(exceptionRecord->ExceptionInformation[2]); + auto* catchableTypeArray = reinterpret_cast<_CatchableTypeArray*>(throwInfo->pCatchableTypeArray); auto ctaSize = catchableTypeArray->nCatchableTypes; for (int i = 0; i < ctaSize; i++) { - auto catchableType = reinterpret_cast<_CatchableType*>(catchableTypeArray->arrayOfCatchableTypes[i]); - auto ctDescriptor = reinterpret_cast<_TypeDescriptor*>(catchableType->pType); - auto classname = ctDescriptor->name; + auto* catchableType = reinterpret_cast<_CatchableType*>(catchableTypeArray->arrayOfCatchableTypes[i]); + auto* ctDescriptor = reinterpret_cast<_TypeDescriptor*>(catchableType->pType); + const char* classname = ctDescriptor->name; if (strcmp(classname, ".?AVexception@std@@") == 0) { isStdException = true; @@ -226,7 +227,7 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) { } if (isStdException) { - auto excObject = reinterpret_cast(exceptionObject); + std::exception* excObject = reinterpret_cast(exceptionObject); // stream << "C++ Exception Type: " << typeid(excObject).name() << "\n"; // always const std::exception * stream << "C++ Exception: " << excObject->what() << "\n"; } else { diff --git a/loader/src/platform/windows/ehdata_structs.hpp b/loader/src/platform/windows/ehdata_structs.hpp index 14d0b94a..57d2f6d2 100644 --- a/loader/src/platform/windows/ehdata_structs.hpp +++ b/loader/src/platform/windows/ehdata_structs.hpp @@ -1,7 +1,12 @@ #pragma once -// All of those are defined in but the header fails to compile for some reason. -#define EH_EXCEPTION_NUMBER ('msc' | 0xE0000000) +// _ThrowInfo and all of those other structs are hardcoded into MSVC, +// but don't exist in other compilers like Clang, causing to not compile. +// +// We check if they don't exist and define them manually. +// source: https://www.geoffchappell.com/studies/msvc/language/predefined/index.htm + +#ifndef _ThrowInfo typedef struct _PMD { @@ -43,4 +48,8 @@ typedef const struct _s__ThrowInfo { _PMFN pmfnUnwind; int (__cdecl *pForwardCompat) (...); _CatchableTypeArray *pCatchableTypeArray; -} _ThrowInfo; \ No newline at end of file +} _ThrowInfo; + +#endif // _ThrowInfo + +#include \ No newline at end of file From 52421d8c656b6d389a5aa31bf08c7a14bddbd562 Mon Sep 17 00:00:00 2001 From: dank_meme01 Date: Tue, 24 Oct 2023 22:42:48 +0200 Subject: [PATCH 225/270] fix msvc compilation error in ehdata_structs.hpp --- loader/src/platform/windows/ehdata_structs.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loader/src/platform/windows/ehdata_structs.hpp b/loader/src/platform/windows/ehdata_structs.hpp index 57d2f6d2..a1e9c84d 100644 --- a/loader/src/platform/windows/ehdata_structs.hpp +++ b/loader/src/platform/windows/ehdata_structs.hpp @@ -1,12 +1,12 @@ #pragma once -// _ThrowInfo and all of those other structs are hardcoded into MSVC, +// _ThrowInfo and all of those other structs are hardcoded into MSVC (the compiler itself, unavailable in any header), // but don't exist in other compilers like Clang, causing to not compile. // -// We check if they don't exist and define them manually. +// We define them manually in order to be able to use them. // source: https://www.geoffchappell.com/studies/msvc/language/predefined/index.htm -#ifndef _ThrowInfo +#if defined(__GNUC__) || defined(__clang__) typedef struct _PMD { @@ -50,6 +50,6 @@ typedef const struct _s__ThrowInfo { _CatchableTypeArray *pCatchableTypeArray; } _ThrowInfo; -#endif // _ThrowInfo +#endif // defined(__GNUC__) || defined(__clang__) -#include \ No newline at end of file +#include // for EH_EXCEPTION_NUMBER \ No newline at end of file From 0472075f88ff4910018b01ecfa5a2619eff9ded8 Mon Sep 17 00:00:00 2001 From: dank_meme Date: Wed, 25 Oct 2023 00:18:58 +0200 Subject: [PATCH 226/270] actually fix windows exception handling --- loader/src/platform/windows/crashlog.cpp | 13 +++++++++++-- loader/src/platform/windows/ehdata_structs.hpp | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index 81de1733..57e137fa 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -254,7 +254,7 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) { } static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) { - + SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES); // init symbols so we can get some juicy debug info @@ -272,8 +272,17 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) { return EXCEPTION_CONTINUE_SEARCH; } -bool crashlog::setupPlatformHandler() { +static LONG WINAPI exceptionHandlerDummy(LPEXCEPTION_POINTERS info) { SetUnhandledExceptionFilter(exceptionHandler); + return EXCEPTION_CONTINUE_SEARCH; +} + +bool crashlog::setupPlatformHandler() { + // for some reason, on exceptions windows seems to clear SetUnhandledExceptionFilter + // so we attach a VE handler (which runs *earlier*) and inside set our crash handler + AddVectoredExceptionHandler(0, exceptionHandlerDummy); + SetUnhandledExceptionFilter(exceptionHandler); + auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed"; if (ghc::filesystem::exists(lastCrashedFile)) { g_lastLaunchCrashed = true; diff --git a/loader/src/platform/windows/ehdata_structs.hpp b/loader/src/platform/windows/ehdata_structs.hpp index a1e9c84d..9ed531f2 100644 --- a/loader/src/platform/windows/ehdata_structs.hpp +++ b/loader/src/platform/windows/ehdata_structs.hpp @@ -6,7 +6,7 @@ // We define them manually in order to be able to use them. // source: https://www.geoffchappell.com/studies/msvc/language/predefined/index.htm -#if defined(__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__) typedef struct _PMD { @@ -50,6 +50,6 @@ typedef const struct _s__ThrowInfo { _CatchableTypeArray *pCatchableTypeArray; } _ThrowInfo; -#endif // defined(__GNUC__) || defined(__clang__) +#endif // defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__) #include // for EH_EXCEPTION_NUMBER \ No newline at end of file From 237128bfc5b6b024aaecaa5c994f0db4ba94e038 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Fri, 27 Oct 2023 20:49:17 +0000 Subject: [PATCH 227/270] Allow error responses i dont want a "HTTP response code said error" --- loader/src/utils/web.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 8dccd048..04759dee 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -271,7 +271,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const // Follow redirects curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); // Fail if response code is 4XX or 5XX - curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0L); // we will handle http errors manually // Headers end curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); @@ -307,12 +307,17 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const ); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); auto res = curl_easy_perform(curl); + long code = 0; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); if (res != CURLE_OK) { - long code = 0; - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); curl_easy_cleanup(curl); return this->error("Fetch failed: " + std::string(curl_easy_strerror(res)), code); } + if (code >= 400 && code < 600) { + std::string response_str(ret.begin(), ret.end()); + curl_easy_cleanup(curl); + return this->error(response_str, code); + } curl_easy_cleanup(curl); AWAIT_RESUME(); From 12231b223cc4b8798ef4be90127d0f35d185a840 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:57:04 -0300 Subject: [PATCH 228/270] disable CCTextInputNodeFix --- .../src/hooks/{CCTextInputNode.cpp => CCTextInputNodeFix.cpp} | 3 +++ 1 file changed, 3 insertions(+) rename loader/src/hooks/{CCTextInputNode.cpp => CCTextInputNodeFix.cpp} (92%) diff --git a/loader/src/hooks/CCTextInputNode.cpp b/loader/src/hooks/CCTextInputNodeFix.cpp similarity index 92% rename from loader/src/hooks/CCTextInputNode.cpp rename to loader/src/hooks/CCTextInputNodeFix.cpp index b94681f1..5feb6548 100644 --- a/loader/src/hooks/CCTextInputNode.cpp +++ b/loader/src/hooks/CCTextInputNodeFix.cpp @@ -1,3 +1,5 @@ +// FIXME: This fix ends up breaking some of the vanilla text inputs. +#if 0 #include using namespace geode::prelude; @@ -24,3 +26,4 @@ struct CCTextInputNodeFix : Modify { return true; } }; +#endif \ No newline at end of file From 3500ce98967289b543151a5c1bc03c780fdcdcfa Mon Sep 17 00:00:00 2001 From: Cvolton Date: Tue, 31 Oct 2023 19:42:10 +0100 Subject: [PATCH 229/270] Bindings: add SearchButton (#322) --- bindings/GeometryDash.bro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2ae29af0..1f774bae 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4322,6 +4322,15 @@ class LevelSettingsDelegate { virtual void levelSettingsUpdated() {} } +[[link(android)]] +class SearchButton : cocos2d::CCSprite { + static SearchButton* create(char const* background, char const* text, float scale, char const* icon) = win 0x182120, mac 0x3869A0; + bool init(char const* background, char const* text, float scale, char const* icon) = win 0x182210, mac 0x389290; + + cocos2d::CCLabelBMFont* m_text; + cocos2d::CCSprite* m_icon; +} + [[link(android)]] class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer2* create() = win 0x21FD70; From 945c88269058d87ad65bf63d401f607aeb498592 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:05:02 -0300 Subject: [PATCH 230/270] fix PlayerObject sprite members --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 0c681d69..a4bd1684 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5109,7 +5109,6 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { bool m_isHidden; int m_hasGhostTrail; GhostTrailEffect* m_ghostTrail; - cocos2d::CCSprite* m_unknownSprite; cocos2d::CCSprite* m_iconSprite; cocos2d::CCSprite* m_iconSpriteSecondary; cocos2d::CCSprite* m_iconSpriteWhitener; @@ -5119,6 +5118,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { cocos2d::CCSprite* m_unk500; cocos2d::CCSprite* m_vehicleSpriteWhitener; cocos2d::CCSprite* m_vehicleGlow; + cocos2d::CCSprite* m_unk50C; cocos2d::CCMotionStreak* m_regularTrail; HardStreak* m_waveTrail; double m_xVelocity; From 69cac3e4f7bde8ac5e7db6aed4032388862c8e22 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:12:39 -0300 Subject: [PATCH 231/270] update changelog and bump to 1.3.6 --- CHANGELOG.md | 12 ++++++++++++ VERSION | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 094bce59..29281b57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Geode Changelog +## v1.3.6 + * Allow error responses in our WebRequest classes (237128bf) + * Display unhandled C++ exceptions in crash log (fdd78aca, 0d091626, 52421d8c, 0472075f) + * Fix GEODE_CLI force caching when not found (0a113744) + * Only write checksum file after unzipping, fixes inconsistent index state (b4fbea51) + * Fix the index notif staying on all the time (c967b520) + * Bump minimum required CMake version in codegen (27ed63e7) + * Only show update indicator if mod is enabled (8762714c) + * Fix FLAlertLayer m_scrollingLayer not being a ScrollingLayer (9694b35d) + * Fix gnustl vector dtor (b55e6465, 0bdb0df7) + * Loads of bindings changes + ## v1.3.5 * Follow redirect in web::utils functions (a942a45) * Lots of bindings diff --git a/VERSION b/VERSION index 80e78df6..95b25aee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.5 +1.3.6 From b525adad504a54dd4f810a48b5719c0bb7497b22 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:22:42 +0100 Subject: [PATCH 232/270] add a bunch of bindings (#324) * reorder funcs in UserListDelegate because the order was wrong * add those same functions to FriendsProfilePage * add getUserList and getStoredUserList to GLM * change unknown delegate to UserListDelegate in GLM * add callbacks for most buttons in ProfilePage --- bindings/GeometryDash.bro | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index a4bd1684..66823fd8 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1804,6 +1804,10 @@ class FriendRequestDelegate {} class FriendsProfilePage : FLAlertLayer, FLAlertLayerProtocol, UploadActionDelegate, UploadPopupDelegate, UserListDelegate { static FriendsProfilePage* create(UserListType) = win 0x9ce80, mac 0x3a9570; bool init(UserListType) = win 0x9cf30, mac 0x3a9770; + void getUserListFinished(cocos2d::CCArray* arr, UserListType listType) = win 0x9d800; + void getUserListFailed(UserListType listType, GJErrorCode errorCode) = win 0x9d8e0; + void forceReloadList(UserListType listType) = win 0x9d950; + void setupUsersBrowser(cocos2d::CCArray* users, UserListType listType) = win 0x9d620; } class GJAccountBackupDelegate { @@ -2871,6 +2875,8 @@ class GameLevelManager : cocos2d::CCNode { void getLevelLeaderboard(GJGameLevel* level, LevelLeaderboardType leaderboardType) = mac 0x2CD6F0, win 0xAED70; void getOnlineLevels(GJSearchObject*) = mac 0x2C5920, win 0xa7bc0; void getPageInfo(char const*) = mac 0x2c0050; + void getUserList(UserListType listType) = mac 0x2d74a0, win 0xb6b60; + cocos2d::CCObject* getStoredUserList(UserListType) = win 0xb70d0; cocos2d::CCArray* getSavedLevels(bool favorite, int levelFolder) = mac 0x2BE910, win 0xa2960; cocos2d::CCArray* getStoredOnlineLevels(char const*) = mac 0x2bfe80, win 0xa3a90; void getTopArtists(int, int) = mac 0x2ce3d0; @@ -2966,7 +2972,7 @@ class GameLevelManager : cocos2d::CCNode { LevelDeleteDelegate* m_levelDeleteDelegate; UserInfoDelegate* m_userInfoDelegate; LevelManagerDelegate* m_levelManagerDelegate; - void* m_unkDelegate; + UserListDelegate* m_userListDelegate; FriendRequestDelegate* m_friendRequestDelegate; MessageListDelegate* m_messageListDelegate; DownloadMessageDelegate* m_downloadMessageDelegate; @@ -5229,10 +5235,23 @@ class PointNode : cocos2d::CCObject { class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate { static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50; + ProfilePage() = win 0x20e920; virtual void getUserInfoFailed(int) = mac 0x463FB0, win 0x2133e0; virtual void userInfoChanged(GJUserScore*) = mac 0x464070, win 0x213430; bool init(int accountID, bool idk) = mac 0x45f170, win 0x20ef00; + void onYoutube(cocos2d::CCObject*) = mac 0x462360, win 0x212e80; + void onTwitter(cocos2d::CCObject*) = mac 0x462500, win 0x212fe0; + void onTwitch(cocos2d::CCObject*) = mac 0x4626a0, win 0x213140; + void onCommentHistory(cocos2d::CCObject*) = mac 0x462840, win 0x211d10; + void onSendMessage(cocos2d::CCObject*) = mac 0x462870, win 0x211d40; + void onFriend(cocos2d::CCObject*) = mac 0x4628c0, win 0x211f30; + void onBlockUser(cocos2d::CCObject*) = mac 0x462b60, win 0x212130; void onMyLevels(cocos2d::CCObject*) = mac 0x462d70, win 0x211bb0; + void onMessages(cocos2d::CCObject*) = mac 0x462f10, win 0x2132c0; + void onFriends(cocos2d::CCObject*) = mac 0x462f60, win 0x2132f0; + void onRequests(cocos2d::CCObject*) = mac 0x462fb0, win 0x213320; + void onSettings(cocos2d::CCObject*) = mac 0x463000, win 0x2132a0; + void onComment(cocos2d::CCObject*) = mac 0x463020, win 0x211e10; void onUpdate(cocos2d::CCObject*) = mac 0x460150, win 0x20fa20; void onClose(cocos2d::CCObject*) = mac 0x45fd20, win 0x49C60; virtual void keyBackClicked() = mac 0x464A60, win 0x49C80; @@ -5896,10 +5915,10 @@ class UserInfoDelegate { } class UserListDelegate { - virtual void forceReloadList(UserListType) {} - virtual void getUserListFailed(UserListType, GJErrorCode) {} virtual void getUserListFinished(cocos2d::CCArray*, UserListType) {} + virtual void getUserListFailed(UserListType, GJErrorCode) {} virtual void userListChanged(cocos2d::CCArray*, UserListType) {} + virtual void forceReloadList(UserListType) {} } class VideoOptionsLayer : FLAlertLayer { From cd83b4dbc9a0660ab13144729c78afe91662fc96 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:30:59 -0300 Subject: [PATCH 233/270] bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 95b25aee..3336003d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.6 +1.3.7 From 80539b493b4ca67eefa15b28086d481922fbb618 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:43:25 -0300 Subject: [PATCH 234/270] fix bindings --- bindings/GeometryDash.bro | 2 -- 1 file changed, 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 0556963c..563747c0 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5450,8 +5450,6 @@ class PointNode : cocos2d::CCObject { class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate { static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50; ProfilePage() = win 0x20e920; - virtual void getUserInfoFailed(int) = mac 0x463FB0, win 0x2133e0; - virtual void userInfoChanged(GJUserScore*) = mac 0x464070, win 0x213430; bool init(int accountID, bool idk) = mac 0x45f170, win 0x20ef00; void onYoutube(cocos2d::CCObject*) = mac 0x462360, win 0x212e80; void onTwitter(cocos2d::CCObject*) = mac 0x462500, win 0x212fe0; From 8d8001a65501959a7359a64a5c871c6c25aba276 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:54:34 -0300 Subject: [PATCH 235/270] ok idc about this class for now --- bindings/GeometryDash.bro | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 563747c0..9c63e114 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5523,13 +5523,6 @@ class RateStarsLayer : FLAlertLayer, UploadPopupDelegate, UploadActionDelegate { bool init(int levelID, bool isModSuggest) = mac 0x136050, win 0x2156a0; } -class RateLevelLayer : FLAlertLayer { - RateLevelLayer() = win 0x214a80; - virtual ~RateLevelLayer() = win 0x214b40; - - bool init(int levelID) = win 0x214cb0; -} - [[link(android)]] class RetryLevelLayer { static RetryLevelLayer* create() = mac 0x28dd60, win 0x216390; From b6b02671b840897601e664537e040c8bb1c488e1 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sat, 11 Nov 2023 09:46:21 -0600 Subject: [PATCH 236/270] canRotateFree for mac --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 66823fd8..4414e4bf 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3361,6 +3361,7 @@ class GameObject : CCSpritePlus { void loadGroupsFromString(gd::string str) = mac 0x33b380, win 0xebcb0; static GameObject* objectFromString(gd::string, bool) = mac 0x33b720, win 0xebe50; void playShineEffect() = mac 0x2fa9d0, win 0xeab20; + bool canRotateFree() = mac 0x33ac80; //void quickUpdatePosition() = mac 0x335790; // inlined on windows void quickUpdatePosition() { From 0b9590727a1426c4624a4b4e73e64c80f211ba84 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sat, 11 Nov 2023 10:01:29 -0600 Subject: [PATCH 237/270] implementation of canRotateFRee --- bindings/GeometryDash.bro | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 4414e4bf..01afbe23 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3361,7 +3361,13 @@ class GameObject : CCSpritePlus { void loadGroupsFromString(gd::string str) = mac 0x33b380, win 0xebcb0; static GameObject* objectFromString(gd::string, bool) = mac 0x33b720, win 0xebe50; void playShineEffect() = mac 0x2fa9d0, win 0xeab20; - bool canRotateFree() = mac 0x33ac80; + bool canRotateFree() { + return ( + m_objectType != GameObjectType::Solid && + m_objectType != GameObjectType::Breakable && + m_objectType != GameObjectType::Slope + ); + } //void quickUpdatePosition() = mac 0x335790; // inlined on windows void quickUpdatePosition() { From 645a41c63a0ea8b0973eebd1d786856c1d0657ac Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sat, 11 Nov 2023 10:03:31 -0600 Subject: [PATCH 238/270] forogt to commit the enum --- .gitignore | 3 +++ loader/include/Geode/Enums.hpp | 1 + 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index e8badae0..18e52909 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ test-docs.bat # Ignore krita files too because we don't want our project files shaking my head **/*.kra + +# Ignore clangd cache +.cache diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp index c7fd1006..a5a67972 100644 --- a/loader/include/Geode/Enums.hpp +++ b/loader/include/Geode/Enums.hpp @@ -54,6 +54,7 @@ enum class GameObjectType { MiniSizePortal = 18, UfoPortal = 19, Modifier = 20, + Breakable = 21, SecretCoin = 22, DualPortal = 23, SoloPortal = 24, From 5083017b5096895f2788cce03a7bf0994582ea2f Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 11 Nov 2023 19:38:01 +0300 Subject: [PATCH 239/270] improve logging + minor refactors --- loader/include/Geode/loader/Loader.hpp | 2 + loader/src/hooks/save.cpp | 16 ++-- loader/src/load.cpp | 25 +++++- loader/src/loader/HookImpl.cpp | 37 +++++---- loader/src/loader/Index.cpp | 4 + loader/src/loader/LoaderImpl.cpp | 94 +++++++++++----------- loader/src/loader/LoaderImpl.hpp | 6 +- loader/src/loader/Log.cpp | 30 +++++++ loader/src/loader/ModImpl.cpp | 33 ++++---- loader/src/platform/windows/LoaderImpl.cpp | 45 +++++++---- 10 files changed, 186 insertions(+), 106 deletions(-) diff --git a/loader/include/Geode/loader/Loader.hpp b/loader/include/Geode/loader/Loader.hpp index f9dd1815..bd824a82 100644 --- a/loader/include/Geode/loader/Loader.hpp +++ b/loader/include/Geode/loader/Loader.hpp @@ -63,6 +63,7 @@ namespace geode { public: // TODO: do we want to expose all of these functions? + static Loader* get(); enum class LoadingState : uint8_t { @@ -76,6 +77,7 @@ namespace geode { Done }; + // TODO: return void Result<> saveData(); Result<> loadData(); diff --git a/loader/src/hooks/save.cpp b/loader/src/hooks/save.cpp index c3dfde14..77432a9c 100644 --- a/loader/src/hooks/save.cpp +++ b/loader/src/hooks/save.cpp @@ -6,14 +6,18 @@ using namespace geode::prelude; struct SaveLoader : Modify { void trySaveGame() { - log::info("Saving..."); + log::info("Saving mod data..."); + log::pushNest(); - auto r = Loader::get()->saveData(); - if (!r) { - log::info("{}", r.unwrapErr()); - } + auto begin = std::chrono::high_resolution_clock::now(); - log::info("Saved"); + (void)Loader::get()->saveData(); + + auto end = std::chrono::high_resolution_clock::now(); + auto time = std::chrono::duration_cast(end - begin).count(); + log::info("Took {}s", static_cast(time) / 1000.f); + + log::popNest(); return AppDelegate::trySaveGame(); } diff --git a/loader/src/load.cpp b/loader/src/load.cpp index 85e05d42..ba849912 100644 --- a/loader/src/load.cpp +++ b/loader/src/load.cpp @@ -58,8 +58,17 @@ $execute { } int geodeEntry(void* platformData) { + log::Logger::setup(); + + log::info("Entry"); + + auto begin = std::chrono::high_resolution_clock::now(); + // set up internal mod, settings and data + log::info("Setting up internal mod"); + log::pushNest(); auto internalSetupRes = LoaderImpl::get()->setupInternalMod(); + log::popNest(); if (!internalSetupRes) { LoaderImpl::get()->platformMessageBox( "Unable to Load Geode!", @@ -72,30 +81,38 @@ int geodeEntry(void* platformData) { // open console if (Mod::get()->getSettingValue("show-platform-console")) { + log::debug("Opening console"); Loader::get()->openPlatformConsole(); } // set up loader, load mods, etc. + log::info("Setting up loader"); + log::pushNest(); auto setupRes = LoaderImpl::get()->setup(); + log::popNest(); if (!setupRes) { LoaderImpl::get()->platformMessageBox( "Unable to Load Geode!", "There was an unknown fatal error setting up " - "the loader and Geode can not be loaded. " + "the loader and Geode can not be loaded. " "(" + setupRes.unwrapErr() + ")" ); LoaderImpl::get()->forceReset(); return 1; } - log::info("Set up loader"); - // download and install new loader update in the background if (Mod::get()->getSettingValue("auto-check-updates")) { + log::info("Starting loader update check"); LoaderImpl::get()->checkForLoaderUpdates(); } + else { + log::info("Skipped loader update check"); + } - log::debug("Entry done."); + auto end = std::chrono::high_resolution_clock::now(); + auto time = std::chrono::duration_cast(end - begin).count(); + log::info("Entry took {}s", static_cast(time) / 1000.f); return 0; } diff --git a/loader/src/loader/HookImpl.cpp b/loader/src/loader/HookImpl.cpp index 58be1dce..cd053ff4 100644 --- a/loader/src/loader/HookImpl.cpp +++ b/loader/src/loader/HookImpl.cpp @@ -44,28 +44,35 @@ tulip::hook::HookMetadata Hook::Impl::getHookMetadata() const { } Result<> Hook::Impl::enable() { - if (!m_enabled) { - if (!LoaderImpl::get()->hasHandler(m_address)) { - GEODE_UNWRAP(LoaderImpl::get()->createHandler(m_address, m_handlerMetadata)); - } - GEODE_UNWRAP_INTO(auto handler, LoaderImpl::get()->getHandler(m_address)); + if (m_enabled) + return Ok(); - m_handle = tulip::hook::createHook(handler, m_detour, m_hookMetadata); - log::debug("Enabling hook at function {} with address {}", m_displayName, m_address); - m_enabled = true; + if (!LoaderImpl::get()->hasHandler(m_address)) { + GEODE_UNWRAP(LoaderImpl::get()->createHandler(m_address, m_handlerMetadata)); } + GEODE_UNWRAP_INTO(auto handler, LoaderImpl::get()->getHandler(m_address)); + + m_handle = tulip::hook::createHook(handler, m_detour, m_hookMetadata); + if (m_owner) + log::debug("Enabled {} hook at {} for {}", m_displayName, m_address, m_owner->getID()); + else + log::debug("Enabled {} hook at {}", m_displayName, m_address); + + m_enabled = true; return Ok(); } Result<> Hook::Impl::disable() { - if (m_enabled) { - GEODE_UNWRAP_INTO(auto handler, LoaderImpl::get()->getHandler(m_address)); + if (!m_enabled) + return Ok(); - tulip::hook::removeHook(handler, m_handle); + GEODE_UNWRAP_INTO(auto handler, LoaderImpl::get()->getHandler(m_address)); - log::debug("Disabling hook at function {}", m_displayName); - m_enabled = false; - } + tulip::hook::removeHook(handler, m_handle); + + log::debug("Disabled {} hook", m_displayName); + + m_enabled = false; return Ok(); } @@ -101,4 +108,4 @@ bool Hook::Impl::getAutoEnable() const { void Hook::Impl::setAutoEnable(bool autoEnable) { m_autoEnable = autoEnable; -} \ No newline at end of file +} diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index ff1d4b1d..5cc68c1b 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -403,6 +403,8 @@ void Index::Impl::checkForUpdates() { void Index::Impl::updateFromLocalTree() { log::debug("Updating local index cache"); + log::pushNest(); + IndexUpdateEvent(UpdateProgress(100, "Updating local cache")).post(); // delete old items m_items.clear(); @@ -442,6 +444,8 @@ void Index::Impl::updateFromLocalTree() { // mark source as finished m_isUpToDate = true; IndexUpdateEvent(UpdateFinished()).post(); + + log::popNest(); } void Index::update(bool force) { diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 52727ff0..d29a1c88 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -61,33 +61,30 @@ Result<> Loader::Impl::setup() { return Ok(); } - log::Logger::setup(); - - if (crashlog::setupPlatformHandler()) { - log::debug("Set up platform crash logger"); - } - else { - log::debug("Unable to set up platform crash logger"); + log::debug("Setting up crash handler"); + log::pushNest(); + if (!crashlog::setupPlatformHandler()) { + log::debug("Failed to set up crash handler"); } + log::popNest(); - log::debug("Setting up Loader..."); - - log::debug("Set up internal mod representation"); - log::debug("Loading hooks... "); - + log::debug("Loading hooks"); + log::pushNest(); if (!this->loadHooks()) { return Err("There were errors loading some hooks, see console for details"); } + log::popNest(); - log::debug("Loaded hooks"); - - log::debug("Setting up IPC..."); - + log::debug("Setting up IPC"); + log::pushNest(); this->setupIPC(); + log::popNest(); + log::debug("Setting up directories"); + log::pushNest(); this->createDirectories(); - this->addSearchPaths(); + log::popNest(); this->refreshModGraph(); @@ -107,14 +104,14 @@ void Loader::Impl::updateResources() { void Loader::Impl::updateResources(bool forceReload) { log::debug("Adding resources"); - - // add mods' spritesheets + log::pushNest(); for (auto const& [_, mod] : m_mods) { - if (forceReload || !ModImpl::getImpl(mod)->m_resourcesLoaded) { - this->updateModResources(mod); - ModImpl::getImpl(mod)->m_resourcesLoaded = true; - } + if (!forceReload && ModImpl::getImpl(mod)->m_resourcesLoaded) + continue; + this->updateModResources(mod); + ModImpl::getImpl(mod)->m_resourcesLoaded = true; } + log::popNest(); } std::vector Loader::Impl::getAllMods() { @@ -164,25 +161,27 @@ bool Loader::Impl::isModVersionSupported(VersionInfo const& version) { // Data saving Result<> Loader::Impl::saveData() { - // save mods' data for (auto& [id, mod] : m_mods) { + log::debug("{}", mod->getID()); + log::pushNest(); auto r = mod->saveData(); if (!r) { log::warn("Unable to save data for mod \"{}\": {}", mod->getID(), r.unwrapErr()); } + log::popNest(); } - // save loader data - GEODE_UNWRAP(Mod::get()->saveData()); - return Ok(); } Result<> Loader::Impl::loadData() { for (auto& [_, mod] : m_mods) { + log::debug("{}", mod->getID()); + log::pushNest(); auto r = mod->loadData(); if (!r) { log::warn("Unable to load data for mod \"{}\": {}", mod->getID(), r.unwrapErr()); } + log::popNest(); } return Ok(); } @@ -225,9 +224,9 @@ void Loader::Impl::updateModResources(Mod* mod) { if (mod->getMetadata().getSpritesheets().empty()) return; - log::debug("Adding resources for {}", mod->getID()); + log::debug("{}", mod->getID()); + log::pushNest(); - // add spritesheets for (auto const& sheet : mod->getMetadata().getSpritesheets()) { log::debug("Adding sheet {}", sheet); auto png = sheet + ".png"; @@ -246,6 +245,8 @@ void Loader::Impl::updateModResources(Mod* mod) { CCSpriteFrameCache::get()->addSpriteFramesWithFile(plist.c_str()); } } + + log::popNest(); } // Dependencies and refreshing @@ -422,6 +423,9 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { return; } + if (node->getID() == "absolllute.megahack") + log::debug("megahack creepypasta"); + for (auto const& dep : node->m_impl->m_dependants) { this->loadModGraph(dep, early); } @@ -512,17 +516,17 @@ void Loader::Impl::findProblems() { } void Loader::Impl::refreshModGraph() { - log::info("Refreshing mod graph..."); + log::info("Refreshing mod graph"); log::pushNest(); - auto begin = std::chrono::high_resolution_clock::now(); - if (m_isSetup) { log::error("Cannot refresh mod graph after startup"); log::popNest(); return; } + auto begin = std::chrono::high_resolution_clock::now(); + m_problems.clear(); m_loadingState = LoadingState::Queue; @@ -641,23 +645,22 @@ bool Loader::Impl::isReadyToHook() const { return m_readyToHook; } -void Loader::Impl::addInternalHook(Hook* hook, Mod* mod) { - m_internalHooks.emplace_back(hook, mod); +void Loader::Impl::addUninitializedHook(Hook* hook, Mod* mod) { + m_uninitializedHooks.emplace_back(hook, mod); } bool Loader::Impl::loadHooks() { m_readyToHook = true; - auto thereWereErrors = false; - for (auto const& hook : m_internalHooks) { + bool hadErrors = false; + for (auto const& hook : m_uninitializedHooks) { auto res = hook.second->addHook(hook.first); if (!res) { log::internalLog(Severity::Error, hook.second, "{}", res.unwrapErr()); - thereWereErrors = true; + hadErrors = true; } } - // free up memory - m_internalHooks.clear(); - return !thereWereErrors; + m_uninitializedHooks.clear(); + return !hadErrors; } void Loader::Impl::queueInMainThread(ScheduledFunction func) { @@ -1037,21 +1040,16 @@ void Loader::Impl::provideNextMod(Mod* mod) { } Mod* Loader::Impl::takeNextMod() { - if (!m_nextMod) { - m_nextMod = this->createInternalMod(); - log::debug("Created internal mod {}", m_nextMod->getName()); - } - auto ret = m_nextMod; - return ret; + if (!m_nextMod) + m_nextMod = this->getInternalMod(); + return m_nextMod; } void Loader::Impl::releaseNextMod() { m_nextMod = nullptr; - m_nextModLock.unlock(); } - Result<> Loader::Impl::createHandler(void* address, tulip::hook::HandlerMetadata const& metadata) { if (m_handlerHandles.count(address)) { return Err("Handler already exists at address"); diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index 38d618eb..041b602e 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -72,7 +72,7 @@ namespace geode { std::vector> m_gdThreadQueue; mutable std::mutex m_gdThreadMutex; bool m_platformConsoleOpen = false; - std::vector> m_internalHooks; + std::vector> m_uninitializedHooks; bool m_readyToHook = false; std::mutex m_nextModMutex; @@ -173,9 +173,9 @@ namespace geode { bool isNewUpdateDownloaded() const; bool isReadyToHook() const; - void addInternalHook(Hook* hook, Mod* mod); + void addUninitializedHook(Hook* hook, Mod* mod); - Mod* createInternalMod(); + Mod* getInternalMod(); Result<> setupInternalMod(); bool userTriedToLoadDLLs() const; diff --git a/loader/src/loader/Log.cpp b/loader/src/loader/Log.cpp index ec69eed7..2b84b292 100644 --- a/loader/src/loader/Log.cpp +++ b/loader/src/loader/Log.cpp @@ -113,6 +113,36 @@ std::string Log::toString(bool logTime, uint32_t nestLevel) const { res += fmt::format("{:%H:%M:%S}", m_time); } + switch (m_severity.m_value) { + case Severity::Debug: + res += " DBG"; + break; + case Severity::Info: + res += " INF"; + break; + case Severity::Notice: + res += " NTC"; + break; + case Severity::Warning: + res += " WRN"; + break; + case Severity::Error: + res += " ERR"; + break; + case Severity::Critical: + res += " CRT"; + break; + case Severity::Alert: + res += " ALR"; + break; + case Severity::Emergency: + res += " FAT"; + break; + default: + res += " UNK"; + break; + } + res += fmt::format(" [{}]: ", m_sender ? m_sender->getName() : "Geode?"); for (uint32_t i = 0; i < nestLevel; i++) { diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 73849f7a..50602396 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -224,7 +224,7 @@ Result<> Mod::Impl::saveData() { log::debug("Check covered"); for (auto& [key, value] : m_savedSettingsData.as_object()) { log::debug("Check if {} is saved", key); - if (!coveredSettings.count(key)) { + if (!coveredSettings.contains(key)) { json[key] = value; } } @@ -465,18 +465,21 @@ Result<> Mod::Impl::disableHook(Hook* hook) { } Result Mod::Impl::addHook(Hook* hook) { - m_hooks.push_back(hook); - if (LoaderImpl::get()->isReadyToHook()) { - if (this->isEnabled() && hook->getAutoEnable()) { - auto res = this->enableHook(hook); - if (!res) { - delete hook; - return Err("Can't create hook: "+ res.unwrapErr()); - } - } + if (!ranges::contains(m_hooks, [&](auto const& h) { return h != hook; })) + m_hooks.push_back(hook); + + if (!LoaderImpl::get()->isReadyToHook()) { + LoaderImpl::get()->addUninitializedHook(hook, m_self); + return Ok(hook); } - else { - LoaderImpl::get()->addInternalHook(hook, m_self); + + if (!this->isEnabled() || !hook->getAutoEnable()) + return Ok(hook); + + auto res = this->enableHook(hook); + if (!res) { + delete hook; + return Err("Can't create hook: " + res.unwrapErr()); } return Ok(hook); @@ -620,9 +623,10 @@ static Result getModImplInfo() { return Ok(info); } -Mod* Loader::Impl::createInternalMod() { +Mod* Loader::Impl::getInternalMod() { auto& mod = Mod::sharedMod<>; - if (mod) return mod; + if (mod) + return mod; auto infoRes = getModImplInfo(); if (!infoRes) { LoaderImpl::get()->platformMessageBox( @@ -639,6 +643,7 @@ Mod* Loader::Impl::createInternalMod() { } mod->m_impl->m_enabled = true; m_mods.insert({ mod->getID(), mod }); + log::debug("Created internal mod {}", mod->getName()); return mod; } diff --git a/loader/src/platform/windows/LoaderImpl.cpp b/loader/src/platform/windows/LoaderImpl.cpp index df77a0a9..ff618be9 100644 --- a/loader/src/platform/windows/LoaderImpl.cpp +++ b/loader/src/platform/windows/LoaderImpl.cpp @@ -20,24 +20,37 @@ void Loader::Impl::platformMessageBox(char const* title, std::string const& info bool hasAnsiColorSupport = false; void Loader::Impl::logConsoleMessageWithSeverity(std::string const& msg, Severity severity) { - if (m_platformConsoleOpen) { - if (hasAnsiColorSupport) { - int color = 0; - switch (severity) { - case Severity::Debug: color = 243; break; - case Severity::Info: color = 33; break; - case Severity::Warning: color = 229; break; - case Severity::Error: color = 9; break; - default: color = 7; break; - } - auto const colorStr = fmt::format("\x1b[38;5;{}m", color); - auto const newMsg = fmt::format("{}{}\x1b[0m{}", colorStr, msg.substr(0, 8), msg.substr(8)); + if (!m_platformConsoleOpen) + return; - std::cout << newMsg << "\n" << std::flush; - } else { - std::cout << msg << "\n" << std::flush; - } + if (!hasAnsiColorSupport) { + std::cout << msg << "\n" << std::flush; + return; } + + int color = 0; + switch (severity) { + case Severity::Debug: + color = 243; + break; + case Severity::Info: + color = 33; + break; + case Severity::Warning: + color = 229; + break; + case Severity::Error: + color = 9; + break; + default: + color = 7; + break; + } + auto const colorStr = fmt::format("\x1b[38;5;{}m", color); + auto const newMsg = fmt::format("{}{}\x1b[0m{}", colorStr, msg.substr(0, 12), + msg.substr(12)); + + std::cout << newMsg << "\n" << std::flush; } void Loader::Impl::openPlatformConsole() { From d050d039c044584cab538d8397a6d3ed1f212e28 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:07:51 +0100 Subject: [PATCH 240/270] bindings: add comment uploading and ShareCommentLayer (#343) --- bindings/GeometryDash.bro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 01afbe23..4b59569e 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2891,6 +2891,9 @@ class GameLevelManager : cocos2d::CCNode { void storeUserName(int userID, int accountID, gd::string str) = mac 0x2B9020, win 0xa1a70; gd::string userNameForUserID(int id) = mac 0x2B91D0, win 0xa1c20; void updateUserScore() = mac 0x2CB6A0, win 0xada60; + void uploadAccountComment(gd::string text) = win 0xb3250; + void uploadLevelComment(int levelID, gd::string text, int unk) = win 0xb31c0; + void uploadComment(gd::string text, CommentType type, int levelID, int unk) = win 0xb32e0; void downloadLevel(int id, bool downloadData) = win 0xaa730; bool hasDownloadedLevel(int id) = win 0xab830; GJGameLevel* getSavedLevel(int id) = win 0xa2ee0; @@ -5550,6 +5553,12 @@ class SetupTouchTogglePopup : FLAlertLayer { void updateTargetID() = mac 0x159480; } +class ShareCommentLayer : FLAlertLayer, TextInputDelegate, UploadActionDelegate, UploadPopupDelegate { + static ShareCommentLayer* create(gd::string, int, CommentType, int) = win 0x24bac0; + bool init(gd::string, int, CommentType, int) = win 0x24bb90; + void onShare(CCObject*) = win 0x24c760; +} + class SimplePlayer : cocos2d::CCSprite { SimplePlayer() {} void setSecondColor(const cocos2d::ccColor3B& color) { From 557b9e3126b6ac9a0a286466b35b838e4034a09c Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:27:39 +0100 Subject: [PATCH 241/270] add the CommentType enum (#344) --- loader/include/Geode/Enums.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp index a5a67972..f9fae148 100644 --- a/loader/include/Geode/Enums.hpp +++ b/loader/include/Geode/Enums.hpp @@ -110,6 +110,11 @@ enum class CommentError { enum class BackupAccountError { }; +enum class CommentType { + Level = 0, + Account = 1, +}; + enum class BoomListType { Default = 0x0, User = 0x2, From 499876307c57e32ff27df7d49c85366bada1cb76 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 17 Nov 2023 16:00:11 +0300 Subject: [PATCH 242/270] fix LevelInfoLayer::onDelete windows addr --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 4b59569e..de6aab93 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4104,7 +4104,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void downloadLevel() = win 0x177d90, mac 0x161b90; void onPlay(cocos2d::CCObject* sender) = mac 0x161840, win 0x179730; void onBack(cocos2d::CCObject* sender) = mac 0x163810, win 0x17C110; - void onDelete(cocos2d::CCObject* sender) = mac 0x162f30, win 0x17A2B0; + void onDelete(cocos2d::CCObject* sender) = mac 0x162f30, win 0x17a1b0; virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; From 7796bfba9f9acd9c0b2ff20342c6fa7b54426176 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:10:19 +0300 Subject: [PATCH 243/270] fix commenttype macos (thanks cocoa!) --- cmake/Platform.cmake | 4 ++++ loader/include/Geode/Enums.hpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 22602b4b..c8b32c1a 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -51,6 +51,10 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS") ${GEODE_LOADER_PATH}/include/link/libfmod.dylib ) + target_compile_definitions(${PROJECT_NAME} INTERFACE + -DCommentType=CommentTypeDummy + ) + set(GEODE_PLATFORM_BINARY "Geode.dylib") elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32") diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp index f9fae148..bf028f95 100644 --- a/loader/include/Geode/Enums.hpp +++ b/loader/include/Geode/Enums.hpp @@ -1,5 +1,7 @@ #pragma once +#include "DefaultInclude.hpp" + // thanks pie enum class SearchType { Search = 0, @@ -110,6 +112,11 @@ enum class CommentError { enum class BackupAccountError { }; +// Thanks cocoa! +#ifdef GEODE_IS_MACOS + #undef CommentType +#endif + enum class CommentType { Level = 0, Account = 1, From 5cf0f3c28cc5df30d9a03c9e007f525078710e2d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:22:27 +0300 Subject: [PATCH 244/270] fix hooks lol! funny demorgan stuff happened here --- loader/src/loader/ModImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 50602396..67058a5b 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -465,7 +465,7 @@ Result<> Mod::Impl::disableHook(Hook* hook) { } Result Mod::Impl::addHook(Hook* hook) { - if (!ranges::contains(m_hooks, [&](auto const& h) { return h != hook; })) + if (!ranges::contains(m_hooks, [&](auto const& h) { return h == hook; })) m_hooks.push_back(hook); if (!LoaderImpl::get()->isReadyToHook()) { From 954ed1085b6d911ff37634ca48b9651aca3c6b93 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:25:47 +0300 Subject: [PATCH 245/270] run on prs --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0cdd586..e480220f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,7 @@ name: Build Binaries on: workflow_dispatch: + pull_request: push: branches: - '**' # every branch From b76eb1245832047dddde0ff313af61dfa4a16faa Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:34:12 +0300 Subject: [PATCH 246/270] fix onShare --- bindings/GeometryDash.bro | 2 +- loader/src/loader/LoaderImpl.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6a8f1bcf..09982edf 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5809,7 +5809,7 @@ class SetupTouchTogglePopup : FLAlertLayer { class ShareCommentLayer : FLAlertLayer, TextInputDelegate, UploadActionDelegate, UploadPopupDelegate { static ShareCommentLayer* create(gd::string, int, CommentType, int) = win 0x24bac0; bool init(gd::string, int, CommentType, int) = win 0x24bb90; - void onShare(CCObject*) = win 0x24c760; + void onShare(cocos2d::CCObject*) = win 0x24c760; } [[link(android)]] diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index 16714e7c..c9f8c3c7 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -71,7 +71,6 @@ namespace geode { std::vector> m_gdThreadQueue; mutable std::mutex m_gdThreadMutex; - bool m_platformConsoleOpen = false; std::vector> m_uninitializedHooks; bool m_readyToHook = false; From c5550a67c252c9129ea817647c15580a4622f476 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Tue, 21 Nov 2023 20:34:59 +0300 Subject: [PATCH 247/270] log geode version on startup --- entry.cpp | 2 +- loader/src/load.cpp | 2 +- loader/src/loader/ModImpl.cpp | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/entry.cpp b/entry.cpp index cf19cb70..0ce0b571 100644 --- a/entry.cpp +++ b/entry.cpp @@ -16,5 +16,5 @@ namespace geode { namespace { // to make sure the instance is set into the sharedMod<> in load time - static auto mod = geode::getMod(); + static auto mod = geode::getMod(); } diff --git a/loader/src/load.cpp b/loader/src/load.cpp index ba849912..b02001e2 100644 --- a/loader/src/load.cpp +++ b/loader/src/load.cpp @@ -60,7 +60,7 @@ $execute { int geodeEntry(void* platformData) { log::Logger::setup(); - log::info("Entry"); + log::info("Running {} {}", Mod::get()->getName(), Mod::get()->getVersion()); auto begin = std::chrono::high_resolution_clock::now(); diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 67058a5b..a24724b0 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -627,6 +627,11 @@ Mod* Loader::Impl::getInternalMod() { auto& mod = Mod::sharedMod<>; if (mod) return mod; + if (m_mods.contains("geode.loader")) { + log::warn("Something went wrong and Mod::sharedMod<> got unset after the internal mod was created! Setting sharedMod back..."); + mod = m_mods["geode.loader"]; + return mod; + } auto infoRes = getModImplInfo(); if (!infoRes) { LoaderImpl::get()->platformMessageBox( @@ -643,7 +648,6 @@ Mod* Loader::Impl::getInternalMod() { } mod->m_impl->m_enabled = true; m_mods.insert({ mod->getID(), mod }); - log::debug("Created internal mod {}", mod->getName()); return mod; } From f7962246ec5def74199a7b007a0f31fd75afe126 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:38:13 +0300 Subject: [PATCH 248/270] set time for updating index notif --- loader/src/hooks/MenuLayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 869d1bce..27975ad7 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -174,6 +174,7 @@ struct CustomMenuLayer : Modify { INDEX_UPDATE_NOTIF = Notification::create( "Updating Index", NotificationIcon::Loading, 0 ); + INDEX_UPDATE_NOTIF->setTime(NOTIFICATION_LONG_TIME); INDEX_UPDATE_NOTIF->show(); Index::get()->update(); } From 164185621e12c8bf7be12172d7fb1abfb70ededc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:20:06 +0300 Subject: [PATCH 249/270] easy fix of the web error crash !!! (not rly) --- loader/src/loader/Index.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index 5cc68c1b..553e1a35 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -781,7 +781,11 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) { item->setIsInstalled(true); // Install next item in queue - this->installNext(index + 1, list); + // this is in next frame cause otherwise + // it seems to deadlock and havent figured out why + Loader::get()->queueInMainThread([&]{ + this->installNext(index + 1, list); + }); }) .expect([postError, list, item](std::string const& err) { postError(fmt::format( From c8392e92f529cf539e8843c46c9f582eaccab6f0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:03:07 +0300 Subject: [PATCH 250/270] im tired --- loader/src/loader/Index.cpp | 14 ++++++++------ loader/src/utils/web.cpp | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index 553e1a35..84b7c565 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -673,7 +673,10 @@ Result Index::getInstallList(IndexItemHandle item) const { } // recursively add dependencies GEODE_UNWRAP_INTO(auto deps, this->getInstallList(depItem)); - ranges::push(list.list, deps.list); + for (auto& dep : deps.list) { + if (ranges::contains(list.list, dep)) continue; + list.list.push_back(dep); + } } // otherwise user must get this dependency manually from somewhere else { @@ -745,6 +748,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) { auto item = list.list.at(index); auto tempFile = dirs::getTempDir() / (item->getMetadata().getID() + ".index"); + log::debug("Installing {}", item->getMetadata().getID()); m_runningInstallations[list.target] = web::AsyncWebRequest() .join("install_item_" + item->getMetadata().getID()) .fetch(item->getDownloadURL()) @@ -780,12 +784,10 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) { item->setIsInstalled(true); + log::debug("Installed {}", item->getMetadata().getID()); + // Install next item in queue - // this is in next frame cause otherwise - // it seems to deadlock and havent figured out why - Loader::get()->queueInMainThread([&]{ - this->installNext(index + 1, list); - }); + this->installNext(index + 1, list); }) .expect([postError, list, item](std::string const& err) { postError(fmt::format( diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 04759dee..a2ba3beb 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -297,9 +297,11 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const return 1; } Loader::get()->queueInMainThread([self = data->self, now, total]() { - std::lock_guard _(self->m_mutex); + std::unique_lock l(self->m_mutex); for (auto& prog : self->m_progresses) { + l.unlock(); prog(*self->m_self, now, total); + l.lock(); } }); return 0; @@ -327,9 +329,11 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const m_finished = true; Loader::get()->queueInMainThread([this, ret]() { - std::lock_guard _(m_mutex); + std::unique_lock l(m_mutex); for (auto& then : m_thens) { + l.unlock(); then(*m_self, ret); + l.lock(); } std::lock_guard __(RUNNING_REQUESTS_MUTEX); RUNNING_REQUESTS.erase(m_id); @@ -354,9 +358,11 @@ void SentAsyncWebRequest::Impl::doCancel() { } Loader::get()->queueInMainThread([this]() { - std::lock_guard _(m_mutex); + std::unique_lock l(m_mutex); for (auto& canc : m_cancelleds) { + l.unlock(); canc(*m_self); + l.lock(); } }); @@ -392,9 +398,11 @@ void SentAsyncWebRequest::Impl::error(std::string const& error, int code) { }); Loader::get()->queueInMainThread([this, error, code]() { { - std::lock_guard _(m_mutex); + std::unique_lock l(m_mutex); for (auto& expect : m_expects) { + l.unlock(); expect(error, code); + l.lock(); } } std::lock_guard _(RUNNING_REQUESTS_MUTEX); From 1e654387b9437add410cfcff283d999824961a5f Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:10:50 +0300 Subject: [PATCH 251/270] Update test-offsets.yml --- .github/workflows/test-offsets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-offsets.yml b/.github/workflows/test-offsets.yml index 23403f67..a4066463 100644 --- a/.github/workflows/test-offsets.yml +++ b/.github/workflows/test-offsets.yml @@ -2,6 +2,7 @@ name: Test Offsets on: workflow_dispatch: + pull_request: push: paths: - 'bindings/**' # only when adjusting bindings From 89e410b5ab350b813536559959741c36d6e97e13 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:41:36 +0100 Subject: [PATCH 252/270] add GameLevelManager::deleteComment --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index de6aab93..5b3a1ee2 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2894,6 +2894,7 @@ class GameLevelManager : cocos2d::CCNode { void uploadAccountComment(gd::string text) = win 0xb3250; void uploadLevelComment(int levelID, gd::string text, int unk) = win 0xb31c0; void uploadComment(gd::string text, CommentType type, int levelID, int unk) = win 0xb32e0; + void deleteComment(int commentID, CommentType type, int levelID) = win 0xb41a0; void downloadLevel(int id, bool downloadData) = win 0xaa730; bool hasDownloadedLevel(int id) = win 0xab830; GJGameLevel* getSavedLevel(int id) = win 0xa2ee0; From 4c6a5074c8bba595e8e2b353ad1ee161f4f17743 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:32:22 -0300 Subject: [PATCH 253/270] update changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29281b57..77daf589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Geode Changelog +## v1.3.7 +* Fix web download deadlock (16418562) +* Set max time for updating index notification (f7962246) +* Log geode version on startup (c5550a67) +* Fix logic error in addHook (5cf0f3c2) +* Improve logging + minor refactors (5083017b) +* Some bindings changes + ## v1.3.6 * Allow error responses in our WebRequest classes (237128bf) * Display unhandled C++ exceptions in crash log (fdd78aca, 0d091626, 52421d8c, 0472075f) From 445b5cdf38c22f89baeb3d450a781117d748c616 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:32:35 -0300 Subject: [PATCH 254/270] forgot the space --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77daf589..c08eb8ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,12 @@ # Geode Changelog ## v1.3.7 -* Fix web download deadlock (16418562) -* Set max time for updating index notification (f7962246) -* Log geode version on startup (c5550a67) -* Fix logic error in addHook (5cf0f3c2) -* Improve logging + minor refactors (5083017b) -* Some bindings changes + * Fix web download deadlock (16418562) + * Set max time for updating index notification (f7962246) + * Log geode version on startup (c5550a67) + * Fix logic error in addHook (5cf0f3c2) + * Improve logging + minor refactors (5083017b) + * Some bindings changes ## v1.3.6 * Allow error responses in our WebRequest classes (237128bf) From 5641c05f49276bed7f0dcd75f0595c60130ddd59 Mon Sep 17 00:00:00 2001 From: Capeling <113705504+Capeling@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:44:43 +1030 Subject: [PATCH 255/270] add windows addresses for LevelTools::getAudioFileName, LevelTools::getAudioTitle, LevelTools::artistForAudio and LevelTools::urlForAudio (#358) --- bindings/GeometryDash.bro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 5b3a1ee2..37cefce2 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5970,9 +5970,9 @@ class LevelTools { static bool verifyLevelIntegrity(gd::string, int) = mac 0x294360, win 0x18b180; static float xPosForTime(float, cocos2d::CCArray*, int) = mac 0x293d90, win 0x18acd0; static float timeForXPos(float, cocos2d::CCArray*, int) = mac 0x293eb0, win 0x18ae70; - static gd::string getAudioFileName(int) = mac 0x292840; - static gd::string getAudioTitle(int) = mac 0x2922f0; - static gd::string artistForAudio(int) = mac 0x292d90; - static gd::string urlForAudio(int) = mac 0x292f10; + static gd::string getAudioFileName(int) = mac 0x292840, win 0x189FA0; + static gd::string getAudioTitle(int) = mac 0x2922f0, win 0x189C60; + static gd::string artistForAudio(int) = mac 0x292d90, win 0x18A2D0; + static gd::string urlForAudio(int) = mac 0x292f10, win 0x18A4A0; } // clang-format on From 8f60e24686a1b650e248662d76647889b6998f12 Mon Sep 17 00:00:00 2001 From: Capeling <113705504+Capeling@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:33:01 +1030 Subject: [PATCH 256/270] Update GeometryDash.bro added more LevelTools functions, removed windows address for artistForAudio due to issues --- bindings/GeometryDash.bro | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 37cefce2..155df79a 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5970,9 +5970,14 @@ class LevelTools { static bool verifyLevelIntegrity(gd::string, int) = mac 0x294360, win 0x18b180; static float xPosForTime(float, cocos2d::CCArray*, int) = mac 0x293d90, win 0x18acd0; static float timeForXPos(float, cocos2d::CCArray*, int) = mac 0x293eb0, win 0x18ae70; - static gd::string getAudioFileName(int) = mac 0x292840, win 0x189FA0; - static gd::string getAudioTitle(int) = mac 0x2922f0, win 0x189C60; - static gd::string artistForAudio(int) = mac 0x292d90, win 0x18A2D0; - static gd::string urlForAudio(int) = mac 0x292f10, win 0x18A4A0; + static gd::string getAudioFileName(int) = mac 0x292840, win 0x189fa0; + static gd::string getAudioTitle(int) = mac 0x2922f0, win 0x189c60; + static gd::string artistForAudio(int) = mac 0x292d90; + static gd::string urlForAudio(int) = mac 0x292f10, win 0x18a4a0; + static gd::string nameForArtist(int) = win 0x18A3A0; + static gd::string ngURLForArtist(int) = win 0x18A7C0; + static gd::string ytURLForArtist(int) = win 0x18A8C0; + static gd::string fbURLForArtist(int) = win 0x18A9B0; + static gd::string getAudioString(int) = win 0x18AAA0; } // clang-format on From 385897c08e4aff7506c73569b0b053be8737ea67 Mon Sep 17 00:00:00 2001 From: Capeling <113705504+Capeling@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:17:10 +1030 Subject: [PATCH 257/270] Update GeometryDash.bro changed artistForAudio into an int, since thats what it is --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 155df79a..052c192c 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5972,7 +5972,7 @@ class LevelTools { static float timeForXPos(float, cocos2d::CCArray*, int) = mac 0x293eb0, win 0x18ae70; static gd::string getAudioFileName(int) = mac 0x292840, win 0x189fa0; static gd::string getAudioTitle(int) = mac 0x2922f0, win 0x189c60; - static gd::string artistForAudio(int) = mac 0x292d90; + static int artistForAudio(int) = mac 0x292d90, win 0x18A2D0; static gd::string urlForAudio(int) = mac 0x292f10, win 0x18a4a0; static gd::string nameForArtist(int) = win 0x18A3A0; static gd::string ngURLForArtist(int) = win 0x18A7C0; From cb8f51e86cfcdbd8713ccd9021e2af5fd9ad52bd Mon Sep 17 00:00:00 2001 From: Cvolton Date: Thu, 7 Dec 2023 00:36:17 +0100 Subject: [PATCH 258/270] add DailyLevelNode::init --- bindings/GeometryDash.bro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 09982edf..2c3519a5 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1177,6 +1177,11 @@ class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, bool m_weekly; } +[[link(android)]] +class DailyLevelNode : cocos2d::CCNode, FLAlertLayerProtocol { + bool init(GJGameLevel* level, DailyLevelPage* page, bool weekly) = mac 0x10ABB0, win 0x6C480; +} + [[link(android)]] class DialogLayer : cocos2d::CCLayerColor { static DialogLayer* create(DialogObject* dialog, int color) { From ffed1df4fc031c1d036bad51fce8d3342dd3283c Mon Sep 17 00:00:00 2001 From: Cvolton Date: Wed, 13 Dec 2023 01:01:58 +0100 Subject: [PATCH 259/270] Fix Android strip not being run without Geode CLI --- cmake/GeodeFile.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index b11d5e9c..d3a7d553 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -51,6 +51,17 @@ function(setup_geode_mod proname) # Link Geode to the mod target_link_libraries(${proname} geode-sdk) + if (ANDROID) + if (CMAKE_BUILD_TYPE STREQUAL "Release") + add_custom_command( + TARGET "${PROJECT_NAME}" POST_BUILD + DEPENDS "${PROJECT_NAME}" + COMMAND $<$:${CMAKE_STRIP}> + ARGS -S $ + ) + endif() + endif() + if (GEODE_DISABLE_CLI_CALLS) message("Skipping setting up geode mod ${proname}") return() @@ -207,17 +218,6 @@ function(setup_geode_mod proname) set_target_properties(${proname} PROPERTIES PREFIX "") set_target_properties(${proname} PROPERTIES OUTPUT_NAME ${MOD_ID}) - if (ANDROID) - if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_custom_command( - TARGET "${PROJECT_NAME}" POST_BUILD - DEPENDS "${PROJECT_NAME}" - COMMAND $<$:${CMAKE_STRIP}> - ARGS -S $ - ) - endif() - endif() - endfunction() function(create_geode_file proname) From e8a326f7cb9621f64e98faeda40f96dbfac17af0 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:31:54 -0300 Subject: [PATCH 260/270] make crashlog messagebox always appear, instead of only on GEODE_DEBUG --- loader/src/platform/windows/crashlog.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index 57e137fa..ba2b8851 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -264,10 +264,7 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) { auto text = crashlog::writeCrashlog(faultyMod, getInfo(info, faultyMod), getStacktrace(info->ContextRecord), getRegisters(info->ContextRecord)); - // show message box on debug mode - #ifdef GEODE_DEBUG MessageBoxA(nullptr, text.c_str(), "Geode Crashed", MB_ICONERROR); - #endif return EXCEPTION_CONTINUE_SEARCH; } From 44a018cdf98b541b96f4021a5f8351d2f23e52d1 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:32:19 -0300 Subject: [PATCH 261/270] recursively follow jumps in followThunkFunction --- loader/src/utils/addresser.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/loader/src/utils/addresser.cpp b/loader/src/utils/addresser.cpp index 9fd65c2f..277084fc 100644 --- a/loader/src/utils/addresser.cpp +++ b/loader/src/utils/addresser.cpp @@ -68,12 +68,19 @@ Addresser::MultipleInheritance* Addresser::instance() { intptr_t Addresser::followThunkFunction(intptr_t address) { #ifdef GEODE_IS_WINDOWS - // check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk - if (*reinterpret_cast(address) == 0xFF && *reinterpret_cast(address + 1) == 0x25) { - // read where the jmp reads from - address = *reinterpret_cast(address + 2); - // that then contains the actual address of the func - address = *reinterpret_cast(address); + for (int limit = 0; limit < 100; ++limit) { + // check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk + if (*reinterpret_cast(address) == 0xFF && *reinterpret_cast(address + 1) == 0x25) { + // read where the jmp reads from + address = *reinterpret_cast(address + 2); + // that then contains the actual address of the func + address = *reinterpret_cast(address); + } else if (*reinterpret_cast(address) == 0xE9) { + auto relative = *reinterpret_cast(address + 1); + address = address + relative + 5; + } else { + break; + } } #endif return address; From 391f63edeecfdc5369798e6497ab36fa768f4abb Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:37:29 -0300 Subject: [PATCH 262/270] implement a save file fix thank you chloe for a basis for the rewritten function Co-authored-by: qimiko <25387744+qimiko@users.noreply.github.com> --- bindings/Cocos2d.bro | 1 + loader/src/hooks/SaveFileFix.cpp | 64 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 loader/src/hooks/SaveFileFix.cpp diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 900aae67..b927c15f 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1154,6 +1154,7 @@ class cocos2d::CCTransitionFade { class cocos2d::ZipUtils { static auto compressString(gd::string, bool, int) = mac 0xe9a50; static auto decompressString(gd::string, bool, int) = mac 0xea380; + static auto decompressString2(unsigned char* data, bool decrypt, int size, int decryptionKey); static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**) = mac 0xe9cf0; } diff --git a/loader/src/hooks/SaveFileFix.cpp b/loader/src/hooks/SaveFileFix.cpp new file mode 100644 index 00000000..6681c34e --- /dev/null +++ b/loader/src/hooks/SaveFileFix.cpp @@ -0,0 +1,64 @@ +#include + +#if defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_ANDROID) + +using namespace geode::prelude; + +#include + +// This function is well known for crashing on certain save files, +// causing the game to crash at startup, known as the infamous save file bug. +// +// The exact reason for why this fails is still a bit fuzzy, but I believe it's because +// rob doesn't use the base64/inflated size correctly, and ends up relying on a null +// terminator being there when it shouldnt. +// +// To fix this, we just rewrite the function. +gd::string decompressString2(unsigned char* data, bool decrypt, int size, int decryptionKey) { + if (data == nullptr || size == 0 || *data == 0) { + return {}; + } + + if (decrypt) { + for (int i = 0; i < size; i++) { + data[i] ^= decryptionKey; + } + } + + // TODO: maybe not use cocos's base64 and inflateMemory.. + + unsigned char* out = nullptr; + auto const decodedSize = cocos2d::base64Decode(data, size, &out); + std::unique_ptr b64decoded { out }; + + if (decodedSize <= 0) { + return {}; + } + + out = nullptr; + auto const inflatedSize = cocos2d::ZipUtils::ccInflateMemory(b64decoded.get(), decodedSize, &out); + + std::unique_ptr inflated { out }; + + if (inflatedSize <= 0) { + return {}; + } + + return std::string(reinterpret_cast(inflated.get()), inflatedSize); +} + +// Modify doesnt want to work for some reason! +$execute { + Mod::get()->addHook( + reinterpret_cast( + geode::addresser::getNonVirtual( + &cocos2d::ZipUtils::decompressString2 + ) + ), + &decompressString2, + "cocos2d::ZipUtils::decompressString2", + tulip::hook::TulipConvention::Cdecl + ); +} + +#endif \ No newline at end of file From d295fc95468f51dfcccdeb65afbec1a1a1c3dddc Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:45:24 -0300 Subject: [PATCH 263/270] update comment --- loader/src/hooks/SaveFileFix.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/loader/src/hooks/SaveFileFix.cpp b/loader/src/hooks/SaveFileFix.cpp index 6681c34e..65241b65 100644 --- a/loader/src/hooks/SaveFileFix.cpp +++ b/loader/src/hooks/SaveFileFix.cpp @@ -9,9 +9,8 @@ using namespace geode::prelude; // This function is well known for crashing on certain save files, // causing the game to crash at startup, known as the infamous save file bug. // -// The exact reason for why this fails is still a bit fuzzy, but I believe it's because -// rob doesn't use the base64/inflated size correctly, and ends up relying on a null -// terminator being there when it shouldnt. +// Rob ends up relying on strlen for knowing the size of `data`, instead of just using the passed in `size`. +// Its a miracle this works most of the time, considering `data` is just binary data // // To fix this, we just rewrite the function. gd::string decompressString2(unsigned char* data, bool decrypt, int size, int decryptionKey) { From 2077a238d35a2212022604ab7edb1be9a2e12ec3 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:58:46 -0300 Subject: [PATCH 264/270] bump version and update changelog --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c08eb8ee..9d65d30a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Geode Changelog +## v1.3.8 +* Implement a save file fix for Windows (391f63ed) +* Recursively follow jumps in followThunkFunction (44a018cd) +* Remove need for GEODE_DEBUG for crashlogs (e8a326f7) +* Some bindings (f18335fa) + ## v1.3.7 * Fix web download deadlock (16418562) * Set max time for updating index notification (f7962246) diff --git a/VERSION b/VERSION index 3336003d..e05cb332 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.7 +1.3.8 From 4b7663015a3dc2f987f01f6ada85353b78862a25 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:59:11 -0300 Subject: [PATCH 265/270] (urgent) fix followThunkFunction it was following hooks for cocos functions, causing bad crashes. instead, now only follow jmp and then jmp dword ptr --- VERSION | 2 +- loader/src/hooks/SaveFileFix.cpp | 2 +- loader/src/utils/addresser.cpp | 30 ++++++++++++++++++------------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/VERSION b/VERSION index e05cb332..d4c4950a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.8 +1.3.9 diff --git a/loader/src/hooks/SaveFileFix.cpp b/loader/src/hooks/SaveFileFix.cpp index 65241b65..2ed63e25 100644 --- a/loader/src/hooks/SaveFileFix.cpp +++ b/loader/src/hooks/SaveFileFix.cpp @@ -48,7 +48,7 @@ gd::string decompressString2(unsigned char* data, bool decrypt, int size, int de // Modify doesnt want to work for some reason! $execute { - Mod::get()->addHook( + (void) Mod::get()->addHook( reinterpret_cast( geode::addresser::getNonVirtual( &cocos2d::ZipUtils::decompressString2 diff --git a/loader/src/utils/addresser.cpp b/loader/src/utils/addresser.cpp index 277084fc..ab2c172f 100644 --- a/loader/src/utils/addresser.cpp +++ b/loader/src/utils/addresser.cpp @@ -68,20 +68,26 @@ Addresser::MultipleInheritance* Addresser::instance() { intptr_t Addresser::followThunkFunction(intptr_t address) { #ifdef GEODE_IS_WINDOWS - for (int limit = 0; limit < 100; ++limit) { - // check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk - if (*reinterpret_cast(address) == 0xFF && *reinterpret_cast(address + 1) == 0x25) { - // read where the jmp reads from - address = *reinterpret_cast(address + 2); - // that then contains the actual address of the func - address = *reinterpret_cast(address); - } else if (*reinterpret_cast(address) == 0xE9) { - auto relative = *reinterpret_cast(address + 1); - address = address + relative + 5; - } else { - break; + // if theres a jmp at the start + if (*reinterpret_cast(address) == 0xE9) { + auto relative = *reinterpret_cast(address + 1); + auto newAddress = address + relative + 5; + // and if that jmp leads to a jmp dword ptr, only then follow it, + // because otherwise its just a hook. + // For some reason this [jmp -> jmp dword ptr] chain happens with a few cocos functions, + // but not all. For example: cocos2d::ZipUtils::decompressString2 + if (*reinterpret_cast(newAddress) == 0xFF && *reinterpret_cast(newAddress + 1) == 0x25) { + address = newAddress; } } + + // check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk + if (*reinterpret_cast(address) == 0xFF && *reinterpret_cast(address + 1) == 0x25) { + // read where the jmp reads from + address = *reinterpret_cast(address + 2); + // that then contains the actual address of the func + address = *reinterpret_cast(address); + } #endif return address; } \ No newline at end of file From 458248bfd61b189d4df3671b0e1b87ba9952d3ee Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:00:20 -0300 Subject: [PATCH 266/270] update changelog --- CHANGELOG.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d65d30a..25beccf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ # Geode Changelog +## v1.3.9 + * Fix followThunkFunction (4b766301) + ## v1.3.8 -* Implement a save file fix for Windows (391f63ed) -* Recursively follow jumps in followThunkFunction (44a018cd) -* Remove need for GEODE_DEBUG for crashlogs (e8a326f7) -* Some bindings (f18335fa) + * Implement a save file fix for Windows (391f63ed) + * Recursively follow jumps in followThunkFunction (44a018cd) + * Remove need for GEODE_DEBUG for crashlogs (e8a326f7) + * Some bindings (f18335fa) ## v1.3.7 * Fix web download deadlock (16418562) From c7a471660e7e934e585793567494689dc21aeef5 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sat, 16 Dec 2023 10:30:42 -0300 Subject: [PATCH 267/270] fix garage node ids being shifted when asking for name --- loader/src/ids/GJGarageLayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/loader/src/ids/GJGarageLayer.cpp b/loader/src/ids/GJGarageLayer.cpp index b4ea8425..020ce5a5 100644 --- a/loader/src/ids/GJGarageLayer.cpp +++ b/loader/src/ids/GJGarageLayer.cpp @@ -9,9 +9,13 @@ using namespace geode::prelude; $register_ids(GJGarageLayer) { // the lock does not exist for not logged in users auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0; + if (loggedInOffset == -1 && !GameManager::get()->m_clickedName) { + // adjusts for the sprite asking for your name + loggedInOffset++; + } - setIDSafe(this, 2, "username-label"); - setIDSafe(this, 6 + loggedInOffset, "player-icon"); + setIDSafe(this, 0, "username-label"); + setIDSafe(this, 0, "player-icon"); auto winSize = CCDirector::get()->getWinSize(); From 0787b8f450d421d9c81f0782a1d70ec8128b9266 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Dec 2023 22:33:32 -0300 Subject: [PATCH 268/270] message for a bug i cant recreate --- VERSION | 2 +- loader/src/hooks/SaveFileFix.cpp | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index d4c4950a..0c00f610 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.9 +1.3.10 diff --git a/loader/src/hooks/SaveFileFix.cpp b/loader/src/hooks/SaveFileFix.cpp index 2ed63e25..45b220b8 100644 --- a/loader/src/hooks/SaveFileFix.cpp +++ b/loader/src/hooks/SaveFileFix.cpp @@ -5,6 +5,17 @@ using namespace geode::prelude; #include +#include "../loader/LoaderImpl.hpp" + +void panic(std::string reason) { + LoaderImpl::get()->platformMessageBox("Critical", fmt::format( + "Your save file failed to load (reason: {})\n" + "As to not lose all of your data, the game will now abort.\n" + "Please backup your save files and try opening the game again, it might work.\n" + "Please contact the Geode Team about this", reason + )); + std::abort(); +} // This function is well known for crashing on certain save files, // causing the game to crash at startup, known as the infamous save file bug. @@ -14,23 +25,26 @@ using namespace geode::prelude; // // To fix this, we just rewrite the function. gd::string decompressString2(unsigned char* data, bool decrypt, int size, int decryptionKey) { - if (data == nullptr || size == 0 || *data == 0) { + log::debug("decompressString2 data={} size={}", reinterpret_cast(data), size); + if (data == nullptr || size == 0) { return {}; } + std::vector copiedData(data, data + size); if (decrypt) { for (int i = 0; i < size; i++) { - data[i] ^= decryptionKey; + copiedData[i] ^= decryptionKey; } } // TODO: maybe not use cocos's base64 and inflateMemory.. unsigned char* out = nullptr; - auto const decodedSize = cocos2d::base64Decode(data, size, &out); + auto const decodedSize = cocos2d::base64Decode(copiedData.data(), size, &out); std::unique_ptr b64decoded { out }; if (decodedSize <= 0) { + panic(fmt::format("base64 (size={}) (data={} size={})", decodedSize, reinterpret_cast(data), size)); return {}; } @@ -40,6 +54,7 @@ gd::string decompressString2(unsigned char* data, bool decrypt, int size, int de std::unique_ptr inflated { out }; if (inflatedSize <= 0) { + panic(fmt::format("inflate (size={}) (data={} size={})", inflatedSize, reinterpret_cast(data), size)); return {}; } From 0387314e35503a481c608900e166546f7436c104 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Dec 2023 22:35:29 -0300 Subject: [PATCH 269/270] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25beccf2..d6e7a22f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Geode Changelog +## v1.3.10 + * Panic if decompressString2 fails, to prevent data loss (0787b8f4) + ## v1.3.9 * Fix followThunkFunction (4b766301) From d22dc28ad9a00238e517d1a121a889a3f3fcb455 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 17 Dec 2023 19:38:59 +0100 Subject: [PATCH 270/270] Bindings: Improve song related stuff --- bindings/GeometryDash.bro | 29 +++++++++++++++++++++++++++-- loader/test/members/Android.cpp | 3 +++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2c3519a5..7d432bc3 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2442,7 +2442,7 @@ class GJGameLevel : cocos2d::CCNode { void dataLoaded(DS_Dictionary* dict) = mac 0x2dc0e0, win 0xbded0, ios 0x6fca4; GJDifficulty getAverageDifficulty() = win 0xbd9b0; gd::string getUnpackedLevelDescription() = mac 0x2DDB50, win 0xbf890; - gd::string lengthKeyToString(int key) = win 0xbd910; + static gd::string lengthKeyToString(int key) = mac 0x2DBBD0, win 0xbd910; static GJGameLevel* getCurrent() { auto playLayer = PlayLayer::get(); @@ -2823,6 +2823,11 @@ class GJSearchObject : cocos2d::CCNode { bool m_songFilter; } +[[link(android)]] +class GJSongBrowser : GJDropDownLayer, FLAlertLayerProtocol { + static GJSongBrowser* create(LevelSettingsObject* levelSettingsObject) = mac 0x3685D0, win 0x14CB20; +} + [[link(android)]] class GJSpecialColorSelect { static const char* textForColorIdx(int id) = mac 0x383a50, win 0x14e1d0, ios 0x113f6c; @@ -3050,6 +3055,15 @@ class GameLevelManager : cocos2d::CCNode { const char* getAccountCommentKey(int a2, int a3){ return cocos2d::CCString::createWithFormat("a_%i_%i", a2, a3)->getCString(); } + bool getBoolForKey(char const* key) { + return m_searchFilters->valueForKey(key)->boolValue(); + } + int getIntForKey(char const* key) { + return m_searchFilters->valueForKey(key)->intValue(); + } + void setIntForKey(int value, char const* key) { + m_searchFilters->setObject(cocos2d::CCString::createWithFormat("%i", value), key); + } inline static GameLevelManager* get() { return GameLevelManager::sharedState(); @@ -4605,10 +4619,20 @@ class MenuLayer : cocos2d::CCLayer, FLAlertLayerProtocol, GooglePlayDelegate { class MessageListDelegate {} [[link(android)]] -class MoreSearchLayer : FLAlertLayer { +class MoreSearchLayer : FLAlertLayer, TextInputDelegate { static MoreSearchLayer* create() = mac 0x388180, win 0x182520; virtual bool init() = mac 0x3896b0, win 0x1825c0; void onClose(cocos2d::CCObject*) = mac 0x38aa40, win 0x1848f0; + void onSongMode(cocos2d::CCObject*) = mac 0x38b030, win 0x1842d0; + void onSongFilter(cocos2d::CCObject*) = mac 0x38aea0, win 0x183e30; + + cocos2d::CCLabelBMFont* m_audioTrackName; + CCMenuItemSpriteExtra* m_songLeftBtn; + CCMenuItemSpriteExtra* m_songRightBtn; + CCMenuItemSpriteExtra* m_normalBtn; + CCMenuItemSpriteExtra* m_customBtn; + CCTextInputNode* m_enterSongID; + } [[link(android)]] @@ -4647,6 +4671,7 @@ class MusicDownloadManager : cocos2d::CCNode, PlatformDownloadDelegate { cocos2d::CCArray* getDownloadedSongs() = win 0x195640; void songStateChanged() = win 0x194d90; void onGetSongInfoCompleted(gd::string, gd::string) = mac 0x2eec60; + bool isSongDownloaded(int songID) = mac 0x2F0E10, win 0x195FF0; cocos2d::CCDictionary* m_unknownDict; cocos2d::CCArray* m_handlers; diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index dd8ff7b5..d7e61a34 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -33,4 +33,7 @@ GEODE_MEMBER_CHECK(EditorUI, m_updateTimeMarkers, 0x1a4); GEODE_MEMBER_CHECK(EditorUI, m_selectedObjects, 0x1bc); GEODE_MEMBER_CHECK(EditorUI, m_selectedObject, 0x2c4); +GEODE_MEMBER_CHECK(MoreSearchLayer, m_enterSongID, 0x1E4); +GEODE_MEMBER_CHECK(MoreSearchLayer, m_songLeftBtn, 0x1D4); + #endif \ No newline at end of file