{"type": "func", "start": 5370668912, "end": 5370669322, "name": "GameStatsManager::completedStarLevel", "pseudocode": "// \n// GameStatsManager::completedStarLevel from 0x1401de770 to 0x1401de90a (410 bytes)\n// \n// 5 xrefs:\n// > GameLevelManager::updateLevelRewards @ 0x14014650b\n// > GameManager::dataLoaded @ 0x140187cdf\n// > GameStatsManager::completedLevel @ 0x1401de4c6\n// > LevelInfoLayer::init @ 0x1402f8ed8\n// > <???> @ 0x1406cc420\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\nvoid GameStatsManager::completedStarLevel(GameStatsManager *a1, GJGameLevel *a2)\n{\n  cocos2d::CCString *v4; // rax\n  const char *v5; // rcx\n  const char *CString; // rax\n  size_t v7; // r8\n  void *v8; // rcx\n  int v9; // r8d\n  const char *v10; // rdx\n  void *Block[2]; // [rsp+20h] [rbp-38h] BYREF\n  __int128 v12; // [rsp+30h] [rbp-28h]\n\n  if ( !GameStatsManager::hasCompletedStarLevel(a1, a2) && a2->m_stars.random - a2->m_stars.seed > 0 )\n  {\n    if ( a2->m_dailyID.random - a2->m_dailyID.seed <= 0 )\n    {\n      v5 = \"gstar_%i\";\n      if ( !a2->m_gauntletLevel )\n        v5 = \"star_%i\";\n      v4 = cocos2d::CCString::createWithFormat(v5);\n    }\n    else\n    {\n      v4 = cocos2d::CCString::createWithFormat(\"dstar_%i\");\n    }\n    CString = cocos2d::CCString::getCString(v4);\n    *(_OWORD *)Block = 0;\n    v12 = 0;\n    v7 = -1;\n    do\n      ++v7;\n    while ( CString[v7] );\n    sub_14003A930(Block, CString, v7);\n    cocos2d::CCDictionary::setObject(a1->m_completedLevels, a1->m_trueString, Block);\n    if ( *((_QWORD *)&v12 + 1) > 0xFu )\n    {\n      v8 = Block[0];\n      if ( (unsigned __int64)(*((_QWORD *)&v12 + 1) + 1LL) >= 0x1000 )\n      {\n        v8 = *((void **)Block[0] - 1);\n        if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )\n          invalid_parameter_noinfo_noreturn();\n      }\n      j_j_free(v8);\n    }\n    v9 = a2->m_stars.random - a2->m_stars.seed;\n    if ( v9 > 10 && a2->m_levelType != Main )\n      v9 = 0;\n    v10 = \"6\";\n    if ( a2->m_levelLength == 5 )\n      v10 = \"28\";\n    GameStatsManager::incrementStat(a1, v10, v9);\n    if ( (unsigned int)(a2->m_stars.random - a2->m_stars.seed - 8) <= 1 )\n      GameStatsManager::incrementStat(a1, \"42\", 1);\n  }\n}", "assembly": "; \n; GameStatsManager::completedStarLevel from 0x1401de770 to 0x1401de90a (410 bytes)\n; \n; 5 xrefs:\n; > GameLevelManager::updateLevelRewards @ 0x14014650b\n; > GameManager::dataLoaded @ 0x140187cdf\n; > GameStatsManager::completedLevel @ 0x1401de4c6\n; > LevelInfoLayer::init @ 0x1402f8ed8\n; > <???> @ 0x1406cc420\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_10], rbx                                              ; +0x0, 0x1401de770\npush    rdi                                                            ; +0x5, 0x1401de775\nsub     rsp, 50h                                                       ; +0x6, 0x1401de776\nmov     rax, cs:__security_cookie                                      ; +0xa, 0x1401de77a\nxor     rax, rsp                                                       ; +0x11, 0x1401de781\nmov     [rsp+58h+var_18], rax                                          ; +0x14, 0x1401de784\nmov     rbx, rdx                                                       ; +0x19, 0x1401de789\nmov     rdi, rcx                                                       ; +0x1c, 0x1401de78c\ncall    GameStatsManager__hasCompletedStarLevel                        ; +0x1f, 0x1401de78f\ntest    al, al                                                         ; +0x24, 0x1401de794\njnz     loc_1401DE8F2                                                  ; +0x26, 0x1401de796\nmov     eax, [rbx+388h]                                                ; +0x2c, 0x1401de79c\nsub     eax, [rbx+38Ch]                                                ; +0x32, 0x1401de7a2\ntest    eax, eax                                                       ; +0x38, 0x1401de7a8\njle     loc_1401DE8F2                                                  ; +0x3a, 0x1401de7aa\nmov     edx, [rbx+36Ch]                                                ; +0x40, 0x1401de7b0\nsub     edx, [rbx+370h]                                                ; +0x46, 0x1401de7b6\ntest    edx, edx                                                       ; +0x4c, 0x1401de7bc\njle     short loc_1401DE7C9                                            ; +0x4e, 0x1401de7be\nlea     rcx, aDstarI; \"dstar_%i\"                                       ; +0x50, 0x1401de7c0\njmp     short loc_1401DE7EE                                            ; +0x57, 0x1401de7c7\nmov     edx, [rbx+148h]                                                ; +0x59, 0x1401de7c9\nmov     eax, [rbx+14Ch]                                                ; +0x5f, 0x1401de7cf\nsub     edx, eax                                                       ; +0x65, 0x1401de7d5\ncmp     byte ptr [rbx+2C9h], 0                                         ; +0x67, 0x1401de7d7\nlea     rcx, aGstarI; \"gstar_%i\"                                       ; +0x6e, 0x1401de7de\njnz     short loc_1401DE7EE                                            ; +0x75, 0x1401de7e5\nlea     rcx, aStarI; \"star_%i\"                                         ; +0x77, 0x1401de7e7\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x7e, 0x1401de7ee\nmov     rcx, rax                                                       ; +0x84, 0x1401de7f4\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x87, 0x1401de7f7\nxorps   xmm0, xmm0                                                     ; +0x8d, 0x1401de7fd\nmovups  xmmword ptr [rsp+58h+Block], xmm0                              ; +0x90, 0x1401de800\nxorps   xmm1, xmm1                                                     ; +0x95, 0x1401de805\nmovdqu  [rsp+58h+var_28], xmm1                                         ; +0x98, 0x1401de808\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0x9e, 0x1401de80e\ninc     r8                                                             ; +0xa5, 0x1401de815\ncmp     byte ptr [rax+r8], 0                                           ; +0xa8, 0x1401de818\njnz     short loc_1401DE815                                            ; +0xad, 0x1401de81d\nmov     rdx, rax                                                       ; +0xaf, 0x1401de81f\nlea     rcx, [rsp+58h+Block]                                           ; +0xb2, 0x1401de822\ncall    sub_14003A930                                                  ; +0xb7, 0x1401de827\nnop                                                                    ; +0xbc, 0x1401de82c\nlea     r8, [rsp+58h+Block]                                            ; +0xbd, 0x1401de82d\nmov     rdx, [rdi+148h]                                                ; +0xc2, 0x1401de832\nmov     rcx, [rdi+2C8h]                                                ; +0xc9, 0x1401de839\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 &) ; +0xd0, 0x1401de840\nnop                                                                    ; +0xd6, 0x1401de846\nmov     rdx, qword ptr [rsp+58h+var_28+8]                              ; +0xd7, 0x1401de847\ncmp     rdx, 0Fh                                                       ; +0xdc, 0x1401de84c\njbe     short loc_1401DE887                                            ; +0xe0, 0x1401de850\ninc     rdx                                                            ; +0xe2, 0x1401de852\nmov     rcx, [rsp+58h+Block]; Block                                    ; +0xe5, 0x1401de855\nmov     rax, rcx                                                       ; +0xea, 0x1401de85a\ncmp     rdx, 1000h                                                     ; +0xed, 0x1401de85d\njb      short loc_1401DE882                                            ; +0xf4, 0x1401de864\nadd     rdx, 27h ; '''                                                 ; +0xf6, 0x1401de866\nmov     rcx, [rcx-8]                                                   ; +0xfa, 0x1401de86a\nsub     rax, rcx                                                       ; +0xfe, 0x1401de86e\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x101, 0x1401de871\ncmp     rax, 1Fh                                                       ; +0x105, 0x1401de875\njbe     short loc_1401DE882                                            ; +0x109, 0x1401de879\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x10b, 0x1401de87b\nalign 2                                                                ; +0x111, 0x1401de881\ncall    j_j_free                                                       ; +0x112, 0x1401de882\nmov     r8d, [rbx+388h]                                                ; +0x117, 0x1401de887\nsub     r8d, [rbx+38Ch]                                                ; +0x11e, 0x1401de88e\ncmp     r8d, 0Ah                                                       ; +0x125, 0x1401de895\njle     short loc_1401DE8A8                                            ; +0x129, 0x1401de899\nxor     eax, eax                                                       ; +0x12b, 0x1401de89b\ncmp     dword ptr [rbx+454h], 1                                        ; +0x12d, 0x1401de89d\ncmovnz  r8d, eax                                                       ; +0x134, 0x1401de8a4\nlea     rax, a28; \"28\"                                                 ; +0x138, 0x1401de8a8\nlea     rdx, a6; \"6\"                                                   ; +0x13f, 0x1401de8af\ncmp     dword ptr [rbx+358h], 5                                        ; +0x146, 0x1401de8b6\ncmovz   rdx, rax                                                       ; +0x14d, 0x1401de8bd\nmov     rcx, rdi                                                       ; +0x151, 0x1401de8c1\ncall    GameStatsManager__incrementStat                                ; +0x154, 0x1401de8c4\nmov     eax, [rbx+388h]                                                ; +0x159, 0x1401de8c9\nsub     eax, [rbx+38Ch]                                                ; +0x15f, 0x1401de8cf\nsub     eax, 8                                                         ; +0x165, 0x1401de8d5\ncmp     eax, 1                                                         ; +0x168, 0x1401de8d8\nja      short loc_1401DE8F2                                            ; +0x16b, 0x1401de8db\nmov     r8d, 1                                                         ; +0x16d, 0x1401de8dd\nlea     rdx, a42; \"42\"                                                 ; +0x173, 0x1401de8e3\nmov     rcx, rdi                                                       ; +0x17a, 0x1401de8ea\ncall    GameStatsManager__incrementStat                                ; +0x17d, 0x1401de8ed\nmov     rcx, [rsp+58h+var_18]                                          ; +0x182, 0x1401de8f2\nxor     rcx, rsp; StackCookie                                          ; +0x187, 0x1401de8f7\ncall    __security_check_cookie                                        ; +0x18a, 0x1401de8fa\nmov     rbx, [rsp+58h+arg_10]                                          ; +0x18f, 0x1401de8ff\nadd     rsp, 50h                                                       ; +0x194, 0x1401de904\npop     rdi                                                            ; +0x198, 0x1401de908\nretn                                                                   ; +0x199, 0x1401de909", "xrefs": ["GameLevelManager::updateLevelRewards @ 0x14014650b", "GameManager::dataLoaded @ 0x140187cdf", "GameStatsManager::completedLevel @ 0x1401de4c6", "LevelInfoLayer::init @ 0x1402f8ed8", "<???> @ 0x1406cc420"], "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"}