{"type": "func", "start": 4759248, "end": 4759734, "name": "GJBaseGameLayer::getSavedPosition", "pseudocode": "// \n// GJBaseGameLayer::getSavedPosition from 0x489ed0 to 0x48a0b6 (486 bytes)\n// \n// 1 xrefs:\n// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48a208\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\ncocos2d::CCPoint *GJBaseGameLayer::getSavedPosition(\n        cocos2d::CCPoint *__return_ptr retstr,\n        GJBaseGameLayer *a2,\n        int a3,\n        float a4)\n{\n  cocos2d::CCPoint *v4; // r6\n  PlayerObject *m_player2; // r0\n  cocos2d::CCPoint *p_m_cameraPosition; // r1\n  GameObject *v9; // r0\n  double v10; // d7\n  float v11; // s16\n  int v12; // r7\n  PlayerObject *m_player1; // r3\n  int m_unkUint12; // r5\n  GameObject *MainObject; // r0\n  int *v16; // r0\n  int v17; // r9\n  float v18; // s16\n  int v19; // r1\n  int v20; // r3\n  int v21; // r1\n  int v22; // r5\n  unsigned int m_uniqueID; // [sp+0h] [bp-34h] BYREF\n  cocos2d::CCPoint v25; // [sp+4h] [bp-30h] BYREF\n  cocos2d::CCPoint v26; // [sp+Ch] [bp-28h] BYREF\n  _BYTE v27[8]; // [sp+14h] [bp-20h] BYREF\n  _BYTE v28[8]; // [sp+1Ch] [bp-18h] BYREF\n  _BYTE v29[8]; // [sp+24h] [bp-10h] BYREF\n\n  v4 = retstr;\n  if ( a4 > 0.0 )\n  {\n    v10 = a4 / 0.00416666667\n        - (float)((float)(unsigned int)(a2->m_gameState.m_unkUint6 - a2->m_gameState.m_unkUint5) / 1000.0);\n    if ( v10 <= 0.0 )\n      v11 = 0.0;\n    else\n      v11 = v10;\n    v12 = (int)ceilf(v11);\n    if ( v12 >= a2->m_gameState.m_unkUint11 )\n    {\n      retstr = v4;\nLABEL_34:\n      p_m_cameraPosition = &stru_AC68C0;\n      goto LABEL_35;\n    }\n    m_uniqueID = a3;\n    if ( a3 == -1 )\n    {\n      m_player1 = a2->m_player1;\n    }\n    else\n    {\n      if ( a3 != -2 )\n      {\n        if ( a3 == -3 )\n        {\n          m_unkUint12 = a2->m_gameState.m_unkUint12;\n        }\n        else\n        {\n          MainObject = GJBaseGameLayer::tryGetMainObject(a2, a3);\n          if ( !MainObject )\n          {\nLABEL_33:\n            retstr = v4;\n            goto LABEL_34;\n          }\n          m_unkUint12 = MainObject->m_unk52C;\n          m_uniqueID = MainObject->m_uniqueID;\n        }\nLABEL_25:\n        if ( m_unkUint12 >= 0 )\n        {\n          if ( sub_46C450(&a2->m_savePositionValues._M_h._M_buckets, m_uniqueID) )\n          {\n            v16 = std::__detail::_Map_base<int,std::pair<int const,int>,std::allocator<std::pair<int const,int>>,std::__detail::_Select1st,std::equal_to<int>,std::hash<int>,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits<false,false,true>,true>::operator[](\n                    &a2->m_savePositionValues._M_h._M_buckets,\n                    &m_uniqueID);\n            v17 = *v16;\n            v18 = (float)v12 - v11;\n            v19 = a2->m_gameState.m_unkUint11 % *v16 - v12;\n            if ( v19 < 0 )\n              v19 += v17;\n            v20 = v19 + 1;\n            v21 = v19 + m_unkUint12;\n            if ( v20 >= v17 )\n              v20 = 0;\n            v22 = m_unkUint12 + v20;\n            cocos2d::CCPoint::CCPoint(\n              &v25,\n              a2->m_gameState.m_unkVecFloat1.m_start[2 * v21],\n              a2->m_gameState.m_unkVecFloat1.m_start[2 * v21 + 1]);\n            cocos2d::CCPoint::CCPoint(\n              &v26,\n              a2->m_gameState.m_unkVecFloat1.m_start[2 * v22],\n              a2->m_gameState.m_unkVecFloat1.m_start[2 * v22 + 1]);\n            cocos2d::CCPoint::operator-(v27, &v26, &v25);\n            cocos2d::CCPoint::operator*(v29, v27, LODWORD(v18));\n            cocos2d::CCPoint::operator+(v28, &v25, v29);\n            retstr = v4;\n            p_m_cameraPosition = (cocos2d::CCPoint *)v28;\n            goto LABEL_35;\n          }\n          retstr = v4;\n          goto LABEL_34;\n        }\n        goto LABEL_33;\n      }\n      m_player1 = a2->m_player2;\n    }\n    m_unkUint12 = m_player1->m_unk52C;\n    goto LABEL_25;\n  }\n  switch ( a3 )\n  {\n    case -1:\n      m_player2 = a2->m_player1;\nLABEL_6:\n      p_m_cameraPosition = (cocos2d::CCPoint *)m_player2->getPosition(m_player2);\n      retstr = v4;\nLABEL_35:\n      cocos2d::CCPoint::CCPoint(retstr, p_m_cameraPosition);\n      return v4;\n    case -2:\n      m_player2 = a2->m_player2;\n      goto LABEL_6;\n    case -3:\n      p_m_cameraPosition = &a2->m_gameState.m_cameraPosition;\n      goto LABEL_35;\n  }\n  v9 = GJBaseGameLayer::tryGetMainObject(a2, a3);\n  if ( !v9 )\n    goto LABEL_33;\n  v9->getRealPosition(v4, v9);\n  return v4;\n}", "assembly": "; \n; GJBaseGameLayer::getSavedPosition from 0x489ed0 to 0x48a0b6 (486 bytes)\n; \n; 1 xrefs:\n; > GJBaseGameLayer::processAdvancedFollowAction @ 0x48a208\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.W          {R4-R9,LR}                                             ; +0x0, 0x489ed0\nVMOV            S14, R3                                                ; +0x4, 0x489ed4\nLDR.W           R8, =(__stack_chk_guard_ptr - 0x489EE8)                ; +0x8, 0x489ed8\nMOV             R6, R0                                                 ; +0xc, 0x489edc\nVPUSH           {D8}                                                   ; +0xe, 0x489ede\nMOV             R4, R1                                                 ; +0x12, 0x489ee2\nADD             R8, PC; __stack_chk_guard_ptr                          ; +0x14, 0x489ee4\nLDR.W           R8, [R8]; __stack_chk_guard                            ; +0x16, 0x489ee6\nMOV             R5, R2                                                 ; +0x1a, 0x489eea\nVCMPE.F32       S14, #0.0                                              ; +0x1c, 0x489eec\nLDR.W           R3, [R8]                                               ; +0x20, 0x489ef0\nSUB             SP, SP, #0x34                                          ; +0x24, 0x489ef4\nSTR             R3, [SP,#0x34+var_8]                                   ; +0x26, 0x489ef6\nVMRS            APSR_nzcv, FPSCR                                       ; +0x28, 0x489ef8\nBHI             loc_489F42                                             ; +0x2c, 0x489efc\nADDS            R2, #1                                                 ; +0x2e, 0x489efe\nBNE             loc_489F08                                             ; +0x30, 0x489f00\nLDR.W           R0, [R1,#0x8B8]                                        ; +0x32, 0x489f02\nB               loc_489F10                                             ; +0x36, 0x489f06\nADDS            R3, R5, #2                                             ; +0x38, 0x489f08\nBNE             loc_489F1C                                             ; +0x3a, 0x489f0a\nLDR.W           R0, [R1,#0x8BC]                                        ; +0x3c, 0x489f0c\nLDR             R3, [R0]                                               ; +0x40, 0x489f10\nLDR             R3, [R3,#0x60]                                         ; +0x42, 0x489f12\nBLX             R3                                                     ; +0x44, 0x489f14\nMOV             R1, R0                                                 ; +0x46, 0x489f16\nMOV             R0, R6                                                 ; +0x48, 0x489f18\nB               loc_48A098                                             ; +0x4a, 0x489f1a\nADDS            R7, R5, #3                                             ; +0x4c, 0x489f1c\nBNE             loc_489F26                                             ; +0x4e, 0x489f1e\nADD.W           R1, R1, #0x360                                         ; +0x50, 0x489f20\nB               loc_48A098                                             ; +0x54, 0x489f24\nMOV             R0, R1; this                                           ; +0x56, 0x489f26\nMOV             R1, R5; int                                            ; +0x58, 0x489f28\nBL              _ZN15GJBaseGameLayer16tryGetMainObjectEi; GJBaseGameLayer::tryGetMainObject(int) ; +0x5a, 0x489f2a\nMOV             R1, R0                                                 ; +0x5e, 0x489f2e\nCMP             R0, #0                                                 ; +0x60, 0x489f30\nBEQ.W           loc_48A090                                             ; +0x62, 0x489f32\nLDR             R3, [R0]                                               ; +0x66, 0x489f36\nMOV             R0, R6                                                 ; +0x68, 0x489f38\nLDR.W           R3, [R3,#0x2A0]                                        ; +0x6a, 0x489f3a\nBLX             R3                                                     ; +0x6e, 0x489f3e\nB               loc_48A09C                                             ; +0x70, 0x489f40\nVCVT.F64.F32    D7, S14                                                ; +0x72, 0x489f42\nLDR.W           R3, [R1,#0x34C]                                        ; +0x76, 0x489f46\nVLDR            D6, =0.00416666667                                     ; +0x7a, 0x489f4a\nLDR.W           R2, [R1,#0x348]                                        ; +0x7e, 0x489f4e\nSUBS            R3, R3, R2                                             ; +0x82, 0x489f52\nVDIV.F64        D6, D7, D6                                             ; +0x84, 0x489f54\nVMOV            S15, R3                                                ; +0x88, 0x489f58\nVCVT.F32.U32    S14, S15                                               ; +0x8c, 0x489f5c\nVLDR            S15, =1000.0                                           ; +0x90, 0x489f60\nVDIV.F32        S14, S14, S15                                          ; +0x94, 0x489f64\nVCVT.F64.F32    D7, S14                                                ; +0x98, 0x489f68\nVSUB.F64        D7, D6, D7                                             ; +0x9c, 0x489f6c\nVCMPE.F64       D7, #0.0                                               ; +0xa0, 0x489f70\nVMRS            APSR_nzcv, FPSCR                                       ; +0xa4, 0x489f74\nITE GT                                                                 ; +0xa8, 0x489f78\nVCVTGT.F32.F64  S16, D7                                                ; +0xaa, 0x489f7a\nVLDRLE          S16, =0.0                                              ; +0xae, 0x489f7e\nVMOV            R0, S16; x                                             ; +0xb2, 0x489f82\nBLX             ceilf                                                  ; +0xb6, 0x489f86\nLDR.W           R3, [R4,#0x3D0]                                        ; +0xba, 0x489f8a\nVMOV            S15, R0                                                ; +0xbe, 0x489f8e\nVCVT.S32.F32    S15, S15                                               ; +0xc2, 0x489f92\nVMOV            R7, S15                                                ; +0xc6, 0x489f96\nCMP             R7, R3                                                 ; +0xca, 0x489f9a\nBLT             loc_489FA6                                             ; +0xcc, 0x489f9c\nLDR             R1, =(qword_AC68B8 - 0x489FA6)                         ; +0xce, 0x489f9e\nMOV             R0, R6                                                 ; +0xd0, 0x489fa0\nADD             R1, PC; qword_AC68B8                                   ; +0xd2, 0x489fa2\nB               loc_48A096                                             ; +0xd4, 0x489fa4\nADDS            R1, R5, #1                                             ; +0xd6, 0x489fa6\nSTR             R5, [SP,#0x34+var_34]                                  ; +0xd8, 0x489fa8\nBNE             loc_489FB2                                             ; +0xda, 0x489faa\nLDR.W           R3, [R4,#0x8B8]                                        ; +0xdc, 0x489fac\nB               loc_489FBA                                             ; +0xe0, 0x489fb0\nADDS            R2, R5, #2                                             ; +0xe2, 0x489fb2\nBNE             loc_489FC0                                             ; +0xe4, 0x489fb4\nLDR.W           R3, [R4,#0x8BC]                                        ; +0xe6, 0x489fb6\nLDR.W           R5, [R3,#0x480]                                        ; +0xea, 0x489fba\nB               loc_489FE0                                             ; +0xee, 0x489fbe\nADDS            R3, R5, #3                                             ; +0xf0, 0x489fc0\nBNE             loc_489FCA                                             ; +0xf2, 0x489fc2\nLDR.W           R5, [R4,#0x3D4]                                        ; +0xf4, 0x489fc4\nB               loc_489FE0                                             ; +0xf8, 0x489fc8\nMOV             R0, R4; this                                           ; +0xfa, 0x489fca\nMOV             R1, R5; int                                            ; +0xfc, 0x489fcc\nBL              _ZN15GJBaseGameLayer16tryGetMainObjectEi; GJBaseGameLayer::tryGetMainObject(int) ; +0xfe, 0x489fce\nCMP             R0, #0                                                 ; +0x102, 0x489fd2\nBEQ             loc_48A090                                             ; +0x104, 0x489fd4\nLDR.W           R3, [R0,#0x304]                                        ; +0x106, 0x489fd6\nLDR.W           R5, [R0,#0x480]                                        ; +0x10a, 0x489fda\nSTR             R3, [SP,#0x34+var_34]                                  ; +0x10e, 0x489fde\nCMP             R5, #0                                                 ; +0x110, 0x489fe0\nBLT             loc_48A090                                             ; +0x112, 0x489fe2\nADD.W           R9, R4, #0x2C40                                        ; +0x114, 0x489fe4\nLDR             R1, [SP,#0x34+var_34]                                  ; +0x118, 0x489fe8\nADD.W           R9, R9, #0x18                                          ; +0x11a, 0x489fea\nMOV             R0, R9                                                 ; +0x11e, 0x489fee\nBL              sub_46C450                                             ; +0x120, 0x489ff0\nCBNZ            R0, loc_489FFE                                         ; +0x124, 0x489ff4\nLDR             R1, =(qword_AC68B8 - 0x489FFE)                         ; +0x126, 0x489ff6\nMOV             R0, R6                                                 ; +0x128, 0x489ff8\nADD             R1, PC; qword_AC68B8                                   ; +0x12a, 0x489ffa\nB               loc_48A096                                             ; +0x12c, 0x489ffc\nMOV             R0, R9                                                 ; +0x12e, 0x489ffe\nMOV             R1, SP                                                 ; +0x130, 0x48a000\nBL              _ZNSt8__detail9_Map_baseIiSt4pairIKiiESaIS3_ENS_10_Select1stESt8equal_toIiESt4hashIiENS_18_Mod_range_hashingENS_20_Default_ranged_hashENS_20_Prime_rehash_policyENS_17_Hashtable_traitsILb0ELb0ELb1EEELb1EEixERS2_; std::__detail::_Map_base<int,std::pair<int const,int>,std::allocator<std::pair<int const,int>>,std::__detail::_Select1st,std::equal_to<int>,std::hash<int>,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits<false,false,true>,true>::operator[](int const&) ; +0x132, 0x48a002\nLDR.W           R9, [R0]                                               ; +0x136, 0x48a006\nLDR.W           R0, [R4,#0x3D0]                                        ; +0x13a, 0x48a00a\nMOV             R1, R9                                                 ; +0x13e, 0x48a00e\nBLX             __aeabi_idivmod                                        ; +0x140, 0x48a010\nVMOV            S15, R7                                                ; +0x144, 0x48a014\nLDR.W           R2, [R4,#0x3C0]                                        ; +0x148, 0x48a018\nVCVT.F32.S32    S15, S15                                               ; +0x14c, 0x48a01c\nVSUB.F32        S16, S15, S16                                          ; +0x150, 0x48a020\nSUBS            R1, R1, R7                                             ; +0x154, 0x48a024\nADD             R7, SP, #0x34+var_30                                   ; +0x156, 0x48a026\nIT MI                                                                  ; +0x158, 0x48a028\nADDMI           R1, R9                                                 ; +0x15a, 0x48a02a\nADDS            R3, R1, #1                                             ; +0x15c, 0x48a02c\nADD             R1, R5                                                 ; +0x15e, 0x48a02e\nCMP             R3, R9                                                 ; +0x160, 0x48a030\nIT GE                                                                  ; +0x162, 0x48a032\nMOVGE           R3, #0                                                 ; +0x164, 0x48a034\nMOV             R0, R7; this                                           ; +0x166, 0x48a036\nADD             R5, R3                                                 ; +0x168, 0x48a038\nADD.W           R3, R2, R1,LSL#3                                       ; +0x16a, 0x48a03a\nLDR             R1, [R3]; float                                        ; +0x16e, 0x48a03e\nMOV.W           R9, R5,LSL#1                                           ; +0x170, 0x48a040\nLDR             R2, [R3,#4]; float                                     ; +0x174, 0x48a044\nBL              _ZN7cocos2d7CCPointC1Eff; cocos2d::CCPoint::CCPoint(float,float) ; +0x176, 0x48a046\nLDR.W           R1, [R4,#0x3C0]                                        ; +0x17a, 0x48a04a\nADD             R4, SP, #0x34+var_28                                   ; +0x17e, 0x48a04e\nADD.W           R3, R1, R9,LSL#2                                       ; +0x180, 0x48a050\nADD.W           R5, R1, R5,LSL#3                                       ; +0x184, 0x48a054\nADD.W           R9, SP, #0x34+var_20                                   ; +0x188, 0x48a058\nMOV             R0, R4; this                                           ; +0x18c, 0x48a05c\nLDR             R2, [R3,#4]; float                                     ; +0x18e, 0x48a05e\nLDR             R1, [R5]; float                                        ; +0x190, 0x48a060\nADD             R5, SP, #0x34+var_10                                   ; +0x192, 0x48a062\nBL              _ZN7cocos2d7CCPointC1Eff; cocos2d::CCPoint::CCPoint(float,float) ; +0x194, 0x48a064\nMOV             R1, R4                                                 ; +0x198, 0x48a068\nMOV             R0, R9                                                 ; +0x19a, 0x48a06a\nMOV             R2, R7                                                 ; +0x19c, 0x48a06c\nADD             R4, SP, #0x34+var_18                                   ; +0x19e, 0x48a06e\nBL              _ZNK7cocos2d7CCPointmiERKS0_; cocos2d::CCPoint::operator-(cocos2d::CCPoint const&) ; +0x1a0, 0x48a070\nMOV             R0, R5                                                 ; +0x1a4, 0x48a074\nMOV             R1, R9                                                 ; +0x1a6, 0x48a076\nVMOV            R2, S16                                                ; +0x1a8, 0x48a078\nBL              _ZNK7cocos2d7CCPointmlEf; cocos2d::CCPoint::operator*(float) ; +0x1ac, 0x48a07c\nMOV             R0, R4                                                 ; +0x1b0, 0x48a080\nMOV             R1, R7                                                 ; +0x1b2, 0x48a082\nMOV             R2, R5                                                 ; +0x1b4, 0x48a084\nBL              _ZNK7cocos2d7CCPointplERKS0_; cocos2d::CCPoint::operator+(cocos2d::CCPoint const&) ; +0x1b6, 0x48a086\nMOV             R0, R6                                                 ; +0x1ba, 0x48a08a\nMOV             R1, R4                                                 ; +0x1bc, 0x48a08c\nB               loc_48A098                                             ; +0x1be, 0x48a08e\nLDR             R1, =(qword_AC68B8 - 0x48A098)                         ; +0x1c0, 0x48a090\nMOV             R0, R6; this                                           ; +0x1c2, 0x48a092\nADD             R1, PC; qword_AC68B8                                   ; +0x1c4, 0x48a094\nADDS            R1, #(stru_AC68C0 - 0xAC68B8); cocos2d::CCPoint *      ; +0x1c6, 0x48a096\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x1c8, 0x48a098\nLDR             R2, [SP,#0x34+var_8]                                   ; +0x1cc, 0x48a09c\nMOV             R0, R6                                                 ; +0x1ce, 0x48a09e\nLDR.W           R3, [R8]                                               ; +0x1d0, 0x48a0a0\nCMP             R2, R3                                                 ; +0x1d4, 0x48a0a4\nBEQ             loc_48A0AC                                             ; +0x1d6, 0x48a0a6\nBLX             __stack_chk_fail                                       ; +0x1d8, 0x48a0a8\nADD             SP, SP, #0x34 ; '4'                                    ; +0x1dc, 0x48a0ac\nVPOP            {D8}                                                   ; +0x1de, 0x48a0ae\nPOP.W           {R4-R9,PC}                                             ; +0x1e2, 0x48a0b2", "xrefs": ["GJBaseGameLayer::processAdvancedFollowAction @ 0x48a208"], "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"}