{"type": "func", "start": 4789816, "end": 4790130, "name": "GJBaseGameLayer::playerWillSwitchMode", "pseudocode": "// \n// GJBaseGameLayer::playerWillSwitchMode from 0x491638 to 0x491772 (314 bytes)\n// \n// 9 xrefs:\n// > GJBaseGameLayer::toggleDualMode @ 0x491814\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492768\n// > GJBaseGameLayer::collisionCheckObjects @ 0x4927b0\n// > GJBaseGameLayer::collisionCheckObjects @ 0x4927cc\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492812\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492858\n// > GJBaseGameLayer::collisionCheckObjects @ 0x49287e\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492c3e\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492c4c\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\nvoid GJBaseGameLayer::playerWillSwitchMode(GJBaseGameLayer *a1, PlayerObject *a2, GameObject *a3)\n{\n  GameObjectClassType m_classType; // r3\n  GameObjectType v7; // r0\n  GameObjectType v8; // r0\n  GJGameEvent v9; // r0\n  GameObjectType v10; // r0\n  LevelSettingsObject *m_levelSettings; // r3\n  _BOOL4 m_twoPlayerMode; // r4\n  PlayerObject *OtherPlayer; // r6\n  GameObjectType v14; // r0\n  int m_isBird; // r0\n\n  if ( a3 )\n  {\n    m_classType = a3->m_classType;\n    a1->m_gameState.m_lastActivatedPortal1 = a3;\n    if ( m_classType == Effect )\n      GJBaseGameLayer::updateCameraMode(a1, (EffectGameObject *)a3, 0);\n    v7 = a3->getType(a3);\n    GJBaseGameLayer::updateDualGround(a1, a2, v7, 0, 0.0);\n    v8 = a3->getType(a3);\n    v9 = GJBaseGameLayer::objectTypeToGameEvent(a1, v8);\n    GJBaseGameLayer::gameEventTriggered(a1, v9, 0, 0);\n    v10 = a3->getType(a3);\n    if ( v10 != ShipPortal && v10 != UfoPortal && v10 != WavePortal && v10 != SwingPortal )\n      a1->toggleGlitter(a1, 0);\n    if ( a1->m_gameState.m_isDualMode )\n    {\n      m_levelSettings = a1->m_levelSettings;\n      m_twoPlayerMode = m_levelSettings->m_twoPlayerMode;\n      if ( !m_levelSettings->m_twoPlayerMode )\n      {\n        OtherPlayer = GJBaseGameLayer::getOtherPlayer(a1, a2);\n        v14 = a3->getType(a3);\n        if ( v14 == UfoPortal )\n        {\n          m_isBird = OtherPlayer->m_isBird;\n          goto LABEL_17;\n        }\n        if ( (unsigned int)v14 <= UfoPortal )\n        {\n          switch ( v14 )\n          {\n            case CubePortal:\n              m_isBird = PlayerObject::isFlying(OtherPlayer);\n              if ( m_isBird )\n              {\n                m_isBird = m_twoPlayerMode;\n              }\n              else if ( !OtherPlayer->m_isBall )\n              {\n                if ( OtherPlayer->m_isRobot )\n                  m_isBird = OtherPlayer->m_isBall;\n                else\n                  m_isBird = !OtherPlayer->m_isSpider;\n              }\n              goto LABEL_17;\n            case BallPortal:\n              m_isBird = OtherPlayer->m_isBall;\n              goto LABEL_17;\n            case ShipPortal:\n              m_isBird = OtherPlayer->m_isShip;\n              goto LABEL_17;\n          }\n          goto LABEL_28;\n        }\n        switch ( v14 )\n        {\n          case SpiderPortal:\n            m_isBird = OtherPlayer->m_isSpider;\n            break;\n          case SwingPortal:\n            m_isBird = OtherPlayer->m_isSwing;\n            break;\n          case RobotPortal:\n            m_isBird = OtherPlayer->m_isRobot;\n            break;\n          default:\nLABEL_28:\n            m_isBird = 0;\n            break;\n        }\nLABEL_17:\n        if ( !a1->m_gameState.m_unkBool31 )\n        {\n          if ( m_isBird )\n            PlayerObject::flipGravity(a2, !OtherPlayer->m_isUpsideDown, 1);\n        }\n      }\n    }\n  }\n}", "assembly": "; \n; GJBaseGameLayer::playerWillSwitchMode from 0x491638 to 0x491772 (314 bytes)\n; \n; 9 xrefs:\n; > GJBaseGameLayer::toggleDualMode @ 0x491814\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492768\n; > GJBaseGameLayer::collisionCheckObjects @ 0x4927b0\n; > GJBaseGameLayer::collisionCheckObjects @ 0x4927cc\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492812\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492858\n; > GJBaseGameLayer::collisionCheckObjects @ 0x49287e\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492c3e\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492c4c\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          {R0,R1,R4-R8,LR}                                       ; +0x0, 0x491638\nMOV             R7, R0                                                 ; +0x4, 0x49163c\nMOV             R8, R1                                                 ; +0x6, 0x49163e\nMOV             R5, R2                                                 ; +0x8, 0x491640\nCMP             R2, #0                                                 ; +0xa, 0x491642\nBEQ.W           loc_49176C                                             ; +0xc, 0x491644\nLDR.W           R3, [R2,#0x434]                                        ; +0x10, 0x491648\nSTR.W           R2, [R7,#0x358]                                        ; +0x14, 0x49164c\nCMP             R3, #1                                                 ; +0x18, 0x491650\nBNE             loc_49165C                                             ; +0x1a, 0x491652\nMOV             R1, R2; EffectGameObject *                             ; +0x1c, 0x491654\nMOVS            R2, #0; bool                                           ; +0x1e, 0x491656\nBL              _ZN15GJBaseGameLayer16updateCameraModeEP16EffectGameObjectb; GJBaseGameLayer::updateCameraMode(EffectGameObject *,bool) ; +0x20, 0x491658\nLDR             R3, [R5]                                               ; +0x24, 0x49165c\nMOV             R0, R5                                                 ; +0x26, 0x49165e\nLDR.W           R3, [R3,#0x37C]                                        ; +0x28, 0x491660\nBLX             R3                                                     ; +0x2c, 0x491664\nMOV             R1, R8; PlayerObject *                                 ; +0x2e, 0x491666\nMOVS            R3, #0                                                 ; +0x30, 0x491668\nSTR             R3, [SP,#8+var_8]; float                               ; +0x32, 0x49166a\nMOVS            R3, #0; bool                                           ; +0x34, 0x49166c\nMOV             R2, R0; int                                            ; +0x36, 0x49166e\nMOV             R0, R7; this                                           ; +0x38, 0x491670\nBL              _ZN15GJBaseGameLayer16updateDualGroundEP12PlayerObjectibf; GJBaseGameLayer::updateDualGround(PlayerObject *,int,bool,float) ; +0x3a, 0x491672\nLDR             R3, [R5]                                               ; +0x3e, 0x491676\nMOV             R0, R5                                                 ; +0x40, 0x491678\nLDR.W           R3, [R3,#0x37C]                                        ; +0x42, 0x49167a\nBLX             R3                                                     ; +0x46, 0x49167e\nMOV             R1, R0; int                                            ; +0x48, 0x491680\nMOV             R0, R7; this                                           ; +0x4a, 0x491682\nBL              _ZN15GJBaseGameLayer21objectTypeToGameEventEi; GJBaseGameLayer::objectTypeToGameEvent(int) ; +0x4c, 0x491684\nMOVS            R2, #0                                                 ; +0x50, 0x491688\nMOV             R3, R2                                                 ; +0x52, 0x49168a\nMOV             R1, R0                                                 ; +0x54, 0x49168c\nMOV             R0, R7                                                 ; +0x56, 0x49168e\nBL              _ZN15GJBaseGameLayer18gameEventTriggeredE11GJGameEventii; GJBaseGameLayer::gameEventTriggered(GJGameEvent,int,int) ; +0x58, 0x491690\nLDR             R3, [R5]                                               ; +0x5c, 0x491694\nMOV             R0, R5                                                 ; +0x5e, 0x491696\nLDR.W           R3, [R3,#0x37C]                                        ; +0x60, 0x491698\nBLX             R3                                                     ; +0x64, 0x49169c\nCMP             R0, #5                                                 ; +0x66, 0x49169e\nBEQ             loc_4916BA                                             ; +0x68, 0x4916a0\nCMP             R0, #0x13                                              ; +0x6a, 0x4916a2\nBEQ             loc_4916BA                                             ; +0x6c, 0x4916a4\nCMP             R0, #0x1A                                              ; +0x6e, 0x4916a6\nBEQ             loc_4916BA                                             ; +0x70, 0x4916a8\nCMP             R0, #0x29 ; ')'                                        ; +0x72, 0x4916aa\nBEQ             loc_4916BA                                             ; +0x74, 0x4916ac\nLDR             R3, [R7]                                               ; +0x76, 0x4916ae\nMOV             R0, R7                                                 ; +0x78, 0x4916b0\nMOVS            R1, #0                                                 ; +0x7a, 0x4916b2\nLDR.W           R3, [R3,#0x27C]                                        ; +0x7c, 0x4916b4\nBLX             R3                                                     ; +0x80, 0x4916b8\nLDRB.W          R3, [R7,#0x372]                                        ; +0x82, 0x4916ba\nCMP             R3, #0                                                 ; +0x86, 0x4916be\nBEQ             loc_49176C                                             ; +0x88, 0x4916c0\nLDR.W           R3, [R7,#0x8C0]                                        ; +0x8a, 0x4916c2\nLDRB.W          R4, [R3,#0x118]                                        ; +0x8e, 0x4916c6\nCMP             R4, #0                                                 ; +0x92, 0x4916ca\nBNE             loc_49176C                                             ; +0x94, 0x4916cc\nMOV             R1, R8; PlayerObject *                                 ; +0x96, 0x4916ce\nMOV             R0, R7; this                                           ; +0x98, 0x4916d0\nBL              _ZN15GJBaseGameLayer14getOtherPlayerEP12PlayerObject; GJBaseGameLayer::getOtherPlayer(PlayerObject *) ; +0x9a, 0x4916d2\nLDR             R3, [R5]                                               ; +0x9e, 0x4916d6\nLDR.W           R3, [R3,#0x37C]                                        ; +0xa0, 0x4916d8\nMOV             R6, R0                                                 ; +0xa4, 0x4916dc\nMOV             R0, R5                                                 ; +0xa6, 0x4916de\nBLX             R3                                                     ; +0xa8, 0x4916e0\nCMP             R0, #0x13                                              ; +0xaa, 0x4916e2\nBNE             loc_4916EC                                             ; +0xac, 0x4916e4\nLDRB.W          R0, [R6,#0x7B2]                                        ; +0xae, 0x4916e6\nB               loc_491700                                             ; +0xb2, 0x4916ea\nBHI             loc_49174E                                             ; +0xb4, 0x4916ec\nCMP             R0, #6                                                 ; +0xb6, 0x4916ee\nBNE             loc_491736                                             ; +0xb8, 0x4916f0\nMOV             R0, R6; this                                           ; +0xba, 0x4916f2\nBL              _ZN12PlayerObject8isFlyingEv; PlayerObject::isFlying(void) ; +0xbc, 0x4916f4\nCBNZ            R0, loc_49172E                                         ; +0xc0, 0x4916f8\nLDRB.W          R3, [R6,#0x7B3]                                        ; +0xc2, 0x4916fa\nCBZ             R3, loc_49171E                                         ; +0xc6, 0x4916fe\nLDRB.W          R3, [R7,#0x5F0]                                        ; +0xc8, 0x491700\nCBNZ            R3, loc_49176C                                         ; +0xcc, 0x491704\nCBZ             R0, loc_49176C                                         ; +0xce, 0x491706\nLDRB.W          R1, [R6,#0x7B7]                                        ; +0xd0, 0x491708\nMOV             R0, R8; this                                           ; +0xd4, 0x49170c\nMOVS            R2, #1; bool                                           ; +0xd6, 0x49170e\nEOR.W           R1, R1, #1; bool                                       ; +0xd8, 0x491710\nADD             SP, SP, #8                                             ; +0xdc, 0x491714\nPOP.W           {R4-R8,LR}                                             ; +0xde, 0x491716\nB.W             _ZN12PlayerObject11flipGravityEbb; PlayerObject::flipGravity(bool,bool) ; +0xe2, 0x49171a\nLDRB.W          R2, [R6,#0x7B5]                                        ; +0xe6, 0x49171e\nCBNZ            R2, loc_491732                                         ; +0xea, 0x491722\nLDRB.W          R0, [R6,#0x7B6]                                        ; +0xec, 0x491724\nEOR.W           R0, R0, #1                                             ; +0xf0, 0x491728\nB               loc_491700                                             ; +0xf4, 0x49172c\nMOV             R0, R4                                                 ; +0xf6, 0x49172e\nB               loc_491700                                             ; +0xf8, 0x491730\nMOV             R0, R3                                                 ; +0xfa, 0x491732\nB               loc_491700                                             ; +0xfc, 0x491734\nCMP             R0, #0x10                                              ; +0xfe, 0x491736\nBNE             loc_491740                                             ; +0x100, 0x491738\nLDRB.W          R0, [R6,#0x7B3]                                        ; +0x102, 0x49173a\nB               loc_491700                                             ; +0x106, 0x49173e\nCMP             R0, #5                                                 ; +0x108, 0x491740\nBNE             loc_49174A                                             ; +0x10a, 0x491742\nLDRB.W          R0, [R6,#0x7B1]                                        ; +0x10c, 0x491744\nB               loc_491700                                             ; +0x110, 0x491748\nMOVS            R0, #0                                                 ; +0x112, 0x49174a\nB               loc_491700                                             ; +0x114, 0x49174c\nCMP             R0, #0x21 ; '!'                                        ; +0x116, 0x49174e\nBNE             loc_491758                                             ; +0x118, 0x491750\nLDRB.W          R0, [R6,#0x7B6]                                        ; +0x11a, 0x491752\nB               loc_491700                                             ; +0x11e, 0x491756\nCMP             R0, #0x29 ; ')'                                        ; +0x120, 0x491758\nBNE             loc_491762                                             ; +0x122, 0x49175a\nLDRB.W          R0, [R6,#0x7BC]                                        ; +0x124, 0x49175c\nB               loc_491700                                             ; +0x128, 0x491760\nCMP             R0, #0x1B                                              ; +0x12a, 0x491762\nBNE             loc_49174A                                             ; +0x12c, 0x491764\nLDRB.W          R0, [R6,#0x7B5]                                        ; +0x12e, 0x491766\nB               loc_491700                                             ; +0x132, 0x49176a\nADD             SP, SP, #8                                             ; +0x134, 0x49176c\nPOP.W           {R4-R8,PC}                                             ; +0x136, 0x49176e", "xrefs": ["GJBaseGameLayer::toggleDualMode @ 0x491814", "GJBaseGameLayer::collisionCheckObjects @ 0x492768", "GJBaseGameLayer::collisionCheckObjects @ 0x4927b0", "GJBaseGameLayer::collisionCheckObjects @ 0x4927cc", "GJBaseGameLayer::collisionCheckObjects @ 0x492812", "GJBaseGameLayer::collisionCheckObjects @ 0x492858", "GJBaseGameLayer::collisionCheckObjects @ 0x49287e", "GJBaseGameLayer::collisionCheckObjects @ 0x492c3e", "GJBaseGameLayer::collisionCheckObjects @ 0x492c4c"], "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"}