//
// PlayerObject::toggleGhostEffect from 0x43887c to 0x438990 (276 bytes)
//
// 10 xrefs:
// > PlayLayer::playEndAnimationToPos @ 0x4000aa
// > PlayLayer::toggleGhostEffect @ 0x40223a
// > PlayLayer::toggleGhostEffect @ 0x40224e
// > PlayLayer::removeAllObjects @ 0x4027d4
// > PlayLayer::removeAllObjects @ 0x402804
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x408442
// > PlayerObject::playerDestroyed @ 0x43bc92
// > PlayerObject::resetObject @ 0x44047e
// > PlayerObject::loadFromCheckpoint @ 0x44b0d2
// > PlayerObject::playCompleteEffect @ 0x69e458
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:48:20 +0000
//
GhostTrailEffect *__fastcall PlayerObject::toggleGhostEffect(GhostTrailEffect *result, int a2)
{
GhostTrailEffect *v2; // r4
_DWORD *v3; // r9
GhostTrailEffect *v4; // r0
int *v5; // r0
int v6; // r3
char v7; // r2
GameManager *v8; // r0
int *v9; // r0
_BYTE *v10; // r3
int v11; // r5
GameManager *v12; // r0
int v13; // r0
v2 = result;
if ( *((_DWORD *)result + 371) != a2 )
{
*((_DWORD *)result + 371) = a2;
result = *((GhostTrailEffect **)result + 372);
if ( result )
{
result = (GhostTrailEffect *)GhostTrailEffect::stopTrail(result);
*((_DWORD *)v2 + 372) = 0;
}
if ( *((_DWORD *)v2 + 371) == 1 )
{
v3 = (_DWORD *)((char *)v2 + 2008);
v4 = (GhostTrailEffect *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)v2 + 373) + 472))(*((_DWORD *)v2 + 373));
if ( *(_BYTE *)v4 || *((_BYTE *)v4 + 1) || *((_BYTE *)v4 + 2) )
{
v5 = GhostTrailEffect::create(v4);
*((_DWORD *)v2 + 372) = v5;
v5[74] = (int)v2;
GhostTrailEffect::doBlendAdditive(*((_DWORD *)v2 + 372));
*(_DWORD *)(*((_DWORD *)v2 + 372) + 280) = *v3;
*(_DWORD *)(*((_DWORD *)v2 + 372) + 304) = 1128792064;
v6 = *((_DWORD *)v2 + 372);
v7 = *((_BYTE *)v2 + 2108);
*(_WORD *)(v6 + 312) = *((_WORD *)v2 + 1053);
*(_BYTE *)(v6 + 314) = v7;
v8 = (GameManager *)GhostTrailEffect::runWithTarget(
*((GhostTrailEffect **)v2 + 372),
*((cocos2d::CCSprite **)v2 + 373),
0.05,
0.4,
nullptr,
0.6,
0);
}
else
{
v9 = GhostTrailEffect::create(v4);
*((_DWORD *)v2 + 372) = v9;
v9[74] = (int)v2;
*(_DWORD *)(*((_DWORD *)v2 + 372) + 280) = *v3;
*(_DWORD *)(*((_DWORD *)v2 + 372) + 304) = 1128792064;
v10 = *((_BYTE **)v2 + 372);
v10[312] = 0;
v10[313] = 0;
v10[314] = 0;
v8 = (GameManager *)GhostTrailEffect::runWithTarget(
*((GhostTrailEffect **)v2 + 372),
*((cocos2d::CCSprite **)v2 + 373),
0.05,
0.4,
nullptr,
0.6,
0);
}
v11 = *((_DWORD *)v2 + 372);
v12 = (GameManager *)GameManager::sharedState(v8);
*(_DWORD *)(v11 + 300) = *(_DWORD *)(*((_DWORD *)v12 + 101) + 2436);
v13 = GameManager::sharedState(v12);
return (GhostTrailEffect *)(*(int (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*(_DWORD *)(v13 + 404) + 2436)
+ 228))(
*(_DWORD *)(*(_DWORD *)(v13 + 404) + 2436),
*((_DWORD *)v2 + 372));
}
}
return result;
}