//
// SlideInLayer::init from 0x5931b4 to 0x593630 (1148 bytes)
//
// 2 xrefs:
// > ??> @ 0x323e8
// > ??> @ 0x113ebd0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool SlideInLayer::init(SlideInLayer *a1)
{
cocos2d::CCPoint v2; // x0
cocos2d::CCDirector *v3; // x0
cocos2d::CCTouchDispatcher *v4; // x0
char v5; // w23
cocos2d::CCDirector *v7; // x0
cocos2d::CCLayer *v8; // x0
cocos2d::CCSprite *v9; // x22
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setScaleX)(cocos2d::CCSprite *__hidden, float); // x25
cocos2d::CCDirector *v13; // x0
float v14; // s8
cocos2d::CCDirector *v15; // x0
float v16; // s0
cocos2d::CCNode *v17; // x24
cocos2d::CCSprite *v18; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
__int64 v21; // x0
cocos2d::CCSprite *v22; // x0
CCMenuItemSpriteExtra *v23; // x22
void *v24; // x0
CCMenuItemSpriteExtra *m_exitButton; // x0
cocos2d::CCMenu *v26; // x22
void (__fastcall *v27)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
float v28; // s0
float v29; // s1
float v30; // s0
float v31; // s1
unsigned int *v32; // x2
int v33; // w1
float v34; // [xsp+78h] [xbp+78h]
float v35; // [xsp+7Ch] [xbp+7Ch]
cocos2d::CCPoint v36[2]; // [xsp+80h] [xbp+80h] BYREF
cocos2d::SEL_MenuHandler v37; // 0:x2.16
v2 = (cocos2d::CCPoint)_stack_chk_guard;
*(&a1->m_closeOnHide + 1) = 1;
v36[1] = v2;
v3 = cocos2d::CCDirector::sharedDirector();
v4 = v3->getTouchDispatcher(v3);
cocos2d::CCTouchDispatcher::registerForcePrio(v4, a1, 2);
v36[0].x = 0.0;
v5 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)v36);
if ( v5 )
{
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = cocos2d::CCLayer::create();
a1->m_mainLayer = v8;
a1->addChild(a1, v8);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("pauseBG_001.png");
setAnchorPoint = v9->setAnchorPoint;
cocos2d::CCPoint::CCPoint(v36, 0.5, 0.0);
setAnchorPoint(v9, v36);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(v36, v34 * 0.5, (float)(v35 * 0.5) + -240.0);
setPosition(v9, v36);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v9, -2);
setScaleX = v9->setScaleX;
v13 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenScaleFactorW(v13);
((void (__fastcall *)(cocos2d::CCSprite *))setScaleX)(v9);
v14 = (float)(v35 - 320.0) + 4.0;
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenScaleFactorMax(v15);
if ( v16 != 1.0 && v14 > 0.0 )
{
v36[0].x = -2.8995e38;
v17 = (cocos2d::CCNode *)cocos2d::CCLayerColor::create(
(cocos2d::CCLayerColor *)v36,
(const cocos2d::_ccColor4B *)0xFFFFFFFFLL,
v34);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v17, -3);
v18 = v9;
getPosition = v9->getPosition;
v20 = v17->setPosition;
v21 = (__int64)getPosition(v18);
cocos2d::CCPoint::CCPoint(v36, 0.0, (float)(*(float *)(v21 + 4) - v14) + 2.0);
v20(v17, v36);
}
v22 = cocos2d::CCSprite::createWithSpriteFrameName("startBtn_001.png");
a1->m_exitSprite = v22;
v37.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v37.adj = 1304;
v23 = CCMenuItemSpriteExtra::create(v22, nullptr, v37);
a1->m_exitButton = v23;
sub_D153B8((int)v36, &byte_F288A0);
sub_D18EA8(&v23->m_activateSound, v36);
v24 = (void *)(*(_QWORD *)v36 - 24LL);
if ( (__int64 *)(*(_QWORD *)v36 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(*(_QWORD *)v36 - 8LL);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(*(_QWORD *)v36 - 8LL);
*(_DWORD *)(*(_QWORD *)v36 - 8LL) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v24);
}
a1->m_exitButton->setScale(a1->m_exitButton, 0.85);
m_exitButton = a1->m_exitButton;
m_exitButton->m_baseScale = 0.85;
v26 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)m_exitButton, nullptr);
a1->m_buttonMenu = v26;
v27 = v26->setPosition;
cocos2d::CCPoint::CCPoint(v36, v34 * 0.5, (float)(v35 * 0.5) + 210.0);
v27(v26, v36);
cocos2d::CCPoint::CCPoint(v36, 0.0, (float)((float)(v35 * 0.5) + -240.0) - (float)((float)(v35 - 480.0) * 0.5));
cocos2d::CCPoint::operator=(&a1->m_endPosition, v28, v29);
cocos2d::CCPoint::CCPoint(v36, a1->m_endPosition.x, a1->m_endPosition.y - v35);
cocos2d::CCPoint::operator=(&a1->m_startPosition, v30, v31);
a1->customSetup(a1);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
a1->hideLayer(a1, 1);
}
return v5;
}