{"type": "func", "start": 5373489840, "end": 5373490181, "name": "MusicDownloadManager::onDownloadSFXCompleted", "pseudocode": "// \n// MusicDownloadManager::onDownloadSFXCompleted from 0x14048f2b0 to 0x14048f405 (341 bytes)\n// \n// 2 xrefs:\n// > MusicDownloadManager::downloadSFX @ 0x14048f1f1\n// > <???> @ 0x140928e14\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:50 +0000\n// \n\n// Hidden C++ exception states: #wind=1\nvoid __fastcall MusicDownloadManager::onDownloadSFXCompleted(__int64 a1, __int64 a2, __int64 a3)\n{\n  const char *Tag; // rax\n  unsigned int v6; // esi\n  cocos2d::CCString *v7; // rax\n  char *CString; // rax\n  const char *v9; // rcx\n  FILE *v10; // rax\n  FILE *v11; // rbp\n  unsigned int i; // ebx\n  struct cocos2d::CCObject *v13; // rax\n  char *FileName[4]; // [rsp+20h] [rbp-48h] BYREF\n\n  Tag = cocos2d::extension::CCHttpRequest::getTag(*(cocos2d::extension::CCHttpRequest **)(a3 + 56));\n  v6 = atoi(Tag);\n  v7 = cocos2d::CCString::createWithFormat(\"sfx_%i\", v6);\n  CString = (char *)cocos2d::CCString::getCString(v7);\n  MusicDownloadManager::removeDLFromActive(a1, CString);\n  if ( *(_BYTE *)(a3 + 64) )\n  {\n    MusicDownloadManager::pathForSFX(a1, FileName, v6);\n    v9 = (const char *)FileName;\n    if ( FileName[3] > (char *)0xF )\n      v9 = FileName[0];\n    v10 = fopen(v9, \"wb\");\n    v11 = v10;\n    if ( v10 )\n    {\n      fwrite(*(const void **)(a3 + 72), 1u, *(_QWORD *)(a3 + 80) - *(_QWORD *)(a3 + 72), v10);\n      fclose(v11);\n      for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)); ++i )\n      {\n        v13 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 336), i);\n        (*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v13 + 40) + 48LL))(*((_QWORD *)v13 + 40), v6);\n      }\n    }\n    else\n    {\n      MusicDownloadManager::downloadSFXFailed(a1, v6, 0);\n    }\n    sub_14003D310((__int64)FileName);\n  }\n  else\n  {\n    MusicDownloadManager::downloadSFXFailed(a1, v6, *(_BYTE *)(*(_QWORD *)(a3 + 56) + 204LL) != 0 ? 3 : 0);\n  }\n}", "assembly": "; \n; MusicDownloadManager::onDownloadSFXCompleted from 0x14048f2b0 to 0x14048f405 (341 bytes)\n; \n; 2 xrefs:\n; > MusicDownloadManager::downloadSFX @ 0x14048f1f1\n; > <???> @ 0x140928e14\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:50 +0000\n; \nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x14048f2b0\npush    rbp                                                            ; +0x5, 0x14048f2b5\npush    rsi                                                            ; +0x6, 0x14048f2b6\npush    rdi                                                            ; +0x7, 0x14048f2b7\nsub     rsp, 50h                                                       ; +0x8, 0x14048f2b8\nmov     rax, cs:__security_cookie                                      ; +0xc, 0x14048f2bc\nxor     rax, rsp                                                       ; +0x13, 0x14048f2c3\nmov     [rsp+68h+var_28], rax                                          ; +0x16, 0x14048f2c6\nmov     rbx, r8                                                        ; +0x1b, 0x14048f2cb\nmov     rdi, rcx                                                       ; +0x1e, 0x14048f2ce\nmov     rcx, [r8+38h]                                                  ; +0x21, 0x14048f2d1\ncall    cs:?getTag@CCHttpRequest@extension@cocos2d@@QEAAPEBDXZ; cocos2d::extension::CCHttpRequest::getTag(void) ; +0x25, 0x14048f2d5\nmov     rcx, rax; String                                               ; +0x2b, 0x14048f2db\ncall    cs:atoi                                                        ; +0x2e, 0x14048f2de\nmov     esi, eax                                                       ; +0x34, 0x14048f2e4\nmov     edx, eax                                                       ; +0x36, 0x14048f2e6\nlea     rcx, aSfxI_0; \"sfx_%i\"                                         ; +0x38, 0x14048f2e8\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x3f, 0x14048f2ef\nmov     rcx, rax                                                       ; +0x45, 0x14048f2f5\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x48, 0x14048f2f8\nmov     rdx, rax                                                       ; +0x4e, 0x14048f2fe\nmov     rcx, rdi                                                       ; +0x51, 0x14048f301\ncall    MusicDownloadManager__removeDLFromActive                       ; +0x54, 0x14048f304\nmov     rcx, rdi                                                       ; +0x59, 0x14048f309\ncmp     byte ptr [rbx+40h], 0                                          ; +0x5c, 0x14048f30c\njnz     short loc_14048F334                                            ; +0x60, 0x14048f310\nmov     rdx, [rbx+38h]                                                 ; +0x62, 0x14048f312\nmovzx   r8d, byte ptr [rdx+0CCh]                                       ; +0x66, 0x14048f316\nneg     r8b                                                            ; +0x6e, 0x14048f31e\nsbb     r8d, r8d                                                       ; +0x71, 0x14048f321\nand     r8d, 3                                                         ; +0x74, 0x14048f324\nmov     edx, esi                                                       ; +0x78, 0x14048f328\ncall    MusicDownloadManager__downloadSFXFailed                        ; +0x7a, 0x14048f32a\njmp     loc_14048F3EB                                                  ; +0x7f, 0x14048f32f\nmov     r8d, esi                                                       ; +0x84, 0x14048f334\nlea     rdx, [rsp+68h+FileName]                                        ; +0x87, 0x14048f337\ncall    MusicDownloadManager__pathForSFX                               ; +0x8c, 0x14048f33c\nnop                                                                    ; +0x91, 0x14048f341\nlea     rcx, [rsp+68h+FileName]                                        ; +0x92, 0x14048f342\ncmp     [rsp+68h+var_30], 0Fh                                          ; +0x97, 0x14048f347\ncmova   rcx, [rsp+68h+FileName]; FileName                              ; +0x9d, 0x14048f34d\nlea     rdx, aWb; \"wb\"                                                 ; +0xa3, 0x14048f353\ncall    cs:fopen                                                       ; +0xaa, 0x14048f35a\nmov     rbp, rax                                                       ; +0xb0, 0x14048f360\ntest    rax, rax                                                       ; +0xb3, 0x14048f363\njnz     short loc_14048F377                                            ; +0xb6, 0x14048f366\nxor     r8d, r8d                                                       ; +0xb8, 0x14048f368\nmov     edx, esi                                                       ; +0xbb, 0x14048f36b\nmov     rcx, rdi                                                       ; +0xbd, 0x14048f36d\ncall    MusicDownloadManager__downloadSFXFailed                        ; +0xc0, 0x14048f370\njmp     short loc_14048F3E1                                            ; +0xc5, 0x14048f375\nmov     rcx, [rbx+48h]; Buffer                                         ; +0xc7, 0x14048f377\nmov     r8, [rbx+50h]                                                  ; +0xcb, 0x14048f37b\nsub     r8, rcx; ElementCount                                          ; +0xcf, 0x14048f37f\nmov     r9, rbp; Stream                                                ; +0xd2, 0x14048f382\nmov     edx, 1; ElementSize                                            ; +0xd5, 0x14048f385\ncall    cs:fwrite                                                      ; +0xda, 0x14048f38a\nmov     rcx, rbp; Stream                                               ; +0xe0, 0x14048f390\ncall    cs:fclose                                                      ; +0xe3, 0x14048f393\nxor     ebx, ebx                                                       ; +0xe9, 0x14048f399\nmov     rcx, [rdi+150h]                                                ; +0xeb, 0x14048f39b\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0xf2, 0x14048f3a2\ntest    eax, eax                                                       ; +0xf8, 0x14048f3a8\njz      short loc_14048F3E1                                            ; +0xfa, 0x14048f3aa\nnop     dword ptr [rax+00h]                                            ; +0xfc, 0x14048f3ac\nmov     edx, ebx                                                       ; +0x100, 0x14048f3b0\nmov     rcx, [rdi+150h]                                                ; +0x102, 0x14048f3b2\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x109, 0x14048f3b9\nmov     rcx, [rax+140h]                                                ; +0x10f, 0x14048f3bf\nmov     rax, [rcx]                                                     ; +0x116, 0x14048f3c6\nmov     edx, esi                                                       ; +0x119, 0x14048f3c9\ncall    qword ptr [rax+30h]                                            ; +0x11b, 0x14048f3cb\ninc     ebx                                                            ; +0x11e, 0x14048f3ce\nmov     rcx, [rdi+150h]                                                ; +0x120, 0x14048f3d0\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x127, 0x14048f3d7\ncmp     ebx, eax                                                       ; +0x12d, 0x14048f3dd\njb      short loc_14048F3B0                                            ; +0x12f, 0x14048f3df\nlea     rcx, [rsp+68h+FileName]                                        ; +0x131, 0x14048f3e1\ncall    sub_14003D310                                                  ; +0x136, 0x14048f3e6\nmov     rcx, [rsp+68h+var_28]                                          ; +0x13b, 0x14048f3eb\nxor     rcx, rsp; StackCookie                                          ; +0x140, 0x14048f3f0\ncall    __security_check_cookie                                        ; +0x143, 0x14048f3f3\nmov     rbx, [rsp+68h+arg_8]                                           ; +0x148, 0x14048f3f8\nadd     rsp, 50h                                                       ; +0x14d, 0x14048f3fd\npop     rdi                                                            ; +0x151, 0x14048f401\npop     rsi                                                            ; +0x152, 0x14048f402\npop     rbp                                                            ; +0x153, 0x14048f403\nretn                                                                   ; +0x154, 0x14048f404", "xrefs": ["MusicDownloadManager::downloadSFX @ 0x14048f1f1", "<???> @ 0x140928e14"], "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"}