//
// GJMultiplayerManager::ProcessHttpRequest from 0x1402826a0 to 0x1402829ac (780 bytes)
//
// 2 xrefs:
// > GJMultiplayerManager::uploadComment @ 0x140283a66
// > ??> @ 0x1406d1478
//
// 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
//
// Hidden C++ exception states: #wind=6
void __fastcall GJMultiplayerManager::ProcessHttpRequest(
cocos2d::CCObject *a1,
char *a2,
const char *a3,
const char *a4,
int a5)
{
unsigned __int64 v6; // r13
unsigned __int64 v7; // rbx
char *v8; // r15
unsigned __int64 v9; // rax
unsigned __int64 v10; // rax
char *v11; // rbp
int v12; // r14d
char *v13; // rbx
void *v14; // rcx
unsigned __int64 v15; // rbx
char *v16; // r9
cocos2d::extension::CCHttpRequest *v17; // rbx
const char *v18; // rdx
const char *v19; // rax
const char *v20; // rdx
__int64 v21; // r8
const char *v22; // rdx
__int64 v23; // rdx
__int64 v24; // rcx
__int64 v25; // r8
__int64 v26; // r9
cocos2d::extension::CCHttpClient *Instance; // rax
void *Block[2]; // [rsp+68h] [rbp-80h] BYREF
size_t v32; // [rsp+78h] [rbp-70h]
unsigned __int64 v33; // [rsp+80h] [rbp-68h]
__int128 v34; // [rsp+88h] [rbp-60h] BYREF
__int64 v35; // [rsp+98h] [rbp-50h]
__int64 v36; // [rsp+A0h] [rbp-48h]
*(_OWORD *)Block = 0;
v32 = 5;
v6 = 15;
v33 = 15;
strcpy((char *)Block, "https");
v34 = 0;
v35 = 4;
v36 = 15;
strcpy((char *)&v34, "http");
v7 = 0;
while ( 1 )
{
v8 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v8 = *(char **)a2;
v9 = *((_QWORD *)a2 + 2);
if ( v9 < 4 )
break;
v10 = v9 - 4;
if ( v7 > v10 )
break;
v11 = &v8[v10];
v12 = (char)v34;
v13 = (char *)memchr(&v8[v7], (char)v34, v10 + 1 - v7);
if ( !v13 )
break;
while ( memcmp(v13, &v34, 4u) )
{
v13 = (char *)memchr(v13 + 1, v12, v11 - v13);
if ( !v13 )
goto LABEL_9;
}
v15 = v13 - v8;
if ( v15 == -1 )
break;
v16 = (char *)Block;
if ( v6 > 0xF )
v16 = (char *)Block[0];
sub_140041FF0(a2, v15, 4u, v16, v32);
v7 = v32 + v15;
v6 = v33;
}
LABEL_9:
if ( v33 > 0xF )
{
v14 = Block[0];
if ( v33 + 1 >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
v17 = (cocos2d::extension::CCHttpRequest *)operator new(0xE0u);
cocos2d::extension::CCHttpRequest::CCHttpRequest(v17);
v17->__vftable = (cocos2d::extension::CCHttpRequest_vtbl *)&cocos2d::extension::CCHttpRequest::`vftable';
v18 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v18 = *(const char **)a2;
cocos2d::extension::CCHttpRequest::setUrl(v17, v18);
v17->_requestType = kHttpPost;
v17->_pTarget = a1;
v17->_pSelector.ptr = (void (__cdecl *)(cocos2d::extension::CCHttpClient *, cocos2d::extension::CCHttpResponse *))GJMultiplayerManager::onProcessHttpRequestCompleted;
if ( a1 )
cocos2d::CCObject::retain(a1);
v19 = a3;
if ( *((_QWORD *)a3 + 3) <= 0xFu )
{
v20 = a3;
}
else
{
v19 = *(const char **)a3;
v20 = *(const char **)a3;
}
v21 = -1;
do
++v21;
while ( v19[v21] );
cocos2d::extension::CCHttpRequest::setRequestData(v17, v20, v21);
v22 = a4;
if ( *((_QWORD *)a4 + 3) > 0xFu )
v22 = *(const char **)a4;
cocos2d::extension::CCHttpRequest::setTag(v17, v22);
LODWORD(v17->_headers._Mypair._Myval2._Myend) = a5;
Instance = (cocos2d::extension::CCHttpClient *)cocos2d::extension::CCHttpClient::getInstance(v24, v23, v25, v26);
cocos2d::extension::CCHttpClient::send(Instance, v17);
cocos2d::CCObject::release(v17);
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
sub_14003A830((__int64)a4);
}