fix destructor crashes

This commit is contained in:
altalk23 2022-07-05 21:39:33 +03:00
parent 0d74eaa2f1
commit 33d1ee02b2
10 changed files with 49 additions and 11 deletions

View file

@ -20,7 +20,9 @@ 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;
~CCApplication() = mac 0x1a3d10, ios 0x10e384;
// ~CCApplication() = mac 0x1a3d10, ios 0x10e384;
inline cocos2d::CCApplication::CCApplication() {}
inline cocos2d::CCApplication::~CCApplication() {}
}
class cocos2d::CCArray {
@ -94,7 +96,9 @@ class cocos2d::CCDictionary {
}
class cocos2d::CCDirector {
virtual ~CCDirector() = mac 0x2493a0;
inline cocos2d::CCDirector::CCDirector() {}
inline cocos2d::CCDirector::~CCDirector() {}
// virtual ~CCDirector() = mac 0x2493a0;
virtual auto init() = mac 0x248df0;
virtual auto getScheduler() = mac 0x24af00;
virtual auto setScheduler(cocos2d::CCScheduler*) = mac 0x24aec0;
@ -424,7 +428,7 @@ class cocos2d::CCMouseDispatcher {
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;
~CCMouseHandler() = mac 0x12ede0, ios 0x4375c;
}
class cocos2d::CCMoveBy {
@ -744,7 +748,7 @@ class cocos2d::CCSpriteFrameCache {
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;
~CCStandardTouchHandler() = mac 0x2482a0, ios 0x6d28;
}
class cocos2d::CCString {
@ -843,6 +847,7 @@ class cocos2d::CCTransitionFade {
// }
class cocos2d::extension::CCControl {
inline cocos2d::extension::CCControl::CCControl() {}
virtual bool init() = mac 0x1a71c0;
virtual ~CCControl() = mac 0x1a7380;
auto sendActionsForControlEvents(cocos2d::extension::CCControlEvent) = mac 0x1a7490;
@ -865,6 +870,7 @@ class cocos2d::extension::CCControl {
}
class cocos2d::extension::CCControlColourPicker {
inline cocos2d::extension::CCControlColourPicker::CCControlColourPicker() {}
~CCControlColourPicker() = mac 0x1aae30;
auto setColorValue(cocos2d::_ccColor3B const&) = mac 0x1aac10;
auto ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x1aae10;

View file

@ -781,7 +781,8 @@ class CreatorLayer : cocos2d::CCLayer {
static CreatorLayer* create() = mac 0x0, win 0x4dda0, ios 0x0;
}
class CurrencyRewardLayer {
class CurrencyRewardLayer : cocos2d::CCLayer {
inline CurrencyRewardLayer() {}
~CurrencyRewardLayer() = mac 0x447950, win 0x0, ios 0x0;
virtual void update(float) = mac 0x44a5c0, win 0x0, ios 0x0;
}
@ -918,6 +919,12 @@ class DialogObject : cocos2d::CCObject {
class DownloadMessageDelegate {}
class DrawGridLayer : cocos2d::CCLayer {
static DrawGridLayer* get() {
auto editorLayer = LevelEditorLayer::get();
if (!editorLayer) return nullptr;
return editorLayer->m_drawGridLayer;
}
bool init(cocos2d::CCNode* grid, LevelEditorLayer* editor) = mac 0x0, win 0x16c4d0, ios 0x0;
void draw() = mac 0x0, win 0x16ce90, ios 0x0;
virtual void update(float) = mac 0x0, win 0x16cd80, ios 0x0;
@ -1109,6 +1116,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
void constrainGameLayerPosition(float x, float y) = mac 0x18890, win 0x8f920, ios 0x0;
void moveGameLayer(cocos2d::CCPoint const& pos) = mac 0x1ca90, win 0x79290, ios 0x0;
void showUI(bool show) = mac 0x245b0, win 0x87180, ios 0x0;
void resetUI() = mac 0x18520;
void editObject2(cocos2d::CCObject* sender) = mac 0x0, win 0x8d1b0, ios 0x0;
void editGroup(cocos2d::CCObject* sender) = mac 0x0, win 0x8d720, ios 0x0;
void moveObjectCall(cocos2d::CCObject* sender) = mac 0x29830, win 0x8db30, ios 0x0;
@ -1186,7 +1194,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
CCMenuItemSpriteExtra* m_snapBtn;
CCMenuItemSpriteExtra* m_rotateBtn;
CCMenuItemSpriteExtra* m_playbackBtn;
CCMenuItemSpriteExtra* m_PlaytestBtn;
CCMenuItemSpriteExtra* m_playtestBtn;
CCMenuItemSpriteExtra* m_playtestStopBtn;
CCMenuItemSpriteExtra* m_trashBtn;
CCMenuItemSpriteExtra* m_linkBtn;
@ -2886,6 +2894,7 @@ class GameObject : CCSpritePlus {
return m_detailColor;
}
GameObject() = mac 0xdc4c0; // yeah why is this here wtf, seems life ego ctor created this
~GameObject() = mac 0x2f4ca0, win 0x0, ios 0x0;
virtual void update(float) = mac 0x2fbb90, win 0x0, ios 0x0;
virtual void setScaleX(float) = mac 0x335b00, win 0xe5050, ios 0x0;
@ -3565,12 +3574,12 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate {
int m_coinCount;
PAD = mac 0x40, win 0x28, android 0x0;
int m_currentLayer;
PAD = mac 0x38, win 0x28, android 0x0;
EditorUI* m_editorUI;
PAD = mac 0x40, win 0x28, android 0x0;
EditorUI* m_editorUI; // 0x5d8 on macos!!
cocos2d::CCSprite* m_backgroundLayer;
cocos2d::CCArray* m_undoObjects;
cocos2d::CCArray* m_someArray;
PAD = mac 0x16, win 0x8, android 0x0;
PAD = mac 0x8, win 0x8, android 0x0;
int m_objectsRand1;
int m_objectsRand2;
int m_objects;

View file

@ -42,9 +42,12 @@ types::ret{index} {class_name}::{function_name}({parameters}){const_whitespace}{
// basically we destruct it once by calling the gd function,
// then lock it, so that other gd destructors dont get called
if (CCDestructor::lock(this)) return;
CCDestructor::lock(this) = true;
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
func(this{argument_comma}{arguments});
// we need to construct it back so that it uhhh ummm doesnt crash
// while going to the child destructors
auto thing = new (this) {class_name}(std::monostate(), sizeof({class_name}));
CCDestructor::lock(this) = true;
}}
)GEN";

View file

@ -59,6 +59,8 @@ class CC_DLL CCKeypadHandler : public CCObject
{
GEODE_FRIEND_MODIFY
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCKeypadHandler, CCObject)
inline CCKeypadHandler() = default;
virtual ~CCKeypadHandler(void);
/** delegate */

View file

@ -139,6 +139,7 @@ public:
: m_pLabel(NULL)
, m_fOriginalScale(0.0)
{}
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCMenuItemLabel, CCMenuItem)
/**
* @js NA
* @lua NA

View file

@ -207,6 +207,9 @@ RT_ADD(
class CC_DLL CCKeyboardHandler : public CCObject
{
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCKeyboardHandler, CCObject)
inline CCKeyboardHandler() = default;
virtual ~CCKeyboardHandler();
CCKeyboardHandler& operator=(const CCKeyboardHandler&);

View file

@ -22,6 +22,9 @@ RT_ADD(
class CC_DLL CCMouseHandler : public CCObject
{
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCMouseHandler, CCObject)
inline CCMouseHandler() = default;
virtual ~CCMouseHandler();
CCMouseHandler& operator=(const CCMouseHandler&);

View file

@ -48,6 +48,8 @@ class CC_DLL CCTouchHandler : public CCObject
{
GEODE_FRIEND_MODIFY
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCTouchHandler, CCObject)
inline CCTouchHandler() = default;
virtual ~CCTouchHandler(void);
/** delegate */
@ -84,6 +86,9 @@ class CC_DLL CCStandardTouchHandler : public CCTouchHandler
{
GEODE_FRIEND_MODIFY
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCStandardTouchHandler, CCTouchHandler)
inline CCStandardTouchHandler() = default;
~CCStandardTouchHandler(void);
/** initializes a TouchHandler with a delegate and a priority */
@ -105,6 +110,9 @@ class CC_DLL CCTargetedTouchHandler : public CCTouchHandler
{
GEODE_FRIEND_MODIFY
public:
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCTargetedTouchHandler, CCTouchHandler)
inline CCTargetedTouchHandler() = default;
~CCTargetedTouchHandler(void);
/** whether or not the touches are swallowed */

View file

@ -139,6 +139,8 @@ public:
* @js ctor
*/
CCControl();
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCControl, CCLayerRGBA)
virtual bool init(void);
/**
* @js NA

View file

@ -58,6 +58,7 @@ public:
virtual void setColorValue(ccColor3B const&);
)
GEODE_MONOSTATE_CONSTRUCTOR_COCOS(CCControlColourPicker, CCControl)
CCControlColourPicker();
virtual ~CCControlColourPicker();
@ -98,4 +99,4 @@ protected:
NS_CC_EXT_END
#endif
#endif