//
// cocos2d::CCLabelTTF::initWithString from 0x1003bd6b0 to 0x1003bd80a (346 bytes)
//
// 4 xrefs:
// > cocos2d::CCLabelTTF::create @ 0x1003bd61a
// > cocos2d::CCLabelTTF::init @ 0x1003bda28
// > cocos2d::CCLabelTTF::initWithString_2 @ 0x1003bda42
// > cocos2d::CCLabelTTF::initWithString_1 @ 0x1003bda58
//
// 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::CCLabelTTF::initWithString(
cocos2d::CCLabelTTF *a1,
const char *a2,
const char *a3,
float a4,
const cocos2d::CCSize *a5,
cocos2d::CCTextAlignment a6,
cocos2d::CCVerticalTextAlignment a7)
{
bool result; // al
cocos2d::CCShaderCache *v12; // rax
cocos2d::CCGLProgram *v13; // rax
double v14; // xmm0_8
std::string *v15; // r12
size_t v16; // rax
size_t v17; // r13
char *elems; // rbx
size_t v19; // r15
__int64 v20; // [rsp+8h] [rbp-48h] BYREF
const char *v21; // [rsp+10h] [rbp-40h]
void *__src; // [rsp+18h] [rbp-38h]
float v23; // [rsp+20h] [rbp-30h]
bool v24; // [rsp+27h] [rbp-29h]
v23 = a4;
v21 = a2;
result = cocos2d::CCSprite::init(a1);
if ( result )
{
v24 = result;
v12 = cocos2d::CCShaderCache::sharedShaderCache();
v13 = cocos2d::CCShaderCache::programForKey(v12, "ShaderPositionTextureColor");
((void (__fastcall *)(cocos2d::CCLabelTTF *, cocos2d::CCGLProgram *))a1->setShaderProgram)(a1, v13);
*(_QWORD *)&v14 = LODWORD(a5->width);
sub_10028CBF0((float *)&v20, *(float *)&v14, a5->height);
sub_10028CFF0(&a1->m_tDimensions, &v20);
a1->m_hAlignment = a6;
a1->m_vAlignment = a7;
v15 = (std::string *)operator new(0x18u);
v16 = strlen(a3);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v14);
v17 = v16;
__src = (void *)a3;
if ( v16 >= 0x17 )
{
v19 = 26;
if ( (v16 | 7) != 0x17 )
v19 = (v16 | 7) + 1;
elems = (char *)operator new(v19);
v15->m_data.m_long.longStorage = elems;
v15->m_data.m_long.capacitym1 = v19 | 1;
v15->m_data.m_long.size = v17;
}
else
{
v15->m_data.m_short.sizex2 = 2 * v16;
elems = v15->m_data.m_short.shortStorage.__elems_;
if ( !v16 )
goto LABEL_10;
}
memcpy(elems, __src, v17);
LABEL_10:
elems[v17] = 0;
a1->m_pFontName = v15;
a1->m_fFontSize = v23;
((void (__fastcall *)(cocos2d::CCLabelTTF *, const char *))a1->setString)(a1, v21);
return v24;
}
return result;
}