//
// GJMultiplayerManager::addComment from 0x1001cf4e0 to 0x1001cf68c (428 bytes)
//
// 2 xrefs:
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x1001ceddc
// > GJMultiplayerManager::createAndAddComment @ 0x1001cfc8c
//
// 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::addComment(__int64 a1, __int64 a2, int a3)
{
intptr_t v5; // x22
cocos2d::CCObject *v6; // x19
cocos2d::CCDictionary *v7; // x0
GJComment *v8; // x21
int m_accountID; // w22
GJAccountManager *v10; // x0
__int64 v11; // x22
__int64 v12; // x23
int v13; // w24
GJAccountManager *v14; // x0
cocos2d::CCObject *v15; // x0
std::string v16; // [xsp+0h] [xbp-70h] BYREF
void *__p[2]; // [xsp+20h] [xbp-50h] BYREF
__int64 v18; // [xsp+30h] [xbp-40h]
v5 = a3;
v6 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 344), a3);
if ( !v6 )
{
v6 = (cocos2d::CCObject *)sub_10024A15C(0);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 344), v6, v5);
}
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__p = *(_OWORD *)a2;
v18 = *(_QWORD *)(a2 + 16);
}
v7 = GameLevelManager::responseToDict((char *)__p, 1);
v8 = GJComment::create(v7);
if ( SHIBYTE(v18) < 0 )
operator delete(__p[0]);
m_accountID = v8->m_accountID;
v10 = GJAccountManager::sharedState();
if ( m_accountID == v10->m_accountID - v10->m_unkInt1 && v8->m_commentID != -1 && (unsigned int)sub_10024A36C(v6) )
{
v11 = 0;
while ( 1 )
{
v12 = sub_10024A388(v6, v11);
v13 = *(_DWORD *)(v12 + 388);
v14 = GJAccountManager::sharedState();
if ( v13 == v14->m_accountID - v14->m_unkInt1 && *(_DWORD *)(v12 + 368) == -1 )
break;
v11 = (unsigned int)(v11 + 1);
if ( (unsigned int)v11 >= (unsigned int)sub_10024A36C(v6) )
goto LABEL_15;
}
*(_DWORD *)(v12 + 368) = v8->m_commentID;
}
else
{
LABEL_15:
v8->m_unkMultiplayerBool = 1;
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 328), v8->m_accountID);
if ( v15 )
{
if ( SHIBYTE(v15[6].__vftable) < 0 )
sub_1000097D0(&v16, *(void **)&v15[5].m_unknown2, *(_QWORD *)&v15[5].m_uOrderOfArrival);
else
v16 = *(std::string *)&v15[5].m_unknown2;
std::string::operator=((std::string *)&v8->m_userName, &v16);
if ( SHIBYTE(v16.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v16.__r_.__value_.__l.__data_);
}
sub_10024A2D0(v6, v8);
}
}