//
// LocalLevelManager::updateLevelRevision from 0x140330500 to 0x140330883 (899 bytes)
//
// 2 xrefs:
// > LocalLevelManager::dataLoaded @ 0x1403312f1
// > ??> @ 0x1406d5018
//
// 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=3
void LocalLevelManager::updateLevelRevision(LocalLevelManager *a1)
{
LocalLevelManager *v1; // r13
int v2; // r12d
int v3; // r15d
unsigned int i; // edi
__int64 v5; // rcx
struct cocos2d::CCObject *v6; // rax
void **p_m_uID; // r14
void **v8; // rcx
size_t v9; // rsi
size_t v10; // r8
__int64 v11; // rbx
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r8
void **v15; // rdx
__int64 v16; // r12
unsigned int v17; // r14d
struct cocos2d::CCObject *v18; // r13
int j; // edi
const char *p_Buf2; // r8
cocos2d::CCString *v21; // rax
const char *v22; // rbx
size_t v23; // r8
__int64 v24; // rsi
void *v25; // rcx
size_t v26; // r8
__int64 v27; // rdx
__int64 v28; // rcx
__int64 v29; // rax
void *v30; // rcx
void *Src[2]; // [rsp+28h] [rbp-41h] BYREF
size_t Size; // [rsp+38h] [rbp-31h]
unsigned __int64 v33; // [rsp+40h] [rbp-29h]
LocalLevelManager *v34; // [rsp+48h] [rbp-21h]
void *Buf1[2]; // [rsp+50h] [rbp-19h] BYREF
size_t v36; // [rsp+60h] [rbp-9h]
unsigned __int64 v37; // [rsp+68h] [rbp-1h]
__int128 Buf2; // [rsp+70h] [rbp+7h] BYREF
__int64 v39; // [rsp+80h] [rbp+17h]
unsigned __int64 v40; // [rsp+88h] [rbp+1Fh]
v1 = a1;
v34 = a1;
v2 = 0;
v3 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v1->m_localLevels); ++i )
{
v6 = cocos2d::CCArray::objectAtIndex(v1->m_localLevels, i);
Buf2 = 0;
v39 = 0;
v40 = 15;
LOBYTE(Buf2) = 0;
p_m_uID = (void **)&v6[6].m_uID;
sub_14003BDB0((__int64)Buf1, (__int64)&v6[6].m_uID);
v2 |= 2u;
v8 = Buf1;
if ( v37 > 0xF )
v8 = (void **)Buf1[0];
v9 = v36;
v10 = v36;
if ( v36 )
v10 = 0;
LODWORD(v11) = memcmp(v8, &Buf2, v10);
if ( !(_DWORD)v11 )
v11 = v9 != 0;
sub_14003A830((__int64)Buf1);
if ( !(_DWORD)v11 )
{
v12 = cocos2d::CCString::createWithFormat("Unnamed %i", v3++);
CString = cocos2d::CCString::getCString(v12);
*(_OWORD *)Src = 0;
Size = 0;
v33 = 0;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003A930(Src, CString, v14);
if ( p_m_uID != Src )
{
v15 = Src;
if ( v33 > 0xF )
v15 = (void **)Src[0];
sub_14003CCE0(p_m_uID, v15, Size);
}
sub_14003A830((__int64)Src);
}
}
v16 = cocos2d::CCDictionary::create(v5);
v17 = 0;
if ( cocos2d::CCArray::count(v1->m_localLevels) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(v1->m_localLevels, v17);
for ( j = 0; ; ++j )
{
sub_14003BDB0((__int64)&Buf2, (__int64)&v18[6].m_uID);
p_Buf2 = (const char *)&Buf2;
if ( v40 > 0xF )
p_Buf2 = (const char *)Buf2;
v21 = cocos2d::CCString::createWithFormat("rev_%i_%s", j, p_Buf2);
v22 = cocos2d::CCString::getCString(v21);
sub_14003A830((__int64)&Buf2);
*(_OWORD *)Buf1 = 0;
v36 = 0;
v37 = 0;
v23 = -1;
do
++v23;
while ( v22[v23] );
sub_14003A930(Buf1, v22, v23);
v24 = cocos2d::CCDictionary::objectForKey(v16, Buf1);
if ( v37 > 0xF )
{
v25 = Buf1[0];
if ( v37 + 1 >= 0x1000 )
{
v25 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v25 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v25);
}
if ( !v24 )
break;
}
*(_OWORD *)Buf1 = 0;
v36 = 0;
v37 = 0;
v26 = -1;
do
++v26;
while ( v22[v26] );
sub_14003A930(Buf1, v22, v26);
v29 = cocos2d::CCNode::create(v28, v27);
cocos2d::CCDictionary::setObject(v16, v29, Buf1);
if ( v37 > 0xF )
{
v30 = Buf1[0];
if ( v37 + 1 >= 0x1000 )
{
v30 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v30);
}
HIDWORD(v18[12].__vftable) = j;
++v17;
v1 = v34;
}
while ( v17 < cocos2d::CCArray::count(v34->m_localLevels) );
}
}