//
// LevelEditorLayer::checkAutoSave from 0x472fb4 to 0x4730e0 (300 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::updateEditor @ 0x4733c8
//
// 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:49:06 +0000
//
int __fastcall LevelEditorLayer::checkAutoSave(LevelEditorLayer *this, float a2)
{
GameManager *v4; // r0
int GameVariable; // r0
GameManager *v6; // r0
float v7; // s15
GameManager *v8; // r0
int result; // r0
GameManager *v10; // r0
int v11; // r2
int v12; // r3
float v13; // s16
v4 = (GameManager *)GameManager::sharedState(this);
GameVariable = GameManager::getGameVariable(v4, "0184");
if ( GameVariable )
{
v6 = (GameManager *)GameManager::sharedState((GameManager *)GameVariable);
GameVariable = GameManager::getIntGameVariable(v6, "0185");
v7 = a2 + *((float *)this + 3086);
*((float *)this + 3086) = v7;
if ( GameVariable <= 0 )
GameVariable = 300;
if ( v7 >= (float)GameVariable )
{
GameVariable = LevelEditorLayer::canAutoSave(this);
if ( GameVariable )
{
*((_DWORD *)this + 3086) = 0;
GameVariable = LevelEditorLayer::doAutoSave(this);
}
}
}
v8 = (GameManager *)GameManager::sharedState((GameManager *)GameVariable);
result = GameManager::getGameVariable(v8, "0186");
if ( result )
{
v10 = (GameManager *)GameManager::sharedState((GameManager *)result);
result = GameManager::getIntGameVariable(v10, "0187");
if ( result <= 0 )
{
result = 3600;
}
else if ( result < 600 )
{
result = 600;
}
v11 = *((_DWORD *)this + 352);
v12 = *(_DWORD *)(v11 + 1144);
v13 = (double)*(int *)(v11 + 480) + *((double *)this + 1511);
if ( v12 <= 0 || (float)v12 > v13 )
*(_DWORD *)(v11 + 1144) = (int)v13;
if ( (float)(v13 - (float)*(int *)(*((_DWORD *)this + 352) + 1144)) >= (float)result )
{
result = LevelEditorLayer::canAutoSave(this);
if ( result )
{
*(_DWORD *)(*((_DWORD *)this + 352) + 1144) = (int)v13;
return LevelEditorLayer::doAutoBackup(this);
}
}
}
return result;
}