//
// GJMultiplayerManager::addComment from 0xac57b4 to 0xac5a10 (604 bytes)
//
// 3 xrefs:
// > GJMultiplayerManager::createAndAddComment @ 0xac5ad0
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0xac6084
// > ??> @ 0xe8d80
//
// This function is hookable on this platform (idp: arm, 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 13:01:07 +0000
//
__int64 __fastcall GJMultiplayerManager::addComment(__int64 a1, char *a2, int a3)
{
__int64 v3; // x21
cocos2d::CCObject *v6; // x20
char v7; // w0
GJAccountManager *v8; // x0
size_t v9; // x1
GJComment *v10; // x0
cocos2d::CCDictionary *v11; // x1
__int64 v12; // x22
int v13; // w19
__int64 v14; // x0
__int64 v15; // x0
size_t v16; // x1
__int64 *v17; // x0
int v19; // w19
GJAccountManager *v20; // x0
__int64 v21; // x0
unsigned int v22; // w19
GJAccountManager *v23; // x0
int v24; // w26
GJAccountManager *v25; // x21
__int64 v26; // x0
GJAccountManager *v27; // [xsp+50h] [xbp+50h] BYREF
size_t v28; // [xsp+58h] [xbp+58h]
void *v29; // [xsp+60h] [xbp+60h]
v3 = a3;
v6 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 344), a3);
if ( !v6 )
{
v6 = (cocos2d::CCObject *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 344), v6, v3);
}
v7 = *a2;
v27 = nullptr;
v28 = 0;
v29 = nullptr;
if ( (v7 & 1) != 0 )
{
std::string::__init((__int64 *)&v27, *((void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
v8 = *(GJAccountManager **)a2;
v9 = *((_QWORD *)a2 + 1);
v29 = *((void **)a2 + 2);
v27 = v8;
v28 = v9;
}
v10 = (GJComment *)GameLevelManager::responseToDict((__int64)&v27, 1u);
v12 = GJComment::create(v10, v11);
if ( ((unsigned __int8)v27 & 1) != 0 )
{
operator delete(v29);
v19 = *(_DWORD *)(v12 + 388);
v21 = GJAccountManager::sharedState(v20);
if ( v19 != *(_DWORD *)(v21 + 352) - *(_DWORD *)(v21 + 356) )
goto LABEL_7;
}
else
{
v13 = *(_DWORD *)(v12 + 388);
v14 = GJAccountManager::sharedState((GJAccountManager *)(unsigned __int8)v27);
if ( v13 != *(_DWORD *)(v14 + 352) - *(_DWORD *)(v14 + 356) )
goto LABEL_7;
}
v22 = 0;
if ( *(_DWORD *)(v12 + 368) != -1 )
{
while ( v22 < (unsigned int)cocos2d::CCArray::count(v6) )
{
v23 = (GJAccountManager *)cocos2d::CCArray::objectAtIndex(v6, v22);
v24 = *((_DWORD *)v23 + 97);
v25 = v23;
v26 = GJAccountManager::sharedState(v23);
if ( v24 == *(_DWORD *)(v26 + 352) - *(_DWORD *)(v26 + 356) && *((_DWORD *)v25 + 92) == -1 )
{
*((_DWORD *)v25 + 92) = *(_DWORD *)(v12 + 368);
return _stack_chk_guard;
}
++v22;
}
}
LABEL_7:
*(_BYTE *)(v12 + 433) = 1;
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 328), *(int *)(v12 + 388));
if ( v15 )
{
v27 = nullptr;
v28 = 0;
v29 = nullptr;
if ( (*(_BYTE *)(v15 + 320) & 1) != 0 )
{
std::string::__init((__int64 *)&v27, *(void **)(v15 + 336), *(_QWORD *)(v15 + 328));
}
else
{
v16 = *(_QWORD *)(v15 + 328);
v27 = *(GJAccountManager **)(v15 + 320);
v28 = v16;
v29 = *(void **)(v15 + 336);
}
v17 = (__int64 *)(v12 + 344);
if ( (GJAccountManager **)(v12 + 344) != &v27 )
{
if ( ((unsigned __int8)v27 & 1) != 0 )
std::string::assign(v17, v29, v28);
else
std::string::assign(v17, (char *)&v27 + 1, (unsigned __int8)v27 >> 1);
}
if ( ((unsigned __int8)v27 & 1) != 0 )
operator delete(v29);
}
cocos2d::CCArray::addObject(v6, (cocos2d::CCObject *)v12);
return _stack_chk_guard;
}