{"type": "func", "start": 5370614032, "end": 5370614542, "name": "GameStatsManager::init", "pseudocode": "// \n// GameStatsManager::init from 0x1401d1110 to 0x1401d130e (510 bytes)\n// \n// 2 xrefs:\n// > <???> @ 0x140562bd0\n// > <???> @ 0x1406cc2f4\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\n// Hidden C++ exception states: #wind=1\nbool GameStatsManager::init(GameStatsManager *a1)\n{\n  cocos2d::CCString *v2; // rax\n  __int64 v3; // rcx\n  cocos2d::CCDictionary *v4; // rax\n  __int64 v5; // rcx\n  cocos2d::CCDictionary *v6; // rax\n  cocos2d::CCDictionary *v7; // rbx\n  cocos2d::CCDictionary *m_rewardItems; // rcx\n  __int64 v9; // rcx\n  cocos2d::CCDictionary *v10; // rax\n  __int64 v11; // rcx\n  cocos2d::CCDictionary *v12; // rax\n  cocos2d::CCDictionary *m_allTreasureRoomChests; // rbp\n  cocos2d::CCDictElement *m_pElements; // rbp\n  cocos2d::CCDictElement *i; // r14\n  cocos2d::CCObject *m_pObject; // rbp\n  cocos2d::CCArray *v17; // rdi\n  unsigned int v18; // ebx\n  struct cocos2d::CCObject *v19; // rax\n  __int64 v20; // rcx\n  struct cocos2d::CCString *v21; // rax\n  _BYTE v23[32]; // [rsp+20h] [rbp-48h] BYREF\n\n  v2 = cocos2d::CCString::createWithFormat(\"%i\", 1);\n  a1->m_trueString = v2;\n  cocos2d::CCObject::retain(v2);\n  v4 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v3);\n  a1->m_unkDict = v4;\n  cocos2d::CCObject::retain(v4);\n  v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v5);\n  v7 = v6;\n  if ( a1->m_rewardItems != v6 )\n  {\n    if ( v6 )\n      cocos2d::CCObject::retain(v6);\n    m_rewardItems = a1->m_rewardItems;\n    if ( m_rewardItems )\n      cocos2d::CCObject::release(m_rewardItems);\n    a1->m_rewardItems = v7;\n  }\n  GameStatsManager::setupIconCredits(a1);\n  GameStatsManager::createStoreItems(a1);\n  if ( !a1->m_allTreasureRoomChestItems )\n  {\n    v10 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v9);\n    a1->m_allTreasureRoomChestItems = v10;\n    cocos2d::CCObject::retain(v10);\n    v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v11);\n    a1->m_allTreasureRoomChests = v12;\n    cocos2d::CCObject::retain(v12);\n    GameStatsManager::createSecretChestRewards(a1);\n    m_allTreasureRoomChests = a1->m_allTreasureRoomChests;\n    if ( m_allTreasureRoomChests )\n    {\n      m_pElements = m_allTreasureRoomChests->m_pElements;\n      if ( m_pElements )\n      {\n        for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )\n        {\n          m_pObject = m_pElements->m_pObject;\n          if ( m_pObject )\n          {\n            v17 = *(cocos2d::CCArray **)&m_pObject[1].m_nTag;\n            if ( v17 )\n            {\n              v18 = 0;\n              if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)&m_pObject[1].m_nTag) )\n              {\n                do\n                {\n                  v19 = cocos2d::CCArray::objectAtIndex(v17, v18);\n                  if ( LODWORD(v19[1].__vftable) == 9 )\n                  {\n                    GameStatsManager::getItemKey(v20, v23, v19[1].m_uID, HIDWORD(v19[1].__vftable));\n                    cocos2d::CCDictionary::objectForKey(a1->m_allTreasureRoomChestItems, v23);\n                    v21 = cocos2d::CCString::createWithFormat(\"%i\", LODWORD(m_pObject[1].__vftable));\n                    cocos2d::CCDictionary::setObject(a1->m_allTreasureRoomChestItems, v21, v23);\n                    sub_14003A830((__int64)v23);\n                  }\n                  ++v18;\n                }\n                while ( v18 < cocos2d::CCArray::count(v17) );\n              }\n            }\n          }\n          m_pElements = i;\n          if ( !i )\n            break;\n        }\n      }\n    }\n  }\n  GameStatsManager::createSpecialChestItems(a1);\n  GameStatsManager::generateItemUnlockableData(a1);\n  return 1;\n}", "assembly": "; \n; GameStatsManager::init from 0x1401d1110 to 0x1401d130e (510 bytes)\n; \n; 2 xrefs:\n; > <???> @ 0x140562bd0\n; > <???> @ 0x1406cc2f4\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\nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x1401d1110\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x1401d1115\npush    rsi                                                            ; +0xa, 0x1401d111a\npush    rdi                                                            ; +0xb, 0x1401d111b\npush    r14                                                            ; +0xc, 0x1401d111c\nsub     rsp, 50h                                                       ; +0xe, 0x1401d111e\nmov     rax, cs:__security_cookie                                      ; +0x12, 0x1401d1122\nxor     rax, rsp                                                       ; +0x19, 0x1401d1129\nmov     [rsp+68h+var_28], rax                                          ; +0x1c, 0x1401d112c\nmov     rsi, rcx                                                       ; +0x21, 0x1401d1131\nmov     edx, 1                                                         ; +0x24, 0x1401d1134\nlea     rcx, aI_11; \"%i\"                                               ; +0x29, 0x1401d1139\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x30, 0x1401d1140\nmov     [rsi+148h], rax                                                ; +0x36, 0x1401d1146\nmov     rcx, rax                                                       ; +0x3d, 0x1401d114d\ncall    cs:?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0x40, 0x1401d1150\ncall    cs:?create@CCDictionary@cocos2d@@SAPEAV12@XZ; cocos2d::CCDictionary::create(void) ; +0x46, 0x1401d1156\nmov     [rsi+398h], rax                                                ; +0x4c, 0x1401d115c\nmov     rcx, rax                                                       ; +0x53, 0x1401d1163\ncall    cs:?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0x56, 0x1401d1166\ncall    cs:?create@CCDictionary@cocos2d@@SAPEAV12@XZ; cocos2d::CCDictionary::create(void) ; +0x5c, 0x1401d116c\nmov     rbx, rax                                                       ; +0x62, 0x1401d1172\ncmp     [rsi+210h], rax                                                ; +0x65, 0x1401d1175\njz      short loc_1401D11A5                                            ; +0x6c, 0x1401d117c\ntest    rax, rax                                                       ; +0x6e, 0x1401d117e\njz      short loc_1401D118C                                            ; +0x71, 0x1401d1181\nmov     rcx, rax                                                       ; +0x73, 0x1401d1183\ncall    cs:?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0x76, 0x1401d1186\nmov     rcx, [rsi+210h]                                                ; +0x7c, 0x1401d118c\ntest    rcx, rcx                                                       ; +0x83, 0x1401d1193\njz      short loc_1401D119E                                            ; +0x86, 0x1401d1196\ncall    cs:?release@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::release(void) ; +0x88, 0x1401d1198\nmov     [rsi+210h], rbx                                                ; +0x8e, 0x1401d119e\nmov     rcx, rsi                                                       ; +0x95, 0x1401d11a5\ncall    GameStatsManager__setupIconCredits                             ; +0x98, 0x1401d11a8\nmov     rcx, rsi                                                       ; +0x9d, 0x1401d11ad\ncall    GameStatsManager__createStoreItems                             ; +0xa0, 0x1401d11b0\ncmp     qword ptr [rsi+168h], 0                                        ; +0xa5, 0x1401d11b5\njnz     loc_1401D12D9                                                  ; +0xad, 0x1401d11bd\ncall    cs:?create@CCDictionary@cocos2d@@SAPEAV12@XZ; cocos2d::CCDictionary::create(void) ; +0xb3, 0x1401d11c3\nmov     [rsi+168h], rax                                                ; +0xb9, 0x1401d11c9\nmov     rcx, rax                                                       ; +0xc0, 0x1401d11d0\ncall    cs:?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0xc3, 0x1401d11d3\ncall    cs:?create@CCDictionary@cocos2d@@SAPEAV12@XZ; cocos2d::CCDictionary::create(void) ; +0xc9, 0x1401d11d9\nmov     [rsi+160h], rax                                                ; +0xcf, 0x1401d11df\nmov     rcx, rax                                                       ; +0xd6, 0x1401d11e6\ncall    cs:?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0xd9, 0x1401d11e9\nmov     rcx, rsi                                                       ; +0xdf, 0x1401d11ef\ncall    GameStatsManager__createSecretChestRewards                     ; +0xe2, 0x1401d11f2\nmov     rbp, [rsi+160h]                                                ; +0xe7, 0x1401d11f7\ntest    rbp, rbp                                                       ; +0xee, 0x1401d11fe\njz      loc_1401D12D9                                                  ; +0xf1, 0x1401d1201\nmov     rbp, [rbp+38h]                                                 ; +0xf7, 0x1401d1207\ntest    rbp, rbp                                                       ; +0xfb, 0x1401d120b\njz      loc_1401D12D9                                                  ; +0xfe, 0x1401d120e\nmov     r14, [rbp+120h]                                                ; +0x104, 0x1401d1214\nnop     dword ptr [rax+rax+00h]                                        ; +0x10b, 0x1401d121b\nmov     rbp, [rbp+108h]                                                ; +0x110, 0x1401d1220\ntest    rbp, rbp                                                       ; +0x117, 0x1401d1227\njz      loc_1401D12C5                                                  ; +0x11a, 0x1401d122a\nmov     rdi, [rbp+48h]                                                 ; +0x120, 0x1401d1230\ntest    rdi, rdi                                                       ; +0x124, 0x1401d1234\njz      loc_1401D12C5                                                  ; +0x127, 0x1401d1237\nxor     ebx, ebx                                                       ; +0x12d, 0x1401d123d\nmov     rcx, rdi                                                       ; +0x12f, 0x1401d123f\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x132, 0x1401d1242\ntest    eax, eax                                                       ; +0x138, 0x1401d1248\njz      short loc_1401D12C5                                            ; +0x13a, 0x1401d124a\nnop     dword ptr [rax+00h]                                            ; +0x13c, 0x1401d124c\nmov     edx, ebx                                                       ; +0x140, 0x1401d1250\nmov     rcx, rdi                                                       ; +0x142, 0x1401d1252\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x145, 0x1401d1255\ncmp     dword ptr [rax+38h], 9                                         ; +0x14b, 0x1401d125b\njnz     short loc_1401D12B6                                            ; +0x14f, 0x1401d125f\nmov     r9d, [rax+3Ch]                                                 ; +0x151, 0x1401d1261\nmov     r8d, [rax+40h]                                                 ; +0x155, 0x1401d1265\nlea     rdx, [rsp+68h+var_48]                                          ; +0x159, 0x1401d1269\ncall    GameStatsManager__getItemKey                                   ; +0x15e, 0x1401d126e\nnop                                                                    ; +0x163, 0x1401d1273\nlea     rdx, [rsp+68h+var_48]                                          ; +0x164, 0x1401d1274\nmov     rcx, [rsi+168h]                                                ; +0x169, 0x1401d1279\ncall    cs:?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::objectForKey(std::string const &) ; +0x170, 0x1401d1280\nmov     edx, [rbp+38h]                                                 ; +0x176, 0x1401d1286\nlea     rcx, aI_11; \"%i\"                                               ; +0x179, 0x1401d1289\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x180, 0x1401d1290\nmov     rdx, rax                                                       ; +0x186, 0x1401d1296\nlea     r8, [rsp+68h+var_48]                                           ; +0x189, 0x1401d1299\nmov     rcx, [rsi+168h]                                                ; +0x18e, 0x1401d129e\ncall    cs:?setObject@CCDictionary@cocos2d@@QEAAXPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const &) ; +0x195, 0x1401d12a5\nnop                                                                    ; +0x19b, 0x1401d12ab\nlea     rcx, [rsp+68h+var_48]                                          ; +0x19c, 0x1401d12ac\ncall    sub_14003A830                                                  ; +0x1a1, 0x1401d12b1\ninc     ebx                                                            ; +0x1a6, 0x1401d12b6\nmov     rcx, rdi                                                       ; +0x1a8, 0x1401d12b8\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x1ab, 0x1401d12bb\ncmp     ebx, eax                                                       ; +0x1b1, 0x1401d12c1\njb      short loc_1401D1250                                            ; +0x1b3, 0x1401d12c3\nmov     rbp, r14                                                       ; +0x1b5, 0x1401d12c5\ntest    r14, r14                                                       ; +0x1b8, 0x1401d12c8\njz      short loc_1401D12D9                                            ; +0x1bb, 0x1401d12cb\nmov     r14, [r14+120h]                                                ; +0x1bd, 0x1401d12cd\njmp     loc_1401D1220                                                  ; +0x1c4, 0x1401d12d4\nmov     rcx, rsi                                                       ; +0x1c9, 0x1401d12d9\ncall    GameStatsManager__createSpecialChestItems                      ; +0x1cc, 0x1401d12dc\nmov     rcx, rsi                                                       ; +0x1d1, 0x1401d12e1\ncall    GameStatsManager__generateItemUnlockableData                   ; +0x1d4, 0x1401d12e4\nmov     al, 1                                                          ; +0x1d9, 0x1401d12e9\nmov     rcx, [rsp+68h+var_28]                                          ; +0x1db, 0x1401d12eb\nxor     rcx, rsp; StackCookie                                          ; +0x1e0, 0x1401d12f0\ncall    __security_check_cookie                                        ; +0x1e3, 0x1401d12f3\nmov     rbx, [rsp+68h+arg_8]                                           ; +0x1e8, 0x1401d12f8\nmov     rbp, [rsp+68h+arg_10]                                          ; +0x1ed, 0x1401d12fd\nadd     rsp, 50h                                                       ; +0x1f5, 0x1401d1305\npop     r14                                                            ; +0x1f9, 0x1401d1309\npop     rdi                                                            ; +0x1fb, 0x1401d130b\npop     rsi                                                            ; +0x1fc, 0x1401d130c\nretn                                                                   ; +0x1fd, 0x1401d130d", "xrefs": ["<???> @ 0x140562bd0", "<???> @ 0x1406cc2f4"], "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"}