//
// cocos2d::CCLabelTTF::_prepareTextDefinition from 0x18004d940 to 0x18004db37 (503 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b1bf0
//
// 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
//
// Hidden C++ exception states: #wind=1
struct cocos2d::_ccFontDefinition *__fastcall cocos2d::CCLabelTTF::_prepareTextDefinition(
struct cocos2d::_ccFontDefinition *__return_ptr retstr,
__int64 a2,
char a3)
{
cocos2d::CCDirector *v6; // rax
float v7; // xmm0_4
__int64 v8; // r8
void *v9; // rdx
cocos2d::CCDirector *v10; // rax
float v11; // xmm6_4
cocos2d::CCDirector *v12; // rax
float ContentScaleFactor; // xmm0_4
float *p_m_strokeSize; // rdx
cocos2d::CCDirector *v15; // rax
cocos2d::CCDirector *v16; // rax
float v17; // xmm6_4
cocos2d::CCDirector *v18; // rax
float v19; // xmm0_4
float *v20; // rax
float v22; // [rsp+60h] [rbp+8h] BYREF
__int64 v23; // [rsp+68h] [rbp+10h]
v23 = a2;
sub_18004D6F0(a2);
if ( a3 )
{
v6 = cocos2d::CCDirector::sharedDirector();
v7 = cocos2d::CCDirector::getContentScaleFactor(v6) * *(float *)&retstr[7].m_fontName.m_data.m_size;
}
else
{
v7 = *(float *)&retstr[7].m_fontName.m_data.m_size;
}
*(_DWORD *)(a2 + 32) = (int)v7;
v8 = *((_QWORD *)&retstr[7].m_fontName.m_data.m_bigStorage + 1);
if ( a2 != v8 )
{
v9 = *((void **)&retstr[7].m_fontName.m_data.m_bigStorage + 1);
if ( *(_QWORD *)(v8 + 24) > 0xFu )
v9 = *(void **)v8;
sub_180010050((void **)a2, v9, *(_QWORD *)(v8 + 16));
}
*(_DWORD *)(a2 + 36) = *(_DWORD *)retstr[7].m_fontName.m_data.m_smallStorage._Elems;
*(_DWORD *)(a2 + 40) = HIDWORD(retstr[7].m_fontName.m_data.m_bigStorage);
if ( a3 )
{
v10 = cocos2d::CCDirector::sharedDirector();
v11 = cocos2d::CCDirector::getContentScaleFactor(v10) * *((float *)&retstr[6].m_stroke + 2);
v12 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v12);
p_m_strokeSize = kmVec2Fill(&v22, ContentScaleFactor * retstr[6].m_stroke.m_strokeSize, v11);
}
else
{
p_m_strokeSize = &retstr[6].m_stroke.m_strokeSize;
}
cocos2d::CCSize::operator=((_DWORD *)(a2 + 44), p_m_strokeSize);
if ( retstr[7].m_stroke.m_strokeEnabled )
{
*(_BYTE *)(a2 + 76) = 1;
*(_WORD *)(a2 + 77) = *(_WORD *)&retstr[7].m_stroke.m_strokeColor.r;
*(_BYTE *)(a2 + 79) = retstr[7].m_stroke.m_strokeColor.b;
if ( a3 )
{
v15 = cocos2d::CCDirector::sharedDirector();
*(float *)(a2 + 80) = cocos2d::CCDirector::getContentScaleFactor(v15) * retstr[7].m_stroke.m_strokeSize;
}
else
{
*(float *)(a2 + 80) = retstr[7].m_stroke.m_strokeSize;
}
}
else
{
*(_BYTE *)(a2 + 76) = 0;
}
if ( retstr[7].m_shadow.m_shadowEnabled )
{
*(_BYTE *)(a2 + 56) = 1;
*(float *)(a2 + 68) = retstr[7].m_shadow.m_shadowOpacity;
*(float *)(a2 + 72) = retstr[7].m_shadow.m_shadowBlur;
if ( a3 )
{
v16 = cocos2d::CCDirector::sharedDirector();
v17 = cocos2d::CCDirector::getContentScaleFactor(v16) * retstr[7].m_shadow.m_shadowOffset.height;
v18 = cocos2d::CCDirector::sharedDirector();
v19 = cocos2d::CCDirector::getContentScaleFactor(v18);
v20 = kmVec2Fill(&v22, v19 * retstr[7].m_shadow.m_shadowOffset.width, v17);
cocos2d::CCSize::operator=((_DWORD *)(a2 + 60), v20);
}
else
{
cocos2d::CCSize::operator=((_DWORD *)(a2 + 60), &retstr[7].m_shadow.m_shadowOffset);
}
}
else
{
*(_BYTE *)(a2 + 56) = 0;
}
*(_WORD *)(a2 + 52) = *((_WORD *)&retstr[7].m_stroke + 4);
*(_BYTE *)(a2 + 54) = *((_BYTE *)&retstr[7].m_stroke + 10);
return (struct cocos2d::_ccFontDefinition *)a2;
}