//
// LevelEditorLayer::saveLevel from 0x4727e0 to 0x472942 (354 bytes)
//
// 3 xrefs:
// > EditorPauseLayer::saveLevel @ 0x509126
// > EditorUI::handleEditorAction @ 0x6f25d2
// > EditorUI::handleEditorAction @ 0x6f2640
//
// 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:05 +0000
//
int __fastcall LevelEditorLayer::saveLevel(int this)
{
int v2; // r6
_BOOL4 v3; // r9
float v4; // s15
unsigned __int8 *v5; // r0
LocalLevelManager *v6; // r0
GManager *v7; // r0
int v8; // r1
int v9; // r8
_BYTE *v10; // r2
bool v11; // zf
int v12; // r3
EditorSFXManager *v13; // r0
int v14; // r1
int v15; // r2
EditorSFXManager *v16; // r0
EditorSFXManager *v18; // [sp+8h] [bp-2Ch] BYREF
int v19; // [sp+Ch] [bp-28h]
int v20; // [sp+10h] [bp-24h]
int v21[3]; // [sp+14h] [bp-20h] BYREF
unsigned __int8 v22[12]; // [sp+20h] [bp-14h] BYREF
v2 = *(_DWORD *)(this + 1408);
LevelEditorLayer::updateCustomSFXMappings((char **)this);
LevelEditorLayer::getLevelString((LevelEditorLayer *)&v18, this);
std::string::basic_string(v21, this + 11888);
v3 = sub_45F9A6((unsigned __int8 *)v21, (unsigned __int8 *)&v18);
std::string::~string((int)v21);
if ( !v3 )
GJGameLevel::levelWasAltered((GJGameLevel *)v2);
cocos2d::ZipUtils::compressString(v22, &v18, 0, -1, 11);
std::string::operator=((unsigned __int8 *)(v2 + 304), v22);
std::string::~string((int)v22);
LevelEditorLayer::updateLevelSaveInfo((LevelEditorLayer *)this);
v4 = *(double *)(this + 12088);
*(_DWORD *)(v2 + 480) += (int)floorf(v4);
*(_QWORD *)(this + 12088) = 0;
memcpy((void *)(v2 + 488), (const void *)(this + 12104), 0x64u);
v5 = LevelEditorLayer::waitForAutoSave((LevelEditorLayer *)this);
v6 = (LocalLevelManager *)LocalLevelManager::sharedState((LocalLevelManager *)v5);
*((_BYTE *)v6 + 376) = 0;
v7 = (GManager *)LocalLevelManager::sharedState(v6);
v9 = GManager::save(v7, 1);
if ( v9 )
{
*(_DWORD *)(this + 12344) = 0;
v10 = (_BYTE *)&stru_303C;
v12 = *(_BYTE *)(this + 12348) & 1;
v11 = v12 == 0;
if ( (*(_BYTE *)(this + 12348) & 1) != 0 )
v10 = *(_BYTE **)(this + 12356);
else
v8 = 12349;
if ( (*(_BYTE *)(this + 12348) & 1) != 0 )
{
v12 = 0;
}
else
{
*(_BYTE *)(this + v8) = v12;
v10[this] = v12;
}
if ( !v11 )
{
*v10 = v12;
*(_DWORD *)(this + 12352) = v12;
}
std::string::reserve((int *)(this + 12348), 0);
v13 = v18;
v14 = v19;
v15 = v20;
v18 = nullptr;
v19 = 0;
v20 = 0;
*(_DWORD *)(this + 12348) = v13;
*(_DWORD *)(this + 12352) = v14;
*(_DWORD *)(this + 12356) = v15;
v16 = (EditorSFXManager *)EditorSFXManager::sharedState(v13);
EditorSFXManager::playAction(v16, 222);
}
std::string::~string((int)&v18);
return v9;
}