{"type": "func", "start": 4656560, "end": 4656722, "name": "GJBaseGameLayer::getPortalTarget", "pseudocode": "// \n// GJBaseGameLayer::getPortalTarget from 0x470db0 to 0x470e52 (162 bytes)\n// \n// 1 xrefs:\n// > GJBaseGameLayer::teleportPlayer @ 0x49128e\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\nTeleportPortalObject *GJBaseGameLayer::getPortalTarget(GJBaseGameLayer *a1, TeleportPortalObject *a2)\n{\n  int m_targetGroupID; // r1\n  cocos2d::CCArray *Group; // r6\n  int v5; // r0\n  unsigned int v6; // r2\n  float v7; // s15\n\n  if ( a2->m_orangePortal )\n    return a2->m_orangePortal;\n  m_targetGroupID = a2->m_targetGroupID;\n  if ( m_targetGroupID <= 0 )\n    return nullptr;\n  Group = GJBaseGameLayer::getGroup(a1, m_targetGroupID);\n  v5 = cocos2d::CCArray::count(Group);\n  if ( v5 <= 0 )\n    return nullptr;\n  if ( v5 == 1 )\n  {\n    v7 = 0.0;\n  }\n  else\n  {\n    v6 = (unsigned int)(214013 * qword_AC68B8 + 2531011) >> 16;\n    qword_AC68B8 = 214013 * qword_AC68B8 + 2531011;\n    v7 = (float)(v6 & 0x7FFF) / 32767.0;\n    if ( v7 == 1.0 )\n      v7 = 0.0;\n  }\n  return (TeleportPortalObject *)cocos2d::CCArray::objectAtIndex(Group, (int)(float)((float)v5 * v7));\n}", "assembly": "; \n; GJBaseGameLayer::getPortalTarget from 0x470db0 to 0x470e52 (162 bytes)\n; \n; 1 xrefs:\n; > GJBaseGameLayer::teleportPlayer @ 0x49128e\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\nLDR.W           R3, [R1,#0x668]                                        ; +0x0, 0x470db0\nPUSH            {R4-R6,LR}                                             ; +0x4, 0x470db4\nCMP             R3, #0                                                 ; +0x6, 0x470db6\nBNE             loc_470E4E                                             ; +0x8, 0x470db8\nLDR.W           R1, [R1,#0x4FC]; int                                   ; +0xa, 0x470dba\nCMP             R1, #0                                                 ; +0xe, 0x470dbe\nBGT             loc_470DC6                                             ; +0x10, 0x470dc0\nMOVS            R0, #0; this                                           ; +0x12, 0x470dc2\nPOP             {R4-R6,PC}                                             ; +0x14, 0x470dc4\nBL              _ZN15GJBaseGameLayer8getGroupEi; GJBaseGameLayer::getGroup(int) ; +0x16, 0x470dc6\nMOV             R6, R0                                                 ; +0x1a, 0x470dca\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x1c, 0x470dcc\nCMP             R0, #0                                                 ; +0x20, 0x470dd0\nBLE             loc_470DC2                                             ; +0x22, 0x470dd2\nCMP             R0, #1                                                 ; +0x24, 0x470dd4\nBEQ             loc_470E2C                                             ; +0x26, 0x470dd6\nLDR             R1, =(qword_AC68B8 - 0x470DE0)                         ; +0x28, 0x470dd8\nLDR             R2, =0x343FD                                           ; +0x2a, 0x470dda\nADD             R1, PC; qword_AC68B8                                   ; +0x2c, 0x470ddc\nVLDR            S14, =32767.0                                          ; +0x2e, 0x470dde\nLDR             R4, [R1]                                               ; +0x32, 0x470de2\nLDR             R3, [R1,#(qword_AC68B8+4 - 0xAC68B8)]                  ; +0x34, 0x470de4\nUMULL           R4, R5, R4, R2                                         ; +0x36, 0x470de6\nMLA             R5, R2, R3, R5                                         ; +0x3a, 0x470dea\nADR             R3, dword_470E58                                       ; +0x3e, 0x470dee\nLDRD.W          R2, R3, [R3]                                           ; +0x40, 0x470df0\nADDS            R4, R4, R2                                             ; +0x44, 0x470df4\nADCS            R5, R3                                                 ; +0x46, 0x470df6\nLSRS            R2, R4, #0x10                                          ; +0x48, 0x470df8\nSTRD.W          R4, R5, [R1]                                           ; +0x4a, 0x470dfa\nMOVW            R4, #0x7FFF                                            ; +0x4e, 0x470dfe\nORR.W           R2, R2, R5,LSL#16                                      ; +0x52, 0x470e02\nANDS            R2, R4                                                 ; +0x56, 0x470e06\nVMOV            S15, R2                                                ; +0x58, 0x470e08\nVCVT.F32.S32    S15, S15                                               ; +0x5c, 0x470e0c\nVDIV.F32        S15, S15, S14                                          ; +0x60, 0x470e10\nVMOV.F32        S14, #1.0                                              ; +0x64, 0x470e14\nVCMP.F32        S15, S14                                               ; +0x68, 0x470e18\nVLDR            S14, =0.0                                              ; +0x6c, 0x470e1c\nVMRS            APSR_nzcv, FPSCR                                       ; +0x70, 0x470e20\nIT EQ                                                                  ; +0x74, 0x470e24\nVMOVEQ.F32      S15, S14                                               ; +0x76, 0x470e26\nB               loc_470E30                                             ; +0x7a, 0x470e2a\nVLDR            S15, =0.0                                              ; +0x7c, 0x470e2c\nVMOV            S14, R0                                                ; +0x80, 0x470e30\nMOV             R0, R6; this                                           ; +0x84, 0x470e34\nPOP.W           {R4-R6,LR}                                             ; +0x86, 0x470e36\nVCVT.F32.S32    S14, S14                                               ; +0x8a, 0x470e3a\nVMUL.F32        S15, S14, S15                                          ; +0x8e, 0x470e3e\nVCVT.S32.F32    S15, S15                                               ; +0x92, 0x470e42\nVMOV            R1, S15; unsigned int                                  ; +0x96, 0x470e46\nB.W             _ZN7cocos2d7CCArray13objectAtIndexEj; cocos2d::CCArray::objectAtIndex(uint) ; +0x9a, 0x470e4a\nMOV             R0, R3                                                 ; +0x9e, 0x470e4e\nPOP             {R4-R6,PC}                                             ; +0xa0, 0x470e50", "xrefs": ["GJBaseGameLayer::teleportPlayer @ 0x49128e"], "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"}