{"type": "func", "start": 10362672, "end": 10363092, "name": "BrowseSmartKeyLayer::addChanceToSelected", "pseudocode": "// \n// BrowseSmartKeyLayer::addChanceToSelected from 0x9e1f30 to 0x9e20d4 (420 bytes)\n// \n// 3 xrefs:\n// > BrowseSmartKeyLayer::onButton @ 0x9e2138\n// > BrowseSmartKeyLayer::onButton @ 0x9e2170\n// > <???> @ 0xc13b0\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 BrowseSmartKeyLayer::addChanceToSelected(BrowseSmartKeyLayer *a1, int a2, bool a3)\n{\n  _BOOL4 v4; // w26\n  cocos2d::CCArray *AllSelectedBlocks; // x21\n  unsigned int v7; // w19\n  __int64 v8; // x28\n  GJSmartTemplate *m_template; // x22\n  long double v10; // q0\n  int v11; // w0\n  __int64 PrefabWithID; // x22\n  char *v13; // x0\n  unsigned int *v14; // x1\n  int v15; // w2\n  std::string v16; // [xsp+80h] [xbp+80h] BYREF\n\n  v4 = a3;\n  AllSelectedBlocks = BrowseSmartKeyLayer::getAllSelectedBlocks(a1);\n  v7 = 0;\n  while ( v7 < (unsigned int)cocos2d::CCArray::count(AllSelectedBlocks) )\n  {\n    v8 = cocos2d::CCArray::objectAtIndex(AllSelectedBlocks, v7);\n    m_template = a1->m_template;\n    *(__n128 *)&v10 = sub_D18D28(&v16);\n    v11 = (*(__int64 (__fastcall **)(__int64, long double))(*(_QWORD *)v8 + 64LL))(v8, v10);\n    PrefabWithID = GJSmartTemplate::getPrefabWithID((__int64)m_template, &v16, v11);\n    v13 = (char *)v16.m_data.m_data - 24;\n    if ( (__int64 *)v16.m_data.m_data - 3 != &qword_124B6B0 )\n    {\n      if ( &pthread_create )\n      {\n        v14 = (unsigned int *)((char *)v16.m_data.m_data - 8);\n        do\n          v15 = __ldaxr(v14);\n        while ( __stlxr(v15 - 1, v14) );\n      }\n      else\n      {\n        v15 = *((_DWORD *)v16.m_data.m_data - 2);\n        *((_DWORD *)v16.m_data.m_data - 2) = v15 - 1;\n      }\n      if ( v15 <= 0 )\n        operator delete(v13);\n    }\n    if ( PrefabWithID )\n    {\n      if ( !v4 )\n      {\n        ++v7;\n        *(_DWORD *)(PrefabWithID + 76) += a2;\n        continue;\n      }\n      *(_DWORD *)(PrefabWithID + 76) = 0;\n    }\n    ++v7;\n  }\n  BrowseSmartKeyLayer::updateChanceValues(a1);\n}", "assembly": "; \n; BrowseSmartKeyLayer::addChanceToSelected from 0x9e1f30 to 0x9e20d4 (420 bytes)\n; \n; 3 xrefs:\n; > BrowseSmartKeyLayer::onButton @ 0x9e2138\n; > BrowseSmartKeyLayer::onButton @ 0x9e2170\n; > <???> @ 0xc13b0\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_90]!                                ; +0x0, 0x9e1f30\nMOV             X29, SP                                                ; +0x4, 0x9e1f34\nSTP             X27, X28, [SP,#0x90+var_40]                            ; +0x8, 0x9e1f38\nMOV             W27, W1                                                ; +0xc, 0x9e1f3c\nADRP            X1, #__stack_chk_guard_ptr@PAGE                        ; +0x10, 0x9e1f40\nSTP             X25, X26, [SP,#0x90+var_50]                            ; +0x14, 0x9e1f44\nUXTB            W26, W2                                                ; +0x18, 0x9e1f48\nADD             X2, X29, #0x90+var_18                                  ; +0x1c, 0x9e1f4c\nLDR             X1, [X1,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x20, 0x9e1f50\nADRP            X25, #off_122EFE8@PAGE                                 ; +0x24, 0x9e1f54\nSTP             X19, X20, [SP,#0x90+var_80]                            ; +0x28, 0x9e1f58\nSTP             X23, X24, [SP,#0x90+var_60]                            ; +0x2c, 0x9e1f5c\nLDR             X1, [X1]                                               ; +0x30, 0x9e1f60\nMOV             X23, X0                                                ; +0x34, 0x9e1f64\nSTP             X21, X22, [SP,#0x90+var_70]                            ; +0x38, 0x9e1f68\nSTR             X2, [X29,#0x90+var_28]                                 ; +0x3c, 0x9e1f6c\nADD             X24, X0, #0x2A8                                        ; +0x40, 0x9e1f70\nSTR             X1, [X29,#0x90+var_8]                                  ; +0x44, 0x9e1f74\nBL              _ZN19BrowseSmartKeyLayer20getAllSelectedBlocksEv; BrowseSmartKeyLayer::getAllSelectedBlocks(void) ; +0x48, 0x9e1f78\nMOV             X21, X0                                                ; +0x4c, 0x9e1f7c\nMOV             W19, #0                                                ; +0x50, 0x9e1f80\nMOV             X0, X21; this                                          ; +0x54, 0x9e1f84\nADD             X20, X29, #0x90+var_10                                 ; +0x58, 0x9e1f88\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x5c, 0x9e1f8c\nCMP             W19, W0                                                ; +0x60, 0x9e1f90\nB.CS            loc_9E2010                                             ; +0x64, 0x9e1f94\nMOV             W1, W19; unsigned int                                  ; +0x68, 0x9e1f98\nMOV             X0, X21; this                                          ; +0x6c, 0x9e1f9c\nBL              _ZN7cocos2d7CCArray13objectAtIndexEj; cocos2d::CCArray::objectAtIndex(uint) ; +0x70, 0x9e1fa0\nMOV             X28, X0                                                ; +0x74, 0x9e1fa4\nMOV             X1, X24                                                ; +0x78, 0x9e1fa8\nMOV             X0, X20                                                ; +0x7c, 0x9e1fac\nLDR             X22, [X23,#0x278]                                      ; +0x80, 0x9e1fb0\nBL              sub_D18D28                                             ; +0x84, 0x9e1fb4\nLDR             X1, [X28]                                              ; +0x88, 0x9e1fb8\nMOV             X0, X28                                                ; +0x8c, 0x9e1fbc\nLDR             X1, [X1,#0x40]                                         ; +0x90, 0x9e1fc0\nBLR             X1                                                     ; +0x94, 0x9e1fc4\nMOV             W2, W0                                                 ; +0x98, 0x9e1fc8\nMOV             X1, X20                                                ; +0x9c, 0x9e1fcc\nMOV             X0, X22                                                ; +0xa0, 0x9e1fd0\nBL              _ZN15GJSmartTemplate15getPrefabWithIDESsi; GJSmartTemplate::getPrefabWithID(std::string,int) ; +0xa4, 0x9e1fd4\nLDR             X1, [X20]                                              ; +0xa8, 0x9e1fd8\nMOV             X22, X0                                                ; +0xac, 0x9e1fdc\nLDR             X2, [X25,#off_122EFE8@PAGEOFF]; qword_124B6B0          ; +0xb0, 0x9e1fe0\nSUB             X0, X1, #0x18; p                                       ; +0xb4, 0x9e1fe4\nCMP             X0, X2                                                 ; +0xb8, 0x9e1fe8\nB.NE            loc_9E204C                                             ; +0xbc, 0x9e1fec\nCBZ             X22, loc_9E1FFC                                        ; +0xc0, 0x9e1ff0\nCBZ             W26, loc_9E2080                                        ; +0xc4, 0x9e1ff4\nSTR             WZR, [X22,#0x4C]                                       ; +0xc8, 0x9e1ff8\nADD             W19, W19, #1                                           ; +0xcc, 0x9e1ffc\nMOV             X0, X21; this                                          ; +0xd0, 0x9e2000\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0xd4, 0x9e2004\nCMP             W19, W0                                                ; +0xd8, 0x9e2008\nB.CC            loc_9E1F98                                             ; +0xdc, 0x9e200c\nMOV             X0, X23; this                                          ; +0xe0, 0x9e2010\nBL              _ZN19BrowseSmartKeyLayer18updateChanceValuesEv; BrowseSmartKeyLayer::updateChanceValues(void) ; +0xe4, 0x9e2014\nADRP            X0, #__stack_chk_guard_ptr@PAGE                        ; +0xe8, 0x9e2018\nLDR             X1, [X29,#0x90+var_8]                                  ; +0xec, 0x9e201c\nLDR             X0, [X0,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0xf0, 0x9e2020\nLDR             X0, [X0]                                               ; +0xf4, 0x9e2024\nCMP             X1, X0                                                 ; +0xf8, 0x9e2028\nB.NE            loc_9E20D0                                             ; +0xfc, 0x9e202c\nLDP             X19, X20, [SP,#0x90+var_80]                            ; +0x100, 0x9e2030\nLDP             X21, X22, [SP,#0x90+var_70]                            ; +0x104, 0x9e2034\nLDP             X23, X24, [SP,#0x90+var_60]                            ; +0x108, 0x9e2038\nLDP             X25, X26, [SP,#0x90+var_50]                            ; +0x10c, 0x9e203c\nLDP             X27, X28, [SP,#0x90+var_40]                            ; +0x110, 0x9e2040\nLDP             X29, X30, [SP+0x90+var_90],#0x90                       ; +0x114, 0x9e2044\nRET                                                                    ; +0x118, 0x9e2048\nADRP            X2, #pthread_create_ptr_0@PAGE                         ; +0x11c, 0x9e204c\nLDR             X2, [X2,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x120, 0x9e2050\nCBZ             X2, loc_9E2094                                         ; +0x124, 0x9e2054\nSUB             X1, X1, #8                                             ; +0x128, 0x9e2058\nLDAXR           W2, [X1]                                               ; +0x12c, 0x9e205c\nSUB             W3, W2, #1                                             ; +0x130, 0x9e2060\nSTLXR           W4, W3, [X1]                                           ; +0x134, 0x9e2064\nCBNZ            W4, loc_9E205C                                         ; +0x138, 0x9e2068\nCMP             W2, WZR                                                ; +0x13c, 0x9e206c\nB.GT            loc_9E1FF0                                             ; +0x140, 0x9e2070\nLDR             X1, [X29,#0x90+var_28]                                 ; +0x144, 0x9e2074\nBL              j__ZdlPv; operator delete(void *)                      ; +0x148, 0x9e2078\nB               loc_9E1FF0                                             ; +0x14c, 0x9e207c\nLDR             W0, [X22,#0x4C]                                        ; +0x150, 0x9e2080\nADD             W19, W19, #1                                           ; +0x154, 0x9e2084\nADD             W0, W0, W27                                            ; +0x158, 0x9e2088\nSTR             W0, [X22,#0x4C]                                        ; +0x15c, 0x9e208c\nB               loc_9E2000                                             ; +0x160, 0x9e2090\nLDUR            W2, [X1,#-8]                                           ; +0x164, 0x9e2094\nSUB             W3, W2, #1                                             ; +0x168, 0x9e2098\nSTUR            W3, [X1,#-8]                                           ; +0x16c, 0x9e209c\nB               loc_9E206C                                             ; +0x170, 0x9e20a0\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x174, 0x9e20a4\nMOV             X19, X0                                                ; +0x178, 0x9e20a8\nLDR             X0, [X29,#0x90+var_10]                                 ; +0x17c, 0x9e20ac\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x180, 0x9e20b0\nSUB             X0, X0, #0x18                                          ; +0x184, 0x9e20b4\nCMP             X0, X1                                                 ; +0x188, 0x9e20b8\nB.EQ            loc_9E20C8                                             ; +0x18c, 0x9e20bc\nADD             X1, X29, #0x90+var_18                                  ; +0x190, 0x9e20c0\nBL              sub_4DD5A0                                             ; +0x194, 0x9e20c4\nMOV             X0, X19                                                ; +0x198, 0x9e20c8\nBL              _Unwind_Resume                                         ; +0x19c, 0x9e20cc\nBL              .__stack_chk_fail                                      ; +0x1a0, 0x9e20d0", "xrefs": ["BrowseSmartKeyLayer::onButton @ 0x9e2138", "BrowseSmartKeyLayer::onButton @ 0x9e2170", "<???> @ 0xc13b0"], "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"}