{"type": "func", "start": 3827280, "end": 3827700, "name": "EditorUI::onNewCustomItem", "pseudocode": "// \n// EditorUI::onNewCustomItem from 0x3a6650 to 0x3a67f4 (420 bytes)\n// \n// 0 xrefs:\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\nvoid EditorUI::onNewCustomItem(EditorUI *a1, cocos2d::CCObject *a2)\n{\n  cocos2d::CCArray *m_selectedObjects; // r0\n  GameManager *v4; // r0\n  cocos2d::CCString *v5; // r0\n  char *v6; // r0\n  FLAlertLayer *v7; // r6\n  cocos2d::CCString *v8; // r0\n  char *CString; // r0\n  FLAlertLayer *v10; // r6\n  GameObject *m_selectedObject; // r3\n  cocos2d::CCArray *v12; // r6\n  GameManager *v13; // r8\n  int v14; // r2\n  int v15; // r3\n  char *v16; // [sp+Ch] [bp-Ch] BYREF\n  char v17; // [sp+10h] [bp-8h] BYREF\n\n  m_selectedObjects = a1->m_selectedObjects;\n  if ( m_selectedObjects && cocos2d::CCArray::count(m_selectedObjects) > 0x3E8u )\n  {\n    v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(\n                                (cocos2d::CCString *)\"A custom object cannot contain more than <cg>%i</c> objects.\",\n                                (const char *)&stru_3DC.st_info);\n    CString = (char *)cocos2d::CCString::getCString(v8);\n    sub_776584((int)&v16, CString);\n    sub_776584((int)&v17, v16);\n    v10 = FLAlertLayer::create(0, (int)\"Max Limit\", (int)&v17, (int)\"OK\", 0, 340.0);\n    sub_774008(&v17);\n    v10->show(v10);\n    goto LABEL_9;\n  }\n  v4 = GameManager::sharedState();\n  if ( cocos2d::CCDictionary::count(v4->m_customObjectDict) > 0xC7 )\n  {\n    v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(\n                                (cocos2d::CCString *)\"You cannot create more than <cy>%i</c> custom objects.\",\n                                (const char *)&dword_C8);\n    v6 = (char *)cocos2d::CCString::getCString(v5);\n    sub_776584((int)&v16, v6);\n    sub_776584((int)&v17, v16);\n    v7 = FLAlertLayer::create(0, (int)\"Max Custom Objects\", (int)&v17, (int)\"OK\", 0, 340.0);\n    sub_774008(&v17);\n    v7->show(v7);\nLABEL_9:\n    sub_774008(&v16);\n    return;\n  }\n  if ( a1->m_selectedObject || cocos2d::CCArray::count(a1->m_selectedObjects) )\n  {\n    m_selectedObject = a1->m_selectedObject;\n    if ( !m_selectedObject || m_selectedObject->m_objectID != 749 )\n    {\n      if ( cocos2d::CCArray::count(a1->m_selectedObjects) )\n      {\n        v12 = a1->m_selectedObjects;\n      }\n      else\n      {\n        v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);\n        cocos2d::CCArray::addObject(v12, a1->m_selectedObject);\n      }\n      EditorUI::copyObjects((EditorUI *)&v16, (cocos2d::CCArray *)a1, (int)v12, 0, 0);\n      if ( *((_DWORD *)v16 - 3) )\n      {\n        if ( cocos2d::CCArray::count(a1->m_selectedObjects) <= 0x3E8u )\n        {\n          v13 = GameManager::sharedState();\n          sub_775C20(&v17, &v16);\n          GameManager::addNewCustomObject(v13, (cocos2d::CCString *)&v17, v14, v15);\n          sub_774008(&v17);\n          a1->m_selectedObjectIndex = 0;\n          EditorUI::reloadCustomItems(a1);\n        }\n      }\n      goto LABEL_9;\n    }\n  }\n}", "assembly": "; \n; EditorUI::onNewCustomItem from 0x3a6650 to 0x3a67f4 (420 bytes)\n; \n; 0 xrefs:\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\nLDR             R3, =(__stack_chk_guard_ptr - 0x3A665A)                ; +0x0, 0x3a6650\nPUSH.W          {R4-R8,LR}                                             ; +0x2, 0x3a6652\nADD             R3, PC; __stack_chk_guard_ptr                          ; +0x6, 0x3a6656\nLDR             R3, [R3]; __stack_chk_guard                            ; +0x8, 0x3a6658\nMOV             R4, R0                                                 ; +0xa, 0x3a665a\nLDR.W           R0, [R0,#0x260]; this                                  ; +0xc, 0x3a665c\nLDR             R2, [R3]                                               ; +0x10, 0x3a6660\nSUB             SP, SP, #0x18                                          ; +0x12, 0x3a6662\nMOV             R7, R3                                                 ; +0x14, 0x3a6664\nSTR             R2, [SP,#0x18+var_4]                                   ; +0x16, 0x3a6666\nCBZ             R0, loc_3A6674                                         ; +0x18, 0x3a6668\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x1a, 0x3a666a\nCMP.W           R0, #0x3E8                                             ; +0x1e, 0x3a666e\nBHI             loc_3A66EA                                             ; +0x22, 0x3a6672\nBL              _ZN11GameManager11sharedStateEv; GameManager::sharedState(void) ; +0x24, 0x3a6674\nLDR.W           R0, [R0,#0x134]; this                                  ; +0x28, 0x3a6678\nBL              _ZN7cocos2d12CCDictionary5countEv; cocos2d::CCDictionary::count(void) ; +0x2c, 0x3a667c\nCMP             R0, #0xC7                                              ; +0x30, 0x3a6680\nBLS             loc_3A66D4                                             ; +0x32, 0x3a6682\nLDR             R0, =(aYouCannotCreat - 0x3A6690); \"You cannot create more than <cy>%i</c> \"... ; +0x34, 0x3a6684\nMOVS            R1, #dword_C8; char *                                  ; +0x36, 0x3a6686\nADD             R4, SP, #0x18+var_8                                    ; +0x38, 0x3a6688\nADD             R5, SP, #0x18+var_C                                    ; +0x3a, 0x3a668a\nADD             R0, PC; \"You cannot create more than <cy>%i</c> \"...   ; +0x3c, 0x3a668c\nBL              _ZN7cocos2d8CCString16createWithFormatEPKcz; cocos2d::CCString::createWithFormat(char const*,...) ; +0x3e, 0x3a668e\nBL              _ZNK7cocos2d8CCString10getCStringEv; cocos2d::CCString::getCString(void) ; +0x42, 0x3a6692\nMOV             R2, R4                                                 ; +0x46, 0x3a6696\nMOV             R1, R0; char *                                         ; +0x48, 0x3a6698\nMOV             R0, R5; int                                            ; +0x4a, 0x3a669a\nBL              sub_776584                                             ; +0x4c, 0x3a669c\nMOV             R0, R4; int                                            ; +0x50, 0x3a66a0\nLDR             R1, [SP,#0x18+var_C]; char *                           ; +0x52, 0x3a66a2\nADD             R2, SP, #0x18+var_10                                   ; +0x54, 0x3a66a4\nBL              sub_776584                                             ; +0x56, 0x3a66a6\nLDR             R3, flt_3A67F4                                         ; +0x5a, 0x3a66aa\nMOVS            R0, #0; int                                            ; +0x5c, 0x3a66ac\nLDR             R1, =(aMaxCustomObjec - 0x3A66BA); \"Max Custom Objects\" ; +0x5e, 0x3a66ae\nMOV             R2, R4; int                                            ; +0x60, 0x3a66b0\nSTR             R0, [SP,#0x18+var_18]; int                             ; +0x62, 0x3a66b2\nSTR             R3, [SP,#0x18+var_14]; float                           ; +0x64, 0x3a66b4\nADD             R1, PC; \"Max Custom Objects\"                           ; +0x66, 0x3a66b6\nLDR             R3, =(aOk - 0x3A66BE); \"OK\"                            ; +0x68, 0x3a66b8\nADD             R3, PC; \"OK\"                                           ; +0x6a, 0x3a66ba\nBL              _ZN12FLAlertLayer6createEP20FLAlertLayerProtocolPKcSsS3_S3_f; FLAlertLayer::create(FLAlertLayerProtocol *,char const*,std::string,char const*,char const*,float) ; +0x6c, 0x3a66bc\nMOV             R6, R0                                                 ; +0x70, 0x3a66c0\nMOV             R0, R4                                                 ; +0x72, 0x3a66c2\nBL              sub_774008                                             ; +0x74, 0x3a66c4\nLDR             R3, [R6]                                               ; +0x78, 0x3a66c8\nMOV             R0, R6                                                 ; +0x7a, 0x3a66ca\nLDR.W           R3, [R3,#0x284]                                        ; +0x7c, 0x3a66cc\nBLX             R3                                                     ; +0x80, 0x3a66d0\nB               loc_3A673A                                             ; +0x82, 0x3a66d2\nLDR.W           R3, [R4,#0x374]                                        ; +0x84, 0x3a66d4\nCMP             R3, #0                                                 ; +0x88, 0x3a66d8\nBNE             loc_3A675C                                             ; +0x8a, 0x3a66da\nLDR.W           R0, [R4,#0x260]; this                                  ; +0x8c, 0x3a66dc\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x90, 0x3a66e0\nCMP             R0, #0                                                 ; +0x94, 0x3a66e4\nBEQ             loc_3A67E2                                             ; +0x96, 0x3a66e6\nB               loc_3A675C                                             ; +0x98, 0x3a66e8\nLDR             R0, =(aACustomObjectC - 0x3A66F8); \"A custom object cannot contain more tha\"... ; +0x9a, 0x3a66ea\nMOV.W           R1, #stru_3DC.st_info; char *                          ; +0x9c, 0x3a66ec\nADD             R4, SP, #0x18+var_8                                    ; +0xa0, 0x3a66f0\nADD             R5, SP, #0x18+var_C                                    ; +0xa2, 0x3a66f2\nADD             R0, PC; \"A custom object cannot contain more tha\"...   ; +0xa4, 0x3a66f4\nBL              _ZN7cocos2d8CCString16createWithFormatEPKcz; cocos2d::CCString::createWithFormat(char const*,...) ; +0xa6, 0x3a66f6\nBL              _ZNK7cocos2d8CCString10getCStringEv; cocos2d::CCString::getCString(void) ; +0xaa, 0x3a66fa\nMOV             R2, R4                                                 ; +0xae, 0x3a66fe\nMOV             R1, R0; char *                                         ; +0xb0, 0x3a6700\nMOV             R0, R5; int                                            ; +0xb2, 0x3a6702\nBL              sub_776584                                             ; +0xb4, 0x3a6704\nMOV             R0, R4; int                                            ; +0xb8, 0x3a6708\nLDR             R1, [SP,#0x18+var_C]; char *                           ; +0xba, 0x3a670a\nADD             R2, SP, #0x18+var_10                                   ; +0xbc, 0x3a670c\nBL              sub_776584                                             ; +0xbe, 0x3a670e\nLDR             R3, flt_3A67F4                                         ; +0xc2, 0x3a6712\nMOVS            R0, #0; int                                            ; +0xc4, 0x3a6714\nLDR             R1, =(aMaxLimit - 0x3A6722); \"Max Limit\"               ; +0xc6, 0x3a6716\nMOV             R2, R4; int                                            ; +0xc8, 0x3a6718\nSTR             R0, [SP,#0x18+var_18]; int                             ; +0xca, 0x3a671a\nSTR             R3, [SP,#0x18+var_14]; float                           ; +0xcc, 0x3a671c\nADD             R1, PC; \"Max Limit\"                                    ; +0xce, 0x3a671e\nLDR             R3, =(aOk - 0x3A6726); \"OK\"                            ; +0xd0, 0x3a6720\nADD             R3, PC; \"OK\"                                           ; +0xd2, 0x3a6722\nBL              _ZN12FLAlertLayer6createEP20FLAlertLayerProtocolPKcSsS3_S3_f; FLAlertLayer::create(FLAlertLayerProtocol *,char const*,std::string,char const*,char const*,float) ; +0xd4, 0x3a6724\nMOV             R6, R0                                                 ; +0xd8, 0x3a6728\nMOV             R0, R4                                                 ; +0xda, 0x3a672a\nBL              sub_774008                                             ; +0xdc, 0x3a672c\nLDR             R3, [R6]                                               ; +0xe0, 0x3a6730\nMOV             R0, R6                                                 ; +0xe2, 0x3a6732\nLDR.W           R3, [R3,#0x284]                                        ; +0xe4, 0x3a6734\nBLX             R3                                                     ; +0xe8, 0x3a6738\nMOV             R0, R5                                                 ; +0xea, 0x3a673a\nBL              sub_774008                                             ; +0xec, 0x3a673c\nB               loc_3A67E2                                             ; +0xf0, 0x3a6740\nMOV             R0, R4                                                 ; +0xf2, 0x3a6742\nB               loc_3A674A                                             ; +0xf4, 0x3a6744\nB               loc_3A6750                                             ; +0xf6, 0x3a6746\nMOV             R0, R6                                                 ; +0xf8, 0x3a6748\nBL              sub_774008                                             ; +0xfa, 0x3a674a\nB               loc_3A6750                                             ; +0xfe, 0x3a674e\nMOV             R0, R5                                                 ; +0x100, 0x3a6750\nBL              sub_774008                                             ; +0x102, 0x3a6752\nBL              __cxa_end_cleanup                                      ; +0x106, 0x3a6756\nB               loc_3A6742                                             ; +0x10a, 0x3a675a\nLDR.W           R3, [R4,#0x374]                                        ; +0x10c, 0x3a675c\nCBZ             R3, loc_3A676E                                         ; +0x110, 0x3a6760\nLDR.W           R2, [R3,#0x374]                                        ; +0x112, 0x3a6762\nMOVW            R3, #0x2ED                                             ; +0x116, 0x3a6766\nCMP             R2, R3                                                 ; +0x11a, 0x3a676a\nBEQ             loc_3A67E2                                             ; +0x11c, 0x3a676c\nLDR.W           R0, [R4,#0x260]; this                                  ; +0x11e, 0x3a676e\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x122, 0x3a6772\nCBNZ            R0, loc_3A6788                                         ; +0x126, 0x3a6776\nBL              _ZN7cocos2d7CCArray6createEv; cocos2d::CCArray::create(void) ; +0x128, 0x3a6778\nLDR.W           R1, [R4,#0x374]; cocos2d::CCObject *                   ; +0x12c, 0x3a677c\nMOV             R6, R0                                                 ; +0x130, 0x3a6780\nBL              _ZN7cocos2d7CCArray9addObjectEPNS_8CCObjectE; cocos2d::CCArray::addObject(cocos2d::CCObject *) ; +0x132, 0x3a6782\nB               loc_3A678C                                             ; +0x136, 0x3a6786\nLDR.W           R6, [R4,#0x260]                                        ; +0x138, 0x3a6788\nADD             R5, SP, #0x18+var_C                                    ; +0x13c, 0x3a678c\nMOVS            R3, #0; bool                                           ; +0x13e, 0x3a678e\nMOV             R1, R4; cocos2d::CCArray *                             ; +0x140, 0x3a6790\nSTR             R3, [SP,#0x18+var_18]                                  ; +0x142, 0x3a6792\nMOV             R0, R5; this                                           ; +0x144, 0x3a6794\nMOV             R2, R6; bool                                           ; +0x146, 0x3a6796\nBL              _ZN8EditorUI11copyObjectsEPN7cocos2d7CCArrayEbb; EditorUI::copyObjects(cocos2d::CCArray *,bool,bool) ; +0x148, 0x3a6798\nLDR             R3, [SP,#0x18+var_C]                                   ; +0x14c, 0x3a679c\nLDR.W           R3, [R3,#-0xC]                                         ; +0x14e, 0x3a679e\nCMP             R3, #0                                                 ; +0x152, 0x3a67a2\nBEQ             loc_3A673A                                             ; +0x154, 0x3a67a4\nLDR.W           R0, [R4,#0x260]; this                                  ; +0x156, 0x3a67a6\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x15a, 0x3a67aa\nCMP.W           R0, #0x3E8                                             ; +0x15e, 0x3a67ae\nBHI             loc_3A673A                                             ; +0x162, 0x3a67b2\nBL              _ZN11GameManager11sharedStateEv; GameManager::sharedState(void) ; +0x164, 0x3a67b4\nADD             R6, SP, #0x18+var_8                                    ; +0x168, 0x3a67b8\nMOV             R8, R0                                                 ; +0x16a, 0x3a67ba\nMOV             R1, R5                                                 ; +0x16c, 0x3a67bc\nMOV             R0, R6                                                 ; +0x16e, 0x3a67be\nBL              sub_775C20                                             ; +0x170, 0x3a67c0\nMOV             R0, R8                                                 ; +0x174, 0x3a67c4\nMOV             R1, R6                                                 ; +0x176, 0x3a67c6\nBL              _ZN11GameManager18addNewCustomObjectESs; GameManager::addNewCustomObject(std::string) ; +0x178, 0x3a67c8\nMOV             R0, R6                                                 ; +0x17c, 0x3a67cc\nBL              sub_774008                                             ; +0x17e, 0x3a67ce\nMOVS            R3, #0                                                 ; +0x182, 0x3a67d2\nMOV             R0, R4; this                                           ; +0x184, 0x3a67d4\nSTR.W           R3, [R4,#0x32C]                                        ; +0x186, 0x3a67d6\nBL              _ZN8EditorUI17reloadCustomItemsEv; EditorUI::reloadCustomItems(void) ; +0x18a, 0x3a67da\nB               loc_3A673A                                             ; +0x18e, 0x3a67de\nB               loc_3A6750                                             ; +0x190, 0x3a67e0\nLDR             R2, [SP,#0x18+var_4]                                   ; +0x192, 0x3a67e2\nLDR             R3, [R7]                                               ; +0x194, 0x3a67e4\nCMP             R2, R3                                                 ; +0x196, 0x3a67e6\nBEQ             loc_3A67EE                                             ; +0x198, 0x3a67e8\nBLX             __stack_chk_fail                                       ; +0x19a, 0x3a67ea\nADD             SP, SP, #0x18                                          ; +0x19e, 0x3a67ee\nPOP.W           {R4-R8,PC}                                             ; +0x1a0, 0x3a67f0", "xrefs": [], "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"}