//
// UILayer::init from 0x14066ff70 to 0x14067086f (2303 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::init @ 0x14030d9dc
// > ??> @ 0x140932288
//
// This function is hookable on this platform (idp: pc, 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 11:35:54 +0000
//
// Hidden C++ exception states: #wind=11
bool __fastcall UILayer::init(__int64 a1, __int64 a2)
{
bool result; // al
__int64 v5; // rcx
__int64 v6; // rcx
cocos2d::CCObject *v7; // rax
__int64 v8; // rcx
int i; // edi
__int64 v10; // rax
__int64 v11; // rcx
struct cocos2d::CCObject *v12; // rbx
__int64 v13; // rdx
__int64 v14; // rdx
__int64 v15; // rdx
__int64 v16; // rcx
__int64 v17; // rax
__int64 *v18; // rdi
__int64 v19; // rdx
void (__fastcall *v20)(__int64 *, __int64); // r8
cocos2d::CCObject *v21; // rbx
struct cocos2d::CCMenu *v22; // rdi
__int64 v23; // rcx
__int64 v24; // rcx
cocos2d::CCDirector *v25; // rax
__int64 v26; // rcx
__int64 v27; // rcx
cocos2d::CCDirector *v28; // rax
__int64 v29; // rbx
cocos2d::CCDirector *v30; // rax
__int64 v31; // rcx
__int64 v32; // rax
__int64 v33; // rcx
cocos2d::CCObject *v34; // rax
struct cocos2d::CCObject *v35; // rbp
cocos2d::CCObject *v36; // r14
struct cocos2d::CCObject *v37; // r15
__int64 v38; // rdi
__int64 v39; // rcx
cocos2d::CCArray *v40; // rbx
__int64 v41; // rax
__int64 v42; // rcx
__int64 v43; // rcx
__int64 v44; // rdx
__int64 v45; // rcx
struct cocos2d::CCObject *v46; // rdi
__int64 v47; // rbx
float v48; // xmm6_4
float *v49; // rax
__int64 v50; // rax
struct cocos2d::CCObject *v51; // rax
struct cocos2d::CCObject *v52; // rdi
__int64 v53; // rbx
float v54; // xmm6_4
float *v55; // rax
__int64 v56; // rax
struct cocos2d::CCObject *v57; // rdi
__int64 v58; // rbx
float v59; // xmm6_4
float *v60; // rax
__int64 v61; // rax
_BYTE v62[16]; // [rsp+30h] [rbp-68h] BYREF
void *v63; // [rsp+B0h] [rbp+18h] BYREF
void *v64; // [rsp+B8h] [rbp+20h]
LODWORD(v63) = 0;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v63);
if ( !result )
return result;
v5 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v64 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v5 = qword_14090BFD0;
}
*(_BYTE *)(a1 + 608) = GameManager::getGameVariable(v5, "0024");
*(_QWORD *)(a1 + 600) = a2;
v7 = (cocos2d::CCObject *)cocos2d::CCArray::create(v6);
*(_QWORD *)(a1 + 616) = v7;
cocos2d::CCObject::retain(v7);
v8 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v63 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = qword_14090BFD0;
}
GameManager::prepareDPadSettings(v8);
for ( i = 0; i < 4; ++i )
{
v10 = qword_14090BFD0;
if ( (unsigned int)i >= 2 )
{
if ( !qword_14090BFD0 )
{
v64 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
v11 = v10 + 1428;
}
else
{
if ( !qword_14090BFD0 )
{
v63 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
v11 = v10 + 1308;
}
v12 = (struct cocos2d::CCObject *)GJUINode::create(v11);
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v12, 100);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v12 + 336LL))(v12, 0);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 616), v12);
if ( ((i - 1) & 0xFFFFFFFD) == 0 )
*((_BYTE *)v12 + 385) = 1;
}
LOBYTE(v13) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v13);
LOBYTE(v14) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v14);
LOBYTE(v15) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1008LL))(a1, v15);
v17 = cocos2d::CCDirector::sharedDirector(v16);
cocos2d::CCDirector::getWinSize(v17, v62);
v18 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseBtn_clean_001.png");
v19 = v18[40];
v20 = *(void (__fastcall **)(__int64 *, __int64))(v19 + 40);
LOBYTE(v19) = 75;
v20(v18 + 40, v19);
v63 = operator new(0x208u);
v21 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v63);
if ( v21 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v21, v18, 0, a1, (__int64)UILayer::onPause) )
{
cocos2d::CCObject::autorelease(v21);
goto LABEL_22;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v21 + 8LL))(v21, 1);
}
v21 = nullptr;
LABEL_22:
*(_QWORD *)(a1 + 568) = v21;
*((_DWORD *)v21 + 103) = 0;
*(_DWORD *)(*(_QWORD *)(a1 + 568) + 372LL) = 1082130432;
v22 = cocos2d::CCMenu::create(*(struct cocos2d::CCMenuItem **)(a1 + 568), 0);
(*(void (__fastcall **)(__int64, struct cocos2d::CCMenu *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v22, 16);
v23 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v63 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v23 = qword_14090BFD0;
}
if ( !GameManager::getGameVariable(v23, "0024") )
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 568) + 336LL))(*(_QWORD *)(a1 + 568), 0);
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v24);
cocos2d::CCDirector::getScreenRight(v25);
v26 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v63 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v26 = qword_14090BFD0;
}
if ( GameManager::getGameVariable(v26, "0015") )
{
v28 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v27);
cocos2d::CCDirector::getScreenLeft(v28);
}
v29 = *(_QWORD *)v22;
v30 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v27);
cocos2d::CCDirector::getScreenTop(v30);
(*(void (__fastcall **)(struct cocos2d::CCMenu *))(v29 + 176))(v22);
v32 = cocos2d::CCMenu::create(v31);
*(_QWORD *)(a1 + 560) = v32;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v32, 16);
v34 = (cocos2d::CCObject *)cocos2d::CCArray::create(v33);
*(_QWORD *)(a1 + 632) = v34;
cocos2d::CCObject::retain(v34);
v35 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkpointBtn_001.png");
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 632), v35);
v63 = operator new(0x208u);
v36 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v63);
if ( v36 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v36, (__int64 *)v35, 0, a1, (__int64)UILayer::onCheck) )
{
cocos2d::CCObject::autorelease(v36);
goto LABEL_35;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v36 + 8LL))(v36, 1);
}
v36 = nullptr;
LABEL_35:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 560) + 464LL))(*(_QWORD *)(a1 + 560), v36);
*((_DWORD *)v36 + 100) = 1066192077;
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_removeCheckBtn_001.png");
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 632), v37);
v63 = operator new(0x208u);
v38 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v63);
if ( !v38 )
{
LABEL_39:
v38 = 0;
goto LABEL_40;
}
if ( !CCMenuItemSpriteExtra::init((__int64 *)v38, (__int64 *)v37, 0, a1, (__int64)UILayer::onDeleteCheck) )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v38 + 8LL))(v38, 1);
goto LABEL_39;
}
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v38);
LABEL_40:
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 464LL))(*(_QWORD *)(a1 + 560), v38);
*(_DWORD *)(v38 + 400) = 1066192077;
v40 = (cocos2d::CCArray *)cocos2d::CCArray::create(v39);
cocos2d::CCArray::addObject(v40, v36);
cocos2d::CCArray::addObject(v40, (struct cocos2d::CCObject *)v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, (const struct cocos2d::CCPoint *)&unk_14090BED8);
GameToolbox::alignItemsHorisontally((__int64)v40, 10.0, v41, 0);
*((_DWORD *)v36 + 93) = 1069547520;
*(_DWORD *)(v38 + 372) = 1069547520;
v42 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v64 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v42 = qword_14090BFD0;
}
if ( GameManager::getGameVariable(v42, "0071") )
goto LABEL_47;
v43 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v63 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v43 = qword_14090BFD0;
}
if ( !GameManager::getGameVariable(v43, "0024") )
LABEL_47:
v44 = 0;
else
LOBYTE(v44) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 1040LL))(*(_QWORD *)(a1 + 560), v44);
UILayer::toggleCheckpointsMenu(a1, 0);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v45) + 209) )
{
v46 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 632), v46);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCObject *))(*(_QWORD *)v37 + 464LL))(v37, v46);
v47 = *(_QWORD *)v46;
v48 = (float)(*(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v37 + 320LL))(v37) + 4)
* 0.5)
- 25.0;
v49 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v37 + 320LL))(v37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, *v49 * 0.5, v48);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v47 + 184))(v46, v50);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v46 + 160LL))(v46);
v51 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_X_001.png");
}
else
{
v52 = cocos2d::CCLabelBMFont::create("X", &qword_140704F78);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 632), v52);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCObject *))(*(_QWORD *)v37 + 464LL))(v37, v52);
v53 = *(_QWORD *)v52;
v54 = (float)(*(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v37 + 320LL))(v37) + 4)
* 0.5)
- 25.0;
v55 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v37 + 320LL))(v37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, *v55 * 0.5, v54);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v53 + 184))(v52, v56);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v52 + 160LL))(v52);
v51 = cocos2d::CCLabelBMFont::create((const char *)&word_140795C68, &qword_140704F78);
}
v57 = v51;
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 632), v51);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCObject *))(*(_QWORD *)v35 + 464LL))(v35, v57);
v58 = *(_QWORD *)v57;
v59 = (float)(*(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v35 + 320LL))(v35) + 4)
* 0.5)
- 25.0;
v60 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v35 + 320LL))(v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, *v60 * 0.5, v59);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v58 + 184))(v57, v61);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v57 + 160LL))(v57);
UILayer::updateCheckState(a1);
UILayer::togglePlatformerMode(a1, 0);
return 1;
}