//
// GManager::save from 0x1002e7b08 to 0x1002e7bb0 (168 bytes)
//
// 4 xrefs:
// > AppDelegate::trySaveGame @ 0x100307438
// > AppDelegate::trySaveGame @ 0x100307450
// > GameManager::doQuickSave @ 0x1003baf7c
// > LevelEditorLayer::saveLevel @ 0x100404cf0
//
// 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 11:02:51 +0000
//
bool __fastcall GManager::save(__int64 a1, __int64 a2)
{
unsigned __int8 *v4; // x8
unsigned __int8 v5; // w21
void *__p[2]; // [xsp+0h] [xbp-40h] BYREF
__int64 v8; // [xsp+10h] [xbp-30h]
if ( (a2 & 1) == 0 )
GManager::waitForSave(a1, 30.0);
v4 = (unsigned __int8 *)(a1 + 345);
do
v5 = __ldaxr(v4);
while ( __stlxr(1u, v4) );
if ( (v5 & 1) == 0 )
{
if ( *(char *)(a1 + 343) < 0 )
{
sub_1000097D0(__p, *(void **)(a1 + 320), *(_QWORD *)(a1 + 328));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(a1 + 320);
v8 = *(_QWORD *)(a1 + 336);
}
GManager::saveGMTo(a1, __p, a2);
if ( SHIBYTE(v8) < 0 )
operator delete(__p[0]);
}
return (v5 & 1) == 0;
}