{"type": "func", "start": 4301373200, "end": 4301373758, "name": "CustomSongWidget::onPlayback", "pseudocode": "// \n// CustomSongWidget::onPlayback from 0x10061bf10 to 0x10061c13e (558 bytes)\n// \n// 1 xrefs:\n// > CustomSongWidget::init @ 0x10061ae28\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::onPlayback(CustomSongWidget *a1, cocos2d::CCObject *a2)\n{\n  double v2; // xmm0_8\n  SongInfoObject *m_songInfoObject; // rsi\n  SongPlaybackDelegate *m_playbackDelegate; // rdi\n  MusicDownloadManager *v6; // rax\n  FMODAudioEngine *v7; // rax\n  FMODAudioEngine *v8; // r14\n  bool isMusicPlaying; // r14\n  FMODAudioEngine *v10; // rax\n  FMODAudioEngine *v11; // rax\n  FMODAudioEngine *v12; // rax\n  FMODAudioEngine *v13; // r14\n  MusicDownloadManager *v14; // rax\n  const char *data; // rbx\n  size_t v16; // rax\n  size_t v17; // r15\n  char *v18; // r12\n  size_t v19; // r13\n  MusicDownloadManager *v20; // rax\n  std::string v21; // [rsp+8h] [rbp-88h] BYREF\n  __int128 v22; // [rsp+20h] [rbp-70h] BYREF\n  void *__p; // [rsp+30h] [rbp-60h]\n  std::string v24; // [rsp+38h] [rbp-58h] BYREF\n  __int128 __dst; // [rsp+50h] [rbp-40h] BYREF\n  void *v26; // [rsp+60h] [rbp-30h]\n\n  m_songInfoObject = a1->m_songInfoObject;\n  m_playbackDelegate = a1->m_playbackDelegate;\n  if ( m_playbackDelegate )\n  {\n    ((void (__fastcall *)(SongPlaybackDelegate *, SongInfoObject *))m_playbackDelegate->onPlayback)(\n      m_playbackDelegate,\n      m_songInfoObject);\n    return;\n  }\n  if ( m_songInfoObject )\n  {\n    v6 = MusicDownloadManager::sharedState();\n    MusicDownloadManager::pathForSong(&v24, v2, (__int64)v6, a1->m_songInfoObject->m_songID);\n    v7 = FMODAudioEngine::sharedEngine();\n    if ( FMODAudioEngine::isMusicPlaying_1(v7, 0) )\n    {\n      v8 = FMODAudioEngine::sharedEngine();\n      if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) != 0 )\n      {\n        sub_100006B70(&v22, v24.__r_.__value_.__l.__data_, v24.__r_.__value_.__l.__size_, v2);\n      }\n      else\n      {\n        __p = v24.__r_.__value_.__l.__data_;\n        v2 = *(double *)v24.__r_.__value_.__r.__words;\n        v22 = *(_OWORD *)&v24.__r_.__value_.__l.0;\n      }\n      isMusicPlaying = FMODAudioEngine::isMusicPlaying(v8, (unsigned __int8 *)&v22, 0);\n      if ( (v22 & 1) != 0 )\n        operator delete(__p);\n      if ( !isMusicPlaying )\n      {\n        v10 = FMODAudioEngine::sharedEngine();\n        FMODAudioEngine::stopAllMusic(v10, 1);\n      }\n    }\n    v11 = FMODAudioEngine::sharedEngine();\n    if ( FMODAudioEngine::isMusicPlaying_1(v11, 0) )\n    {\n      v12 = FMODAudioEngine::sharedEngine();\n      FMODAudioEngine::stopAllMusic(v12, 1);\n      goto LABEL_30;\n    }\n    if ( !a1->m_songInfoObject )\n    {\nLABEL_30:\n      v20 = MusicDownloadManager::sharedState();\n      MusicDownloadManager::songStateChanged(v20);\n      if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) != 0 )\n        operator delete(v24.__r_.__value_.__l.__data_);\n      return;\n    }\n    v13 = FMODAudioEngine::sharedEngine();\n    v14 = MusicDownloadManager::sharedState();\n    MusicDownloadManager::pathForSong(&v21, v2, (__int64)v14, a1->m_songInfoObject->m_songID);\n    if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )\n      data = v21.__r_.__value_.__l.__data_;\n    else\n      data = v21.__r_.__value_.__s.__data_;\n    v16 = strlen(data);\n    if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )\n      sub_100006BF0(v2);\n    v17 = v16;\n    if ( v16 >= 0x17 )\n    {\n      v19 = 26;\n      if ( (v16 | 7) != 0x17 )\n        v19 = (v16 | 7) + 1;\n      v18 = (char *)operator new(v19);\n      v26 = v18;\n      *(_QWORD *)&__dst = v19 | 1;\n      *((_QWORD *)&__dst + 1) = v17;\n    }\n    else\n    {\n      LOBYTE(__dst) = 2 * v16;\n      v18 = (char *)&__dst + 1;\n      if ( !v16 )\n        goto LABEL_26;\n    }\n    memmove(v18, data, v17);\nLABEL_26:\n    v18[v17] = 0;\n    FMODAudioEngine::playMusic((__int64)v13, &__dst, 0, 0, 0.0);\n    if ( (__dst & 1) != 0 )\n      operator delete(v26);\n    if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )\n      operator delete(v21.__r_.__value_.__l.__data_);\n    goto LABEL_30;\n  }\n}", "assembly": "; \n; CustomSongWidget::onPlayback from 0x10061bf10 to 0x10061c13e (558 bytes)\n; \n; 1 xrefs:\n; > CustomSongWidget::init @ 0x10061ae28\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, 0x10061bf10\nmov     rbp, rsp                                                       ; +0x1, 0x10061bf11\npush    r15                                                            ; +0x4, 0x10061bf14\npush    r14                                                            ; +0x6, 0x10061bf16\npush    r13                                                            ; +0x8, 0x10061bf18\npush    r12                                                            ; +0xa, 0x10061bf1a\npush    rbx                                                            ; +0xc, 0x10061bf1c\nsub     rsp, 68h                                                       ; +0xd, 0x10061bf1d\nmov     rbx, rdi                                                       ; +0x11, 0x10061bf21\nmov     rsi, [rdi+150h]                                                ; +0x14, 0x10061bf24\nmov     rdi, [rdi+200h]                                                ; +0x1b, 0x10061bf2b\ntest    rdi, rdi                                                       ; +0x22, 0x10061bf32\njz      short loc_10061BF4D                                            ; +0x25, 0x10061bf35\nmov     rax, [rdi]                                                     ; +0x27, 0x10061bf37\nmov     rax, [rax]                                                     ; +0x2a, 0x10061bf3a\nadd     rsp, 68h                                                       ; +0x2d, 0x10061bf3d\npop     rbx                                                            ; +0x31, 0x10061bf41\npop     r12                                                            ; +0x32, 0x10061bf42\npop     r13                                                            ; +0x34, 0x10061bf44\npop     r14                                                            ; +0x36, 0x10061bf46\npop     r15                                                            ; +0x38, 0x10061bf48\npop     rbp                                                            ; +0x3a, 0x10061bf4a\njmp     rax                                                            ; +0x3b, 0x10061bf4b\ntest    rsi, rsi                                                       ; +0x3d, 0x10061bf4d\njz      loc_10061C12A                                                  ; +0x40, 0x10061bf50\ncall    MusicDownloadManager__sharedState                              ; +0x46, 0x10061bf56\nmov     rcx, [rbx+150h]                                                ; +0x4b, 0x10061bf5b\nmov     edx, [rcx+13Ch]                                                ; +0x52, 0x10061bf62\nlea     rdi, [rbp+var_58]; this                                        ; +0x58, 0x10061bf68\nmov     rsi, rax                                                       ; +0x5c, 0x10061bf6c\ncall    MusicDownloadManager__pathForSong                              ; +0x5f, 0x10061bf6f\ncall    FMODAudioEngine__sharedEngine                                  ; +0x64, 0x10061bf74\nmov     rdi, rax                                                       ; +0x69, 0x10061bf79\nxor     esi, esi                                                       ; +0x6c, 0x10061bf7c\ncall    FMODAudioEngine__isMusicPlaying_1                              ; +0x6e, 0x10061bf7e\ntest    al, al                                                         ; +0x73, 0x10061bf83\njz      short loc_10061BFEF                                            ; +0x75, 0x10061bf85\ncall    FMODAudioEngine__sharedEngine                                  ; +0x77, 0x10061bf87\nmov     r14, rax                                                       ; +0x7c, 0x10061bf8c\ntest    byte ptr [rbp+var_58.__r_.__value_], 1                         ; +0x7f, 0x10061bf8f\njnz     short loc_10061BFA7                                            ; +0x83, 0x10061bf93\nmov     rax, qword ptr [rbp+var_58.__r_.__value_+10h]                  ; +0x85, 0x10061bf95\nmov     [rbp+__p], rax                                                 ; +0x89, 0x10061bf99\nmovups  xmm0, xmmword ptr [rbp+var_58.__r_.__value_]                   ; +0x8d, 0x10061bf9d\nmovaps  [rbp+var_70], xmm0                                             ; +0x91, 0x10061bfa1\njmp     short loc_10061BFB8                                            ; +0x95, 0x10061bfa5\nmov     rdx, qword ptr [rbp+var_58.__r_.__value_+8]                    ; +0x97, 0x10061bfa7\nmov     rsi, qword ptr [rbp+var_58.__r_.__value_+10h]                  ; +0x9b, 0x10061bfab\nlea     rdi, [rbp+var_70]                                              ; +0x9f, 0x10061bfaf\ncall    sub_100006B70                                                  ; +0xa3, 0x10061bfb3\nlea     rsi, [rbp+var_70]                                              ; +0xa8, 0x10061bfb8\nmov     rdi, r14                                                       ; +0xac, 0x10061bfbc\nxor     edx, edx                                                       ; +0xaf, 0x10061bfbf\ncall    FMODAudioEngine__isMusicPlaying                                ; +0xb1, 0x10061bfc1\nmov     r14d, eax                                                      ; +0xb6, 0x10061bfc6\ntest    byte ptr [rbp+var_70], 1                                       ; +0xb9, 0x10061bfc9\njz      short loc_10061BFD8                                            ; +0xbd, 0x10061bfcd\nmov     rdi, [rbp+__p]; __p                                            ; +0xbf, 0x10061bfcf\ncall    __ZdlPv; operator delete(void *)                               ; +0xc3, 0x10061bfd3\ntest    r14b, r14b                                                     ; +0xc8, 0x10061bfd8\njnz     short loc_10061BFEF                                            ; +0xcb, 0x10061bfdb\ncall    FMODAudioEngine__sharedEngine                                  ; +0xcd, 0x10061bfdd\nmov     rdi, rax                                                       ; +0xd2, 0x10061bfe2\nmov     esi, 1                                                         ; +0xd5, 0x10061bfe5\ncall    FMODAudioEngine__stopAllMusic                                  ; +0xda, 0x10061bfea\ncall    FMODAudioEngine__sharedEngine                                  ; +0xdf, 0x10061bfef\nmov     rdi, rax                                                       ; +0xe4, 0x10061bff4\nxor     esi, esi                                                       ; +0xe7, 0x10061bff7\ncall    FMODAudioEngine__isMusicPlaying_1                              ; +0xe9, 0x10061bff9\ntest    al, al                                                         ; +0xee, 0x10061bffe\njz      short loc_10061C019                                            ; +0xf0, 0x10061c000\ncall    FMODAudioEngine__sharedEngine                                  ; +0xf2, 0x10061c002\nmov     rdi, rax                                                       ; +0xf7, 0x10061c007\nmov     esi, 1                                                         ; +0xfa, 0x10061c00a\ncall    FMODAudioEngine__stopAllMusic                                  ; +0xff, 0x10061c00f\njmp     loc_10061C10E                                                  ; +0x104, 0x10061c014\ncmp     qword ptr [rbx+150h], 0                                        ; +0x109, 0x10061c019\njz      loc_10061C10E                                                  ; +0x111, 0x10061c021\ncall    FMODAudioEngine__sharedEngine                                  ; +0x117, 0x10061c027\nmov     r14, rax                                                       ; +0x11c, 0x10061c02c\ncall    MusicDownloadManager__sharedState                              ; +0x11f, 0x10061c02f\nmov     rcx, [rbx+150h]                                                ; +0x124, 0x10061c034\nmov     edx, [rcx+13Ch]                                                ; +0x12b, 0x10061c03b\nlea     rdi, [rbp+var_88]; this                                        ; +0x131, 0x10061c041\nmov     rsi, rax                                                       ; +0x138, 0x10061c048\ncall    MusicDownloadManager__pathForSong                              ; +0x13b, 0x10061c04b\ntest    byte ptr [rbp+var_88.__r_.__value_], 1                         ; +0x140, 0x10061c050\njz      short loc_10061C05F                                            ; +0x147, 0x10061c057\nmov     rbx, qword ptr [rbp+var_88.__r_.__value_+10h]                  ; +0x149, 0x10061c059\njmp     short loc_10061C066                                            ; +0x14d, 0x10061c05d\nlea     rbx, [rbp+var_88.__r_.__value_+1]                              ; +0x14f, 0x10061c05f\nmov     rdi, rbx; __s                                                  ; +0x156, 0x10061c066\ncall    _strlen                                                        ; +0x159, 0x10061c069\ncmp     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x15e, 0x10061c06e\njnb     loc_10061C139                                                  ; +0x162, 0x10061c072\nmov     r15, rax                                                       ; +0x168, 0x10061c078\ncmp     rax, 17h                                                       ; +0x16b, 0x10061c07b\njnb     short loc_10061C093                                            ; +0x16f, 0x10061c07f\nlea     eax, [r15+r15]                                                 ; +0x171, 0x10061c081\nmov     byte ptr [rbp+__dst], al                                       ; +0x175, 0x10061c085\nlea     r12, [rbp+__dst+1]                                             ; +0x178, 0x10061c088\ntest    r15, r15                                                       ; +0x17c, 0x10061c08c\njnz     short loc_10061C0C7                                            ; +0x17f, 0x10061c08f\njmp     short loc_10061C0D5                                            ; +0x181, 0x10061c091\nmov     rax, r15                                                       ; +0x183, 0x10061c093\nor      rax, 7                                                         ; +0x186, 0x10061c096\nlea     rcx, [rax+1]                                                   ; +0x18a, 0x10061c09a\ncmp     rax, 17h                                                       ; +0x18e, 0x10061c09e\nmov     r13d, 1Ah                                                      ; +0x192, 0x10061c0a2\ncmovnz  r13, rcx                                                       ; +0x198, 0x10061c0a8\nmov     rdi, r13; __sz                                                 ; +0x19c, 0x10061c0ac\ncall    __Znwm; operator new(ulong)                                    ; +0x19f, 0x10061c0af\nmov     r12, rax                                                       ; +0x1a4, 0x10061c0b4\nmov     [rbp+var_30], rax                                              ; +0x1a7, 0x10061c0b7\nor      r13, 1                                                         ; +0x1ab, 0x10061c0bb\nmov     [rbp+__dst], r13                                               ; +0x1af, 0x10061c0bf\nmov     [rbp+var_38], r15                                              ; +0x1b3, 0x10061c0c3\nmov     rdi, r12; __dst                                                ; +0x1b7, 0x10061c0c7\nmov     rsi, rbx; __src                                                ; +0x1ba, 0x10061c0ca\nmov     rdx, r15; __len                                                ; +0x1bd, 0x10061c0cd\ncall    _memmove                                                       ; +0x1c0, 0x10061c0d0\nmov     byte ptr [r12+r15], 0                                          ; +0x1c5, 0x10061c0d5\nlea     rsi, [rbp+__dst]                                               ; +0x1ca, 0x10061c0da\nxorps   xmm0, xmm0                                                     ; +0x1ce, 0x10061c0de\nmov     rdi, r14                                                       ; +0x1d1, 0x10061c0e1\nxor     edx, edx                                                       ; +0x1d4, 0x10061c0e4\nxor     ecx, ecx                                                       ; +0x1d6, 0x10061c0e6\ncall    FMODAudioEngine__playMusic                                     ; +0x1d8, 0x10061c0e8\ntest    byte ptr [rbp+__dst], 1                                        ; +0x1dd, 0x10061c0ed\njz      short loc_10061C0FC                                            ; +0x1e1, 0x10061c0f1\nmov     rdi, [rbp+var_30]; __p                                         ; +0x1e3, 0x10061c0f3\ncall    __ZdlPv; operator delete(void *)                               ; +0x1e7, 0x10061c0f7\ntest    byte ptr [rbp+var_88.__r_.__value_], 1                         ; +0x1ec, 0x10061c0fc\njz      short loc_10061C10E                                            ; +0x1f3, 0x10061c103\nmov     rdi, qword ptr [rbp+var_88.__r_.__value_+10h]; __p             ; +0x1f5, 0x10061c105\ncall    __ZdlPv; operator delete(void *)                               ; +0x1f9, 0x10061c109\ncall    MusicDownloadManager__sharedState                              ; +0x1fe, 0x10061c10e\nmov     rdi, rax                                                       ; +0x203, 0x10061c113\ncall    MusicDownloadManager__songStateChanged                         ; +0x206, 0x10061c116\ntest    byte ptr [rbp+var_58.__r_.__value_], 1                         ; +0x20b, 0x10061c11b\njz      short loc_10061C12A                                            ; +0x20f, 0x10061c11f\nmov     rdi, qword ptr [rbp+var_58.__r_.__value_+10h]; __p             ; +0x211, 0x10061c121\ncall    __ZdlPv; operator delete(void *)                               ; +0x215, 0x10061c125\nadd     rsp, 68h                                                       ; +0x21a, 0x10061c12a\npop     rbx                                                            ; +0x21e, 0x10061c12e\npop     r12                                                            ; +0x21f, 0x10061c12f\npop     r13                                                            ; +0x221, 0x10061c131\npop     r14                                                            ; +0x223, 0x10061c133\npop     r15                                                            ; +0x225, 0x10061c135\npop     rbp                                                            ; +0x227, 0x10061c137\nretn                                                                   ; +0x228, 0x10061c138\ncall    sub_100006BF0                                                  ; +0x229, 0x10061c139", "xrefs": ["CustomSongWidget::init @ 0x10061ae28"], "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"}