//
// GJBaseGameLayer::toggleDualMode from 0x1001017a0 to 0x100101b17 (887 bytes)
//
// 6 xrefs:
// > PlayLayer::loadFromCheckpoint @ 0x10008b067
// > LevelEditorLayer::onStopPlaytest @ 0x1000c6df2
// > GJBaseGameLayer::setupLevelStart @ 0x100100e15
// > GJBaseGameLayer::collisionCheckObjects @ 0x100104f87
// > GJBaseGameLayer::collisionCheckObjects @ 0x100105026
// > GJBaseGameLayer::resetLevelVariables @ 0x10013904a
//
// 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:21:21 +0000
//
void __fastcall GJBaseGameLayer::toggleDualMode(__int64 a1, __int64 a2, char a3, __int64 a4, unsigned __int8 a5)
{
__int64 v8; // rdi
unsigned __int8 v9; // al
__int64 v10; // rdi
char v11; // cl
_BYTE *v12; // rax
__int64 v13; // rax
unsigned int ActiveMode; // eax
__int64 v15; // rdi
_BYTE *v16; // rdi
__int64 v17; // rbx
if ( *(_BYTE *)(a1 + 1010) == a3 )
return;
*(_BYTE *)(a1 + 1010) = a3;
v8 = *(_QWORD *)(a1 + 13288);
if ( a3 )
v9 = *(_BYTE *)(*(_QWORD *)(a1 + 3272) + 340LL);
else
v9 = 0;
UILayer::updateDualMode(v8, v9);
v10 = *(_QWORD *)(a1 + 3256);
v11 = *(_BYTE *)(a1 + 1010);
*(_BYTE *)(v10 + 2617) = v11;
v12 = *(_BYTE **)(a1 + 3264);
v12[2617] = v11;
if ( v11 == 1 )
{
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v12 + 1288LL))(v12);
if ( !(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3264) + 512LL))(*(_QWORD *)(a1 + 3264)) )
{
v13 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3256) + 512LL))(*(_QWORD *)(a1 + 3256));
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v13 + 464LL))(v13, *(_QWORD *)(a1 + 3264), 59);
if ( !*(_BYTE *)(a1 + 12236) )
PlayerObject::addAllParticles(*(_QWORD *)(a1 + 3264));
}
PlayerObject::spawnFromPlayer(*(_QWORD *)(a1 + 3264), *(_QWORD *)(a1 + 3256), *(unsigned __int8 *)(a1 + 1912) ^ 1u);
if ( *(_BYTE *)(*(_QWORD *)(a1 + 3272) + 340LL) == 1 )
{
PlayerObject::releaseButton(*(_QWORD *)(a1 + 3264), 1);
if ( *(_BYTE *)(a1 + 12236) | a5 )
{
LABEL_12:
if ( !a2 )
return;
LABEL_37:
*(_QWORD *)(a1 + 984) = a2;
GJBaseGameLayer::playerWillSwitchMode(a1, a4, a2);
return;
}
}
else if ( *(_BYTE *)(a1 + 12236) | a5 )
{
goto LABEL_12;
}
PlayerObject::spawnDualCircle(*(_QWORD *)(a1 + 3256));
PlayerObject::spawnDualCircle(*(_QWORD *)(a1 + 3264));
if ( !a2 )
return;
goto LABEL_37;
}
if ( *(_BYTE *)(v10 + 2420) == 1 && (!a4 || *(_DWORD *)(a4 + 916) != *(_DWORD *)(v10 + 916)) )
PlayerObject::createFadeOutDartStreak();
if ( a4 && !*(_BYTE *)(a1 + 12236) )
{
GJBaseGameLayer::playExitDualEffect(
a1,
*(_QWORD *)(a1 + 8LL * (*(_DWORD *)(a4 + 916) != *(_DWORD *)(*(_QWORD *)(a1 + 3264) + 916LL)) + 3256));
goto LABEL_22;
}
if ( a4 )
{
LABEL_22:
if ( *(_DWORD *)(a4 + 916) == *(_DWORD *)(*(_QWORD *)(a1 + 3264) + 916LL) )
PlayerObject::copyAttributes(*(_QWORD *)(a1 + 3256));
}
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3264) + 528LL))(*(_QWORD *)(a1 + 3264), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 3264) + 912LL))(*(_QWORD *)(a1 + 3264), 0);
PlayerObject::releaseAllButtons(*(_QWORD *)(a1 + 3264));
PlayerObject::removeAllParticles(*(_QWORD *)(a1 + 3264));
PlayerObject::deactivateStreak(*(_QWORD *)(a1 + 3264), 1);
if ( !*(_BYTE *)(a1 + 12236) )
PlayerObject::spawnPortalCircle(*(_QWORD *)(a1 + 3256), 6618880, 50.0);
*(_QWORD *)(a1 + 984) = 0;
if ( a2 )
{
if ( *(_DWORD *)(a2 + 1248) == 1 )
{
*(_BYTE *)(a1 + 785) = *(_BYTE *)(a2 + 1748);
*(_BYTE *)(a1 + 786) = *(_BYTE *)(a2 + 1760);
if ( *(_BYTE *)(a2 + 1749) == 1 )
_mm_storel_ps(
(double *)(a1 + 716),
_mm_min_ps(
(__m128)0x422000003F800000uLL,
_mm_max_ps(
(__m128)0x3F80000000000000uLL,
_mm_shuffle_ps((__m128)*(unsigned __int64 *)(a2 + 1752), (__m128)*(unsigned __int64 *)(a2 + 1752), 225))));
}
}
ActiveMode = PlayerObject::getActiveMode(*(_QWORD *)(a1 + 3256));
GJBaseGameLayer::updateDualGround(a1, a4, ActiveMode, 0, 0.0);
v15 = *(_QWORD *)(a1 + 3256);
if ( *(_BYTE *)(v15 + 2420) == 1 && (!a4 || *(_DWORD *)(a4 + 916) != *(_DWORD *)(v15 + 916)) )
{
PlayerObject::resetStreak(v15);
sub_1003F05E0(*(_QWORD *)(a1 + 3256));
v16 = *(_BYTE **)(a1 + 3264);
if ( v16[2420] == 1 )
{
v17 = *(_QWORD *)(a1 + 3256);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v16 + 368LL))(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 360LL))(v17);
}
}
}