//
// GJMultiplayerManager::addComment from 0x140283d10 to 0x140283ecd (445 bytes)
//
// 3 xrefs:
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x14028350b
// > GJMultiplayerManager::createAndAddComment @ 0x140283c79
// > ??> @ 0x1406d14d8
//
// 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
//
// Hidden C++ exception states: #wind=2
void __fastcall GJMultiplayerManager::addComment(__int64 a1, __int64 a2, int a3)
{
unsigned int v5; // ebx
__int64 v6; // rsi
__int64 v7; // rcx
cocos2d::CCArray *v8; // rdi
_QWORD *v9; // rax
cocos2d::CCDictionary *v10; // rax
GJComment *v11; // rbp
GJAccountManager *v12; // rax
struct cocos2d::CCObject *v13; // rsi
GJAccountManager *v14; // rax
struct cocos2d::CCObject *v15; // rax
void **v16; // rdx
void *Src[4]; // [rsp+28h] [rbp-80h] BYREF
_BYTE v18[32]; // [rsp+48h] [rbp-60h] BYREF
__int64 v19; // [rsp+68h] [rbp-40h]
v19 = a2;
v5 = 0;
v6 = a3;
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 344), a3);
if ( !v8 )
{
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 344), v8, v6);
}
v9 = (_QWORD *)sub_14003BDB0((__int64)v18, a2);
v10 = (cocos2d::CCDictionary *)GameLevelManager::responseToDict(v9, 1);
v11 = GJComment::create(v10);
v12 = GJAccountManager::sharedState();
if ( v11->m_accountID == v12->m_accountID - v12->m_unkInt1 && v11->m_commentID != -1 && cocos2d::CCArray::count(v8) )
{
while ( 1 )
{
v13 = cocos2d::CCArray::objectAtIndex(v8, v5);
v14 = GJAccountManager::sharedState();
if ( v13[7].m_nLuaID == v14->m_accountID - v14->m_unkInt1 && v13[6].m_uOrderOfArrival == -1 )
break;
if ( ++v5 >= cocos2d::CCArray::count(v8) )
goto LABEL_9;
}
v13[6].m_uOrderOfArrival = v11->m_commentID;
}
else
{
LABEL_9:
v11->m_unkMultiplayerBool = 1;
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 328), v11->m_accountID);
if ( v15 )
{
sub_14003BDB0((__int64)Src, (__int64)&v15[5].m_unknown2);
if ( &v11->m_userName != (std::string *)Src )
{
v16 = Src;
if ( Src[3] > (void *)0xF )
v16 = (void **)Src[0];
sub_14003CCE0((void **)&v11->m_userName, v16, (size_t)Src[2]);
}
sub_14003A830((__int64)Src);
}
cocos2d::CCArray::addObject(v8, v11);
}
sub_14003A830(a2);
}