{"type": "func", "start": 5504192, "end": 5504356, "name": "BrowseSmartKeyLayer::addChanceToSelected", "pseudocode": "// \n// BrowseSmartKeyLayer::addChanceToSelected from 0x53fcc0 to 0x53fd64 (164 bytes)\n// \n// 1 xrefs:\n// > BrowseSmartKeyLayer::onButton @ 0x53fda8\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  unsigned int v5; // r4\n  cocos2d::CCArray *AllSelectedBlocks; // r7\n  int v7; // r0\n  int v8; // r11\n  int v9; // r0\n  int PrefabWithID; // r11\n  int v11; // r3\n  GJSmartTemplate *m_template; // [sp+0h] [bp-14h]\n  _BOOL4 v13; // [sp+4h] [bp-10h]\n  std::string v14; // [sp+8h] [bp-Ch] BYREF\n\n  v13 = a3;\n  v5 = 0;\n  AllSelectedBlocks = BrowseSmartKeyLayer::getAllSelectedBlocks(a1);\n  while ( v5 < cocos2d::CCArray::count(AllSelectedBlocks) )\n  {\n    v7 = cocos2d::CCArray::objectAtIndex(AllSelectedBlocks, v5);\n    m_template = a1->m_template;\n    v8 = v7;\n    sub_775C20(&v14);\n    v9 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 32))(v8);\n    PrefabWithID = GJSmartTemplate::getPrefabWithID((int)m_template, &v14, v9);\n    sub_774008(&v14);\n    if ( PrefabWithID )\n    {\n      if ( v13 )\n        v11 = 0;\n      else\n        v11 = *(_DWORD *)(PrefabWithID + 64) + a2;\n      *(_DWORD *)(PrefabWithID + 64) = v11;\n    }\n    ++v5;\n  }\n  BrowseSmartKeyLayer::updateChanceValues(a1);\n}", "assembly": "; \n; BrowseSmartKeyLayer::addChanceToSelected from 0x53fcc0 to 0x53fd64 (164 bytes)\n; \n; 1 xrefs:\n; > BrowseSmartKeyLayer::onButton @ 0x53fda8\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          {R4-R11,LR}                                            ; +0x0, 0x53fcc0\nSUB             SP, SP, #0x14                                          ; +0x4, 0x53fcc4\nLDR             R5, =(__stack_chk_guard_ptr - 0x53FCD2)                ; +0x6, 0x53fcc6\nMOV             R6, R0                                                 ; +0x8, 0x53fcc8\nMOV             R8, R1                                                 ; +0xa, 0x53fcca\nSTR             R2, [SP,#0x14+var_10]                                  ; +0xc, 0x53fccc\nADD             R5, PC; __stack_chk_guard_ptr                          ; +0xe, 0x53fcce\nLDR             R5, [R5]; __stack_chk_guard                            ; +0x10, 0x53fcd0\nADD.W           R10, R6, #0x208                                        ; +0x12, 0x53fcd2\nMOVS            R4, #0                                                 ; +0x16, 0x53fcd6\nLDR             R3, [R5]                                               ; +0x18, 0x53fcd8\nMOV             R9, R5                                                 ; +0x1a, 0x53fcda\nADD             R5, SP, #0x14+var_C                                    ; +0x1c, 0x53fcdc\nSTR             R3, [SP,#0x14+var_8]                                   ; +0x1e, 0x53fcde\nBL              _ZN19BrowseSmartKeyLayer20getAllSelectedBlocksEv; BrowseSmartKeyLayer::getAllSelectedBlocks(void) ; +0x20, 0x53fce0\nMOV             R7, R0                                                 ; +0x24, 0x53fce4\nMOV             R0, R7; this                                           ; +0x26, 0x53fce6\nBL              _ZNK7cocos2d7CCArray5countEv; cocos2d::CCArray::count(void) ; +0x28, 0x53fce8\nCMP             R4, R0                                                 ; +0x2c, 0x53fcec\nBCS             loc_53FD40                                             ; +0x2e, 0x53fcee\nMOV             R1, R4; unsigned int                                   ; +0x30, 0x53fcf0\nMOV             R0, R7; this                                           ; +0x32, 0x53fcf2\nBL              _ZN7cocos2d7CCArray13objectAtIndexEj; cocos2d::CCArray::objectAtIndex(uint) ; +0x34, 0x53fcf4\nLDR.W           R3, [R6,#0x1F0]                                        ; +0x38, 0x53fcf8\nMOV             R1, R10                                                ; +0x3c, 0x53fcfc\nSTR             R3, [SP,#0x14+var_14]                                  ; +0x3e, 0x53fcfe\nMOV             R11, R0                                                ; +0x40, 0x53fd00\nMOV             R0, R5                                                 ; +0x42, 0x53fd02\nBL              sub_775C20                                             ; +0x44, 0x53fd04\nLDR.W           R2, [R11]                                              ; +0x48, 0x53fd08\nMOV             R0, R11                                                ; +0x4c, 0x53fd0c\nLDR             R2, [R2,#0x20]                                         ; +0x4e, 0x53fd0e\nBLX             R2                                                     ; +0x50, 0x53fd10\nMOV             R2, R0                                                 ; +0x52, 0x53fd12\nMOV             R1, R5                                                 ; +0x54, 0x53fd14\nLDR             R0, [SP,#0x14+var_14]                                  ; +0x56, 0x53fd16\nBL              _ZN15GJSmartTemplate15getPrefabWithIDESsi; GJSmartTemplate::getPrefabWithID(std::string,int) ; +0x58, 0x53fd18\nMOV             R11, R0                                                ; +0x5c, 0x53fd1c\nMOV             R0, R5                                                 ; +0x5e, 0x53fd1e\nBL              sub_774008                                             ; +0x60, 0x53fd20\nCMP.W           R11, #0                                                ; +0x64, 0x53fd24\nBEQ             loc_53FD3C                                             ; +0x68, 0x53fd28\nLDR             R3, [SP,#0x14+var_10]                                  ; +0x6a, 0x53fd2a\nCBZ             R3, loc_53FD32                                         ; +0x6c, 0x53fd2c\nMOVS            R3, #0                                                 ; +0x6e, 0x53fd2e\nB               loc_53FD38                                             ; +0x70, 0x53fd30\nLDR.W           R3, [R11,#0x40]                                        ; +0x72, 0x53fd32\nADD             R3, R8                                                 ; +0x76, 0x53fd36\nSTR.W           R3, [R11,#0x40]                                        ; +0x78, 0x53fd38\nADDS            R4, #1                                                 ; +0x7c, 0x53fd3c\nB               loc_53FCE6                                             ; +0x7e, 0x53fd3e\nMOV             R0, R6; this                                           ; +0x80, 0x53fd40\nBL              _ZN19BrowseSmartKeyLayer18updateChanceValuesEv; BrowseSmartKeyLayer::updateChanceValues(void) ; +0x82, 0x53fd42\nLDR             R2, [SP,#0x14+var_8]                                   ; +0x86, 0x53fd46\nLDR.W           R3, [R9]                                               ; +0x88, 0x53fd48\nCMP             R2, R3                                                 ; +0x8c, 0x53fd4c\nBEQ             loc_53FD5E                                             ; +0x8e, 0x53fd4e\nBLX             __stack_chk_fail                                       ; +0x90, 0x53fd50\nMOV             R0, R5                                                 ; +0x94, 0x53fd54\nBL              sub_774008                                             ; +0x96, 0x53fd56\nBL              __cxa_end_cleanup                                      ; +0x9a, 0x53fd5a\nADD             SP, SP, #0x14                                          ; +0x9e, 0x53fd5e\nPOP.W           {R4-R11,PC}                                            ; +0xa0, 0x53fd60", "xrefs": ["BrowseSmartKeyLayer::onButton @ 0x53fda8"], "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"}