{"type": "func", "start": 4299318592, "end": 4299319172, "name": "GJSmartTemplate::smartObjectToType", "pseudocode": "// \n// GJSmartTemplate::smartObjectToType from 0x100426540 to 0x100426784 (580 bytes)\n// \n// 11 xrefs:\n// > EditorUI::addObjectsToSmartTemplate @ 0x10004145f\n// > GJSmartTemplate::keyFromNeighbors @ 0x100425f97\n// > GJSmartTemplate::keyFromNeighbors @ 0x100425ff9\n// > GJSmartTemplate::keyFromNeighbors @ 0x100426063\n// > GJSmartTemplate::keyFromNeighbors @ 0x1004260ca\n// > GJSmartTemplate::keyFromNeighbors @ 0x100426126\n// > GJSmartTemplate::keyFromNeighbors @ 0x10042618d\n// > GJSmartTemplate::keyFromNeighbors @ 0x1004261ea\n// > GJSmartTemplate::keyFromNeighbors @ 0x10042624a\n// > GJSmartTemplate::keyFromNeighbors @ 0x1004262aa\n// > GJSmartTemplate::offsetForObject @ 0x10042650e\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// local variable allocation has failed, the output may be wrong!\nSmartBlockType __fastcall GJSmartTemplate::smartObjectToType(SmartGameObject *a1, cocos2d::CCPoint a2)\n{\n  float *v2; // rsi\n  SmartBlockType v3; // ebx\n  int m_objectID; // eax\n  unsigned __int64 m_slopeDirection; // rax\n  __m128 v6; // xmm0\n  __m128 v7; // xmm0\n  char v8; // cl\n  float v10; // [rsp+0h] [rbp-1Ch]\n  float v11; // [rsp+0h] [rbp-1Ch]\n  float v12; // [rsp+0h] [rbp-1Ch]\n  float v13; // [rsp+0h] [rbp-1Ch]\n\n  v3 = 48;\n  if ( a1 )\n  {\n    m_objectID = a1->m_objectID;\n    switch ( m_objectID )\n    {\n      case 2897:\n        *(double *)v6.i64 = ((double (__fastcall *)(SmartGameObject *, double))a1->getRotation)(a1, *(double *)&a2);\n        v7 = _mm_and_ps(v6, (__m128)xmmword_100815500);\n        v8 = _mm_cvtsi128_si32((__m128i)_mm_or_ps(\n                                          _mm_cmpeq_ps((__m128)0x42B40000u, v7),\n                                          _mm_cmpeq_ps((__m128)0x43870000u, v7)));\n        switch ( a1->m_slopeDirection )\n        {\n          case 0:\n          case 7:\n            v3 = WideSlope1;\n            if ( (v8 & 1) != 0 )\n              v3 = WideSlope9;\n            break;\n          case 1:\n          case 5:\n            v3 = 8 * (v8 & 1) + 65;\n            break;\n          case 2:\n          case 4:\n            v3 = WideSlope3;\n            if ( (v8 & 1) != 0 )\n              v3 = WideSlope11;\n            break;\n          case 3:\n          case 6:\n            v3 = 8 * (v8 & 1) + 67;\n            break;\n          default:\n            goto LABEL_17;\n        }\n        break;\n      case 2896:\n        m_slopeDirection = (unsigned int)a1->m_slopeDirection;\n        if ( m_slopeDirection < 8 )\n          v3 = *(_DWORD *)&a2_2[4 * m_slopeDirection];\n        break;\n      case 2895:\n        v3 = Block;\n        break;\n    }\n  }\nLABEL_17:\n  if ( !sub_10028CDB0(v2, (float *)&dbl_1009A15B8) )\n  {\n    switch ( v3 )\n    {\n      case WideSlope1:\n      case WideSlope5:\n        v10 = *v2;\n        if ( v10 > *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) )\n        {\n          if ( v3 == WideSlope5 )\n          {\n            v3 = WideSlope6;\n          }\n          else if ( v3 == WideSlope1 )\n          {\n            v3 = WideSlope2;\n          }\n        }\n        break;\n      case WideSlope3:\n      case WideSlope7:\n        v13 = *v2;\n        if ( *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) > v13 )\n        {\n          if ( v3 == WideSlope7 )\n          {\n            v3 = WideSlope8;\n          }\n          else if ( v3 == WideSlope3 )\n          {\n            v3 = WideSlope4;\n          }\n        }\n        break;\n      case WideSlope9:\n      case WideSlope11:\n        v12 = v2[1];\n        if ( *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) > v12 )\n        {\n          if ( v3 == WideSlope11 )\n          {\n            v3 = WideSlope12;\n          }\n          else if ( v3 == WideSlope9 )\n          {\n            v3 = WideSlope10;\n          }\n        }\n        break;\n      case WideSlope13:\n      case WideSlope15:\n        v11 = v2[1];\n        if ( v11 > *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) )\n        {\n          if ( v3 == WideSlope15 )\n          {\n            v3 = WideSlope16;\n          }\n          else if ( v3 == WideSlope13 )\n          {\n            v3 = WideSlope14;\n          }\n        }\n        break;\n      default:\n        return v3;\n    }\n  }\n  return v3;\n}", "assembly": "; \n; GJSmartTemplate::smartObjectToType from 0x100426540 to 0x100426784 (580 bytes)\n; \n; 11 xrefs:\n; > EditorUI::addObjectsToSmartTemplate @ 0x10004145f\n; > GJSmartTemplate::keyFromNeighbors @ 0x100425f97\n; > GJSmartTemplate::keyFromNeighbors @ 0x100425ff9\n; > GJSmartTemplate::keyFromNeighbors @ 0x100426063\n; > GJSmartTemplate::keyFromNeighbors @ 0x1004260ca\n; > GJSmartTemplate::keyFromNeighbors @ 0x100426126\n; > GJSmartTemplate::keyFromNeighbors @ 0x10042618d\n; > GJSmartTemplate::keyFromNeighbors @ 0x1004261ea\n; > GJSmartTemplate::keyFromNeighbors @ 0x10042624a\n; > GJSmartTemplate::keyFromNeighbors @ 0x1004262aa\n; > GJSmartTemplate::offsetForObject @ 0x10042650e\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    rbp                                                            ; +0x0, 0x100426540\nmov     rbp, rsp                                                       ; +0x1, 0x100426541\npush    r15                                                            ; +0x4, 0x100426544\npush    r14                                                            ; +0x6, 0x100426546\npush    rbx                                                            ; +0x8, 0x100426548\npush    rax                                                            ; +0x9, 0x100426549\nmov     r15, rsi                                                       ; +0xa, 0x10042654a\nmov     r14, rdi                                                       ; +0xd, 0x10042654d\nmov     ebx, 30h ; '0'                                                 ; +0x10, 0x100426550\ntest    rdi, rdi                                                       ; +0x15, 0x100426555\njz      def_1004265F5; jumptable 00000001004265F5 default case         ; +0x18, 0x100426558\nmov     eax, [r14+404h]                                                ; +0x1e, 0x10042655e\ncmp     eax, 0B51h                                                     ; +0x25, 0x100426565\njz      short loc_1004265A8                                            ; +0x2a, 0x10042656a\ncmp     eax, 0B50h                                                     ; +0x2c, 0x10042656c\njz      short loc_100426588                                            ; +0x31, 0x100426571\ncmp     eax, 0B4Fh                                                     ; +0x33, 0x100426573\njnz     def_1004265F5; jumptable 00000001004265F5 default case         ; +0x38, 0x100426578\nmov     ebx, 31h ; '1'                                                 ; +0x3e, 0x10042657e\njmp     def_1004265F5; jumptable 00000001004265F5 default case         ; +0x43, 0x100426583\nmov     eax, [r14+43Ch]                                                ; +0x48, 0x100426588\ncmp     rax, 8                                                         ; +0x4f, 0x10042658f\njnb     def_1004265F5; jumptable 00000001004265F5 default case         ; +0x53, 0x100426593\nlea     rcx, a2_2; \"2\"                                                 ; +0x59, 0x100426599\nmov     ebx, [rcx+rax*4]                                               ; +0x60, 0x1004265a0\njmp     def_1004265F5; jumptable 00000001004265F5 default case         ; +0x63, 0x1004265a3\nmov     rax, [r14]                                                     ; +0x68, 0x1004265a8\nmov     rdi, r14                                                       ; +0x6b, 0x1004265ab\ncall    qword ptr [rax+160h]                                           ; +0x6e, 0x1004265ae\nmov     eax, [r14+43Ch]                                                ; +0x74, 0x1004265b4\ncmp     rax, 7; switch 8 cases                                         ; +0x7b, 0x1004265bb\nja      short def_1004265F5; jumptable 00000001004265F5 default case   ; +0x7f, 0x1004265bf\nandps   xmm0, cs:xmmword_100815500                                     ; +0x81, 0x1004265c1\nmovss   xmm1, cs:dword_100815414                                       ; +0x88, 0x1004265c8\ncmpeqps xmm1, xmm0                                                     ; +0x90, 0x1004265d0\nmovss   xmm2, cs:dword_100815038                                       ; +0x94, 0x1004265d4\ncmpeqps xmm2, xmm0                                                     ; +0x9c, 0x1004265dc\norps    xmm2, xmm1                                                     ; +0xa0, 0x1004265e0\nmovd    ecx, xmm2                                                      ; +0xa3, 0x1004265e3\nlea     rdx, jpt_1004265F5                                             ; +0xa7, 0x1004265e7\nmovsxd  rax, (jpt_1004265F5 - 100426784h)[rdx+rax*4]                   ; +0xae, 0x1004265ee\nadd     rax, rdx                                                       ; +0xb2, 0x1004265f2\njmp     rax; switch jump                                               ; +0xb5, 0x1004265f5\ntest    cl, 1; jumptable 00000001004265F5 cases 0,7                    ; +0xb7, 0x1004265f7\nmov     eax, 45h ; 'E'                                                 ; +0xba, 0x1004265fa\nmov     ebx, 36h ; '6'                                                 ; +0xbf, 0x1004265ff\ncmovnz  ebx, eax                                                       ; +0xc4, 0x100426604\njmp     short def_1004265F5; jumptable 00000001004265F5 default case   ; +0xc7, 0x100426607\ntest    cl, 1; jumptable 00000001004265F5 cases 2,4                    ; +0xc9, 0x100426609\nmov     eax, 47h ; 'G'                                                 ; +0xcc, 0x10042660c\nmov     ebx, 38h ; '8'                                                 ; +0xd1, 0x100426611\ncmovnz  ebx, eax                                                       ; +0xd6, 0x100426616\njmp     short def_1004265F5; jumptable 00000001004265F5 default case   ; +0xd9, 0x100426619\nmovzx   eax, cl; jumptable 00000001004265F5 cases 3,6                  ; +0xdb, 0x10042661b\nand     eax, 1                                                         ; +0xde, 0x10042661e\nlea     ebx, ds:43h[rax*8]                                             ; +0xe1, 0x100426621\njmp     short def_1004265F5; jumptable 00000001004265F5 default case   ; +0xe8, 0x100426628\nmovzx   eax, cl; jumptable 00000001004265F5 cases 1,5                  ; +0xea, 0x10042662a\nand     eax, 1                                                         ; +0xed, 0x10042662d\nlea     ebx, ds:41h[rax*8]                                             ; +0xf0, 0x100426630\nlea     rsi, dbl_1009A15B8; jumptable 00000001004265F5 default case    ; +0xf7, 0x100426637\nmov     rdi, r15                                                       ; +0xfe, 0x10042663e\ncall    sub_10028CDB0                                                  ; +0x101, 0x100426641\ntest    al, al                                                         ; +0x106, 0x100426646\njz      short loc_100426657                                            ; +0x108, 0x100426648\nmov     eax, ebx; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x10a, 0x10042664a\nadd     rsp, 8                                                         ; +0x10c, 0x10042664c\npop     rbx                                                            ; +0x110, 0x100426650\npop     r14                                                            ; +0x111, 0x100426651\npop     r15                                                            ; +0x113, 0x100426653\npop     rbp                                                            ; +0x115, 0x100426655\nretn                                                                   ; +0x116, 0x100426656\nlea     eax, [rbx-36h]; switch 22 cases                                ; +0x117, 0x100426657\ncmp     eax, 15h                                                       ; +0x11a, 0x10042665a\nja      short def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x11d, 0x10042665d\nlea     rcx, jpt_10042666D                                             ; +0x11f, 0x10042665f\nmovsxd  rax, (jpt_10042666D - 1004267A4h)[rcx+rax*4]                   ; +0x126, 0x100426666\nadd     rax, rcx                                                       ; +0x12a, 0x10042666a\njmp     rax; switch jump                                               ; +0x12d, 0x10042666d\nmovss   xmm0, dword ptr [r15]; jumptable 000000010042666D cases 54,65  ; +0x12f, 0x10042666f\nmovss   [rbp+var_1C], xmm0                                             ; +0x134, 0x100426674\nmov     rax, [r14]                                                     ; +0x139, 0x100426679\nmov     rdi, r14                                                       ; +0x13c, 0x10042667c\ncall    qword ptr [rax+0C0h]                                           ; +0x13f, 0x10042667f\nmovss   xmm0, [rbp+var_1C]                                             ; +0x145, 0x100426685\nucomiss xmm0, dword ptr [rax]                                          ; +0x14a, 0x10042668a\njbe     short def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x14d, 0x10042668d\ncmp     ebx, 41h ; 'A'                                                 ; +0x14f, 0x10042668f\njz      loc_10042675C                                                  ; +0x152, 0x100426692\ncmp     ebx, 36h ; '6'                                                 ; +0x158, 0x100426698\njnz     short def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x15b, 0x10042669b\nmov     ebx, 37h ; '7'                                                 ; +0x15d, 0x10042669d\njmp     short def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x162, 0x1004266a2\nmovss   xmm0, dword ptr [r15+4]; jumptable 000000010042666D cases 73,75 ; +0x164, 0x1004266a4\nmovss   [rbp+var_1C], xmm0                                             ; +0x16a, 0x1004266aa\nmov     rax, [r14]                                                     ; +0x16f, 0x1004266af\nmov     rdi, r14                                                       ; +0x172, 0x1004266b2\ncall    qword ptr [rax+0C0h]                                           ; +0x175, 0x1004266b5\nmovss   xmm0, [rbp+var_1C]                                             ; +0x17b, 0x1004266bb\nucomiss xmm0, dword ptr [rax+4]                                        ; +0x180, 0x1004266c0\njbe     short def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x184, 0x1004266c4\ncmp     ebx, 4Bh ; 'K'                                                 ; +0x186, 0x1004266c6\njz      loc_100426766                                                  ; +0x189, 0x1004266c9\ncmp     ebx, 49h ; 'I'                                                 ; +0x18f, 0x1004266cf\njnz     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x192, 0x1004266d2\nmov     ebx, 4Ah ; 'J'                                                 ; +0x198, 0x1004266d8\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x19d, 0x1004266dd\nmovss   xmm0, dword ptr [r15+4]; jumptable 000000010042666D cases 69,71 ; +0x1a2, 0x1004266e2\nmovss   [rbp+var_1C], xmm0                                             ; +0x1a8, 0x1004266e8\nmov     rax, [r14]                                                     ; +0x1ad, 0x1004266ed\nmov     rdi, r14                                                       ; +0x1b0, 0x1004266f0\ncall    qword ptr [rax+0C0h]                                           ; +0x1b3, 0x1004266f3\nmovss   xmm0, dword ptr [rax+4]                                        ; +0x1b9, 0x1004266f9\nucomiss xmm0, [rbp+var_1C]                                             ; +0x1be, 0x1004266fe\njbe     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x1c2, 0x100426702\ncmp     ebx, 47h ; 'G'                                                 ; +0x1c8, 0x100426708\njz      short loc_100426770                                            ; +0x1cb, 0x10042670b\ncmp     ebx, 45h ; 'E'                                                 ; +0x1cd, 0x10042670d\njnz     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x1d0, 0x100426710\nmov     ebx, 46h ; 'F'                                                 ; +0x1d6, 0x100426716\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x1db, 0x10042671b\nmovss   xmm0, dword ptr [r15]; jumptable 000000010042666D cases 56,67  ; +0x1e0, 0x100426720\nmovss   [rbp+var_1C], xmm0                                             ; +0x1e5, 0x100426725\nmov     rax, [r14]                                                     ; +0x1ea, 0x10042672a\nmov     rdi, r14                                                       ; +0x1ed, 0x10042672d\ncall    qword ptr [rax+0C0h]                                           ; +0x1f0, 0x100426730\nmovss   xmm0, dword ptr [rax]                                          ; +0x1f6, 0x100426736\nucomiss xmm0, [rbp+var_1C]                                             ; +0x1fa, 0x10042673a\njbe     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x1fe, 0x10042673e\ncmp     ebx, 43h ; 'C'                                                 ; +0x204, 0x100426744\njz      short loc_10042677A                                            ; +0x207, 0x100426747\ncmp     ebx, 38h ; '8'                                                 ; +0x209, 0x100426749\njnz     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x20c, 0x10042674c\nmov     ebx, 39h ; '9'                                                 ; +0x212, 0x100426752\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x217, 0x100426757\nmov     ebx, 42h ; 'B'                                                 ; +0x21c, 0x10042675c\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x221, 0x100426761\nmov     ebx, 4Ch ; 'L'                                                 ; +0x226, 0x100426766\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x22b, 0x10042676b\nmov     ebx, 48h ; 'H'                                                 ; +0x230, 0x100426770\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x235, 0x100426775\nmov     ebx, 44h ; 'D'                                                 ; +0x23a, 0x10042677a\njmp     def_10042666D; jumptable 000000010042666D default case, cases 55,57-64,66,68,70,72,74 ; +0x23f, 0x10042677f", "xrefs": ["EditorUI::addObjectsToSmartTemplate @ 0x10004145f", "GJSmartTemplate::keyFromNeighbors @ 0x100425f97", "GJSmartTemplate::keyFromNeighbors @ 0x100425ff9", "GJSmartTemplate::keyFromNeighbors @ 0x100426063", "GJSmartTemplate::keyFromNeighbors @ 0x1004260ca", "GJSmartTemplate::keyFromNeighbors @ 0x100426126", "GJSmartTemplate::keyFromNeighbors @ 0x10042618d", "GJSmartTemplate::keyFromNeighbors @ 0x1004261ea", "GJSmartTemplate::keyFromNeighbors @ 0x10042624a", "GJSmartTemplate::keyFromNeighbors @ 0x1004262aa", "GJSmartTemplate::offsetForObject @ 0x10042650e"], "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"}