{"type": "func", "start": 5370296304, "end": 5370296682, "name": "GameManager::addNewCustomObject", "pseudocode": "// \n// GameManager::addNewCustomObject from 0x1401837f0 to 0x14018396a (378 bytes)\n// \n// 2 xrefs:\n// > EditorUI::onNewCustomItem @ 0x1400e44d3\n// > <???> @ 0x1406cb5c8\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\n// Hidden C++ exception states: #wind=2\n__int64 __fastcall GameManager::addNewCustomObject(__int64 a1, __int64 a2)\n{\n  struct cocos2d::CCArray *v4; // rsi\n  int v5; // edi\n  cocos2d::ccArray *data; // rbx\n  __int64 num; // rax\n  cocos2d::CCString **arr; // rbx\n  cocos2d::CCString **i; // rsi\n  int v10; // eax\n  cocos2d::CCString *v11; // rax\n  const char *CString; // rax\n  size_t v13; // r8\n  __int64 v14; // rax\n  void *v15; // rcx\n  void *Block[2]; // [rsp+28h] [rbp-40h] BYREF\n  __int128 v18; // [rsp+38h] [rbp-30h]\n\n  v4 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 424));\n  if ( cocos2d::CCArray::count(v4) )\n    qsort(v4->data->arr, v4->data->num, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)sub_14017B290);\n  v5 = 0;\n  if ( v4 )\n  {\n    data = v4->data;\n    num = data->num;\n    if ( (_DWORD)num )\n    {\n      arr = (cocos2d::CCString **)data->arr;\n      for ( i = &arr[num - 1]; arr <= i; ++arr )\n      {\n        if ( !*arr )\n          break;\n        v10 = cocos2d::CCString::intValue(*arr);\n        if ( v10 < v5 )\n          v5 = v10;\n      }\n    }\n  }\n  v11 = cocos2d::CCString::createWithFormat(\"%i\", v5 - 1);\n  CString = cocos2d::CCString::getCString(v11);\n  *(_OWORD *)Block = 0;\n  v18 = 0;\n  v13 = -1;\n  do\n    ++v13;\n  while ( CString[v13] );\n  sub_14003A930(Block, CString, v13);\n  v14 = cocos2d::CCString::create(a2);\n  cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 424), v14, Block);\n  if ( *((_QWORD *)&v18 + 1) > 0xFu )\n  {\n    v15 = Block[0];\n    if ( (unsigned __int64)(*((_QWORD *)&v18 + 1) + 1LL) >= 0x1000 )\n    {\n      v15 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v15);\n  }\n  sub_14003A830(a2);\n  return (unsigned int)(v5 - 1);\n}", "assembly": "; \n; GameManager::addNewCustomObject from 0x1401837f0 to 0x14018396a (378 bytes)\n; \n; 2 xrefs:\n; > EditorUI::onNewCustomItem @ 0x1400e44d3\n; > <???> @ 0x1406cb5c8\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_10], rbx                                              ; +0x0, 0x1401837f0\nmov     [rsp+arg_18], rbp                                              ; +0x5, 0x1401837f5\npush    rsi                                                            ; +0xa, 0x1401837fa\npush    rdi                                                            ; +0xb, 0x1401837fb\npush    r14                                                            ; +0xc, 0x1401837fc\nsub     rsp, 50h                                                       ; +0xe, 0x1401837fe\nmov     rax, cs:__security_cookie                                      ; +0x12, 0x140183802\nxor     rax, rsp                                                       ; +0x19, 0x140183809\nmov     [rsp+68h+var_20], rax                                          ; +0x1c, 0x14018380c\nmov     rbp, rdx                                                       ; +0x21, 0x140183811\nmov     r14, rcx                                                       ; +0x24, 0x140183814\nmov     [rsp+68h+var_48], rdx                                          ; +0x27, 0x140183817\nmov     rcx, [rcx+1A8h]                                                ; +0x2c, 0x14018381c\ncall    cs:?allKeys@CCDictionary@cocos2d@@QEAAPEAVCCArray@2@XZ; cocos2d::CCDictionary::allKeys(void) ; +0x33, 0x140183823\nmov     rsi, rax                                                       ; +0x39, 0x140183829\nmov     rcx, rax                                                       ; +0x3c, 0x14018382c\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x3f, 0x14018382f\ntest    eax, eax                                                       ; +0x45, 0x140183835\njz      short loc_140183856                                            ; +0x47, 0x140183837\nmov     rcx, [rsi+38h]                                                 ; +0x49, 0x140183839\nmov     edx, [rcx]; NumOfElements                                      ; +0x4d, 0x14018383d\nlea     r9, sub_14017B290; CompareFunction                             ; +0x4f, 0x14018383f\nmov     r8d, 8; SizeOfElements                                         ; +0x56, 0x140183846\nmov     rcx, [rcx+10h]; Base                                           ; +0x5c, 0x14018384c\ncall    cs:qsort                                                       ; +0x60, 0x140183850\nxor     edi, edi                                                       ; +0x66, 0x140183856\ntest    rsi, rsi                                                       ; +0x68, 0x140183858\njz      short loc_140183894                                            ; +0x6b, 0x14018385b\nmov     rbx, [rsi+38h]                                                 ; +0x6d, 0x14018385d\nmov     eax, [rbx]                                                     ; +0x71, 0x140183861\ntest    eax, eax                                                       ; +0x73, 0x140183863\njz      short loc_140183894                                            ; +0x75, 0x140183865\nmov     rbx, [rbx+10h]                                                 ; +0x77, 0x140183867\nlea     rsi, [rax-1]                                                   ; +0x7b, 0x14018386b\nlea     rsi, [rbx+rsi*8]                                               ; +0x7f, 0x14018386f\ncmp     rbx, rsi                                                       ; +0x83, 0x140183873\nja      short loc_140183894                                            ; +0x86, 0x140183876\nmov     rcx, [rbx]                                                     ; +0x88, 0x140183878\ntest    rcx, rcx                                                       ; +0x8b, 0x14018387b\njz      short loc_140183894                                            ; +0x8e, 0x14018387e\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0x90, 0x140183880\ncmp     eax, edi                                                       ; +0x96, 0x140183886\ncmovl   edi, eax                                                       ; +0x98, 0x140183888\nadd     rbx, 8                                                         ; +0x9b, 0x14018388b\ncmp     rbx, rsi                                                       ; +0x9f, 0x14018388f\njbe     short loc_140183878                                            ; +0xa2, 0x140183892\nlea     edx, [rdi-1]                                                   ; +0xa4, 0x140183894\nlea     rcx, aI_11; \"%i\"                                               ; +0xa7, 0x140183897\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xae, 0x14018389e\nmov     rcx, rax                                                       ; +0xb4, 0x1401838a4\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0xb7, 0x1401838a7\nxorps   xmm0, xmm0                                                     ; +0xbd, 0x1401838ad\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0xc0, 0x1401838b0\nxorps   xmm1, xmm1                                                     ; +0xc5, 0x1401838b5\nmovdqu  [rsp+68h+var_30], xmm1                                         ; +0xc8, 0x1401838b8\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0xce, 0x1401838be\ninc     r8                                                             ; +0xd5, 0x1401838c5\ncmp     byte ptr [rax+r8], 0                                           ; +0xd8, 0x1401838c8\njnz     short loc_1401838C5                                            ; +0xdd, 0x1401838cd\nmov     rdx, rax                                                       ; +0xdf, 0x1401838cf\nlea     rcx, [rsp+68h+Block]                                           ; +0xe2, 0x1401838d2\ncall    sub_14003A930                                                  ; +0xe7, 0x1401838d7\nnop                                                                    ; +0xec, 0x1401838dc\nmov     rcx, rbp                                                       ; +0xed, 0x1401838dd\ncall    cs:?create@CCString@cocos2d@@SAPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCString::create(std::string const &) ; +0xf0, 0x1401838e0\nmov     rdx, rax                                                       ; +0xf6, 0x1401838e6\nlea     r8, [rsp+68h+Block]                                            ; +0xf9, 0x1401838e9\nmov     rcx, [r14+1A8h]                                                ; +0xfe, 0x1401838ee\ncall    cs:?setObject@CCDictionary@cocos2d@@QEAAXPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const &) ; +0x105, 0x1401838f5\nnop                                                                    ; +0x10b, 0x1401838fb\nmov     rdx, qword ptr [rsp+68h+var_30+8]                              ; +0x10c, 0x1401838fc\ncmp     rdx, 0Fh                                                       ; +0x111, 0x140183901\njbe     short loc_14018393D                                            ; +0x115, 0x140183905\ninc     rdx                                                            ; +0x117, 0x140183907\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x11a, 0x14018390a\nmov     rax, rcx                                                       ; +0x11f, 0x14018390f\ncmp     rdx, 1000h                                                     ; +0x122, 0x140183912\njb      short loc_140183937                                            ; +0x129, 0x140183919\nadd     rdx, 27h ; '''                                                 ; +0x12b, 0x14018391b\nmov     rcx, [rcx-8]                                                   ; +0x12f, 0x14018391f\nsub     rax, rcx                                                       ; +0x133, 0x140183923\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x136, 0x140183926\ncmp     rax, 1Fh                                                       ; +0x13a, 0x14018392a\njbe     short loc_140183937                                            ; +0x13e, 0x14018392e\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x140, 0x140183930\ndb 0CCh                                                                ; +0x146, 0x140183936\ncall    j_j_free                                                       ; +0x147, 0x140183937\nnop                                                                    ; +0x14c, 0x14018393c\nmov     rcx, rbp                                                       ; +0x14d, 0x14018393d\ncall    sub_14003A830                                                  ; +0x150, 0x140183940\nlea     eax, [rdi-1]                                                   ; +0x155, 0x140183945\nmov     rcx, [rsp+68h+var_20]                                          ; +0x158, 0x140183948\nxor     rcx, rsp; StackCookie                                          ; +0x15d, 0x14018394d\ncall    __security_check_cookie                                        ; +0x160, 0x140183950\nlea     r11, [rsp+68h+var_18]                                          ; +0x165, 0x140183955\nmov     rbx, [r11+30h]                                                 ; +0x16a, 0x14018395a\nmov     rbp, [r11+38h]                                                 ; +0x16e, 0x14018395e\nmov     rsp, r11                                                       ; +0x172, 0x140183962\npop     r14                                                            ; +0x175, 0x140183965\npop     rdi                                                            ; +0x177, 0x140183967\npop     rsi                                                            ; +0x178, 0x140183968\nretn                                                                   ; +0x179, 0x140183969", "xrefs": ["EditorUI::onNewCustomItem @ 0x1400e44d3", "<???> @ 0x1406cb5c8"], "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"}