//
// cocos2d::CCLabelBMFont::initWithString from 0x1005d86e0 to 0x1005d898a (682 bytes)
//
// 8 xrefs:
// > CCCounterLabel::create @ 0x10051169e
// > CCCounterLabel::init @ 0x100511747
// > cocos2d::CCLabelBMFont::create_1 @ 0x1005d8498
// > cocos2d::CCLabelBMFont::create @ 0x1005d853a
// > cocos2d::CCLabelBMFont::create_2 @ 0x1005d85e2
// > cocos2d::CCLabelBMFont::create_3 @ 0x1005d8690
// > cocos2d::CCLabelBMFont::createBatched @ 0x1005d8a0d
// > cocos2d::CCLabelBMFont::init @ 0x1005d8a85
//
// 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
//
bool __fastcall cocos2d::CCLabelBMFont::initWithString(
cocos2d::CCLabelBMFont *a1,
const char *a2,
const char *a3,
float a4,
cocos2d::CCTextAlignment a5,
cocos2d::CCPoint a6)
{
double *v6; // r8
cocos2d::CCBMFontConfiguration *File; // rax
cocos2d::CCBMFontConfiguration *v12; // r15
cocos2d::CCBMFontConfiguration *m_pConfiguration; // rdi
cocos2d::CCTextureCache *v14; // rax
cocos2d::CCBMFontConfiguration *v15; // rsi
const char *longStorage; // rsi
cocos2d::CCTexture2D *v17; // r14
const char *v18; // r15
double v19; // xmm0_8
cocos2d::CCLabelBMFont_vtbl *v20; // rax
cocos2d::CCLabelBMFont *v21; // rdi
const char *v22; // rsi
__int64 v23; // rdx
unsigned int v24; // eax
float v25; // xmm0_4
cocos2d::CCTexture2D *v26; // rax
double *v27; // rsi
double v28; // xmm0_8
cocos2d::CCSprite *v29; // r14
__int64 v30; // r12
double v32[2]; // [rsp+8h] [rbp-48h] BYREF
double *v33; // [rsp+18h] [rbp-38h]
float v34; // [rsp+24h] [rbp-2Ch]
v34 = a4;
v33 = v6;
if ( a3 )
{
File = cocos2d::FNTConfigLoadFile(a3);
if ( !File )
{
cocos2d::CCObject::release(a1);
return 0;
}
v12 = File;
cocos2d::CCObject::retain(File);
m_pConfiguration = a1->m_pConfiguration;
if ( m_pConfiguration )
cocos2d::CCObject::release(m_pConfiguration);
a1->m_pConfiguration = v12;
std::string::assign((std::string *)&a1->m_sFntFile, a3);
v14 = cocos2d::CCTextureCache::sharedTextureCache();
v15 = a1->m_pConfiguration;
if ( (v15->m_sAtlasName.m_data.m_short.sizex2 & 1) != 0 )
longStorage = v15->m_sAtlasName.m_data.m_long.longStorage;
else
longStorage = v15->m_sAtlasName.m_data.m_short.shortStorage.__elems_;
v17 = cocos2d::CCTextureCache::addImage(v14, longStorage, 0);
}
else
{
v17 = (cocos2d::CCTexture2D *)operator new(0x68u);
sub_100477FC0((__int64)v17);
cocos2d::CCObject::autorelease(v17);
}
v18 = "";
if ( a2 )
v18 = a2;
if ( a1->m_bIsBatched )
{
if ( cocos2d::CCNode::init(a1) )
{
a1->m_fWidth = v34;
a1->m_pAlignment = a5;
*(_QWORD *)&a1->m_cDisplayedOpacity = -1;
*(_WORD *)&a1->m_bCascadeColorEnabled = 257;
sub_10028CFF0(&a1->m_obContentSize, &qword_1009A2D78);
a1->m_bIsOpacityModifyRGB = 1;
sub_10028CBE0((float *)v32, 0.5, 0.5);
sub_10028CC90(&a1->m_obAnchorPoint, v32);
v19 = sub_10028CC90(&a1->m_tImageOffset, v33);
a1->m_pSomeTexture = v17;
v20 = a1->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v21 = a1;
v22 = v18;
v23 = 0;
LABEL_18:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *, __int64, double))v20->setString_0)(
v21,
v22,
v23,
v19);
return 1;
}
}
else
{
v24 = strlen(v18);
if ( cocos2d::CCSpriteBatchNode::initWithTexture(a1, v17, v24) )
{
v25 = v34;
a1->m_fWidth = v34;
a1->m_pAlignment = a5;
*(_QWORD *)&a1->m_cDisplayedOpacity = -1;
*(_WORD *)&a1->m_bCascadeColorEnabled = 257;
sub_10028CFF0(&a1->m_obContentSize, &qword_1009A2D78);
v26 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *, float, double))a1->m_pobTextureAtlas->getTexture)(
a1->m_pobTextureAtlas,
v25,
*(double *)&a6);
a1->m_bIsOpacityModifyRGB = cocos2d::CCTexture2D::hasPremultipliedAlpha(v26);
sub_10028CBE0((float *)v32, 0.5, 0.5);
sub_10028CC90(&a1->m_obAnchorPoint, v32);
v27 = v33;
v28 = sub_10028CC90(&a1->m_tImageOffset, v33);
v29 = (cocos2d::CCSprite *)operator new(0x258u);
sub_1002881A0((__int64)v29, v28, (__int64)v27);
a1->m_pReusedChar = v29;
v30 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))a1->m_pobTextureAtlas->getTexture)(a1->m_pobTextureAtlas);
v19 = 0.0;
sub_10028CC00((__int64)v32, 0.0, 0.0, (__m128)0LL, (__m128)0LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64, double *, _QWORD))v29->initWithTexture_1)(v29, v30, v32, 0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCLabelBMFont *))a1->m_pReusedChar->setBatchNode)(
a1->m_pReusedChar,
a1);
v20 = a1->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v21 = a1;
v22 = v18;
v23 = 1;
goto LABEL_18;
}
}
return 0;
}