//
// GameLevelManager::onGetAccountCommentsCompleted from 0x3cd82c to 0x3cd9ac (384 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x3d718a
//
// 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
//
int __fastcall GameLevelManager::onGetAccountCommentsCompleted(GameLevelManager *a1, char **a2, const char **a3)
{
char *v4; // r5
_BOOL4 v6; // r10
cocos2d::CCArray *v7; // r8
int result; // r0
cocos2d::CCString *v9; // r0
char *CString; // r0
cocos2d::CCString *v11; // r0
char *v12; // r0
LevelCommentDelegate *m_levelCommentDelegate; // r11
cocos2d::CCArray *AccountComments; // r10
LevelCommentDelegate *v15; // r0
char *v16; // [sp+4h] [bp-18h]
void (__fastcall *setupPageInfo)(LevelCommentDelegate *__hidden, std::string, const unsigned __int8 *); // [sp+8h] [bp-14h]
char v18[4]; // [sp+10h] [bp-Ch] BYREF
char v19[4]; // [sp+14h] [bp-8h] BYREF
char v20[4]; // [sp+18h] [bp-4h] BYREF
char v21[4]; // [sp+1Ch] [bp+0h] BYREF
char *v22; // [sp+20h] [bp+4h] BYREF
v4 = (char *)*a3;
v16 = (char *)GameLevelManager::levelIDFromCommentKey(a1, *a3);
GameLevelManager::removeDLFromActive(a1, v4);
sub_776584((int)&v22, "-1");
v6 = sub_3BE0D8((int)a2, (int)&v22);
sub_774008(&v22);
if ( v6
|| (sub_776584((int)&v22, *a2),
v7 = sub_3BE530((cocos2d::CCArray *)&v22, "#"),
sub_774008(&v22),
cocos2d::CCArray::count(v7) <= 1u) )
{
result = (int)a1->m_levelCommentDelegate;
if ( result )
return (*(int (__fastcall **)(int, char *))(*(_DWORD *)result + 4))(result, v4);
}
else
{
v9 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, 0);
CString = (char *)cocos2d::CCString::getCString(v9);
sub_776584((int)v18, CString);
v11 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, 1u);
v12 = (char *)cocos2d::CCString::getCString(v11);
sub_776584((int)v19, v12);
m_levelCommentDelegate = a1->m_levelCommentDelegate;
if ( m_levelCommentDelegate )
{
setupPageInfo = m_levelCommentDelegate->setupPageInfo;
sub_775C20(v20);
((void (__fastcall *)(LevelCommentDelegate *, char *, char *))setupPageInfo)(m_levelCommentDelegate, v20, v4);
sub_774008(v20);
}
sub_775C20(v21);
AccountComments = GameLevelManager::createAndGetAccountComments((char *)a1, v21, v16);
sub_774008(v21);
sub_775C20(&v22);
GameLevelManager::storeCommentsResult(a1, AccountComments, &v22, v4);
sub_774008(&v22);
v15 = a1->m_levelCommentDelegate;
if ( v15 )
v15->loadCommentsFinished(v15, AccountComments, (const unsigned __int8 *)v4);
sub_774008(v19);
return sub_774008(v18);
}
return result;
}