//
// MPLobbyLayer::joinLobbyFinished from 0x1004941b0 to 0x1004944a5 (757 bytes)
//
// 2 xrefs:
// > sub_1004944F0 @ 0x1004944fc
// > ??> @ 0x100943c60
//
// 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 MPLobbyLayer::joinLobbyFinished(MPLobbyLayer *a1, int a2)
{
double v2; // xmm0_8
MPLobbyLayer *v3; // r13
GJMultiplayerManager *v4; // rax
cocos2d::CCObject *v5; // rax
cocos2d::CCObject *v6; // r14
cocos2d::CCString *v7; // rax
const char *v8; // r15
size_t v9; // rax
std::string::size_type v10; // rbx
char *data; // r12
cocos2d::CCLabelBMFont *m_lobbyLabel; // r14
cocos2d::CCString *v13; // rax
const char *CString; // rax
size_t v15; // r13
unsigned int i; // r12d
__int64 v17; // r15
cocos2d::CCString *v18; // rax
const char *v19; // rax
cocos2d::CCLabelBMFont *v20; // rdi
float v21; // xmm0_4
cocos2d::CCDelayTime *v22; // rbx
cocos2d::CCCallFunc *v23; // rax
cocos2d::CCSequence *v24; // rax
timeb v25; // [rsp+0h] [rbp-80h] BYREF
cocos2d::CCObject *v26; // [rsp+10h] [rbp-70h]
std::string::pointer v27; // [rsp+18h] [rbp-68h]
__int128 v28; // [rsp+20h] [rbp-60h] BYREF
void *__p; // [rsp+30h] [rbp-50h]
int v30; // [rsp+3Ch] [rbp-44h]
std::string __dst[2]; // [rsp+40h] [rbp-40h] BYREF
v3 = a1;
a1->m_lobbyID = a2;
v4 = GJMultiplayerManager::sharedState();
v5 = cocos2d::CCDictionary::objectForKey(v4->m_scoreArrays, a1->m_lobbyID);
if ( !v5 )
{
m_lobbyLabel = a1->m_lobbyLabel;
v13 = (cocos2d::CCString *)sub_1007AB580("MPLobbyLayer::joinLobbyFinished: %i", v25.time);
CString = cocos2d::CCString::getCString(v13);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_lobbyLabel->setString)(m_lobbyLabel, CString);
goto LABEL_23;
}
v6 = v5;
v7 = (cocos2d::CCString *)sub_1007AB580("Game: %i", v25.time);
v8 = cocos2d::CCString::getCString(v7);
v9 = strlen(v8);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v10 = v9;
v26 = v6;
if ( v9 >= 0x17 )
{
v15 = 26;
if ( (v9 | 7) != 0x17 )
v15 = (v9 | 7) + 1;
data = (char *)operator new(v15);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v15 + 1;
v3 = a1;
v6 = v26;
__dst[0].__r_.__value_.__l.__size_ = v10;
goto LABEL_10;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v9);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v9 )
LABEL_10:
memmove(data, v8, v10);
v27 = __dst[0].__r_.__value_.__s.__data_;
data[v10] = 0;
for ( i = 0; i < (unsigned int)sub_100720070(v6); ++i )
{
v17 = sub_1007200C0(v6, i);
v30 = *(_DWORD *)(v17 + 376);
if ( (*(_BYTE *)(v17 + 320) & 1) != 0 )
{
sub_100006B70(&v28, *(const void **)(v17 + 336), *(_QWORD *)(v17 + 328), v2);
}
else
{
__p = *(void **)(v17 + 336);
v28 = *(_OWORD *)(v17 + 320);
}
ftime(&v25);
v2 = ((double)(v25.millitm + 1000 * (v25.time & 0xFFFFF)) / 1000.0 - *(double *)(v17 + 720)) / 1000.0;
v18 = (cocos2d::CCString *)sub_1007AB580("\n%i: %s - Last Action: %f", v25.time);
v19 = cocos2d::CCString::getCString(v18);
std::string::append(__dst, v19);
if ( (v28 & 1) != 0 )
operator delete(__p);
v6 = v26;
}
v20 = v3->m_lobbyLabel;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v27 = __dst[0].__r_.__value_.__l.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))v20->setString)(v20, v27);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
LABEL_23:
v3->m_awaitingLobby = 0;
((void (__fastcall *)(MPLobbyLayer *))v3->updateComments)(v3);
if ( v3->m_awaitingLobby )
v21 = 2.0;
else
v21 = fminf(10.0, v3->m_lobbyDelay + 0.5);
v3->m_lobbyDelay = v21;
v22 = cocos2d::CCDelayTime::create(v21);
v23 = cocos2d::CCCallFunc::create(v3, (cocos2d::SEL_CallFunc)(unsigned __int64)MPLobbyLayer::onUpdateLobby);
v24 = sub_1003B5760(v22, v23, 0);
cocos2d::CCNode::runAction(v3, v24);
}