//
// cocos2d::extension::AssetsManager::update from 0x180001c90 to 0x180001eb7 (551 bytes)
//
// 5 xrefs:
// > ??> @ 0x180023540
// > ??> @ 0x18002cf18
// > ??> @ 0x18002cf70
// > ??> @ 0x18002fdf8
// > ??> @ 0x1800490c0
//
// 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::extension::AssetsManager::update(cocos2d::extension::AssetsManager *this)
{
char *v2; // rbx
unsigned __int64 v3; // rcx
char *v4; // rdi
char *v5; // r9
__int64 v6; // rcx
unsigned __int8 v7; // al
int v8; // eax
__int64 v9; // rax
void **v10; // rbx
__int64 StringForKey; // rdi
unsigned __int64 v12; // rdx
_QWORD *v13; // rcx
_BYTE *v14; // rcx
_OWORD *v15; // rax
void *Block; // [rsp+20h] [rbp-38h] BYREF
unsigned __int64 v17; // [rsp+38h] [rbp-20h]
if ( !*((_QWORD *)this + 23) && *((_QWORD *)this + 15) && *((_QWORD *)this + 11) )
{
v2 = (char *)this + 72;
if ( *((_QWORD *)this + 12) > 0xFu )
v2 = *((char **)this + 9);
v3 = *((_QWORD *)this + 11);
if ( v3 >= 4 )
{
v4 = &v2[v3];
v5 = (char *)memchr(v2, 46, v3 - 3);
if ( v5 )
{
while ( 1 )
{
v6 = 0;
while ( 1 )
{
v7 = v5[v6++];
if ( v7 != aZip[v6 - 1] )
break;
if ( v6 == 4 )
{
v8 = 0;
goto LABEL_13;
}
}
v8 = v7 < (unsigned __int8)aZip[v6 - 1] ? -1 : 1;
LABEL_13:
if ( !v8 )
break;
v5 = (char *)memchr(v5 + 1, 46, v4 - 3 - (v5 + 1));
if ( !v5 )
return;
}
if ( v5 - v2 != -1
&& (*(unsigned __int8 (__fastcall **)(cocos2d::extension::AssetsManager *))(*(_QWORD *)this + 8LL))(this) )
{
v9 = cocos2d::CCUserDefault::sharedUserDefault();
v10 = (void **)((char *)this + 136);
StringForKey = cocos2d::CCUserDefault::getStringForKey(v9, &Block, "downloaded-version-code");
if ( (cocos2d::extension::AssetsManager *)((char *)this + 136) != (cocos2d::extension::AssetsManager *)StringForKey )
{
v12 = *((_QWORD *)this + 20);
if ( v12 > 0xF )
{
v13 = *v10;
if ( v12 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v13 - *(v13 - 1) - 8 > 0x1F )
goto LABEL_28;
v13 = (_QWORD *)*(v13 - 1);
}
j_j_free(v13);
}
*((_QWORD *)this + 19) = 0;
*((_QWORD *)this + 20) = 15;
*(_BYTE *)v10 = 0;
*(_OWORD *)v10 = *(_OWORD *)StringForKey;
*(_OWORD *)((char *)this + 152) = *(_OWORD *)(StringForKey + 16);
*(_QWORD *)(StringForKey + 16) = 0;
*(_QWORD *)(StringForKey + 24) = 15;
*(_BYTE *)StringForKey = 0;
}
if ( v17 > 0xF )
{
v14 = Block;
if ( v17 + 1 >= 0x1000 )
{
v14 = *((_BYTE **)Block - 1);
if ( (unsigned __int64)((_BYTE *)Block - v14 - 8) > 0x1F )
LABEL_28:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
v15 = operator new(0x10u);
*v15 = 0;
*((_QWORD *)this + 23) = v15;
pthread_create(v15, 0, sub_180001B60, this);
}
}
}
}
}