//
// GameLevelManager::onUploadCommentCompleted from 0x14015e370 to 0x14015ecfa (2442 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140143437
// > ??> @ 0x1406caadc
//
// 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
//
// Hidden C++ exception states: #wind=11
void __fastcall GameLevelManager::onUploadCommentCompleted(GameLevelManager *a1, __int64 *a2, _QWORD *a3)
{
_BYTE *v5; // rsi
size_t v6; // rdi
size_t v7; // r8
void *v8; // rcx
size_t v9; // r8
void **v10; // rcx
unsigned __int64 v11; // r13
char *v12; // r15
unsigned __int64 v13; // r12
size_t v14; // r8
int v15; // r12d
char *v16; // rax
GJAccountManager *v17; // rax
int v18; // ebx
size_t v19; // r8
cocos2d::CCArray *v20; // rbx
void *v21; // rcx
cocos2d::CCString *v22; // rax
const char *CString; // rax
const void *v24; // rcx
unsigned __int64 v25; // r13
size_t v26; // r8
int v27; // r15d
CommentUploadDelegate *m_commentUploadDelegate; // rcx
const void *v29; // rcx
size_t v30; // r13
size_t v31; // r8
int v32; // r15d
CommentUploadDelegate *v33; // rcx
__int64 v34; // rax
cocos2d::CCString *v35; // rax
const char *v36; // rax
__int64 v37; // rax
FLAlertLayer *v38; // rbx
__int64 v39; // rcx
cocos2d::CCArray *v40; // r15
int v41; // r12d
cocos2d::CCString *v42; // rax
CommentUploadDelegate *v43; // rcx
const char *TimeString; // rax
cocos2d::CCString *v45; // r12
cocos2d::CCString *v46; // rax
const char *v47; // rbx
const char *v48; // rax
const char *v49; // rax
__int64 v50; // rax
FLAlertLayer *v51; // rbx
cocos2d::CCString *v52; // rax
const char *v53; // rdi
GameLevelManager *v54; // rcx
cocos2d::CCString *v55; // rax
const char *v56; // rax
size_t v57; // r8
const char *p_Buf2; // r15
GameLevelManager *v59; // rcx
void *v60; // rcx
cocos2d::CCString *v61; // rax
const char *v62; // rax
const char *v63; // rdi
GameLevelManager *v64; // rcx
void *v65; // rcx
CommentUploadDelegate *v66; // rcx
bool v67; // [rsp+51h] [rbp-58h]
int v68; // [rsp+58h] [rbp-51h]
void *v69; // [rsp+58h] [rbp-51h]
void *v70; // [rsp+58h] [rbp-51h]
void *v71; // [rsp+58h] [rbp-51h]
void *v72; // [rsp+58h] [rbp-51h]
void *v73; // [rsp+58h] [rbp-51h]
void *v75; // [rsp+60h] [rbp-49h]
void *Block[2]; // [rsp+80h] [rbp-29h] BYREF
unsigned __int64 v78; // [rsp+90h] [rbp-19h]
unsigned __int64 v79; // [rsp+98h] [rbp-11h]
__int128 Buf2; // [rsp+A0h] [rbp-9h] BYREF
__int64 v81; // [rsp+B0h] [rbp+7h]
unsigned __int64 v82; // [rsp+B8h] [rbp+Fh]
v5 = a3;
if ( a3[3] > 0xFu )
v5 = (_BYTE *)*a3;
*(_OWORD *)Block = 0;
v78 = 0;
v79 = 0;
v6 = -1;
v7 = -1;
do
++v7;
while ( v5[v7] );
sub_14003A930(Block, v5, v7);
cocos2d::CCDictionary::removeObjectForKey(a1->m_friendReqAndUserBlocks, Block);
if ( v79 > 0xF )
{
v8 = Block[0];
if ( v79 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
HIWORD(Buf2) = 0;
v81 = 11;
v82 = 15;
qmemcpy(&Buf2, "acc_commen", 10);
*(_DWORD *)((char *)&Buf2 + 10) = (unsigned __int8)aAccComment[10];
*(_OWORD *)Block = 0;
v78 = 0;
v79 = 0;
v9 = -1;
do
++v9;
while ( v5[v9] );
sub_14003A930(Block, v5, v9);
v10 = Block;
v11 = v79;
v67 = v79 > 0xF;
v12 = (char *)Block[0];
if ( v79 > 0xF )
v10 = (void **)Block[0];
v13 = v78;
v14 = v78;
if ( v78 > 0xB )
v14 = 11;
v68 = memcmp(v10, &Buf2, v14);
if ( !v68 )
{
if ( v13 < 0xB )
{
v15 = -1;
v68 = -1;
goto LABEL_21;
}
v68 = v13 > 0xB;
}
v15 = v68;
LABEL_21:
if ( v67 )
{
v16 = v12;
if ( v11 + 1 >= 0x1000 )
{
v12 = *((char **)v12 - 1);
if ( (unsigned __int64)(v16 - v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
if ( v15 )
{
Buf2 = 0;
v81 = 0;
v82 = 0;
v19 = -1;
do
++v19;
while ( v5[v19] );
sub_14003A930(&Buf2, v5, v19);
v20 = sub_140140F70((__int64 *)&Buf2, "_");
if ( v82 > 0xF )
{
v21 = (void *)Buf2;
if ( v82 + 1 >= 0x1000 )
{
v21 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v21 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v21);
}
v81 = 0;
v82 = 15;
LOBYTE(Buf2) = 0;
if ( cocos2d::CCArray::count(v20) < 2 )
{
v18 = 0;
}
else
{
v22 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v20, 1u);
CString = cocos2d::CCString::getCString(v22);
v18 = atoi(CString);
}
}
else
{
v17 = GJAccountManager::sharedState();
v18 = v17->m_accountID - v17->m_unkInt1;
}
*(_OWORD *)Block = 0;
v78 = 2;
v79 = 15;
strcpy((char *)Block, "-1");
v24 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v24 = (const void *)*a2;
v25 = a2[2];
v26 = v25;
if ( v25 > 2 )
v26 = 2;
v27 = memcmp(v24, Block, v26);
if ( !v27 )
{
if ( v25 >= 2 )
v27 = v25 > 2;
else
v27 = -1;
}
if ( !v27 )
{
m_commentUploadDelegate = a1->m_commentUploadDelegate;
if ( m_commentUploadDelegate )
m_commentUploadDelegate->commentUploadFailed(m_commentUploadDelegate, v18, (CommentError)0LL);
GameLevelManager::resetTimerForKey(a1, v5);
goto LABEL_111;
}
*(_OWORD *)Block = 0;
v78 = 3;
v79 = 15;
LODWORD(Block[0]) = 3158317;
v29 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v29 = (const void *)*a2;
v30 = a2[2];
v31 = v30;
if ( v30 > 3 )
v31 = 3;
v32 = memcmp(v29, Block, v31);
if ( !v32 )
{
if ( v30 >= 3 )
v32 = v30 > 3;
else
v32 = -1;
}
if ( !v32 )
{
v33 = a1->m_commentUploadDelegate;
if ( v33 )
v33->commentUploadFailed(v33, v18, Banned);
v34 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v75 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v75);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v34 = qword_1406C2ED8;
}
v35 = cocos2d::CCString::createWithFormat(
"You have been banned from making comments. \n"
"Please contact support with ID %i if you have any questions.",
*(_DWORD *)(v34 + 652) - *(_DWORD *)(v34 + 656));
v36 = cocos2d::CCString::getCString(v35);
*(_OWORD *)Block = 0;
v78 = 0;
v79 = 0;
do
++v6;
while ( v36[v6] );
sub_14003A930(Block, v36, v6);
v37 = sub_14003BDB0((__int64)&Buf2, (__int64)Block);
v38 = FLAlertLayer::create(0, (int)"Banned", v37, (__int64)"OK", 0, 1132068864, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v38->show(v38);
goto LABEL_111;
}
v39 = (__int64)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v39 = *a2;
if ( sub_14003BCE0(v39, v30, 0, "temp", 4u) != -1 )
{
v40 = sub_140140F70(a2, "_");
v41 = 0;
if ( cocos2d::CCArray::count(v40) >= 2 )
{
v42 = cocos2d::CCArray::stringAtIndex(v40, 1u);
v41 = cocos2d::CCString::intValue(v42);
}
v43 = a1->m_commentUploadDelegate;
if ( v43 )
v43->commentUploadFailed(v43, v18, Banned);
TimeString = (const char *)GameToolbox::getTimeString(&Buf2, v41, 0);
if ( *((_QWORD *)TimeString + 3) > 0xFu )
TimeString = *(const char **)TimeString;
v45 = cocos2d::CCString::createWithFormat(
"You have been banned from making comments for: %s",
TimeString);
sub_14003A830((__int64)&Buf2);
if ( cocos2d::CCArray::count(v40) >= 3 )
{
v46 = cocos2d::CCArray::stringAtIndex(v40, 2u);
v47 = cocos2d::CCString::getCString(v46);
v48 = cocos2d::CCString::getCString(v45);
v45 = cocos2d::CCString::createWithFormat("%s.\n\nReason: %s", v48, v47);
}
v49 = cocos2d::CCString::getCString(v45);
*(_OWORD *)Block = 0;
v78 = 0;
v79 = 0;
do
++v6;
while ( v49[v6] );
sub_14003A930(Block, v49, v6);
v50 = sub_14003BDB0((__int64)&Buf2, (__int64)Block);
v51 = FLAlertLayer::create(0, (int)"Banned", v50, (__int64)"OK", 0, 1136525312, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v51->show(v51);
GameLevelManager::resetTimerForKey(a1, v5);
goto LABEL_111;
}
if ( !v68 )
{
v52 = cocos2d::CCString::createWithFormat("a_%i_%i", v18, 0);
v53 = cocos2d::CCString::getCString(v52);
v54 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v69 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v54 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetTimerForKey(v54, v53);
goto LABEL_109;
}
if ( !qword_1406C2EC0 )
{
v70 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v70);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
v55 = cocos2d::CCString::createWithFormat("comment_%i_%i_%i_%i", v18, 0, 0, (v18 >> 31) & 2);
v56 = cocos2d::CCString::getCString(v55);
Buf2 = 0;
v81 = 0;
v82 = 0;
v57 = -1;
do
++v57;
while ( v56[v57] );
sub_14003A930(&Buf2, v56, v57);
p_Buf2 = (const char *)&Buf2;
if ( v82 > 0xF )
p_Buf2 = (const char *)Buf2;
v59 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v71 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v71);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v59 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetTimerForKey(v59, p_Buf2);
if ( v82 > 0xF )
{
v60 = (void *)Buf2;
if ( v82 + 1 >= 0x1000 )
{
v60 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v60 - 8) > 0x1F )
goto LABEL_107;
}
j_j_free(v60);
}
if ( !qword_1406C2EC0 )
{
v72 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v72);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
v61 = cocos2d::CCString::createWithFormat("comment_%i_%i_%i_%i", v18, 0, 1, (v18 >> 31) & 2);
v62 = cocos2d::CCString::getCString(v61);
Buf2 = 0;
v81 = 0;
v82 = 0;
do
++v6;
while ( v62[v6] );
sub_14003A930(&Buf2, v62, v6);
v63 = (const char *)&Buf2;
if ( v82 > 0xF )
v63 = (const char *)Buf2;
v64 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v73 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v73);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v64 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetTimerForKey(v64, v63);
if ( v82 <= 0xF )
goto LABEL_109;
v65 = (void *)Buf2;
if ( v82 + 1 >= 0x1000 )
{
v65 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v65 - 8) > 0x1F )
LABEL_107:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v65);
LABEL_109:
v66 = a1->m_commentUploadDelegate;
if ( v66 )
v66->commentUploadFinished(v66, v18);
LABEL_111:
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}