//
// GJMultiplayerManager::addComment from 0x1403919d0 to 0x140391b8d (445 bytes)
//
// 3 xrefs:
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x14039116e
// > GJMultiplayerManager::createAndAddComment @ 0x140391924
// > ??> @ 0x140922ff4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:11 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall GJMultiplayerManager::addComment(__int64 a1, __int64 a2, int a3)
{
unsigned int v5; // ebx
__int64 v6; // rdi
__int64 v7; // rcx
struct cocos2d::CCObject *v8; // rsi
_QWORD *v9; // rax
__int64 v10; // rax
char *v11; // rbp
__int64 v12; // rax
struct cocos2d::CCObject *v13; // rdi
__int64 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::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 344), a3);
if ( !v8 )
{
v8 = (struct cocos2d::CCObject *)cocos2d::CCArray::create(v7);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 344), v8, v6);
}
v9 = (_QWORD *)sub_14003F4F0((__int64)v18, a2);
v10 = GameLevelManager::responseToDict(v9, 1);
v11 = GJComment::create(v10);
v12 = GJAccountManager::sharedState();
if ( *((_DWORD *)v11 + 101) == *(_DWORD *)(v12 + 360) - *(_DWORD *)(v12 + 364)
&& *((_DWORD *)v11 + 96) != -1
&& cocos2d::CCArray::count(v8) )
{
while ( 1 )
{
v13 = cocos2d::CCArray::objectAtIndex(v8, v5);
v14 = GJAccountManager::sharedState();
if ( *((_DWORD *)v13 + 101) == *(_DWORD *)(v14 + 360) - *(_DWORD *)(v14 + 364) && *((_DWORD *)v13 + 96) == -1 )
break;
if ( ++v5 >= cocos2d::CCArray::count(v8) )
goto LABEL_9;
}
*((_DWORD *)v13 + 96) = *((_DWORD *)v11 + 96);
}
else
{
LABEL_9:
v11[457] = 1;
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 328), *((int *)v11 + 101));
if ( v15 )
{
sub_14003F4F0((__int64)Src, (__int64)v15 + 320);
if ( v11 + 352 != (char *)Src )
{
v16 = Src;
if ( Src[3] > (void *)0xF )
v16 = (void **)Src[0];
sub_1400405A0((void **)v11 + 44, v16, (size_t)Src[2]);
}
sub_14003D310((__int64)Src);
}
cocos2d::CCArray::addObject(v8, (struct cocos2d::CCObject *)v11);
}
sub_14003D310(a2);
}