//
// UILayer::init from 0x3fd8b8 to 0x3fdc56 (926 bytes)
//
// 1 xrefs:
// > UILayer::create @ 0x3fdd52
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:47:22 +0000
//
cocos2d::CCArray *__fastcall UILayer::init(UILayer *this, GJBaseGameLayer *a2)
{
int v3; // r5
cocos2d::CCArray *v5; // r0
cocos2d::CCObject *v6; // r0
GameManager *v7; // r0
GameManager *v8; // r0
GameManager *v9; // r0
GJUINode *v10; // r0
UIButtonConfig *v11; // r1
int *v12; // r6
unsigned int v13; // r3
cocos2d::CCDirector *v14; // r0
const char *v15; // r1
int v16; // r6
int v17; // r0
int v18; // r5
cocos2d::CCDirector *v19; // r0
cocos2d::CCDirector *v20; // r0
float v21; // s17
GameManager *v22; // r0
float v23; // r0
float v24; // s17
cocos2d::CCDirector *v25; // r0
int (__fastcall *v26)(int, _DWORD, _DWORD); // r6
cocos2d::CCDirector *v27; // r0
float v28; // r0
cocos2d::CCMenu *v29; // r0
int v30; // r0
int v31; // r3
cocos2d::CCArray *v32; // r0
cocos2d::CCObject *v33; // r0
const char *v34; // r1
cocos2d::CCObject *v35; // r5
cocos2d::CCObject *v36; // r9
const char *v37; // r1
cocos2d::CCObject *v38; // r6
cocos2d::CCObject *v39; // r8
cocos2d::CCArray *v40; // r0
cocos2d::CCArray *v41; // r11
PlatformToolbox *v42; // r0
const char *v43; // r1
cocos2d::CCObject *v44; // r8
void (__fastcall *v45)(cocos2d::CCObject *, _BYTE *); // r9
float v46; // s17
int v47; // r0
const char *v48; // r1
cocos2d::CCObject *v49; // r6
void (__fastcall *v50)(cocos2d::CCObject *, _BYTE *); // r8
float v51; // s17
int v52; // r0
cocos2d::CCArray *v54; // [sp+8h] [bp-2Ch]
char v55[8]; // [sp+14h] [bp-20h] BYREF
GameManager *(__fastcall *v56)(UILayer *, cocos2d::CCObject *); // [sp+1Ch] [bp-18h]
int v57; // [sp+20h] [bp-14h]
GameManager *(__fastcall *v58)(UILayer *, cocos2d::CCObject *); // [sp+24h] [bp-10h]
int v59; // [sp+28h] [bp-Ch]
GameManager *(__fastcall *v60)(UILayer *, cocos2d::CCObject *); // [sp+2Ch] [bp-8h]
int v61; // [sp+30h] [bp-4h]
_BYTE v62[8]; // [sp+34h] [bp+0h] BYREF
v3 = 0;
v62[0] = 0;
v62[1] = 0;
v62[2] = 0;
v62[3] = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCLayerColor::initWithColor(this, v62);
v54 = v5;
if ( v5 )
{
*((_DWORD *)this + 120) = a2;
*((_BYTE *)this + 484) = 1;
v6 = (cocos2d::CCObject *)cocos2d::CCArray::create(v5);
*((_DWORD *)this + 122) = v6;
v7 = (GameManager *)cocos2d::CCObject::retain(v6);
v8 = (GameManager *)GameManager::sharedState(v7);
v9 = (GameManager *)GameManager::prepareDPadSettings(v8);
do
{
if ( v3 > 1 )
v10 = (GJUINode *)(GameManager::sharedState(v9) + 1128);
else
v10 = (GJUINode *)(GameManager::sharedState(v9) + 1008);
v12 = GJUINode::create(v10, v11);
(*(void (__fastcall **)(UILayer *, int *, int))(*(_DWORD *)this + 232))(this, v12, 100);
(*(void (__fastcall **)(int *, _DWORD))(*v12 + 172))(v12, 0);
v9 = (GameManager *)cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 122), (cocos2d::CCObject *)v12);
v13 = v3++ & 0xFFFFFFFD;
if ( v13 == 1 )
*((_BYTE *)v12 + 321) = 1;
}
while ( v3 != 4 );
(*(void (__fastcall **)(UILayer *, int))(*(_DWORD *)this + 500))(this, 1);
(*(void (__fastcall **)(UILayer *, int))(*(_DWORD *)this + 536))(this, 1);
v14 = (cocos2d::CCDirector *)(*(int (__fastcall **)(UILayer *, int))(*(_DWORD *)this + 544))(this, 1);
cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v55);
v16 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_pauseBtn_clean_001.png", v15);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v16 + 456))(v16, 75);
v56 = UILayer::onPause;
v57 = 0;
v17 = CCMenuItemSpriteExtra::create(v16, 0, (int)this, (int)UILayer::onPause, 0);
*((_DWORD *)this + 113) = v17;
*(_DWORD *)(v17 + 324) = 0;
CCMenuItemSpriteExtra::setSizeMult(*((_DWORD *)this + 113), 4.0);
v18 = cocos2d::CCMenu::create(*((cocos2d::CCMenu **)this + 113), nullptr);
v19 = (cocos2d::CCDirector *)(*(int (__fastcall **)(UILayer *, int, int))(*(_DWORD *)this + 232))(this, v18, 16);
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
v21 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v20));
v22 = (GameManager *)GameManager::sharedState((GameManager *)LODWORD(v21));
v23 = COERCE_FLOAT(GameManager::getGameVariable(v22, "0015"));
if ( v23 == 0.0 )
{
v24 = v21 - 15.0;
}
else
{
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v23));
v23 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v25));
v24 = v23 + 15.0;
}
v26 = *(int (__fastcall **)(int, _DWORD, _DWORD))(*(_DWORD *)v18 + 100);
v27 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v23));
v28 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v27));
v29 = (cocos2d::CCMenu *)v26(v18, LODWORD(v24), v28 - 15.0);
v30 = cocos2d::CCMenu::create(v29);
v31 = *(_DWORD *)this;
*((_DWORD *)this + 112) = v30;
v32 = (cocos2d::CCArray *)(*(int (__fastcall **)(UILayer *, int, int))(v31 + 232))(this, v30, 16);
v33 = (cocos2d::CCObject *)cocos2d::CCArray::create(v32);
*((_DWORD *)this + 124) = v33;
cocos2d::CCObject::retain(v33);
v35 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_checkpointBtn_001.png",
v34);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 124), v35);
v58 = UILayer::onCheck;
v59 = 0;
v36 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v35, 0, (int)this, (int)UILayer::onCheck, 0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 112) + 228))(
*((_DWORD *)this + 112),
v36);
*((_DWORD *)v36 + 78) = 1066192077;
v38 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_removeCheckBtn_001.png",
v37);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 124), v38);
v60 = UILayer::onDeleteCheck;
v61 = 0;
v39 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v38, 0, (int)this, (int)UILayer::onDeleteCheck, 0);
v40 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 112) + 228))(
*((_DWORD *)this + 112),
v39);
*((_DWORD *)v39 + 78) = 1066192077;
v41 = (cocos2d::CCArray *)cocos2d::CCArray::create(v40);
cocos2d::CCArray::addObject(v41, v36);
cocos2d::CCArray::addObject(v41, v39);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, (const cocos2d::CCPoint *)&unk_D2B6C8);
GameToolbox::alignItemsHorisontally(*(float *)&v41, 10.0, (int)v62, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v36, 1.5);
CCMenuItemSpriteExtra::setSizeMult((int)v39, 1.5);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 112) + 636))(*((_DWORD *)this + 112), 1);
v42 = (PlatformToolbox *)UILayer::toggleCheckpointsMenu(this, 0);
if ( PlatformToolbox::isControllerConnected(v42) )
{
v44 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"controllerBtn_B_001.png",
v43);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 124), v44);
(*(void (__fastcall **)(cocos2d::CCObject *, cocos2d::CCObject *))(*(_DWORD *)v38 + 228))(v38, v44);
v45 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v44 + 92);
v46 = *(float *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)v38 + 164))(v38);
v47 = (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)v38 + 164))(v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v46 * 0.5, (float)(*(float *)(v47 + 4) * 0.5) - 25.0);
v45(v44, v62);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v44 + 80))(v44, 1061997773);
v49 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"controllerBtn_X_001.png",
v48);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 124), v49);
(*(void (__fastcall **)(cocos2d::CCObject *, cocos2d::CCObject *))(*(_DWORD *)v35 + 228))(v35, v49);
v50 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v49 + 92);
v51 = *(float *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)v35 + 164))(v35);
v52 = (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)v35 + 164))(v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v51 * 0.5, (float)(*(float *)(v52 + 4) * 0.5) - 25.0);
v50(v49, v62);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v49 + 80))(v49, 1061997773);
}
UILayer::updateCheckState((cocos2d::CCArray **)this);
UILayer::togglePlatformerMode(this, 0);
}
return v54;
}