//
// LevelEditorLayer::checkAutoSave from 0x7a8b3c to 0x7a8ca4 (360 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::updateEditor @ 0x7a9038
// > ??> @ 0xc6508
//
// 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:53:44 +0000
//
unsigned __int64 __fastcall LevelEditorLayer::checkAutoSave(LevelEditorLayer *this, float a2)
{
GameManager *v4; // x0
__int64 GameVariable; // x0
GameManager *v6; // x0
unsigned __int64 result; // x0
GameManager *v8; // x0
int IntGameVariable; // w0
float v10; // s1
int v11; // w2
float v12; // s8
float v13; // s0
GameManager *v14; // x0
float v15; // s0
float v16; // s8
v4 = (GameManager *)GameManager::sharedState(this);
GameVariable = (unsigned __int8)GameManager::getGameVariable(v4, "0184");
if ( (_BYTE)GameVariable )
{
v14 = (GameManager *)GameManager::sharedState((GameManager *)GameVariable);
GameVariable = GameManager::getIntGameVariable(v14, "0185");
v15 = (int)GameVariable <= 0 ? 300.0 : (float)(int)GameVariable;
v16 = a2 + *((float *)this + 3764);
*((float *)this + 3764) = v16;
if ( v16 >= v15 )
{
GameVariable = LevelEditorLayer::canAutoSave(this);
if ( (_BYTE)GameVariable )
{
*((_DWORD *)this + 3764) = 0;
GameVariable = LevelEditorLayer::doAutoSave(this);
}
}
}
v6 = (GameManager *)GameManager::sharedState((GameManager *)GameVariable);
result = (unsigned __int8)GameManager::getGameVariable(v6, "0186");
if ( (_BYTE)result )
{
v8 = (GameManager *)GameManager::sharedState((GameManager *)result);
IntGameVariable = GameManager::getIntGameVariable(v8, "0187");
if ( IntGameVariable <= 0 )
{
v10 = 3600.0;
}
else if ( IntGameVariable > 599 )
{
v10 = (float)IntGameVariable;
}
else
{
v10 = 600.0;
}
result = *((_QWORD *)this + 242);
v11 = *(_DWORD *)(result + 1464);
v12 = (double)*(int *)(result + 652) + *((double *)this + 1836);
if ( v11 <= 0 || (v13 = (float)v11, v12 < (float)v11) )
{
*(_DWORD *)(result + 1464) = (int)v12;
result = *((_QWORD *)this + 242);
v13 = (float)*(int *)(result + 1464);
}
if ( (float)(v12 - v13) >= v10 )
{
result = LevelEditorLayer::canAutoSave(this);
if ( (_BYTE)result )
{
*(_DWORD *)(*((_QWORD *)this + 242) + 1464LL) = (int)v12;
return LevelEditorLayer::doAutoBackup(this);
}
}
}
return result;
}