//
// GameLevelManager::deleteLevel from 0x140145050 to 0x1401452aa (602 bytes)
//
// 5 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x1400d8cb9
// > LevelBrowserLayer::FLAlert_Clicked @ 0x1402cf83b
// > LevelBrowserLayer::FLAlert_Clicked @ 0x1402cfc05
// > LevelInfoLayer::FLAlert_Clicked @ 0x1403002f6
// > ??> @ 0x1406ca554
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=2
void GameLevelManager::deleteLevel(GameLevelManager *a1, GJGameLevel *a2)
{
LocalLevelManager *v4; // rax
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // rbx
size_t v8; // r8
__int64 v9; // rdi
void *v10; // rcx
cocos2d::CCString *v11; // rax
const char *v12; // rax
void *v13; // rcx
__int128 Src; // [rsp+20h] [rbp-50h] BYREF
__int64 v15; // [rsp+30h] [rbp-40h]
__int64 v16; // [rsp+38h] [rbp-38h]
__int128 *p_Src; // [rsp+40h] [rbp-30h]
void *Block[2]; // [rsp+48h] [rbp-28h] BYREF
__m128i si128; // [rsp+58h] [rbp-18h]
if ( a2->m_levelType == Editor )
{
v4 = LocalLevelManager::sharedState();
cocos2d::CCArray::removeObject(v4->m_localLevels, a2, 1);
}
else
{
v5 = cocos2d::CCString::createWithFormat("%i", a2->m_levelID.random - a2->m_levelID.seed);
CString = cocos2d::CCString::getCString(v5);
*(_OWORD *)Block = 0;
si128 = 0;
v7 = -1;
v8 = -1;
do
++v8;
while ( CString[v8] );
sub_14003A930(Block, CString, v8);
v9 = cocos2d::CCDictionary::objectForKey(a1->m_onlineLevels, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v9
&& (*(_DWORD *)(v9 + 816) - *(_DWORD *)(v9 + 812) > 0
|| *(int *)(v9 + 844) > 0
|| *(int *)(v9 + 1300) > 0
|| *(_DWORD *)(v9 + 1352)
|| *(_BYTE *)(v9 + 868)) )
{
Src = 0;
v15 = 0;
v16 = 15;
LOBYTE(Src) = 0;
p_Src = &Src;
if ( (__int128 *)(v9 + 408) != &Src )
sub_14003CCE0((void **)(v9 + 408), &Src, 0);
sub_14003A830((__int64)&Src);
*(_BYTE *)(v9 + 1073) = 1;
}
else
{
v11 = cocos2d::CCString::createWithFormat("%i", a2->m_levelID.random - a2->m_levelID.seed);
v12 = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
si128 = 0;
do
++v7;
while ( v12[v7] );
sub_14003A930(Block, v12, v7);
cocos2d::CCDictionary::removeObjectForKey(a1->m_onlineLevels, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v13 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}
}
}