//
// GameLevelManager::deleteLevel from 0x84f880 to 0x84fa98 (536 bytes)
//
// 5 xrefs:
// > LevelInfoLayer::onDelete @ 0x7e6390
// > EditLevelLayer::onDelete @ 0x7ef268
// > LevelBrowserLayer::deleteSelected @ 0x7fc0f0
// > LevelBrowserLayer::FLAlert_Clicked @ 0x7fc788
// > ??> @ 0xdada0
//
// 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:55:26 +0000
//
__int64 __fastcall GameLevelManager::deleteLevel(GameLevelManager *this, GJGameLevel *a2)
{
int v4; // w0
__int64 v5; // x22
const char *CString; // x1
size_t v7; // x0
GJGameLevel *v8; // x0
__int64 v9; // x19
__int64 *v10; // x0
cocos2d::CCString *v12; // x0
__int64 v13; // x0
char *v14; // [xsp+38h] [xbp+38h]
__int64 v15[2]; // [xsp+48h] [xbp+48h] BYREF
void *v16; // [xsp+58h] [xbp+58h]
__int64 v17; // [xsp+60h] [xbp+60h] BYREF
size_t v18; // [xsp+68h] [xbp+68h]
void *v19; // [xsp+70h] [xbp+70h]
if ( *((_DWORD *)a2 + 285) == 2 )
{
v13 = LocalLevelManager::sharedState(this);
cocos2d::CCArray::removeObject(*(cocos2d::CCArray **)(v13 + 360), a2, 1);
return _stack_chk_guard;
}
GameLevelManager::evictDeathDataCache(this, *((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83));
v4 = *((_DWORD *)a2 + 230);
if ( v4 - *((_DWORD *)a2 + 231) > 0 )
{
v5 = *((_QWORD *)this + 106);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)(v4 - *((_DWORD *)a2 + 231)));
CString = (const char *)cocos2d::CCString::getCString(v12);
}
else
{
v5 = *((_QWORD *)this + 95);
CString = (const char *)GameLevelManager::getLevelKey(
this,
(const char *)(unsigned int)(*((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83)));
}
v14 = (char *)CString;
v15[0] = 0;
v15[1] = 0;
v16 = nullptr;
v7 = strlen(CString);
std::string::__init(v15, v14, v7);
v8 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey(v5, v15);
v9 = (__int64)v8;
if ( v8
&& ((int)GJGameLevel::getNormalPercent(v8) > 0
|| *(int *)(v9 + 888) > 0
|| *(int *)(v9 + 1296) > 0
|| *(_DWORD *)(v9 + 1336)
|| *(_BYTE *)(v9 + 912)) )
{
v17 = 0;
v18 = 0;
v19 = nullptr;
std::string::__init(&v17, &byte_11B8890, 0);
v10 = (__int64 *)(v9 + 392);
if ( (__int64 *)(v9 + 392) != &v17 )
{
if ( (v17 & 1) != 0 )
std::string::assign(v10, v19, v18);
else
std::string::assign(v10, (char *)&v17 + 1, (unsigned __int8)v17 >> 1);
}
if ( (v17 & 1) != 0 )
operator delete(v19);
*(_BYTE *)(v9 + 1105) = 1;
GJGameLevel::clearDeathMarkerData(v9);
if ( (v15[0] & 1) != 0 )
goto LABEL_19;
}
else
{
cocos2d::CCDictionary::removeObjectForKey(v5, v15);
if ( (v15[0] & 1) != 0 )
LABEL_19:
operator delete(v16);
}
return _stack_chk_guard;
}