{"type": "func", "start": 4300495280, "end": 4300495590, "name": "GameLevelManager::markLevelAsDownloaded", "pseudocode": "// \n// GameLevelManager::markLevelAsDownloaded from 0x1005459b0 to 0x100545ae6 (310 bytes)\n// \n// 2 xrefs:\n// > GameLevelManager::processOnDownloadLevelCompleted @ 0x1005455f4\n// > GameLevelManager::markListAsDownloaded @ 0x100545b17\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\nvoid __fastcall GameLevelManager::markLevelAsDownloaded(GameLevelManager *a1, int a2)\n{\n  double v2; // xmm0_8\n  cocos2d::CCDictionary *m_downloadedLevels; // rbx\n  cocos2d::CCString *m_trueString; // r14\n  cocos2d::CCString *v5; // rax\n  const char *CString; // r12\n  size_t v7; // rax\n  std::string::size_type v8; // r15\n  char *data; // r13\n  cocos2d::CCDictionary *v10; // r14\n  size_t v11; // rbx\n  char v12; // [rsp+0h] [rbp-50h]\n  cocos2d::CCString *v13; // [rsp+8h] [rbp-48h]\n  std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF\n\n  if ( cocos2d::CCDictionary::count(a1->m_downloadedLevels) >= 0x64 )\n  {\n    cocos2d::CCDictionary::getFirstKey(__dst, (__int64)a1->m_downloadedLevels);\n    cocos2d::CCDictionary::removeObjectForKey_1((__int64)a1->m_downloadedLevels, (char *)__dst);\n    if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )\n      operator delete(__dst[0].__r_.__value_.__l.__data_);\n  }\n  m_downloadedLevels = a1->m_downloadedLevels;\n  m_trueString = a1->m_trueString;\n  v5 = (cocos2d::CCString *)sub_1007AB580(\"%i\", v12);\n  CString = cocos2d::CCString::getCString(v5);\n  v7 = strlen(CString);\n  if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )\n    sub_100006BF0(v2);\n  v8 = v7;\n  if ( v7 >= 0x17 )\n  {\n    v13 = m_trueString;\n    v10 = m_downloadedLevels;\n    v11 = 26;\n    if ( (v7 | 7) != 0x17 )\n      v11 = (v7 | 7) + 1;\n    data = (char *)operator new(v11);\n    __dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;\n    __dst[0].__r_.__value_.__r.__words[0] = v11 + 1;\n    m_downloadedLevels = v10;\n    m_trueString = v13;\n    __dst[0].__r_.__value_.__l.__size_ = v8;\n    goto LABEL_11;\n  }\n  __dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);\n  data = __dst[0].__r_.__value_.__s.__data_;\n  if ( v7 )\nLABEL_11:\n    memmove(data, CString, v8);\n  data[v8] = 0;\n  cocos2d::CCDictionary::setObject_1((__int64)m_downloadedLevels, m_trueString, (char *)__dst);\n  if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )\n    operator delete(__dst[0].__r_.__value_.__l.__data_);\n}", "assembly": "; \n; GameLevelManager::markLevelAsDownloaded from 0x1005459b0 to 0x100545ae6 (310 bytes)\n; \n; 2 xrefs:\n; > GameLevelManager::processOnDownloadLevelCompleted @ 0x1005455f4\n; > GameLevelManager::markListAsDownloaded @ 0x100545b17\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, 0x1005459b0\nmov     rbp, rsp                                                       ; +0x1, 0x1005459b1\npush    r15                                                            ; +0x4, 0x1005459b4\npush    r14                                                            ; +0x6, 0x1005459b6\npush    r13                                                            ; +0x8, 0x1005459b8\npush    r12                                                            ; +0xa, 0x1005459ba\npush    rbx                                                            ; +0xc, 0x1005459bc\nsub     rsp, 28h                                                       ; +0xd, 0x1005459bd\nmov     r15d, esi                                                      ; +0x11, 0x1005459c1\nmov     r14, rdi                                                       ; +0x14, 0x1005459c4\nmov     rdi, [rdi+188h]                                                ; +0x17, 0x1005459c7\ncall    cocos2d__CCDictionary__count                                   ; +0x1e, 0x1005459ce\ncmp     eax, 64h ; 'd'                                                 ; +0x23, 0x1005459d3\njb      short loc_100545A09                                            ; +0x26, 0x1005459d6\nmov     rsi, [r14+188h]                                                ; +0x28, 0x1005459d8\nlea     rbx, [rbp+__dst]                                               ; +0x2f, 0x1005459df\nmov     rdi, rbx; this                                                 ; +0x33, 0x1005459e3\ncall    cocos2d__CCDictionary__getFirstKey                             ; +0x36, 0x1005459e6\nmov     rdi, [r14+188h]                                                ; +0x3b, 0x1005459eb\nmov     rsi, rbx                                                       ; +0x42, 0x1005459f2\ncall    cocos2d__CCDictionary__removeObjectForKey_1                    ; +0x45, 0x1005459f5\ntest    byte ptr [rbp+__dst], 1                                        ; +0x4a, 0x1005459fa\njz      short loc_100545A09                                            ; +0x4e, 0x1005459fe\nmov     rdi, [rbp+__p]; __p                                            ; +0x50, 0x100545a00\ncall    __ZdlPv; operator delete(void *)                               ; +0x54, 0x100545a04\nmov     rbx, [r14+188h]                                                ; +0x59, 0x100545a09\nmov     r14, [r14+3A8h]                                                ; +0x60, 0x100545a10\nlea     rdi, aI; \"%i\"                                                  ; +0x67, 0x100545a17\nmov     esi, r15d                                                      ; +0x6e, 0x100545a1e\nxor     eax, eax                                                       ; +0x71, 0x100545a21\ncall    sub_1007AB580                                                  ; +0x73, 0x100545a23\nmov     rdi, rax                                                       ; +0x78, 0x100545a28\ncall    cocos2d__CCString__getCString                                  ; +0x7b, 0x100545a2b\nmov     r12, rax                                                       ; +0x80, 0x100545a30\nmov     rdi, rax; __s                                                  ; +0x83, 0x100545a33\ncall    _strlen                                                        ; +0x86, 0x100545a36\ncmp     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x8b, 0x100545a3b\njnb     loc_100545AE1                                                  ; +0x8f, 0x100545a3f\nmov     r15, rax                                                       ; +0x95, 0x100545a45\ncmp     rax, 17h                                                       ; +0x98, 0x100545a48\njnb     short loc_100545A60                                            ; +0x9c, 0x100545a4c\nlea     eax, [r15+r15]                                                 ; +0x9e, 0x100545a4e\nmov     byte ptr [rbp+__dst], al                                       ; +0xa2, 0x100545a52\nlea     r13, [rbp+__dst+1]                                             ; +0xa5, 0x100545a55\ntest    r15, r15                                                       ; +0xa9, 0x100545a59\njnz     short loc_100545AA0                                            ; +0xac, 0x100545a5c\njmp     short loc_100545AAE                                            ; +0xae, 0x100545a5e\nmov     rax, r15                                                       ; +0xb0, 0x100545a60\nor      rax, 7                                                         ; +0xb3, 0x100545a63\nlea     rcx, [rax+1]                                                   ; +0xb7, 0x100545a67\ncmp     rax, 17h                                                       ; +0xbb, 0x100545a6b\nmov     [rbp+var_48], r14                                              ; +0xbf, 0x100545a6f\nmov     r14, rbx                                                       ; +0xc3, 0x100545a73\nmov     ebx, 1Ah                                                       ; +0xc6, 0x100545a76\ncmovnz  rbx, rcx                                                       ; +0xcb, 0x100545a7b\nmov     rdi, rbx; __sz                                                 ; +0xcf, 0x100545a7f\ncall    __Znwm; operator new(ulong)                                    ; +0xd2, 0x100545a82\nmov     r13, rax                                                       ; +0xd7, 0x100545a87\nmov     [rbp+__p], rax                                                 ; +0xda, 0x100545a8a\ninc     rbx                                                            ; +0xde, 0x100545a8e\nmov     [rbp+__dst], rbx                                               ; +0xe1, 0x100545a91\nmov     rbx, r14                                                       ; +0xe5, 0x100545a95\nmov     r14, [rbp+var_48]                                              ; +0xe8, 0x100545a98\nmov     [rbp+var_38], r15                                              ; +0xec, 0x100545a9c\nmov     rdi, r13; __dst                                                ; +0xf0, 0x100545aa0\nmov     rsi, r12; __src                                                ; +0xf3, 0x100545aa3\nmov     rdx, r15; __len                                                ; +0xf6, 0x100545aa6\ncall    _memmove                                                       ; +0xf9, 0x100545aa9\nmov     byte ptr [r13+r15+0], 0                                        ; +0xfe, 0x100545aae\nlea     rdx, [rbp+__dst]                                               ; +0x104, 0x100545ab4\nmov     rdi, rbx                                                       ; +0x108, 0x100545ab8\nmov     rsi, r14                                                       ; +0x10b, 0x100545abb\ncall    cocos2d__CCDictionary__setObject_1                             ; +0x10e, 0x100545abe\ntest    byte ptr [rbp+__dst], 1                                        ; +0x113, 0x100545ac3\njz      short loc_100545AD2                                            ; +0x117, 0x100545ac7\nmov     rdi, [rbp+__p]; __p                                            ; +0x119, 0x100545ac9\ncall    __ZdlPv; operator delete(void *)                               ; +0x11d, 0x100545acd\nadd     rsp, 28h                                                       ; +0x122, 0x100545ad2\npop     rbx                                                            ; +0x126, 0x100545ad6\npop     r12                                                            ; +0x127, 0x100545ad7\npop     r13                                                            ; +0x129, 0x100545ad9\npop     r14                                                            ; +0x12b, 0x100545adb\npop     r15                                                            ; +0x12d, 0x100545add\npop     rbp                                                            ; +0x12f, 0x100545adf\nretn                                                                   ; +0x130, 0x100545ae0\ncall    sub_100006BF0                                                  ; +0x131, 0x100545ae1", "xrefs": ["GameLevelManager::processOnDownloadLevelCompleted @ 0x1005455f4", "GameLevelManager::markListAsDownloaded @ 0x100545b17"], "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"}