//
// GameLevelManager::onGetGauntletsCompleted from 0x10052e6a0 to 0x10052e9c2 (802 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051e001
//
// 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:49 +0000
//
void __fastcall GameLevelManager::onGetGauntletsCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
__int64 v4; // r15
const void *v5; // r12
unsigned __int64 v6; // rcx
size_t v7; // rdx
__int64 v8; // rdi
size_t v9; // rax
size_t v10; // r13
char *v11; // r15
size_t v12; // rbx
__int64 v13; // r15
__int64 v14; // rdi
__int64 v15; // rax
const char *CString; // r13
const char *v17; // rdi
size_t v18; // rax
size_t v19; // r12
char *v20; // r15
char v21; // bl
size_t v22; // rbx
__int64 MapPacks; // r15
int v24; // r12d
unsigned int v25; // r12d
unsigned int i; // r12d
__int64 v27; // rax
void (__fastcall ***v28)(_QWORD, __int64, __int64); // rdi
_WORD v29[12]; // [rsp+8h] [rbp-78h] BYREF
__int128 v30; // [rsp+20h] [rbp-60h] BYREF
void *v31; // [rsp+30h] [rbp-50h]
__int64 v32; // [rsp+38h] [rbp-48h]
__int128 __s2; // [rsp+40h] [rbp-40h] BYREF
void *__p; // [rsp+50h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v4 = *(_QWORD *)(a3 + 16);
else
v4 = a3 + 1;
GameLevelManager::removeDLFromActive(a1, v4);
*(_WORD *)((char *)&__s2 + 1) = 12589;
BYTE3(__s2) = 0;
v5 = a2 + 1;
v6 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v5 = *((const void **)a2 + 2);
v6 = *((_QWORD *)a2 + 1);
}
v7 = 2;
if ( v6 < 2 )
v7 = v6;
if ( !((v6 != 2) | (memcmp(v5, (char *)&__s2 + 1, v7) != 0)) )
{
v8 = *(_QWORD *)(a1 + 1224);
if ( v8 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 8LL))(v8, v4);
return;
}
v9 = strlen((const char *)v5);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_49;
v10 = v9;
v32 = v4;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v11 = (char *)operator new(v12);
__p = v11;
*(_QWORD *)&__s2 = v12 + 1;
*((_QWORD *)&__s2 + 1) = v10;
goto LABEL_18;
}
LOBYTE(__s2) = 2 * v9;
v11 = (char *)&__s2 + 1;
if ( v9 )
LABEL_18:
memmove(v11, v5, v10);
v11[v10] = 0;
v13 = sub_10053FBE0(&__s2, "#");
if ( (__s2 & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_1007FEF90(v13) <= 1 )
{
v14 = *(_QWORD *)(a1 + 1224);
if ( v14 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 8LL))(v14, v32);
return;
}
v15 = sub_1007FEFE0(v13, 0);
CString = (const char *)cocos2d::CCString::getCString(v15);
v17 = CString;
v18 = strlen(CString);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_49:
sub_100003630();
v19 = v18;
v20 = (char *)&__s2 + 1;
if ( v18 >= 0x17 )
{
v22 = 26;
if ( (v18 | 7) != 0x17 )
v22 = (v18 | 7) + 1;
v20 = (char *)operator new(v22);
__p = v20;
*(_QWORD *)&__s2 = v22 + 1;
*((_QWORD *)&__s2 + 1) = v19;
LABEL_32:
v17 = v20;
memmove(v20, CString, v19);
v20[v19] = 0;
v21 = __s2;
if ( (__s2 & 1) == 0 )
goto LABEL_28;
LABEL_33:
v17 = (const char *)&v30;
sub_10001AD30(&v30, __p, *((unsigned __int64 *)&__s2 + 1));
goto LABEL_34;
}
LOBYTE(__s2) = 2 * v18;
if ( v18 )
goto LABEL_32;
BYTE1(__s2) = 0;
v21 = __s2;
if ( (__s2 & 1) != 0 )
goto LABEL_33;
LABEL_28:
v31 = __p;
v30 = __s2;
LABEL_34:
MapPacks = GameLevelManager::createAndGetMapPacks(v17, &v30);
if ( (v30 & 1) != 0 )
operator delete(v31);
v24 = sub_1007FEF90(MapPacks);
if ( v24 > 0 )
{
v25 = v24 + 1;
do
{
if ( *(int *)(sub_1007FEFE0(MapPacks, v25 - 2) + 328) >= 63 )
sub_1007FF150(MapPacks, v25 - 2, 1);
--v25;
}
while ( v25 > 1 );
}
for ( i = 0; i < (unsigned int)sub_1007FEF90(MapPacks); ++i )
{
v27 = sub_1007FEFE0(MapPacks, i);
*(_BYTE *)(v27 + 404) = 1;
sub_10055DA70(a1, v27);
}
v29[0] = 0;
GameLevelManager::storeSearchResult(a1, MapPacks, v29, v32);
v28 = *(void (__fastcall ****)(_QWORD, __int64, __int64))(a1 + 1224);
if ( v28 )
(**v28)(v28, MapPacks, v32);
if ( (v21 & 1) != 0 )
operator delete(__p);
}