//
// SelectFontLayer::init from 0x14028e510 to 0x14028eb26 (1558 bytes)
//
// 2 xrefs:
// > LevelSettingsLayer::onSelectFont @ 0x140321dcd
// > ??> @ 0x1406d1898
//
// 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
//
// Hidden C++ exception states: #wind=2
bool SelectFontLayer::init(SelectFontLayer *a1, LevelEditorLayer *a2)
{
bool result; // al
_BOOL8 v5; // rdx
__int64 v6; // rcx
__int64 v7; // rax
cocos2d::CCTouchDispatcher *v8; // rax
_BOOL8 v9; // rdx
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
cocos2d::CCLayer *v12; // rax
struct cocos2d::CCRect *v13; // rax
struct cocos2d::extension::CCScale9Sprite *v14; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v15; // rbx
const cocos2d::CCSize *v16; // rax
float v17; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
struct cocos2d::CCLabelBMFont *v20; // rdi
float v21; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v22; // rbx
const cocos2d::CCPoint *v23; // rax
ButtonSprite *v24; // rbx
CCMenuItemSpriteExtra *v25; // rax
cocos2d::CCMenu *v26; // rax
float v27; // xmm0_4
cocos2d::CCMenu_vtbl *v28; // rbx
const cocos2d::CCPoint *v29; // rax
__int64 *v30; // rdi
float v31; // xmm0_4
__int64 v32; // rbx
struct cocos2d::CCPoint v33; // rax
float v34; // xmm0_4
cocos2d::CCSprite *v35; // rbx
cocos2d::CCNode *v36; // rdi
float v37; // xmm0_4
cocos2d::CCNode_vtbl *v38; // rbx
struct cocos2d::CCPoint v39; // rax
struct cocos2d::CCSprite *v40; // rbx
cocos2d::CCNode *v41; // rdi
float v42; // xmm0_4
cocos2d::CCNode_vtbl *v43; // rbx
struct cocos2d::CCPoint v44; // rax
char v45[8]; // [rsp+58h] [rbp-29h] BYREF
struct cocos2d::CCPoint v46; // [rsp+60h] [rbp-21h] BYREF
cocos2d::CCRect v47; // [rsp+68h] [rbp-19h] BYREF
__int64 v48; // [rsp+78h] [rbp-9h]
__int64 v49; // [rsp+80h] [rbp-1h]
__int128 v50; // [rsp+88h] [rbp+7h] BYREF
__int64 v51; // [rsp+98h] [rbp+17h]
__int64 v52; // [rsp+A0h] [rbp+1Fh]
ButtonSprite *v53; // [rsp+F8h] [rbp+77h] BYREF
float v54; // [rsp+100h] [rbp+7Fh]
LODWORD(v53) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&v53);
if ( result )
{
if ( !a1->m_forcePrioRegistered )
{
a1->m_forcePrioRegistered = 1;
v7 = cocos2d::CCDirector::sharedDirector(v6);
v8 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 144LL))(v7);
cocos2d::CCTouchDispatcher::registerForcePrio(v8, a1, 2);
}
a1->m_noElasticity = 1;
a1->m_editorLayer = a2;
LOBYTE(v5) = 1;
a1->setTouchEnabled(a1, v5);
LOBYTE(v9) = 1;
a1->setKeypadEnabled(a1, v9);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11);
v12 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v12;
a1->addChild_1(a1, v12);
cocos2d::CCRect::CCRect(&v47, 0.0, 0.0, 80.0, 80.0);
v14 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v13);
v15 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v53, 300.0, 200.0);
v15->setContentSize(v14, v16);
v17 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v14,
4294967294LL);
v18 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v17, v54 * 0.5);
v18->setPosition_0(v14, v19);
v20 = cocos2d::CCLabelBMFont::create("Select Font", "goldFont.fnt");
a1->addChild_1(a1, v20);
v21 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v20->setScale_0)(v20);
v22 = v20->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v21, v54 * 0.5);
v22->setPosition_0(v20, v23);
v53 = (ButtonSprite *)operator new(0x2C0u);
v24 = ButtonSprite::ButtonSprite(v53);
if ( v24 )
{
if ( ButtonSprite::init_1(v24, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v24);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v24->~ButtonSprite)(v24, 1);
v24 = nullptr;
}
}
v25 = CCMenuItemSpriteExtra::create(v24, nullptr, a1, (cocos2d::SEL_MenuHandler *)AudioAssetsBrowser::onClose);
v26 = cocos2d::CCMenu::create(v25, 0);
a1->m_buttonMenu = v26;
v27 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v26,
10);
v28 = a1->m_buttonMenu->FLAlertLayer::__vftable;
cocos2d::CCPoint::CCPoint(v27, v54 * 0.5);
v28->setPosition_0(a1->m_buttonMenu, v29);
v53 = (ButtonSprite *)&v47;
v47 = 0;
v48 = 0;
v49 = 15;
v47.origin = (cocos2d::CCPoint)sub_14003AA10(0x60u);
v48 = 83;
v49 = 95;
strcpy(
*(char **)&v47.origin,
"Choose a font that will be used in this level.\nYou can only use one font at a time.");
v50 = 0;
v51 = 4;
v52 = 15;
strcpy((char *)&v50, "Help");
v30 = (__int64 *)InfoAlertButton::create(&v50, &v47);
v31 = ((float (__fastcall *)(cocos2d::CCMenu *, __int64 *))a1->m_buttonMenu->addChild_1)(a1->m_buttonMenu, v30);
v32 = *v30;
cocos2d::CCPoint::CCPoint(v31, (float)((float)(v54 * 0.5) - 150.0) + 18.0);
v33 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v46);
v34 = (*(float (__fastcall **)(__int64 *, struct cocos2d::CCPoint))(v32 + 184))(v30, v33);
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(v34, v54 * 0.5);
v35 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v35, 1);
((void (__fastcall *)(cocos2d::CCSprite *))v35->setScale_0)(v35);
v36 = CCMenuItemSpriteExtra::create(v35, nullptr, a1, (cocos2d::SEL_MenuHandler *)SelectFontLayer::onChangeFont);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v36);
v37 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v36->setTag)(v36, 1);
cocos2d::CCPoint::CCPoint(v37, 110.0);
cocos2d::CCPoint::operator+(v45, &v53);
v38 = v36->__vftable;
v39 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v47.origin);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v38->setPosition_0)(v36, v39);
v36[1].m_unknown5 = 0x40000000;
v36->setTag(v36, 1);
v40 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v40->setScale_0)(v40);
v41 = CCMenuItemSpriteExtra::create(v40, nullptr, a1, (cocos2d::SEL_MenuHandler *)SelectFontLayer::onChangeFont);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v41);
v42 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v41->setTag)(v41, 2);
cocos2d::CCPoint::CCPoint(v42, -110.0);
cocos2d::CCPoint::operator+(v45, &v53);
v43 = v41->__vftable;
v44 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v46);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v43->setPosition_0)(v41, v44);
v41[1].m_unknown5 = 0x40000000;
v41->setTag(v41, 0);
SelectFontLayer::updateFontLabel(a1);
return 1;
}
return result;
}