//
// GameLevelManager::onDownloadUserMessageCompleted from 0x14015acc0 to 0x14015ae32 (370 bytes)
//
// 3 xrefs:
// > GameLevelManager::handleIt @ 0x140143971
// > ??> @ 0x1406caa04
// > ??> @ 0x1406caa10
//
// 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=2
void __fastcall GameLevelManager::onDownloadUserMessageCompleted(GameLevelManager *a1, const void **a2, const char *a3)
{
const char *v6; // rbp
unsigned int SplitIntFromKey; // r15d
const void *v8; // rcx
unsigned __int64 v9; // rbp
size_t v10; // r8
_BYTE *v11; // rdx
size_t v12; // r8
cocos2d::CCDictionary *v13; // rax
GJUserMessage *v14; // rax
GJUserMessage *v15; // rbp
DownloadMessageDelegate *m_downloadMessageDelegate; // rcx
DownloadMessageDelegate *v17; // rcx
__int128 Buf2; // [rsp+38h] [rbp-50h] BYREF
__int64 v19; // [rsp+48h] [rbp-40h]
__int64 v20; // [rsp+50h] [rbp-38h]
v6 = a3;
if ( *((_QWORD *)a3 + 3) > 0xFu )
v6 = *(const char **)a3;
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(a1, v6, 1);
GameLevelManager::removeDLFromActive(a1, v6);
Buf2 = 0;
v19 = 2;
v20 = 15;
strcpy((char *)&Buf2, "-1");
v8 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v8 = *a2;
v9 = (unsigned __int64)a2[2];
v10 = v9;
if ( v9 > 2 )
v10 = 2;
if ( !memcmp(v8, &Buf2, v10) && v9 == 2 )
goto LABEL_14;
v11 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v11 = *a2;
Buf2 = 0;
v19 = 0;
v20 = 0;
v12 = -1;
do
++v12;
while ( v11[v12] );
sub_14003A930(&Buf2, v11, v12);
v13 = (cocos2d::CCDictionary *)GameLevelManager::responseToDict(&Buf2, 0);
v14 = GJUserMessage::create(v13);
v15 = v14;
if ( !v14 )
{
LABEL_14:
m_downloadMessageDelegate = a1->m_downloadMessageDelegate;
if ( m_downloadMessageDelegate )
m_downloadMessageDelegate->downloadMessageFailed(m_downloadMessageDelegate, SplitIntFromKey);
}
else
{
cocos2d::CCDictionary::setObject(a1->m_userMessages, v14, v14->m_messageID);
v17 = a1->m_downloadMessageDelegate;
if ( v17 )
v17->downloadMessageFinished(v17, v15);
}
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}