//
// GameLevelManager::setLevelControlsTemplate from 0x81c998 to 0x81cadc (324 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetLevelControlsCompleted @ 0x834010
// > GameLevelManager::onDeleteLevelControlsCompleted @ 0x83443c
// > GameLevelManager::onUploadLevelControlsCompleted @ 0x83473c
// > ??> @ 0x8f7e8
//
// This function is hookable on this platform (idp: arm, 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:54:59 +0000
//
__int64 __fastcall GameLevelManager::setLevelControlsTemplate(GameLevelManager *a1, const char *a2, __int64 a3, int a4)
{
GJGameLevel **v6; // x20
GJGameLevel **v7; // x23
GJGameLevel *v8; // x21
__int64 *v9; // x0
__int64 v10; // x1
int v11; // w0
void *v13; // [xsp+40h] [xbp+40h] BYREF
void *v14; // [xsp+48h] [xbp+48h]
GameLevelManager::levelControlInstances(a1, a2, &v13);
v6 = (GJGameLevel **)v13;
v7 = (GJGameLevel **)v14;
if ( v13 != v14 )
{
do
{
v8 = *v6;
v9 = (__int64 *)((char *)*v6 + 1784);
if ( v9 != (__int64 *)a3 )
{
if ( (*(_BYTE *)a3 & 1) != 0 )
std::string::assign(v9, *(const void **)(a3 + 16), *(_QWORD *)(a3 + 8));
else
std::string::assign(v9, (const void *)(a3 + 1), *(_BYTE *)a3 >> 1);
}
if ( (a4 & 0x80000000) == 0 )
{
v10 = *(_BYTE *)a3 >> 1;
if ( (*(_BYTE *)a3 & 1) != 0 )
v10 = *(_QWORD *)(a3 + 8);
if ( v10 )
v11 = a4;
else
v11 = 0;
*((_DWORD *)v8 + 452) = v11;
}
GJGameLevel::syncUneditedControls(v8);
++v6;
}
while ( v7 != v6 );
v7 = (GJGameLevel **)v13;
}
if ( v7 )
{
if ( v7 != v14 )
v14 = (char *)v14 + 8 * ~((unsigned __int64)((char *)v14 - 8 - (char *)v7) >> 3);
operator delete(v7);
}
return _stack_chk_guard;
}