//
// GJMultiplayerManager::addComment from 0x10073a550 to 0x10073a733 (483 bytes)
//
// 2 xrefs:
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x1007394cd
// > GJMultiplayerManager::createAndAddComment @ 0x10073b4ea
//
// 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 12:36:26 +0000
//
__int64 __fastcall GJMultiplayerManager::addComment(__int64 a1, __int128 *a2, int a3)
{
__int64 v4; // rdi
__int64 v5; // r12
__int64 v6; // rbx
void *v7; // rdi
__int64 v8; // r15
int v9; // r12d
__int64 v10; // rax
unsigned int v11; // r12d
__int64 v12; // r13
int v13; // r14d
__int64 v14; // rax
__int64 result; // rax
__int64 v16; // rax
__int64 v17; // [rsp+8h] [rbp-68h]
__int128 v18; // [rsp+10h] [rbp-60h] BYREF
void *__p; // [rsp+20h] [rbp-50h]
std::string __str; // [rsp+30h] [rbp-40h] BYREF
v4 = *(_QWORD *)(a1 + 344);
v5 = a3;
v6 = cocos2d::CCDictionary::objectForKey_1(v4, a3);
if ( v6 )
{
if ( (*(_BYTE *)a2 & 1) == 0 )
{
LABEL_3:
__p = *((void **)a2 + 2);
v18 = *a2;
goto LABEL_6;
}
}
else
{
v6 = sub_1007FE900(v4);
cocos2d::CCDictionary::setObject_1(*(_QWORD *)(a1 + 344), v6, v5);
if ( (*(_BYTE *)a2 & 1) == 0 )
goto LABEL_3;
}
sub_10001AD30(&v18, *((const void **)a2 + 2), *((_QWORD *)a2 + 1));
LABEL_6:
v17 = a1;
v7 = GameLevelManager::responseToDict((__int64)&v18, 1);
v8 = GJComment::create((__int64)v7);
if ( (v18 & 1) != 0 )
{
v7 = __p;
operator delete(__p);
}
v9 = *(_DWORD *)(v8 + 388);
v10 = GJAccountManager::sharedState((__int64)v7, 1);
if ( v9 == *(_DWORD *)(v10 + 352) - *(_DWORD *)(v10 + 356)
&& *(_DWORD *)(v8 + 368) != -1
&& (unsigned int)sub_1007FEF90(v6) )
{
v11 = 0;
while ( 1 )
{
v12 = sub_1007FEFE0(v6, v11);
v13 = *(_DWORD *)(v12 + 388);
v14 = GJAccountManager::sharedState(v6, v11);
if ( v13 == *(_DWORD *)(v14 + 352) - *(_DWORD *)(v14 + 356) && *(_DWORD *)(v12 + 368) == -1 )
break;
if ( ++v11 >= (unsigned int)sub_1007FEF90(v6) )
goto LABEL_16;
}
result = *(unsigned int *)(v8 + 368);
*(_DWORD *)(v12 + 368) = result;
}
else
{
LABEL_16:
*(_BYTE *)(v8 + 433) = 1;
v16 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(v17 + 328), *(int *)(v8 + 388));
if ( v16 )
{
if ( (*(_BYTE *)(v16 + 320) & 1) != 0 )
sub_10001AD30(&__str, *(const void **)(v16 + 336), *(_QWORD *)(v16 + 328));
else
__str = *(std::string *)(v16 + 320);
std::string::operator=((std::string *)(v8 + 344), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}
return sub_1007FEBF0(v6, v8);
}
return result;
}