//
// GJMultiplayerManager::onJoinLobbyCompleted from 0x1001cea50 to 0x1001cee74 (1060 bytes)
//
// 1 xrefs:
// > GJMultiplayerManager::handleIt @ 0x1001ce984
//
// 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 GJMultiplayerManager::onJoinLobbyCompleted(GJMultiplayerManager *a1, _QWORD *a2, const char *a3)
{
const char *v3; // x20
const char *v6; // x1
__int64 v7; // x20
_BOOL4 v8; // w0
_BOOL4 v9; // w22
cocos2d::CCArray *v10; // x21
cocos2d::CCString *v11; // x0
char *CString; // x0
cocos2d::CCString *v13; // x0
cocos2d::CCObject *v14; // x22
cocos2d::CCString *v15; // x0
char *v16; // x0
cocos2d::CCArray *v17; // x23
unsigned int i; // w24
cocos2d::CCString *v19; // x0
char *v20; // x0
cocos2d::CCArray *v21; // x27
cocos2d::CCString *v22; // x0
int v23; // w26
cocos2d::CCString *v24; // x0
char *v25; // x0
cocos2d::CCString *v26; // x0
int v27; // w28
GJUserScore *v28; // x27
GJMPDelegate *m_mpDelegate; // x0
cocos2d::CCString *v30; // x0
char *v31; // x0
unsigned __int64 v32; // x9
unsigned __int8 v33; // w8
cocos2d::CCArray *v34; // x21
unsigned int j; // w22
cocos2d::CCString *v36; // x0
char *v37; // x0
GJMPDelegate *v38; // x0
__int64 v39; // [xsp+8h] [xbp-118h]
std::string __dst; // [xsp+10h] [xbp-110h] BYREF
std::string __str; // [xsp+30h] [xbp-F0h] BYREF
std::string v42; // [xsp+48h] [xbp-D8h] BYREF
void *v43[2]; // [xsp+60h] [xbp-C0h] BYREF
unsigned __int8 v44; // [xsp+77h] [xbp-A9h]
void *v45[2]; // [xsp+78h] [xbp-A8h] BYREF
char v46; // [xsp+8Fh] [xbp-91h]
void *__p[2]; // [xsp+90h] [xbp-90h] BYREF
char v48; // [xsp+A7h] [xbp-79h]
timeb v49; // [xsp+A8h] [xbp-78h] BYREF
v3 = a3;
v6 = a3;
if ( a3[23] < 0 )
v6 = *(const char **)a3;
GJMultiplayerManager::removeDLFromActive(a1, v6);
if ( v3[23] < 0 )
v3 = *(const char **)v3;
v7 = atoi(v3);
sub_100009900(__p, "-1");
v8 = sub_1000045BC(a2, __p);
v9 = v8;
if ( v48 < 0 )
{
operator delete(__p[0]);
if ( v9 )
goto LABEL_23;
}
else if ( v8 )
{
LABEL_23:
m_mpDelegate = a1->m_mpDelegate;
if ( m_mpDelegate )
((void (__fastcall *)(GJMPDelegate *, __int64, _QWORD))m_mpDelegate->joinLobbyFailed)(m_mpDelegate, v7, 0);
return;
}
v10 = (cocos2d::CCArray *)sub_1001CF2C4(a2, "#");
if ( (unsigned int)sub_10024A36C(v10) < 3 )
goto LABEL_23;
v11 = cocos2d::CCArray::stringAtIndex(v10, 0);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_100009900(__p, CString);
v13 = cocos2d::CCArray::stringAtIndex(v10, 1u);
v39 = cocos2d::CCString::intValue(v13);
v14 = (cocos2d::CCObject *)sub_10024A15C(v39);
v15 = cocos2d::CCArray::stringAtIndex(v10, 2u);
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_100009900(v45, v16);
v17 = (cocos2d::CCArray *)sub_1001CF2C4(v45, ";");
for ( i = 0; i < (unsigned int)sub_10024A36C(v17); ++i )
{
v19 = cocos2d::CCArray::stringAtIndex(v17, i);
v20 = (char *)cocos2d::CCString::getCString(v19);
sub_100009900(v43, v20);
v21 = (cocos2d::CCArray *)sub_1001CF2C4(v43, ",");
if ( (unsigned int)sub_10024A36C(v21) >= 3 )
{
v22 = cocos2d::CCArray::stringAtIndex(v21, 0);
v23 = cocos2d::CCString::intValue(v22);
v24 = cocos2d::CCArray::stringAtIndex(v21, 1u);
v25 = (char *)cocos2d::CCString::getCString(v24);
sub_100009900(&v42, v25);
v26 = cocos2d::CCArray::stringAtIndex(v21, 2u);
v27 = cocos2d::CCString::intValue(v26);
v28 = GJUserScore::create_1();
v28->m_accountID = v23;
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__str, v42.__r_.__value_.__l.__data_, v42.__r_.__value_.__l.__size_);
else
__str = v42;
std::string::operator=((std::string *)&v28->m_userName, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
ftime(&v49);
v28->m_lobbyJoinTime = (double)(v49.millitm + 1000 * (unsigned __int64)(v49.time & 0xFFFFF)) / 1000.0
+ (float)((float)v27 * -1000.0);
cocos2d::CCDictionary::setObject(a1->m_lobbyScores, v28, v23);
sub_10024A2D0(v14, v28);
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v42.__r_.__value_.__l.__data_);
}
if ( (char)v44 < 0 )
operator delete(v43[0]);
}
cocos2d::CCDictionary::setObject(a1->m_scoreArrays, v14, (int)v39);
if ( (unsigned int)sub_10024A36C(v10) >= 4 )
{
v30 = cocos2d::CCArray::stringAtIndex(v10, 3u);
v31 = (char *)cocos2d::CCString::getCString(v30);
sub_100009900(v43, v31);
v32 = v44;
v33 = v44;
if ( (v44 & 0x80u) != 0 )
v32 = (unsigned __int64)v43[1];
if ( v32 )
{
v34 = (cocos2d::CCArray *)sub_1001CF2C4(v43, "|");
for ( j = 0; j < (unsigned int)sub_10024A36C(v34); ++j )
{
v36 = cocos2d::CCArray::stringAtIndex(v34, j);
v37 = (char *)cocos2d::CCString::getCString(v36);
sub_100009900(&v42, v37);
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v42.__r_.__value_.__l.__data_, v42.__r_.__value_.__l.__size_);
else
__dst = v42;
GJMultiplayerManager::addComment(a1, &__dst, v39);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v42.__r_.__value_.__l.__data_);
}
v33 = v44;
}
if ( (v33 & 0x80) != 0 )
operator delete(v43[0]);
}
v38 = a1->m_mpDelegate;
if ( v38 )
((void (__fastcall *)(GJMPDelegate *, __int64))v38->joinLobbyFinished)(v38, v39);
if ( v46 < 0 )
operator delete(v45[0]);
if ( v48 < 0 )
operator delete(__p[0]);
}