{"type": "func", "start": 5370677024, "end": 5370677586, "name": "GameStatsManager::getAwardedCurrencyForLevel", "pseudocode": "// \n// GameStatsManager::getAwardedCurrencyForLevel from 0x1401e0720 to 0x1401e0952 (562 bytes)\n// \n// 10 xrefs:\n// > LevelCell::loadCustomLevelCell @ 0x1400b070e\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3910\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3a43\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ba3\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3d42\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ea2\n// > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ff2\n// > LevelInfoLayer::updateLabelValues @ 0x1402ff701\n// > LevelPage::updateDynamicPage @ 0x14031b335\n// > <???> @ 0x1406cc4e0\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=2\nint GameStatsManager::getAwardedCurrencyForLevel(GameStatsManager *a1, GJGameLevel *a2)\n{\n  int v4; // edx\n  cocos2d::CCDictionary *m_mainCurrencyScores; // rbp\n  cocos2d::CCString *v6; // rax\n  const char *CString; // rax\n  size_t v8; // rbx\n  size_t v9; // r8\n  cocos2d::CCString *v10; // rax\n  void **v11; // rdx\n  cocos2d::CCString *v12; // rax\n  int v13; // ebx\n  void *v14; // rcx\n  int BaseCurrencyForLevel; // eax\n  float v16; // xmm1_4\n  int v17; // ebx\n  void *v18; // rcx\n  void *v20[2]; // [rsp+28h] [rbp-60h] BYREF\n  __int128 v21; // [rsp+38h] [rbp-50h]\n  void *Block[2]; // [rsp+48h] [rbp-40h] BYREF\n  __int128 v23; // [rsp+58h] [rbp-30h]\n\n  v4 = a2->m_dailyID.random - a2->m_dailyID.seed;\n  if ( v4 <= 0 )\n  {\n    if ( a2->m_levelType == Main )\n    {\n      m_mainCurrencyScores = a1->m_mainCurrencyScores;\n    }\n    else if ( a2->m_gauntletLevel )\n    {\n      m_mainCurrencyScores = a1->m_gauntletCurrencyScores;\n    }\n    else\n    {\n      m_mainCurrencyScores = a1->m_onlineCurrencyScores;\n    }\n    v10 = cocos2d::CCString::createWithFormat(\"%i\", a2->m_levelID.random - a2->m_levelID.seed);\n    CString = cocos2d::CCString::getCString(v10);\n    *(_OWORD *)v20 = 0;\n    v21 = 0;\n    v8 = -1;\n    v9 = -1;\n    do\n      ++v9;\n    while ( CString[v9] );\n  }\n  else\n  {\n    m_mainCurrencyScores = a1->m_timelyCurrencyScores;\n    v6 = cocos2d::CCString::createWithFormat(\"%i\", v4);\n    CString = cocos2d::CCString::getCString(v6);\n    *(_OWORD *)v20 = 0;\n    v21 = 0;\n    v8 = -1;\n    v9 = -1;\n    do\n      ++v9;\n    while ( CString[v9] );\n  }\n  sub_14003A930(v20, CString, v9);\n  v11 = v20;\n  if ( *((_QWORD *)&v21 + 1) > 0xFu )\n    v11 = (void **)v20[0];\n  *(_OWORD *)Block = 0;\n  v23 = 0;\n  do\n    ++v8;\n  while ( *((_BYTE *)v11 + v8) );\n  sub_14003A930(Block, v11, v8);\n  v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_mainCurrencyScores, Block);\n  v13 = cocos2d::CCString::intValue(v12);\n  if ( *((_QWORD *)&v23 + 1) > 0xFu )\n  {\n    v14 = Block[0];\n    if ( (unsigned __int64)(*((_QWORD *)&v23 + 1) + 1LL) >= 0x1000 )\n    {\n      v14 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v14);\n  }\n  BaseCurrencyForLevel = GameStatsManager::getBaseCurrencyForLevel(a1, a2);\n  v16 = (float)BaseCurrencyForLevel;\n  if ( v13 >= 100 )\n    v17 = BaseCurrencyForLevel + (int)(float)(v16 * 0.25);\n  else\n    v17 = (int)floorf((float)((float)v13 / 100.0) * v16);\n  if ( *((_QWORD *)&v21 + 1) > 0xFu )\n  {\n    v18 = v20[0];\n    if ( (unsigned __int64)(*((_QWORD *)&v21 + 1) + 1LL) >= 0x1000 )\n    {\n      v18 = *((void **)v20[0] - 1);\n      if ( (unsigned __int64)((char *)v20[0] - (char *)v18 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v18);\n  }\n  return v17;\n}", "assembly": "; \n; GameStatsManager::getAwardedCurrencyForLevel from 0x1401e0720 to 0x1401e0952 (562 bytes)\n; \n; 10 xrefs:\n; > LevelCell::loadCustomLevelCell @ 0x1400b070e\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3910\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3a43\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ba3\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3d42\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ea2\n; > GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ff2\n; > LevelInfoLayer::updateLabelValues @ 0x1402ff701\n; > LevelPage::updateDynamicPage @ 0x14031b335\n; > <???> @ 0x1406cc4e0\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, 0x1401e0720\npush    rbp                                                            ; +0x5, 0x1401e0725\npush    rsi                                                            ; +0x6, 0x1401e0726\npush    rdi                                                            ; +0x7, 0x1401e0727\nsub     rsp, 70h                                                       ; +0x8, 0x1401e0728\nmov     rax, cs:__security_cookie                                      ; +0xc, 0x1401e072c\nxor     rax, rsp                                                       ; +0x13, 0x1401e0733\nmov     [rsp+88h+var_20], rax                                          ; +0x16, 0x1401e0736\nmov     rsi, rdx                                                       ; +0x1b, 0x1401e073b\nmov     rdi, rcx                                                       ; +0x1e, 0x1401e073e\nmov     edx, [rdx+36Ch]                                                ; +0x21, 0x1401e0741\nsub     edx, [rsi+370h]                                                ; +0x27, 0x1401e0747\ntest    edx, edx                                                       ; +0x2d, 0x1401e074d\njle     short loc_1401E079C                                            ; +0x2f, 0x1401e074f\nmov     rbp, [rcx+300h]                                                ; +0x31, 0x1401e0751\nlea     rcx, aI_11; \"%i\"                                               ; +0x38, 0x1401e0758\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x3f, 0x1401e075f\nmov     rcx, rax                                                       ; +0x45, 0x1401e0765\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x48, 0x1401e0768\nxorps   xmm0, xmm0                                                     ; +0x4e, 0x1401e076e\nmovups  xmmword ptr [rsp+88h+var_60], xmm0                             ; +0x51, 0x1401e0771\nxorps   xmm1, xmm1                                                     ; +0x56, 0x1401e0776\nmovdqu  [rsp+88h+var_50], xmm1                                         ; +0x59, 0x1401e0779\nmov     rbx, 0FFFFFFFFFFFFFFFFh                                        ; +0x5f, 0x1401e077f\nmov     r8, rbx                                                        ; +0x66, 0x1401e0786\nnop     dword ptr [rax+00000000h]                                      ; +0x69, 0x1401e0789\ninc     r8                                                             ; +0x70, 0x1401e0790\ncmp     byte ptr [rax+r8], 0                                           ; +0x73, 0x1401e0793\njnz     short loc_1401E0790                                            ; +0x78, 0x1401e0798\njmp     short loc_1401E080E                                            ; +0x7a, 0x1401e079a\ncmp     dword ptr [rsi+454h], 1                                        ; +0x7c, 0x1401e079c\njnz     short loc_1401E07AE                                            ; +0x83, 0x1401e07a3\nmov     rbp, [rcx+2F0h]                                                ; +0x85, 0x1401e07a5\njmp     short loc_1401E07C7                                            ; +0x8c, 0x1401e07ac\ncmp     byte ptr [rsi+2C9h], 0                                         ; +0x8e, 0x1401e07ae\njz      short loc_1401E07C0                                            ; +0x95, 0x1401e07b5\nmov     rbp, [rcx+2F8h]                                                ; +0x97, 0x1401e07b7\njmp     short loc_1401E07C7                                            ; +0x9e, 0x1401e07be\nmov     rbp, [rcx+2E8h]                                                ; +0xa0, 0x1401e07c0\nmov     edx, [rsi+148h]                                                ; +0xa7, 0x1401e07c7\nsub     edx, [rsi+14Ch]                                                ; +0xad, 0x1401e07cd\nlea     rcx, aI_11; \"%i\"                                               ; +0xb3, 0x1401e07d3\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xba, 0x1401e07da\nmov     rcx, rax                                                       ; +0xc0, 0x1401e07e0\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0xc3, 0x1401e07e3\nxorps   xmm0, xmm0                                                     ; +0xc9, 0x1401e07e9\nmovups  xmmword ptr [rsp+88h+var_60], xmm0                             ; +0xcc, 0x1401e07ec\nxorps   xmm1, xmm1                                                     ; +0xd1, 0x1401e07f1\nmovdqu  [rsp+88h+var_50], xmm1                                         ; +0xd4, 0x1401e07f4\nmov     rbx, 0FFFFFFFFFFFFFFFFh                                        ; +0xda, 0x1401e07fa\nmov     r8, rbx                                                        ; +0xe1, 0x1401e0801\ninc     r8                                                             ; +0xe4, 0x1401e0804\ncmp     byte ptr [rax+r8], 0                                           ; +0xe7, 0x1401e0807\njnz     short loc_1401E0804                                            ; +0xec, 0x1401e080c\nmov     rdx, rax                                                       ; +0xee, 0x1401e080e\nlea     rcx, [rsp+88h+var_60]                                          ; +0xf1, 0x1401e0811\ncall    sub_14003A930                                                  ; +0xf6, 0x1401e0816\nnop                                                                    ; +0xfb, 0x1401e081b\nlea     rdx, [rsp+88h+var_60]                                          ; +0xfc, 0x1401e081c\ncmp     qword ptr [rsp+88h+var_50+8], 0Fh                              ; +0x101, 0x1401e0821\ncmova   rdx, [rsp+88h+var_60]                                          ; +0x107, 0x1401e0827\nxorps   xmm0, xmm0                                                     ; +0x10d, 0x1401e082d\nmovups  xmmword ptr [rsp+88h+Block], xmm0                              ; +0x110, 0x1401e0830\nxorps   xmm1, xmm1                                                     ; +0x115, 0x1401e0835\nmovdqu  [rsp+88h+var_30], xmm1                                         ; +0x118, 0x1401e0838\nxchg    ax, ax                                                         ; +0x11e, 0x1401e083e\ninc     rbx                                                            ; +0x120, 0x1401e0840\ncmp     byte ptr [rdx+rbx], 0                                          ; +0x123, 0x1401e0843\njnz     short loc_1401E0840                                            ; +0x127, 0x1401e0847\nmov     r8, rbx                                                        ; +0x129, 0x1401e0849\nlea     rcx, [rsp+88h+Block]                                           ; +0x12c, 0x1401e084c\ncall    sub_14003A930                                                  ; +0x131, 0x1401e0851\nnop                                                                    ; +0x136, 0x1401e0856\nlea     rdx, [rsp+88h+Block]                                           ; +0x137, 0x1401e0857\nmov     rcx, rbp                                                       ; +0x13c, 0x1401e085c\ncall    cs:?valueForKey@CCDictionary@cocos2d@@QEAAPEBVCCString@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::valueForKey(std::string const &) ; +0x13f, 0x1401e085f\nmov     rcx, rax                                                       ; +0x145, 0x1401e0865\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0x148, 0x1401e0868\nmov     ebx, eax                                                       ; +0x14e, 0x1401e086e\nmov     rdx, qword ptr [rsp+88h+var_30+8]                              ; +0x150, 0x1401e0870\ncmp     rdx, 0Fh                                                       ; +0x155, 0x1401e0875\njbe     short loc_1401E08B0                                            ; +0x159, 0x1401e0879\ninc     rdx                                                            ; +0x15b, 0x1401e087b\nmov     rcx, [rsp+88h+Block]; Block                                    ; +0x15e, 0x1401e087e\nmov     rax, rcx                                                       ; +0x163, 0x1401e0883\ncmp     rdx, 1000h                                                     ; +0x166, 0x1401e0886\njb      short loc_1401E08AB                                            ; +0x16d, 0x1401e088d\nadd     rdx, 27h ; '''                                                 ; +0x16f, 0x1401e088f\nmov     rcx, [rcx-8]                                                   ; +0x173, 0x1401e0893\nsub     rax, rcx                                                       ; +0x177, 0x1401e0897\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x17a, 0x1401e089a\ncmp     rax, 1Fh                                                       ; +0x17e, 0x1401e089e\njbe     short loc_1401E08AB                                            ; +0x182, 0x1401e08a2\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x184, 0x1401e08a4\ndb 0CCh                                                                ; +0x18a, 0x1401e08aa\ncall    j_j_free                                                       ; +0x18b, 0x1401e08ab\nmov     rdx, rsi                                                       ; +0x190, 0x1401e08b0\nmov     rcx, rdi                                                       ; +0x193, 0x1401e08b3\ncall    GameStatsManager__getBaseCurrencyForLevel                      ; +0x196, 0x1401e08b6\nmovd    xmm1, eax                                                      ; +0x19b, 0x1401e08bb\ncvtdq2ps xmm1, xmm1                                                    ; +0x19f, 0x1401e08bf\ncmp     ebx, 64h ; 'd'                                                 ; +0x1a2, 0x1401e08c2\njge     short loc_1401E08E5                                            ; +0x1a5, 0x1401e08c5\nmovd    xmm0, ebx                                                      ; +0x1a7, 0x1401e08c7\ncvtdq2ps xmm0, xmm0                                                    ; +0x1ab, 0x1401e08cb\ndivss   xmm0, cs:dword_1406232BC                                       ; +0x1ae, 0x1401e08ce\nmulss   xmm0, xmm1; X                                                  ; +0x1b6, 0x1401e08d6\ncall    floorf                                                         ; +0x1ba, 0x1401e08da\ncvttss2si ebx, xmm0                                                    ; +0x1bf, 0x1401e08df\njmp     short loc_1401E08F3                                            ; +0x1c3, 0x1401e08e3\nmulss   xmm1, cs:dword_140622A88                                       ; +0x1c5, 0x1401e08e5\ncvttss2si ebx, xmm1                                                    ; +0x1cd, 0x1401e08ed\nadd     ebx, eax                                                       ; +0x1d1, 0x1401e08f1\nmov     rdx, qword ptr [rsp+88h+var_50+8]                              ; +0x1d3, 0x1401e08f3\ncmp     rdx, 0Fh                                                       ; +0x1d8, 0x1401e08f8\njbe     short loc_1401E0933                                            ; +0x1dc, 0x1401e08fc\ninc     rdx                                                            ; +0x1de, 0x1401e08fe\nmov     rcx, [rsp+88h+var_60]; Block                                   ; +0x1e1, 0x1401e0901\nmov     rax, rcx                                                       ; +0x1e6, 0x1401e0906\ncmp     rdx, 1000h                                                     ; +0x1e9, 0x1401e0909\njb      short loc_1401E092E                                            ; +0x1f0, 0x1401e0910\nadd     rdx, 27h ; '''                                                 ; +0x1f2, 0x1401e0912\nmov     rcx, [rcx-8]                                                   ; +0x1f6, 0x1401e0916\nsub     rax, rcx                                                       ; +0x1fa, 0x1401e091a\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x1fd, 0x1401e091d\ncmp     rax, 1Fh                                                       ; +0x201, 0x1401e0921\njbe     short loc_1401E092E                                            ; +0x205, 0x1401e0925\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x207, 0x1401e0927\nalign 2                                                                ; +0x20d, 0x1401e092d\ncall    j_j_free                                                       ; +0x20e, 0x1401e092e\nmov     eax, ebx                                                       ; +0x213, 0x1401e0933\nmov     rcx, [rsp+88h+var_20]                                          ; +0x215, 0x1401e0935\nxor     rcx, rsp; StackCookie                                          ; +0x21a, 0x1401e093a\ncall    __security_check_cookie                                        ; +0x21d, 0x1401e093d\nmov     rbx, [rsp+88h+arg_10]                                          ; +0x222, 0x1401e0942\nadd     rsp, 70h                                                       ; +0x22a, 0x1401e094a\npop     rdi                                                            ; +0x22e, 0x1401e094e\npop     rsi                                                            ; +0x22f, 0x1401e094f\npop     rbp                                                            ; +0x230, 0x1401e0950\nretn                                                                   ; +0x231, 0x1401e0951", "xrefs": ["LevelCell::loadCustomLevelCell @ 0x1400b070e", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3910", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3a43", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ba3", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3d42", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ea2", "GameStatsManager::getTotalCollectedCurrency @ 0x1401e3ff2", "LevelInfoLayer::updateLabelValues @ 0x1402ff701", "LevelPage::updateDynamicPage @ 0x14031b335", "<???> @ 0x1406cc4e0"], "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"}