//
// GameLevelManager::createNewLevel from 0x4ca878 to 0x4ca992 (282 bytes)
//
// 4 xrefs:
// > LevelInfoLayer::onClone @ 0x49b254
// > EditLevelLayer::onClone @ 0x4a20e0
// > LevelBrowserLayer::createNewLevel @ 0x4a4a82
// > MapSelectLayer::init @ 0x640e2c
//
// 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:37 +0000
//
unsigned __int8 *__fastcall GameLevelManager::createNewLevel(GameLevelManager *this)
{
int *v1; // r0
unsigned __int8 *v2; // r5
int v3; // r0
const char *v4; // r8
LocalLevelManager *v5; // r0
LocalLevelManager *v6; // r0
int AllLevelsInDict; // r10
cocos2d::CCString *v8; // r0
const char *CString; // r0
const char *v10; // r9
size_t v11; // r0
_BOOL4 v12; // r3
LocalLevelManager *v13; // r0
size_t v14; // r0
int v15; // r9
int v16; // r0
_BOOL4 v18; // [sp+4h] [bp-18h]
int v19; // [sp+8h] [bp-14h] BYREF
int v20; // [sp+Ch] [bp-10h]
int v21; // [sp+10h] [bp-Ch]
v1 = GJGameLevel::create(this);
v1[238] = 2;
*((_BYTE *)v1 + 476) = 1;
v2 = (unsigned __int8 *)v1;
v3 = GameManager::sharedState((GameManager *)v1);
std::string::basic_string(&v19, v3 + 448);
std::string::operator=(v2 + 316, (unsigned __int8 *)&v19);
std::string::~string((int)&v19);
v4 = nullptr;
GJGameLevel::generateAutoSaveUID((GJGameLevel *)&v19, (int)v2);
v5 = (LocalLevelManager *)std::string::~string((int)&v19);
v6 = (LocalLevelManager *)LocalLevelManager::sharedState(v5);
AllLevelsInDict = LocalLevelManager::getAllLevelsInDict(v6);
do
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Unnamed %i", v4);
CString = (const char *)cocos2d::CCString::getCString(v8);
v19 = 0;
v20 = 0;
v21 = 0;
v10 = CString;
v11 = strlen(CString);
std::string::__init(&v19, v10, v11);
if ( cocos2d::CCDictionary::objectForKey(AllLevelsInDict, &v19) )
v12 = (int)v4 > 998;
else
v12 = 1;
v18 = v12;
v13 = (LocalLevelManager *)std::string::~string((int)&v19);
if ( v18 )
{
v19 = 0;
v20 = 0;
v21 = 0;
v14 = strlen(v10);
std::string::__init(&v19, v10, v14);
std::string::operator=(v2 + 960, (unsigned __int8 *)&v19);
v15 = 0;
v13 = (LocalLevelManager *)std::string::~string((int)&v19);
}
else
{
v15 = 1;
}
++v4;
}
while ( v15 );
v16 = LocalLevelManager::sharedState(v13);
cocos2d::CCArray::insertObject(*(cocos2d::CCArray **)(v16 + 284), (cocos2d::CCObject *)v2, 0);
return v2;
}