//
// cocos2d::extension::AssetsManager::Helper::update from 0xd0b05c to 0xd0b238 (476 bytes)
//
// 2 xrefs:
// > ??> @ 0xfe9b0
// > ??> @ 0x1509c98
//
// This function is hookable on this platform (idp: arm, 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 13:06:59 +0000
//
__int64 __fastcall cocos2d::extension::AssetsManager::Helper::update(
cocos2d::extension::AssetsManager::Helper *this,
float a2)
{
pthread_mutex_t *v3; // x21
__int64 v4; // x2
_QWORD *v5; // x0
_QWORD *v6; // x22
cocos2d::CCUserDefault *v7; // x0
_QWORD *v9; // x1
__int64 v10; // x0
__int64 v11; // x21
__int64 v12; // x0
const char *v13; // x1
size_t v14; // x0
cocos2d::CCUserDefault *v15; // x0
cocos2d::CCUserDefault *v16; // x0
void (__fastcall ***v17)(_QWORD, _QWORD); // x0
char *v18; // [xsp+38h] [xbp+38h]
cocos2d::CCUserDefault *v19[2]; // [xsp+40h] [xbp+40h] BYREF
void *v20; // [xsp+50h] [xbp+50h]
v3 = (pthread_mutex_t *)((char *)this + 64);
pthread_mutex_lock((pthread_mutex_t *)((char *)this + 64));
v4 = *((_QWORD *)this + 7);
if ( *(_QWORD *)(v4 + 16) )
{
v5 = *(_QWORD **)(v4 + 8);
v6 = (_QWORD *)v5[2];
*(_QWORD *)(*v5 + 8LL) = v5[1];
*(_QWORD *)v5[1] = *v5;
--*(_QWORD *)(v4 + 16);
operator delete(v5);
pthread_mutex_unlock(v3);
v7 = (cocos2d::CCUserDefault *)*(unsigned int *)v6;
switch ( (int)v7 )
{
case 0:
cocos2d::extension::AssetsManager::Helper::handleUpdateSucceed((__int64)this, (__int64)v6);
break;
case 1:
v11 = cocos2d::CCUserDefault::sharedUserDefault(v7);
v12 = v6[1];
v13 = (const char *)(v12 + 33);
if ( (*(_BYTE *)(v12 + 32) & 1) != 0 )
v13 = *(const char **)(v12 + 48);
v18 = (char *)v13;
v19[0] = nullptr;
v19[1] = nullptr;
v20 = nullptr;
v14 = strlen(v13);
std::string::__init((__int64 *)v19, v18, v14);
cocos2d::CCUserDefault::setStringForKey(v11, "downloaded-version-code", v19);
v15 = (cocos2d::CCUserDefault *)LOBYTE(v19[0]);
if ( ((__int64)v19[0] & 1) != 0 )
operator delete(v20);
v16 = (cocos2d::CCUserDefault *)cocos2d::CCUserDefault::sharedUserDefault(v15);
cocos2d::CCUserDefault::flush(v16);
break;
case 2:
v9 = (_QWORD *)v6[1];
v10 = *(_QWORD *)(v9[1] + 160LL);
if ( v10 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v10 + 8LL))(v10, *(unsigned int *)v9);
v9 = (_QWORD *)v6[1];
}
goto LABEL_9;
case 3:
v9 = (_QWORD *)v6[1];
v17 = *(void (__fastcall ****)(_QWORD, _QWORD))(v9[1] + 160LL);
if ( v17 )
{
(**v17)(v17, *(unsigned int *)v9);
v9 = (_QWORD *)v6[1];
}
LABEL_9:
operator delete(v9);
break;
default:
break;
}
operator delete(v6);
}
else
{
pthread_mutex_unlock(v3);
}
return _stack_chk_guard;
}