//
// GJMultiplayerManager::exitLobby from 0x10065b100 to 0x10065b353 (595 bytes)
//
// 1 xrefs:
// > MPLobbyLayer::tryExitLobby @ 0x1004940ed
//
// 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
//
bool __fastcall GJMultiplayerManager::exitLobby(GJMultiplayerManager *a1, int a2)
{
__m128 v2; // xmm0
cocos2d::CCString *v3; // rax
const char *CString; // r14
cocos2d::CCObject *DLObject; // rax
cocos2d::CCNode *v6; // rax
cocos2d::CCString *v7; // rax
cocos2d::CCString *v8; // rax
const char *v9; // rax
double v10; // xmm0_8
size_t v11; // rax
size_t v12; // r15
char *v13; // r12
size_t v14; // r13
char v16; // [rsp+0h] [rbp-A0h]
char v17; // [rsp+0h] [rbp-A0h]
std::string v18; // [rsp+18h] [rbp-88h] BYREF
__int128 v19; // [rsp+30h] [rbp-70h] BYREF
void *data; // [rsp+40h] [rbp-60h]
_QWORD __dst[2]; // [rsp+48h] [rbp-58h] BYREF
void *__p; // [rsp+58h] [rbp-48h]
std::string v23; // [rsp+60h] [rbp-40h] BYREF
v3 = (cocos2d::CCString *)sub_1007AB580("%i_exitLobby", v16);
CString = cocos2d::CCString::getCString(v3);
DLObject = GJMultiplayerManager::getDLObject(a1, CString);
if ( !DLObject )
{
v6 = cocos2d::CCNode::create();
GJMultiplayerManager::addDLToActive(a1, CString, v6);
GJMultiplayerManager::getBasePostString(&v23, v2);
v7 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"9");
cocos2d::CCString::getCString(v7);
v8 = (cocos2d::CCString *)sub_1007AB580("&gameID=%i&secret=%s", v17);
v9 = cocos2d::CCString::getCString(v8);
std::string::append(&v23, v9);
v18.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v18.__r_.__value_.__r.__words[0] = 57;
v18.__r_.__value_.__l.__size_ = 53;
v10 = *(double *)"https://www.geometrydash.com/database/exitMPLobby.php";
strcpy(v18.__r_.__value_.__l.__data_, "https://www.geometrydash.com/database/exitMPLobby.php");
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v19, v23.__r_.__value_.__l.__data_, v23.__r_.__value_.__l.__size_, 2.057594829120962e-81);
}
else
{
data = v23.__r_.__value_.__l.__data_;
v10 = *(double *)v23.__r_.__value_.__r.__words;
v19 = *(_OWORD *)&v23.__r_.__value_.__l.0;
}
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v10);
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
__dst[0] = v14 | 1;
__dst[1] = v12;
}
else
{
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( !v11 )
{
LABEL_13:
v13[v12] = 0;
GJMultiplayerManager::ProcessHttpRequest(a1, &v18, (__int64)&v19, (__int64)__dst, 58);
if ( (__dst[0] & 1) != 0 )
{
operator delete(__p);
if ( (v19 & 1) == 0 )
{
LABEL_15:
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_16;
goto LABEL_22;
}
}
else if ( (v19 & 1) == 0 )
{
goto LABEL_15;
}
operator delete(data);
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_16:
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_18:
DLObject = nullptr;
return DLObject == nullptr;
}
LABEL_17:
operator delete(v23.__r_.__value_.__l.__data_);
goto LABEL_18;
}
LABEL_22:
operator delete(v18.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_18;
goto LABEL_17;
}
}
memmove(v13, CString, v12);
goto LABEL_13;
}
return DLObject == nullptr;
}