//
// cocos2d::extension::AssetsManager::checkUpdate from 0x180001900 to 0x180001b58 (600 bytes)
//
// 3 xrefs:
// > ??> @ 0x180023538
// > ??> @ 0x18002fdf8
// > ??> @ 0x180049090
//
// 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=1
char __fastcall cocos2d::extension::AssetsManager::checkUpdate(cocos2d::extension::AssetsManager *this)
{
__int64 v2; // rax
_BYTE *v3; // rax
_QWORD *v4; // rax
__int64 v6; // rax
char *v7; // rdx
void **v8; // rcx
char *v9; // rsi
unsigned __int64 v10; // rbp
_QWORD *v11; // rax
char v12; // bl
char *v13; // rax
_QWORD *v14; // [rsp+20h] [rbp-48h]
_QWORD *v15; // [rsp+20h] [rbp-48h]
void *Buf1[2]; // [rsp+28h] [rbp-40h] BYREF
size_t Size; // [rsp+38h] [rbp-30h]
unsigned __int64 v18; // [rsp+40h] [rbp-28h]
if ( !*((_QWORD *)this + 15) )
return 0;
v2 = curl_easy_init();
*((_QWORD *)this + 21) = v2;
if ( !v2 )
return 0;
*((_QWORD *)this + 7) = 0;
v3 = (char *)this + 40;
if ( *((_QWORD *)this + 8) > 0xFu )
v3 = *((_BYTE **)this + 5);
*v3 = 0;
curl_easy_setopt(*((_QWORD *)this + 21), 10002);
curl_easy_setopt(*((_QWORD *)this + 21), 64);
curl_easy_setopt(*((_QWORD *)this + 21), 20011);
curl_easy_setopt(*((_QWORD *)this + 21), 10001);
if ( *((_DWORD *)this + 48) )
curl_easy_setopt(*((_QWORD *)this + 21), 78);
if ( (unsigned int)curl_easy_perform(*((_QWORD *)this + 21)) )
{
v14 = operator new(0x10u);
v14[1] = 0;
*(_DWORD *)v14 = 3;
v4 = operator new(0x10u);
*v4 = 1;
v4[1] = this;
v14[1] = v4;
sub_180002B70(*((_QWORD *)this + 22), v14);
curl_easy_cleanup(*((_QWORD *)this + 21));
return 0;
}
v6 = cocos2d::CCUserDefault::sharedUserDefault();
cocos2d::CCUserDefault::getStringForKey(v6, Buf1, "current-version-code");
v7 = (char *)this + 40;
if ( *((_QWORD *)this + 8) > 0xFu )
v7 = *((char **)this + 5);
v8 = Buf1;
v9 = (char *)Buf1[0];
v10 = v18;
if ( v18 > 0xF )
v8 = (void **)Buf1[0];
if ( Size == *((_QWORD *)this + 7) && !memcmp(v8, v7, Size) )
{
v15 = operator new(0x10u);
v15[1] = 0;
*(_DWORD *)v15 = 3;
v11 = operator new(0x10u);
*v11 = 2;
v11[1] = this;
v15[1] = v11;
sub_180002B70(*((_QWORD *)this + 22), v15);
cocos2d::extension::AssetsManager::setSearchPath(this);
v12 = 0;
v10 = v18;
v9 = (char *)Buf1[0];
}
else
{
v12 = 1;
}
if ( v10 > 0xF )
{
v13 = v9;
if ( v10 + 1 >= 0x1000 )
{
v9 = *((char **)v9 - 1);
if ( (unsigned __int64)(v13 - v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
return v12;
}