{"type": "func", "start": 5370996912, "end": 5370997067, "name": "GJBaseGameLayer::convertToClosestDirection", "pseudocode": "// \n// GJBaseGameLayer::convertToClosestDirection from 0x14022e8b0 to 0x14022e94b (155 bytes)\n// \n// 9 xrefs:\n// > GJBaseGameLayer::teleportPlayer @ 0x140210674\n// > sub_14021EFB0 @ 0x14021f299\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x14022fc10\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x140230138\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x1402301ca\n// > GJBaseGameLayer::updateScreenRotation @ 0x140235ed0\n// > GJBaseGameLayer::updateScreenRotation @ 0x140235ee8\n// > PlayerObject::redirectPlayerForce @ 0x14039fcff\n// > <???> @ 0x1406cdd7c\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\nfloat GJBaseGameLayer::convertToClosestDirection(float a1, float a2)\n{\n  float v2; // xmm6_4\n  float v3; // xmm0_4\n  float v4; // xmm0_4\n\n  v2 = a1;\n  if ( (float)-a2 <= a1 )\n  {\n    if ( a1 > a2 )\n    {\n      v4 = floorf(fabs(a1) / a2);\n      return v2 - (float)(ceilf(v4 * 0.5) * (float)(a2 + a2));\n    }\n  }\n  else\n  {\n    v3 = floorf(fabs(a1) / a2);\n    return (float)(ceilf(v3 * 0.5) * (float)(a2 + a2)) + v2;\n  }\n  return a1;\n}", "assembly": "; \n; GJBaseGameLayer::convertToClosestDirection from 0x14022e8b0 to 0x14022e94b (155 bytes)\n; \n; 9 xrefs:\n; > GJBaseGameLayer::teleportPlayer @ 0x140210674\n; > sub_14021EFB0 @ 0x14021f299\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x14022fc10\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x140230138\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x1402301ca\n; > GJBaseGameLayer::updateScreenRotation @ 0x140235ed0\n; > GJBaseGameLayer::updateScreenRotation @ 0x140235ee8\n; > PlayerObject::redirectPlayerForce @ 0x14039fcff\n; > <???> @ 0x1406cdd7c\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\nsub     rsp, 48h                                                       ; +0x0, 0x14022e8b0\nmovaps  [rsp+48h+var_18], xmm6                                         ; +0x4, 0x14022e8b4\nmovaps  xmm2, xmm1                                                     ; +0x9, 0x14022e8b9\nxorps   xmm2, cs:xmmword_1406243F0                                     ; +0xc, 0x14022e8bc\nmovaps  xmm6, xmm0                                                     ; +0x13, 0x14022e8c3\ncomiss  xmm2, xmm6                                                     ; +0x16, 0x14022e8c6\nmovaps  [rsp+48h+var_28], xmm7                                         ; +0x19, 0x14022e8c9\nmovaps  xmm7, xmm1                                                     ; +0x1e, 0x14022e8ce\njbe     short loc_14022E90B                                            ; +0x21, 0x14022e8d1\nandps   xmm0, cs:xmmword_1406243C0                                     ; +0x23, 0x14022e8d3\ndivss   xmm0, xmm7; X                                                  ; +0x2a, 0x14022e8da\ncall    floorf                                                         ; +0x2e, 0x14022e8de\nmulss   xmm0, cs:dword_140622B08; X                                    ; +0x33, 0x14022e8e3\ncall    ceilf                                                          ; +0x3b, 0x14022e8eb\naddss   xmm7, xmm7                                                     ; +0x40, 0x14022e8f0\nmulss   xmm0, xmm7                                                     ; +0x44, 0x14022e8f4\naddss   xmm0, xmm6                                                     ; +0x48, 0x14022e8f8\nmovaps  xmm6, [rsp+48h+var_18]                                         ; +0x4c, 0x14022e8fc\nmovaps  xmm7, [rsp+48h+var_28]                                         ; +0x51, 0x14022e901\nadd     rsp, 48h                                                       ; +0x56, 0x14022e906\nretn                                                                   ; +0x5a, 0x14022e90a\ncomiss  xmm6, xmm7                                                     ; +0x5b, 0x14022e90b\njbe     short loc_14022E93C                                            ; +0x5e, 0x14022e90e\nandps   xmm0, cs:xmmword_1406243C0                                     ; +0x60, 0x14022e910\ndivss   xmm0, xmm7; X                                                  ; +0x67, 0x14022e917\ncall    floorf                                                         ; +0x6b, 0x14022e91b\nmulss   xmm0, cs:dword_140622B08; X                                    ; +0x70, 0x14022e920\ncall    ceilf                                                          ; +0x78, 0x14022e928\naddss   xmm7, xmm7                                                     ; +0x7d, 0x14022e92d\nmulss   xmm0, xmm7                                                     ; +0x81, 0x14022e931\nsubss   xmm6, xmm0                                                     ; +0x85, 0x14022e935\nmovaps  xmm0, xmm6                                                     ; +0x89, 0x14022e939\nmovaps  xmm6, [rsp+48h+var_18]                                         ; +0x8c, 0x14022e93c\nmovaps  xmm7, [rsp+48h+var_28]                                         ; +0x91, 0x14022e941\nadd     rsp, 48h                                                       ; +0x96, 0x14022e946\nretn                                                                   ; +0x9a, 0x14022e94a", "xrefs": ["GJBaseGameLayer::teleportPlayer @ 0x140210674", "sub_14021EFB0 @ 0x14021f299", "GJBaseGameLayer::processAdvancedFollowAction @ 0x14022fc10", "GJBaseGameLayer::processAdvancedFollowAction @ 0x140230138", "GJBaseGameLayer::processAdvancedFollowAction @ 0x1402301ca", "GJBaseGameLayer::updateScreenRotation @ 0x140235ed0", "GJBaseGameLayer::updateScreenRotation @ 0x140235ee8", "PlayerObject::redirectPlayerForce @ 0x14039fcff", "<???> @ 0x1406cdd7c"], "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"}