//
// UILayer::init from 0x1000505e8 to 0x100050ac0 (1240 bytes)
//
// 1 xrefs:
// > UILayer::create @ 0x10005059c
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 10:57:43 +0000
//
__int64 __fastcall UILayer::init(__int64 a1, __int64 a2)
{
__int64 v4; // x0
__int64 v5; // x20
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
unsigned int i; // w23
__int64 v11; // x0
__int64 v12; // x8
_BYTE *v13; // x21
__int64 v14; // x0
__int64 v15; // x0
__int64 v16; // x21
__int64 v17; // x0
__int64 v18; // x21
__int64 v19; // x0
__int64 v20; // x0
double v21; // d0
float v22; // s8
__int64 v23; // x0
__int64 v24; // x0
__int64 v25; // x0
__int64 GameVariable; // x0
__int64 v27; // x0
double v28; // d0
__int64 v29; // x0
float v30; // s0
__int64 v31; // x0
__int64 v32; // x0
__int64 v33; // x0
__int64 v34; // x0
__int64 v35; // x21
__int64 v36; // x23
__int64 v37; // x22
__int64 v38; // x24
__int64 v39; // x0
__int64 v40; // x25
__int64 v41; // x0
__int64 v42; // x23
float v43; // s8
__int64 v44; // x0
__int64 v45; // x22
float v46; // s9
__int64 v47; // x0
float32x2_t v49; // [xsp+10h] [xbp-70h] BYREF
__int64 v50; // [xsp+18h] [xbp-68h] BYREF
LODWORD(v50) = 0;
v4 = cocos2d::CCLayerColor::initWithColor(a1, &v50);
v5 = v4;
if ( (_DWORD)v4 )
{
*(_BYTE *)(a1 + 608) = 1;
*(_QWORD *)(a1 + 600) = a2;
v6 = sub_1002E736C(v4);
*(_QWORD *)(a1 + 616) = v6;
cocos2d::CCObject::retain(v6);
v8 = GameManager::sharedState(v7);
v9 = GameManager::prepareDPadSettings(v8);
for ( i = 0; i != 4; ++i )
{
v11 = GameManager::sharedState(v9);
if ( i >= 2 )
v12 = 1436;
else
v12 = 1316;
v13 = (_BYTE *)GJUINode::create(v11 + v12);
(*(void (__fastcall **)(__int64, _BYTE *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v13, 100);
(*(void (__fastcall **)(_BYTE *, _QWORD))(*(_QWORD *)v13 + 344LL))(v13, 0);
v9 = sub_1002E74E0(*(_QWORD *)(a1 + 616), v13);
if ( (i & 1) != 0 )
v13[385] = 1;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v14 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1);
v15 = cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize(&v50, v15);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseBtn_clean_001.png");
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v16 + 912LL))(v16, 75);
v17 = CCMenuItemSpriteExtra::create(v16, 0, a1, UILayer::onPause, 0);
*(_QWORD *)(a1 + 568) = v17;
*(_DWORD *)(v17 + 412) = 0;
CCMenuItemSpriteExtra::setSizeMult(4.0);
v18 = sub_100270434(*(_QWORD *)(a1 + 568));
v19 = (*(__int64 (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v18, 16);
v20 = cocos2d::CCDirector::sharedDirector(v19);
v21 = sub_100207EB0(v20);
v22 = *(float *)&v21 + -15.0;
v24 = AppDelegate::get(v23);
if ( *(_BYTE *)(v24 + 37) )
v22 = v22 + -10.0;
v25 = GameManager::sharedState(v24);
GameVariable = GameManager::getGameVariable(v25, "0015");
if ( (GameVariable & 1) != 0 )
{
v27 = cocos2d::CCDirector::sharedDirector(GameVariable);
v28 = sub_100207EA8(v27);
v22 = *(float *)&v28 + 15.0;
}
v29 = cocos2d::CCDirector::sharedDirector(GameVariable);
v30 = sub_100207E98(v29);
v31 = (*(__int64 (__fastcall **)(__int64, float, float))(*(_QWORD *)v18 + 200LL))(v18, v22, v30 + -15.0);
v32 = cocos2d::CCMenu::create(v31);
*(_QWORD *)(a1 + 560) = v32;
v33 = (*(__int64 (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v32, 16);
v34 = sub_1002E736C(v33);
*(_QWORD *)(a1 + 632) = v34;
cocos2d::CCObject::retain(v34);
v35 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkpointBtn_001.png");
sub_1002E74E0(*(_QWORD *)(a1 + 632), v35);
v36 = CCMenuItemSpriteExtra::create(v35, 0, a1, UILayer::onCheck, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(*(_QWORD *)(a1 + 560), v36);
*(_DWORD *)(v36 + 400) = 1066192077;
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_removeCheckBtn_001.png");
sub_1002E74E0(*(_QWORD *)(a1 + 632), v37);
v38 = CCMenuItemSpriteExtra::create(v37, 0, a1, UILayer::onDeleteCheck, 0);
v39 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(*(_QWORD *)(a1 + 560), v38);
*(_DWORD *)(v38 + 400) = 1066192077;
v40 = sub_1002E736C(v39);
sub_1002E74E0(v40, v36);
sub_1002E74E0(v40, v38);
sub_1000262F4(&v49, &dbl_1009F3300);
GameToolbox::alignItemsHorisontally(v40, &v49, 0, 10.0);
CCMenuItemSpriteExtra::setSizeMult(1.5);
CCMenuItemSpriteExtra::setSizeMult(1.5);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 1272LL))(*(_QWORD *)(a1 + 560), 1);
v41 = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 560) + 344LL))(*(_QWORD *)(a1 + 560), 0);
if ( (unsigned int)PlatformToolbox::isControllerConnected(v41) )
{
v42 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
sub_1002E74E0(*(_QWORD *)(a1 + 632), v42);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v37 + 456LL))(v37, v42);
v43 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 328LL))(v37) * 0.5;
v44 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 328LL))(v37);
sub_1000262BC((float *)&v49, v43, (float)(*(float *)(v44 + 4) * 0.5) + -25.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v42 + 184LL))(v42, &v49);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v42 + 160LL))(v42, 0.8);
v45 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_X_001.png");
sub_1002E74E0(*(_QWORD *)(a1 + 632), v45);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v35 + 456LL))(v35, v45);
v46 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 328LL))(v35) * 0.5;
v47 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 328LL))(v35);
sub_1000262BC((float *)&v49, v46, (float)(*(float *)(v47 + 4) * 0.5) + -25.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v45 + 184LL))(v45, &v49);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v45 + 160LL))(v45, 0.8);
}
UILayer::updateCheckState(a1);
UILayer::togglePlatformerMode(a1, 0);
}
return v5;
}