//
// GJMultiplayerManager::exitLobby from 0x98358c to 0x9838f8 (876 bytes)
//
// 2 xrefs:
// > MPLobbyLayer::tryExitLobby @ 0x9cab20
// > ??> @ 0x5b620
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool GJMultiplayerManager::exitLobby(GJMultiplayerManager *a1, int a2)
{
cocos2d::CCString *v4; // x0
char *CString; // x21
_BOOL4 isDLActive; // w1
bool result; // w0
cocos2d::CCString *v8; // x0
const char *v9; // x0
cocos2d::CCString *v10; // x0
size_t v11; // x0
char *v12; // x0
char *v13; // x0
char *v14; // x0
void *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
const char *v24; // [xsp+48h] [xbp+48h]
__int64 v25; // [xsp+68h] [xbp+68h] BYREF
const char *v26; // [xsp+70h] [xbp+70h] BYREF
const char *v27; // [xsp+78h] [xbp+78h] BYREF
const char *v28; // [xsp+80h] [xbp+80h] BYREF
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i_exitLobby",
*(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v4);
isDLActive = GJMultiplayerManager::isDLActive(a1, CString);
result = 0;
if ( !isDLActive )
{
GJMultiplayerManager::addDLToActive(a1, CString);
GJMultiplayerManager::getBasePostString(a1, (__int64)&v25);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfv",
"3899",
103,
99,
"9");
v9 = cocos2d::CCString::getCString(v8);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&gameID=%i&secret=%s",
(const char *)(unsigned int)a2,
v9);
v24 = cocos2d::CCString::getCString(v10);
v11 = strlen(v24);
sub_D15FD4(&v25, v24, v11);
sub_D153B8((int)&v26, "https://www.geometrydash.com/database/exitMPLobby.php");
sub_D18D28(&v27);
sub_D153B8((int)&v28, CString);
GJMultiplayerManager::ProcessHttpRequest(a1, &v26, &v27, &v28, 58);
v12 = (char *)(v28 - 24);
if ( v28 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v28 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v12);
}
v13 = (char *)(v27 - 24);
if ( v27 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v27 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v13);
}
v14 = (char *)(v26 - 24);
if ( v26 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v26 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v14);
}
v15 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) == &qword_124B6B0 )
return 1;
if ( &pthread_create )
{
v16 = (unsigned int *)(v25 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v17 - 1;
}
if ( v17 > 0 )
{
return 1;
}
else
{
operator delete(v15);
return 1;
}
}
return result;
}