//
// SelectFontLayer2::init from 0x14058de50 to 0x14058e2c1 (1137 bytes)
//
// 3 xrefs:
// > LevelSettingsLayer::onSelectFont @ 0x14045b030
// > ??> @ 0x14092cc18
// > ??> @ 0x14092cc24
//
// 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:34:30 +0000
//
// Hidden C++ exception states: #wind=1
bool __fastcall SelectFontLayer2::init(__int64 a1, __int64 a2)
{
bool result; // al
__int64 v5; // rdx
__int64 v6; // rdx
__int64 v7; // rcx
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 *v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rbx
__int64 v15; // rax
struct cocos2d::CCLabelBMFont *v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rcx
__int64 v20; // rax
int v21; // eax
cocos2d::CCObject *v22; // rsi
__int64 v23; // rdi
__int64 v24; // rbx
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rcx
__int64 v28; // rax
__int64 v29; // rdx
__int64 v30; // rcx
cocos2d::CCSpriteFrameCache *v31; // rax
cocos2d::CCArray *v32; // rdi
int i; // ebx
struct cocos2d::CCObject *v34; // rax
__int64 v35; // rdx
_QWORD *v36; // rax
int v37; // edx
cocos2d::CCLayerColor *v38; // rdi
__int64 v39; // rbx
__int64 v40; // rax
__int64 v41; // [rsp+20h] [rbp-98h]
float v42; // [rsp+40h] [rbp-78h] BYREF
float v43; // [rsp+44h] [rbp-74h]
int v44; // [rsp+48h] [rbp-70h] BYREF
_BYTE v45[16]; // [rsp+50h] [rbp-68h] BYREF
__int64 v46; // [rsp+60h] [rbp-58h]
v44 = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v44);
if ( result )
{
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
*(_BYTE *)(a1 + 596) = 1;
*(_QWORD *)(a1 + 672) = a2;
LOBYTE(v5) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v5);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v6);
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v42);
v9 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v9;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v45, 0.0, 0.0, 80.0, 80.0);
v11 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v10);
v12 = *v11;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v44, 370.0, 270.0);
(*(void (__fastcall **)(__int64 *, __int64))(v12 + 312))(v11, v13);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v11,
4294967294LL);
v14 = *v11;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, v42 * 0.5, v43 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 184))(v11, v15);
v16 = cocos2d::CCLabelBMFont::create("Select Font", "goldFont.fnt");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v16);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v16 + 160LL))(v16);
v17 = *(_QWORD *)v16;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, v42 * 0.5, (float)((float)(v43 * 0.5) + 135.0) - 16.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v17 + 184))(v16, v18);
v20 = cocos2d::CCMenu::create(v19);
*(_QWORD *)(a1 + 552) = v20;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v20, 10);
v21 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v22 = CCMenuItemSpriteExtra::create(v21, 0, a1, (__int64)PagedListPopup::onClose);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v22);
*((_DWORD *)v22 + 93) = 1070386381;
v23 = *(_QWORD *)v22;
v24 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v44,
(float)((float)(v42 * 0.5) - 185.0) + 10.0,
(float)((float)(v43 * 0.5) + 135.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(v24, v45, v25);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v23 + 184))(v22, v26);
*(_DWORD *)(a1 + 640) = -1;
if ( !*(_BYTE *)(a1 + 688) )
{
v28 = cocos2d::CCFileUtils::sharedFileUtils(v27);
(*(void (__fastcall **)(__int64, _BYTE *, const char *, _QWORD))(*(_QWORD *)v28 + 40LL))(
v28,
v45,
"GJ_FontSheet.png",
0);
if ( v46 )
{
v31 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v30, v29);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v31, "GJ_FontSheet.plist");
*(_BYTE *)(a1 + 688) = 1;
}
sub_14003D310((__int64)v45);
}
*(_DWORD *)(a1 + 692) = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 672) + 3528LL) + 360LL);
v32 = cocos2d::CCArray::createWithCapacity(0x3Cu);
for ( i = 0; i < 60; ++i )
{
v34 = cocos2d::CCInteger::create(i);
cocos2d::CCArray::addObject(v32, v34);
}
v35 = a1 + 664;
if ( !a1 )
v35 = 0;
v36 = CustomListView::create(v32, v35, 200.0, 340.0, v41, 33);
*(_QWORD *)(a1 + 680) = v36;
v38 = GJCommentListLayer::create((int)v36, v37, -13487566, 340.0, 1128792064, 1, 0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLayerColor *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v38,
10);
v39 = *(_QWORD *)v38;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v45,
(float)(v42 - 340.0) * 0.5,
(float)((float)(v43 - 200.0) * 0.5) - 10.0);
(*(void (__fastcall **)(cocos2d::CCLayerColor *, __int64))(v39 + 184))(v38, v40);
return 1;
}
return result;
}