//
// GameLevelManager::onRequestUserAccessCompleted from 0x6fba9c to 0x6fbd20 (644 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x732114
// > ??> @ 0x7eb58
//
// 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::onRequestUserAccessCompleted(__int64 a1, const void **a2)
{
cocos2d::CCDictionary *v4; // x22
char *v5; // x0
_DWORD *v6; // x25
unsigned __int64 v7; // x26
unsigned __int64 v8; // x20
size_t v9; // x2
int v10; // w19
__int64 v11; // x20
__int64 *v12; // x0
__int64 v13; // x0
int v14; // w0
int v15; // w19
unsigned int *v17; // x25
int v18; // w1
GameManager *v19; // x0
GameManager *v20; // x20
int v21; // w0
void (__fastcall ***v22)(_QWORD, _QWORD, __int64); // x1
float v23; // s0
GameManager *v24; // x0
unsigned int *v25; // x1
int v26; // w2
void *v27; // [xsp+60h] [xbp+60h] BYREF
v4 = *(cocos2d::CCDictionary **)(a1 + 656);
sub_D153B8((int)&v27, "req_ua");
cocos2d::CCDictionary::removeObjectForKey(v4, (const std::string *)&v27);
v5 = (char *)v27 - 24;
if ( (char *)v27 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)((char *)v27 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v5);
}
sub_D153B8((int)&v27, "-1");
v6 = v27;
v7 = *((_QWORD *)v27 - 3);
v8 = *((_QWORD *)*a2 - 3);
if ( v7 > v8 )
v9 = *((_QWORD *)*a2 - 3);
else
v9 = *((_QWORD *)v27 - 3);
v10 = memcmp(*a2, v27, v9);
if ( v10 || (v10 = 0x7FFFFFFF, v11 = v8 - v7, v11 > 0x7FFFFFFF) )
{
v12 = (__int64 *)(v6 - 6);
if ( v6 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_8;
}
else
{
v12 = (__int64 *)(v6 - 6);
if ( v11 >= (__int64)0xFFFFFFFF80000000LL )
v10 = v11;
else
v10 = 0x80000000;
if ( v12 == &qword_124B6B0 )
goto LABEL_8;
}
if ( &pthread_create )
{
v17 = v6 - 2;
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(v6 - 2);
*(v6 - 2) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v12);
LABEL_8:
if ( !v10 )
{
v13 = *(_QWORD *)(a1 + 824);
if ( v13 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v13 + 8LL))(v13, 0, 43);
}
v14 = atoi((const char *)*a2);
v15 = v14;
if ( v14 == 99 )
{
v24 = GameManager::sharedState();
v22 = *(void (__fastcall ****)(_QWORD, _QWORD, __int64))(a1 + 824);
v24->m_hasDRP = 1;
if ( !v22 )
return _stack_chk_guard;
goto LABEL_24;
}
if ( (unsigned int)(v14 - 1) <= 1 )
{
v19 = GameManager::sharedState();
v19->m_hasRP.value = v15;
v20 = v19;
v21 = rand();
v22 = *(void (__fastcall ****)(_QWORD, _QWORD, __int64))(a1 + 824);
v23 = (float)((float)v21 * 4.6566e-10) * 1000.0;
v20->m_hasRP.seed = (int)v23;
v20->m_hasRP.random = v15 + (int)v23;
if ( v22 )
LABEL_24:
(**v22)(v22, 0, 43);
}
return _stack_chk_guard;
}