//
// GameLevelManager::onProcessHttpRequestCompleted from 0x10051ad60 to 0x10051aeb0 (336 bytes)
//
// 2 xrefs:
// > GameLevelManager::performNetworkTest @ 0x10051acaa
// > GameLevelManager::ProcessHttpRequest @ 0x10051b027
//
// 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
//
void __fastcall GameLevelManager::onProcessHttpRequestCompleted(
GameLevelManager *a1,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
double v3; // xmm0_8
GameLevelManager *v4; // rbx
cocos2d::extension::CCHttpRequest *pHttpRequest; // rax
const char *longStorage; // r15
unsigned int requestTypeGJ; // r14d
size_t v8; // rax
size_t v9; // r12
char *v10; // r13
size_t v11; // rbx
__int128 v12; // [rsp+0h] [rbp-80h] BYREF
void *v13; // [rsp+10h] [rbp-70h]
__int128 v14; // [rsp+20h] [rbp-60h] BYREF
void *__p; // [rsp+30h] [rbp-50h]
_QWORD __dst[2]; // [rsp+38h] [rbp-48h] BYREF
void *v17; // [rsp+48h] [rbp-38h]
unsigned int v18; // [rsp+54h] [rbp-2Ch]
v4 = a1;
pHttpRequest = a3->_pHttpRequest;
if ( (pHttpRequest->_tag.m_data.m_short.sizex2 & 1) != 0 )
longStorage = pHttpRequest->_tag.m_data.m_long.longStorage;
else
longStorage = pHttpRequest->_tag.m_data.m_short.shortStorage.__elems_;
requestTypeGJ = pHttpRequest->_requestTypeGJ;
GameToolbox::getResponse((__int64)&v14, (__int64)a3, v3);
if ( (v14 & 1) != 0 )
{
sub_100006B70(&v12, __p, *((unsigned __int64 *)&v14 + 1), v3);
}
else
{
v13 = __p;
v3 = *(double *)&v14;
v12 = v14;
}
v8 = strlen(longStorage);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v9 = v8;
if ( v8 >= 0x17 )
{
v18 = requestTypeGJ;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
v17 = v10;
__dst[0] = v11 | 1;
__dst[1] = v9;
v4 = a1;
requestTypeGJ = v18;
goto LABEL_14;
}
LOBYTE(__dst[0]) = 2 * v8;
v10 = (char *)__dst + 1;
if ( v8 )
LABEL_14:
memmove(v10, longStorage, v9);
v10[v9] = 0;
GameLevelManager::handleIt(v4, 1, &v12, __dst, requestTypeGJ);
if ( (__dst[0] & 1) != 0 )
{
operator delete(v17);
if ( (v12 & 1) == 0 )
{
LABEL_17:
if ( (v14 & 1) == 0 )
return;
goto LABEL_18;
}
}
else if ( (v12 & 1) == 0 )
{
goto LABEL_17;
}
operator delete(v13);
if ( (v14 & 1) != 0 )
LABEL_18:
operator delete(__p);
}