//
// GameManager::reorderKey from 0x14027f1f0 to 0x14027f2e3 (243 bytes)
//
// 3 xrefs:
// > EditorUI::orderUpCustomItem @ 0x1401f614d
// > EditorUI::orderDownCustomItem @ 0x1401f61dd
// > ??> @ 0x14091d030
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:28:59 +0000
//
__int64 __fastcall GameManager::reorderKey(__int64 a1, unsigned int a2, char a3)
{
struct cocos2d::CCArray *v6; // rdi
unsigned int v7; // esi
unsigned int v8; // ebx
cocos2d::CCString *v9; // rax
unsigned int v10; // eax
unsigned int v12; // ebx
cocos2d::CCString *v13; // rax
v6 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 464));
if ( cocos2d::CCArray::count(v6) )
qsort(
*(void **)(*((_QWORD *)v6 + 7) + 16LL),
**((unsigned int **)v6 + 7),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_1402760B0);
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;
}