//
// GameLevelManager::onGetMapPacksCompleted from 0x100523f40 to 0x100524900 (2496 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051ecbd
//
// 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:45 +0000
//
__int64 __fastcall GameLevelManager::onGetMapPacksCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
__int64 v3; // r15
const void *v4; // rbx
unsigned __int64 v5; // rcx
size_t v6; // rdx
__int64 v7; // rdx
__int64 v8; // rdi
size_t v10; // rax
size_t v11; // r14
char *v12; // r15
size_t v13; // r12
__int64 v14; // rbx
__int64 v15; // rdi
__int64 v16; // rax
const char *CString; // r14
size_t v18; // rax
size_t v19; // r15
char *v20; // r12
size_t v21; // r13
__int64 v22; // rax
const char *v23; // r14
size_t v24; // rax
size_t v25; // r15
char *v26; // r12
size_t v27; // r13
__int64 v28; // rax
const char *v29; // rbx
const char *v30; // rdi
size_t v31; // rax
size_t v32; // r14
char *v33; // r15
size_t v34; // r12
unsigned int i; // r15d
__int64 v36; // rax
const char *v37; // r12
size_t v38; // rax
size_t v39; // r13
char *v40; // rbx
__int64 v41; // r14
std::string::value_type *v42; // rax
__int64 v43; // rax
size_t v44; // r14
char *v45; // rcx
size_t v46; // rax
__int64 v47; // rax
const std::string::value_type *v48; // rax
__int64 v49; // rax
const std::string::value_type *v50; // rax
__int64 v51; // rax
const std::string::value_type *v52; // rax
unsigned int v53; // eax
size_t v54; // rax
size_t v55; // rbx
char *v56; // r14
char *v57; // r15
size_t v58; // r12
void *v59; // r15
char v60; // r12
char *v61; // rdi
size_t v62; // rax
size_t v63; // rdx
bool v64; // zf
char v65; // r14
int v66; // eax
__int64 v67; // rbx
unsigned int v68; // r14d
__int64 v69; // rax
__int64 v70; // r14
char v71; // r15
__int64 v72; // rdi
__int64 v73; // rbx
void (__fastcall ***v74)(_QWORD, __int64, __int64); // rdi
void *v75; // rdi
char v76; // [rsp+0h] [rbp-180h]
char v77; // [rsp+0h] [rbp-180h]
char v78; // [rsp+0h] [rbp-180h]
__int64 v79; // [rsp+8h] [rbp-178h] BYREF
size_t v80; // [rsp+10h] [rbp-170h]
void *v81; // [rsp+18h] [rbp-168h]
__int128 v82; // [rsp+20h] [rbp-160h] BYREF
void *v83; // [rsp+30h] [rbp-150h]
__int128 v84; // [rsp+40h] [rbp-140h] BYREF
void *v85; // [rsp+50h] [rbp-130h]
__int128 v86; // [rsp+60h] [rbp-120h] BYREF
void *v87; // [rsp+70h] [rbp-110h]
char *__s; // [rsp+78h] [rbp-108h]
__int64 __s1; // [rsp+80h] [rbp-100h] BYREF
size_t __n; // [rsp+88h] [rbp-F8h]
char *v91; // [rsp+90h] [rbp-F0h]
std::string v92; // [rsp+98h] [rbp-E8h] BYREF
__int128 __dst; // [rsp+B0h] [rbp-D0h] BYREF
void *v94; // [rsp+C0h] [rbp-C0h]
void *v95; // [rsp+C8h] [rbp-B8h]
__int128 v96; // [rsp+D0h] [rbp-B0h] BYREF
void *v97; // [rsp+E0h] [rbp-A0h]
__int64 v98; // [rsp+E8h] [rbp-98h]
__int64 v99; // [rsp+F0h] [rbp-90h]
__int64 MapPacks; // [rsp+F8h] [rbp-88h]
__int64 __s2; // [rsp+100h] [rbp-80h] BYREF
size_t v102; // [rsp+108h] [rbp-78h]
void *__p; // [rsp+110h] [rbp-70h]
_BYTE v104[32]; // [rsp+130h] [rbp-50h] BYREF
v98 = a1;
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(_QWORD *)(a3 + 16);
else
v3 = a3 + 1;
GameLevelManager::removeDLFromActive(v98, v3);
LOBYTE(__s2) = 4;
*(_WORD *)((char *)&__s2 + 1) = 12589;
BYTE3(__s2) = 0;
v4 = a2 + 1;
v5 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v4 = *((const void **)a2 + 2);
v5 = *((_QWORD *)a2 + 1);
}
v6 = 2;
if ( v5 < 2 )
v6 = v5;
if ( !((v5 != 2) | (memcmp(v4, (char *)&__s2 + 1, v6) != 0)) )
{
v8 = *(_QWORD *)(v98 + 1224);
if ( !v8 )
return __stack_chk_guard;
return (*(__int64 (__fastcall **)(__int64, __int64, __int64, _QWORD))(*(_QWORD *)v8 + 8LL))(
v8,
v3,
v7,
__stack_chk_guard);
}
v10 = strlen((const char *)v4);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
v99 = v3;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
__p = v12;
__s2 = v13 + 1;
v102 = v11;
goto LABEL_18;
}
LOBYTE(__s2) = 2 * v10;
v12 = (char *)&__s2 + 1;
if ( v10 )
LABEL_18:
memmove(v12, v4, v11);
v12[v11] = 0;
v14 = sub_10053FBE0(&__s2, "#");
if ( (__s2 & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_1007FEF90(v14) <= 2 )
{
v15 = *(_QWORD *)(v98 + 1224);
if ( v15 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v15 + 8LL))(v15, v99);
return __stack_chk_guard;
}
v16 = sub_1007FEFE0(v14, 0);
CString = (const char *)cocos2d::CCString::getCString(v16);
v18 = strlen(CString);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
v94 = v20;
*(_QWORD *)&__dst = v21 | 1;
*((_QWORD *)&__dst + 1) = v19;
goto LABEL_31;
}
LOBYTE(__dst) = 2 * v18;
v20 = (char *)&__dst + 1;
if ( v18 )
LABEL_31:
memmove(v20, CString, v19);
v20[v19] = 0;
v22 = sub_1007FEFE0(v14, 1);
v23 = (const char *)cocos2d::CCString::getCString(v22);
v24 = strlen(v23);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v25 = v24;
if ( v24 >= 0x17 )
{
v27 = 26;
if ( (v24 | 7) != 0x17 )
v27 = (v24 | 7) + 1;
v26 = (char *)operator new(v27);
v97 = v26;
*(_QWORD *)&v96 = v27 | 1;
*((_QWORD *)&v96 + 1) = v25;
goto LABEL_39;
}
LOBYTE(v96) = 2 * v24;
v26 = (char *)&v96 + 1;
if ( v24 )
LABEL_39:
memmove(v26, v23, v25);
v26[v25] = 0;
v28 = cocos2d::CCArray::stringAtIndex(v14, 2);
v29 = (const char *)cocos2d::CCString::getCString(v28);
v30 = v29;
v31 = strlen(v29);
if ( v31 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v32 = v31;
if ( v31 >= 0x17 )
{
v34 = 26;
if ( (v31 | 7) != 0x17 )
v34 = (v31 | 7) + 1;
v33 = (char *)operator new(v34);
v91 = v33;
__s1 = v34 | 1;
__n = v32;
LABEL_48:
v30 = v33;
memmove(v33, v29, v32);
v33[v32] = 0;
if ( (__dst & 1) == 0 )
goto LABEL_44;
LABEL_49:
v30 = (const char *)&v82;
sub_10001AD30(&v82, v94, *((unsigned __int64 *)&__dst + 1));
goto LABEL_50;
}
LOBYTE(__s1) = 2 * v31;
v33 = (char *)&__s1 + 1;
if ( v31 )
goto LABEL_48;
BYTE1(__s1) = 0;
if ( (__dst & 1) != 0 )
goto LABEL_49;
LABEL_44:
v83 = v94;
v82 = __dst;
LABEL_50:
MapPacks = GameLevelManager::createAndGetMapPacks(v30, &v82);
if ( (v82 & 1) != 0 )
operator delete(v83);
*(_WORD *)&v92.__r_.__value_.__l.0 = 0;
__s = v92.__r_.__value_.__s.__data_;
for ( i = 0; i < (unsigned int)sub_1007FEF90(MapPacks); ++i )
{
v95 = (void *)sub_1007FEFE0(MapPacks, i);
v36 = sub_10088E820("%i", v76);
v37 = (const char *)cocos2d::CCString::getCString(v36);
v38 = strlen(v37);
if ( v38 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v39 = v38;
if ( v38 >= 0x17 )
{
v43 = v38 | 7;
v44 = 26;
if ( (v39 | 7) != 0x17 )
v44 = v43 + 1;
v40 = (char *)operator new(v44);
__p = v40;
__s2 = v44 | 1;
v102 = v39;
}
else
{
LOBYTE(__s2) = 2 * v38;
v40 = (char *)&__s2 + 1;
if ( !v38 )
{
BYTE1(__s2) = 0;
v41 = (unsigned __int8)__s2;
if ( (__s2 & 1) == 0 )
goto LABEL_59;
goto LABEL_65;
}
}
memmove(v40, v37, v39);
v40[v39] = 0;
v41 = (unsigned __int8)__s2;
if ( (__s2 & 1) == 0 )
{
LABEL_59:
v42 = (char *)&__s2 + 1;
if ( v41 )
goto LABEL_67;
goto LABEL_71;
}
LABEL_65:
if ( v102 )
{
v42 = (std::string::value_type *)__p;
LABEL_67:
std::string::push_back(&v92, *v42);
if ( (v41 & 1) != 0 )
{
v45 = (char *)__p;
v46 = v102;
}
else
{
v46 = (unsigned int)v41 >> 1;
v45 = (char *)&__s2 + 1;
}
std::string::push_back(&v92, v45[v46 - 1]);
}
LABEL_71:
v47 = sub_10088E820("%i", v77);
v48 = (const std::string::value_type *)cocos2d::CCString::getCString(v47);
std::string::append(&v92, v48);
v49 = sub_10088E820("%i", v78);
v50 = (const std::string::value_type *)cocos2d::CCString::getCString(v49);
std::string::append(&v92, v50);
if ( (v41 & 1) != 0 )
operator delete(__p);
}
v51 = sub_10088E820("%c%s%s%c%c%s", (char)"Qg");
v52 = (const std::string::value_type *)cocos2d::CCString::getCString(v51);
std::string::append(&v92, v52);
if ( (*(_BYTE *)&v92.__r_.__value_.__s.0 & 1) != 0 )
__s = v92.__r_.__value_.__l.__data_;
v53 = strlen(__s);
sub_100872DB0(__s, v53, v104);
sub_100873590(v104, &__s2);
v54 = strlen((const char *)&__s2);
if ( v54 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v55 = v54;
v56 = (char *)&v79 + 1;
if ( v54 >= 0x17 )
{
v58 = 26;
if ( (v54 | 7) != 0x17 )
v58 = (v54 | 7) + 1;
v57 = (char *)operator new(v58);
v81 = v57;
v79 = v58 | 1;
v80 = v55;
goto LABEL_82;
}
LOBYTE(v79) = 2 * v54;
v57 = (char *)&v79 + 1;
if ( v54 )
LABEL_82:
memcpy(v57, &__s2, v55);
v57[v55] = 0;
v59 = v81;
v60 = __s1;
v61 = v91;
v95 = v91;
if ( (__s1 & 1) != 0 )
{
v62 = __n;
}
else
{
v62 = (unsigned __int8)__s1 >> 1;
v61 = (char *)&__s1 + 1;
}
v63 = (unsigned __int8)v79 >> 1;
if ( (v79 & 1) != 0 )
{
v63 = v80;
v56 = (char *)v81;
}
v64 = v63 == v62;
if ( v63 >= v62 )
v63 = v62;
v65 = v64 & (memcmp(v61, v56, v63) == 0);
if ( (v79 & 1) != 0 )
operator delete(v59);
if ( v65 )
{
v66 = sub_1007FEF90(MapPacks);
v67 = v98;
if ( v66 )
{
v68 = 0;
do
{
v69 = sub_1007FEFE0(MapPacks, v68);
sub_100544490(v67, v69);
++v68;
}
while ( v68 < (unsigned int)sub_1007FEF90(MapPacks) );
}
v70 = *(_QWORD *)(v67 + 1224);
v71 = v96;
if ( v70 )
{
if ( (v96 & 1) != 0 )
{
sub_10001AD30(&v84, v97, *((unsigned __int64 *)&v96 + 1));
}
else
{
v85 = v97;
v84 = v96;
}
(*(void (__fastcall **)(__int64, __int128 *, __int64))(*(_QWORD *)v70 + 32LL))(v70, &v84, v99);
if ( (v84 & 1) != 0 )
operator delete(v85);
}
if ( (v71 & 1) != 0 )
{
sub_10001AD30(&v86, v97, *((unsigned __int64 *)&v96 + 1));
}
else
{
v87 = v97;
v86 = v96;
}
v73 = v98;
GameLevelManager::storeSearchResult(v98, MapPacks, &v86, v99);
if ( (v86 & 1) != 0 )
operator delete(v87);
v74 = *(void (__fastcall ****)(_QWORD, __int64, __int64))(v73 + 1224);
if ( v74 )
(**v74)(v74, MapPacks, v99);
}
else
{
v72 = *(_QWORD *)(v98 + 1224);
if ( v72 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v72 + 8LL))(v72, v99);
}
if ( (*(_BYTE *)&v92.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v92.__r_.__value_.__l.__data_);
v75 = v95;
if ( (v60 & 1) != 0 )
goto LABEL_118;
LABEL_113:
if ( (v96 & 1) == 0 )
goto LABEL_114;
LABEL_119:
operator delete(v97);
if ( (__dst & 1) != 0 )
LABEL_115:
operator delete(v94);
}
else
{
v75 = v95;
if ( (v60 & 1) == 0 )
goto LABEL_113;
LABEL_118:
operator delete(v75);
if ( (v96 & 1) != 0 )
goto LABEL_119;
LABEL_114:
if ( (__dst & 1) != 0 )
goto LABEL_115;
}
return __stack_chk_guard;
}