//
// GJMultiplayerManager::joinLobby from 0x10065a630 to 0x10065a911 (737 bytes)
//
// 1 xrefs:
// > MPLobbyLayer::onUpdateLobby @ 0x100493d47
//
// 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::joinLobby(GJMultiplayerManager *a1, int a2)
{
cocos2d::CCString *v2; // rax
char *CString; // r14
cocos2d::CCObject *DLObject; // rax
cocos2d::CCNode *v5; // rax
cocos2d::CCObject *v6; // rax
cocos2d::CCObject *v7; // r13
unsigned int v8; // ebx
int v9; // r12d
int v10; // r14d
unsigned int v11; // eax
cocos2d::CCString *v12; // rax
cocos2d::CCString *v13; // rax
const char *v14; // rax
double v15; // xmm0_8
cocos2d::CCObject *v16; // r14
char *v17; // r13
size_t v18; // rax
size_t v19; // r15
char *v20; // rbx
size_t v21; // r12
char v23; // [rsp+0h] [rbp-B0h]
char v24; // [rsp+0h] [rbp-B0h]
std::string v25; // [rsp+18h] [rbp-98h] BYREF
__int128 v26; // [rsp+30h] [rbp-80h] BYREF
void *data; // [rsp+40h] [rbp-70h]
GJMultiplayerManager *v28; // [rsp+48h] [rbp-68h]
char *__s; // [rsp+50h] [rbp-60h]
_QWORD __dst[2]; // [rsp+58h] [rbp-58h] BYREF
void *__p; // [rsp+68h] [rbp-48h]
std::string v32; // [rsp+70h] [rbp-40h] BYREF
v2 = (cocos2d::CCString *)sub_1007AB580("%i_joinLobby", v23);
CString = (char *)cocos2d::CCString::getCString(v2);
DLObject = GJMultiplayerManager::getDLObject(a1, CString);
if ( !DLObject )
{
v5 = cocos2d::CCNode::create();
__s = CString;
GJMultiplayerManager::addDLToActive(a1, CString, v5);
GJMultiplayerManager::getBasePostString(&v32);
v28 = a1;
v6 = cocos2d::CCDictionary::objectForKey(a1->m_lobbyComments, a2);
v7 = v6;
if ( v6 && (unsigned int)sub_100720070(v6) && (unsigned int)sub_100720070(v7) )
{
v8 = 0;
v9 = 0;
do
{
v10 = *(_DWORD *)(sub_1007200C0(v7, v8) + 368);
v11 = sub_100720070(v7);
++v8;
if ( v10 > v9 )
v9 = v10;
}
while ( v8 < v11 );
}
v12 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"9");
cocos2d::CCString::getCString(v12);
v13 = (cocos2d::CCString *)sub_1007AB580("&gameID=%i&lastCommentID=%i&secret=%s", v24);
v14 = cocos2d::CCString::getCString(v13);
std::string::append(&v32, v14);
v25.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v25.__r_.__value_.__r.__words[0] = 57;
v25.__r_.__value_.__l.__size_ = 53;
v15 = *(double *)"https://www.geometrydash.com/database/joinMPLobby.php";
strcpy(v25.__r_.__value_.__l.__data_, "https://www.geometrydash.com/database/joinMPLobby.php");
if ( (*(_BYTE *)&v32.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v26, v32.__r_.__value_.__l.__data_, v32.__r_.__value_.__l.__size_, 2.057594829120962e-81);
}
else
{
data = v32.__r_.__value_.__l.__data_;
v15 = *(double *)v32.__r_.__value_.__r.__words;
v26 = *(_OWORD *)&v32.__r_.__value_.__l.0;
}
v16 = v28;
v17 = __s;
v18 = strlen(__s);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v15);
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
__p = v20;
__dst[0] = v21 | 1;
__dst[1] = v19;
}
else
{
LOBYTE(__dst[0]) = 2 * v18;
v20 = (char *)__dst + 1;
if ( !v18 )
{
LABEL_20:
v20[v19] = 0;
GJMultiplayerManager::ProcessHttpRequest(v16, &v25, (__int64)&v26, (__int64)__dst, 57);
if ( (__dst[0] & 1) != 0 )
{
operator delete(__p);
if ( (v26 & 1) == 0 )
{
LABEL_22:
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_23;
goto LABEL_29;
}
}
else if ( (v26 & 1) == 0 )
{
goto LABEL_22;
}
operator delete(data);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_23:
if ( (*(_BYTE *)&v32.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_25:
DLObject = nullptr;
return DLObject == nullptr;
}
LABEL_24:
operator delete(v32.__r_.__value_.__l.__data_);
goto LABEL_25;
}
LABEL_29:
operator delete(v25.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v32.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_25;
goto LABEL_24;
}
}
memmove(v20, v17, v19);
goto LABEL_20;
}
return DLObject == nullptr;
}