//
// GameManager::reorderKey from 0x140183ac0 to 0x140183bb3 (243 bytes)
//
// 3 xrefs:
// > EditorUI::orderUpCustomItem @ 0x1400e46ba
// > EditorUI::orderDownCustomItem @ 0x1400e474a
// > ??> @ 0x1406cb5e0
//
// 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
//
int GameManager::reorderKey(GameManager *a1, int a2, bool a3)
{
struct cocos2d::CCArray *v6; // rdi
int v7; // esi
unsigned int v8; // ebx
cocos2d::CCString *v9; // rax
int v10; // eax
unsigned int v12; // ebx
cocos2d::CCString *v13; // rax
v6 = cocos2d::CCDictionary::allKeys(a1->m_customObjectDict);
if ( cocos2d::CCArray::count(v6) )
qsort(v6->data->arr, v6->data->num, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)sub_14017B290);
v7 = 0;
v8 = 0;
if ( !cocos2d::CCArray::count(v6) )
return a2;
while ( 1 )
{
v9 = cocos2d::CCArray::stringAtIndex(v6, v8);
v10 = cocos2d::CCString::intValue(v9);
if ( v10 == a2 )
break;
v7 = v10;
if ( ++v8 >= cocos2d::CCArray::count(v6) )
return a2;
}
if ( !a3 )
{
v12 = v8 + 1;
if ( v12 >= cocos2d::CCArray::count(v6) )
return a2;
v13 = cocos2d::CCArray::stringAtIndex(v6, v12);
v7 = cocos2d::CCString::intValue(v13);
}
if ( !v7 )
return a2;
GameManager::switchCustomObjects(a1, a2, v7);
return v7;
}