{"type": "func", "start": 5370297024, "end": 5370297267, "name": "GameManager::reorderKey", "pseudocode": "// \n// GameManager::reorderKey from 0x140183ac0 to 0x140183bb3 (243 bytes)\n// \n// 3 xrefs:\n// > EditorUI::orderUpCustomItem @ 0x1400e46ba\n// > EditorUI::orderDownCustomItem @ 0x1400e474a\n// > <???> @ 0x1406cb5e0\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nint GameManager::reorderKey(GameManager *a1, int a2, bool a3)\n{\n  struct cocos2d::CCArray *v6; // rdi\n  int v7; // esi\n  unsigned int v8; // ebx\n  cocos2d::CCString *v9; // rax\n  int v10; // eax\n  unsigned int v12; // ebx\n  cocos2d::CCString *v13; // rax\n\n  v6 = cocos2d::CCDictionary::allKeys(a1->m_customObjectDict);\n  if ( cocos2d::CCArray::count(v6) )\n    qsort(v6->data->arr, v6->data->num, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)sub_14017B290);\n  v7 = 0;\n  v8 = 0;\n  if ( !cocos2d::CCArray::count(v6) )\n    return a2;\n  while ( 1 )\n  {\n    v9 = cocos2d::CCArray::stringAtIndex(v6, v8);\n    v10 = cocos2d::CCString::intValue(v9);\n    if ( v10 == a2 )\n      break;\n    v7 = v10;\n    if ( ++v8 >= cocos2d::CCArray::count(v6) )\n      return a2;\n  }\n  if ( !a3 )\n  {\n    v12 = v8 + 1;\n    if ( v12 >= cocos2d::CCArray::count(v6) )\n      return a2;\n    v13 = cocos2d::CCArray::stringAtIndex(v6, v12);\n    v7 = cocos2d::CCString::intValue(v13);\n  }\n  if ( !v7 )\n    return a2;\n  GameManager::switchCustomObjects(a1, a2, v7);\n  return v7;\n}", "assembly": "; \n; GameManager::reorderKey from 0x140183ac0 to 0x140183bb3 (243 bytes)\n; \n; 3 xrefs:\n; > EditorUI::orderUpCustomItem @ 0x1400e46ba\n; > EditorUI::orderDownCustomItem @ 0x1400e474a\n; > <???> @ 0x1406cb5e0\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x140183ac0\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x140183ac5\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x140183aca\npush    rdi                                                            ; +0xf, 0x140183acf\npush    r14                                                            ; +0x10, 0x140183ad0\npush    r15                                                            ; +0x12, 0x140183ad2\nsub     rsp, 20h                                                       ; +0x14, 0x140183ad4\nmov     r15, rcx                                                       ; +0x18, 0x140183ad8\nmovzx   r14d, r8b                                                      ; +0x1b, 0x140183adb\nmov     rcx, [rcx+1A8h]                                                ; +0x1f, 0x140183adf\nmov     ebp, edx                                                       ; +0x26, 0x140183ae6\ncall    cs:?allKeys@CCDictionary@cocos2d@@QEAAPEAVCCArray@2@XZ; cocos2d::CCDictionary::allKeys(void) ; +0x28, 0x140183ae8\nmov     rcx, rax                                                       ; +0x2e, 0x140183aee\nmov     rdi, rax                                                       ; +0x31, 0x140183af1\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x34, 0x140183af4\ntest    eax, eax                                                       ; +0x3a, 0x140183afa\njz      short loc_140183B1B                                            ; +0x3c, 0x140183afc\nmov     rcx, [rdi+38h]                                                 ; +0x3e, 0x140183afe\nlea     r9, sub_14017B290; CompareFunction                             ; +0x42, 0x140183b02\nmov     r8d, 8; SizeOfElements                                         ; +0x49, 0x140183b09\nmov     edx, [rcx]; NumOfElements                                      ; +0x4f, 0x140183b0f\nmov     rcx, [rcx+10h]; Base                                           ; +0x51, 0x140183b11\ncall    cs:qsort                                                       ; +0x55, 0x140183b15\nxor     esi, esi                                                       ; +0x5b, 0x140183b1b\nmov     rcx, rdi                                                       ; +0x5d, 0x140183b1d\nmov     ebx, esi                                                       ; +0x60, 0x140183b20\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x62, 0x140183b22\ntest    eax, eax                                                       ; +0x68, 0x140183b28\njz      short loc_140183B59                                            ; +0x6a, 0x140183b2a\nnop     dword ptr [rax+00h]                                            ; +0x6c, 0x140183b2c\nmov     edx, ebx                                                       ; +0x70, 0x140183b30\nmov     rcx, rdi                                                       ; +0x72, 0x140183b32\ncall    cs:?stringAtIndex@CCArray@cocos2d@@QEAAPEAVCCString@2@I@Z; cocos2d::CCArray::stringAtIndex(uint) ; +0x75, 0x140183b35\nmov     rcx, rax                                                       ; +0x7b, 0x140183b3b\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0x7e, 0x140183b3e\ncmp     eax, ebp                                                       ; +0x84, 0x140183b44\njz      short loc_140183B74                                            ; +0x86, 0x140183b46\nmov     rcx, rdi                                                       ; +0x88, 0x140183b48\nmov     esi, eax                                                       ; +0x8b, 0x140183b4b\ninc     ebx                                                            ; +0x8d, 0x140183b4d\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x8f, 0x140183b4f\ncmp     ebx, eax                                                       ; +0x95, 0x140183b55\njb      short loc_140183B30                                            ; +0x97, 0x140183b57\nmov     eax, ebp                                                       ; +0x99, 0x140183b59\nmov     rbx, [rsp+38h+arg_0]                                           ; +0x9b, 0x140183b5b\nmov     rbp, [rsp+38h+arg_8]                                           ; +0xa0, 0x140183b60\nmov     rsi, [rsp+38h+arg_10]                                          ; +0xa5, 0x140183b65\nadd     rsp, 20h                                                       ; +0xaa, 0x140183b6a\npop     r15                                                            ; +0xae, 0x140183b6e\npop     r14                                                            ; +0xb0, 0x140183b70\npop     rdi                                                            ; +0xb2, 0x140183b72\nretn                                                                   ; +0xb3, 0x140183b73\ntest    r14b, r14b                                                     ; +0xb4, 0x140183b74\njnz     short loc_140183B9E                                            ; +0xb7, 0x140183b77\nmov     rcx, rdi                                                       ; +0xb9, 0x140183b79\ninc     ebx                                                            ; +0xbc, 0x140183b7c\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0xbe, 0x140183b7e\ncmp     ebx, eax                                                       ; +0xc4, 0x140183b84\njnb     short loc_140183B59                                            ; +0xc6, 0x140183b86\nmov     edx, ebx                                                       ; +0xc8, 0x140183b88\nmov     rcx, rdi                                                       ; +0xca, 0x140183b8a\ncall    cs:?stringAtIndex@CCArray@cocos2d@@QEAAPEAVCCString@2@I@Z; cocos2d::CCArray::stringAtIndex(uint) ; +0xcd, 0x140183b8d\nmov     rcx, rax                                                       ; +0xd3, 0x140183b93\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0xd6, 0x140183b96\nmov     esi, eax                                                       ; +0xdc, 0x140183b9c\ntest    esi, esi                                                       ; +0xde, 0x140183b9e\njz      short loc_140183B59                                            ; +0xe0, 0x140183ba0\nmov     r8d, esi                                                       ; +0xe2, 0x140183ba2\nmov     edx, ebp                                                       ; +0xe5, 0x140183ba5\nmov     rcx, r15                                                       ; +0xe7, 0x140183ba7\ncall    GameManager__switchCustomObjects                               ; +0xea, 0x140183baa\nmov     eax, esi                                                       ; +0xef, 0x140183baf\njmp     short loc_140183B5B                                            ; +0xf1, 0x140183bb1", "xrefs": ["EditorUI::orderUpCustomItem @ 0x1400e46ba", "EditorUI::orderDownCustomItem @ 0x1400e474a", "<???> @ 0x1406cb5e0"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}