//
// cocos2d::CCLabelAtlas::updateAtlasValues from 0x180046760 to 0x180046a50 (752 bytes)
//
// 3 xrefs:
// > ??> @ 0x1800eb768
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b177c
//
// 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
//
void __fastcall cocos2d::CCLabelAtlas::updateAtlasValues(cocos2d::CCLabelAtlas *this)
{
unsigned int m_size; // esi
std::string *p_m_sString; // r14
__int64 v4; // rbx
float v5; // xmm9_4
float v6; // xmm10_4
cocos2d::CCDirector *v7; // rax
float ContentScaleFactor; // xmm0_4
float m_uItemHeight; // xmm8_4
float m_uItemWidth; // xmm6_4
cocos2d::CCDirector *v11; // rax
float v12; // xmm7_4
__int64 v13; // rax
__int64 v14; // r9
__int64 v15; // r8
float v16; // xmm4_4
float v17; // xmm5_4
unsigned int v18; // eax
signed int v19; // ecx
__int64 v20; // rdx
float v21; // xmm3_4
unsigned int v22; // ecx
float v23; // xmm3_4
float v24; // xmm1_4
int v25; // eax
int v26; // eax
int v27; // eax
signed int v28; // eax
signed int v29; // eax
unsigned int v30; // eax
int v31; // [rsp+80h] [rbp+8h]
m_size = this->m_sString.m_data.m_size;
p_m_sString = &this->m_sString;
if ( this->m_sString.m_data.m_capacity > 0xF )
p_m_sString = (std::string *)p_m_sString->m_data.m_bigStorage;
v4 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getTexture)(this->m_pTextureAtlas);
v5 = (float)(*(int (__fastcall **)(__int64))(*(_QWORD *)v4 + 80LL))(v4);
v6 = (float)(*(int (__fastcall **)(__int64))(*(_QWORD *)v4 + 88LL))(v4);
v7 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v7);
m_uItemHeight = (float)(int)this->m_uItemHeight;
m_uItemWidth = ContentScaleFactor * (float)(int)this->m_uItemWidth;
v11 = cocos2d::CCDirector::sharedDirector();
v12 = cocos2d::CCDirector::getContentScaleFactor(v11) * m_uItemHeight;
if ( this->m_bIgnoreContentScaleFactor )
{
v12 = m_uItemHeight;
m_uItemWidth = (float)(int)this->m_uItemWidth;
}
((void (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getCapacity)(this->m_pTextureAtlas);
v13 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getQuads)(this->m_pTextureAtlas);
LODWORD(v14) = 0;
if ( m_size )
{
v15 = v13 + 20;
v16 = m_uItemWidth / v5;
v17 = v12 / v6;
do
{
v18 = (unsigned __int8)(p_m_sString->m_data.m_smallStorage._Elems[0] - LOBYTE(this->m_uMapStartChar))
/ this->m_uItemsPerRow;
v19 = (unsigned __int8)(p_m_sString->m_data.m_smallStorage._Elems[0] - LOBYTE(this->m_uMapStartChar))
% this->m_uItemsPerRow;
p_m_sString = (std::string *)((char *)p_m_sString + 1);
v20 = v18;
v21 = (float)v19;
v22 = v14 + 1;
v23 = (float)(v21 * m_uItemWidth) / v5;
v24 = (float)((float)(int)v18 * v12) / v6;
*(float *)(v15 - 4) = v23;
*(float *)v15 = v24;
*(float *)(v15 + 48) = v24;
*(float *)(v15 + 20) = v23;
*(float *)(v15 + 44) = v16 + v23;
*(float *)(v15 + 24) = v17 + v24;
*(float *)(v15 + 72) = v17 + v24;
*(float *)(v15 + 68) = v16 + v23;
v25 = this->m_uItemWidth * v14;
*(_QWORD *)(v15 + 8) = 0;
*(float *)(v15 + 4) = (float)v25;
v26 = this->m_uItemWidth * (v14 + 1);
*(_QWORD *)(v15 + 56) = 0;
*(float *)(v15 + 52) = (float)v26;
v27 = this->m_uItemWidth * v14;
v14 = (unsigned int)(v14 + 1);
*(float *)(v15 - 20) = (float)v27;
v28 = this->m_uItemHeight;
*(_DWORD *)(v15 - 12) = 0;
*(float *)(v15 - 16) = (float)v28;
*(float *)(v15 + 28) = (float)(int)(this->m_uItemWidth * v22);
v29 = this->m_uItemHeight;
*(_DWORD *)(v15 + 36) = 0;
*(float *)(v15 + 32) = (float)v29;
LOWORD(v31) = *(_WORD *)&this->_displayedColor.r;
BYTE2(v31) = this->_displayedColor.b;
HIBYTE(v31) = this->_displayedOpacity;
*(_DWORD *)(v15 - 8) = v31;
*(_DWORD *)(v15 + 40) = v31;
*(_DWORD *)(v15 + 16) = v31;
*(_DWORD *)(v15 + 64) = v31;
v15 += 96;
}
while ( v22 < m_size );
this->m_pTextureAtlas->m_bDirty = 1;
v30 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *, __int64, __int64, __int64))this->m_pTextureAtlas->getTotalQuads)(
this->m_pTextureAtlas,
v20,
v15,
v14);
if ( m_size > v30 )
cocos2d::CCTextureAtlas::increaseTotalQuadsWith(this->m_pTextureAtlas, m_size - v30);
}
}