//
// cocos2d::CCTexture2D::initWithString from 0x100478f90 to 0x1004790b8 (296 bytes)
//
// 2 xrefs:
// > cocos2d::CCLabelTTF::updateTexture @ 0x1003bdc81
// > cocos2d::CCTexture2D::initWithString_1 @ 0x100478f79
//
// 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::CCTexture2D::initWithString(
cocos2d::CCTexture2D *a1,
const char *a2,
const char *a3,
float a4,
const cocos2d::CCSize *a5,
cocos2d::CCTextAlignment a6,
cocos2d::CCVerticalTextAlignment a7)
{
int v8; // r14d
int v9; // eax
bool v10; // zf
int v11; // ebx
cocos2d::CCImage *v12; // r13
unsigned int m_nWidth; // r14d
unsigned int m_nHeight; // r15d
cocos2d::CCConfiguration *v15; // rax
unsigned int MaxTextureSize; // eax
bool v17; // bl
cocos2d::CCTexture2D *v19; // [rsp+8h] [rbp-38h]
float v20; // [rsp+14h] [rbp-2Ch]
v8 = (int)a3;
if ( a7 == kCCVerticalTextAlignmentBottom )
{
v20 = a4;
v19 = a1;
v9 = (((unsigned int)a6 | 0x2200000000uLL) - 1) >> 32;
v10 = a6 == kCCTextAlignmentCenter;
v11 = 35;
}
else if ( a7 == kCCVerticalTextAlignmentCenter )
{
v20 = a4;
v19 = a1;
v9 = (((unsigned int)a6 | 0x3200000000uLL) - 1) >> 32;
v10 = a6 == kCCTextAlignmentCenter;
v11 = 51;
}
else
{
if ( a7 )
return 0;
v20 = a4;
v19 = a1;
v9 = (((unsigned int)a6 | 0x1200000000uLL) - 1) >> 32;
v10 = a6 == kCCTextAlignmentCenter;
v11 = 19;
}
if ( !v10 )
v11 = v9;
v12 = (cocos2d::CCImage *)operator new(0x50u);
cocos2d::CCImage::CCImage(v12);
if ( !(unsigned __int8)cocos2d::CCImage::initWithString(
(_DWORD)v12,
(_DWORD)a2,
(int)a5->width,
(int)a5->height,
v11,
v8,
(int)v20) )
return 0;
m_nWidth = v12->m_nWidth;
m_nHeight = v12->m_nHeight;
v15 = cocos2d::CCConfiguration::sharedConfiguration();
MaxTextureSize = cocos2d::CCConfiguration::getMaxTextureSize(v15);
v17 = MaxTextureSize >= m_nWidth && MaxTextureSize >= m_nHeight;
if ( v17 )
cocos2d::CCTexture2D::initPremultipliedATextureWithImage(v19, v12, m_nWidth, m_nHeight);
cocos2d::CCObject::release(v12);
return v17;
}