//
// LocalLevelManager::updateLevelRevision from 0x14046b2f0 to 0x14046b681 (913 bytes)
//
// 2 xrefs:
// > LocalLevelManager::dataLoaded @ 0x14046c6bd
// > ??> @ 0x14092807c
//
// This function is hookable on this platform (idp: pc, 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 11:32:36 +0000
//
// Hidden C++ exception states: #wind=3
unsigned int __fastcall LocalLevelManager::updateLevelRevision(__int64 a1)
{
__int64 v1; // r13
int v2; // r12d
int v3; // r15d
unsigned int i; // edi
__int64 v5; // rcx
struct cocos2d::CCObject *v6; // rax
void **v7; // r14
void **v8; // rcx
__int64 v9; // rsi
size_t v10; // r8
int v11; // ebx
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r8
void **v15; // rdx
__int64 v16; // r15
unsigned int v17; // r14d
unsigned int result; // eax
struct cocos2d::CCObject *v19; // r13
int j; // edi
const char *p_Buf2; // r8
cocos2d::CCString *v22; // rax
const char *v23; // rbx
size_t v24; // r8
__int64 v25; // rsi
void *v26; // rcx
size_t v27; // r8
__int64 v28; // rdx
__int64 v29; // rcx
__int64 v30; // rax
void *v31; // rcx
void *Src[2]; // [rsp+38h] [rbp-41h] BYREF
size_t Size; // [rsp+48h] [rbp-31h]
unsigned __int64 v34; // [rsp+50h] [rbp-29h]
__int64 v35; // [rsp+58h] [rbp-21h]
void *Buf1[2]; // [rsp+60h] [rbp-19h] BYREF
__int128 v37; // [rsp+70h] [rbp-9h]
__int128 Buf2; // [rsp+80h] [rbp+7h] BYREF
__int64 v39; // [rsp+90h] [rbp+17h]
unsigned __int64 v40; // [rsp+98h] [rbp+1Fh]
v1 = a1;
v35 = a1;
v2 = 0;
v3 = 0;
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v1 + 368)); ++i )
{
v6 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v1 + 368), i);
Buf2 = 0;
v39 = 0;
v40 = 15;
LOBYTE(Buf2) = 0;
v7 = (void **)((char *)v6 + 344);
sub_14003F4F0((__int64)Buf1, (__int64)v6 + 344);
v2 |= 2u;
v8 = Buf1;
if ( *((_QWORD *)&v37 + 1) > 0xFu )
v8 = (void **)Buf1[0];
v9 = v37;
v10 = v37;
if ( (_QWORD)v37 )
v10 = 0;
v11 = memcmp(v8, &Buf2, v10);
if ( !v11 )
v11 = v9 != 0;
sub_14003D310((__int64)Buf1);
if ( !v11 )
{
v12 = cocos2d::CCString::createWithFormat("Unnamed %i", v3++);
CString = cocos2d::CCString::getCString(v12);
*(_OWORD *)Src = 0;
Size = 0;
v34 = 0;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003D230(Src, CString, v14);
if ( v7 != Src )
{
v15 = Src;
if ( v34 > 0xF )
v15 = (void **)Src[0];
sub_1400405A0(v7, v15, Size);
}
sub_14003D310((__int64)Src);
}
}
v16 = cocos2d::CCDictionary::create(v5);
v17 = 0;
result = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v1 + 368));
if ( result )
{
do
{
v19 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v1 + 368), v17);
for ( j = 0; ; ++j )
{
sub_14003F4F0((__int64)&Buf2, (__int64)v19 + 344);
p_Buf2 = (const char *)&Buf2;
if ( v40 > 0xF )
p_Buf2 = (const char *)Buf2;
v22 = cocos2d::CCString::createWithFormat("rev_%i_%s", j, p_Buf2);
v23 = cocos2d::CCString::getCString(v22);
sub_14003D310((__int64)&Buf2);
*(_OWORD *)Buf1 = 0;
v37 = 0;
v24 = -1;
do
++v24;
while ( v23[v24] );
sub_14003D230(Buf1, v23, v24);
v25 = cocos2d::CCDictionary::objectForKey(v16, Buf1);
if ( *((_QWORD *)&v37 + 1) > 0xFu )
{
v26 = Buf1[0];
if ( (unsigned __int64)(*((_QWORD *)&v37 + 1) + 1LL) >= 0x1000 )
{
v26 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
if ( !v25 )
break;
}
*(_OWORD *)Buf1 = 0;
v37 = 0;
v27 = -1;
do
++v27;
while ( v23[v27] );
sub_14003D230(Buf1, v23, v27);
v30 = cocos2d::CCNode::create(v29, v28);
cocos2d::CCDictionary::setObject(v16, v30, Buf1);
if ( *((_QWORD *)&v37 + 1) > 0xFu )
{
v31 = Buf1[0];
if ( (unsigned __int64)(*((_QWORD *)&v37 + 1) + 1LL) >= 0x1000 )
{
v31 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v31 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v31);
}
*((_DWORD *)v19 + 171) = j;
++v17;
v1 = v35;
result = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v35 + 368));
}
while ( v17 < result );
}
return result;
}