//
// GameLevelManager::createNewLevel from 0x100092550 to 0x10009269c (332 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::onClone @ 0x10002aa34
// > EditLevelLayer::onClone @ 0x1000ec37c
// > LevelBrowserLayer::createNewLevel @ 0x100419268
//
// 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
//
GJGameLevel *__fastcall GameLevelManager::createNewLevel(GameLevelManager *a1)
{
GJGameLevel *v1; // x19
GameManager *v2; // x0
LocalLevelManager *v3; // x0
cocos2d::CCDictionary *AllLevelsInDict; // x20
unsigned int v5; // w23
cocos2d::CCString *v6; // x0
char *CString; // x22
bool v8; // cf
char v9; // w25
LocalLevelManager *v10; // x0
std::string v12; // [xsp+10h] [xbp-90h] BYREF
void *__p[2]; // [xsp+28h] [xbp-78h] BYREF
char v14; // [xsp+3Fh] [xbp-61h]
std::string __str; // [xsp+40h] [xbp-60h] BYREF
v1 = GJGameLevel::create_1();
v1->m_levelType = Editor;
v1->m_isEditable = 1;
v2 = GameManager::sharedState();
if ( v2->m_playerName.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&__str, (void *)v2->m_playerName.m_data.m_long.capacitym1, v2->m_playerName.m_data.m_long.size);
else
__str = (std::string)v2->m_playerName;
std::string::operator=((std::string *)&v1->m_creatorName, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v3 = LocalLevelManager::sharedState();
AllLevelsInDict = LocalLevelManager::getAllLevelsInDict(v3);
v5 = 0;
do
{
v6 = (cocos2d::CCString *)sub_100268F4C("Unnamed %i", v5);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_100009900(__p, CString);
if ( cocos2d::CCDictionary::objectForKey_1(AllLevelsInDict, __p) )
v8 = v5 >= 0x3E7;
else
v8 = 1;
v9 = !v8;
if ( v14 < 0 )
operator delete(__p[0]);
++v5;
}
while ( (v9 & 1) != 0 );
sub_100009900(&v12, CString);
std::string::operator=((std::string *)&v1->m_tempName, &v12);
if ( SHIBYTE(v12.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v12.__r_.__value_.__l.__data_);
v10 = LocalLevelManager::sharedState();
sub_10024A428(v10->m_localLevels, v1, 0);
return v1;
}