//
// GameLevelManager::createNewLevel from 0x1000a6390 to 0x1000a64f8 (360 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::onClone @ 0x10002e210
// > EditLevelLayer::onClone @ 0x1001124ec
// > LevelBrowserLayer::createNewLevel @ 0x10049a6ec
//
// 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 10:58:34 +0000
//
__int64 GameLevelManager::createNewLevel()
{
__int64 v0; // x19
__int64 v1; // x0
_QWORD *v2; // x0
__int64 v3; // x0
__int64 AllLevelsInDict; // x20
unsigned int v5; // w23
__int64 v6; // x0
char *CString; // x22
bool v8; // cf
char v9; // w25
std::string *v10; // x0
__int64 v11; // x0
std::string v13; // [xsp+8h] [xbp-A8h] BYREF
void *v14[2]; // [xsp+20h] [xbp-90h] BYREF
char v15; // [xsp+37h] [xbp-79h]
void *__p; // [xsp+38h] [xbp-78h] BYREF
char v17; // [xsp+4Fh] [xbp-61h]
std::string __str; // [xsp+50h] [xbp-60h] BYREF
v0 = GJGameLevel::create_1();
*(_DWORD *)(v0 + 1140) = 2;
*(_BYTE *)(v0 + 648) = 1;
v1 = GameManager::sharedState(v0);
if ( *(char *)(v1 + 655) < 0 )
sub_1000097D0(&__str, *(void **)(v1 + 632), *(_QWORD *)(v1 + 640));
else
__str = *(std::string *)(v1 + 632);
std::string::operator=((std::string *)(v0 + 416), &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v2 = sub_1000A65B0(&__p, v0);
if ( v17 < 0 )
operator delete(__p);
v3 = LocalLevelManager::sharedState(v2);
AllLevelsInDict = LocalLevelManager::getAllLevelsInDict(v3);
v5 = 0;
do
{
v6 = sub_1003065B0("Unnamed %i", v5);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_100009900(v14, CString);
if ( cocos2d::CCDictionary::objectForKey(AllLevelsInDict, v14) )
v8 = v5 >= 0x3E7;
else
v8 = 1;
v9 = !v8;
if ( v15 < 0 )
operator delete(v14[0]);
++v5;
}
while ( (v9 & 1) != 0 );
sub_100009900(&v13, CString);
v10 = std::string::operator=((std::string *)(v0 + 1152), &v13);
if ( SHIBYTE(v13.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v13.__r_.__value_.__l.__data_);
v11 = LocalLevelManager::sharedState(v10);
sub_1002E7640(*(_QWORD *)(v11 + 360), v0, 0);
return v0;
}