//
// GJBaseGameLayer::toggleDualMode from 0x9e6b78 to 0x9e6e08 (656 bytes)
//
// 7 xrefs:
// > PlayLayer::loadFromCheckpoint @ 0x70fb14
// > LevelEditorLayer::onStopPlaytest @ 0x78de94
// > GJBaseGameLayer::resetLevelVariables @ 0x9e7b84
// > GJBaseGameLayer::setupLevelStart @ 0x9e8310
// > GJBaseGameLayer::collisionCheckObjects @ 0x9e8ea8
// > GJBaseGameLayer::collisionCheckObjects @ 0x9e8f4c
// > ??> @ 0xa1488
//
// 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:59:00 +0000
//
__int64 __fastcall GJBaseGameLayer::toggleDualMode(
GJBaseGameLayer *this,
GameObject *a2,
unsigned __int8 a3,
PlayerObject *a4,
unsigned __int8 a5)
{
int v6; // w22
__int64 result; // x0
char v8; // w4
__int64 v11; // x0
int v12; // w2
char *v13; // x22
PlayerObject *v14; // x1
int ActiveMode; // w0
unsigned __int8 *v16; // x1
PlayerObject *v17; // x1
__int64 v18; // x19
__int64 (__fastcall *v19)(__int64); // x20
int v20; // [xsp+38h] [xbp+38h]
v6 = a5;
result = *((unsigned __int8 *)this + 1010);
if ( (_DWORD)result == a3 )
return result;
*((_BYTE *)this + 1010) = a3;
v8 = 0;
if ( a3 )
v8 = *(_BYTE *)(*((_QWORD *)this + 409) + 340LL);
UILayer::updateDualMode(*((char **)this + 1661), v8);
*(_BYTE *)(*((_QWORD *)this + 407) + 2617LL) = *((_BYTE *)this + 1010);
*(_BYTE *)(*((_QWORD *)this + 408) + 2617LL) = *((_BYTE *)this + 1010);
if ( !*((_BYTE *)this + 1010) )
{
v11 = *((_QWORD *)this + 407);
if ( *(_BYTE *)(v11 + 2420) )
{
if ( a4 )
{
v12 = *((_DWORD *)a4 + 229);
if ( v12 == *(_DWORD *)(v11 + 916) )
{
v13 = (char *)this + 0x2000;
if ( *((_BYTE *)this + 12236) )
goto LABEL_12;
goto LABEL_25;
}
}
PlayerObject::createFadeOutDartStreak((HardStreak **)v11);
}
v13 = (char *)this + 0x2000;
if ( *((_BYTE *)this + 12236) )
{
if ( !a4 )
goto LABEL_13;
v12 = *((_DWORD *)a4 + 229);
LABEL_12:
v14 = *((PlayerObject **)this + 408);
if ( v12 != *((_DWORD *)v14 + 229) )
goto LABEL_13;
LABEL_28:
PlayerObject::copyAttributes(*((PlayerObject **)this + 407), v14);
GJBaseGameLayer::removePlayer2(this);
if ( v13[4044] )
goto LABEL_14;
goto LABEL_29;
}
if ( !a4 )
{
LABEL_13:
GJBaseGameLayer::removePlayer2(this);
if ( v13[4044] )
goto LABEL_14;
LABEL_29:
LOWORD(v20) = -256;
BYTE2(v20) = 100;
PlayerObject::spawnPortalCircle(*((_QWORD *)this + 407), v20, 50.0);
LABEL_14:
*((_QWORD *)this + 123) = 0;
if ( a2 && *((_DWORD *)a2 + 312) == 1 )
GJBaseGameLayer::updateCameraMode((__int64)this, a2, 0);
ActiveMode = PlayerObject::getActiveMode(*((PlayerObject **)this + 407));
GJBaseGameLayer::updateDualGround(this, a4, ActiveMode, 0, 0.0);
result = *((_QWORD *)this + 407);
if ( *(_BYTE *)(result + 2420) && (!a4 || *((_DWORD *)a4 + 229) != *(_DWORD *)(result + 916)) )
{
PlayerObject::resetStreak((cocos2d::CCMotionStreak **)result);
PlayerObject::placeStreakPoint(*((PlayerObject **)this + 407));
v16 = *((unsigned __int8 **)this + 408);
result = v16[2420];
if ( v16[2420] )
{
v18 = *((_QWORD *)this + 407);
v19 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 360LL);
(*(void (__fastcall **)(unsigned __int8 *))(*(_QWORD *)v16 + 368LL))(v16);
return v19(v18);
}
}
return result;
}
v12 = *((_DWORD *)a4 + 229);
LABEL_25:
v17 = *((PlayerObject **)this + 408);
if ( *((_DWORD *)v17 + 229) == v12 )
v17 = *((PlayerObject **)this + 407);
GJBaseGameLayer::playExitDualEffect(this, v17);
v14 = *((PlayerObject **)this + 408);
if ( *((_DWORD *)a4 + 229) == *((_DWORD *)v14 + 229) )
goto LABEL_28;
goto LABEL_13;
}
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 408) + 1288LL))(*((_QWORD *)this + 408));
GJBaseGameLayer::spawnPlayer2(this);
if ( *(_BYTE *)(*((_QWORD *)this + 409) + 340LL) )
{
PlayerObject::releaseButton(*((_QWORD *)this + 408), 1);
if ( !v6 )
{
LABEL_32:
if ( !*((_BYTE *)this + 12236) )
{
PlayerObject::spawnDualCircle(*((_QWORD *)this + 407));
PlayerObject::spawnDualCircle(*((_QWORD *)this + 408));
}
}
}
else if ( !v6 )
{
goto LABEL_32;
}
if ( a2 )
*((_QWORD *)this + 123) = a2;
return GJBaseGameLayer::playerWillSwitchMode((__int64)this, a4, a2);
}