{"type": "func", "start": 4790132, "end": 4790568, "name": "GJBaseGameLayer::toggleDualMode", "pseudocode": "// \n// GJBaseGameLayer::toggleDualMode from 0x491774 to 0x491928 (436 bytes)\n// \n// 6 xrefs:\n// > PlayLayer::loadFromCheckpoint @ 0x31f4e0\n// > LevelEditorLayer::onStopPlaytest @ 0x3692d6\n// > GJBaseGameLayer::setupLevelStart @ 0x491968\n// > GJBaseGameLayer::resetLevelVariables @ 0x491f4a\n// > GJBaseGameLayer::collisionCheckObjects @ 0x4929e2\n// > GJBaseGameLayer::collisionCheckObjects @ 0x492a46\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::toggleDualMode(GJBaseGameLayer *a1, GameObject *a2, bool a3, PlayerObject *a4, bool a5)\n{\n  UILayer *m_uiLayer; // r0\n  bool v9; // r1\n  PlayerObject *m_player1; // r3\n  PlayerObject *m_player2; // r0\n  PlayerObject *v12; // r1\n  GameObjectType ActiveMode; // r0\n  PlayerObject *v14; // r0\n  PlayerObject *v15; // r0\n  PlayerObject *v16; // r4\n  void (__fastcall *setRotation)(PlayerObject *__hidden, float); // r5\n  int v18; // r0\n  cocos2d::ccColor3B v19; // [sp+Ch] [bp-8h]\n\n  if ( a1->m_gameState.m_isDualMode == a3 )\n    return;\n  a1->m_gameState.m_isDualMode = a3;\n  m_uiLayer = a1->m_uiLayer;\n  v9 = a3 && a1->m_levelSettings->m_twoPlayerMode;\n  UILayer::updateDualMode(m_uiLayer, v9);\n  m_player1 = a1->m_player1;\n  m_player2 = a1->m_player2;\n  m_player1->m_unkA99 = a1->m_gameState.m_isDualMode;\n  m_player2->m_unkA99 = a1->m_gameState.m_isDualMode;\n  if ( a1->m_gameState.m_isDualMode )\n  {\n    m_player2->resetObject(m_player2);\n    GJBaseGameLayer::spawnPlayer2(a1);\n    if ( a1->m_levelSettings->m_twoPlayerMode )\n      PlayerObject::releaseButton(a1->m_player2, Jump);\n    if ( !a1->m_isEditor && !a5 )\n    {\n      PlayerObject::spawnDualCircle(a1->m_player1);\n      PlayerObject::spawnDualCircle(a1->m_player2);\n    }\n    if ( a2 )\n      a1->m_gameState.m_lastActivatedPortal2 = a2;\n    GJBaseGameLayer::playerWillSwitchMode(a1, a4, a2);\n    return;\n  }\n  if ( m_player1->m_isDart && (!a4 || a4->m_uniqueID != m_player1->m_uniqueID) )\n    PlayerObject::createFadeOutDartStreak(m_player1);\n  if ( a1->m_isEditor )\n  {\n    if ( a4 )\n    {\nLABEL_23:\n      if ( a4->m_uniqueID == a1->m_player2->m_uniqueID )\n        PlayerObject::copyAttributes(a1->m_player1);\n    }\n  }\n  else if ( a4 )\n  {\n    v12 = a1->m_player2;\n    if ( a4->m_uniqueID == v12->m_uniqueID )\n      v12 = a1->m_player1;\n    GJBaseGameLayer::playExitDualEffect(a1, v12);\n    goto LABEL_23;\n  }\n  GJBaseGameLayer::removePlayer2(a1);\n  if ( !a1->m_isEditor )\n  {\n    v19.r = 0;\n    *(_WORD *)&v19.g = 25855;\n    PlayerObject::spawnPortalCircle(a1->m_player1, v19, 50.0);\n  }\n  a1->m_gameState.m_lastActivatedPortal2 = nullptr;\n  if ( a2 && a2->m_classType == Effect )\n    GJBaseGameLayer::updateCameraMode(a1, (EffectGameObject *)a2, 0);\n  ActiveMode = PlayerObject::getActiveMode(a1->m_player1);\n  GJBaseGameLayer::updateDualGround(a1, a4, ActiveMode, 0, 0.0);\n  v14 = a1->m_player1;\n  if ( v14->m_isDart && (!a4 || a4->m_uniqueID != v14->m_uniqueID) )\n  {\n    PlayerObject::resetStreak(v14);\n    PlayerObject::placeStreakPoint(a1->m_player1);\n    v15 = a1->m_player2;\n    if ( v15->m_isDart )\n    {\n      v16 = a1->m_player1;\n      setRotation = v16->setRotation;\n      v18 = ((int (__fastcall *)(PlayerObject *))v15->getRotation)(v15);\n      ((void (__fastcall *)(PlayerObject *, int))setRotation)(v16, v18);\n    }\n  }\n}", "assembly": "; \n; GJBaseGameLayer::toggleDualMode from 0x491774 to 0x491928 (436 bytes)\n; \n; 6 xrefs:\n; > PlayLayer::loadFromCheckpoint @ 0x31f4e0\n; > LevelEditorLayer::onStopPlaytest @ 0x3692d6\n; > GJBaseGameLayer::setupLevelStart @ 0x491968\n; > GJBaseGameLayer::resetLevelVariables @ 0x491f4a\n; > GJBaseGameLayer::collisionCheckObjects @ 0x4929e2\n; > GJBaseGameLayer::collisionCheckObjects @ 0x492a46\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            {R4-R7,LR}                                             ; +0x0, 0x491774\nMOV             R5, R3                                                 ; +0x2, 0x491776\nLDRB.W          R3, [R0,#0x372]                                        ; +0x4, 0x491778\nSUB             SP, SP, #0x14                                          ; +0x8, 0x49177c\nMOV             R4, R0                                                 ; +0xa, 0x49177e\nMOV             R6, R1                                                 ; +0xc, 0x491780\nCMP             R3, R2                                                 ; +0xe, 0x491782\nLDRB.W          R7, [SP,#0x14+arg_0]                                   ; +0x10, 0x491784\nBEQ.W           loc_491924                                             ; +0x14, 0x491788\nADD.W           R3, R0, #0x2C80                                        ; +0x18, 0x49178c\nSTRB.W          R2, [R0,#0x372]                                        ; +0x1c, 0x491790\nLDR             R0, [R3]; this                                         ; +0x20, 0x491794\nCBZ             R2, loc_4917A2                                         ; +0x22, 0x491796\nLDR.W           R3, [R4,#0x8C0]                                        ; +0x24, 0x491798\nLDRB.W          R1, [R3,#0x118]                                        ; +0x28, 0x49179c\nB               loc_4917A4                                             ; +0x2c, 0x4917a0\nMOV             R1, R2; bool                                           ; +0x2e, 0x4917a2\nBL              _ZN7UILayer14updateDualModeEb; UILayer::updateDualMode(bool) ; +0x30, 0x4917a4\nLDRB.W          R2, [R4,#0x372]                                        ; +0x34, 0x4917a8\nLDR.W           R3, [R4,#0x8B8]                                        ; +0x38, 0x4917ac\nLDR.W           R0, [R4,#0x8BC]                                        ; +0x3c, 0x4917b0\nSTRB.W          R2, [R3,#0x861]                                        ; +0x40, 0x4917b4\nLDRB.W          R2, [R4,#0x372]                                        ; +0x44, 0x4917b8\nSTRB.W          R2, [R0,#0x861]                                        ; +0x48, 0x4917bc\nLDRB.W          R2, [R4,#0x372]                                        ; +0x4c, 0x4917c0\nCBZ             R2, loc_491818                                         ; +0x50, 0x4917c4\nLDR             R3, [R0]                                               ; +0x52, 0x4917c6\nLDR.W           R3, [R3,#0x27C]                                        ; +0x54, 0x4917c8\nBLX             R3                                                     ; +0x58, 0x4917cc\nMOV             R0, R4; this                                           ; +0x5a, 0x4917ce\nBL              _ZN15GJBaseGameLayer12spawnPlayer2Ev; GJBaseGameLayer::spawnPlayer2(void) ; +0x5c, 0x4917d0\nLDR.W           R3, [R4,#0x8C0]                                        ; +0x60, 0x4917d4\nLDRB.W          R3, [R3,#0x118]                                        ; +0x64, 0x4917d8\nCBZ             R3, loc_4917E8                                         ; +0x68, 0x4917dc\nLDR.W           R0, [R4,#0x8BC]                                        ; +0x6a, 0x4917de\nMOVS            R1, #1                                                 ; +0x6e, 0x4917e2\nBL              _ZN12PlayerObject13releaseButtonE12PlayerButton; PlayerObject::releaseButton(PlayerButton) ; +0x70, 0x4917e4\nMOVW            R3, #0x2A10                                            ; +0x74, 0x4917e8\nLDRB            R3, [R4,R3]                                            ; +0x78, 0x4917ec\nCBNZ            R3, loc_491802                                         ; +0x7a, 0x4917ee\nCBNZ            R7, loc_491802                                         ; +0x7c, 0x4917f0\nLDR.W           R0, [R4,#0x8B8]; this                                  ; +0x7e, 0x4917f2\nBL              _ZN12PlayerObject15spawnDualCircleEv; PlayerObject::spawnDualCircle(void) ; +0x82, 0x4917f6\nLDR.W           R0, [R4,#0x8BC]; this                                  ; +0x86, 0x4917fa\nBL              _ZN12PlayerObject15spawnDualCircleEv; PlayerObject::spawnDualCircle(void) ; +0x8a, 0x4917fe\nCBZ             R6, loc_491808                                         ; +0x8e, 0x491802\nSTR.W           R6, [R4,#0x35C]                                        ; +0x90, 0x491804\nMOV             R0, R4; this                                           ; +0x94, 0x491808\nMOV             R1, R5; PlayerObject *                                 ; +0x96, 0x49180a\nMOV             R2, R6; GameObject *                                   ; +0x98, 0x49180c\nADD             SP, SP, #0x14                                          ; +0x9a, 0x49180e\nPOP.W           {R4-R7,LR}                                             ; +0x9c, 0x491810\nB.W             _ZN15GJBaseGameLayer20playerWillSwitchModeEP12PlayerObjectP10GameObject; GJBaseGameLayer::playerWillSwitchMode(PlayerObject *,GameObject *) ; +0xa0, 0x491814\nLDRB.W          R2, [R3,#0x7B4]                                        ; +0xa4, 0x491818\nCBZ             R2, loc_49182E                                         ; +0xa8, 0x49181c\nCMP             R5, #0                                                 ; +0xaa, 0x49181e\nBEQ             loc_4918D2                                             ; +0xac, 0x491820\nLDR.W           R1, [R5,#0x304]                                        ; +0xae, 0x491822\nLDR.W           R2, [R3,#0x304]                                        ; +0xb2, 0x491826\nCMP             R1, R2                                                 ; +0xb6, 0x49182a\nBNE             loc_4918D2                                             ; +0xb8, 0x49182c\nMOVW            R3, #0x2A10                                            ; +0xba, 0x49182e\nLDRB            R3, [R4,R3]                                            ; +0xbe, 0x491832\nCBNZ            R3, loc_491854                                         ; +0xc0, 0x491834\nCBZ             R5, loc_491866                                         ; +0xc2, 0x491836\nLDR.W           R1, [R4,#0x8BC]                                        ; +0xc4, 0x491838\nMOV             R0, R4; this                                           ; +0xc8, 0x49183c\nLDR.W           R2, [R5,#0x304]                                        ; +0xca, 0x49183e\nLDR.W           R3, [R1,#0x304]                                        ; +0xce, 0x491842\nCMP             R2, R3                                                 ; +0xd2, 0x491846\nIT EQ                                                                  ; +0xd4, 0x491848\nLDREQ.W         R1, [R4,#0x8B8]; PlayerObject *                        ; +0xd6, 0x49184a\nBL              _ZN15GJBaseGameLayer18playExitDualEffectEP12PlayerObject; GJBaseGameLayer::playExitDualEffect(PlayerObject *) ; +0xda, 0x49184e\nB               loc_491856                                             ; +0xde, 0x491852\nCBZ             R5, loc_491866                                         ; +0xe0, 0x491854\nLDR.W           R1, [R4,#0x8BC]; PlayerObject *                        ; +0xe2, 0x491856\nLDR.W           R2, [R5,#0x304]                                        ; +0xe6, 0x49185a\nLDR.W           R3, [R1,#0x304]                                        ; +0xea, 0x49185e\nCMP             R2, R3                                                 ; +0xee, 0x491862\nBEQ             loc_4918DA                                             ; +0xf0, 0x491864\nMOV             R0, R4; this                                           ; +0xf2, 0x491866\nBL              _ZN15GJBaseGameLayer13removePlayer2Ev; GJBaseGameLayer::removePlayer2(void) ; +0xf4, 0x491868\nMOVW            R3, #0x2A10                                            ; +0xf8, 0x49186c\nLDRB            R3, [R4,R3]                                            ; +0xfc, 0x491870\nCBNZ            R3, loc_491890                                         ; +0xfe, 0x491872\nSTRB.W          R3, [SP,#0x14+var_8]                                   ; +0x100, 0x491874\nMOVS            R3, #0xFF                                              ; +0x104, 0x491878\nSTRB.W          R3, [SP,#0x14+var_8+1]                                 ; +0x106, 0x49187a\nMOVS            R3, #0x64 ; 'd'                                        ; +0x10a, 0x49187e\nSTRB.W          R3, [SP,#0x14+var_8+2]                                 ; +0x10c, 0x491880\nLDR.W           R0, [R4,#0x8B8]                                        ; +0x110, 0x491884\nLDR             R1, [SP,#0x14+var_8]                                   ; +0x114, 0x491888\nLDR             R2, =0x42480000                                        ; +0x116, 0x49188a\nBL              _ZN12PlayerObject17spawnPortalCircleEN7cocos2d10_ccColor3BEf; PlayerObject::spawnPortalCircle(cocos2d::_ccColor3B,float) ; +0x118, 0x49188c\nMOVS            R2, #0; bool                                           ; +0x11c, 0x491890\nSTR.W           R2, [R4,#0x35C]                                        ; +0x11e, 0x491892\nCBZ             R6, loc_4918A0                                         ; +0x122, 0x491896\nLDR.W           R3, [R6,#0x434]                                        ; +0x124, 0x491898\nCMP             R3, #1                                                 ; +0x128, 0x49189c\nBEQ             loc_4918E4                                             ; +0x12a, 0x49189e\nLDR.W           R0, [R4,#0x8B8]; this                                  ; +0x12c, 0x4918a0\nBL              _ZN12PlayerObject13getActiveModeEv; PlayerObject::getActiveMode(void) ; +0x130, 0x4918a4\nMOVS            R3, #0                                                 ; +0x134, 0x4918a8\nMOV             R1, R5; PlayerObject *                                 ; +0x136, 0x4918aa\nSTR             R3, [SP,#0x14+var_14]; float                           ; +0x138, 0x4918ac\nMOVS            R3, #0; bool                                           ; +0x13a, 0x4918ae\nMOV             R2, R0; int                                            ; +0x13c, 0x4918b0\nMOV             R0, R4; this                                           ; +0x13e, 0x4918b2\nBL              _ZN15GJBaseGameLayer16updateDualGroundEP12PlayerObjectibf; GJBaseGameLayer::updateDualGround(PlayerObject *,int,bool,float) ; +0x140, 0x4918b4\nLDR.W           R0, [R4,#0x8B8]; this                                  ; +0x144, 0x4918b8\nLDRB.W          R3, [R0,#0x7B4]                                        ; +0x148, 0x4918bc\nCBZ             R3, loc_491924                                         ; +0x14c, 0x4918c0\nCBZ             R5, loc_4918EE                                         ; +0x14e, 0x4918c2\nLDR.W           R2, [R5,#0x304]                                        ; +0x150, 0x4918c4\nLDR.W           R3, [R0,#0x304]                                        ; +0x154, 0x4918c8\nCMP             R2, R3                                                 ; +0x158, 0x4918cc\nBNE             loc_4918EE                                             ; +0x15a, 0x4918ce\nB               loc_491924                                             ; +0x15c, 0x4918d0\nMOV             R0, R3; this                                           ; +0x15e, 0x4918d2\nBL              _ZN12PlayerObject23createFadeOutDartStreakEv; PlayerObject::createFadeOutDartStreak(void) ; +0x160, 0x4918d4\nB               loc_49182E                                             ; +0x164, 0x4918d8\nLDR.W           R0, [R4,#0x8B8]; this                                  ; +0x166, 0x4918da\nBL              _ZN12PlayerObject14copyAttributesEPS_; PlayerObject::copyAttributes(PlayerObject*) ; +0x16a, 0x4918de\nB               loc_491866                                             ; +0x16e, 0x4918e2\nMOV             R0, R4; this                                           ; +0x170, 0x4918e4\nMOV             R1, R6; EffectGameObject *                             ; +0x172, 0x4918e6\nBL              _ZN15GJBaseGameLayer16updateCameraModeEP16EffectGameObjectb; GJBaseGameLayer::updateCameraMode(EffectGameObject *,bool) ; +0x174, 0x4918e8\nB               loc_4918A0                                             ; +0x178, 0x4918ec\nBL              _ZN12PlayerObject11resetStreakEv; PlayerObject::resetStreak(void) ; +0x17a, 0x4918ee\nLDR.W           R0, [R4,#0x8B8]; this                                  ; +0x17e, 0x4918f2\nBL              _ZN12PlayerObject16placeStreakPointEv; PlayerObject::placeStreakPoint(void) ; +0x182, 0x4918f6\nLDR.W           R0, [R4,#0x8BC]                                        ; +0x186, 0x4918fa\nLDRB.W          R3, [R0,#0x7B4]                                        ; +0x18a, 0x4918fe\nCBZ             R3, loc_491924                                         ; +0x18e, 0x491902\nLDR.W           R4, [R4,#0x8B8]                                        ; +0x190, 0x491904\nLDR             R3, [R4]                                               ; +0x194, 0x491908\nLDR.W           R5, [R3,#0xAC]                                         ; +0x196, 0x49190a\nLDR             R3, [R0]                                               ; +0x19a, 0x49190e\nLDR.W           R3, [R3,#0xB0]                                         ; +0x19c, 0x491910\nBLX             R3                                                     ; +0x1a0, 0x491914\nMOV             R3, R5                                                 ; +0x1a2, 0x491916\nMOV             R1, R0                                                 ; +0x1a4, 0x491918\nMOV             R0, R4                                                 ; +0x1a6, 0x49191a\nADD             SP, SP, #0x14                                          ; +0x1a8, 0x49191c\nPOP.W           {R4-R7,LR}                                             ; +0x1aa, 0x49191e\nBX              R3                                                     ; +0x1ae, 0x491922\nADD             SP, SP, #0x14                                          ; +0x1b0, 0x491924\nPOP             {R4-R7,PC}                                             ; +0x1b2, 0x491926", "xrefs": ["PlayLayer::loadFromCheckpoint @ 0x31f4e0", "LevelEditorLayer::onStopPlaytest @ 0x3692d6", "GJBaseGameLayer::setupLevelStart @ 0x491968", "GJBaseGameLayer::resetLevelVariables @ 0x491f4a", "GJBaseGameLayer::collisionCheckObjects @ 0x4929e2", "GJBaseGameLayer::collisionCheckObjects @ 0x492a46"], "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"}