//
// GJBaseGameLayer::swapMiddleground from 0x99a640 to 0x99a6e4 (164 bytes)
//
// 2 xrefs:
// > ArtTriggerGameObject::triggerObject @ 0x86ffcc
// > ??> @ 0xe1730
//
// 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:58:04 +0000
//
__int64 __fastcall GJBaseGameLayer::swapMiddleground(__int64 this, int a2)
{
GJBaseGameLayer *v3; // x20
GameManager *v4; // x0
__int64 v5; // x0
*(_DWORD *)(this + 1908) = a2;
if ( !*(_BYTE *)(this + 12605) )
{
v3 = (GJBaseGameLayer *)this;
this = *(unsigned int *)(GameManager::sharedState((GameManager *)this) + 988);
if ( a2 != (_DWORD)this || a2 > 0 && (this = *((_QWORD *)v3 + 497)) == 0 )
{
if ( a2 )
{
v4 = (GameManager *)*(unsigned int *)(GameManager::sharedState((GameManager *)this) + 988);
if ( a2 == (_DWORD)v4 )
{
return GJBaseGameLayer::asyncMGLoaded(v3, (unsigned int)a2);
}
else
{
v5 = GameManager::sharedState(v4);
return GameManager::loadMiddlegroundAsync(v5, a2);
}
}
else
{
return GJBaseGameLayer::createMiddleground((__int64)v3, 0);
}
}
}
return this;
}