{"type": "func", "start": 5135180, "end": 5135468, "name": "CustomSongWidget::onDownload", "pseudocode": "// \n// CustomSongWidget::onDownload from 0x4e5b4c to 0x4e5c6c (288 bytes)\n// \n// 2 xrefs:\n// > CustomSongWidget::musicActionFinished @ 0x4e5c84\n// > CustomSongWidget::FLAlert_Clicked @ 0x4e5cc6\n// \n// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\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:51:05 +0000\n// \n\nMusicDownloadManager *__fastcall CustomSongWidget::onDownload(\n        CustomSongWidget *this,\n        cocos2d::CCObject *a2,\n        int a3,\n        int a4)\n{\n  GameManager *v5; // r0\n  GameManager *v6; // r0\n  MusicDownloadManager *result; // r0\n  MusicDownloadManager *v8; // r0\n  int v9; // r5\n  MusicDownloadManager *v10; // r0\n  int v11; // r0\n  int v12; // r2\n  int v13; // r3\n  int v14; // r1\n  int v15; // r3\n  int v16; // r3\n  MusicDownloadManager *v18; // r0\n  MusicDownloadManager *v19; // r0\n\n  (*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 73) + 172))(*((_DWORD *)this + 73), 0);\n  v5 = *((GameManager **)this + 86);\n  if ( v5 )\n    v5 = (GameManager *)(*(int (__fastcall **)(GameManager *, _DWORD))(*(_DWORD *)v5 + 172))(v5, 0);\n  v6 = (GameManager *)GameManager::sharedState(v5);\n  result = (MusicDownloadManager *)GameManager::getGameVariable(v6, \"0016\");\n  if ( !result )\n  {\n    v8 = (MusicDownloadManager *)MusicDownloadManager::sharedState(nullptr);\n    return (MusicDownloadManager *)MusicDownloadManager::showTOS(v8, (CustomSongWidget *)((char *)this + 268));\n  }\n  v9 = *((unsigned __int8 *)this + 377);\n  if ( *((_BYTE *)this + 377) )\n  {\n    (*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 74) + 172))(*((_DWORD *)this + 74), 0);\n    v10 = (MusicDownloadManager *)(*(int (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 75) + 172))(\n                                    *((_DWORD *)this + 75),\n                                    1);\n    v11 = MusicDownloadManager::sharedState(v10);\n    v13 = *(unsigned __int8 *)(v11 + 288);\n    v14 = v13 << 31;\n    if ( (v13 & 1) != 0 )\n      v15 = *(_DWORD *)(v11 + 292);\n    else\n      v15 = v13 >> 1;\n    if ( v15 )\n      return CustomSongWidget::startMultiAssetDownload(this, v14, v12, a4);\nLABEL_17:\n    *((_BYTE *)this + 376) = 1;\n    v18 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)v11);\n    return (MusicDownloadManager *)MusicDownloadManager::getCustomContentURL(v18);\n  }\n  if ( !*((_DWORD *)this + 68) )\n    return result;\n  (*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 83) + 172))(*((_DWORD *)this + 83), 1);\n  (*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 74) + 172))(*((_DWORD *)this + 74), v9);\n  (*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 75) + 172))(*((_DWORD *)this + 75), 1);\n  v11 = (*(int (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 80) + 172))(*((_DWORD *)this + 80), v9);\n  if ( *((int *)this + 90) > 9999999 )\n  {\n    v11 = MusicDownloadManager::sharedState((MusicDownloadManager *)v11);\n    v16 = *(unsigned __int8 *)(v11 + 288);\n    if ( !((v16 & 1) != 0 ? *(_DWORD *)(v11 + 292) : v16 >> 1) )\n      goto LABEL_17;\n  }\n  if ( *(_BYTE *)(*((_DWORD *)this + 68) + 329) )\n    return (MusicDownloadManager *)CustomSongWidget::startDownload(this);\n  *((_BYTE *)this + 355) = 1;\n  v19 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)v11);\n  return (MusicDownloadManager *)MusicDownloadManager::getSongInfo(v19, *((_DWORD *)this + 90), 1);\n}", "assembly": "; \n; CustomSongWidget::onDownload from 0x4e5b4c to 0x4e5c6c (288 bytes)\n; \n; 2 xrefs:\n; > CustomSongWidget::musicActionFinished @ 0x4e5c84\n; > CustomSongWidget::FLAlert_Clicked @ 0x4e5cc6\n; \n; This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\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:51:05 +0000\n; \nPUSH            {R3-R5,LR}                                             ; +0x0, 0x4e5b4c\nMOV             R4, R0                                                 ; +0x2, 0x4e5b4e\nLDR.W           R0, [R0,#0x124]                                        ; +0x4, 0x4e5b50\nMOVS            R1, #0                                                 ; +0x8, 0x4e5b54\nLDR             R3, [R0]                                               ; +0xa, 0x4e5b56\nLDR.W           R3, [R3,#0xAC]                                         ; +0xc, 0x4e5b58\nBLX             R3                                                     ; +0x10, 0x4e5b5c\nLDR.W           R0, [R4,#0x158]                                        ; +0x12, 0x4e5b5e\nCBZ             R0, loc_4E5B6E                                         ; +0x16, 0x4e5b62\nLDR             R3, [R0]                                               ; +0x18, 0x4e5b64\nMOVS            R1, #0                                                 ; +0x1a, 0x4e5b66\nLDR.W           R3, [R3,#0xAC]                                         ; +0x1c, 0x4e5b68\nBLX             R3                                                     ; +0x20, 0x4e5b6c\nBL              _ZN11GameManager11sharedStateEv; GameManager::sharedState(void) ; +0x22, 0x4e5b6e\nLDR             R1, =(a0016 - 0x4E5B78); \"0016\"                        ; +0x26, 0x4e5b72\nADD             R1, PC; \"0016\"                                         ; +0x28, 0x4e5b74\nBL              _ZN11GameManager15getGameVariableEPKc; GameManager::getGameVariable(char const*) ; +0x2a, 0x4e5b76\nCBNZ            R0, loc_4E5B8C                                         ; +0x2e, 0x4e5b7a\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0x30, 0x4e5b7c\nADD.W           R1, R4, #0x10C; FLAlertLayerProtocol *                 ; +0x34, 0x4e5b80\nPOP.W           {R3-R5,LR}                                             ; +0x38, 0x4e5b84\nB.W             _ZN20MusicDownloadManager7showTOSEP20FLAlertLayerProtocol; MusicDownloadManager::showTOS(FLAlertLayerProtocol *) ; +0x3c, 0x4e5b88\nLDRB.W          R5, [R4,#0x179]                                        ; +0x40, 0x4e5b8c\nCBZ             R5, loc_4E5BCE                                         ; +0x44, 0x4e5b90\nLDR.W           R0, [R4,#0x128]                                        ; +0x46, 0x4e5b92\nMOVS            R1, #0                                                 ; +0x4a, 0x4e5b96\nLDR             R3, [R0]                                               ; +0x4c, 0x4e5b98\nLDR.W           R3, [R3,#0xAC]                                         ; +0x4e, 0x4e5b9a\nBLX             R3                                                     ; +0x52, 0x4e5b9e\nLDR.W           R0, [R4,#0x12C]                                        ; +0x54, 0x4e5ba0\nMOVS            R1, #1                                                 ; +0x58, 0x4e5ba4\nLDR             R3, [R0]                                               ; +0x5a, 0x4e5ba6\nLDR.W           R3, [R3,#0xAC]                                         ; +0x5c, 0x4e5ba8\nBLX             R3                                                     ; +0x60, 0x4e5bac\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0x62, 0x4e5bae\nLDRB.W          R3, [R0,#0x120]                                        ; +0x66, 0x4e5bb2\nLSLS            R1, R3, #0x1F                                          ; +0x6a, 0x4e5bb6\nITE PL                                                                 ; +0x6c, 0x4e5bb8\nASRPL           R3, R3, #1                                             ; +0x6e, 0x4e5bba\nLDRMI.W         R3, [R0,#0x124]                                        ; +0x70, 0x4e5bbc\nCMP             R3, #0                                                 ; +0x74, 0x4e5bc0\nBEQ             loc_4E5C2C                                             ; +0x76, 0x4e5bc2\nMOV             R0, R4; this                                           ; +0x78, 0x4e5bc4\nPOP.W           {R3-R5,LR}                                             ; +0x7a, 0x4e5bc6\nB.W             _ZN16CustomSongWidget23startMultiAssetDownloadEv; CustomSongWidget::startMultiAssetDownload(void) ; +0x7e, 0x4e5bca\nLDR.W           R3, [R4,#0x110]                                        ; +0x82, 0x4e5bce\nCMP             R3, #0                                                 ; +0x86, 0x4e5bd2\nBEQ             locret_4E5C6A                                          ; +0x88, 0x4e5bd4\nLDR.W           R0, [R4,#0x14C]                                        ; +0x8a, 0x4e5bd6\nMOVS            R1, #1                                                 ; +0x8e, 0x4e5bda\nLDR             R3, [R0]                                               ; +0x90, 0x4e5bdc\nLDR.W           R3, [R3,#0xAC]                                         ; +0x92, 0x4e5bde\nBLX             R3                                                     ; +0x96, 0x4e5be2\nLDR.W           R0, [R4,#0x128]                                        ; +0x98, 0x4e5be4\nMOV             R1, R5                                                 ; +0x9c, 0x4e5be8\nLDR             R3, [R0]                                               ; +0x9e, 0x4e5bea\nLDR.W           R3, [R3,#0xAC]                                         ; +0xa0, 0x4e5bec\nBLX             R3                                                     ; +0xa4, 0x4e5bf0\nLDR.W           R0, [R4,#0x12C]                                        ; +0xa6, 0x4e5bf2\nMOVS            R1, #1                                                 ; +0xaa, 0x4e5bf6\nLDR             R3, [R0]                                               ; +0xac, 0x4e5bf8\nLDR.W           R3, [R3,#0xAC]                                         ; +0xae, 0x4e5bfa\nBLX             R3                                                     ; +0xb2, 0x4e5bfe\nLDR.W           R0, [R4,#0x140]                                        ; +0xb4, 0x4e5c00\nMOV             R1, R5                                                 ; +0xb8, 0x4e5c04\nLDR             R3, [R0]                                               ; +0xba, 0x4e5c06\nLDR.W           R3, [R3,#0xAC]                                         ; +0xbc, 0x4e5c08\nBLX             R3                                                     ; +0xc0, 0x4e5c0c\nLDR.W           R2, [R4,#0x168]                                        ; +0xc2, 0x4e5c0e\nLDR             R3, =0x98967F                                          ; +0xc6, 0x4e5c12\nCMP             R2, R3                                                 ; +0xc8, 0x4e5c14\nBLE             loc_4E5C3E                                             ; +0xca, 0x4e5c16\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0xcc, 0x4e5c18\nLDRB.W          R3, [R0,#0x120]                                        ; +0xd0, 0x4e5c1c\nLSLS            R2, R3, #0x1F                                          ; +0xd4, 0x4e5c20\nITE PL                                                                 ; +0xd6, 0x4e5c22\nASRPL           R3, R3, #1                                             ; +0xd8, 0x4e5c24\nLDRMI.W         R3, [R0,#0x124]                                        ; +0xda, 0x4e5c26\nCBNZ            R3, loc_4E5C3E                                         ; +0xde, 0x4e5c2a\nMOVS            R3, #1                                                 ; +0xe0, 0x4e5c2c\nSTRB.W          R3, [R4,#0x178]                                        ; +0xe2, 0x4e5c2e\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0xe6, 0x4e5c32\nPOP.W           {R3-R5,LR}                                             ; +0xea, 0x4e5c36\nB.W             _ZN20MusicDownloadManager19getCustomContentURLEv; MusicDownloadManager::getCustomContentURL(void) ; +0xee, 0x4e5c3a\nLDR.W           R3, [R4,#0x110]                                        ; +0xf2, 0x4e5c3e\nLDRB.W          R3, [R3,#0x149]                                        ; +0xf6, 0x4e5c42\nCBZ             R3, loc_4E5C52                                         ; +0xfa, 0x4e5c46\nMOV             R0, R4; this                                           ; +0xfc, 0x4e5c48\nPOP.W           {R3-R5,LR}                                             ; +0xfe, 0x4e5c4a\nB.W             _ZN16CustomSongWidget13startDownloadEv; CustomSongWidget::startDownload(void) ; +0x102, 0x4e5c4e\nMOVS            R5, #1                                                 ; +0x106, 0x4e5c52\nSTRB.W          R5, [R4,#0x163]                                        ; +0x108, 0x4e5c54\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0x10c, 0x4e5c58\nLDR.W           R1, [R4,#0x168]; int                                   ; +0x110, 0x4e5c5c\nMOV             R2, R5; bool                                           ; +0x114, 0x4e5c60\nPOP.W           {R3-R5,LR}                                             ; +0x116, 0x4e5c62\nB.W             _ZN20MusicDownloadManager11getSongInfoEib; MusicDownloadManager::getSongInfo(int,bool) ; +0x11a, 0x4e5c66\nPOP             {R3-R5,PC}                                             ; +0x11e, 0x4e5c6a", "xrefs": ["CustomSongWidget::musicActionFinished @ 0x4e5c84", "CustomSongWidget::FLAlert_Clicked @ 0x4e5cc6"], "is_objc": false, "is_32_bit": true, "is_64_bit": false, "idp_name": "arm", "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"}