//
// cocos2d::CCLabelBMFont::initWithString from 0x1002fb134 to 0x1002fb3b8 (644 bytes)
//
// 4 xrefs:
// > CCCounterLabel::init @ 0x10003ab38
// > cocos2d::CCLabelBMFont::create @ 0x1002fb088
// > cocos2d::CCLabelBMFont::createBatched @ 0x1002fb448
// > cocos2d::CCLabelBMFont::init @ 0x1002fb4dc
//
// 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; // x4
double *v7; // x20
cocos2d::CCBMFontConfiguration *File; // x0
cocos2d::CCBMFontConfiguration *v14; // x24
cocos2d::CCBMFontConfiguration *m_pConfiguration; // x0
cocos2d::CCTextureCache *v16; // x0
cocos2d::CCBMFontConfiguration *v17; // x8
const char *p_m_sAtlasName; // x1
cocos2d::CCTexture2D *v19; // x23
__n128 v20; // q0
bool v21; // w22
__n128 v22; // q1
__n128 v23; // q0
unsigned int v24; // w0
double v25; // d0
cocos2d::CCTexture2D *v26; // x0
__n128 v27; // q0
__n128 v28; // q1
cocos2d::CCSprite *v29; // x20
__int64 v30; // x22
__n128 v31; // q0
double v33[2]; // [xsp+0h] [xbp-50h] BYREF
v7 = v6;
if ( a3 )
{
File = cocos2d::FNTConfigLoadFile(a3);
if ( !File )
{
cocos2d::CCObject::release(a1);
return 0;
}
v14 = File;
cocos2d::CCObject::retain(File);
m_pConfiguration = a1->m_pConfiguration;
if ( m_pConfiguration )
cocos2d::CCObject::release(m_pConfiguration);
a1->m_pConfiguration = v14;
std::string::assign((std::string *)&a1->m_sFntFile, a3);
v16 = cocos2d::CCTextureCache::sharedTextureCache();
v17 = a1->m_pConfiguration;
p_m_sAtlasName = (const char *)&v17->m_sAtlasName;
if ( v17->m_sAtlasName.m_data.m_short.shortStorage.__elems_[22] < 0 )
p_m_sAtlasName = *(const char **)p_m_sAtlasName;
v19 = cocos2d::CCTextureCache::addImage(v16, p_m_sAtlasName, 0);
}
else
{
v19 = (cocos2d::CCTexture2D *)operator new(0x68u);
j_cocos2d::CCTexture2D::CCTexture2D((__int64)v19);
cocos2d::CCObject::autorelease(v19);
}
if ( !a2 )
a2 = "";
if ( !a1->m_bIsBatched )
{
v24 = strlen(a2);
if ( cocos2d::CCSpriteBatchNode::initWithTexture(a1, v19, v24) )
{
a1->m_fWidth = a4;
a1->m_pAlignment = a5;
*(_QWORD *)&a1->m_cDisplayedOpacity = -1;
*(_WORD *)&a1->m_bCascadeColorEnabled = 257;
v25 = sub_100022B14(&a1->m_obContentSize, &dbl_10086DDB8);
v26 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *, double))a1->m_pobTextureAtlas->getTexture)(
a1->m_pobTextureAtlas,
v25);
a1->m_bIsOpacityModifyRGB = cocos2d::CCTexture2D::hasPremultipliedAlpha(v26);
v27.n128_u32[0] = 0.5;
v28.n128_u32[0] = 0.5;
sub_100022980(v27, v28, v33);
sub_1000229D0(&a1->m_obAnchorPoint, v33);
sub_1000229D0(&a1->m_tImageOffset, v7);
v29 = (cocos2d::CCSprite *)operator new(0x258u);
j_cocos2d::CCSprite::CCSprite((__int64)v29);
a1->m_pReusedChar = v29;
v30 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))a1->m_pobTextureAtlas->getTexture)(a1->m_pobTextureAtlas);
sub_100022990((float *)v33, 0.0, 0.0, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int64, double *, _QWORD))v29->initWithTexture_1)(v29, v30, v33, 0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCLabelBMFont *))a1->m_pReusedChar->setBatchNode)(
a1->m_pReusedChar,
a1);
v21 = 1;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *, __int64, __n128))a1->setString_0)(a1, a2, 1, v31);
return v21;
}
return 0;
}
if ( !cocos2d::CCNode::init(a1) )
return 0;
a1->m_fWidth = a4;
a1->m_pAlignment = a5;
*(_QWORD *)&a1->m_cDisplayedOpacity = -1;
*(_WORD *)&a1->m_bCascadeColorEnabled = 257;
v20.n128_f64[0] = sub_100022B14(&a1->m_obContentSize, &dbl_10086DDB8);
v21 = 1;
a1->m_bIsOpacityModifyRGB = 1;
v20.n128_u32[0] = 0.5;
v22.n128_u32[0] = 0.5;
sub_100022980(v20, v22, v33);
sub_1000229D0(&a1->m_obAnchorPoint, v33);
v23.n128_f64[0] = sub_1000229D0(&a1->m_tImageOffset, v7);
a1->m_pSomeTexture = v19;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *, _QWORD, __n128))a1->setString_0)(a1, a2, 0, v23);
return v21;
}