//
// GameLevelManager::deleteLevel from 0x4b2f6c to 0x4b308c (288 bytes)
//
// 4 xrefs:
// > LevelInfoLayer::onDelete @ 0x49a148
// > EditLevelLayer::onDelete @ 0x4a05ee
// > LevelBrowserLayer::deleteSelected @ 0x4a8b8c
// > LevelBrowserLayer::FLAlert_Clicked @ 0x4a8e52
//
// 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:50:04 +0000
//
int __fastcall GameLevelManager::deleteLevel(cocos2d::CCDictionary **this, GJGameLevel *a2)
{
int v4; // r0
const char *v6; // r1
cocos2d::CCDictionary *v7; // r6
cocos2d::CCString *v8; // r0
const char *LevelKey; // r0
const char *v10; // r4
size_t v11; // r0
GJGameLevel *v12; // r0
int v13; // r4
int v14[3]; // [sp+4h] [bp-20h] BYREF
int v15[3]; // [sp+10h] [bp-14h] BYREF
if ( *((_DWORD *)a2 + 238) == 2 )
{
v4 = LocalLevelManager::sharedState((LocalLevelManager *)this);
return cocos2d::CCArray::removeObject(*(cocos2d::CCArray **)(v4 + 284), a2, 1);
}
else
{
GameLevelManager::evictDeathDataCache((GameLevelManager *)this, *((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68));
v6 = (const char *)(*((_DWORD *)a2 + 186) - *((_DWORD *)a2 + 187));
if ( (int)v6 <= 0 )
{
v7 = *(this + 136);
LevelKey = (const char *)GameLevelManager::getLevelKey(
(GameLevelManager *)this,
(const char *)(*((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68)));
}
else
{
v7 = *(this + 147);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v6);
LevelKey = (const char *)cocos2d::CCString::getCString(v8);
}
v10 = LevelKey;
memset(v14, 0, sizeof(v14));
v11 = strlen(LevelKey);
std::string::__init(v14, v10, v11);
v12 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey(v7, v14);
v13 = (int)v12;
if ( v12
&& (GJGameLevel::getNormalPercent(v12) > 0
|| *(int *)(v13 + 712) > 0
|| *(int *)(v13 + 1040) > 0
|| *(_DWORD *)(v13 + 1068)
|| *(_BYTE *)(v13 + 736)) )
{
memset(v15, 0, sizeof(v15));
std::string::__init(v15, &unk_B6B226, 0);
std::string::operator=((unsigned __int8 *)(v13 + 304), (unsigned __int8 *)v15);
std::string::~string((int)v15);
*(_BYTE *)(v13 + 917) = 1;
GJGameLevel::clearDeathMarkerData(v13);
}
else
{
cocos2d::CCDictionary::removeObjectForKey(v7);
}
return std::string::~string((int)v14);
}
}