//
// GameLevelManager::onSendThreadMessageCompleted from 0x100538370 to 0x1005386a5 (821 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x100520bf8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:31:53 +0000
//
int __fastcall GameLevelManager::onSendThreadMessageCompleted(__int64 a1, const std::string *a2, __int64 a3)
{
const char *v3; // r15
__int64 v4; // r12
size_t v5; // rax
size_t v6; // r13
char *v7; // rbx
size_t v8; // r12
std::string::size_type v9; // r13
std::string::pointer data; // r15
unsigned __int64 size; // rcx
char *v12; // r12
size_t v13; // rdx
size_t v14; // rax
size_t v15; // r14
__int64 v16; // rbx
int result; // eax
__int64 v18; // rdi
size_t v19; // rbx
__int64 v20; // r12
__int64 v21; // r15
__int64 v22; // rax
unsigned int v23; // r14d
__int64 v24; // rax
const char *CString; // rax
unsigned int v26; // ecx
int v27; // r13d
int v28; // eax
__int64 v29; // rax
__int64 v30; // rax
__int64 v31; // rdi
unsigned int v32; // eax
bool v33; // cl
__int64 v34; // rax
_DWORD *v35; // rax
__int64 v36; // [rsp+0h] [rbp-50h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v38; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(const char **)(a3 + 16);
else
v3 = (const char *)(a3 + 1);
v4 = *(_QWORD *)(a1 + 1088);
v5 = strlen(v3);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_49;
v6 = v5;
if ( v5 >= 0x17 )
{
v36 = *(_QWORD *)(a1 + 1088);
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v4 = v36;
v38 = v6;
goto LABEL_11;
}
v7 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v5;
if ( v5 )
LABEL_11:
memmove(v7, v3, v6);
v7[v6] = 0;
cocos2d::CCDictionary::removeObjectForKey(v4, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v9 = std::string::find(a2, 58, 0);
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
data = a2->__r_.__value_.__s.__data_;
size = *(_BYTE *)&a2->__r_.__value_.__l.0 >> 1;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
v12 = (char *)&__dst + 1;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
size = a2->__r_.__value_.__l.__size_;
v13 = 2;
if ( size < 2 )
v13 = size;
if ( ((size == 2) & (memcmp(data, (char *)&__dst + 1, v13) == 0)) != 0 || v9 == -1 )
{
result = a1;
v18 = *(_QWORD *)(a1 + 1264);
if ( v18 )
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 56LL))(v18);
return result;
}
v14 = strlen(data);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_49:
sub_100003630();
v15 = v14;
if ( v14 >= 0x17 )
{
v19 = 26;
if ( (v14 | 7) != 0x17 )
v19 = (v14 | 7) + 1;
v12 = (char *)operator new(v19);
__p = v12;
__dst = v19 + 1;
v38 = v15;
v16 = a1;
}
else
{
LOBYTE(__dst) = 2 * v14;
v16 = a1;
if ( !v14 )
goto LABEL_32;
}
memmove(v12, data, v15);
LABEL_32:
v12[v15] = 0;
v20 = sub_10053FBE0(&__dst, ":");
if ( (__dst & 1) != 0 )
operator delete(__p);
v21 = 0;
v22 = cocos2d::CCArray::stringAtIndex(v20, 0);
v23 = cocos2d::CCString::intValue(v22);
if ( (unsigned int)sub_1007FEF90(v20) >= 2 )
{
v24 = cocos2d::CCArray::stringAtIndex(v20, 1);
CString = (const char *)cocos2d::CCString::getCString(v24);
v21 = atoll(CString);
}
if ( *(_BYTE *)(v16 + 448) || !*(_BYTE *)(v16 + 449) )
{
v32 = sub_1007FEF90(v20);
v33 = 0;
if ( v32 >= 3 )
{
v34 = cocos2d::CCArray::stringAtIndex(v20, 2);
v33 = (unsigned int)cocos2d::CCString::intValue(v34) != 0;
}
*(_BYTE *)(v16 + 450) = v33;
*(_DWORD *)(v16 + 440) = 0;
*(_DWORD *)(v16 + 444) = 0;
v31 = *(_QWORD *)(v16 + 1264);
if ( v31 )
return (*(__int64 (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v31 + 48LL))(v31, v23, v21);
}
else
{
v26 = sub_1007FEF90(v20);
v27 = 0;
v28 = 0;
if ( v26 >= 3 )
{
v29 = cocos2d::CCArray::stringAtIndex(v20, 2);
v28 = cocos2d::CCString::intValue(v29);
}
*(_DWORD *)(v16 + 440) = v28;
if ( (unsigned int)sub_1007FEF90(v20) >= 4 )
{
v30 = cocos2d::CCArray::stringAtIndex(v20, 3);
v27 = cocos2d::CCString::intValue(v30);
}
*(_DWORD *)(v16 + 444) = v27;
v31 = *(_QWORD *)(v16 + 1264);
if ( v31 )
return (*(__int64 (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v31 + 48LL))(v31, v23, v21);
}
v35 = cocos2d::CCNotificationCenter::sharedNotificationCenter();
return cocos2d::CCNotificationCenter::postNotification((__int64)v35, "ThreadsChangedNotification", 0);
}