{"type": "func", "start": 4673524, "end": 4673670, "name": "GJBaseGameLayer::convertToClosestDirection", "pseudocode": "// \n// GJBaseGameLayer::convertToClosestDirection from 0x474ff4 to 0x475086 (146 bytes)\n// \n// 9 xrefs:\n// > PlayLayer::updateScreenRotation @ 0x3109fe\n// > PlayerObject::redirectPlayerForce @ 0x3419fc\n// > PlayerObject::redirectDash @ 0x342630\n// > getRotateCommandAngleDelta @ 0x4751c8\n// > GJBaseGameLayer::updateScreenRotation @ 0x485f64\n// > GJBaseGameLayer::updateScreenRotation @ 0x485f72\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48a732\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48abba\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48ac2c\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 v3; // s17\n  float v4; // r0\n  float v5; // r0\n\n  v3 = a1;\n  if ( a1 >= (float)-a2 )\n  {\n    if ( a1 > a2 )\n    {\n      v5 = floorf(fabsf(a1) / a2);\n      return v3 - (float)(ceilf(v5 * 0.5) * (float)(a2 + a2));\n    }\n  }\n  else\n  {\n    v4 = floorf(fabsf(a1) / a2);\n    return v3 + (float)(ceilf(v4 * 0.5) * (float)(a2 + a2));\n  }\n  return v3;\n}", "assembly": "; \n; GJBaseGameLayer::convertToClosestDirection from 0x474ff4 to 0x475086 (146 bytes)\n; \n; 9 xrefs:\n; > PlayLayer::updateScreenRotation @ 0x3109fe\n; > PlayerObject::redirectPlayerForce @ 0x3419fc\n; > PlayerObject::redirectDash @ 0x342630\n; > getRotateCommandAngleDelta @ 0x4751c8\n; > GJBaseGameLayer::updateScreenRotation @ 0x485f64\n; > GJBaseGameLayer::updateScreenRotation @ 0x485f72\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x48a732\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x48abba\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x48ac2c\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            {R3,LR}                                                ; +0x0, 0x474ff4\nVPUSH           {D8}                                                   ; +0x2, 0x474ff6\nVMOV            S16, R1                                                ; +0x6, 0x474ffa\nVMOV            S17, R0                                                ; +0xa, 0x474ffe\nVNEG.F32        S15, S16                                               ; +0xe, 0x475002\nVCMPE.F32       S17, S15                                               ; +0x12, 0x475006\nVMRS            APSR_nzcv, FPSCR                                       ; +0x16, 0x47500a\nBPL             loc_475042                                             ; +0x1a, 0x47500e\nVABS.F32        S15, S17                                               ; +0x1c, 0x475010\nVDIV.F32        S15, S15, S16                                          ; +0x20, 0x475014\nVMOV            R0, S15; x                                             ; +0x24, 0x475018\nBLX             floorf                                                 ; +0x28, 0x47501c\nVMOV.F32        S15, #0.5                                              ; +0x2c, 0x475020\nVADD.F32        S16, S16, S16                                          ; +0x30, 0x475024\nVMOV            S14, R0                                                ; +0x34, 0x475028\nVMUL.F32        S15, S14, S15                                          ; +0x38, 0x47502c\nVMOV            R0, S15; x                                             ; +0x3c, 0x475030\nBLX             ceilf                                                  ; +0x40, 0x475034\nVMOV            S15, R0                                                ; +0x44, 0x475038\nVMLA.F32        S17, S15, S16                                          ; +0x48, 0x47503c\nB               loc_47507C                                             ; +0x4c, 0x475040\nVCMPE.F32       S17, S16                                               ; +0x4e, 0x475042\nVMRS            APSR_nzcv, FPSCR                                       ; +0x52, 0x475046\nBLE             loc_47507C                                             ; +0x56, 0x47504a\nVABS.F32        S15, S17                                               ; +0x58, 0x47504c\nVDIV.F32        S15, S15, S16                                          ; +0x5c, 0x475050\nVMOV            R0, S15; x                                             ; +0x60, 0x475054\nBLX             floorf                                                 ; +0x64, 0x475058\nVMOV.F32        S15, #0.5                                              ; +0x68, 0x47505c\nVADD.F32        S16, S16, S16                                          ; +0x6c, 0x475060\nVMOV            S14, R0                                                ; +0x70, 0x475064\nVMUL.F32        S15, S14, S15                                          ; +0x74, 0x475068\nVMOV            R0, S15; x                                             ; +0x78, 0x47506c\nBLX             ceilf                                                  ; +0x7c, 0x475070\nVMOV            S15, R0                                                ; +0x80, 0x475074\nVMLS.F32        S17, S15, S16                                          ; +0x84, 0x475078\nVMOV            R0, S17                                                ; +0x88, 0x47507c\nVPOP            {D8}                                                   ; +0x8c, 0x475080\nPOP             {R3,PC}                                                ; +0x90, 0x475084", "xrefs": ["PlayLayer::updateScreenRotation @ 0x3109fe", "PlayerObject::redirectPlayerForce @ 0x3419fc", "PlayerObject::redirectDash @ 0x342630", "getRotateCommandAngleDelta @ 0x4751c8", "GJBaseGameLayer::updateScreenRotation @ 0x485f64", "GJBaseGameLayer::updateScreenRotation @ 0x485f72", "GJBaseGameLayer::processAdvancedFollowAction @ 0x48a732", "GJBaseGameLayer::processAdvancedFollowAction @ 0x48abba", "GJBaseGameLayer::processAdvancedFollowAction @ 0x48ac2c"], "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"}