{"type": "func", "start": 4301372016, "end": 4301372670, "name": "CustomSongWidget::onDownload", "pseudocode": "// \n// CustomSongWidget::onDownload from 0x10061ba70 to 0x10061bcfe (654 bytes)\n// \n// 5 xrefs:\n// > CustomSongWidget::musicActionFinished @ 0x10062133a\n// > sub_100621350 @ 0x100621371\n// > CustomSongWidget::FLAlert_Clicked @ 0x100621465\n// > sub_100621480 @ 0x1006214cc\n// > CustomSongWidget::init @ 0x10061ac25\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 CustomSongWidget::onDownload(CustomSongWidget *a1, cocos2d::CCObject *a2)\n{\n  cocos2d::extension::CCScale9Sprite *m_bgSpr; // rdi\n  GameManager *v4; // rax\n  MusicDownloadManager *v5; // rax\n  unsigned int sizex2; // ecx\n  MusicDownloadManager *v7; // rax\n  MusicDownloadManager *v8; // rax\n  unsigned int v9; // ecx\n  MusicDownloadManager *v10; // rax\n  cocos2d::CCSprite *m_sliderBar; // r14\n  __m128 width_low; // xmm0\n  __m128 v13; // xmm2\n  MusicDownloadManager *v14; // rax\n  MusicDownloadManager *v15; // rax\n  _BYTE v16[40]; // [rsp+8h] [rbp-28h] BYREF\n\n  ((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_errorLabel->setVisible)(a1->m_errorLabel, 0);\n  m_bgSpr = a1->m_bgSpr;\n  if ( m_bgSpr )\n    ((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, _QWORD))m_bgSpr->setVisible)(m_bgSpr, 0);\n  v4 = GameManager::sharedState();\n  if ( !GameManager::getGameVariable(v4, \"0016\") )\n  {\n    v7 = MusicDownloadManager::sharedState();\n    MusicDownloadManager::showTOS(v7, &a1->FLAlertLayerProtocol);\n    return;\n  }\n  if ( a1->m_hasSFX )\n  {\n    ((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadBtn->setVisible)(a1->m_downloadBtn, 0);\n    ((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_cancelDownloadBtn->setVisible)(\n      a1->m_cancelDownloadBtn,\n      1);\n    v5 = MusicDownloadManager::sharedState();\n    sizex2 = v5->m_customContentURL.m_data.m_short.sizex2;\n    if ( (sizex2 & 1) == 0 )\n    {\n      if ( !(sizex2 >> 1) )\n        goto LABEL_20;\nLABEL_15:\n      CustomSongWidget::startMultiAssetDownload(a1);\n      return;\n    }\n    if ( v5->m_customContentURL.m_data.m_long.size )\n      goto LABEL_15;\nLABEL_20:\n    a1->m_hasLibrarySongs = 1;\n    v14 = MusicDownloadManager::sharedState();\n    MusicDownloadManager::getCustomContentURL(v14);\n    return;\n  }\n  if ( a1->m_songInfoObject )\n  {\n    ((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_sliderGroove->setVisible)(a1->m_sliderGroove, 1);\n    ((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadBtn->setVisible)(a1->m_downloadBtn, 0);\n    ((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_cancelDownloadBtn->setVisible)(\n      a1->m_cancelDownloadBtn,\n      1);\n    ((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteBtn->setVisible)(a1->m_deleteBtn, 0);\n    if ( a1->m_customSongID >= 10000000 )\n    {\n      v8 = MusicDownloadManager::sharedState();\n      v9 = v8->m_customContentURL.m_data.m_short.sizex2;\n      if ( (v9 & 1) != 0 )\n      {\n        if ( !v8->m_customContentURL.m_data.m_long.size )\n          goto LABEL_20;\n      }\n      else if ( !(v9 >> 1) )\n      {\n        goto LABEL_20;\n      }\n    }\n    if ( a1->m_songInfoObject->m_verified )\n    {\n      a1->m_isNotDownloading = 0;\n      v10 = MusicDownloadManager::sharedState();\n      MusicDownloadManager::downloadSong(v10, a1->m_customSongID);\n      m_sliderBar = a1->m_sliderBar;\n      width_low = (__m128)LODWORD(a1->m_sliderGroove->m_obRect.size.width);\n      width_low.f32[0] = width_low.f32[0] + -4.0;\n      v13 = width_low;\n      v13.f32[0] = fminf(width_low.f32[0] * 0.0, width_low.f32[0]);\n      sub_10028CC00((__int64)v16, 0.0, 0.0, v13, (__m128)0x41000000u);\n      ((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *))m_sliderBar->setTextureRect)(m_sliderBar, v16);\n      ((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_sliderGroove->setVisible)(a1->m_sliderGroove, 1);\n      cocos2d::CCNode::unschedule(a1, (cocos2d::SEL_SCHEDULE)(unsigned __int64)CustomSongWidget::updateDownloadProgress);\n      cocos2d::CCNode::schedule_1(\n        a1,\n        (cocos2d::SEL_SCHEDULE)(unsigned __int64)CustomSongWidget::updateDownloadProgress,\n        0.033333335);\n    }\n    else\n    {\n      a1->m_isNotDownloading = 1;\n      v15 = MusicDownloadManager::sharedState();\n      MusicDownloadManager::getSongInfo(v15, a1->m_customSongID, 1);\n    }\n  }\n}", "assembly": "; \n; CustomSongWidget::onDownload from 0x10061ba70 to 0x10061bcfe (654 bytes)\n; \n; 5 xrefs:\n; > CustomSongWidget::musicActionFinished @ 0x10062133a\n; > sub_100621350 @ 0x100621371\n; > CustomSongWidget::FLAlert_Clicked @ 0x100621465\n; > sub_100621480 @ 0x1006214cc\n; > CustomSongWidget::init @ 0x10061ac25\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, 0x10061ba70\nmov     rbp, rsp                                                       ; +0x1, 0x10061ba71\npush    r15                                                            ; +0x4, 0x10061ba74\npush    r14                                                            ; +0x6, 0x10061ba76\npush    rbx                                                            ; +0x8, 0x10061ba78\nsub     rsp, 18h                                                       ; +0x9, 0x10061ba79\nmov     rbx, rdi                                                       ; +0xd, 0x10061ba7d\nmov     rdi, [rdi+178h]                                                ; +0x10, 0x10061ba80\nmov     rax, [rdi]                                                     ; +0x17, 0x10061ba87\nxor     esi, esi                                                       ; +0x1a, 0x10061ba8a\ncall    qword ptr [rax+148h]                                           ; +0x1c, 0x10061ba8c\nmov     rdi, [rbx+1D8h]                                                ; +0x22, 0x10061ba92\ntest    rdi, rdi                                                       ; +0x29, 0x10061ba99\njz      short loc_10061BAA9                                            ; +0x2c, 0x10061ba9c\nmov     rax, [rdi]                                                     ; +0x2e, 0x10061ba9e\nxor     esi, esi                                                       ; +0x31, 0x10061baa1\ncall    qword ptr [rax+148h]                                           ; +0x33, 0x10061baa3\ncall    GameManager__sharedState                                       ; +0x39, 0x10061baa9\nlea     rsi, a0016; \"0016\"                                             ; +0x3e, 0x10061baae\nmov     rdi, rax                                                       ; +0x45, 0x10061bab5\ncall    GameManager__getGameVariable                                   ; +0x48, 0x10061bab8\ntest    al, al                                                         ; +0x4d, 0x10061babd\njz      short loc_10061BB16                                            ; +0x4f, 0x10061babf\ncmp     byte ptr [rbx+209h], 1                                         ; +0x51, 0x10061bac1\njnz     short loc_10061BB37                                            ; +0x58, 0x10061bac8\nmov     rdi, [rbx+180h]                                                ; +0x5a, 0x10061baca\nmov     rax, [rdi]                                                     ; +0x61, 0x10061bad1\nxor     esi, esi                                                       ; +0x64, 0x10061bad4\ncall    qword ptr [rax+148h]                                           ; +0x66, 0x10061bad6\nmov     rdi, [rbx+188h]                                                ; +0x6c, 0x10061badc\nmov     rax, [rdi]                                                     ; +0x73, 0x10061bae3\nmov     esi, 1                                                         ; +0x76, 0x10061bae6\ncall    qword ptr [rax+148h]                                           ; +0x7b, 0x10061baeb\ncall    MusicDownloadManager__sharedState                              ; +0x81, 0x10061baf1\nmovzx   ecx, byte ptr [rax+170h]                                       ; +0x86, 0x10061baf6\ntest    cl, 1                                                          ; +0x8d, 0x10061bafd\njnz     loc_10061BBBC                                                  ; +0x90, 0x10061bb00\nshr     ecx, 1                                                         ; +0x96, 0x10061bb06\ntest    rcx, rcx                                                       ; +0x98, 0x10061bb08\njnz     loc_10061BBCC                                                  ; +0x9b, 0x10061bb0b\njmp     loc_10061BCB7                                                  ; +0xa1, 0x10061bb11\ncall    MusicDownloadManager__sharedState                              ; +0xa6, 0x10061bb16\nadd     rbx, 148h                                                      ; +0xab, 0x10061bb1b\nmov     rdi, rax                                                       ; +0xb2, 0x10061bb22\nmov     rsi, rbx                                                       ; +0xb5, 0x10061bb25\nadd     rsp, 18h                                                       ; +0xb8, 0x10061bb28\npop     rbx                                                            ; +0xbc, 0x10061bb2c\npop     r14                                                            ; +0xbd, 0x10061bb2d\npop     r15                                                            ; +0xbf, 0x10061bb2f\npop     rbp                                                            ; +0xc1, 0x10061bb31\njmp     MusicDownloadManager__showTOS                                  ; +0xc2, 0x10061bb32\ncmp     qword ptr [rbx+150h], 0                                        ; +0xc7, 0x10061bb37\njz      loc_10061BCAC                                                  ; +0xcf, 0x10061bb3f\nmov     rdi, [rbx+1C0h]                                                ; +0xd5, 0x10061bb45\nmov     rax, [rdi]                                                     ; +0xdc, 0x10061bb4c\nmov     esi, 1                                                         ; +0xdf, 0x10061bb4f\ncall    qword ptr [rax+148h]                                           ; +0xe4, 0x10061bb54\nmov     rdi, [rbx+180h]                                                ; +0xea, 0x10061bb5a\nmov     rax, [rdi]                                                     ; +0xf1, 0x10061bb61\nxor     esi, esi                                                       ; +0xf4, 0x10061bb64\ncall    qword ptr [rax+148h]                                           ; +0xf6, 0x10061bb66\nmov     rdi, [rbx+188h]                                                ; +0xfc, 0x10061bb6c\nmov     rax, [rdi]                                                     ; +0x103, 0x10061bb73\nmov     esi, 1                                                         ; +0x106, 0x10061bb76\ncall    qword ptr [rax+148h]                                           ; +0x10b, 0x10061bb7b\nmov     rdi, [rbx+1B0h]                                                ; +0x111, 0x10061bb81\nmov     rax, [rdi]                                                     ; +0x118, 0x10061bb88\nxor     esi, esi                                                       ; +0x11b, 0x10061bb8b\ncall    qword ptr [rax+148h]                                           ; +0x11d, 0x10061bb8d\ncmp     dword ptr [rbx+1F0h], 989680h                                  ; +0x123, 0x10061bb93\njl      short loc_10061BBEE                                            ; +0x12d, 0x10061bb9d\ncall    MusicDownloadManager__sharedState                              ; +0x12f, 0x10061bb9f\nmovzx   ecx, byte ptr [rax+170h]                                       ; +0x134, 0x10061bba4\ntest    cl, 1                                                          ; +0x13b, 0x10061bbab\njnz     short loc_10061BBDE                                            ; +0x13e, 0x10061bbae\nshr     ecx, 1                                                         ; +0x140, 0x10061bbb0\ntest    rcx, rcx                                                       ; +0x142, 0x10061bbb2\njnz     short loc_10061BBEE                                            ; +0x145, 0x10061bbb5\njmp     loc_10061BCB7                                                  ; +0x147, 0x10061bbb7\nmov     rcx, [rax+178h]                                                ; +0x14c, 0x10061bbbc\ntest    rcx, rcx                                                       ; +0x153, 0x10061bbc3\njz      loc_10061BCB7                                                  ; +0x156, 0x10061bbc6\nmov     rdi, rbx                                                       ; +0x15c, 0x10061bbcc\nadd     rsp, 18h                                                       ; +0x15f, 0x10061bbcf\npop     rbx                                                            ; +0x163, 0x10061bbd3\npop     r14                                                            ; +0x164, 0x10061bbd4\npop     r15                                                            ; +0x166, 0x10061bbd6\npop     rbp                                                            ; +0x168, 0x10061bbd8\njmp     CustomSongWidget__startMultiAssetDownload                      ; +0x169, 0x10061bbd9\nmov     rcx, [rax+178h]                                                ; +0x16e, 0x10061bbde\ntest    rcx, rcx                                                       ; +0x175, 0x10061bbe5\njz      loc_10061BCB7                                                  ; +0x178, 0x10061bbe8\nmov     rax, [rbx+150h]                                                ; +0x17e, 0x10061bbee\ncmp     byte ptr [rax+1F9h], 1                                         ; +0x185, 0x10061bbf5\njnz     loc_10061BCD5                                                  ; +0x18c, 0x10061bbfc\nmov     byte ptr [rbx+1EBh], 0                                         ; +0x192, 0x10061bc02\ncall    MusicDownloadManager__sharedState                              ; +0x199, 0x10061bc09\nmov     esi, [rbx+1F0h]                                                ; +0x19e, 0x10061bc0e\nmov     rdi, rax                                                       ; +0x1a4, 0x10061bc14\ncall    MusicDownloadManager__downloadSong                             ; +0x1a7, 0x10061bc17\nmov     rax, [rbx+1C0h]                                                ; +0x1ac, 0x10061bc1c\nmov     r14, [rbx+1C8h]                                                ; +0x1b3, 0x10061bc23\nmovss   xmm0, dword ptr [rax+1B0h]                                     ; +0x1ba, 0x10061bc2a\naddss   xmm0, cs:dword_100815290                                       ; +0x1c2, 0x10061bc32\nxorps   xmm1, xmm1                                                     ; +0x1ca, 0x10061bc3a\nmovaps  xmm2, xmm0                                                     ; +0x1cd, 0x10061bc3d\nmulss   xmm2, xmm1                                                     ; +0x1d0, 0x10061bc40\nminss   xmm2, xmm0                                                     ; +0x1d4, 0x10061bc44\nlea     r15, [rbp+var_28]                                              ; +0x1d8, 0x10061bc48\nmovss   xmm3, cs:dword_100815034                                       ; +0x1dc, 0x10061bc4c\nxorps   xmm0, xmm0                                                     ; +0x1e4, 0x10061bc54\nmov     rdi, r15                                                       ; +0x1e7, 0x10061bc57\ncall    sub_10028CC00                                                  ; +0x1ea, 0x10061bc5a\nmov     rax, [r14]                                                     ; +0x1ef, 0x10061bc5f\nmov     rdi, r14                                                       ; +0x1f2, 0x10061bc62\nmov     rsi, r15                                                       ; +0x1f5, 0x10061bc65\ncall    qword ptr [rax+460h]                                           ; +0x1f8, 0x10061bc68\nmov     rdi, [rbx+1C0h]                                                ; +0x1fe, 0x10061bc6e\nmov     rax, [rdi]                                                     ; +0x205, 0x10061bc75\nmov     esi, 1                                                         ; +0x208, 0x10061bc78\ncall    qword ptr [rax+148h]                                           ; +0x20d, 0x10061bc7d\nlea     r14, CustomSongWidget__updateDownloadProgress                  ; +0x213, 0x10061bc83\nmov     rdi, rbx                                                       ; +0x21a, 0x10061bc8a\nmov     rsi, r14                                                       ; +0x21d, 0x10061bc8d\nxor     edx, edx                                                       ; +0x220, 0x10061bc90\ncall    cocos2d__CCNode__unschedule                                    ; +0x222, 0x10061bc92\nmovss   xmm0, cs:dword_10081646C                                       ; +0x227, 0x10061bc97\nmov     rdi, rbx                                                       ; +0x22f, 0x10061bc9f\nmov     rsi, r14                                                       ; +0x232, 0x10061bca2\nxor     edx, edx                                                       ; +0x235, 0x10061bca5\ncall    cocos2d__CCNode__schedule_1                                    ; +0x237, 0x10061bca7\nadd     rsp, 18h                                                       ; +0x23c, 0x10061bcac\npop     rbx                                                            ; +0x240, 0x10061bcb0\npop     r14                                                            ; +0x241, 0x10061bcb1\npop     r15                                                            ; +0x243, 0x10061bcb3\npop     rbp                                                            ; +0x245, 0x10061bcb5\nretn                                                                   ; +0x246, 0x10061bcb6\nmov     byte ptr [rbx+208h], 1                                         ; +0x247, 0x10061bcb7\ncall    MusicDownloadManager__sharedState                              ; +0x24e, 0x10061bcbe\nmov     rdi, rax                                                       ; +0x253, 0x10061bcc3\nadd     rsp, 18h                                                       ; +0x256, 0x10061bcc6\npop     rbx                                                            ; +0x25a, 0x10061bcca\npop     r14                                                            ; +0x25b, 0x10061bccb\npop     r15                                                            ; +0x25d, 0x10061bccd\npop     rbp                                                            ; +0x25f, 0x10061bccf\njmp     MusicDownloadManager__getCustomContentURL                      ; +0x260, 0x10061bcd0\nmov     byte ptr [rbx+1EBh], 1                                         ; +0x265, 0x10061bcd5\ncall    MusicDownloadManager__sharedState                              ; +0x26c, 0x10061bcdc\nmov     esi, [rbx+1F0h]                                                ; +0x271, 0x10061bce1\nmov     rdi, rax                                                       ; +0x277, 0x10061bce7\nmov     edx, 1                                                         ; +0x27a, 0x10061bcea\nadd     rsp, 18h                                                       ; +0x27f, 0x10061bcef\npop     rbx                                                            ; +0x283, 0x10061bcf3\npop     r14                                                            ; +0x284, 0x10061bcf4\npop     r15                                                            ; +0x286, 0x10061bcf6\npop     rbp                                                            ; +0x288, 0x10061bcf8\njmp     MusicDownloadManager__getSongInfo                              ; +0x289, 0x10061bcf9", "xrefs": ["CustomSongWidget::musicActionFinished @ 0x10062133a", "sub_100621350 @ 0x100621371", "CustomSongWidget::FLAlert_Clicked @ 0x100621465", "sub_100621480 @ 0x1006214cc", "CustomSongWidget::init @ 0x10061ac25"], "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"}