//
// EditLevelLayer::verifyLevelName from 0x3b7c40 to 0x3b7d6c (300 bytes)
//
// 4 xrefs:
// > EditLevelLayer::onPlay @ 0x3b7dec
// > EditLevelLayer::onEdit @ 0x3b7e9a
// > EditLevelLayer::onBack @ 0x3b7f36
// > EditLevelLayer::onClone @ 0x3b8048
//
// 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
//
void EditLevelLayer::verifyLevelName(EditLevelLayer *a1)
{
int v2; // r6
int v3; // r8
GJGameLevel *m_level; // r6
int v5; // r6
LocalLevelManager *v6; // r6
cocos2d::CCArray *AllLevelsWithName; // r8
unsigned int v8; // r6
int v9; // r4
int v10; // r0
int v11; // [sp+8h] [bp-8h] BYREF
sub_775C20(&v11, &a1->m_level->m_levelName);
v2 = *(_DWORD *)(v11 - 12);
sub_774008(&v11);
if ( !v2 )
{
sub_775C20(&v11, &a1->m_level->m_tempName);
v3 = *(_DWORD *)(v11 - 12);
sub_774008(&v11);
m_level = a1->m_level;
if ( v3 )
sub_775C20(&v11, &m_level->m_tempName);
else
sub_776584((int)&v11, "Unknown");
sub_775D40(&m_level->m_levelName, &v11);
sub_774008(&v11);
}
sub_775C20(&v11, &a1->m_level->m_levelName);
v5 = sub_774DBC(&v11, &a1->m_levelName);
sub_774008(&v11);
if ( v5 )
{
a1->m_level->m_levelRev = 0;
v6 = LocalLevelManager::sharedState();
sub_775C20(&v11, &a1->m_level->m_levelName);
AllLevelsWithName = (cocos2d::CCArray *)LocalLevelManager::getAllLevelsWithName(v6, (std::string)&v11);
sub_774008(&v11);
if ( cocos2d::CCArray::count(AllLevelsWithName) > 1u )
{
v8 = 0;
v9 = 0;
while ( v8 < cocos2d::CCArray::count(AllLevelsWithName) )
{
v10 = cocos2d::CCArray::objectAtIndex(AllLevelsWithName, v8++);
if ( v9 < *(_DWORD *)(v10 + 360) )
v9 = *(_DWORD *)(v10 + 360);
}
a1->m_level->m_levelRev = v9 + 1;
}
}
}