{"type": "func", "start": 5372081120, "end": 5372081275, "name": "GJBaseGameLayer::convertToClosestDirection", "pseudocode": "// \n// GJBaseGameLayer::convertToClosestDirection from 0x1403373e0 to 0x14033747b (155 bytes)\n// \n// 9 xrefs:\n// > GJBaseGameLayer::teleportPlayer @ 0x140316836\n// > sub_140326AB0 @ 0x140326d8b\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338772\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338c95\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338d1a\n// > GJBaseGameLayer::updateScreenRotation @ 0x14033eca3\n// > GJBaseGameLayer::updateScreenRotation @ 0x14033ecb7\n// > PlayerObject::redirectPlayerForce @ 0x1404fe12a\n// > <???> @ 0x14091f9b8\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\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:30:35 +0000\n// \n\n// local variable allocation has failed, the output may be wrong!\ndouble __fastcall GJBaseGameLayer::convertToClosestDirection(double result, float a2)\n{\n  __int128 v2; // xmm6\n  float v3; // xmm0_4\n\n  v2 = *(_OWORD *)&result;\n  if ( (float)-a2 <= *(float *)&result )\n  {\n    if ( *(float *)&result > a2 )\n    {\n      v3 = floorf(fabs(*(float *)&result) / a2);\n      *(float *)&v2 = *(float *)&v2 - (float)(ceilf(v3 * 0.5) * (float)(a2 + a2));\n      *(_OWORD *)&result = v2;\n    }\n  }\n  else\n  {\n    *(__m128 *)&result = _mm_and_ps(*(__m128 *)&result, (__m128)xmmword_140836C90);\n    *(float *)&result = floorf(*(float *)&result / a2);\n    *(float *)&result = (float)(ceilf(*(float *)&result * 0.5) * (float)(a2 + a2)) + *(float *)&v2;\n  }\n  return result;\n}", "assembly": "; \n; GJBaseGameLayer::convertToClosestDirection from 0x1403373e0 to 0x14033747b (155 bytes)\n; \n; 9 xrefs:\n; > GJBaseGameLayer::teleportPlayer @ 0x140316836\n; > sub_140326AB0 @ 0x140326d8b\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338772\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338c95\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x140338d1a\n; > GJBaseGameLayer::updateScreenRotation @ 0x14033eca3\n; > GJBaseGameLayer::updateScreenRotation @ 0x14033ecb7\n; > PlayerObject::redirectPlayerForce @ 0x1404fe12a\n; > <???> @ 0x14091f9b8\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\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:30:35 +0000\n; \nsub     rsp, 48h                                                       ; +0x0, 0x1403373e0\nmovaps  [rsp+48h+var_18], xmm6                                         ; +0x4, 0x1403373e4\nmovaps  xmm2, xmm1                                                     ; +0x9, 0x1403373e9\nxorps   xmm2, cs:xmmword_140836CC0                                     ; +0xc, 0x1403373ec\nmovaps  xmm6, xmm0                                                     ; +0x13, 0x1403373f3\ncomiss  xmm2, xmm6                                                     ; +0x16, 0x1403373f6\nmovaps  [rsp+48h+var_28], xmm7                                         ; +0x19, 0x1403373f9\nmovaps  xmm7, xmm1                                                     ; +0x1e, 0x1403373fe\njbe     short loc_14033743B                                            ; +0x21, 0x140337401\nandps   xmm0, cs:xmmword_140836C90                                     ; +0x23, 0x140337403\ndivss   xmm0, xmm7; X                                                  ; +0x2a, 0x14033740a\ncall    floorf                                                         ; +0x2e, 0x14033740e\nmulss   xmm0, cs:dword_140834F20; X                                    ; +0x33, 0x140337413\ncall    ceilf                                                          ; +0x3b, 0x14033741b\naddss   xmm7, xmm7                                                     ; +0x40, 0x140337420\nmulss   xmm0, xmm7                                                     ; +0x44, 0x140337424\naddss   xmm0, xmm6                                                     ; +0x48, 0x140337428\nmovaps  xmm6, [rsp+48h+var_18]                                         ; +0x4c, 0x14033742c\nmovaps  xmm7, [rsp+48h+var_28]                                         ; +0x51, 0x140337431\nadd     rsp, 48h                                                       ; +0x56, 0x140337436\nretn                                                                   ; +0x5a, 0x14033743a\ncomiss  xmm6, xmm7                                                     ; +0x5b, 0x14033743b\njbe     short loc_14033746C                                            ; +0x5e, 0x14033743e\nandps   xmm0, cs:xmmword_140836C90                                     ; +0x60, 0x140337440\ndivss   xmm0, xmm7; X                                                  ; +0x67, 0x140337447\ncall    floorf                                                         ; +0x6b, 0x14033744b\nmulss   xmm0, cs:dword_140834F20; X                                    ; +0x70, 0x140337450\ncall    ceilf                                                          ; +0x78, 0x140337458\naddss   xmm7, xmm7                                                     ; +0x7d, 0x14033745d\nmulss   xmm0, xmm7                                                     ; +0x81, 0x140337461\nsubss   xmm6, xmm0                                                     ; +0x85, 0x140337465\nmovaps  xmm0, xmm6                                                     ; +0x89, 0x140337469\nmovaps  xmm6, [rsp+48h+var_18]                                         ; +0x8c, 0x14033746c\nmovaps  xmm7, [rsp+48h+var_28]                                         ; +0x91, 0x140337471\nadd     rsp, 48h                                                       ; +0x96, 0x140337476\nretn                                                                   ; +0x9a, 0x14033747a", "xrefs": ["GJBaseGameLayer::teleportPlayer @ 0x140316836", "sub_140326AB0 @ 0x140326d8b", "GJBaseGameLayer::processAdvancedFollowAction @ 0x140338772", "GJBaseGameLayer::processAdvancedFollowAction @ 0x140338c95", "GJBaseGameLayer::processAdvancedFollowAction @ 0x140338d1a", "GJBaseGameLayer::updateScreenRotation @ 0x14033eca3", "GJBaseGameLayer::updateScreenRotation @ 0x14033ecb7", "PlayerObject::redirectPlayerForce @ 0x1404fe12a", "<???> @ 0x14091f9b8"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "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"}