//
// LevelEditorLayer::updateLevelFont from 0x793c38 to 0x79415c (1316 bytes)
//
// 3 xrefs:
// > SelectFontLayer::onChangeFont @ 0xa1f6ec
// > SelectFontLayer2::onSelectFont @ 0xd02fb8
// > ??> @ 0xdafe0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:53:31 +0000
//
__int64 __fastcall LevelEditorLayer::updateLevelFont(LevelEditorLayer *this, int a2)
{
cocos2d::CCArray *v4; // x0
cocos2d::CCArray *v5; // x24
cocos2d::CCArray *v6; // x22
unsigned int v7; // w19
cocos2d::CCArray *AllObjects; // x20
cocos2d::CCTextureCache *v9; // x0
cocos2d::CCObject *v10; // x1
int v11; // w0
cocos2d::CCTextureCache *v12; // x0
unsigned int v13; // w20
__int64 v14; // x26
unsigned int v15; // w1
__int64 v16; // x19
unsigned int i; // w19
unsigned int v18; // w1
LabelGameObject *v19; // x0
GameManager *v20; // x0
GameManager *v21; // x0
const char *FontTexture; // x0
size_t v23; // x0
cocos2d::CCTextureCache *v24; // x0
cocos2d::CCTextureCache *v25; // x0
const char *v26; // x1
__int64 v27; // x26
unsigned int j; // w21
__int64 v29; // x0
void *v30; // x1
void (__fastcall **v31)(void **, __int64 *); // x2
void **v32; // x19
char v33; // w0
unsigned int k; // w20
__int64 v36; // x21
char v37; // w0
__int64 v38; // x0
__int64 v39; // x1
char *v40; // [xsp+68h] [xbp+68h]
__int64 v41[2]; // [xsp+70h] [xbp+70h] BYREF
void *v42; // [xsp+80h] [xbp+80h]
__int64 v43; // [xsp+88h] [xbp+88h] BYREF
void *v44; // [xsp+90h] [xbp+90h]
void *v45; // [xsp+98h] [xbp+98h]
__int64 v46; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v47; // [xsp+A8h] [xbp+A8h]
void *v48; // [xsp+B0h] [xbp+B0h]
v4 = (cocos2d::CCArray *)*(unsigned int *)(*((_QWORD *)this + 409) + 360LL);
if ( (_DWORD)v4 != a2 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v7 = 0;
AllObjects = (cocos2d::CCArray *)LevelEditorLayer::getAllObjects(this);
v9 = (cocos2d::CCTextureCache *)cocos2d::CCArray::count(AllObjects);
if ( (_DWORD)v9 )
{
do
{
v10 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(AllObjects, v7);
v11 = *((_DWORD *)v10 + 257);
if ( v11 == 914 )
{
++v7;
cocos2d::CCArray::addObject(v5, v10);
}
else
{
++v7;
if ( v11 == 1615 )
cocos2d::CCArray::addObject(v6, v10);
}
v9 = (cocos2d::CCTextureCache *)cocos2d::CCArray::count(AllObjects);
}
while ( v7 < (unsigned int)v9 );
}
v12 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v9);
v13 = 0;
v14 = cocos2d::CCTextureCache::addImage(v12, "bigFont.png", 0);
while ( v13 < (unsigned int)cocos2d::CCArray::count(v5) )
{
v15 = v13++;
v16 = cocos2d::CCArray::objectAtIndex(v5, v15);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v16 + 1312LL))(v16, 1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v16 + 576LL))(v16);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 1120LL))(v16, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v16 + 1064LL))(v16, v14);
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v6); ++i )
{
v18 = i;
v19 = (LabelGameObject *)cocos2d::CCArray::objectAtIndex(v6, v18);
LabelGameObject::removeLabel(v19);
}
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 293) + 520LL))(*((_QWORD *)this + 293));
*((_QWORD *)this + 293) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 294) + 520LL))(*((_QWORD *)this + 294));
*((_QWORD *)this + 294) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 307) + 520LL))(*((_QWORD *)this + 307));
*((_QWORD *)this + 307) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 308) + 520LL))(*((_QWORD *)this + 308));
*((_QWORD *)this + 308) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 321) + 520LL))(*((_QWORD *)this + 321));
*((_QWORD *)this + 321) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 322) + 520LL))(*((_QWORD *)this + 322));
*((_QWORD *)this + 322) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 341) + 520LL))(*((_QWORD *)this + 341));
*((_QWORD *)this + 341) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 342) + 520LL))(*((_QWORD *)this + 342));
*((_QWORD *)this + 342) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 355) + 520LL))(*((_QWORD *)this + 355));
*((_QWORD *)this + 355) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 356) + 520LL))(*((_QWORD *)this + 356));
*((_QWORD *)this + 356) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 369) + 520LL))(*((_QWORD *)this + 369));
*((_QWORD *)this + 369) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 370) + 520LL))(*((_QWORD *)this + 370));
*((_QWORD *)this + 370) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 383) + 520LL))(*((_QWORD *)this + 383));
*((_QWORD *)this + 383) = 0;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 384) + 520LL))(*((_QWORD *)this + 384));
*((_QWORD *)this + 384) = 0;
v20 = *((GameManager **)this + 409);
*((_DWORD *)v20 + 90) = a2;
v21 = (GameManager *)GameManager::sharedState(v20);
FontTexture = GameManager::getFontTexture(v21, a2);
v41[0] = 0;
v40 = (char *)FontTexture;
v41[1] = 0;
v42 = nullptr;
v23 = strlen(FontTexture);
v24 = (cocos2d::CCTextureCache *)std::string::__init(v41, v40, v23);
v25 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v24);
v26 = (char *)v41 + 1;
if ( (v41[0] & 1) != 0 )
v26 = (const char *)v42;
v27 = cocos2d::CCTextureCache::addImage(v25, v26, 0);
GJBaseGameLayer::createTextLayers(this);
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(v5); ++j )
{
v32 = (void **)cocos2d::CCArray::objectAtIndex(v5, j);
(*((void (__fastcall **)(void **, __int64))*v32 + 133))(v32, v27);
v33 = *((_BYTE *)v32 + 1352);
v43 = 0;
v44 = nullptr;
v45 = nullptr;
if ( (v33 & 1) != 0 )
{
std::string::__init(&v43, v32[171], (size_t)v32[170]);
}
else
{
v29 = (__int64)v32[169];
v30 = v32[170];
v45 = v32[171];
v43 = v29;
v44 = v30;
}
TextGameObject::updateTextObject(v32, (unsigned __int8 *)&v43, 0);
if ( (v43 & 1) != 0 )
operator delete(v45);
v31 = (void (__fastcall **)(void **, __int64 *))*v32;
*((_BYTE *)v32 + 1149) = 1;
v31[187](v32, &qword_1141B78);
}
for ( k = 0; k < (unsigned int)cocos2d::CCArray::count(v6); ++k )
{
v36 = cocos2d::CCArray::objectAtIndex(v6, k);
v37 = *(_BYTE *)(v36 + 1856);
v46 = 0;
v47 = 0;
v48 = nullptr;
if ( (v37 & 1) != 0 )
{
std::string::__init(&v46, *(void **)(v36 + 1872), *(_QWORD *)(v36 + 1864));
}
else
{
v38 = *(_QWORD *)(v36 + 1856);
v39 = *(_QWORD *)(v36 + 1864);
v48 = *(void **)(v36 + 1872);
v46 = v38;
v47 = v39;
}
LabelGameObject::createLabel(v36, &v46);
if ( (v46 & 1) != 0 )
operator delete(v48);
}
if ( (v41[0] & 1) != 0 )
operator delete(v42);
}
return _stack_chk_guard;
}