//
// GameLevelManager::onUploadCommentCompleted from 0x6f8f1c to 0x6f9828 (2316 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x732504
// > ??> @ 0x84438
//
// 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
//
__int64 __fastcall GameLevelManager::onUploadCommentCompleted(GameLevelManager *a1, const void **a2, char **a3)
{
char *v4; // x23
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x19
char *v7; // x0
_BOOL4 v8; // w27
unsigned __int64 v9; // x25
size_t v10; // x2
int v11; // w0
_DWORD *v12; // x3
__int64 v13; // x25
char *v14; // x0
char *v15; // x0
GJAccountManager *v16; // x0
char *v17; // x25
size_t v18; // x2
int v19; // w2
__int64 *v20; // x0
CommentUploadDelegate *m_commentUploadDelegate; // x0
unsigned int *v23; // x4
int v24; // w1
unsigned int *v25; // x3
int v26; // w1
size_t v27; // x2
int v28; // w2
char *v29; // x0
CommentUploadDelegate *v30; // x0
GameManager *v31; // x0
cocos2d::CCString *v32; // x0
char *v33; // x0
FLAlertLayer *v34; // x20
char *v35; // x0
unsigned int *v36; // x4
int v37; // w1
unsigned int *v38; // x1
int v39; // w2
unsigned int v40; // w27
cocos2d::CCArray *v41; // x26
cocos2d::CCString *v42; // x0
CommentUploadDelegate *v43; // x0
cocos2d::CCString *v44; // x25
char *v45; // x0
char *v46; // x0
FLAlertLayer *v47; // x20
char *v48; // x0
GameLevelManager *v49; // x24
char *v50; // x0
GameLevelManager *v51; // x24
char *v52; // x0
CommentUploadDelegate *v53; // x0
unsigned int *v54; // x4
int v55; // w1
unsigned int *v56; // x1
int v57; // w2
const char *CString; // x25
cocos2d::CCString *v59; // x0
const char *v60; // x0
GameLevelManager *v61; // x19
const char *AccountCommentKey; // x0
unsigned int *v63; // x1
int v64; // w2
unsigned int *v65; // x1
int v66; // w2
unsigned int *v67; // x1
int v68; // w2
unsigned int *v69; // x1
int v70; // w2
unsigned __int64 v71; // [xsp+60h] [xbp+60h]
unsigned __int64 v72; // [xsp+68h] [xbp+68h]
unsigned __int64 v73; // [xsp+68h] [xbp+68h]
unsigned __int64 v74; // [xsp+68h] [xbp+68h]
char *v75; // [xsp+70h] [xbp+70h]
unsigned __int64 v76; // [xsp+70h] [xbp+70h]
char *v77; // [xsp+70h] [xbp+70h]
int v78; // [xsp+70h] [xbp+70h]
int v79; // [xsp+70h] [xbp+70h]
char *v80; // [xsp+78h] [xbp+78h]
unsigned int v81; // [xsp+78h] [xbp+78h]
void *v82; // [xsp+98h] [xbp+98h] BYREF
char *v83; // [xsp+A0h] [xbp+A0h] BYREF
v4 = *a3;
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_D153B8((int)&v83, *a3);
cocos2d::CCDictionary::removeObjectForKey(m_friendReqAndUserBlocks, (const std::string *)&v83);
v7 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v83 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v82, v4);
sub_D153B8((int)&v83, "acc_comment");
v8 = 0;
v75 = (char *)v82;
v9 = *((_QWORD *)v82 - 3);
v80 = v83;
v72 = *((_QWORD *)v83 - 3);
if ( v72 > v9 )
v10 = *((_QWORD *)v82 - 3);
else
v10 = *((_QWORD *)v83 - 3);
v11 = memcmp(v82, v83, v10);
v12 = v75;
if ( v11 || (v13 = v9 - v72, v13 > 0x7FFFFFFF) || v13 < (__int64)0xFFFFFFFF80000000LL )
{
v14 = v80 - 24;
if ( v80 - 24 != (char *)&qword_124B6B0 )
goto LABEL_30;
LABEL_8:
v15 = v75 - 24;
if ( v75 - 24 == (char *)&qword_124B6B0 )
goto LABEL_9;
goto LABEL_36;
}
v14 = v80 - 24;
v8 = v13 == 0;
if ( v80 - 24 == (char *)&qword_124B6B0 )
goto LABEL_8;
LABEL_30:
if ( &pthread_create )
{
v23 = (unsigned int *)(v80 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v80 - 2);
*((_DWORD *)v80 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v14);
v12 = v82;
v15 = (char *)v82 - 24;
if ( (char *)v82 - 24 != (char *)&qword_124B6B0 )
{
LABEL_36:
if ( &pthread_create )
{
v25 = v12 - 2;
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(v12 - 2);
*(v12 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v15);
}
LABEL_9:
if ( v8 )
{
v16 = GJAccountManager::sharedState();
v81 = v16->m_accountID - v16->m_unkInt1;
}
else
{
v81 = GameLevelManager::levelIDFromPostCommentKey(a1, v4);
}
sub_D153B8((int)&v83, "-1");
v17 = v83;
v73 = *((_QWORD *)*a2 - 3);
v76 = *((_QWORD *)v83 - 3);
if ( v76 > v73 )
v18 = *((_QWORD *)*a2 - 3);
else
v18 = *((_QWORD *)v83 - 3);
v19 = memcmp(*a2, v83, v18);
if ( v19 || (v19 = 0x7FFFFFFF, (__int64)(v73 - v76) > 0x7FFFFFFF) )
{
v20 = (__int64 *)(v17 - 24);
if ( v17 - 24 == (char *)&qword_124B6B0 )
goto LABEL_17;
}
else
{
v20 = (__int64 *)(v17 - 24);
if ( (__int64)(v73 - v76) >= (__int64)0xFFFFFFFF80000000LL )
v19 = v73 - v76;
else
v19 = 0x80000000;
if ( v20 == &qword_124B6B0 )
goto LABEL_17;
}
if ( &pthread_create )
{
v36 = (unsigned int *)(v17 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v17 - 2);
*((_DWORD *)v17 - 2) = v37 - 1;
}
if ( v37 <= 0 )
{
v78 = v19;
operator delete(v20);
v19 = v78;
}
LABEL_17:
if ( !v19 )
{
m_commentUploadDelegate = a1->m_commentUploadDelegate;
if ( m_commentUploadDelegate )
((void (__fastcall *)(CommentUploadDelegate *, _QWORD))m_commentUploadDelegate->commentUploadFailed)(
m_commentUploadDelegate,
v81);
LABEL_20:
GameLevelManager::resetTimerForKey(a1, v4);
return _stack_chk_guard;
}
sub_D153B8((int)&v83, "-10");
v77 = v83;
v71 = *((_QWORD *)*a2 - 3);
v74 = *((_QWORD *)v83 - 3);
if ( v74 > v71 )
v27 = *((_QWORD *)*a2 - 3);
else
v27 = *((_QWORD *)v83 - 3);
v28 = memcmp(*a2, v83, v27);
if ( !v28 )
{
v28 = 0x7FFFFFFF;
if ( (__int64)(v71 - v74) <= 0x7FFFFFFF )
{
if ( (__int64)(v71 - v74) >= (__int64)0xFFFFFFFF80000000LL )
v28 = v71 - v74;
else
v28 = 0x80000000;
}
}
v29 = v77 - 24;
if ( v77 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v77 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *((_DWORD *)v77 - 2);
*((_DWORD *)v77 - 2) = v55 - 1;
}
if ( v55 <= 0 )
{
v79 = v28;
operator delete(v29);
v28 = v79;
}
}
if ( v28 )
{
if ( sub_D1641C((int)a2, "temp") != -1 )
{
v40 = 0;
v41 = sub_6F004C(a2, "_");
if ( (unsigned int)cocos2d::CCArray::count(v41) > 1 )
{
v42 = cocos2d::CCArray::stringAtIndex(v41, 1u);
v40 = cocos2d::CCString::intValue(v42);
}
v43 = a1->m_commentUploadDelegate;
if ( v43 )
v43->commentUploadFailed(v43, v81, Banned);
GameToolbox::getTimeString((GameToolbox *)v40, nullptr, (__int64)&v83);
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You have been banned from making comments for: %s",
v83);
v45 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v65 = (unsigned int *)(v83 - 8);
do
v66 = __ldaxr(v65);
while ( __stlxr(v66 - 1, v65) );
}
else
{
v66 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v66 - 1;
}
if ( v66 <= 0 )
operator delete(v45);
}
if ( (unsigned int)cocos2d::CCArray::count(v41) > 2 )
{
CString = cocos2d::CCString::getCString(v44);
v59 = cocos2d::CCArray::stringAtIndex(v41, 2u);
v60 = cocos2d::CCString::getCString(v59);
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s.\n\nReason: %s",
CString,
v60);
}
v46 = (char *)cocos2d::CCString::getCString(v44);
sub_D153B8((int)&v83, v46);
v47 = FLAlertLayer::create(0, (__int64)"Banned", (__int64)&v83);
v48 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v63 = (unsigned int *)(v83 - 8);
do
v64 = __ldaxr(v63);
while ( __stlxr(v64 - 1, v63) );
}
else
{
v64 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v64 - 1;
}
if ( v64 <= 0 )
operator delete(v48);
}
v47->show(v47);
goto LABEL_20;
}
if ( v8 )
{
v61 = GameLevelManager::sharedState();
AccountCommentKey = GameLevelManager::getAccountCommentKey(a1, v81, 0);
GameLevelManager::resetTimerForKey(v61, AccountCommentKey);
}
else
{
v49 = GameLevelManager::sharedState();
GameLevelManager::sharedState();
GameLevelManager::getCommentKey((const char *)v81, (__int64)&v83);
GameLevelManager::resetTimerForKey(v49, v83);
v50 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v67 = (unsigned int *)(v83 - 8);
do
v68 = __ldaxr(v67);
while ( __stlxr(v68 - 1, v67) );
}
else
{
v68 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v68 - 1;
}
if ( v68 <= 0 )
operator delete(v50);
}
v51 = GameLevelManager::sharedState();
GameLevelManager::sharedState();
GameLevelManager::getCommentKey((const char *)v81, (__int64)&v83);
GameLevelManager::resetTimerForKey(v51, v83);
v52 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(v83 - 8);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v52);
}
}
v53 = a1->m_commentUploadDelegate;
if ( v53 )
v53->commentUploadFinished(v53, v81);
}
else
{
v30 = a1->m_commentUploadDelegate;
if ( v30 )
v30->commentUploadFailed(v30, v81, Banned);
v31 = GameManager::sharedState();
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You have been banned from making comments. \n"
"Please contact support with ID %i if you have any questions.",
(const char *)(unsigned int)(v31->m_playerUserID.random - v31->m_playerUserID.seed));
v33 = (char *)cocos2d::CCString::getCString(v32);
sub_D153B8((int)&v83, v33);
v34 = FLAlertLayer::create(0, (__int64)"Banned", (__int64)&v83);
v35 = v83 - 24;
if ( v83 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v83 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v83 - 2);
*((_DWORD *)v83 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v35);
}
v34->show(v34);
}
return _stack_chk_guard;
}