{"type": "func", "start": 5371824048, "end": 5371824555, "name": "GameStatsManager::preSaveGameStats", "pseudocode": "// \n// GameStatsManager::preSaveGameStats from 0x1402f87b0 to 0x1402f89ab (507 bytes)\n// \n// 3 xrefs:\n// > GameStatsManager::encodeDataTo @ 0x1402f6dd0\n// > GJAccountManager::onSyncAccountCompleted @ 0x140308b07\n// > <???> @ 0x14091e1b8\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:30:05 +0000\n// \n\n// Hidden C++ exception states: #wind=2\n__int64 __fastcall GameStatsManager::preSaveGameStats(__int64 a1, __int64 a2, __int64 a3)\n{\n  char v4; // bp\n  __int64 v5; // rdx\n  __int64 v6; // rcx\n  __int64 v7; // r8\n  int i; // edi\n  cocos2d::CCString *v9; // rax\n  const char *CString; // rax\n  size_t v11; // r8\n  __int128 *v12; // rdx\n  size_t v13; // r8\n  __int128 *v14; // rdx\n  __int64 v15; // rbx\n  unsigned int Stat; // eax\n  struct cocos2d::CCString *v17; // rax\n  __int64 v18; // rcx\n  __int64 v19; // r8\n  void *v20; // rcx\n  __int64 v21; // rdx\n  void *v22; // rcx\n  __int64 result; // rax\n  __int128 v24; // [rsp+30h] [rbp-58h] BYREF\n  __int128 v25; // [rsp+40h] [rbp-48h]\n  __int128 v26; // [rsp+50h] [rbp-38h] BYREF\n  __int128 v27; // [rsp+60h] [rbp-28h]\n\n  v4 = *(_BYTE *)(AchievementManager::sharedState(a1, a2, a3) + 360);\n  *(_BYTE *)(AchievementManager::sharedState(v6, v5, v7) + 360) = 1;\n  for ( i = 1; i <= 44; ++i )\n  {\n    v9 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)i);\n    CString = cocos2d::CCString::getCString(v9);\n    v24 = 0;\n    v25 = 0;\n    v11 = -1;\n    do\n      ++v11;\n    while ( CString[v11] );\n    sub_14003D230(&v24, CString, v11);\n    v12 = &v24;\n    if ( *((_QWORD *)&v25 + 1) > 0xFu )\n      v12 = (__int128 *)v24;\n    v26 = 0;\n    v27 = 0;\n    v13 = -1;\n    do\n      ++v13;\n    while ( *((_BYTE *)v12 + v13) );\n    sub_14003D230(&v26, v12, v13);\n    v14 = &v24;\n    if ( *((_QWORD *)&v25 + 1) > 0xFu )\n      v14 = (__int128 *)v24;\n    v15 = *(_QWORD *)(a1 + 576);\n    Stat = GameStatsManager::getStat(a1, v14);\n    v17 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, Stat);\n    cocos2d::CCDictionary::setObject(v15, v17, &v26);\n    if ( *((_QWORD *)&v27 + 1) > 0xFu )\n    {\n      v20 = (void *)v26;\n      if ( (unsigned __int64)(*((_QWORD *)&v27 + 1) + 1LL) >= 0x1000 )\n      {\n        v20 = *(void **)(v26 - 8);\n        if ( (unsigned __int64)(v26 - (_QWORD)v20 - 8) > 0x1F )\n          invoke_watson(nullptr, nullptr, nullptr, 0, 0);\n      }\n      j_j_free(v20);\n    }\n    v21 = *((_QWORD *)&v25 + 1);\n    if ( *((_QWORD *)&v25 + 1) > 0xFu )\n    {\n      v22 = (void *)v24;\n      if ( (unsigned __int64)(*((_QWORD *)&v25 + 1) + 1LL) >= 0x1000 )\n      {\n        v22 = *(void **)(v24 - 8);\n        if ( (unsigned __int64)(v24 - (_QWORD)v22 - 8) > 0x1F )\n          invoke_watson(nullptr, nullptr, nullptr, 0, 0);\n      }\n      j_j_free(v22);\n    }\n  }\n  result = AchievementManager::sharedState(v18, v21, v19);\n  *(_BYTE *)(result + 360) = v4;\n  return result;\n}", "assembly": "; \n; GameStatsManager::preSaveGameStats from 0x1402f87b0 to 0x1402f89ab (507 bytes)\n; \n; 3 xrefs:\n; > GameStatsManager::encodeDataTo @ 0x1402f6dd0\n; > GJAccountManager::onSyncAccountCompleted @ 0x140308b07\n; > <???> @ 0x14091e1b8\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:30:05 +0000\n; \nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x1402f87b0\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x1402f87b5\nmov     [rsp+arg_18], rsi                                              ; +0xa, 0x1402f87ba\npush    rdi                                                            ; +0xf, 0x1402f87bf\nsub     rsp, 80h                                                       ; +0x10, 0x1402f87c0\nmov     rax, cs:__security_cookie                                      ; +0x17, 0x1402f87c7\nxor     rax, rsp                                                       ; +0x1e, 0x1402f87ce\nmov     [rsp+88h+var_18], rax                                          ; +0x21, 0x1402f87d1\nmov     rsi, rcx                                                       ; +0x26, 0x1402f87d6\ncall    AchievementManager__sharedState                                ; +0x29, 0x1402f87d9\nmovzx   ebp, byte ptr [rax+168h]                                       ; +0x2e, 0x1402f87de\ncall    AchievementManager__sharedState                                ; +0x35, 0x1402f87e5\nmov     byte ptr [rax+168h], 1                                         ; +0x3a, 0x1402f87ea\nmov     edi, 1                                                         ; +0x41, 0x1402f87f1\nnop     word ptr [rax+rax+00000000h]                                   ; +0x46, 0x1402f87f6\nmov     edx, edi                                                       ; +0x50, 0x1402f8800\nlea     rcx, word_1406ED6F8                                            ; +0x52, 0x1402f8802\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x59, 0x1402f8809\nmov     rcx, rax                                                       ; +0x5f, 0x1402f880f\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x62, 0x1402f8812\nxorps   xmm0, xmm0                                                     ; +0x68, 0x1402f8818\nmovups  [rsp+88h+var_58], xmm0                                         ; +0x6b, 0x1402f881b\nxorps   xmm1, xmm1                                                     ; +0x70, 0x1402f8820\nmovdqu  [rsp+88h+var_48], xmm1                                         ; +0x73, 0x1402f8823\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0x79, 0x1402f8829\ninc     r8                                                             ; +0x80, 0x1402f8830\ncmp     byte ptr [rax+r8], 0                                           ; +0x83, 0x1402f8833\njnz     short loc_1402F8830                                            ; +0x88, 0x1402f8838\nmov     rdx, rax                                                       ; +0x8a, 0x1402f883a\nlea     rcx, [rsp+88h+var_58]                                          ; +0x8d, 0x1402f883d\ncall    sub_14003D230                                                  ; +0x92, 0x1402f8842\nnop                                                                    ; +0x97, 0x1402f8847\nlea     rdx, [rsp+88h+var_58]                                          ; +0x98, 0x1402f8848\ncmp     qword ptr [rsp+88h+var_48+8], 0Fh                              ; +0x9d, 0x1402f884d\ncmova   rdx, qword ptr [rsp+88h+var_58]                                ; +0xa3, 0x1402f8853\nxorps   xmm0, xmm0                                                     ; +0xa9, 0x1402f8859\nmovups  [rsp+88h+var_38], xmm0                                         ; +0xac, 0x1402f885c\nxorps   xmm1, xmm1                                                     ; +0xb1, 0x1402f8861\nmovdqu  [rsp+88h+var_28], xmm1                                         ; +0xb4, 0x1402f8864\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0xba, 0x1402f886a\ninc     r8                                                             ; +0xc1, 0x1402f8871\ncmp     byte ptr [rdx+r8], 0                                           ; +0xc4, 0x1402f8874\njnz     short loc_1402F8871                                            ; +0xc9, 0x1402f8879\nlea     rcx, [rsp+88h+var_38]                                          ; +0xcb, 0x1402f887b\ncall    sub_14003D230                                                  ; +0xd0, 0x1402f8880\nnop                                                                    ; +0xd5, 0x1402f8885\nlea     rdx, [rsp+88h+var_58]                                          ; +0xd6, 0x1402f8886\ncmp     qword ptr [rsp+88h+var_48+8], 0Fh                              ; +0xdb, 0x1402f888b\ncmova   rdx, qword ptr [rsp+88h+var_58]                                ; +0xe1, 0x1402f8891\nmov     rbx, [rsi+240h]                                                ; +0xe7, 0x1402f8897\nmov     rcx, rsi                                                       ; +0xee, 0x1402f889e\ncall    GameStatsManager__getStat                                      ; +0xf1, 0x1402f88a1\nmov     edx, eax                                                       ; +0xf6, 0x1402f88a6\nlea     rcx, word_1406ED6F8                                            ; +0xf8, 0x1402f88a8\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xff, 0x1402f88af\nmov     rdx, rax                                                       ; +0x105, 0x1402f88b5\nlea     r8, [rsp+88h+var_38]                                           ; +0x108, 0x1402f88b8\nmov     rcx, rbx                                                       ; +0x10d, 0x1402f88bd\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 &) ; +0x110, 0x1402f88c0\nnop                                                                    ; +0x116, 0x1402f88c6\nmov     rdx, qword ptr [rsp+88h+var_28+8]                              ; +0x117, 0x1402f88c7\ncmp     rdx, 0Fh                                                       ; +0x11c, 0x1402f88cc\njbe     short loc_1402F8901                                            ; +0x120, 0x1402f88d0\ninc     rdx                                                            ; +0x122, 0x1402f88d2\nmov     rcx, qword ptr [rsp+88h+var_38]                                ; +0x125, 0x1402f88d5\nmov     rax, rcx                                                       ; +0x12a, 0x1402f88da\ncmp     rdx, 1000h                                                     ; +0x12d, 0x1402f88dd\njb      short loc_1402F88FB                                            ; +0x134, 0x1402f88e4\nadd     rdx, 27h ; '''                                                 ; +0x136, 0x1402f88e6\nmov     rcx, [rcx-8]; Block                                            ; +0x13a, 0x1402f88ea\nsub     rax, rcx                                                       ; +0x13e, 0x1402f88ee\nsub     rax, 8                                                         ; +0x141, 0x1402f88f1\ncmp     rax, 1Fh                                                       ; +0x145, 0x1402f88f5\nja      short loc_1402F8977                                            ; +0x149, 0x1402f88f9\ncall    j_j_free                                                       ; +0x14b, 0x1402f88fb\nnop                                                                    ; +0x150, 0x1402f8900\nmov     rdx, qword ptr [rsp+88h+var_48+8]                              ; +0x151, 0x1402f8901\ncmp     rdx, 0Fh                                                       ; +0x156, 0x1402f8906\njbe     short loc_1402F893A                                            ; +0x15a, 0x1402f890a\ninc     rdx                                                            ; +0x15c, 0x1402f890c\nmov     rcx, qword ptr [rsp+88h+var_58]                                ; +0x15f, 0x1402f890f\nmov     rax, rcx                                                       ; +0x164, 0x1402f8914\ncmp     rdx, 1000h                                                     ; +0x167, 0x1402f8917\njb      short loc_1402F8935                                            ; +0x16e, 0x1402f891e\nadd     rdx, 27h ; '''                                                 ; +0x170, 0x1402f8920\nmov     rcx, [rcx-8]; Block                                            ; +0x174, 0x1402f8924\nsub     rax, rcx                                                       ; +0x178, 0x1402f8928\nsub     rax, 8                                                         ; +0x17b, 0x1402f892b\ncmp     rax, 1Fh                                                       ; +0x17f, 0x1402f892f\nja      short loc_1402F8991                                            ; +0x183, 0x1402f8933\ncall    j_j_free                                                       ; +0x185, 0x1402f8935\ninc     edi                                                            ; +0x18a, 0x1402f893a\ncmp     edi, 2Ch ; ','                                                 ; +0x18c, 0x1402f893c\njle     loc_1402F8800                                                  ; +0x18f, 0x1402f893f\ncall    AchievementManager__sharedState                                ; +0x195, 0x1402f8945\nmov     [rax+168h], bpl                                                ; +0x19a, 0x1402f894a\nmov     rcx, [rsp+88h+var_18]                                          ; +0x1a1, 0x1402f8951\nxor     rcx, rsp; StackCookie                                          ; +0x1a6, 0x1402f8956\ncall    __security_check_cookie                                        ; +0x1a9, 0x1402f8959\nlea     r11, [rsp+88h+var_8]                                           ; +0x1ae, 0x1402f895e\nmov     rbx, [r11+18h]                                                 ; +0x1b6, 0x1402f8966\nmov     rbp, [r11+20h]                                                 ; +0x1ba, 0x1402f896a\nmov     rsi, [r11+28h]                                                 ; +0x1be, 0x1402f896e\nmov     rsp, r11                                                       ; +0x1c2, 0x1402f8972\npop     rdi                                                            ; +0x1c5, 0x1402f8975\nretn                                                                   ; +0x1c6, 0x1402f8976\nmov     [rsp+88h+Reserved], 0; Reserved                                ; +0x1c7, 0x1402f8977\nxor     r9d, r9d; LineNo                                               ; +0x1d0, 0x1402f8980\nxor     r8d, r8d; FileName                                             ; +0x1d3, 0x1402f8983\nxor     edx, edx; FunctionName                                         ; +0x1d6, 0x1402f8986\nxor     ecx, ecx; Expression                                           ; +0x1d8, 0x1402f8988\ncall    cs:_invoke_watson                                              ; +0x1da, 0x1402f898a\ndb 90h                                                                 ; +0x1e0, 0x1402f8990\nmov     [rsp+88h+Reserved], 0; Reserved                                ; +0x1e1, 0x1402f8991\nxor     r9d, r9d; LineNo                                               ; +0x1ea, 0x1402f899a\nxor     r8d, r8d; FileName                                             ; +0x1ed, 0x1402f899d\nxor     edx, edx; FunctionName                                         ; +0x1f0, 0x1402f89a0\nxor     ecx, ecx; Expression                                           ; +0x1f2, 0x1402f89a2\ncall    cs:_invoke_watson                                              ; +0x1f4, 0x1402f89a4\ndb 0CCh                                                                ; +0x1fa, 0x1402f89aa", "xrefs": ["GameStatsManager::encodeDataTo @ 0x1402f6dd0", "GJAccountManager::onSyncAccountCompleted @ 0x140308b07", "<???> @ 0x14091e1b8"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}