//
// cocos2d::extension::AssetsManager::Helper::update from 0xa9931c to 0xa99510 (500 bytes)
//
// 2 xrefs:
// > ??> @ 0xc38e8
// > ??> @ 0x11f4518
//
// 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::Helper::update(
cocos2d::extension::AssetsManager::Helper *this,
float a2)
{
pthread_mutex_t *v2; // x21
_QWORD *v4; // x0
_QWORD *v5; // x20
_QWORD *v6; // x23
_QWORD *v8; // x1
__int64 v9; // x0
cocos2d::CCUserDefault *v10; // x21
char *v11; // x0
cocos2d::CCUserDefault *v12; // x0
void (__fastcall ***v13)(_QWORD, _QWORD); // x0
unsigned int *v14; // x2
int v15; // w1
std::string v16; // [xsp+50h] [xbp+50h] BYREF
v2 = (pthread_mutex_t *)((char *)this + 64);
pthread_mutex_lock((pthread_mutex_t *)((char *)this + 64));
v4 = *((_QWORD **)this + 7);
v5 = (_QWORD *)*v4;
if ( (_QWORD *)*v4 == v4 )
{
pthread_mutex_unlock(v2);
}
else
{
v6 = (_QWORD *)v5[2];
sub_CD8DA4(*v4);
operator delete(v5);
pthread_mutex_unlock(v2);
switch ( *(_DWORD *)v6 )
{
case 0:
cocos2d::extension::AssetsManager::Helper::handleUpdateSucceed((__int64)this, (__int64)v6);
break;
case 1:
v10 = cocos2d::CCUserDefault::sharedUserDefault();
sub_D153B8((int)&v16, *(char **)(v6[1] + 16LL));
cocos2d::CCUserDefault::setStringForKey(v10, "downloaded-version-code", &v16);
v11 = (char *)v16.m_data.m_data - 24;
if ( (__int64 *)v16.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)((char *)v16.m_data.m_data - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v16.m_data.m_data - 2);
*((_DWORD *)v16.m_data.m_data - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v11);
}
v12 = cocos2d::CCUserDefault::sharedUserDefault();
cocos2d::CCUserDefault::flush(v12);
break;
case 2:
v8 = (_QWORD *)v6[1];
v9 = *(_QWORD *)(v8[1] + 80LL);
if ( v9 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v9 + 8LL))(v9, *(unsigned int *)v8);
v8 = (_QWORD *)v6[1];
}
goto LABEL_9;
case 3:
v8 = (_QWORD *)v6[1];
v13 = *(void (__fastcall ****)(_QWORD, _QWORD))(v8[1] + 80LL);
if ( v13 )
{
(**v13)(v13, *(unsigned int *)v8);
v8 = (_QWORD *)v6[1];
}
LABEL_9:
operator delete(v8);
break;
default:
break;
}
operator delete(v6);
}
return _stack_chk_guard;
}