//
// EditLevelLayer::verifyLevelName from 0x4a0170 to 0x4a02aa (314 bytes)
//
// 4 xrefs:
// > EditLevelLayer::onPlay @ 0x4a0382
// > EditLevelLayer::onEdit @ 0x4a049a
// > EditLevelLayer::onBack @ 0x4a0536
// > EditLevelLayer::onClone @ 0x4a20f0
//
// 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:49:49 +0000
//
LocalLevelManager *__fastcall EditLevelLayer::verifyLevelName(EditLevelLayer *this, int a2, int a3, int a4)
{
int v5; // r6
int v6; // r6
int v7; // r8
_BOOL4 v8; // r6
LocalLevelManager *result; // r0
int v10; // r6
cocos2d::CCArray *AllLevelsWithName; // r8
unsigned int v12; // r6
int v13; // r4
int v14; // r0
EditLevelLayer *v15; // [sp+0h] [bp-10h] BYREF
int v16; // [sp+4h] [bp-Ch]
int v17; // [sp+8h] [bp-8h]
int v18; // [sp+Ch] [bp-4h]
v15 = this;
v16 = a2;
v17 = a3;
v18 = a4;
std::string::basic_string((int *)&v15, *((_DWORD *)this + 87) + 280);
if ( ((unsigned __int8)v15 & 1) != 0 )
v5 = v16;
else
v5 = (int)(unsigned __int8)v15 >> 1;
std::string::~string((int)&v15);
if ( !v5 )
{
std::string::basic_string((int *)&v15, *((_DWORD *)this + 87) + 960);
if ( ((unsigned __int8)v15 & 1) != 0 )
v6 = v16;
else
v6 = (int)(unsigned __int8)v15 >> 1;
std::string::~string((int)&v15);
v7 = *((_DWORD *)this + 87);
if ( v6 )
{
std::string::basic_string((int *)&v15, v7 + 960);
}
else
{
v15 = nullptr;
v16 = 0;
v17 = 0;
std::string::__init((int *)&v15, "Unknown", 7u);
}
std::string::operator=((unsigned __int8 *)(v7 + 280), (unsigned __int8 *)&v15);
std::string::~string((int)&v15);
}
std::string::basic_string((int *)&v15, *((_DWORD *)this + 87) + 280);
v8 = sub_49F398((unsigned __int8 *)&v15, (unsigned __int8 *)this + 368);
result = (LocalLevelManager *)std::string::~string((int)&v15);
if ( !v8 )
{
*(_DWORD *)(*((_DWORD *)this + 87) + 440) = 0;
v10 = LocalLevelManager::sharedState(result);
std::string::basic_string((int *)&v15, *((_DWORD *)this + 87) + 280);
AllLevelsWithName = (cocos2d::CCArray *)LocalLevelManager::getAllLevelsWithName(v10, &v15);
std::string::~string((int)&v15);
result = (LocalLevelManager *)cocos2d::CCArray::count(AllLevelsWithName);
if ( (unsigned int)result > 1 )
{
v12 = 0;
v13 = 0;
while ( 1 )
{
result = (LocalLevelManager *)cocos2d::CCArray::count(AllLevelsWithName);
if ( v12 >= (unsigned int)result )
break;
v14 = cocos2d::CCArray::objectAtIndex(AllLevelsWithName, v12++);
if ( v13 < *(_DWORD *)(v14 + 440) )
v13 = *(_DWORD *)(v14 + 440);
}
*(_DWORD *)(*((_DWORD *)this + 87) + 440) = v13 + 1;
}
}
return result;
}