//
// cocos2d::extension::AssetsManager::checkUpdate from 0xa98ed0 to 0xa990bc (492 bytes)
//
// 2 xrefs:
// > ??> @ 0xaedc8
// > ??> @ 0x11f44d0
//
// 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
//
__int64 __fastcall cocos2d::extension::AssetsManager::checkUpdate(cocos2d::extension::AssetsManager *this)
{
unsigned int v2; // w21
__int64 v4; // x0
__int64 v5; // x2
cocos2d::CCUserDefault *v6; // x0
_DWORD *v7; // x22
_QWORD *v8; // x1
size_t v9; // x2
char *v10; // x0
unsigned int *v11; // x22
int v12; // w1
void *v13; // [xsp+40h] [xbp+40h] BYREF
if ( *(_QWORD *)(*((_QWORD *)this + 4) - 24LL) && (v4 = sub_B94B24(), (*((_QWORD *)this + 6) = v4) != 0) )
{
sub_D174B8((char *)this + 16, 0, *(_QWORD *)(*((_QWORD *)this + 2) - 24LL), 0);
sub_B94BD0(*((_QWORD *)this + 6), 10002, *((_QWORD *)this + 4));
sub_B94BD0(*((_QWORD *)this + 6), 64, 0);
sub_B94BD0(*((_QWORD *)this + 6), 20011, sub_A97314);
sub_B94BD0(*((_QWORD *)this + 6), 10001, (char *)this + 16);
v5 = *((unsigned int *)this + 18);
if ( (_DWORD)v5 )
sub_B94BD0(*((_QWORD *)this + 6), 78, v5);
if ( (unsigned int)sub_B94C64(*((_QWORD *)this + 6)) )
{
v2 = 0;
cocos2d::extension::AssetsManager::sendErrorMessage((__int64)this, 1);
sub_B94EA8(*((_QWORD *)this + 6));
}
else
{
v6 = cocos2d::CCUserDefault::sharedUserDefault();
v2 = 1;
cocos2d::CCUserDefault::getStringForKey((__int64 *)&v13, v6, "current-version-code");
v7 = v13;
v8 = *((_QWORD **)this + 2);
v9 = *((_QWORD *)v13 - 3);
if ( v9 == *(v8 - 3) && !memcmp(v13, v8, v9) )
{
cocos2d::extension::AssetsManager::sendErrorMessage((__int64)this, 2);
cocos2d::extension::AssetsManager::setSearchPath(this);
v7 = v13;
v2 = 0;
}
v10 = (char *)(v7 - 6);
if ( v7 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = v7 - 2;
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(v7 - 2);
*(v7 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
}
else
{
return 0;
}
return v2;
}