//
// cocos2d::CCTileMapAtlas::updateAtlasValues from 0xb3e54c to 0xb3e760 (532 bytes)
//
// 2 xrefs:
// > ??> @ 0x4fff8
// > ??> @ 0x121b810
//
// 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 cocos2d::CCTileMapAtlas::updateAtlasValues(cocos2d::CCTileMapAtlas *a1)
{
cocos2d::sImageTGA *m_pTGAInfo; // x1
int v3; // w28
signed int i; // w26
int j; // w19
cocos2d::CCString *v6; // x21
__int64 v7; // x24
cocos2d::CCDictionary *m_pPosToAtlasIndex; // x23
char *CString; // x0
void *v10; // x0
unsigned int *v11; // x2
int v12; // w1
cocos2d::ccColor3B v13; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v14; // [xsp+90h] [xbp+90h] BYREF
m_pTGAInfo = a1->m_pTGAInfo;
v3 = 0;
for ( i = 0; m_pTGAInfo->width > v3; ++v3 )
{
for ( j = 0; m_pTGAInfo->height > j; ++i )
{
while ( 1 )
{
if ( a1->m_nItemsToRender > i )
{
v13 = *(cocos2d::ccColor3B *)&m_pTGAInfo->imageData[3 * v3 + 3 * m_pTGAInfo->width * j];
if ( v13.r )
break;
}
if ( m_pTGAInfo->height <= ++j )
goto LABEL_9;
}
cocos2d::CCPoint::CCPoint(&v14, (float)v3, (float)j);
cocos2d::CCTileMapAtlas::updateAtlasValueAt(a1, &v14, &v13, i);
v6 = cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%d,%d", (unsigned int)v3, (unsigned int)j);
v7 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v7);
*(_DWORD *)(v7 + 56) = i;
*(_QWORD *)v7 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v7);
m_pPosToAtlasIndex = a1->m_pPosToAtlasIndex;
CString = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((int)&v14, CString);
cocos2d::CCDictionary::setObject((__int64)m_pPosToAtlasIndex, (cocos2d::CCObject *)v7, (const char **)&v14);
v10 = (void *)(*(_QWORD *)&v14 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v14 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(*(_QWORD *)&v14 - 8LL);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(*(_QWORD *)&v14 - 8LL);
*(_DWORD *)(*(_QWORD *)&v14 - 8LL) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
m_pTGAInfo = a1->m_pTGAInfo;
++j;
}
LABEL_9:
;
}
}