{"type": "func", "start": 5373470560, "end": 5373471079, "name": "MusicDownloadManager::decodeCustomSFX", "pseudocode": "// \n// MusicDownloadManager::decodeCustomSFX from 0x14048a760 to 0x14048a967 (519 bytes)\n// \n// 2 xrefs:\n// > MusicDownloadManager::dataLoaded @ 0x14048b263\n// > <???> @ 0x140928d48\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:32:48 +0000\n// \n\n// Hidden C++ exception states: #wind=2\nvoid __fastcall MusicDownloadManager::decodeCustomSFX(__int64 a1, __int64 *a2)\n{\n  char *v4; // rbx\n  __int64 v5; // rbx\n  void *v6; // rcx\n  char *v7; // rcx\n  int v8; // eax\n  char *v9; // rdi\n  char *v10; // rax\n  int v11; // [rsp+30h] [rbp-68h] BYREF\n  int v12; // [rsp+34h] [rbp-64h] BYREF\n  char *String[2]; // [rsp+38h] [rbp-60h] BYREF\n  __int64 v14; // [rsp+48h] [rbp-50h]\n  void *Block[2]; // [rsp+50h] [rbp-48h] BYREF\n  __m128i si128; // [rsp+60h] [rbp-38h]\n\n  if ( a2[2] )\n  {\n    *(_OWORD *)String = 0;\n    v14 = 0;\n    sub_1401C5360(a2, (unsigned __int8 *)&word_14070D07C, (__int64 *)String);\n    v4 = String[0];\n    if ( (unsigned __int64)((String[1] - String[0]) >> 5) >= 3 )\n    {\n      if ( *((_QWORD *)String[0] + 3) > 0xFu )\n        v4 = *(char **)String[0];\n      if ( atoi(v4) <= 1 )\n      {\n        v5 = *(_QWORD *)(a1 + 920);\n        v12 = 0;\n        v11 = 0;\n        *(_OWORD *)Block = 0;\n        si128 = _mm_load_si128((const __m128i *)&Size);\n        LOBYTE(Block[0]) = 0;\n        MusicDownloadManager::importCustomSFXSetup(a1, a2, (__int64)Block, 0, &v12, &v11);\n        if ( si128.m128i_i64[1] > 0xFuLL )\n        {\n          v6 = Block[0];\n          if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )\n          {\n            v6 = *((void **)Block[0] - 1);\n            if ( (unsigned __int64)((char *)Block[0] - (char *)v6 - 8) > 0x1F )\n              invoke_watson(nullptr, nullptr, nullptr, 0, 0);\n          }\n          j_j_free(v6);\n        }\n        MusicDownloadManager::getCustomSFXRoot(a1);\n        v7 = String[0] + 32;\n        if ( *((_QWORD *)String[0] + 7) > 0xFu )\n          v7 = *(char **)v7;\n        v8 = atoi(v7);\n        if ( (unsigned int)(v8 - 3) <= 0xFFFFFC && (!v5 || v8 > *(_DWORD *)(a1 + 928)) )\n          *(_DWORD *)(a1 + 928) = v8;\n        MusicDownloadManager::syncCustomSFXPlacements(a1);\n      }\n      v4 = String[0];\n    }\n    if ( v4 )\n    {\n      v9 = String[1];\n      if ( v4 != String[1] )\n      {\n        do\n        {\n          sub_14003D310((__int64)v4);\n          v4 += 32;\n        }\n        while ( v4 != v9 );\n        v4 = String[0];\n      }\n      v10 = v4;\n      if ( ((v14 - (_QWORD)v4) & 0xFFFFFFFFFFFFFFE0uLL) >= 0x1000 )\n      {\n        v4 = *((char **)v4 - 1);\n        if ( (unsigned __int64)(v10 - v4 - 8) > 0x1F )\n          invoke_watson(nullptr, nullptr, nullptr, 0, 0);\n      }\n      j_j_free(v4);\n    }\n  }\n}", "assembly": "; \n; MusicDownloadManager::decodeCustomSFX from 0x14048a760 to 0x14048a967 (519 bytes)\n; \n; 2 xrefs:\n; > MusicDownloadManager::dataLoaded @ 0x14048b263\n; > <???> @ 0x140928d48\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:32:48 +0000\n; \nmov     [rsp+arg_10], rbx                                              ; +0x0, 0x14048a760\npush    rbp                                                            ; +0x5, 0x14048a765\npush    rsi                                                            ; +0x6, 0x14048a766\npush    rdi                                                            ; +0x7, 0x14048a767\nsub     rsp, 80h                                                       ; +0x8, 0x14048a768\nmov     rax, cs:__security_cookie                                      ; +0xf, 0x14048a76f\nxor     rax, rsp                                                       ; +0x16, 0x14048a776\nmov     [rsp+98h+var_28], rax                                          ; +0x19, 0x14048a779\nmov     rsi, rdx                                                       ; +0x1e, 0x14048a77e\nmov     rdi, rcx                                                       ; +0x21, 0x14048a781\ncmp     qword ptr [rdx+10h], 0                                         ; +0x24, 0x14048a784\njz      loc_14048A947                                                  ; +0x29, 0x14048a789\nxorps   xmm0, xmm0                                                     ; +0x2f, 0x14048a78f\nmovdqu  xmmword ptr [rsp+98h+String], xmm0                             ; +0x32, 0x14048a792\nxor     ebp, ebp                                                       ; +0x38, 0x14048a798\nmov     [rsp+98h+var_50], rbp                                          ; +0x3a, 0x14048a79a\nlea     r8, [rsp+98h+String]                                           ; +0x3f, 0x14048a79f\nlea     rdx, word_14070D07C                                            ; +0x44, 0x14048a7a4\nmov     rcx, rsi                                                       ; +0x4b, 0x14048a7ab\ncall    sub_1401C5360                                                  ; +0x4e, 0x14048a7ae\nmov     rax, [rsp+98h+String+8]                                        ; +0x53, 0x14048a7b3\nmov     rbx, [rsp+98h+String]                                          ; +0x58, 0x14048a7b8\nsub     rax, rbx                                                       ; +0x5d, 0x14048a7bd\nsar     rax, 5                                                         ; +0x60, 0x14048a7c0\ncmp     rax, 3                                                         ; +0x64, 0x14048a7c4\njb      loc_14048A8D7                                                  ; +0x68, 0x14048a7c8\ncmp     qword ptr [rbx+18h], 0Fh                                       ; +0x6e, 0x14048a7ce\njbe     short loc_14048A7D8                                            ; +0x73, 0x14048a7d3\nmov     rbx, [rbx]                                                     ; +0x75, 0x14048a7d5\nmov     rcx, rbx; String                                               ; +0x78, 0x14048a7d8\ncall    cs:atoi                                                        ; +0x7b, 0x14048a7db\ncmp     eax, 1                                                         ; +0x81, 0x14048a7e1\njg      loc_14048A8D2                                                  ; +0x84, 0x14048a7e4\nmov     rbx, [rdi+398h]                                                ; +0x8a, 0x14048a7ea\nmov     [rsp+98h+var_64], ebp                                          ; +0x91, 0x14048a7f1\nmov     [rsp+98h+var_68], ebp                                          ; +0x95, 0x14048a7f5\nxorps   xmm0, xmm0                                                     ; +0x99, 0x14048a7f9\nmovups  xmmword ptr [rsp+98h+Block], xmm0                              ; +0x9c, 0x14048a7fc\nmovdqa  xmm1, cs:Size                                                  ; +0xa1, 0x14048a801\nmovdqu  [rsp+98h+var_38], xmm1                                         ; +0xa9, 0x14048a809\nmov     byte ptr [rsp+98h+Block], 0                                    ; +0xaf, 0x14048a80f\nlea     rax, [rsp+98h+var_68]                                          ; +0xb4, 0x14048a814\nmov     [rsp+98h+var_70], rax                                          ; +0xb9, 0x14048a819\nlea     rax, [rsp+98h+var_64]                                          ; +0xbe, 0x14048a81e\nmov     [rsp+98h+Reserved], rax                                        ; +0xc3, 0x14048a823\nxor     r9d, r9d                                                       ; +0xc8, 0x14048a828\nlea     r8, [rsp+98h+Block]                                            ; +0xcb, 0x14048a82b\nmov     rdx, rsi                                                       ; +0xd0, 0x14048a830\nmov     rcx, rdi                                                       ; +0xd3, 0x14048a833\ncall    MusicDownloadManager__importCustomSFXSetup                     ; +0xd6, 0x14048a836\nnop                                                                    ; +0xdb, 0x14048a83b\nmov     rdx, qword ptr [rsp+98h+var_38+8]                              ; +0xdc, 0x14048a83c\ncmp     rdx, 0Fh                                                       ; +0xe1, 0x14048a841\njbe     short loc_14048A88B                                            ; +0xe5, 0x14048a845\ninc     rdx                                                            ; +0xe7, 0x14048a847\nmov     rcx, [rsp+98h+Block]; Block                                    ; +0xea, 0x14048a84a\nmov     rax, rcx                                                       ; +0xef, 0x14048a84f\ncmp     rdx, 1000h                                                     ; +0xf2, 0x14048a852\njb      short loc_14048A886                                            ; +0xf9, 0x14048a859\nadd     rdx, 27h ; '''                                                 ; +0xfb, 0x14048a85b\nmov     rcx, [rcx-8]                                                   ; +0xff, 0x14048a85f\nsub     rax, rcx                                                       ; +0x103, 0x14048a863\nsub     rax, 8                                                         ; +0x106, 0x14048a866\ncmp     rax, 1Fh                                                       ; +0x10a, 0x14048a86a\njbe     short loc_14048A886                                            ; +0x10e, 0x14048a86e\nmov     [rsp+98h+Reserved], rbp; Reserved                              ; +0x110, 0x14048a870\nxor     r9d, r9d; LineNo                                               ; +0x115, 0x14048a875\nxor     r8d, r8d; FileName                                             ; +0x118, 0x14048a878\nxor     edx, edx; FunctionName                                         ; +0x11b, 0x14048a87b\nxor     ecx, ecx; Expression                                           ; +0x11d, 0x14048a87d\ncall    cs:_invoke_watson                                              ; +0x11f, 0x14048a87f\nalign 2                                                                ; +0x125, 0x14048a885\ncall    j_j_free                                                       ; +0x126, 0x14048a886\nmov     rcx, rdi                                                       ; +0x12b, 0x14048a88b\ncall    MusicDownloadManager__getCustomSFXRoot                         ; +0x12e, 0x14048a88e\nmov     rcx, [rsp+98h+String]                                          ; +0x133, 0x14048a893\nadd     rcx, 20h ; ' '                                                 ; +0x138, 0x14048a898\ncmp     qword ptr [rcx+18h], 0Fh                                       ; +0x13c, 0x14048a89c\njbe     short loc_14048A8A6                                            ; +0x141, 0x14048a8a1\nmov     rcx, [rcx]; String                                             ; +0x143, 0x14048a8a3\ncall    cs:atoi                                                        ; +0x146, 0x14048a8a6\nlea     edx, [rax-3]                                                   ; +0x14c, 0x14048a8ac\ncmp     edx, 0FFFFFCh                                                  ; +0x14f, 0x14048a8af\nja      short loc_14048A8CA                                            ; +0x155, 0x14048a8b5\ntest    rbx, rbx                                                       ; +0x157, 0x14048a8b7\njz      short loc_14048A8C4                                            ; +0x15a, 0x14048a8ba\ncmp     eax, [rdi+3A0h]                                                ; +0x15c, 0x14048a8bc\njle     short loc_14048A8CA                                            ; +0x162, 0x14048a8c2\nmov     [rdi+3A0h], eax                                                ; +0x164, 0x14048a8c4\nmov     rcx, rdi                                                       ; +0x16a, 0x14048a8ca\ncall    MusicDownloadManager__syncCustomSFXPlacements                  ; +0x16d, 0x14048a8cd\nmov     rbx, [rsp+98h+String]                                          ; +0x172, 0x14048a8d2\ntest    rbx, rbx                                                       ; +0x177, 0x14048a8d7\njz      short loc_14048A947                                            ; +0x17a, 0x14048a8da\nmov     rdi, [rsp+98h+String+8]                                        ; +0x17c, 0x14048a8dc\ncmp     rbx, rdi                                                       ; +0x181, 0x14048a8e1\njz      short loc_14048A8FC                                            ; +0x184, 0x14048a8e4\nmov     rcx, rbx                                                       ; +0x186, 0x14048a8e6\ncall    sub_14003D310                                                  ; +0x189, 0x14048a8e9\nadd     rbx, 20h ; ' '                                                 ; +0x18e, 0x14048a8ee\ncmp     rbx, rdi                                                       ; +0x192, 0x14048a8f2\njnz     short loc_14048A8E6                                            ; +0x195, 0x14048a8f5\nmov     rbx, [rsp+98h+String]                                          ; +0x197, 0x14048a8f7\nmov     rdx, [rsp+98h+var_50]                                          ; +0x19c, 0x14048a8fc\nsub     rdx, rbx                                                       ; +0x1a1, 0x14048a901\nand     rdx, 0FFFFFFFFFFFFFFE0h                                        ; +0x1a4, 0x14048a904\nmov     rax, rbx                                                       ; +0x1a8, 0x14048a908\ncmp     rdx, 1000h                                                     ; +0x1ab, 0x14048a90b\njb      short loc_14048A93F                                            ; +0x1b2, 0x14048a912\nadd     rdx, 27h ; '''                                                 ; +0x1b4, 0x14048a914\nmov     rbx, [rbx-8]                                                   ; +0x1b8, 0x14048a918\nsub     rax, rbx                                                       ; +0x1bc, 0x14048a91c\nsub     rax, 8                                                         ; +0x1bf, 0x14048a91f\ncmp     rax, 1Fh                                                       ; +0x1c3, 0x14048a923\njbe     short loc_14048A93F                                            ; +0x1c7, 0x14048a927\nmov     [rsp+98h+Reserved], rbp; Reserved                              ; +0x1c9, 0x14048a929\nxor     r9d, r9d; LineNo                                               ; +0x1ce, 0x14048a92e\nxor     r8d, r8d; FileName                                             ; +0x1d1, 0x14048a931\nxor     edx, edx; FunctionName                                         ; +0x1d4, 0x14048a934\nxor     ecx, ecx; Expression                                           ; +0x1d6, 0x14048a936\ncall    cs:_invoke_watson                                              ; +0x1d8, 0x14048a938\ndb 0CCh                                                                ; +0x1de, 0x14048a93e\nmov     rcx, rbx; Block                                                ; +0x1df, 0x14048a93f\ncall    j_j_free                                                       ; +0x1e2, 0x14048a942\nmov     rcx, [rsp+98h+var_28]                                          ; +0x1e7, 0x14048a947\nxor     rcx, rsp; StackCookie                                          ; +0x1ec, 0x14048a94c\ncall    __security_check_cookie                                        ; +0x1ef, 0x14048a94f\nmov     rbx, [rsp+98h+arg_10]                                          ; +0x1f4, 0x14048a954\nadd     rsp, 80h                                                       ; +0x1fc, 0x14048a95c\npop     rdi                                                            ; +0x203, 0x14048a963\npop     rsi                                                            ; +0x204, 0x14048a964\npop     rbp                                                            ; +0x205, 0x14048a965\nretn                                                                   ; +0x206, 0x14048a966", "xrefs": ["MusicDownloadManager::dataLoaded @ 0x14048b263", "<???> @ 0x140928d48"], "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"}