//
// GameLevelManager::onDownloadLevelCompleted from 0x708460 to 0x7085ec (396 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x732ea4
// > ??> @ 0x5abb8
//
// 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 GameLevelManager::onDownloadLevelCompleted(GameLevelManager *a1, __int64 a2, __int64 a3)
{
char *v4; // x0
void *v5; // x0
unsigned int *v7; // x1
int v8; // w2
unsigned int *v9; // x1
int v10; // w2
__int64 v12; // [xsp+48h] [xbp+48h] BYREF
const char *v13; // [xsp+50h] [xbp+50h] BYREF
sub_D18D28(&v12, a2);
sub_D18D28(&v13, a3);
GameLevelManager::processOnDownloadLevelCompleted(a1, &v12, &v13, 0);
v4 = (char *)(v13 - 24);
if ( v13 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v13 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *((_DWORD *)v13 - 2);
*((_DWORD *)v13 - 2) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v4);
}
v5 = (void *)(v12 - 24);
if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v12 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v5);
}
return _stack_chk_guard;
}