//
// cocos2d::CCLabelBMFont::createFontChars from 0xae5cfc to 0xae65a8 (2220 bytes)
//
// 3 xrefs:
// > cocos2d::CCLabelBMFont::setString @ 0xae75e8
// > cocos2d::CCLabelBMFont::setFntFile @ 0xae7720
// > ??> @ 0x31e60
//
// 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
//
void cocos2d::CCLabelBMFont::createFontChars(cocos2d::CCLabelBMFont *a1)
{
unsigned __int16 *m_sString; // x0
__int64 v3; // x20
int v4; // w1
int v5; // w0
int m_nCommonHeight; // w2
__int64 v7; // x23
unsigned int v8; // w22
int v9; // w20
int v10; // w28
cocos2d::CCBMFontConfiguration *m_pConfiguration; // x0
int m_nExtraKerning; // w1
cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // x5
int v14; // w0
unsigned int v15; // w2
unsigned int v16; // w1
UT_hash_table *tbl; // x27
int v18; // w0
unsigned int v19; // w2
unsigned int v20; // w1
int v21; // w0
UT_hash_handle *hh_head; // x0
__int64 v23; // x28
float v24; // s8
float v25; // s8
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x21
cocos2d::CCDirector *v27; // x0
float v28; // s8
float v29; // s9
cocos2d::CCDirector *v30; // x0
float v31; // s0
float x; // s11
cocos2d::CCDirector *v33; // x0
float v34; // s11
float y; // s8
cocos2d::CCDirector *v36; // x0
float v37; // s1
float v38; // s9
cocos2d::CCDirector *v39; // x0
float v40; // s2
float v41; // s8
cocos2d::CCDirector *v42; // x0
float v43; // s0
float v44; // s2
cocos2d::CCNode *(__fastcall *getChildByTag)(cocos2d::CCNode *__hidden, int); // x2
__int64 v46; // x0
__int64 v47; // x28
float v48; // s12
float v49; // s8
float v50; // s11
float v51; // s9
cocos2d::CCDirector *v52; // x0
float v53; // s0
float v54; // s9
void (__fastcall *v55)(__int64, cocos2d::CCRect *); // x20
cocos2d::CCDirector *v56; // x0
float v57; // s9
float v58; // s8
cocos2d::CCDirector *v59; // x0
float v60; // s0
int v61; // w0
float width; // s9
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x21
cocos2d::CCDirector *v64; // x0
float v65; // s9
float height; // s8
cocos2d::CCDirector *v67; // x0
float ContentScaleFactor; // s0
float v69; // s9
cocos2d::CCDirector *v70; // x0
float v71; // s0
int v72; // w0
float v73; // s8
cocos2d::CCDirector *v74; // x0
float v75; // s0
_BOOL4 m_bIsBatched; // w0
void (__fastcall *v77)(__int64, cocos2d::CCTexture2D *, cocos2d::CCRect *); // x3
cocos2d::CCObject *v78; // x2
cocos2d::CCTexture2D *v79; // x1
unsigned int v80; // [xsp+9Ch] [xbp+9Ch]
int v81; // [xsp+A0h] [xbp+A0h]
float v82; // [xsp+A0h] [xbp+A0h]
std::_Rb_tree_node_base *p_M_header; // [xsp+B8h] [xbp+B8h]
unsigned __int16 v84; // [xsp+C0h] [xbp+C0h]
float v85; // [xsp+C0h] [xbp+C0h]
void (__fastcall *v86)(__int64, cocos2d::CCTexture2D *, cocos2d::CCRect *); // [xsp+C0h] [xbp+C0h]
std::set *CharacterSet; // [xsp+D0h] [xbp+D0h]
int v88; // [xsp+D8h] [xbp+D8h]
int v89; // [xsp+DCh] [xbp+DCh]
int v90; // [xsp+DCh] [xbp+DCh]
int v91; // [xsp+E0h] [xbp+E0h]
int v92; // [xsp+E4h] [xbp+E4h]
int v93; // [xsp+E8h] [xbp+E8h]
int v94; // [xsp+F4h] [xbp+F4h] BYREF
cocos2d::CCSize v95; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v96; // [xsp+100h] [xbp+100h] BYREF
cocos2d::CCRect v97; // [xsp+108h] [xbp+108h] BYREF
cocos2d::CCRect v98; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCSize v99; // [xsp+128h] [xbp+128h] BYREF
float v100; // [xsp+134h] [xbp+134h]
float v101; // [xsp+138h] [xbp+138h]
__int16 v102; // [xsp+13Ch] [xbp+13Ch]
__int16 v103; // [xsp+13Eh] [xbp+13Eh]
__int16 v104; // [xsp+140h] [xbp+140h]
cocos2d::CCSize::CCSize(&v95, &stru_12452E8);
m_sString = a1->m_sString;
if ( !m_sString || (v91 = cocos2d::cc_wcslen(m_sString)) == 0 )
{
width = v95.width;
setContentSize = a1->setContentSize;
v64 = cocos2d::CCDirector::sharedDirector();
v65 = width / cocos2d::CCDirector::getContentScaleFactor(v64);
height = v95.height;
v67 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v67);
cocos2d::CCSize::CCSize(&v99, v65, height / ContentScaleFactor);
setContentSize(a1, &v99);
return;
}
CharacterSet = cocos2d::CCBMFontConfiguration::getCharacterSet(a1->m_pConfiguration);
if ( v91 == 1 )
{
v4 = 1;
}
else
{
v3 = 0;
v4 = 1;
do
{
v5 = a1->m_sString[v3++];
if ( v5 == 10 )
++v4;
}
while ( v91 - 1 > (unsigned int)v3 );
}
v84 = -1;
m_nCommonHeight = a1->m_pConfiguration->m_nCommonHeight;
p_M_header = &CharacterSet->_M_t._M_impl._M_header;
v88 = 0;
v80 = v4 * m_nCommonHeight;
v7 = 0;
v92 = v4 * m_nCommonHeight - m_nCommonHeight;
v8 = 0;
v93 = 0;
cocos2d::CCRect::CCRect(&v97);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v99.height);
do
{
while ( 1 )
{
v9 = a1->m_sString[v7];
if ( v9 != 10 )
break;
v93 = 0;
v92 -= a1->m_pConfiguration->m_nCommonHeight;
LABEL_10:
++v8;
++v7;
if ( v91 == v8 )
goto LABEL_20;
}
LODWORD(v98.origin.x) = a1->m_sString[v7];
v10 = v9;
if ( p_M_header == (std::_Rb_tree_node_base *)std::_Rb_tree,std::less,std::allocator>::find(
(__int64)CharacterSet,
(unsigned int *)&v98) )
{
switch ( v9 )
{
case 'a':
v10 = 65;
LOWORD(v9) = 65;
break;
case 'b':
v10 = 66;
LOWORD(v9) = 66;
break;
case 'c':
v10 = 67;
LOWORD(v9) = 67;
break;
case 'd':
v10 = 68;
LOWORD(v9) = 68;
break;
case 'e':
v10 = 69;
LOWORD(v9) = 69;
break;
case 'f':
v10 = 70;
LOWORD(v9) = 70;
break;
case 'g':
v10 = 71;
LOWORD(v9) = 71;
break;
case 'h':
v10 = 72;
LOWORD(v9) = 72;
break;
case 'i':
v10 = 73;
LOWORD(v9) = 73;
break;
case 'j':
v10 = 74;
LOWORD(v9) = 74;
break;
case 'k':
v10 = 75;
LOWORD(v9) = 75;
break;
case 'l':
v10 = 76;
LOWORD(v9) = 76;
break;
case 'm':
v10 = 77;
LOWORD(v9) = 77;
break;
case 'n':
v10 = 78;
LOWORD(v9) = 78;
break;
case 'o':
v10 = 79;
LOWORD(v9) = 79;
break;
case 'p':
v10 = 80;
LOWORD(v9) = 80;
break;
case 'q':
v10 = 81;
LOWORD(v9) = 81;
break;
case 'r':
v10 = 82;
LOWORD(v9) = 82;
break;
case 's':
v10 = 83;
LOWORD(v9) = 83;
break;
case 't':
v10 = 84;
LOWORD(v9) = 84;
break;
case 'u':
v10 = 85;
LOWORD(v9) = 85;
break;
case 'v':
v10 = 86;
LOWORD(v9) = 86;
break;
case 'w':
v10 = 87;
LOWORD(v9) = 87;
break;
case 'x':
v10 = 88;
LOWORD(v9) = 88;
break;
case 'y':
v10 = 89;
LOWORD(v9) = 89;
break;
case 'z':
v10 = 90;
LOWORD(v9) = 90;
break;
default:
goto LABEL_10;
}
LODWORD(v98.origin.x) = v10;
if ( p_M_header == (std::_Rb_tree_node_base *)std::_Rb_tree,std::less,std::allocator>::find(
(__int64)CharacterSet,
(unsigned int *)&v98) )
goto LABEL_10;
}
v89 = cocos2d::CCLabelBMFont::kerningAmountForFirst(a1, v84, v9);
m_pConfiguration = a1->m_pConfiguration;
m_nExtraKerning = a1->m_nExtraKerning;
v94 = v10;
m_pFontDefDictionary = m_pConfiguration->m_pFontDefDictionary;
v81 = m_nExtraKerning;
if ( !m_pFontDefDictionary )
goto LABEL_10;
v14 = ((unsigned __int8)v94 + 17973517 + (HIBYTE(v94) << 24) + (BYTE2(v94) << 16) + (BYTE1(v94) << 8)) ^ 0x7F76D;
v15 = (-1622558010 - v14) ^ (v14 << 8);
v16 = (-17973517 - v14 - v15) ^ (v15 >> 13);
tbl = m_pFontDefDictionary->hh.tbl;
v18 = (v14 - v15 - v16) ^ (v16 >> 12);
v19 = (v15 - v16 - v18) ^ (v18 << 16);
v20 = (v16 - v18 - v19) ^ (v19 >> 5);
v21 = (v18 - v19 - v20) ^ (v20 >> 3);
hh_head = tbl->buckets[((v20 - v21 - ((v19 - v20 - v21) ^ (v21 << 10)))
^ (((v19 - v20 - v21) ^ (v21 << 10)) >> 15))
& (tbl->num_buckets - 1)].hh_head;
if ( hh_head )
goto LABEL_15;
v23 = 0;
while ( 2 )
{
if ( !v23 )
goto LABEL_10;
if ( *(_DWORD *)(v23 + 80) == 4 && !memcmp(*(const void **)(v23 + 72), &v94, 4u) )
{
v99.width = *(float *)(v23 + 4);
v90 = v81 + v89;
cocos2d::CCRect::operator=((cocos2d::CCRect *)&v99.height, (float *)(v23 + 8));
v102 = *(_WORD *)(v23 + 24);
v103 = *(_WORD *)(v23 + 26);
v104 = *(_WORD *)(v23 + 28);
cocos2d::CCRect::operator=(&v97, &v99.height);
x = v97.origin.x;
v33 = cocos2d::CCDirector::sharedDirector();
v34 = x / cocos2d::CCDirector::getContentScaleFactor(v33);
y = v97.origin.y;
v36 = cocos2d::CCDirector::sharedDirector();
v37 = y / cocos2d::CCDirector::getContentScaleFactor(v36);
v38 = v97.size.width;
v82 = v37;
v39 = cocos2d::CCDirector::sharedDirector();
v40 = v38 / cocos2d::CCDirector::getContentScaleFactor(v39);
v41 = v97.size.height;
v85 = v40;
v42 = cocos2d::CCDirector::sharedDirector();
v43 = cocos2d::CCDirector::getContentScaleFactor(v42);
cocos2d::CCRect::CCRect(&v98, v34, v82, v85, v41 / v43);
cocos2d::CCRect::operator=(&v97, (float *)&v98.origin);
v44 = a1->m_tImageOffset.y;
getChildByTag = a1->getChildByTag;
v97.origin.x = v97.origin.x + a1->m_tImageOffset.x;
v97.origin.y = v97.origin.y + v44;
v46 = (__int64)getChildByTag(a1, v8);
v47 = v46;
if ( v46 )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v46 + 328LL))(v46, 1);
v48 = (float)v90;
}
else
{
v47 = operator new(0x280u);
cocos2d::CCSprite::CCSprite((cocos2d::CCSprite *)v47);
*(_DWORD *)(v47 + 596) = 0;
*(_DWORD *)(v47 + 600) = 0;
*(_BYTE *)(v47 + 604) = 0;
*(_QWORD *)v47 = &off_1202410;
*(_QWORD *)(v47 + 320) = &off_12028E8;
*(_QWORD *)(v47 + 344) = &off_1202968;
*(_DWORD *)(v47 + 628) = 0;
*(_DWORD *)(v47 + 608) = 0;
*(_DWORD *)(v47 + 612) = 0;
*(_DWORD *)(v47 + 616) = 0;
*(_DWORD *)(v47 + 620) = 0;
*(_DWORD *)(v47 + 624) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v47 + 632));
v69 = (float)v102;
v70 = cocos2d::CCDirector::sharedDirector();
v71 = cocos2d::CCDirector::getContentScaleFactor(v70);
v48 = (float)v90;
v72 = a1->m_pConfiguration->m_nCommonHeight;
*(float *)(v47 + 596) = (float)(v69 / v71) + (float)v90;
v73 = (float)((float)v72 - v101) * 0.5;
v74 = cocos2d::CCDirector::sharedDirector();
v75 = cocos2d::CCDirector::getContentScaleFactor(v74);
m_bIsBatched = a1->m_bIsBatched;
v77 = *(void (__fastcall **)(__int64, cocos2d::CCTexture2D *, cocos2d::CCRect *))(*(_QWORD *)v47 + 1000LL);
*(float *)(v47 + 600) = v73 / v75;
if ( m_bIsBatched )
{
v77(v47, a1->m_pSomeTexture, &v97);
}
else
{
v86 = v77;
v79 = a1->m_pobTextureAtlas->getTexture(a1->m_pobTextureAtlas);
v86(v47, v79, &v97);
}
if ( a1->m_bIsBatched )
cocos2d::CCArray::addObject(a1->m_pTargetArray, (cocos2d::_ccArray *)v47, v78);
else
a1->addChild_1(a1, (cocos2d::CCNode *)v47, v8, v8);
cocos2d::CCObject::release((cocos2d::CCObject *)v47);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v47 + 976LL))(v47, a1->m_bIsOpacityModifyRGB);
(*(void (__fastcall **)(__int64, cocos2d::ccColor3B *))(*(_QWORD *)v47 + 952LL))(v47, &a1->m_tDisplayedColor);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v47 + 904LL))(v47, a1->m_cDisplayedOpacity);
}
v84 = v9;
(*(void (__fastcall **)(__int64, cocos2d::CCRect *, _QWORD, cocos2d::CCSize *))(*(_QWORD *)v47 + 1128LL))(
v47,
&v97,
0,
&v97.size);
v49 = v97.size.height * 0.5;
v50 = (float)v92 + (float)(a1->m_pConfiguration->m_nCommonHeight - v103);
v51 = (float)((float)((float)v93 + (float)v102) + (float)(v100 * 0.5)) + v48;
v52 = cocos2d::CCDirector::sharedDirector();
v53 = cocos2d::CCDirector::getContentScaleFactor(v52);
cocos2d::CCPoint::CCPoint(&v96, v51, v50 - (float)(v49 * v53));
v54 = v96.x;
v55 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v47 + 184LL);
v56 = cocos2d::CCDirector::sharedDirector();
v57 = v54 / cocos2d::CCDirector::getContentScaleFactor(v56);
v58 = v96.y;
v59 = cocos2d::CCDirector::sharedDirector();
v60 = cocos2d::CCDirector::getContentScaleFactor(v59);
cocos2d::CCPoint::CCPoint(&v98.origin, v57, v58 / v60);
v55(v47, &v98);
v61 = v93 + v104 + v90;
v93 = v61;
if ( v88 >= v61 )
v61 = v88;
v88 = v61;
goto LABEL_10;
}
hh_head = *(UT_hash_handle **)(v23 + 64);
if ( hh_head )
{
LABEL_15:
v23 = (__int64)hh_head - tbl->hho;
continue;
}
break;
}
++v8;
++v7;
}
while ( v91 != v8 );
LABEL_20:
v24 = (float)v104;
if ( v24 < v100 )
v25 = (float)(v100 + (float)v88) - v24;
else
v25 = (float)v88;
v95.width = v25;
v26 = a1->setContentSize;
v95.height = (float)v80;
v27 = cocos2d::CCDirector::sharedDirector();
v28 = v25 / cocos2d::CCDirector::getContentScaleFactor(v27);
v29 = v95.height;
v30 = cocos2d::CCDirector::sharedDirector();
v31 = cocos2d::CCDirector::getContentScaleFactor(v30);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v98, v28, v29 / v31);
v26(a1, (const cocos2d::CCSize *)&v98);
}