From c8cf6e20fdfa3c4496d5a4a11d5dabdd776e088a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:20:57 +0300 Subject: [PATCH 01/12] fix appdelegate --- bindings/GeometryDash.bro | 2 +- .../cocos/layers_scenes_transitions_nodes/CCScene.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 62f2084c..b6bdfc28 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -78,7 +78,7 @@ class AnimatedSpriteDelegate { virtual void animationFinished(const char*) {} } -class AppDelegate : cocos2d::CCApplication { +class AppDelegate : cocos2d::CCApplication, cocos2d::CCSceneDelegate { void bgScale() = mac 0x3aaab0; virtual bool applicationDidFinishLaunching() = mac 0x3aa900, win 0x3cbb0; virtual void applicationDidEnterBackground() = mac 0x3aabe0, win 0x3cf40; diff --git a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCScene.h b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCScene.h index 3c327718..21003355 100644 --- a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCScene.h +++ b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCScene.h @@ -36,6 +36,15 @@ NS_CC_BEGIN * @{ */ +// geode should use the cocos2d-x-gd imo +class CCScene; + +class CC_DLL CCSceneDelegate { +public: + virtual void willSwitchToScene(CCScene* scene) {} +}; + + /** @brief CCScene is a subclass of CCNode that is used only as an abstract concept. CCScene an CCNode are almost identical with the difference that CCScene has it's @@ -71,8 +80,7 @@ public: int getHighestChildZ(void); - protected: - void* m_pIDK; + CCSceneDelegate* m_pDelegate; ) }; From ac238e54dabf9e36b2699758e288661846ae8265 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:25:53 +0300 Subject: [PATCH 02/12] fix crashlog --- loader/src/platform/mac/crashlog.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/src/platform/mac/crashlog.mm b/loader/src/platform/mac/crashlog.mm index 88a8ec09..d64c2293 100644 --- a/loader/src/platform/mac/crashlog.mm +++ b/loader/src/platform/mac/crashlog.mm @@ -2,6 +2,7 @@ #ifdef GEODE_IS_MACOS + #include <array> #include <ghc/filesystem.hpp> #include <Foundation/Foundation.h> From 8fb5a841171663392d58e6099138e84f007a6bb9 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:30:06 +0300 Subject: [PATCH 03/12] fix PlayLayer for macos --- bindings/GeometryDash.bro | 2 +- loader/test/members/MacOS.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b3c14f9d..6c000e24 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4359,7 +4359,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, cocos2d::CCSprite* m_sliderGrooveSprite; cocos2d::CCSprite* m_sliderBarSprite; cocos2d::CCSize m_sliderSize; - void* unknown680; + int unknown680; int m_activeGravityEffects; int m_gravityEffectStatus; // ?? PAD = mac 0x4, win 0x4; diff --git a/loader/test/members/MacOS.cpp b/loader/test/members/MacOS.cpp index ab931ebb..e283b385 100644 --- a/loader/test/members/MacOS.cpp +++ b/loader/test/members/MacOS.cpp @@ -17,6 +17,14 @@ GEODE_MEMBER_CHECK(EditorUI, m_selectedObject, 0x440); GEODE_MEMBER_CHECK(LevelEditorLayer, m_editorUI, 0x5d8); GEODE_MEMBER_CHECK(LevelEditorLayer, m_level, 0x618); +// PlayLayer +GEODE_MEMBER_CHECK(PlayLayer, unknown518, 0x518); +GEODE_MEMBER_CHECK(PlayLayer, unknown5f4, 0x5f4); +GEODE_MEMBER_CHECK(PlayLayer, unknown680, 0x680); +GEODE_MEMBER_CHECK(PlayLayer, unknown6a8, 0x6a8); +GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x728); +GEODE_MEMBER_CHECK(PlayLayer, m_shouldTryToKick, 0x7a8); + // GameManager GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x180); GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x188); From bfe05a77e2a1c5cabf0f7602c2c86a460099bf52 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:39:11 +0300 Subject: [PATCH 04/12] add some gameobject offsets as anchors --- loader/test/members/MacOS.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/loader/test/members/MacOS.cpp b/loader/test/members/MacOS.cpp index e283b385..5d46e14d 100644 --- a/loader/test/members/MacOS.cpp +++ b/loader/test/members/MacOS.cpp @@ -30,4 +30,27 @@ GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x180); GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x188); // GEODE_MEMBER_CHECK(GameManager, m_clickedGarage, 0x2a2); // todo: find why this is not 0x2a2 +// GameObject +GEODE_MEMBER_CHECK(GameObject, m_baseColorID, 0x27c); +GEODE_MEMBER_CHECK(GameObject, m_detailColorID, 0x280); +GEODE_MEMBER_CHECK(GameObject, m_active, 0x2e5); +GEODE_MEMBER_CHECK(GameObject, m_baseSprite, 0x348); +GEODE_MEMBER_CHECK(GameObject, m_startPosition, 0x37c); +GEODE_MEMBER_CHECK(GameObject, m_baseColor, 0x410); +GEODE_MEMBER_CHECK(GameObject, m_groups, 0x458); +GEODE_MEMBER_CHECK(GameObject, m_effectManager, 0x4d8); + +// EffectGameObject +GEODE_MEMBER_CHECK(EffectGameObject, m_duration, 0x4f0); +GEODE_MEMBER_CHECK(EffectGameObject, m_followMod, 0x530); +GEODE_MEMBER_CHECK(EffectGameObject, m_hsvValue, 0x560); +GEODE_MEMBER_CHECK(EffectGameObject, m_spawnDelay, 0x588); +GEODE_MEMBER_CHECK(EffectGameObject, m_itemBlockAID, 0x5b0); + +// TeleportGameObject +GEODE_MEMBER_CHECK(TeleportGameObject, m_orangePortal, 0x4f8); + +// StartPosObject +GEODE_MEMBER_CHECK(StartPosObject, m_levelSettings, 0x5e0); + #endif \ No newline at end of file From 8c7be452260151faa47b356e12c46d8f5854a34a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:43:22 +0300 Subject: [PATCH 05/12] fix TeleportPortalObject --- loader/test/members/MacOS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/test/members/MacOS.cpp b/loader/test/members/MacOS.cpp index 5d46e14d..e95f2f96 100644 --- a/loader/test/members/MacOS.cpp +++ b/loader/test/members/MacOS.cpp @@ -47,8 +47,8 @@ GEODE_MEMBER_CHECK(EffectGameObject, m_hsvValue, 0x560); GEODE_MEMBER_CHECK(EffectGameObject, m_spawnDelay, 0x588); GEODE_MEMBER_CHECK(EffectGameObject, m_itemBlockAID, 0x5b0); -// TeleportGameObject -GEODE_MEMBER_CHECK(TeleportGameObject, m_orangePortal, 0x4f8); +// TeleportPortalObject +GEODE_MEMBER_CHECK(TeleportPortalObject, m_orangePortal, 0x4f8); // StartPosObject GEODE_MEMBER_CHECK(StartPosObject, m_levelSettings, 0x5e0); From 8eefcec86276ea5755936703ba2a7f0d80d21c4b Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Mon, 9 Jan 2023 23:33:29 +0100 Subject: [PATCH 06/12] Added the supported metering variable to PlayLayer From my findings, legacy levels are indicated if this bool is false. If it is, GD will default to extracting the metering from the AudioEffectsLayer rather than using GameSoundManager. I say this is likely a way of indicating a legacy mode because this can be found in all levels which were made before 2.1. --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6c000e24..d4fb591f 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4376,7 +4376,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, int unknown6b8; int unknown6bc; bool unk460; - bool unk461; + bool m_isAudioMeteringSupported; cocos2d::CCDictionary* unk464; gd::map<short, bool> unk468; bool m_collisionDisabled; From 207733edd981937e33c696449d9b154320a8bcff Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 13 Jan 2023 08:36:15 +0300 Subject: [PATCH 07/12] retype a member using mats mod --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6c000e24..ef4f05d4 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4282,7 +4282,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, bool m_shouldSmoothCamera; float unused_4e0; PAD = mac 0x4, win 0x4; - cocos2d::CCObject* unknown4e8; + cocos2d::CCDrawNode* unknown4e8; float m_camera4f0; int unused4f4; float m_somegroup4f8; @@ -4620,7 +4620,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate { bool m_isHidden; int m_hasGhostTrail; GhostTrailEffect* m_ghostTrail; - void* m_unknown; + cocos2d::CCSprite* m_unknownSprite; cocos2d::CCSprite* m_iconSprite; cocos2d::CCSprite* m_iconSpriteSecondary; cocos2d::CCSprite* m_iconSpriteWhitener; From db109bfdf2475ca0430119e053805e054a5ca7ed Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Wed, 18 Jan 2023 23:05:37 +0300 Subject: [PATCH 08/12] Fix recursive ctor in minifunction --- loader/include/Geode/utils/MiniFunction.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index f11f823c..4f68dc00 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -31,6 +31,11 @@ namespace geode::utils { return new MiniFunctionState(*this); } }; + + template <class Callable, class Ret, class... Args> + concept MiniFunctionCallable = requires(Callable&& func, Args... args) { + { func(args...) } -> std::same_as<Ret>; + }; template <class Ret, class... Args> class MiniFunction<Ret(Args...)> { @@ -56,9 +61,7 @@ namespace geode::utils { } template <class Callable> - requires requires(Callable&& func, Args... args) { - { func(args...) } -> std::same_as<Ret>; - } + requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<Callable, MiniFunction<Ret, Args...>>) MiniFunction(Callable&& func) : m_state(new MiniFunctionState<std::decay_t<Callable>, Ret, Args...>(std::forward<Callable>(func))) {} @@ -83,4 +86,4 @@ namespace geode::utils { return m_state; } }; -} \ No newline at end of file +} From 50eecc2c0ba5c64809a2adf9ebd1b464356466f4 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Wed, 18 Jan 2023 23:10:00 +0300 Subject: [PATCH 09/12] Update MiniFunction.hpp --- loader/include/Geode/utils/MiniFunction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index 4f68dc00..1427d6fc 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -61,7 +61,7 @@ namespace geode::utils { } template <class Callable> - requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<Callable, MiniFunction<Ret, Args...>>) + requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<Callable, MiniFunction<FunctionType>>) MiniFunction(Callable&& func) : m_state(new MiniFunctionState<std::decay_t<Callable>, Ret, Args...>(std::forward<Callable>(func))) {} From 018a42a258b2712fcf30f558349f7647af281466 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Wed, 18 Jan 2023 23:40:33 +0300 Subject: [PATCH 10/12] Update MiniFunction.hpp --- loader/include/Geode/utils/MiniFunction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index 1427d6fc..0dd12e46 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -61,7 +61,7 @@ namespace geode::utils { } template <class Callable> - requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<Callable, MiniFunction<FunctionType>>) + requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<std::decay_t<Callable>, MiniFunction<FunctionType>>) MiniFunction(Callable&& func) : m_state(new MiniFunctionState<std::decay_t<Callable>, Ret, Args...>(std::forward<Callable>(func))) {} From 4a548ab8fdd11d8c1055fe82639d276cc64ae7ab Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:27:42 +0300 Subject: [PATCH 11/12] fix msvc string --- loader/include/Geode/c++stl/msvcstl.hpp | 51 ++++++++++++++++++------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/loader/include/Geode/c++stl/msvcstl.hpp b/loader/include/Geode/c++stl/msvcstl.hpp index eb40541f..a2f269df 100644 --- a/loader/include/Geode/c++stl/msvcstl.hpp +++ b/loader/include/Geode/c++stl/msvcstl.hpp @@ -1,6 +1,7 @@ #pragma once #include <Geode/binding/GDString.hpp> +#include <cstring> #include <string> #include <stdexcept> #include <utility> @@ -33,22 +34,44 @@ namespace gd { } public: - template <class... Params> - string(Params&&... params) { - m_data.m_pointer = 0; - m_data.m_length = 0; - m_data.m_capacity = 15; - - auto val = std::string(std::forward<Params>(params)...); - (void)this->winAssign(val.c_str(), val.size()); + string(string const& param) : string() { + (void)this->winAssign(param.c_str(), param.size()); + } + + string(string&& param) : string() { + (void)this->winAssign(param.c_str(), param.size()); + } + + string(char const* param) : string() { + (void)this->winAssign(param, std::strlen(param)); + } + + string(std::string const& param) : string() { + (void)this->winAssign(param.c_str(), param.size()); + } + + string& operator=(string const& param) { + (void)this->winAssign(param.c_str(), param.size()); + return *this; + } + + string& operator=(string&& param) { + (void)this->winAssign(param.c_str(), param.size()); + return *this; + } + + string& operator=(char const* param) { + (void)this->winAssign(param, std::strlen(param)); + return *this; + } + + string& operator=(std::string const& param) { + (void)this->winAssign(param.c_str(), param.size()); + return *this; } - template <class Param> - string& operator=(Param&& param) { - std::string val; - val = std::forward<Param>(param); - (void)this->winAssign(val.c_str(), val.size()); - return *this; + void clear() { + (void)this->winDtor(); } ~string() { From cc3c768aa5346546b9469cb1a2ae0a11b1e938e2 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:31:32 +0300 Subject: [PATCH 12/12] add default constructor --- loader/include/Geode/c++stl/msvcstl.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loader/include/Geode/c++stl/msvcstl.hpp b/loader/include/Geode/c++stl/msvcstl.hpp index a2f269df..43a91f0b 100644 --- a/loader/include/Geode/c++stl/msvcstl.hpp +++ b/loader/include/Geode/c++stl/msvcstl.hpp @@ -34,6 +34,12 @@ namespace gd { } public: + string() { + m_data.m_storage[0] = 0; + m_data.m_length = 0; + m_data.m_capacity = 15; + } + string(string const& param) : string() { (void)this->winAssign(param.c_str(), param.size()); }