diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 1614c85b..cbcd4a71 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -849,10 +849,10 @@ class cocos2d::CCTransitionFade { static cocos2d::CCTransitionFade* create(float, cocos2d::CCScene*) = mac 0x8ea30, ios 0x12c244; } -// class cocos2d::ZipUtils { -// static auto compressString(gd::string, bool, int) = mac 0xe9a50; -// static auto decompressString(gd::string, bool, int) = mac 0xea380; -// } +class cocos2d::ZipUtils { + static auto compressString(gd::string, bool, int) = mac 0xe9a50; + static auto decompressString(gd::string, bool, int) = mac 0xea380; +} class cocos2d::extension::CCControl { inline cocos2d::extension::CCControl::CCControl() {} diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 5d3c76aa..9874f928 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1040,8 +1040,8 @@ class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol { void onExitEditor(cocos2d::CCObject* sender) = mac 0x0, win 0x75660, ios 0x0; void playStep2() = mac 0x13f040, win 0x75440, ios 0x0; void onResume(cocos2d::CCObject* sender) = mac 0x0, win 0x74fe0, ios 0x0; - void onSaveAndPlay(cocos2d::CCObject* sender) = mac 0x0, win 0x753d0, ios 0x0; - void onSaveAndExit(cocos2d::CCObject* sender) = mac 0x0, win 0x75620, ios 0x0; + void onSaveAndPlay(cocos2d::CCObject* sender) = mac 0x13e1b0, win 0x753d0, ios 0x0; + void onSaveAndExit(cocos2d::CCObject* sender) = mac 0x13e230, win 0x75620, ios 0x0; void onSave(cocos2d::CCObject* sender) = mac 0x0, win 0x755a0, ios 0x0; void onExitNoSave(cocos2d::CCObject* sender) = mac 0x0, win 0x75700, ios 0x0; void uncheckAllPortals(cocos2d::CCObject* sender) = mac 0x0, win 0x74760, ios 0x0; @@ -1238,11 +1238,13 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ LevelEditorLayer* m_editorLayer; cocos2d::CCPoint m_swipeStart; cocos2d::CCPoint m_swipeEnd; - PAD = mac 0x20, win 0x20, android 0x0; + PAD = mac 0x10, win 0x10, android 0x0; + cocos2d::CCPoint m_caremaTest; + PAD = mac 0x8, win 0x8, android 0x0; GameObject* m_selectedObject; - PAD = mac 0x16, win 0x8, android 0x0; + PAD = mac 0x10, win 0x8, android 0x0; gd::string m_clipboard; - PAD = mac 0x16, win 0x8, android 0x0; + PAD = mac 0x10, win 0x8, android 0x0; int m_selectedTab; int m_timesSelected; PAD = mac 0x0, win 0x20, android 0x0; @@ -1509,9 +1511,9 @@ class GJAccountLoginDelegate { } class GJAccountManager : cocos2d::CCNode { - static GJAccountManager* sharedState() = mac 0x0, win 0x107d50, ios 0x0; + static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50, ios 0x0; - PAD = mac 0x0, win 0x4, android 0x0; + PAD = mac 0x8, win 0x4, android 0x0; gd::string m_password; gd::string m_username; int m_accountID; @@ -2743,7 +2745,7 @@ class GameManager : GManager { bool isColorUnlocked(int _id, bool _type) = mac 0x1c3b90, win 0xc53f0, ios 0x0; bool isIconUnlocked(int _id, IconType _type) = mac 0x1c35b0, win 0xc4fc0, ios 0x0; void toggleGameVariable(const char* key) = mac 0x0, win 0xc9e90, ios 0x0; - static void returnToLastScene(GJGameLevel* level) = mac 0x0, win 0xce6a0, ios 0x0; + void returnToLastScene(GJGameLevel* level) = mac 0x1d0500, win 0xce6a0, ios 0x0; bool m_switchModes; bool m_toFullscreen; @@ -3957,6 +3959,7 @@ class OptionsLayer : GJDropDownLayer, FLAlertLayerProtocol { class PauseLayer : CCBlockLayer { static PauseLayer* create(bool) = mac 0x20b1e0, win 0x1e4570, ios 0x0; void onEdit(cocos2d::CCObject*) = mac 0x20c630, win 0x1e60e0, ios 0x0; + void goEdit() = mac 0x20cc10; void onQuit(cocos2d::CCObject*) = mac 0x0, win 0x1e63d0, ios 0x0; void createToggleButton(gd::string caption, cocos2d::SEL_MenuHandler callback, bool on, cocos2d::CCMenu* menu, cocos2d::CCPoint pos) = mac 0x20c890, win 0x1e5570, ios 0x0; diff --git a/include/cocos/cocos2dx/support/zip_support/ZipUtils.h b/include/cocos/cocos2dx/support/zip_support/ZipUtils.h index 8813b943..bb0b6c28 100644 --- a/include/cocos/cocos2dx/support/zip_support/ZipUtils.h +++ b/include/cocos/cocos2dx/support/zip_support/ZipUtils.h @@ -149,19 +149,19 @@ namespace cocos2d static void ccSetPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4); RT_ADD( - static std::string base64DecodeEnc(std::string, std::string); - static std::string base64EncodeEnc(std::string, std::string); - static std::string base64URLDecode(std::string); - static std::string base64URLEncode(std::string); + static gd::string base64DecodeEnc(gd::string, gd::string); + static gd::string base64EncodeEnc(gd::string, gd::string); + static gd::string base64URLDecode(gd::string); + static gd::string base64URLEncode(gd::string); static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**); static int ccDeflateMemoryWithHint(unsigned char*, unsigned int, unsigned char**, unsigned int); - static std::string compressString(std::string, bool, int); - static std::string decompressString(std::string, bool, int); - static std::string decompressString2(unsigned char*, bool, int, int); - static std::string encryptDecrypt(std::string, int); - static std::string encryptDecryptWKey(std::string, std::string); - static unsigned char hexToChar(const std::string&); - static std::string urlDecode(const std::string&); + static gd::string compressString(gd::string, bool, int); + static gd::string decompressString(gd::string, bool, int); + static gd::string decompressString2(unsigned char*, bool, int, int); + static gd::string encryptDecrypt(gd::string, int); + static gd::string encryptDecryptWKey(gd::string, gd::string); + static unsigned char hexToChar(const gd::string&); + static gd::string urlDecode(const gd::string&); ) private: diff --git a/include/loader/Interface.hpp b/include/loader/Interface.hpp index de595b23..9c5db431 100644 --- a/include/loader/Interface.hpp +++ b/include/loader/Interface.hpp @@ -54,15 +54,12 @@ namespace geode { Severity m_severity; }; - using exportmemfn_t = void(Mod::*)(std::string const&, unknownmemfn_t); - using exportfn_t = void(Mod::*)(std::string const&, unknownfn_t); - - using loadfn_t = void(*)(Mod*); + using ScheduledFunction = std::function; Mod* m_mod = nullptr; std::vector m_scheduledHooks; std::vector m_scheduledLogs; - std::vector m_scheduledFunctions; + std::vector m_scheduledFunctions; public: static inline GEODE_HIDDEN Interface* get() { @@ -126,22 +123,7 @@ namespace geode { */ GEODE_DLL void logInfo(std::string const& info, Severity severity); - GEODE_DLL void scheduleOnLoad(loadfn_t fn); - - protected: - // GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownmemfn_t fn); - // GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownfn_t fn); - - public: - // template - // inline void exportAPIFunction(std::string const& selector, T ptr) { - // if constexpr (std::is_member_function_pointer_v) { - // exportAPIFunctionInternal(selector, cast::reference_cast(ptr)); - // } - // else { - // exportAPIFunctionInternal(selector, reinterpret_cast(ptr)); - // } - // } + GEODE_DLL void scheduleOnLoad(ScheduledFunction function); friend Mod* Mod::get(); }; diff --git a/include/syntax/InternalMacros.hpp b/include/syntax/InternalMacros.hpp index 975ea9e2..ca498c21 100644 --- a/include/syntax/InternalMacros.hpp +++ b/include/syntax/InternalMacros.hpp @@ -56,7 +56,7 @@ struct GEODE_HIDDEN derived : derived##Intermediate #define GEODE_MODIFY_REDIRECT4(base, derived) GEODE_MODIFY_DECLARE(base, derived) #define GEODE_MODIFY_REDIRECT3(base, derived) GEODE_MODIFY_DECLARE_ANONYMOUS(base, derived) -#define GEODE_MODIFY_REDIRECT2(base) GEODE_MODIFY_REDIRECT3(base, GEODE_CONCAT(hook, __COUNTER__)) +#define GEODE_MODIFY_REDIRECT2(base) GEODE_MODIFY_REDIRECT3(base, GEODE_CONCAT(hook, __LINE__)) #define GEODE_MODIFY_REDIRECT1(base) GEODE_MODIFY_REDIRECT2(base) /** @@ -82,3 +82,18 @@ struct GEODE_HIDDEN derived : derived##Intermediate #define GEODE_INTERNAL_FIELD(type, field, name) inline type& name() { return this->*field; } //#define GEODE_EXTERNAL_FIELD(type, field, name) static inline type& name##From(void* self) { return reinterpret_cast(self)->*field; } #define GEODE_FIELD(type, field, name, default_) GEODE_ONLY_FIELD(type, field, default_) GEODE_INTERNAL_FIELD(type, field, name) //GEODE_EXTERNAL_FIELD(type, field, name) + + +#define GEODE_EXECUTE_FUNC(Line_) \ +template \ +void _##Line_##Function(); \ +namespace { \ + struct _##Line_##Unique {}; \ +} \ +static inline auto _line = (Interface::get()->scheduleOnLoad( \ + &_##Line_##Function<_##Line_##Unique> \ +), 0); \ +template \ +void _##Line_##Function() + +#define $execute GEODE_EXECUTE_FUNC(__LINE__)