//
// GameLevelManager::onUpdateThreadCompleted from 0x10053a950 to 0x10053ae8b (1339 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d875
//
// 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:54 +0000
//
char __fastcall GameLevelManager::onUpdateThreadCompleted(__int64 a1, unsigned __int8 *a2, const std::string *a3)
{
const std::string *v3; // r12
const char *data; // r14
__int64 v5; // rbx
size_t v6; // rax
std::string::size_type v7; // r15
char *v8; // r13
__int64 v9; // r12
size_t v10; // rbx
const std::string *v11; // r13
std::string::size_type v12; // r14
std::string::size_type v13; // r15
unsigned int v14; // r13d
std::string::size_type size; // r13
std::string::pointer v16; // rsi
std::string::size_type v17; // rcx
std::string::size_type v18; // r14
std::string::size_type v19; // r13
std::string::value_type *v20; // r14
unsigned int v21; // eax
std::string::size_type v22; // rax
std::string::pointer v23; // r12
size_t v24; // rbx
std::string::value_type *v25; // rax
std::string::pointer v26; // rbx
std::string::size_type v27; // r15
std::string::size_type v28; // rbx
char *v29; // r14
size_t v30; // r13
std::string::pointer v31; // rbx
char v32; // r13
unsigned __int64 v33; // rax
_BYTE *v34; // r14
const void *v35; // r15
size_t v36; // rdx
char result; // al
unsigned int v38; // r14d
__int64 v39; // rbx
_DWORD *v40; // rdi
__int64 v41; // rdi
__int64 v42; // r15
int v43; // ebx
__int64 v44; // rax
__int64 v45; // rax
int v46; // ecx
bool v47; // cc
int v48; // ecx
char v49; // bl
__int64 v50; // rdi
_DWORD *v51; // rax
unsigned __int64 v52; // [rsp+8h] [rbp-88h]
std::string v53; // [rsp+10h] [rbp-80h] BYREF
unsigned __int8 *v54; // [rsp+30h] [rbp-60h]
__int64 v55; // [rsp+38h] [rbp-58h]
const std::string *v56; // [rsp+40h] [rbp-50h]
std::string __dst; // [rsp+48h] [rbp-48h] BYREF
unsigned int v58; // [rsp+64h] [rbp-2Ch]
v3 = a3;
v54 = a2;
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
data = a3->__r_.__value_.__l.__data_;
else
data = a3->__r_.__value_.__s.__data_;
v55 = a1;
v5 = *(_QWORD *)(a1 + 1088);
v6 = strlen(data);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_85;
v7 = v6;
if ( v6 >= 0x17 )
{
v56 = v3;
v9 = v5;
v10 = 26;
if ( (v6 | 7) != 0x17 )
v10 = (v6 | 7) + 1;
v8 = (char *)operator new(v10);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v8;
__dst.__r_.__value_.__r.__words[0] = v10 + 1;
v5 = v9;
v3 = v56;
__dst.__r_.__value_.__l.__size_ = v7;
goto LABEL_11;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v6);
v8 = __dst.__r_.__value_.__s.__data_;
if ( v6 )
LABEL_11:
memmove(v8, data, v7);
v8[v7] = 0;
cocos2d::CCDictionary::removeObjectForKey(v5, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v11 = nullptr;
v12 = std::string::find(v3, 95, 0);
v13 = std::string::rfind(v3, 95, 0xFFFFFFFFFFFFFFFFLL);
v58 = 0;
if ( v12 != -1 && v13 != -1 && v13 > v12 )
{
v14 = (unsigned int)v3->__r_.__value_.__l.0;
if ( (v14 & 1) != 0 )
{
size = v3->__r_.__value_.__l.__size_;
if ( size <= v12 )
goto LABEL_86;
v16 = v3->__r_.__value_.__l.__data_;
}
else
{
size = v14 >> 1;
if ( v12 >= size )
goto LABEL_86;
v16 = v3->__r_.__value_.__s.__data_;
}
v17 = v12 + 1;
v18 = v13 + ~v12;
v19 = size - v17;
if ( v19 >= v18 )
v19 = v18;
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_85;
if ( v19 >= 0x17 )
{
v56 = (const std::string *)v17;
v24 = 26;
if ( (v19 | 7) != 0x17 )
v24 = (v19 | 7) + 1;
v25 = (std::string::value_type *)operator new(v24);
v17 = (std::string::size_type)v56;
v20 = v25;
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v25;
__dst.__r_.__value_.__r.__words[0] = v24 + 1;
__dst.__r_.__value_.__l.__size_ = v19;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v19);
v20 = __dst.__r_.__value_.__s.__data_;
if ( !v19 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_26;
goto LABEL_33;
}
}
memmove(v20, &v16[v17], v19);
v20[v19] = 0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_26:
v58 = atoi(__dst.__r_.__value_.__s.__data_);
v21 = (unsigned int)v3->__r_.__value_.__l.0;
if ( (v21 & 1) != 0 )
goto LABEL_27;
goto LABEL_34;
}
LABEL_33:
v26 = __dst.__r_.__value_.__l.__data_;
v58 = atoi(__dst.__r_.__value_.__l.__data_);
operator delete(v26);
v21 = (unsigned int)v3->__r_.__value_.__l.0;
if ( (v21 & 1) != 0 )
{
LABEL_27:
v22 = v3->__r_.__value_.__l.__size_;
if ( v22 > v13 )
{
v23 = v3->__r_.__value_.__l.__data_;
goto LABEL_36;
}
goto LABEL_86;
}
LABEL_34:
v22 = v21 >> 1;
if ( v13 < v22 )
{
v23 = v3->__r_.__value_.__s.__data_;
LABEL_36:
v27 = v13 + 1;
v28 = v22 - v27;
if ( v22 - v27 < 0xFFFFFFFFFFFFFFF8LL )
{
if ( v28 >= 0x17 )
{
v30 = 26;
if ( (v28 | 7) != 0x17 )
v30 = (v28 | 7) + 1;
v29 = (char *)operator new(v30);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v29;
__dst.__r_.__value_.__r.__words[0] = v30 + 1;
__dst.__r_.__value_.__l.__size_ = v28;
}
else
{
v29 = __dst.__r_.__value_.__s.__data_;
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v28);
if ( v22 == v27 )
{
*((_BYTE *)&__dst.__r_.__value_.__l.0 + v28 + 1) = 0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_40:
v11 = (const std::string *)(unsigned int)atoi(__dst.__r_.__value_.__s.__data_);
goto LABEL_46;
}
goto LABEL_45;
}
}
memmove(v29, &v23[v27], v28);
v29[v28] = 0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_40;
LABEL_45:
v31 = __dst.__r_.__value_.__l.__data_;
v11 = (const std::string *)(unsigned int)atoi(__dst.__r_.__value_.__l.__data_);
operator delete(v31);
goto LABEL_46;
}
LABEL_85:
sub_100003630();
}
LABEL_86:
sub_100056810();
}
LABEL_46:
v56 = v11;
strcpy(__dst.__r_.__value_.__s.__data_, "-1");
v32 = *v54;
v33 = *v54 >> 1;
v34 = *((_BYTE **)v54 + 2);
v35 = v34;
if ( (*v54 & 1) == 0 )
v35 = v54 + 1;
v52 = *((_QWORD *)v54 + 1);
if ( (v32 & 1) != 0 )
v33 = *((_QWORD *)v54 + 1);
v36 = 2;
if ( v33 < 2 )
v36 = v33;
result = (v33 != 2) | (memcmp(v35, (char *)&__dst.__r_.__value_.__l.0 + 1, v36) != 0);
if ( result )
{
if ( (_DWORD)v56 == 4 )
{
v42 = v55;
sub_100578860(v55, v58, v54);
}
else
{
if ( (_DWORD)v56 == 3 )
{
v43 = atoi((const char *)v35);
v44 = GJAccountManager::sharedState((__int64)v35, (__int64)__dst.__r_.__value_.__r.__words + 1);
v42 = v55;
v45 = cocos2d::CCDictionary::objectForKey_1(
*(_QWORD *)(v55 + 1120),
*(int *)(v44 + 352) - (__int64)*(int *)(v44 + 356));
if ( v45 && v43 > 0 )
{
v46 = *(_DWORD *)(v45 + 692);
v47 = v46 <= v43;
v48 = v46 - v43;
if ( v47 )
v48 = 0;
*(_DWORD *)(v45 + 692) = v48;
}
goto LABEL_81;
}
v42 = v55;
if ( (_DWORD)v56 == 2 )
{
if ( (v32 & 1) != 0 )
{
if ( v52 != 1 || *v34 != 49 )
{
sub_10001AD30(&v53, v34, v52);
goto LABEL_75;
}
}
else if ( v32 != 2 || v54[1] != 49 )
{
v53 = *(std::string *)v54;
LABEL_75:
LevelTools::base64DecodeString(&__dst, &v53);
v49 = 0;
goto LABEL_76;
}
*(_WORD *)&__dst.__r_.__value_.__l.0 = 0;
v49 = 1;
LABEL_76:
if ( (*(_BYTE *)(v42 + 544) & 1) != 0 )
operator delete(*(void **)(v42 + 560));
*(std::string *)(v42 + 544) = __dst;
*(_WORD *)&__dst.__r_.__value_.__l.0 = 0;
if ( !v49 && (*(_BYTE *)&v53.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v53.__r_.__value_.__l.__data_);
}
}
LABEL_81:
v50 = *(_QWORD *)(v42 + 1264);
if ( v50 )
return (*(__int64 (__fastcall **)(__int64, _QWORD, const std::string *))(*(_QWORD *)v50 + 64LL))(v50, v58, v56);
v51 = cocos2d::CCNotificationCenter::sharedNotificationCenter();
return cocos2d::CCNotificationCenter::postNotification((__int64)v51, "ThreadsChangedNotification", 0);
}
v38 = (unsigned int)v56;
v39 = v55;
if ( (_DWORD)v56 == 4 )
{
v40 = *(_DWORD **)(v55 + 680);
if ( v40 )
{
result = cocos2d::CCObject::release(v40);
*(_QWORD *)(v55 + 680) = 0;
}
}
v41 = *(_QWORD *)(v39 + 1264);
if ( v41 )
return (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v41 + 72LL))(v41, v58, v38);
return result;
}