{"type": "func", "start": 4739100, "end": 4739558, "name": "EditorUI::findSnapObject", "pseudocode": "// \n// EditorUI::findSnapObject from 0x48501c to 0x4851e6 (458 bytes)\n// \n// 1 xrefs:\n// > EditorUI::findSnapObject @ 0x48528a\n// \n// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:49:24 +0000\n// \n\nunsigned int __fastcall EditorUI::findSnapObject(EditorUI *this, cocos2d::CCArray *a2, float a3)\n{\n  float v6; // s18\n  unsigned int i; // r6\n  unsigned int result; // r0\n  GameObject *v9; // r9\n  float v10; // r1\n  float v11; // r2\n  int v12; // r3\n  float v13; // s15\n  float v14; // s16\n  float v15; // s16\n  int v16; // r0\n  int v17; // r1\n  int v18; // r9\n  float v19; // [sp+14h] [bp-20h] BYREF\n  float v20; // [sp+18h] [bp-1Ch]\n  float v21; // [sp+1Ch] [bp-18h] BYREF\n  float v22; // [sp+20h] [bp-14h]\n  float v23[2]; // [sp+24h] [bp-10h] BYREF\n\n  if ( a2 && cocos2d::CCArray::count(a2) )\n  {\n    v6 = 999.0;\n    for ( i = 0; ; ++i )\n    {\n      result = cocos2d::CCArray::count(a2);\n      if ( i >= result )\n        break;\n      v9 = (GameObject *)cocos2d::CCArray::objectAtIndex(a2, i);\n      GameObject::updateStartPos(v9, v10, v11, v12);\n      EditorUI::positionWithoutOffset((EditorUI *)&v21, this);\n      cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&flt_D2B938);\n      EditorUI::applySpecialOffset(&v19, this, &v21, v9, v23);\n      cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&v19);\n      result = EditorUI::getGridSnappedPos((int)&v21, (int)this, v23);\n      v13 = fabsf(v21 - v19);\n      v14 = fabsf(v22 - v20);\n      if ( a3 <= 0.0 || v13 <= a3 && v14 <= a3 )\n      {\n        v15 = v13 + v14;\n        if ( v15 < v6 )\n        {\n          *((_DWORD *)this + 250) = v9;\n          result = EditorUI::shouldSnap(this, v9);\n          if ( result )\n            v6 = v15;\n        }\n      }\n      if ( v6 == 0.0 )\n        break;\n    }\n  }\n  else\n  {\n    result = *((_DWORD *)this + 249);\n    if ( result )\n    {\n      v16 = (int)(*(float (__fastcall **)(unsigned int))(*(_DWORD *)result + 184))(result);\n      v17 = v16 % 90;\n      result = v16 / 90;\n      if ( !v17 )\n      {\n        EditorUI::positionWithoutOffset((EditorUI *)&v21, this);\n        v18 = *((_DWORD *)this + 249);\n        cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&flt_D2B938);\n        EditorUI::applySpecialOffset(&v19, this, &v21, v18, v23);\n        cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&v19);\n        result = EditorUI::getGridSnappedPos((int)&v21, (int)this, v23);\n        if ( a3 <= 0.0 || fabsf(v21 - v19) <= a3 && fabsf(v22 - v20) <= a3 )\n          *((_DWORD *)this + 250) = *((_DWORD *)this + 249);\n      }\n    }\n  }\n  return result;\n}", "assembly": "; \n; EditorUI::findSnapObject from 0x48501c to 0x4851e6 (458 bytes)\n; \n; 1 xrefs:\n; > EditorUI::findSnapObject @ 0x48528a\n; \n; This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:49:24 +0000\n; \nPUSH.W          {R4-R11,LR}                                            ; +0x0, 0x48501c\nMOV             R4, R0                                                 ; +0x4, 0x485020\nVPUSH           {D8-D9}                                                ; +0x6, 0x485022\nMOV             R7, R1                                                 ; +0xa, 0x485026\nLDR             R5, =(__stack_chk_guard_ptr - 0x48502E)                ; +0xc, 0x485028\nADD             R5, PC; __stack_chk_guard_ptr                          ; +0xe, 0x48502a\nLDR             R5, [R5]; __stack_chk_guard                            ; +0x10, 0x48502c\nVMOV            S17, R2                                                ; +0x12, 0x48502e\nSUB             SP, SP, #0x34                                          ; +0x16, 0x485032\nLDR             R3, [R5]                                               ; +0x18, 0x485034\nSTR             R3, [SP,#0x34+var_8]                                   ; +0x1a, 0x485036\nCMP             R1, #0                                                 ; +0x1c, 0x485038\nBEQ             loc_485122                                             ; +0x1e, 0x48503a\nMOV             R0, R1; this                                           ; +0x20, 0x48503c\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x22, 0x48503e\nCMP             R0, #0                                                 ; +0x26, 0x485042\nBEQ             loc_485122                                             ; +0x28, 0x485044\nLDR.W           R11, =(flt_D2B938 - 0x48505A)                          ; +0x2a, 0x485046\nADD.W           R10, SP, #0x34+var_18                                  ; +0x2e, 0x48504a\nVLDR            S18, =999.0                                            ; +0x32, 0x48504e\nADD.W           R8, SP, #0x34+var_10                                   ; +0x36, 0x485052\nADD             R11, PC; flt_D2B938                                    ; +0x3a, 0x485056\nMOVS            R6, #0                                                 ; +0x3c, 0x485058\nMOV             R0, R7; this                                           ; +0x3e, 0x48505a\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x40, 0x48505c\nCMP             R6, R0                                                 ; +0x44, 0x485060\nBCS.W           loc_4851D0                                             ; +0x46, 0x485062\nMOV             R1, R6; unsigned int                                   ; +0x4a, 0x485066\nMOV             R0, R7; this                                           ; +0x4c, 0x485068\nBL              _ZN7cocos2d7CCArray13objectAtIndexEj; cocos2d::CCArray::objectAtIndex(uint) ; +0x4e, 0x48506a\nMOV             R9, R0                                                 ; +0x52, 0x48506e\nBL              _ZN10GameObject14updateStartPosEv; GameObject::updateStartPos(void) ; +0x54, 0x485070\nMOV             R2, R9                                                 ; +0x58, 0x485074\nMOV             R0, R10; this                                          ; +0x5a, 0x485076\nMOV             R1, R4; GameObject *                                   ; +0x5c, 0x485078\nBL              _ZN8EditorUI21positionWithoutOffsetEP10GameObject; EditorUI::positionWithoutOffset(GameObject *) ; +0x5e, 0x48507a\nMOV             R1, R11; cocos2d::CCPoint *                            ; +0x62, 0x48507e\nMOV             R0, R8; this                                           ; +0x64, 0x485080\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x66, 0x485082\nADD.W           R12, SP, #0x34+var_20                                  ; +0x6a, 0x485086\nMOV             R2, R10                                                ; +0x6e, 0x48508a\nMOV             R3, R9                                                 ; +0x70, 0x48508c\nMOV             R0, R12                                                ; +0x72, 0x48508e\nMOV             R1, R4                                                 ; +0x74, 0x485090\nSTR.W           R8, [SP,#0x34+var_34]                                  ; +0x76, 0x485092\nSTR.W           R12, [SP,#0x34+var_28]                                 ; +0x7a, 0x485096\nBL              _ZN8EditorUI18applySpecialOffsetEN7cocos2d7CCPointEP10GameObjectS1_; EditorUI::applySpecialOffset(cocos2d::CCPoint,GameObject *,cocos2d::CCPoint) ; +0x7e, 0x48509a\nLDR.W           R12, [SP,#0x34+var_28]                                 ; +0x82, 0x48509e\nMOV             R0, R8; this                                           ; +0x86, 0x4850a2\nMOV             R1, R12; cocos2d::CCPoint *                            ; +0x88, 0x4850a4\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x8a, 0x4850a6\nMOV             R0, R10                                                ; +0x8e, 0x4850aa\nMOV             R1, R4                                                 ; +0x90, 0x4850ac\nMOV             R2, R8                                                 ; +0x92, 0x4850ae\nBL              _ZN8EditorUI17getGridSnappedPosEN7cocos2d7CCPointE; EditorUI::getGridSnappedPos(cocos2d::CCPoint) ; +0x94, 0x4850b0\nVLDR            S14, [SP,#0x34+var_20]                                 ; +0x98, 0x4850b4\nVLDR            S15, [SP,#0x34+var_18]                                 ; +0x9c, 0x4850b8\nVLDR            S16, [SP,#0x34+var_1C]                                 ; +0xa0, 0x4850bc\nVSUB.F32        S15, S15, S14                                          ; +0xa4, 0x4850c0\nVLDR            S14, [SP,#0x34+var_14]                                 ; +0xa8, 0x4850c4\nVSUB.F32        S16, S14, S16                                          ; +0xac, 0x4850c8\nVCMPE.F32       S17, #0.0                                              ; +0xb0, 0x4850cc\nVABS.F32        S15, S15                                               ; +0xb4, 0x4850d0\nVMRS            APSR_nzcv, FPSCR                                       ; +0xb8, 0x4850d4\nVABS.F32        S16, S16                                               ; +0xbc, 0x4850d8\nBLS             loc_4850F2                                             ; +0xc0, 0x4850dc\nVCMPE.F32       S15, S17                                               ; +0xc2, 0x4850de\nVMRS            APSR_nzcv, FPSCR                                       ; +0xc6, 0x4850e2\nBHI             loc_485114                                             ; +0xca, 0x4850e6\nVCMPE.F32       S16, S17                                               ; +0xcc, 0x4850e8\nVMRS            APSR_nzcv, FPSCR                                       ; +0xd0, 0x4850ec\nBHI             loc_485114                                             ; +0xd4, 0x4850f0\nVADD.F32        S16, S15, S16                                          ; +0xd6, 0x4850f2\nVCMPE.F32       S16, S18                                               ; +0xda, 0x4850f6\nVMRS            APSR_nzcv, FPSCR                                       ; +0xde, 0x4850fa\nBPL             loc_485114                                             ; +0xe2, 0x4850fe\nSTR.W           R9, [R4,#0x3E8]                                        ; +0xe4, 0x485100\nMOV             R0, R4; this                                           ; +0xe8, 0x485104\nMOV             R1, R9; GameObject *                                   ; +0xea, 0x485106\nBL              _ZN8EditorUI10shouldSnapEP10GameObject; EditorUI::shouldSnap(GameObject *) ; +0xec, 0x485108\nCMP             R0, #0                                                 ; +0xf0, 0x48510c\nIT NE                                                                  ; +0xf2, 0x48510e\nVMOVNE.F32      S18, S16                                               ; +0xf4, 0x485110\nVCMP.F32        S18, #0.0                                              ; +0xf8, 0x485114\nVMRS            APSR_nzcv, FPSCR                                       ; +0xfc, 0x485118\nBEQ             loc_4851D0                                             ; +0x100, 0x48511c\nADDS            R6, #1                                                 ; +0x102, 0x48511e\nB               loc_48505A                                             ; +0x104, 0x485120\nLDR.W           R0, [R4,#0x3E4]                                        ; +0x106, 0x485122\nCMP             R0, #0                                                 ; +0x10a, 0x485126\nBEQ             loc_4851D0                                             ; +0x10c, 0x485128\nLDR             R3, [R0]                                               ; +0x10e, 0x48512a\nLDR.W           R3, [R3,#0xB8]                                         ; +0x110, 0x48512c\nBLX             R3                                                     ; +0x114, 0x485130\nMOVS            R1, #0x5A ; 'Z'                                        ; +0x116, 0x485132\nVMOV            S15, R0                                                ; +0x118, 0x485134\nVCVT.S32.F32    S15, S15                                               ; +0x11c, 0x485138\nVMOV            R0, S15                                                ; +0x120, 0x48513c\nBLX             __aeabi_idivmod                                        ; +0x124, 0x485140\nCMP             R1, #0                                                 ; +0x128, 0x485144\nBNE             loc_4851D0                                             ; +0x12a, 0x485146\nADD.W           R8, SP, #0x34+var_18                                   ; +0x12c, 0x485148\nLDR.W           R2, [R4,#0x3E4]                                        ; +0x130, 0x48514c\nMOV             R1, R4; GameObject *                                   ; +0x134, 0x485150\nADD             R6, SP, #0x34+var_10                                   ; +0x136, 0x485152\nMOV             R0, R8; this                                           ; +0x138, 0x485154\nADD             R7, SP, #0x34+var_20                                   ; +0x13a, 0x485156\nBL              _ZN8EditorUI21positionWithoutOffsetEP10GameObject; EditorUI::positionWithoutOffset(GameObject *) ; +0x13c, 0x485158\nLDR.W           R9, [R4,#0x3E4]                                        ; +0x140, 0x48515c\nLDR             R1, =(flt_D2B938 - 0x485168)                           ; +0x144, 0x485160\nMOV             R0, R6; this                                           ; +0x146, 0x485162\nADD             R1, PC; flt_D2B938 ; cocos2d::CCPoint *                ; +0x148, 0x485164\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x14a, 0x485166\nMOV             R2, R8                                                 ; +0x14e, 0x48516a\nMOV             R3, R9                                                 ; +0x150, 0x48516c\nMOV             R0, R7                                                 ; +0x152, 0x48516e\nMOV             R1, R4                                                 ; +0x154, 0x485170\nSTR             R6, [SP,#0x34+var_34]                                  ; +0x156, 0x485172\nBL              _ZN8EditorUI18applySpecialOffsetEN7cocos2d7CCPointEP10GameObjectS1_; EditorUI::applySpecialOffset(cocos2d::CCPoint,GameObject *,cocos2d::CCPoint) ; +0x158, 0x485174\nMOV             R1, R7; cocos2d::CCPoint *                             ; +0x15c, 0x485178\nMOV             R0, R6; this                                           ; +0x15e, 0x48517a\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x160, 0x48517c\nMOV             R0, R8                                                 ; +0x164, 0x485180\nMOV             R1, R4                                                 ; +0x166, 0x485182\nMOV             R2, R6                                                 ; +0x168, 0x485184\nBL              _ZN8EditorUI17getGridSnappedPosEN7cocos2d7CCPointE; EditorUI::getGridSnappedPos(cocos2d::CCPoint) ; +0x16a, 0x485186\nVCMPE.F32       S17, #0.0                                              ; +0x16e, 0x48518a\nVMRS            APSR_nzcv, FPSCR                                       ; +0x172, 0x48518e\nBLS             loc_4851C8                                             ; +0x176, 0x485192\nVLDR            S14, [SP,#0x34+var_20]                                 ; +0x178, 0x485194\nVLDR            S15, [SP,#0x34+var_18]                                 ; +0x17c, 0x485198\nVSUB.F32        S15, S15, S14                                          ; +0x180, 0x48519c\nVABS.F32        S15, S15                                               ; +0x184, 0x4851a0\nVCMPE.F32       S15, S17                                               ; +0x188, 0x4851a4\nVMRS            APSR_nzcv, FPSCR                                       ; +0x18c, 0x4851a8\nBHI             loc_4851D0                                             ; +0x190, 0x4851ac\nVLDR            S14, [SP,#0x34+var_1C]                                 ; +0x192, 0x4851ae\nVLDR            S15, [SP,#0x34+var_14]                                 ; +0x196, 0x4851b2\nVSUB.F32        S15, S15, S14                                          ; +0x19a, 0x4851b6\nVABS.F32        S15, S15                                               ; +0x19e, 0x4851ba\nVCMPE.F32       S15, S17                                               ; +0x1a2, 0x4851be\nVMRS            APSR_nzcv, FPSCR                                       ; +0x1a6, 0x4851c2\nBHI             loc_4851D0                                             ; +0x1aa, 0x4851c6\nLDR.W           R3, [R4,#0x3E4]                                        ; +0x1ac, 0x4851c8\nSTR.W           R3, [R4,#0x3E8]                                        ; +0x1b0, 0x4851cc\nLDR             R2, [SP,#0x34+var_8]                                   ; +0x1b4, 0x4851d0\nLDR             R3, [R5]                                               ; +0x1b6, 0x4851d2\nCMP             R2, R3                                                 ; +0x1b8, 0x4851d4\nBEQ             loc_4851DC                                             ; +0x1ba, 0x4851d6\nBLX             __stack_chk_fail                                       ; +0x1bc, 0x4851d8\nADD             SP, SP, #0x34 ; '4'                                    ; +0x1c0, 0x4851dc\nVPOP            {D8-D9}                                                ; +0x1c2, 0x4851de\nPOP.W           {R4-R11,PC}                                            ; +0x1c6, 0x4851e2", "xrefs": ["EditorUI::findSnapObject @ 0x48528a"], "is_objc": false, "is_32_bit": true, "is_64_bit": false, "idp_name": "arm", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}