{"type": "func", "start": 8963928, "end": 8964540, "name": "GJBaseGameLayer::handleButton", "pseudocode": "// \n// GJBaseGameLayer::handleButton from 0x88c758 to 0x88c9bc (612 bytes)\n// \n// 2 xrefs:\n// > GJBaseGameLayer::processQueuedButtons @ 0x88ca14\n// > <???> @ 0xa5810\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::handleButton(GJBaseGameLayer *a1, bool a2, int a3, bool a4)\n{\n  float *v4; // x20\n  _BOOL4 v6; // w21\n  unsigned int v7; // w22\n  unsigned int m_twoPlayerMode; // w24\n  bool hasActiveDualTouch; // w0\n  int m_clickIndex; // w0\n  PlayerObject *m_player1; // x0\n  _BOOL4 v13; // w25\n  unsigned int v14; // w2\n  GJGameEvent v15; // w1\n  int v16; // w3\n  GameManager *v17; // x0\n  PlayerObject *m_player2; // x0\n  bool v19; // w0\n  bool v20; // w0\n\n  v4 = &a1->m_varianceValues.__elems_[1975];\n  v6 = a2;\n  v7 = a4;\n  m_twoPlayerMode = a1->m_levelSettings->m_twoPlayerMode;\n  if ( !a1->m_isPlatformer && !a1->m_useReplay )\n  {\n    v17 = GameManager::sharedState();\n    if ( GameManager::getGameVariable(v17, \"0010\") )\n      v7 ^= 1u;\n  }\n  hasActiveDualTouch = GJEffectManager::hasActiveDualTouch(a1->m_effectManager);\n  if ( v6 )\n  {\n    *((_BYTE *)v4 + 236) = hasActiveDualTouch;\n  }\n  else if ( !*((_BYTE *)v4 + 236) )\n  {\n    goto LABEL_6;\n  }\n  if ( v7 < hasActiveDualTouch )\n    goto LABEL_9;\nLABEL_6:\n  if ( v7 < m_twoPlayerMode || !GJBaseGameLayer::isButtonAllowed(a1, v6, a3, 1) )\n  {\n    if ( *((_BYTE *)v4 + 236)\n      || !a1->m_gameState.m_isDualMode\n      || v7 > (m_twoPlayerMode ^ 1)\n      || !GJBaseGameLayer::isButtonAllowed(a1, v6, a3, 0) )\n    {\n      goto LABEL_9;\n    }\n    goto LABEL_40;\n  }\n  m_player1 = a1->m_player1;\n  if ( v6 )\n    v13 = PlayerObject::pushButton(m_player1, (PlayerButton)a3);\n  else\n    v13 = PlayerObject::releaseButton(m_player1, (PlayerButton)a3);\n  if ( !*((_BYTE *)v4 + 236)\n    && a1->m_gameState.m_isDualMode\n    && v7 <= (m_twoPlayerMode ^ 1)\n    && GJBaseGameLayer::isButtonAllowed(a1, v6, a3, 0) )\n  {\nLABEL_40:\n    m_player2 = a1->m_player2;\n    if ( v6 )\n    {\n      v19 = PlayerObject::pushButton(m_player2, (PlayerButton)a3);\n      v14 = m_twoPlayerMode;\n      if ( !v19 )\n        goto LABEL_9;\n      goto LABEL_26;\n    }\n    v20 = PlayerObject::releaseButton(m_player2, (PlayerButton)a3);\n    v14 = m_twoPlayerMode;\n    if ( !v20 )\n      goto LABEL_9;\nLABEL_45:\n    if ( (unsigned int)(a3 - 1) > 2 )\n      goto LABEL_9;\n    v15 = dword_EED690[a3 - 1];\n    goto LABEL_28;\n  }\n  if ( !v13 )\n    goto LABEL_9;\n  v14 = 0;\n  if ( !v6 )\n    goto LABEL_45;\nLABEL_26:\n  if ( (unsigned int)(a3 - 1) > 2 )\n    goto LABEL_9;\n  v15 = dword_EED680[a3 - 1];\nLABEL_28:\n  if ( v15 )\n  {\n    if ( v14 )\n      v16 = 2;\n    else\n      v16 = 1;\n    GJBaseGameLayer::gameEventTriggered(a1, v15, 0, v16);\n  }\nLABEL_9:\n  if ( !a1->m_player1->m_isDead )\n    GJEffectManager::playerButton(a1->m_effectManager, v6, v7);\n  if ( !*((_BYTE *)v4 + 496) )\n    GJBaseGameLayer::recordAction(a1, a3, v6, m_twoPlayerMode & (v7 ^ 1));\n  if ( v6 )\n  {\n    m_clickIndex = a1->m_clickIndex;\n    ++a1->m_clicks;\n    a1->m_clickIndex = m_clickIndex + 1;\n    if ( a3 == 1 )\n      *((_BYTE *)v4 + 248) = 1;\n  }\n}", "assembly": "; \n; GJBaseGameLayer::handleButton from 0x88c758 to 0x88c9bc (612 bytes)\n; \n; 2 xrefs:\n; > GJBaseGameLayer::processQueuedButtons @ 0x88ca14\n; > <???> @ 0xa5810\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\nSTP             X29, X30, [SP,#var_50]!                                ; +0x0, 0x88c758\nMOV             X29, SP                                                ; +0x4, 0x88c75c\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x88c760\nADD             X20, X0, #3,LSL#12                                     ; +0xc, 0x88c764\nMOV             X19, X0                                                ; +0x10, 0x88c768\nSTP             X21, X22, [SP,#0x50+var_30]                            ; +0x14, 0x88c76c\nUXTB            W21, W1                                                ; +0x18, 0x88c770\nLDR             X1, [X0,#0xE08]                                        ; +0x1c, 0x88c774\nLDRB            W0, [X20,#0x10E]                                       ; +0x20, 0x88c778\nUXTB            W22, W3                                                ; +0x24, 0x88c77c\nSTP             X23, X24, [SP,#0x50+var_20]                            ; +0x28, 0x88c780\nSTR             X25, [SP,#0x50+var_10]                                 ; +0x2c, 0x88c784\nMOV             W23, W2                                                ; +0x30, 0x88c788\nLDRB            W24, [X1,#0x154]                                       ; +0x34, 0x88c78c\nCBNZ            W0, loc_88C79C                                         ; +0x38, 0x88c790\nLDRB            W0, [X20,#0x1F0]; this                                 ; +0x3c, 0x88c794\nCBZ             W0, loc_88C8F4                                         ; +0x40, 0x88c798\nLDR             X0, [X19,#0x9A8]; this                                 ; +0x44, 0x88c79c\nBL              _ZN15GJEffectManager18hasActiveDualTouchEv; GJEffectManager::hasActiveDualTouch(void) ; +0x48, 0x88c7a0\nUXTB            W1, W0                                                 ; +0x4c, 0x88c7a4\nCBNZ            W21, loc_88C828                                        ; +0x50, 0x88c7a8\nLDRB            W0, [X20,#0xEC]                                        ; +0x54, 0x88c7ac\nCBZ             W0, loc_88C7BC                                         ; +0x58, 0x88c7b0\nCMP             W22, W1                                                ; +0x5c, 0x88c7b4\nB.CC            loc_88C7D4                                             ; +0x60, 0x88c7b8\nCMP             W22, W24                                               ; +0x64, 0x88c7bc\nB.CS            loc_88C860                                             ; +0x68, 0x88c7c0\nLDRB            W0, [X20,#0xEC]                                        ; +0x6c, 0x88c7c4\nCBNZ            W0, loc_88C7D4                                         ; +0x70, 0x88c7c8\nLDRB            W0, [X19,#0x412]                                       ; +0x74, 0x88c7cc\nCBNZ            W0, loc_88C918                                         ; +0x78, 0x88c7d0\nLDR             X0, [X19,#0xDF8]                                       ; +0x7c, 0x88c7d4\nLDRB            W0, [X0,#0x998]                                        ; +0x80, 0x88c7d8\nCBZ             W0, loc_88C84C                                         ; +0x84, 0x88c7dc\nLDRB            W0, [X20,#0x1F0]                                       ; +0x88, 0x88c7e0\nCBZ             W0, loc_88C830                                         ; +0x8c, 0x88c7e4\nCBZ             W21, loc_88C810                                        ; +0x90, 0x88c7e8\nLDR             W1, [X19,#0x30F0]                                      ; +0x94, 0x88c7ec\nCMP             W23, #1                                                ; +0x98, 0x88c7f0\nLDR             W0, [X19,#0x356C]                                      ; +0x9c, 0x88c7f4\nADD             W1, W1, #1                                             ; +0xa0, 0x88c7f8\nSTR             W1, [X19,#0x30F0]                                      ; +0xa4, 0x88c7fc\nADD             W0, W0, #1                                             ; +0xa8, 0x88c800\nSTR             W0, [X19,#0x356C]                                      ; +0xac, 0x88c804\nB.NE            loc_88C810                                             ; +0xb0, 0x88c808\nSTRB            W23, [X20,#0xF8]                                       ; +0xb4, 0x88c80c\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0xb8, 0x88c810\nLDP             X21, X22, [SP,#0x50+var_30]                            ; +0xbc, 0x88c814\nLDP             X23, X24, [SP,#0x50+var_20]                            ; +0xc0, 0x88c818\nLDR             X25, [SP,#0x50+var_10]                                 ; +0xc4, 0x88c81c\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0xc8, 0x88c820\nRET                                                                    ; +0xcc, 0x88c824\nSTRB            W0, [X20,#0xEC]                                        ; +0xd0, 0x88c828\nB               loc_88C7B4                                             ; +0xd4, 0x88c82c\nEOR             W3, W22, #1                                            ; +0xd8, 0x88c830\nMOV             X0, X19; this                                          ; +0xdc, 0x88c834\nMOV             W1, W23; int                                           ; +0xe0, 0x88c838\nMOV             W2, W21; bool                                          ; +0xe4, 0x88c83c\nAND             W3, W24, W3; bool                                      ; +0xe8, 0x88c840\nBL              _ZN15GJBaseGameLayer12recordActionEibb; GJBaseGameLayer::recordAction(int,bool,bool) ; +0xec, 0x88c844\nB               loc_88C7E8                                             ; +0xf0, 0x88c848\nLDR             X0, [X19,#0x9A8]; this                                 ; +0xf4, 0x88c84c\nMOV             W1, W21; bool                                          ; +0xf8, 0x88c850\nMOV             W2, W22; bool                                          ; +0xfc, 0x88c854\nBL              _ZN15GJEffectManager12playerButtonEbb; GJEffectManager::playerButton(bool,bool) ; +0x100, 0x88c858\nB               loc_88C7E0                                             ; +0x104, 0x88c85c\nMOV             X0, X19; this                                          ; +0x108, 0x88c860\nMOV             W1, W21; bool                                          ; +0x10c, 0x88c864\nMOV             W2, W23; int                                           ; +0x110, 0x88c868\nMOV             W3, #1; bool                                           ; +0x114, 0x88c86c\nBL              _ZN15GJBaseGameLayer15isButtonAllowedEbib; GJBaseGameLayer::isButtonAllowed(bool,int,bool) ; +0x118, 0x88c870\nUXTB            W0, W0                                                 ; +0x11c, 0x88c874\nCBZ             W0, loc_88C7C4                                         ; +0x120, 0x88c878\nLDR             X0, [X19,#0xDF8]; this                                 ; +0x124, 0x88c87c\nMOV             W1, W23                                                ; +0x128, 0x88c880\nCBNZ            W21, loc_88C980                                        ; +0x12c, 0x88c884\nBL              _ZN12PlayerObject13releaseButtonE12PlayerButton; PlayerObject::releaseButton(PlayerButton) ; +0x130, 0x88c888\nUXTB            W25, W0                                                ; +0x134, 0x88c88c\nLDRB            W0, [X20,#0xEC]                                        ; +0x138, 0x88c890\nCBNZ            W0, loc_88C8AC                                         ; +0x13c, 0x88c894\nLDRB            W0, [X19,#0x412]                                       ; +0x140, 0x88c898\nCBZ             W0, loc_88C8AC                                         ; +0x144, 0x88c89c\nEOR             W0, W24, #1                                            ; +0x148, 0x88c8a0\nCMP             W22, W0                                                ; +0x14c, 0x88c8a4\nB.LS            loc_88C944                                             ; +0x150, 0x88c8a8\nCBZ             W25, loc_88C7D4                                        ; +0x154, 0x88c8ac\nMOV             W2, #0                                                 ; +0x158, 0x88c8b0\nCBZ             W21, loc_88C99C                                        ; +0x15c, 0x88c8b4\nSUB             W1, W23, #1                                            ; +0x160, 0x88c8b8\nCMP             W1, #2                                                 ; +0x164, 0x88c8bc\nB.HI            loc_88C7D4                                             ; +0x168, 0x88c8c0\nADRL            X0, dword_EED5F0                                       ; +0x16c, 0x88c8c4\nADD             X0, X0, #(dword_EED680 - 0xEED5F0)                     ; +0x174, 0x88c8cc\nLDR             W1, [X0,W1,UXTW#2]                                     ; +0x178, 0x88c8d0\nCBZ             W1, loc_88C7D4                                         ; +0x17c, 0x88c8d4\nCMP             W2, WZR                                                ; +0x180, 0x88c8d8\nMOV             W3, #2                                                 ; +0x184, 0x88c8dc\nMOV             X0, X19                                                ; +0x188, 0x88c8e0\nMOV             W2, #0                                                 ; +0x18c, 0x88c8e4\nCSINC           W3, W3, WZR, NE                                        ; +0x190, 0x88c8e8\nBL              _ZN15GJBaseGameLayer18gameEventTriggeredE11GJGameEventii; GJBaseGameLayer::gameEventTriggered(GJGameEvent,int,int) ; +0x194, 0x88c8ec\nB               loc_88C7D4                                             ; +0x198, 0x88c8f0\nBL              _ZN11GameManager11sharedStateEv; GameManager::sharedState(void) ; +0x19c, 0x88c8f4\nADRL            X1, a0010; \"0010\"                                      ; +0x1a0, 0x88c8f8\nBL              _ZN11GameManager15getGameVariableEPKc; GameManager::getGameVariable(char const*) ; +0x1a8, 0x88c900\nUXTB            W0, W0                                                 ; +0x1ac, 0x88c904\nEOR             W1, W22, #1                                            ; +0x1b0, 0x88c908\nCMP             W0, WZR                                                ; +0x1b4, 0x88c90c\nCSEL            W22, W1, W22, NE                                       ; +0x1b8, 0x88c910\nB               loc_88C79C                                             ; +0x1bc, 0x88c914\nEOR             W0, W24, #1                                            ; +0x1c0, 0x88c918\nCMP             W22, W0                                                ; +0x1c4, 0x88c91c\nB.HI            loc_88C7D4                                             ; +0x1c8, 0x88c920\nMOV             X0, X19; this                                          ; +0x1cc, 0x88c924\nMOV             W1, W21; bool                                          ; +0x1d0, 0x88c928\nMOV             W2, W23; int                                           ; +0x1d4, 0x88c92c\nMOV             W3, #0; bool                                           ; +0x1d8, 0x88c930\nBL              _ZN15GJBaseGameLayer15isButtonAllowedEbib; GJBaseGameLayer::isButtonAllowed(bool,int,bool) ; +0x1dc, 0x88c934\nUXTB            W0, W0                                                 ; +0x1e0, 0x88c938\nCBNZ            W0, loc_88C960                                         ; +0x1e4, 0x88c93c\nB               loc_88C7D4                                             ; +0x1e8, 0x88c940\nMOV             X0, X19; this                                          ; +0x1ec, 0x88c944\nMOV             W1, W21; bool                                          ; +0x1f0, 0x88c948\nMOV             W2, W23; int                                           ; +0x1f4, 0x88c94c\nMOV             W3, #0; bool                                           ; +0x1f8, 0x88c950\nBL              _ZN15GJBaseGameLayer15isButtonAllowedEbib; GJBaseGameLayer::isButtonAllowed(bool,int,bool) ; +0x1fc, 0x88c954\nUXTB            W0, W0                                                 ; +0x200, 0x88c958\nCBZ             W0, loc_88C8AC                                         ; +0x204, 0x88c95c\nLDR             X0, [X19,#0xE00]; this                                 ; +0x208, 0x88c960\nMOV             W1, W23                                                ; +0x20c, 0x88c964\nCBZ             W21, loc_88C98C                                        ; +0x210, 0x88c968\nBL              _ZN12PlayerObject10pushButtonE12PlayerButton; PlayerObject::pushButton(PlayerButton) ; +0x214, 0x88c96c\nUXTB            W0, W0                                                 ; +0x218, 0x88c970\nMOV             W2, W24                                                ; +0x21c, 0x88c974\nCBNZ            W0, loc_88C8B8                                         ; +0x220, 0x88c978\nB               loc_88C7D4                                             ; +0x224, 0x88c97c\nBL              _ZN12PlayerObject10pushButtonE12PlayerButton; PlayerObject::pushButton(PlayerButton) ; +0x228, 0x88c980\nUXTB            W25, W0                                                ; +0x22c, 0x88c984\nB               loc_88C890                                             ; +0x230, 0x88c988\nBL              _ZN12PlayerObject13releaseButtonE12PlayerButton; PlayerObject::releaseButton(PlayerButton) ; +0x234, 0x88c98c\nUXTB            W0, W0                                                 ; +0x238, 0x88c990\nMOV             W2, W24                                                ; +0x23c, 0x88c994\nCBZ             W0, loc_88C7D4                                         ; +0x240, 0x88c998\nSUB             W1, W23, #1                                            ; +0x244, 0x88c99c\nCMP             W1, #2                                                 ; +0x248, 0x88c9a0\nB.HI            loc_88C7D4                                             ; +0x24c, 0x88c9a4\nADRL            X0, dword_EED5F0                                       ; +0x250, 0x88c9a8\nADD             X0, X0, #(dword_EED690 - 0xEED5F0)                     ; +0x258, 0x88c9b0\nLDR             W1, [X0,W1,UXTW#2]                                     ; +0x25c, 0x88c9b4\nB               loc_88C8D4                                             ; +0x260, 0x88c9b8", "xrefs": ["GJBaseGameLayer::processQueuedButtons @ 0x88ca14", "<???> @ 0xa5810"], "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"}