//
// GameLevelManager::onUploadUserMessageCompleted from 0x14015b290 to 0x14015b4ac (540 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x1401439ac
// > ??> @ 0x1406caa28
//
// 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=4
void __fastcall GameLevelManager::onUploadUserMessageCompleted(GameLevelManager *a1, const void **a2, _QWORD *a3)
{
_BYTE *v6; // rbx
size_t v7; // r8
GameLevelManager *v8; // rcx
void *v9; // rcx
unsigned int SplitIntFromKey; // r13d
const void *v11; // rcx
unsigned __int64 v12; // r12
size_t v13; // r8
int v14; // ebp
UploadMessageDelegate *v15; // rcx
cocos2d::CCString *v16; // rax
const char *CString; // rbx
GameLevelManager *v18; // rcx
UploadMessageDelegate *m_uploadMessageDelegate; // rcx
void *v20; // [rsp+28h] [rbp-80h]
void *Block[2]; // [rsp+40h] [rbp-68h] BYREF
__int64 v22; // [rsp+50h] [rbp-58h]
unsigned __int64 v23; // [rsp+58h] [rbp-50h]
v6 = a3;
if ( a3[3] > 0xFu )
v6 = (_BYTE *)*a3;
*(_OWORD *)Block = 0;
v22 = 0;
v23 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003A930(Block, v6, v7);
cocos2d::CCDictionary::removeObjectForKey(a1->m_friendReqAndUserBlocks, Block);
if ( v23 > 0xF )
{
v9 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v8, v6, 1);
*(_OWORD *)Block = 0;
v22 = 2;
v23 = 15;
strcpy((char *)Block, "-1");
v11 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v11 = *a2;
v12 = (unsigned __int64)a2[2];
v13 = v12;
if ( v12 > 2 )
v13 = 2;
v14 = memcmp(v11, Block, v13);
if ( !v14 )
{
if ( v12 >= 2 )
v14 = v12 > 2;
else
v14 = -1;
}
if ( v14 )
{
v16 = cocos2d::CCString::createWithFormat("messages_%i_%i", 1, 0);
CString = cocos2d::CCString::getCString(v16);
v18 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v20 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v18 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetTimerForKey(v18, CString);
m_uploadMessageDelegate = a1->m_uploadMessageDelegate;
if ( m_uploadMessageDelegate )
m_uploadMessageDelegate->uploadMessageFinished(m_uploadMessageDelegate, SplitIntFromKey);
}
else
{
v15 = a1->m_uploadMessageDelegate;
if ( v15 )
v15->uploadMessageFailed(v15, SplitIntFromKey);
GameLevelManager::resetTimerForKey(a1, v6);
}
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}