{"type": "func", "start": 5503168, "end": 5503440, "name": "BrowseSmartTemplateLayer::onTemplateObject", "pseudocode": "// \n// BrowseSmartTemplateLayer::onTemplateObject from 0x53f8c0 to 0x53f9d0 (272 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 BrowseSmartTemplateLayer::onTemplateObject(BrowseSmartTemplateLayer *a1, cocos2d::CCObject *a2)\n{\n  GJSmartTemplate *m_template; // r8\n  cocos2d::CCArray *Prefabs; // r8\n  GJSmartTemplate *v5; // r8\n  BrowseSmartTemplateLayer *v6; // r6\n  void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // r8\n  cocos2d::CCNode *v8; // r0\n  char v9; // [sp+14h] [bp-Ch] BYREF\n  std::string v10; // [sp+18h] [bp-8h] BYREF\n\n  a2->__vftable[13].~CCObject_0(a2);\n  m_template = a1->m_template;\n  sub_775C20(&v10);\n  Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs((int)m_template, &v10);\n  sub_774008(&v10);\n  if ( Prefabs && cocos2d::CCArray::count(Prefabs) )\n  {\n    BrowseSmartTemplateLayer::onClose(a1, nullptr);\n    v5 = a1->m_template;\n    sub_775C20(&v10);\n    v6 = BrowseSmartKeyLayer::create(v5, (int)&v10);\n    sub_774008(&v10);\n    v6[1].m_uID = a1->m_page;\n    v6->show(v6);\n  }\n  else\n  {\n    sub_775C20(&v10);\n    BrowseSmartTemplateLayer::createPrefab((int)a1, (int)&v10, 0);\n    sub_774008(&v10);\n    addChild_0 = a1->addChild_0;\n    sub_776584((int)&v9, \"Added to editor\");\n    sub_776584((int)&v10, (char *)&unk_939830);\n    v8 = TextAlertPopup::create((TextAlertPopup *)&v9, (std::string)1056964608, 0.6, 150, (int)&v10);\n    addChild_0(a1, v8, 100);\n    sub_774008(&v10);\n    sub_774008(&v9);\n  }\n}", "assembly": "; \n; BrowseSmartTemplateLayer::onTemplateObject from 0x53f8c0 to 0x53f9d0 (272 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\nPUSH.W          {R4-R8,LR}                                             ; +0x0, 0x53f8c0\nSUB             SP, SP, #0x20                                          ; +0x4, 0x53f8c4\nLDR             R7, =(__stack_chk_guard_ptr - 0x53F8D2)                ; +0x6, 0x53f8c6\nMOV             R5, R0                                                 ; +0x8, 0x53f8c8\nMOV             R0, R1                                                 ; +0xa, 0x53f8ca\nADD             R4, SP, #0x20+var_8                                    ; +0xc, 0x53f8cc\nADD             R7, PC; __stack_chk_guard_ptr                          ; +0xe, 0x53f8ce\nLDR             R7, [R7]; __stack_chk_guard                            ; +0x10, 0x53f8d0\nLDR             R3, [R7]                                               ; +0x12, 0x53f8d2\nSTR             R3, [SP,#0x20+var_4]                                   ; +0x14, 0x53f8d4\nLDR             R3, [R1]                                               ; +0x16, 0x53f8d6\nLDR.W           R3, [R3,#0x210]                                        ; +0x18, 0x53f8d8\nBLX             R3                                                     ; +0x1c, 0x53f8dc\nLDR.W           R8, [R5,#0x1F0]                                        ; +0x1e, 0x53f8de\nADD.W           R6, R0, #0x108                                         ; +0x22, 0x53f8e2\nMOV             R0, R4                                                 ; +0x26, 0x53f8e6\nMOV             R1, R6                                                 ; +0x28, 0x53f8e8\nBL              sub_775C20                                             ; +0x2a, 0x53f8ea\nMOV             R0, R8                                                 ; +0x2e, 0x53f8ee\nMOV             R1, R4                                                 ; +0x30, 0x53f8f0\nBL              _ZN15GJSmartTemplate10getPrefabsESs; GJSmartTemplate::getPrefabs(std::string) ; +0x32, 0x53f8f2\nMOV             R8, R0                                                 ; +0x36, 0x53f8f6\nMOV             R0, R4                                                 ; +0x38, 0x53f8f8\nBL              sub_774008                                             ; +0x3a, 0x53f8fa\nCMP.W           R8, #0                                                 ; +0x3e, 0x53f8fe\nBEQ             loc_53F952                                             ; +0x42, 0x53f902\nMOV             R0, R8; this                                           ; +0x44, 0x53f904\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x46, 0x53f906\nCBNZ            R0, loc_53F91A                                         ; +0x4a, 0x53f90a\nB               loc_53F952                                             ; +0x4c, 0x53f90c\nB               loc_53F910                                             ; +0x4e, 0x53f90e\nMOV             R0, R4                                                 ; +0x50, 0x53f910\nBL              sub_774008                                             ; +0x52, 0x53f912\nBL              __cxa_end_cleanup                                      ; +0x56, 0x53f916\nMOV             R0, R5; this                                           ; +0x5a, 0x53f91a\nMOVS            R1, #0; cocos2d::CCObject *                            ; +0x5c, 0x53f91c\nBL              _ZN24BrowseSmartTemplateLayer7onCloseEPN7cocos2d8CCObjectE; BrowseSmartTemplateLayer::onClose(cocos2d::CCObject *) ; +0x5e, 0x53f91e\nLDR.W           R8, [R5,#0x1F0]                                        ; +0x62, 0x53f922\nMOV             R1, R6                                                 ; +0x66, 0x53f926\nMOV             R0, R4                                                 ; +0x68, 0x53f928\nBL              sub_775C20                                             ; +0x6a, 0x53f92a\nMOV             R1, R4                                                 ; +0x6e, 0x53f92e\nMOV             R0, R8                                                 ; +0x70, 0x53f930\nBL              _ZN19BrowseSmartKeyLayer6createEP15GJSmartTemplateSs; BrowseSmartKeyLayer::create(GJSmartTemplate *,std::string) ; +0x72, 0x53f932\nMOV             R6, R0                                                 ; +0x76, 0x53f936\nMOV             R0, R4                                                 ; +0x78, 0x53f938\nBL              sub_774008                                             ; +0x7a, 0x53f93a\nLDR.W           R3, [R5,#0x1F8]                                        ; +0x7e, 0x53f93e\nMOV             R0, R6                                                 ; +0x82, 0x53f942\nSTR.W           R3, [R6,#0x20C]                                        ; +0x84, 0x53f944\nLDR             R3, [R6]                                               ; +0x88, 0x53f948\nLDR.W           R3, [R3,#0x284]                                        ; +0x8a, 0x53f94a\nBLX             R3                                                     ; +0x8e, 0x53f94e\nB               loc_53F9BE                                             ; +0x90, 0x53f950\nMOV             R1, R6                                                 ; +0x92, 0x53f952\nMOV             R0, R4                                                 ; +0x94, 0x53f954\nBL              sub_775C20                                             ; +0x96, 0x53f956\nMOV             R0, R5                                                 ; +0x9a, 0x53f95a\nMOV             R1, R4                                                 ; +0x9c, 0x53f95c\nMOVS            R2, #0                                                 ; +0x9e, 0x53f95e\nBL              _ZN24BrowseSmartTemplateLayer12createPrefabESsi; BrowseSmartTemplateLayer::createPrefab(std::string,int) ; +0xa0, 0x53f960\nMOV             R0, R4                                                 ; +0xa4, 0x53f964\nADD             R6, SP, #0x20+var_C                                    ; +0xa6, 0x53f966\nBL              sub_774008                                             ; +0xa8, 0x53f968\nLDR             R3, [R5]                                               ; +0xac, 0x53f96c\nLDR             R1, =(aAddedToEditor - 0x53F978); \"Added to editor\"    ; +0xae, 0x53f96e\nADD             R2, SP, #0x20+var_14                                   ; +0xb0, 0x53f970\nMOV             R0, R6; int                                            ; +0xb2, 0x53f972\nADD             R1, PC; \"Added to editor\"                              ; +0xb4, 0x53f974\nLDR.W           R8, [R3,#0xE0]                                         ; +0xb6, 0x53f976\nBL              sub_776584                                             ; +0xba, 0x53f97a\nLDR             R1, =(unk_939830 - 0x53F988)                           ; +0xbe, 0x53f97e\nMOV             R0, R4; int                                            ; +0xc0, 0x53f980\nADD             R2, SP, #0x20+var_10                                   ; +0xc2, 0x53f982\nADD             R1, PC; unk_939830 ; char *                            ; +0xc4, 0x53f984\nBL              sub_776584                                             ; +0xc6, 0x53f986\nSTR             R4, [SP,#0x20+var_20]                                  ; +0xca, 0x53f98a\nMOV             R0, R6                                                 ; +0xcc, 0x53f98c\nMOV.W           R1, #0x3F000000                                        ; +0xce, 0x53f98e\nLDR             R2, =0x3F19999A                                        ; +0xd2, 0x53f992\nMOVS            R3, #0x96                                              ; +0xd4, 0x53f994\nBL              _ZN14TextAlertPopup6createESsffiSs; TextAlertPopup::create(std::string,float,float,int,std::string) ; +0xd6, 0x53f996\nMOV             R1, R0                                                 ; +0xda, 0x53f99a\nMOVS            R2, #0x64 ; 'd'                                        ; +0xdc, 0x53f99c\nMOV             R0, R5                                                 ; +0xde, 0x53f99e\nBLX             R8                                                     ; +0xe0, 0x53f9a0\nMOV             R0, R4                                                 ; +0xe2, 0x53f9a2\nBL              sub_774008                                             ; +0xe4, 0x53f9a4\nMOV             R0, R6                                                 ; +0xe8, 0x53f9a8\nBL              sub_774008                                             ; +0xea, 0x53f9aa\nB               loc_53F9BE                                             ; +0xee, 0x53f9ae\nB               loc_53F910                                             ; +0xf0, 0x53f9b0\nMOV             R0, R4                                                 ; +0xf2, 0x53f9b2\nBL              sub_774008                                             ; +0xf4, 0x53f9b4\nB               loc_53F9BA                                             ; +0xf8, 0x53f9b8\nMOV             R0, R6                                                 ; +0xfa, 0x53f9ba\nB               loc_53F912                                             ; +0xfc, 0x53f9bc\nLDR             R2, [SP,#0x20+var_4]                                   ; +0xfe, 0x53f9be\nLDR             R3, [R7]                                               ; +0x100, 0x53f9c0\nCMP             R2, R3                                                 ; +0x102, 0x53f9c2\nBEQ             loc_53F9CA                                             ; +0x104, 0x53f9c4\nBLX             __stack_chk_fail                                       ; +0x106, 0x53f9c6\nADD             SP, SP, #0x20 ; ' '                                    ; +0x10a, 0x53f9ca\nPOP.W           {R4-R8,PC}                                             ; +0x10c, 0x53f9cc", "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"}