{"type": "func", "start": 4295541456, "end": 4295541798, "name": "GameStatsManager::unlockGoldChest", "pseudocode": "// \n// GameStatsManager::unlockGoldChest from 0x10008c2d0 to 0x10008c426 (342 bytes)\n// \n// 1 xrefs:\n// > SecretRewardsLayer::onGoldChest @ 0x100632576\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\nGJRewardItem *__fastcall GameStatsManager::unlockGoldChest(GameStatsManager *a1, int a2)\n{\n  double v2; // xmm0_8\n  cocos2d::CCObject *v3; // rax\n  GJRewardItem *v4; // rbx\n  int Stat; // eax\n  cocos2d::CCDictionary *m_treasureRoomChests; // r14\n  cocos2d::CCString *v7; // rax\n  const char *CString; // r12\n  size_t v9; // rax\n  size_t v10; // r15\n  char *v11; // r13\n  size_t v13; // r14\n  char v14; // [rsp+0h] [rbp-50h]\n  cocos2d::CCDictionary *v15; // [rsp+8h] [rbp-48h]\n  _QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF\n  void *__p; // [rsp+20h] [rbp-30h]\n\n  if ( GameStatsManager::isSecretChestUnlocked(a1, a2) )\n    return nullptr;\n  v3 = cocos2d::CCDictionary::objectForKey(a1->m_allTreasureRoomChests, a2);\n  if ( !v3 )\n    return nullptr;\n  v4 = (GJRewardItem *)v3;\n  Stat = GameStatsManager::getStat(a1, \"43\");\n  if ( Stat <= 0 )\n    return nullptr;\n  GameStatsManager::setStat(a1, \"43\", Stat - 1);\n  GameStatsManager::preProcessReward(a1, v4);\n  GameStatsManager::registerRewardsFromItem(a1, v4);\n  m_treasureRoomChests = a1->m_treasureRoomChests;\n  v7 = (cocos2d::CCString *)sub_1007AB580(\"%i\", v14);\n  CString = cocos2d::CCString::getCString(v7);\n  v9 = strlen(CString);\n  if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )\n    sub_100006BF0(v2);\n  v10 = v9;\n  if ( v9 >= 0x17 )\n  {\n    v15 = m_treasureRoomChests;\n    v13 = 26;\n    if ( (v9 | 7) != 0x17 )\n      v13 = (v9 | 7) + 1;\n    v11 = (char *)operator new(v13);\n    __p = v11;\n    __dst[0] = v13 + 1;\n    m_treasureRoomChests = v15;\n    __dst[1] = v10;\n    goto LABEL_13;\n  }\n  LOBYTE(__dst[0]) = 2 * v9;\n  v11 = (char *)__dst + 1;\n  if ( v9 )\nLABEL_13:\n    memmove(v11, CString, v10);\n  v11[v10] = 0;\n  cocos2d::CCDictionary::setObject_1(m_treasureRoomChests, v4, __dst);\n  if ( (__dst[0] & 1) != 0 )\n    operator delete(__p);\n  return v4;\n}", "assembly": "; \n; GameStatsManager::unlockGoldChest from 0x10008c2d0 to 0x10008c426 (342 bytes)\n; \n; 1 xrefs:\n; > SecretRewardsLayer::onGoldChest @ 0x100632576\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    rbp                                                            ; +0x0, 0x10008c2d0\nmov     rbp, rsp                                                       ; +0x1, 0x10008c2d1\npush    r15                                                            ; +0x4, 0x10008c2d4\npush    r14                                                            ; +0x6, 0x10008c2d6\npush    r13                                                            ; +0x8, 0x10008c2d8\npush    r12                                                            ; +0xa, 0x10008c2da\npush    rbx                                                            ; +0xc, 0x10008c2dc\nsub     rsp, 28h                                                       ; +0xd, 0x10008c2dd\nmov     r15d, esi                                                      ; +0x11, 0x10008c2e1\nmov     r14, rdi                                                       ; +0x14, 0x10008c2e4\ncall    GameStatsManager__isSecretChestUnlocked                        ; +0x17, 0x10008c2e7\ntest    al, al                                                         ; +0x1c, 0x10008c2ec\njnz     loc_10008C39B                                                  ; +0x1e, 0x10008c2ee\nmov     rdi, [r14+158h]                                                ; +0x24, 0x10008c2f4\nmovsxd  rsi, r15d                                                      ; +0x2b, 0x10008c2fb\ncall    cocos2d__CCDictionary__objectForKey                            ; +0x2e, 0x10008c2fe\ntest    rax, rax                                                       ; +0x33, 0x10008c303\njz      loc_10008C39B                                                  ; +0x36, 0x10008c306\nmov     rbx, rax                                                       ; +0x3c, 0x10008c30c\nlea     rsi, a43; \"43\"                                                 ; +0x3f, 0x10008c30f\nmov     rdi, r14                                                       ; +0x46, 0x10008c316\ncall    GameStatsManager__getStat                                      ; +0x49, 0x10008c319\ntest    eax, eax                                                       ; +0x4e, 0x10008c31e\njle     short loc_10008C39B                                            ; +0x50, 0x10008c320\ndec     eax                                                            ; +0x52, 0x10008c322\nlea     rsi, a43; \"43\"                                                 ; +0x54, 0x10008c324\nmov     rdi, r14                                                       ; +0x5b, 0x10008c32b\nmov     edx, eax                                                       ; +0x5e, 0x10008c32e\ncall    GameStatsManager__setStat                                      ; +0x60, 0x10008c330\nmov     rdi, r14                                                       ; +0x65, 0x10008c335\nmov     rsi, rbx                                                       ; +0x68, 0x10008c338\ncall    GameStatsManager__preProcessReward                             ; +0x6b, 0x10008c33b\nmov     rdi, r14                                                       ; +0x70, 0x10008c340\nmov     rsi, rbx                                                       ; +0x73, 0x10008c343\ncall    GameStatsManager__registerRewardsFromItem                      ; +0x76, 0x10008c346\nmov     r14, [r14+2F0h]                                                ; +0x7b, 0x10008c34b\nlea     rdi, aI; \"%i\"                                                  ; +0x82, 0x10008c352\nmov     esi, r15d                                                      ; +0x89, 0x10008c359\nxor     eax, eax                                                       ; +0x8c, 0x10008c35c\ncall    sub_1007AB580                                                  ; +0x8e, 0x10008c35e\nmov     rdi, rax                                                       ; +0x93, 0x10008c363\ncall    cocos2d__CCString__getCString                                  ; +0x96, 0x10008c366\nmov     r12, rax                                                       ; +0x9b, 0x10008c36b\nmov     rdi, rax; __s                                                  ; +0x9e, 0x10008c36e\ncall    _strlen                                                        ; +0xa1, 0x10008c371\ncmp     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xa6, 0x10008c376\njnb     loc_10008C421                                                  ; +0xaa, 0x10008c37a\nmov     r15, rax                                                       ; +0xb0, 0x10008c380\ncmp     rax, 17h                                                       ; +0xb3, 0x10008c383\njnb     short loc_10008C3AF                                            ; +0xb7, 0x10008c387\nlea     eax, [r15+r15]                                                 ; +0xb9, 0x10008c389\nmov     byte ptr [rbp+__dst], al                                       ; +0xbd, 0x10008c38d\nlea     r13, [rbp+__dst+1]                                             ; +0xc0, 0x10008c390\ntest    r15, r15                                                       ; +0xc4, 0x10008c394\njnz     short loc_10008C3EA                                            ; +0xc7, 0x10008c397\njmp     short loc_10008C3F8                                            ; +0xc9, 0x10008c399\nxor     ebx, ebx                                                       ; +0xcb, 0x10008c39b\nmov     rax, rbx                                                       ; +0xcd, 0x10008c39d\nadd     rsp, 28h                                                       ; +0xd0, 0x10008c3a0\npop     rbx                                                            ; +0xd4, 0x10008c3a4\npop     r12                                                            ; +0xd5, 0x10008c3a5\npop     r13                                                            ; +0xd7, 0x10008c3a7\npop     r14                                                            ; +0xd9, 0x10008c3a9\npop     r15                                                            ; +0xdb, 0x10008c3ab\npop     rbp                                                            ; +0xdd, 0x10008c3ad\nretn                                                                   ; +0xde, 0x10008c3ae\nmov     rax, r15                                                       ; +0xdf, 0x10008c3af\nor      rax, 7                                                         ; +0xe2, 0x10008c3b2\nlea     rcx, [rax+1]                                                   ; +0xe6, 0x10008c3b6\ncmp     rax, 17h                                                       ; +0xea, 0x10008c3ba\nmov     [rbp+var_48], r14                                              ; +0xee, 0x10008c3be\nmov     r14d, 1Ah                                                      ; +0xf2, 0x10008c3c2\ncmovnz  r14, rcx                                                       ; +0xf8, 0x10008c3c8\nmov     rdi, r14; __sz                                                 ; +0xfc, 0x10008c3cc\ncall    __Znwm; operator new(ulong)                                    ; +0xff, 0x10008c3cf\nmov     r13, rax                                                       ; +0x104, 0x10008c3d4\nmov     [rbp+__p], rax                                                 ; +0x107, 0x10008c3d7\ninc     r14                                                            ; +0x10b, 0x10008c3db\nmov     [rbp+__dst], r14                                               ; +0x10e, 0x10008c3de\nmov     r14, [rbp+var_48]                                              ; +0x112, 0x10008c3e2\nmov     [rbp+var_38], r15                                              ; +0x116, 0x10008c3e6\nmov     rdi, r13; __dst                                                ; +0x11a, 0x10008c3ea\nmov     rsi, r12; __src                                                ; +0x11d, 0x10008c3ed\nmov     rdx, r15; __len                                                ; +0x120, 0x10008c3f0\ncall    _memmove                                                       ; +0x123, 0x10008c3f3\nmov     byte ptr [r13+r15+0], 0                                        ; +0x128, 0x10008c3f8\nlea     rdx, [rbp+__dst]                                               ; +0x12e, 0x10008c3fe\nmov     rdi, r14                                                       ; +0x132, 0x10008c402\nmov     rsi, rbx                                                       ; +0x135, 0x10008c405\ncall    cocos2d__CCDictionary__setObject_1                             ; +0x138, 0x10008c408\ntest    byte ptr [rbp+__dst], 1                                        ; +0x13d, 0x10008c40d\njz      short loc_10008C39D                                            ; +0x141, 0x10008c411\nmov     rdi, [rbp+__p]; __p                                            ; +0x143, 0x10008c413\ncall    __ZdlPv; operator delete(void *)                               ; +0x147, 0x10008c417\njmp     loc_10008C39D                                                  ; +0x14c, 0x10008c41c\ncall    sub_100006BF0                                                  ; +0x151, 0x10008c421", "xrefs": ["SecretRewardsLayer::onGoldChest @ 0x100632576"], "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"}