//
// SelectFontLayer::updateFontLabel from 0x14028eb30 to 0x14028ed27 (503 bytes)
//
// 3 xrefs:
// > SelectFontLayer::init @ 0x14028eafd
// > SelectFontLayer::onChangeFont @ 0x14028edb8
// > ??> @ 0x1406d18a4
//
// 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=3
void SelectFontLayer::updateFontLabel(SelectFontLayer *a1)
{
float v1; // xmm0_4
int m_fontIndex; // ebx
cocos2d::CCLabelBMFont *m_fontLabel; // rcx
cocos2d::CCString *v5; // rax
const char *CString; // rsi
GameManager *v7; // rcx
GameManager *v8; // rcx
GameManager *v9; // rbx
int m_loadedFont; // eax
int v11; // ebx
cocos2d::CCString *v12; // rax
const char *v13; // rax
cocos2d::CCLabelBMFont *v14; // rax
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
cocos2d::CCLabelBMFont_vtbl *v17; // rbx
const cocos2d::CCPoint *v18; // rax
float v19; // [rsp+30h] [rbp+8h]
void *v20; // [rsp+38h] [rbp+10h]
void *v21; // [rsp+38h] [rbp+10h]
void *v22; // [rsp+38h] [rbp+10h]
m_fontIndex = a1->m_editorLayer->m_levelSettings->m_fontIndex;
if ( a1->m_font != m_fontIndex )
{
m_fontLabel = a1->m_fontLabel;
if ( m_fontLabel )
{
m_fontLabel->removeFromParent(m_fontLabel);
a1->m_fontLabel = nullptr;
}
a1->m_font = m_fontIndex;
v5 = cocos2d::CCString::createWithFormat("Font %i", m_fontIndex + 1);
CString = cocos2d::CCString::getCString(v5);
v7 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = (GameManager *)qword_1406C2ED8;
}
GameManager::loadFont(v7, a1->m_font);
v8 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v21 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
v9 = v8;
if ( !v8 )
{
v22 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
m_loadedFont = v9->m_loadedFont;
v11 = 59;
if ( m_loadedFont < 59 )
v11 = m_loadedFont;
if ( v11 <= 0 )
{
GameManager::loadFont(v8, 0);
v13 = (const char *)&qword_14052A4D8;
}
else
{
GameManager::loadFont(v8, v11);
v12 = cocos2d::CCString::createWithFormat("gjFont%02d.fnt", v11);
v13 = cocos2d::CCString::getCString(v12);
}
v14 = cocos2d::CCLabelBMFont::create(CString, v13);
a1->m_fontLabel = v14;
a1->addChild_1(a1, v14);
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::getWinSize(v16);
v17 = a1->m_fontLabel->__vftable;
cocos2d::CCPoint::CCPoint(v1, v19 * 0.5);
v17->setPosition_0(a1->m_fontLabel, v18);
}
}