From 11f22087672fb23657ff68dbdc8a96119bf2b52a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Wed, 7 Jun 2023 18:58:19 +0300 Subject: [PATCH 1/2] add more cocos stuff --- bindings/Cocos2d.bro | 3 +++ loader/include/Geode/cocos/CCDirector.h | 2 +- loader/include/Geode/cocos/include/ccMacros.h | 2 +- loader/include/Geode/cocos/platform/CCEGLViewProtocol.h | 9 +++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 2113cc49..73a34020 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -236,9 +236,12 @@ class cocos2d::CCEGLView { } class cocos2d::CCEGLViewProtocol { + CCEGLViewProtocol(); + virtual ~CCEGLViewProtocol(); auto getViewPortRect() const = mac 0x29e2f0; auto getScaleX() const = mac 0x29e300; auto getScaleY() const = mac 0x29e310; + virtual auto setDesignResolutionSize(float, float, ResolutionPolicy); } class cocos2d::CCFadeOut { diff --git a/loader/include/Geode/cocos/CCDirector.h b/loader/include/Geode/cocos/CCDirector.h index 385a137a..fb9c1d9b 100644 --- a/loader/include/Geode/cocos/CCDirector.h +++ b/loader/include/Geode/cocos/CCDirector.h @@ -458,7 +458,7 @@ protected: void setNextScene(void); void showStats(); - void createStatsLabel(); + RT_REMOVE(void createStatsLabel();) void calculateMPF(); void getFPSImageData(unsigned char** datapointer, unsigned int* length); diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index db902501..d0313fd6 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -245,7 +245,7 @@ It should work same as apples CFSwapInt32LittleToHost(..) Increments the GL Draws counts by one. The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ -extern unsigned int CC_DLL g_uNumberOfDraws; +extern unsigned int __declspec(dllimport) g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ /*******************/ diff --git a/loader/include/Geode/cocos/platform/CCEGLViewProtocol.h b/loader/include/Geode/cocos/platform/CCEGLViewProtocol.h index 095cb409..cdea5806 100644 --- a/loader/include/Geode/cocos/platform/CCEGLViewProtocol.h +++ b/loader/include/Geode/cocos/platform/CCEGLViewProtocol.h @@ -49,6 +49,7 @@ public: * @lua NA */ CCEGLViewProtocol(); + GEODE_CUSTOM_CONSTRUCTOR_BEGIN(CCEGLViewProtocol) /** * @lua NA */ @@ -57,22 +58,22 @@ public: /** Force destroying EGL view, subclass must implement this method. * @lua NA */ - virtual void end() = 0; + virtual void end() {} /** Get whether opengl render system is ready, subclass must implement this method. * @lua NA */ - virtual bool isOpenGLReady() = 0; + virtual bool isOpenGLReady() { return false; } /** Exchanges the front and back buffers, subclass must implement this method. * @lua NA */ - virtual void swapBuffers() = 0; + virtual void swapBuffers() {} /** Open or close IME keyboard , subclass must implement this method. * @lua NA */ - virtual void setIMEKeyboardState(bool bOpen) = 0; + virtual void setIMEKeyboardState(bool bOpen) {} /** * Get the frame size of EGL view. From ba40d39a2d1d85907a3c65321fe6c693c0bd5e57 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Wed, 7 Jun 2023 19:07:42 +0300 Subject: [PATCH 2/2] fix g_uNumberOfDraws --- loader/include/Geode/cocos/include/ccMacros.h | 2 +- loader/include/Geode/cocos/platform/android/CCPlatformDefine.h | 1 + loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h | 1 + loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h | 1 + loader/include/Geode/cocos/platform/win32/CCPlatformDefine.h | 2 ++ 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index d0313fd6..0c98e27a 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -245,7 +245,7 @@ It should work same as apples CFSwapInt32LittleToHost(..) Increments the GL Draws counts by one. The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ -extern unsigned int __declspec(dllimport) g_uNumberOfDraws; +extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ /*******************/ diff --git a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h index b46a03c0..93fe1c46 100644 --- a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h @@ -8,6 +8,7 @@ #else #define CC_DLL #endif +#define ACTUAL_CC_DLL 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 c77c38ba..74bc5d07 100644 --- a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h @@ -8,6 +8,7 @@ #else #define CC_DLL #endif +#define ACTUAL_CC_DLL 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 8455edc4..e542eecb 100644 --- a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h @@ -8,6 +8,7 @@ #else #define CC_DLL #endif +#define ACTUAL_CC_DLL CC_DLL #if CC_DISABLE_ASSERT > 0 diff --git a/loader/include/Geode/cocos/platform/win32/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/win32/CCPlatformDefine.h index 913a42df..7289e78c 100644 --- a/loader/include/Geode/cocos/platform/win32/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/win32/CCPlatformDefine.h @@ -9,8 +9,10 @@ #if defined(_USRDLL) #define CC_DLL + #define ACTUAL_CC_DLL #else // use a DLL library #define CC_DLL + #define ACTUAL_CC_DLL __declspec(dllimport) #endif #include