//
// UILayer::togglePlatformerMode from 0x1004c2a70 to 0x1004c2b66 (246 bytes)
//
// 4 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10007b514
// > LevelEditorLayer::onPlaytest @ 0x1000c5a63
// > UILayer::init @ 0x1004c26b1
// > UILayer::updateDualMode @ 0x1004c2bce
//
// 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:06 +0000
//
__int64 __fastcall UILayer::togglePlatformerMode(__int64 a1, int a2)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 result; // rax
unsigned int v7; // r14d
__int64 v8; // rax
*(_BYTE *)(a1 + 596) = a2;
if ( a2 )
UILayer::resolveLevelControls(a1);
if ( *(_BYTE *)(a1 + 626) == 1 && *(_BYTE *)(a1 + 627) != 1
|| *(_BYTE *)(a1 + 596) != 1
|| (v2 = *(_QWORD *)(a1 + 640)) == 0
|| !*(_QWORD *)(v2 + 96) && !*(_QWORD *)(v2 + 136) )
{
v4 = GJKeybindManager::sharedState();
GJKeybindManager::clearMovementOverride(v4);
if ( *(_BYTE *)(a1 + 596) != 1 )
goto LABEL_13;
goto LABEL_12;
}
v3 = GJKeybindManager::sharedState();
GJKeybindManager::applyMovementOverride(v3, *(_QWORD *)(a1 + 640) + 72LL, *(_QWORD *)(a1 + 640) + 112LL);
if ( *(_BYTE *)(a1 + 596) == 1 )
{
LABEL_12:
v5 = GameManager::sharedState();
GameManager::getGameVariable(v5, "0024");
}
LABEL_13:
result = sub_1007FEF90(*(_QWORD *)(a1 + 616));
if ( (_DWORD)result )
{
v7 = 0;
do
{
v8 = sub_1007FEFE0(*(_QWORD *)(a1 + 616), v7);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v8 + 344LL))(v8, 0);
++v7;
result = sub_1007FEF90(*(_QWORD *)(a1 + 616));
}
while ( v7 < (unsigned int)result );
}
return result;
}