//
// GameLevelManager::onGetLevelControlsCompleted from 0x4c6438 to 0x4c667e (582 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x4daaca
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:31 +0000
//
int __fastcall GameLevelManager::onGetLevelControlsCompleted(
GameLevelManager *a1,
unsigned __int8 *a2,
unsigned __int8 *a3)
{
const char *v5; // r0
const char *v6; // r6
int v7; // r3
int v8; // r3
void (__fastcall ***v9)(_DWORD, const char *, int); // r0
_BOOL4 v10; // r8
void (__fastcall ***v11)(_DWORD, const char *, int); // r0
int v12; // r3
int v13; // r3
unsigned __int8 *v14; // r5
unsigned __int8 *v15; // r8
size_t v16; // r5
const char *v17; // r0
int v18; // r11
int v19; // r4
size_t v20; // r2
int v21; // r4
_DWORD **v22; // r0
int v24; // r1
int v25; // r3
int v26; // r5
int v27; // r3
char *v28; // r0
unsigned __int8 *v29; // r1
char *v30; // r0
unsigned __int8 *v31; // r2
int v32; // t1
unsigned __int8 *v33; // [sp+0h] [bp-64h]
int v34; // [sp+4h] [bp-60h]
char v35; // [sp+8h] [bp-5Ch]
char v36; // [sp+Ch] [bp-58h]
unsigned __int8 *v37; // [sp+18h] [bp-4Ch] BYREF
int v38; // [sp+20h] [bp-44h] BYREF
int v39; // [sp+24h] [bp-40h]
int v40; // [sp+28h] [bp-3Ch]
int v41[3]; // [sp+2Ch] [bp-38h] BYREF
char *v42[3]; // [sp+38h] [bp-2Ch] BYREF
int v43[3]; // [sp+44h] [bp-20h] BYREF
int v44; // [sp+50h] [bp-14h] BYREF
size_t v45; // [sp+54h] [bp-10h]
char *v46; // [sp+58h] [bp-Ch]
v38 = 0;
v39 = 0;
v40 = 0;
sub_4C62E0(a3, "_", &v38);
if ( (unsigned int)(-1431655765 * ((v39 - v38) >> 2)) <= 1 )
{
v6 = nullptr;
}
else
{
if ( (byte_9[v38 + 3] & 1) != 0 )
v5 = *(const char **)(v38 + 20);
else
v5 = (const char *)(v38 + 13);
v6 = (const char *)atoi(v5);
}
v7 = *a2;
if ( (v7 & 1) != 0 )
v8 = *((_DWORD *)a2 + 1);
else
v8 = v7 >> 1;
if ( v8 )
{
memset(v41, 0, sizeof(v41));
std::string::__init(v41, "-1", 2u);
v10 = sub_4A9CC4(a2, (unsigned __int8 *)v41);
std::string::~string((int)v41);
if ( !v10 )
{
GameLevelManager::levelControlInstances((GameLevelManager *)v42, a1, v6);
if ( v42[0] == v42[1] )
{
v11 = *((void (__fastcall ****)(_DWORD, const char *, int))a1 + 130);
if ( v11 )
(**v11)(v11, v6, 3);
LABEL_43:
std::__vector_base::~__vector_base(v42);
return std::__vector_base::~__vector_base((int)&v38);
}
v12 = *a2;
if ( (v12 & 1) != 0 )
{
v13 = *((_DWORD *)a2 + 1);
v14 = *((unsigned __int8 **)a2 + 2);
}
else
{
v13 = v12 >> 1;
v14 = a2 + 1;
}
if ( !v13
|| (v15 = &v14[v13],
v35 = 0,
v36 = 0,
std::__search(
&v37,
v14,
&v14[v13],
";",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v37 == v15)
|| (v16 = v37 - v14, v16 == -1) )
{
std::string::basic_string(v43, (int)a2);
v16 = -1;
}
else
{
v33 = a2;
std::string::basic_string(v43, a2, 0, v16);
}
if ( (v43[0] & 1) != 0 )
v17 = (const char *)v43[2];
else
v17 = (char *)v43 + 1;
v18 = atoi(v17);
std::string::~string((int)v43);
if ( v16 == -1 )
{
v44 = 0;
v45 = 0;
v46 = nullptr;
std::string::__init(&v44, &unk_B6B226, 0);
}
else
{
v33 = a2;
std::string::basic_string(&v44, a2, v16 + 1, 0xFFFFFFFF);
}
v19 = v44 & 1;
if ( v19 )
{
v20 = v45;
if ( !v45 )
{
LABEL_38:
v21 = 2;
LABEL_40:
GameLevelManager::setLevelControlsTemplate(a1, v6, (unsigned __int8 *)&v44, v18);
v22 = *((_DWORD ***)a1 + 130);
if ( v22 )
((void (__fastcall *)(_DWORD **, const char *, int, _DWORD, unsigned __int8 *, int, char, char))**v22)(
v22,
v6,
v21,
**v22,
v33,
v34,
v35,
v36);
std::string::~string((int)&v44);
goto LABEL_43;
}
}
else
{
v20 = (int)(unsigned __int8)v44 >> 1;
if ( !v20 )
goto LABEL_38;
}
v24 = *(_DWORD *)v42[0];
v25 = *(unsigned __int8 *)(*(_DWORD *)v42[0] + 1328);
v26 = v25 & 1;
if ( (v25 & 1) != 0 )
v27 = *(_DWORD *)(v24 + 1332);
else
v27 = v25 >> 1;
if ( v20 == v27 )
{
if ( v19 )
v28 = v46;
else
v28 = (char *)&v44 + 1;
if ( v26 )
v29 = *(unsigned __int8 **)(v24 + 1336);
else
v29 = (unsigned __int8 *)(v24 + 1329);
if ( v19 )
{
v21 = std::char_traits::compare(v28, v29, v20) == 0;
}
else
{
v30 = v28 - 1;
v31 = &v29[v20];
while ( v29 != v31 )
{
v32 = (unsigned __int8)*++v30;
if ( v32 != *v29 )
goto LABEL_61;
++v29;
}
v21 = 1;
}
}
else
{
LABEL_61:
v21 = 0;
}
goto LABEL_40;
}
}
v9 = *((void (__fastcall ****)(_DWORD, const char *, int))a1 + 130);
if ( v9 )
(**v9)(v9, v6, 3);
return std::__vector_base::~__vector_base((int)&v38);
}