//
// PlayerObject::toggleGhostEffect from 0x753324 to 0x753488 (356 bytes)
//
// 11 xrefs:
// > PlayLayer::playEndAnimationToPos @ 0x6f3f18
// > PlayLayer::toggleGhostEffect @ 0x6f6c48
// > PlayLayer::toggleGhostEffect @ 0x6f6c70
// > PlayLayer::removeAllObjects @ 0x6f7644
// > PlayLayer::removeAllObjects @ 0x6f7704
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x70444c
// > PlayerObject::playerDestroyed @ 0x759124
// > PlayerObject::resetObject @ 0x75e038
// > PlayerObject::loadFromCheckpoint @ 0x76bb28
// > PlayerObject::playCompleteEffect @ 0xb5371c
// > ??> @ 0x7cb40
//
// 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:52:56 +0000
//
__int64 __fastcall PlayerObject::toggleGhostEffect(__int64 result, int a2)
{
__int64 v2; // x19
GhostTrailEffect *v3; // x0
__int64 v4; // x0
_BYTE *v5; // x0
GameManager *v6; // x0
__int64 v7; // x20
GameManager *v8; // x0
__int64 v9; // x0
__int64 v10; // x0
__int64 v11; // x0
if ( *(_DWORD *)(result + 1788) != a2 )
{
v2 = result;
result = *(_QWORD *)(result + 1792);
*(_DWORD *)(v2 + 1788) = a2;
if ( result )
{
result = GhostTrailEffect::stopTrail((GhostTrailEffect *)result);
*(_QWORD *)(v2 + 1792) = 0;
a2 = *(_DWORD *)(v2 + 1788);
}
if ( a2 == 1 )
{
v3 = (GhostTrailEffect *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v2 + 1800) + 944LL))(*(_QWORD *)(v2 + 1800));
if ( *(_WORD *)v3 || (v3 = (GhostTrailEffect *)*((unsigned __int8 *)v3 + 2), (_DWORD)v3) )
{
v10 = GhostTrailEffect::create(v3);
*(_QWORD *)(v2 + 1792) = v10;
*(_QWORD *)(v10 + 352) = v2;
GhostTrailEffect::doBlendAdditive(*(_QWORD *)(v2 + 1792));
*(_DWORD *)(*(_QWORD *)(v2 + 1792) + 332LL) = *(_DWORD *)(v2 + 2472);
*(_DWORD *)(*(_QWORD *)(v2 + 1792) + 368LL) = 1128792064;
v11 = *(_QWORD *)(v2 + 1792);
*(_WORD *)(v11 + 384) = *(_WORD *)(v2 + 2602);
*(_BYTE *)(v11 + 386) = *(_BYTE *)(v2 + 2604);
}
else
{
v4 = GhostTrailEffect::create(v3);
*(_QWORD *)(v2 + 1792) = v4;
*(_QWORD *)(v4 + 352) = v2;
*(_DWORD *)(*(_QWORD *)(v2 + 1792) + 332LL) = *(_DWORD *)(v2 + 2472);
*(_DWORD *)(*(_QWORD *)(v2 + 1792) + 368LL) = 1128792064;
v5 = *(_BYTE **)(v2 + 1792);
v5[384] = 0;
v5[385] = 0;
v5[386] = 0;
}
v6 = GhostTrailEffect::runWithTarget(
*(GhostTrailEffect **)(v2 + 1792),
*(cocos2d::CCSprite **)(v2 + 1800),
0.05,
0.4,
0.0,
0.6,
0);
v7 = *(_QWORD *)(v2 + 1792);
v8 = *(GameManager **)(*(_QWORD *)(GameManager::sharedState(v6) + 544) + 3920LL);
*(_QWORD *)(v7 + 360) = v8;
v9 = GameManager::sharedState(v8);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(v9 + 544) + 3920LL) + 456LL))(
*(_QWORD *)(*(_QWORD *)(v9 + 544) + 3920LL),
*(_QWORD *)(v2 + 1792));
}
}
return result;
}