//
// LevelInfoLayer::downloadLevel from 0x10002a6a4 to 0x10002a788 (228 bytes)
//
// 4 xrefs:
// > LevelInfoLayer::init @ 0x100028580
// > LevelInfoLayer::onPlay @ 0x100029da4
// > sub_10002A588 @ 0x10002a5d8
// > LevelInfoLayer::onUpdate @ 0x10002b9c8
//
// 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 10:57:28 +0000
//
__int64 __fastcall LevelInfoLayer::downloadLevel(__int64 a1)
{
__int64 v2; // x0
__int64 GameVariable; // x0
__int64 v4; // x0
__int64 v5; // x20
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x0
__int64 v11; // x8
__int64 v12; // x0
__int64 result; // x0
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 496) + 344LL))(*(_QWORD *)(a1 + 496), 0);
v2 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 648) + 344LL))(*(_QWORD *)(a1 + 648), 1);
GameVariable = GameLevelManager::sharedState(v2);
if ( *(_DWORD *)(GameVariable + 1480) != 99 )
{
GameVariable = GameLevelManager::sharedState(GameVariable);
if ( *(_DWORD *)(GameVariable + 1480) != 100 )
{
v4 = GameManager::sharedState(GameVariable);
GameVariable = GameManager::getGameVariable(v4, "0084");
v5 = *(_QWORD *)(a1 + 504);
if ( (_DWORD)GameVariable )
{
if ( !*(_DWORD *)(v5 + 632) )
{
v6 = GameLevelManager::sharedState(GameVariable);
GameVariable = sub_1000AB988(v6);
*(_DWORD *)(v5 + 632) = GameVariable;
}
}
else
{
v7 = GameLevelManager::sharedState(GameVariable);
GameVariable = sub_1000AB94C(v7);
*(_DWORD *)(v5 + 632) = GameVariable + 1;
}
}
}
v8 = GameLevelManager::sharedState(GameVariable);
v9 = GameLevelManager::saveLevel(v8, *(_QWORD *)(a1 + 504));
v10 = GameLevelManager::sharedState(v9);
v11 = *(_QWORD *)(a1 + 504);
v12 = GameLevelManager::downloadLevel(
v10,
(unsigned int)(*(_DWORD *)(v11 + 328) - *(_DWORD *)(v11 + 332)),
*(unsigned __int8 *)(v11 + 649),
(unsigned int)(*(_DWORD *)(v11 + 920) - *(_DWORD *)(v11 + 924)));
result = GameLevelManager::sharedState(v12);
*(_QWORD *)(result + 1232) = a1 + 408;
return result;
}