From 047db25b232275c0bbc1381c29df1e45140abdc4 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Wed, 27 Dec 2023 00:35:39 -0300 Subject: [PATCH 1/6] add fix for clipping rect in some layers --- cmake/Platform.cmake | 2 ++ loader/src/hooks/FixClippingRect.cpp | 16 ++++++++++++++++ loader/test/members/Windows.cpp | 1 + 3 files changed, 19 insertions(+) create mode 100644 loader/src/hooks/FixClippingRect.cpp diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 6b58e50c..5413ccbd 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -79,6 +79,7 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32") ${GEODE_LOADER_PATH}/include/link/glew32.lib ${GEODE_LOADER_PATH}/include/link/gdstring.lib ${GEODE_LOADER_PATH}/include/link/fmod.lib + opengl32 ) # Windows links against .lib and not .dll @@ -95,6 +96,7 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Android32") ${GEODE_LOADER_PATH}/include/link/android32/libssl.a ${GEODE_LOADER_PATH}/include/link/android32/libcrypto.a ${GEODE_LOADER_PATH}/include/link/android32/libcocos2dcpp.so + GLESv2 log ) diff --git a/loader/src/hooks/FixClippingRect.cpp b/loader/src/hooks/FixClippingRect.cpp new file mode 100644 index 00000000..3aeb1ebd --- /dev/null +++ b/loader/src/hooks/FixClippingRect.cpp @@ -0,0 +1,16 @@ +#include + +using namespace geode::prelude; + +struct MyGameToolbox : Modify { + static void preVisitWithClippingRect(CCNode* node, CCRect rect) { + if (node->isVisible()) { + glEnable(0xc11); + if (node->getParent()) { + // rob messed this up somehow causing nested ScrollLayers to be not clipped properly + rect.origin = node->getParent()->convertToWorldSpace(rect.origin); + } + CCEGLView::get()->setScissorInPoints(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + } + } +}; \ No newline at end of file diff --git a/loader/test/members/Windows.cpp b/loader/test/members/Windows.cpp index de9e8477..3d1ab025 100644 --- a/loader/test/members/Windows.cpp +++ b/loader/test/members/Windows.cpp @@ -27,6 +27,7 @@ GEODE_MEMBER_CHECK(BoomListView, m_tableView, 0x144); GEODE_MEMBER_CHECK(BoomListView, m_entries, 0x148); GEODE_MEMBER_CHECK(TableView, m_cellArray, 0x1b0); +GEODE_MEMBER_CHECK(CCScrollLayerExt, m_cutContent, 0x16c); From e99ac038083e5c6e1729bedd43b600488dbb1f69 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:58:07 +0300 Subject: [PATCH 2/6] add gameobject size checks --- loader/test/members/Android32.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/loader/test/members/Android32.cpp b/loader/test/members/Android32.cpp index 6312ec70..bc63dc71 100644 --- a/loader/test/members/Android32.cpp +++ b/loader/test/members/Android32.cpp @@ -35,6 +35,7 @@ GEODE_SIZE_CHECK(CCScrollLayerExt, 0x184); GEODE_SIZE_CHECK(TableView, 0x1dc); GEODE_SIZE_CHECK(CCTextInputNode, 0x1a0); GEODE_SIZE_CHECK(CCTouchDispatcher, 0x6c); +GEODE_SIZE_CHECK(CCSpritePlus, 0x208); // GEODE_MEMBER_CHECK(CCTouchDispatcher, m_forcePrio, 0x60); @@ -46,6 +47,17 @@ GEODE_MEMBER_CHECK(TableView, m_cellArray, 0x1b0); GEODE_MEMBER_CHECK(TableViewCell, m_backgroundLayer, 0x190); +GEODE_SIZE_CHECK(GameObject, 0x488); +GEODE_SIZE_CHECK(EnhancedGameObject, 0x4f0); +GEODE_SIZE_CHECK(EffectGameObject, 0x668); +GEODE_SIZE_CHECK(TextGameObject, 0x490); +GEODE_SIZE_CHECK(SmartGameObject, 0x490); +GEODE_SIZE_CHECK(ParticleGameObject, 0x618); +GEODE_SIZE_CHECK(SpecialAnimGameObject, 0x4f0); +GEODE_SIZE_CHECK(RingObject, 0x668); +GEODE_SIZE_CHECK(StartPosObject, 0x668); +GEODE_SIZE_CHECK(LabelGameObject, 0x690); +GEODE_SIZE_CHECK(EventLinkTrigger, 0x688); // GEODE_MEMBER_CHECK(CCNode, m_pUserObject, 0xcc); From d057d8b208d8fe97142921de51cb016866120f06 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Dec 2023 19:32:41 +0300 Subject: [PATCH 3/6] i am no longer lazy --- loader/src/ui/nodes/MDTextArea.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 23818afe..fb5e2046 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -1,4 +1,4 @@ -// #include +#include #include #include #include @@ -181,8 +181,7 @@ void MDTextArea::onGDProfile(CCObject* pSender) { auto profile = std::string(href->getCString()); profile = profile.substr(profile.find(":") + 1); try { - // TODO: im really lazy rn - // ProfilePage::create(std::stoi(profile), false)->show(); + ProfilePage::create(std::stoi(profile), false)->show(); } catch (...) { FLAlertLayer::create( From 67601514fd3bc4ede6ebb764a2fac4ae7e8cb494 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:31:53 -0300 Subject: [PATCH 4/6] fix ccdirector maybe --- loader/include/Geode/cocos/CCDirector.h | 10 +++++++++- loader/test/members/Windows.cpp | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/cocos/CCDirector.h b/loader/include/Geode/cocos/CCDirector.h index 82a45ddb..018c1256 100644 --- a/loader/include/Geode/cocos/CCDirector.h +++ b/loader/include/Geode/cocos/CCDirector.h @@ -468,7 +468,7 @@ protected: /** calculates delta time since last time it was called */ void calculateDeltaTime(); -protected: +public: /* The CCEGLView, where everything is rendered */ CCEGLView *m_pobOpenGLView; @@ -479,6 +479,9 @@ protected: bool m_bLandscape; bool m_bDisplayStats; + + float m_unknown; + float m_fAccumDt; float m_fFrameRate; @@ -533,10 +536,15 @@ protected: RT_ADD( CC_SYNTHESIZE(CCSceneDelegate*, m_pAppDelegate, SceneDelegate); + void* m_unknownPtr; + CCNode* m_unknownLabel; CCSize m_obScaleFactor; CCSize m_obResolutionInPixels; CC_SYNTHESIZE_READONLY_NV(TextureQuality, m_eTextureQuality, LoadedTextureQuality); CC_SYNTHESIZE_NV(bool, m_bDontCallWillSwitch, DontCallWillSwitch); + // these were just garbage memory in reclass + void* m_unknownPtr2; + void* m_unknownPtr3; ) // CCEGLViewProtocol will recreate stats labels to fit visible rect diff --git a/loader/test/members/Windows.cpp b/loader/test/members/Windows.cpp index 3d1ab025..5db4ffc9 100644 --- a/loader/test/members/Windows.cpp +++ b/loader/test/members/Windows.cpp @@ -15,6 +15,14 @@ GEODE_SIZE_CHECK(CCLayerColor, 0x1b8); // GEODE_SIZE_CHECK(CCLabelBMFont, 0x194); +GEODE_SIZE_CHECK(CCDirector, 0x130); +GEODE_MEMBER_CHECK(CCDirector, m_pobOpenGLView, 0x8c); +GEODE_MEMBER_CHECK(CCDirector, m_fFrameRate, 0xac); +GEODE_MEMBER_CHECK(CCDirector, m_pRunningScene, 0xcc); +GEODE_MEMBER_CHECK(CCDirector, m_pobScenesStack, 0xd8); +GEODE_MEMBER_CHECK(CCDirector, m_obWinSizeInPoints, 0xe8); + + GEODE_MEMBER_CHECK(CCTextInputNode, m_allowedChars, 0x174); GEODE_MEMBER_CHECK(CCTextInputNode, m_maxLabelWidth, 0x18c); GEODE_MEMBER_CHECK(CCTextInputNode, m_maxLabelScale, 0x190); @@ -29,6 +37,12 @@ GEODE_MEMBER_CHECK(BoomListView, m_entries, 0x148); GEODE_MEMBER_CHECK(TableView, m_cellArray, 0x1b0); GEODE_MEMBER_CHECK(CCScrollLayerExt, m_cutContent, 0x16c); +GEODE_SIZE_CHECK(SliderThumb, 0x140); +GEODE_SIZE_CHECK(Slider, 0x158); +GEODE_MEMBER_CHECK(Slider, m_touchLogic, 0x13c); +GEODE_SIZE_CHECK(SliderTouchLogic, 0x178); + + #endif From 8a5ff5736d1e1ea4041dfa2d5309563b15bb89c8 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:40:10 -0300 Subject: [PATCH 5/6] fix android --- loader/test/members/Android32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/test/members/Android32.cpp b/loader/test/members/Android32.cpp index bc63dc71..9fd26bfa 100644 --- a/loader/test/members/Android32.cpp +++ b/loader/test/members/Android32.cpp @@ -57,7 +57,7 @@ GEODE_SIZE_CHECK(SpecialAnimGameObject, 0x4f0); GEODE_SIZE_CHECK(RingObject, 0x668); GEODE_SIZE_CHECK(StartPosObject, 0x668); GEODE_SIZE_CHECK(LabelGameObject, 0x690); -GEODE_SIZE_CHECK(EventLinkTrigger, 0x688); +// GEODE_SIZE_CHECK(EventLinkTrigger, 0x688); // GEODE_MEMBER_CHECK(CCNode, m_pUserObject, 0xcc); From 2111530743f61bec20bcf7f5df055a1fbdbeda96 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Wed, 27 Dec 2023 19:24:18 -0300 Subject: [PATCH 6/6] fix this one function --- loader/include/Geode/cocos/CCDirector.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/cocos/CCDirector.h b/loader/include/Geode/cocos/CCDirector.h index 018c1256..ff2b0740 100644 --- a/loader/include/Geode/cocos/CCDirector.h +++ b/loader/include/Geode/cocos/CCDirector.h @@ -379,9 +379,10 @@ public: void updateScreenScale(CCSize); void applySmoothFix(); - void createStatsLabel(); void showFPSLabel(); void toggleShowFPS(bool, gd::string, cocos2d::CCPoint); + protected: + void createStatsLabel(); protected: CC_SYNTHESIZE_READONLY_NV(float, m_fScreenScaleFactor, ScreenScaleFactor);