{"type": "func", "start": 4299036768, "end": 4299037215, "name": "FMODAudioEngine::getActiveMusicChannel", "pseudocode": "// \n// FMODAudioEngine::getActiveMusicChannel from 0x1003e1860 to 0x1003e1a1f (447 bytes)\n// \n// 14 xrefs:\n// > PlayLayer::showCompleteEffect @ 0x1000b45a3\n// > GJBaseGameLayer::processSongState @ 0x1001622dd\n// > FMODAudioEngine::resumeMusic @ 0x1003e1844\n// > FMODAudioEngine::isMusicPlaying_1 @ 0x1003e6a1c\n// > FMODAudioEngine::isMusicPlaying @ 0x1003e6bc9\n// > FMODAudioEngine::loadAndPlayMusic @ 0x1003e6eb8\n// > FMODAudioEngine::playMusic @ 0x1003e6f9f\n// > FMODAudioEngine::playMusic @ 0x1003e7061\n// > FMODAudioEngine::playMusic @ 0x1003e708e\n// > FMODAudioEngine::fadeInMusic @ 0x1003e70d3\n// > FMODAudioEngine::isPersistentMatchPlaying @ 0x1003e7253\n// > FMODAudioEngine::pauseMusic @ 0x1003e9ed4\n// > FMODAudioEngine::fadeOutMusic @ 0x1003e9f03\n// > FMODAudioEngine::fadeMusic @ 0x1003e9fed\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\nFMOD::Channel *__fastcall FMODAudioEngine::getActiveMusicChannel(FMODAudioEngine *a1, int a2)\n{\n  unsigned __int64 value; // rcx\n  std::unordered_map<int, FMODMusic> *p_m_fmodMusic; // r11\n  unsigned __int64 v4; // r10\n  unsigned __int64 v5; // r9\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMODMusic>, void *> *> *v6; // rax\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMODMusic>, void *> *>::__next_pointer next; // rbx\n  unsigned __int64 v8; // rcx\n  FMOD::Channel *v9; // r10\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMODMusic>, void *> *>::__next_pointer v10; // rax\n  unsigned __int64 v11; // rax\n  __int64 v12; // rax\n  int *v14; // [rsp+8h] [rbp-18h] BYREF\n  int v15; // [rsp+10h] [rbp-10h] BYREF\n  char v16[9]; // [rsp+17h] [rbp-9h] BYREF\n\n  v15 = a2;\n  value = a1->m_fmodMusic.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;\n  if ( !value )\n    return nullptr;\n  p_m_fmodMusic = &a1->m_fmodMusic;\n  v4 = (0x101010101010101LL\n      * ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)\n        + (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)\n        + ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)\n          + (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))\n       & 0xF0F0F0F0F0F0F0FLL)) >> 56;\n  if ( v4 <= 1 )\n  {\n    v5 = a2 & (value - 1);\n    v6 = p_m_fmodMusic->__table_.__bucket_list_.__ptr_.__value_[v5];\n    if ( !v6 )\n      return nullptr;\n    goto LABEL_9;\n  }\n  v5 = a2;\n  if ( value <= a2 )\n  {\n    if ( !((value | a2) >> 32) )\n    {\n      v5 = a2 % (unsigned int)value;\n      v6 = p_m_fmodMusic->__table_.__bucket_list_.__ptr_.__value_[v5];\n      if ( !v6 )\n        return nullptr;\n      goto LABEL_9;\n    }\n    v5 = a2 % value;\n  }\n  v6 = p_m_fmodMusic->__table_.__bucket_list_.__ptr_.__value_[v5];\n  if ( !v6 )\n    return nullptr;\nLABEL_9:\n  next = v6->__next_;\n  if ( !v6->__next_ )\n    return nullptr;\n  if ( (unsigned int)v4 < 2 )\n  {\n    v8 = value - 1;\n    v9 = nullptr;\n    while ( 1 )\n    {\n      v10 = next[1].__next_;\n      if ( v10 == (std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMODMusic>, void *> *>::__next_pointer)a2 )\n      {\n        if ( LODWORD(next[2].__next_) == a2 )\n          goto LABEL_28;\n      }\n      else if ( (v8 & (unsigned __int64)v10) != v5 )\n      {\n        return v9;\n      }\n      next = next->__next_;\n      if ( !next )\n        return v9;\n    }\n  }\n  v9 = nullptr;\n  while ( 1 )\n  {\n    v11 = (unsigned __int64)next[1].__next_;\n    if ( v11 == a2 )\n      break;\n    if ( v11 < value )\n      goto LABEL_24;\n    if ( (value | v11) >> 32 )\n    {\n      v11 %= value;\nLABEL_24:\n      if ( v11 != v5 )\n        return v9;\n      goto LABEL_19;\n    }\n    if ( (unsigned int)v11 % (unsigned int)value != v5 )\n      return v9;\nLABEL_19:\n    next = next->__next_;\n    if ( !next )\n      return v9;\n  }\n  if ( LODWORD(next[2].__next_) != a2 )\n    goto LABEL_19;\nLABEL_28:\n  v14 = &v15;\n  v12 = sub_1003EF570(&a1->m_fmodMusic, &v15, &unk_10081B0A2, &v14, v16);\n  return FMODAudioEngine::channelForChannelID(a1, *(_DWORD *)(v12 + 24));\n}", "assembly": "; \n; FMODAudioEngine::getActiveMusicChannel from 0x1003e1860 to 0x1003e1a1f (447 bytes)\n; \n; 14 xrefs:\n; > PlayLayer::showCompleteEffect @ 0x1000b45a3\n; > GJBaseGameLayer::processSongState @ 0x1001622dd\n; > FMODAudioEngine::resumeMusic @ 0x1003e1844\n; > FMODAudioEngine::isMusicPlaying_1 @ 0x1003e6a1c\n; > FMODAudioEngine::isMusicPlaying @ 0x1003e6bc9\n; > FMODAudioEngine::loadAndPlayMusic @ 0x1003e6eb8\n; > FMODAudioEngine::playMusic @ 0x1003e6f9f\n; > FMODAudioEngine::playMusic @ 0x1003e7061\n; > FMODAudioEngine::playMusic @ 0x1003e708e\n; > FMODAudioEngine::fadeInMusic @ 0x1003e70d3\n; > FMODAudioEngine::isPersistentMatchPlaying @ 0x1003e7253\n; > FMODAudioEngine::pauseMusic @ 0x1003e9ed4\n; > FMODAudioEngine::fadeOutMusic @ 0x1003e9f03\n; > FMODAudioEngine::fadeMusic @ 0x1003e9fed\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, 0x1003e1860\nmov     rbp, rsp                                                       ; +0x1, 0x1003e1861\npush    rbx                                                            ; +0x4, 0x1003e1864\nsub     rsp, 18h                                                       ; +0x5, 0x1003e1865\nmov     [rbp+var_10], esi                                              ; +0x9, 0x1003e1869\nmov     rcx, [rdi+148h]                                                ; +0xc, 0x1003e186c\ntest    rcx, rcx                                                       ; +0x13, 0x1003e1873\njz      loc_1003E1A12                                                  ; +0x16, 0x1003e1876\nlea     r11, [rdi+140h]                                                ; +0x1c, 0x1003e187c\nmovsxd  r8, esi                                                        ; +0x23, 0x1003e1883\nmov     rax, rcx                                                       ; +0x26, 0x1003e1886\nshr     rax, 1                                                         ; +0x29, 0x1003e1889\nmov     rdx, 5555555555555555h                                         ; +0x2c, 0x1003e188c\nand     rdx, rax                                                       ; +0x36, 0x1003e1896\nmov     rax, rcx                                                       ; +0x39, 0x1003e1899\nsub     rax, rdx                                                       ; +0x3c, 0x1003e189c\nmov     rdx, 3333333333333333h                                         ; +0x3f, 0x1003e189f\nmov     r9, rax                                                        ; +0x49, 0x1003e18a9\nand     r9, rdx                                                        ; +0x4c, 0x1003e18ac\nshr     rax, 2                                                         ; +0x4f, 0x1003e18af\nand     rax, rdx                                                       ; +0x53, 0x1003e18b3\nadd     rax, r9                                                        ; +0x56, 0x1003e18b6\nmov     rdx, rax                                                       ; +0x59, 0x1003e18b9\nshr     rdx, 4                                                         ; +0x5c, 0x1003e18bc\nadd     rdx, rax                                                       ; +0x60, 0x1003e18c0\nmov     rax, 0F0F0F0F0F0F0F0Fh                                         ; +0x63, 0x1003e18c3\nand     rax, rdx                                                       ; +0x6d, 0x1003e18cd\nmov     r10, 101010101010101h                                          ; +0x70, 0x1003e18d0\nimul    r10, rax                                                       ; +0x7a, 0x1003e18da\nshr     r10, 38h                                                       ; +0x7e, 0x1003e18de\ncmp     r10, 1                                                         ; +0x82, 0x1003e18e2\nja      short loc_1003E1900                                            ; +0x86, 0x1003e18e6\nlea     r9, [rcx-1]                                                    ; +0x88, 0x1003e18e8\nand     r9, r8                                                         ; +0x8c, 0x1003e18ec\nmov     rax, [r11]                                                     ; +0x8f, 0x1003e18ef\nmov     rax, [rax+r9*8]                                                ; +0x92, 0x1003e18f2\ntest    rax, rax                                                       ; +0x96, 0x1003e18f6\njnz     short loc_1003E1933                                            ; +0x99, 0x1003e18f9\njmp     loc_1003E1A12                                                  ; +0x9b, 0x1003e18fb\nmov     r9, r8                                                         ; +0xa0, 0x1003e1900\ncmp     rcx, r8                                                        ; +0xa3, 0x1003e1903\nja      short loc_1003E1923                                            ; +0xa6, 0x1003e1906\nmov     rax, r8                                                        ; +0xa8, 0x1003e1908\nor      rax, rcx                                                       ; +0xab, 0x1003e190b\nshr     rax, 20h                                                       ; +0xae, 0x1003e190e\njz      loc_1003E19F9                                                  ; +0xb2, 0x1003e1912\nmov     rax, r8                                                        ; +0xb8, 0x1003e1918\nxor     edx, edx                                                       ; +0xbb, 0x1003e191b\ndiv     rcx                                                            ; +0xbd, 0x1003e191d\nmov     r9, rdx                                                        ; +0xc0, 0x1003e1920\nmov     rax, [r11]                                                     ; +0xc3, 0x1003e1923\nmov     rax, [rax+r9*8]                                                ; +0xc6, 0x1003e1926\ntest    rax, rax                                                       ; +0xca, 0x1003e192a\njz      loc_1003E1A12                                                  ; +0xcd, 0x1003e192d\nmov     rbx, [rax]                                                     ; +0xd3, 0x1003e1933\ntest    rbx, rbx                                                       ; +0xd6, 0x1003e1936\njz      loc_1003E1A12                                                  ; +0xd9, 0x1003e1939\ncmp     r10d, 2                                                        ; +0xdf, 0x1003e193f\njnb     short loc_1003E1977                                            ; +0xe3, 0x1003e1943\ndec     rcx                                                            ; +0xe5, 0x1003e1945\nxor     r10d, r10d                                                     ; +0xe8, 0x1003e1948\njmp     short loc_1003E1961                                            ; +0xeb, 0x1003e194b\nalign 10h                                                              ; +0xed, 0x1003e194d\ncmp     [rbx+10h], esi                                                 ; +0xf0, 0x1003e1950\njz      short loc_1003E19C7                                            ; +0xf3, 0x1003e1953\nmov     rbx, [rbx]                                                     ; +0xf5, 0x1003e1955\ntest    rbx, rbx                                                       ; +0xf8, 0x1003e1958\njz      loc_1003E1A15                                                  ; +0xfb, 0x1003e195b\nmov     rax, [rbx+8]                                                   ; +0x101, 0x1003e1961\ncmp     rax, r8                                                        ; +0x105, 0x1003e1965\njz      short loc_1003E1950                                            ; +0x108, 0x1003e1968\nand     rax, rcx                                                       ; +0x10a, 0x1003e196a\ncmp     rax, r9                                                        ; +0x10d, 0x1003e196d\njz      short loc_1003E1955                                            ; +0x110, 0x1003e1970\njmp     loc_1003E1A15                                                  ; +0x112, 0x1003e1972\nxor     r10d, r10d                                                     ; +0x117, 0x1003e1977\njmp     short loc_1003E1991                                            ; +0x11a, 0x1003e197a\nalign 20h                                                              ; +0x11c, 0x1003e197c\ncmp     [rbx+10h], esi                                                 ; +0x120, 0x1003e1980\njz      short loc_1003E19C7                                            ; +0x123, 0x1003e1983\nmov     rbx, [rbx]                                                     ; +0x125, 0x1003e1985\ntest    rbx, rbx                                                       ; +0x128, 0x1003e1988\njz      loc_1003E1A15                                                  ; +0x12b, 0x1003e198b\nmov     rax, [rbx+8]                                                   ; +0x131, 0x1003e1991\ncmp     rax, r8                                                        ; +0x135, 0x1003e1995\njz      short loc_1003E1980                                            ; +0x138, 0x1003e1998\ncmp     rax, rcx                                                       ; +0x13a, 0x1003e199a\njb      short loc_1003E19B3                                            ; +0x13d, 0x1003e199d\nmov     rdx, rax                                                       ; +0x13f, 0x1003e199f\nor      rdx, rcx                                                       ; +0x142, 0x1003e19a2\nshr     rdx, 20h                                                       ; +0x145, 0x1003e19a5\njz      short loc_1003E19BA                                            ; +0x149, 0x1003e19a9\nxor     edx, edx                                                       ; +0x14b, 0x1003e19ab\ndiv     rcx                                                            ; +0x14d, 0x1003e19ad\nmov     rax, rdx                                                       ; +0x150, 0x1003e19b0\ncmp     rax, r9                                                        ; +0x153, 0x1003e19b3\njz      short loc_1003E1985                                            ; +0x156, 0x1003e19b6\njmp     short loc_1003E1A15                                            ; +0x158, 0x1003e19b8\nxor     edx, edx                                                       ; +0x15a, 0x1003e19ba\ndiv     ecx                                                            ; +0x15c, 0x1003e19bc\nmov     eax, edx                                                       ; +0x15e, 0x1003e19be\ncmp     rax, r9                                                        ; +0x160, 0x1003e19c0\njz      short loc_1003E1985                                            ; +0x163, 0x1003e19c3\njmp     short loc_1003E1A15                                            ; +0x165, 0x1003e19c5\nlea     rsi, [rbp+var_10]                                              ; +0x167, 0x1003e19c7\nmov     [rbp+var_18], rsi                                              ; +0x16b, 0x1003e19cb\nlea     rdx, unk_10081B0A2                                             ; +0x16f, 0x1003e19cf\nlea     rcx, [rbp+var_18]                                              ; +0x176, 0x1003e19d6\nlea     r8, [rbp+var_9]                                                ; +0x17a, 0x1003e19da\nmov     rbx, rdi                                                       ; +0x17e, 0x1003e19de\nmov     rdi, r11                                                       ; +0x181, 0x1003e19e1\ncall    sub_1003EF570                                                  ; +0x184, 0x1003e19e4\nmov     esi, [rax+18h]                                                 ; +0x189, 0x1003e19e9\nmov     rdi, rbx                                                       ; +0x18c, 0x1003e19ec\ncall    FMODAudioEngine__channelForChannelID                           ; +0x18f, 0x1003e19ef\nmov     r10, rax                                                       ; +0x194, 0x1003e19f4\njmp     short loc_1003E1A15                                            ; +0x197, 0x1003e19f7\nmov     eax, esi                                                       ; +0x199, 0x1003e19f9\nxor     edx, edx                                                       ; +0x19b, 0x1003e19fb\ndiv     ecx                                                            ; +0x19d, 0x1003e19fd\nmov     r9d, edx                                                       ; +0x19f, 0x1003e19ff\nmov     rax, [r11]                                                     ; +0x1a2, 0x1003e1a02\nmov     rax, [rax+r9*8]                                                ; +0x1a5, 0x1003e1a05\ntest    rax, rax                                                       ; +0x1a9, 0x1003e1a09\njnz     loc_1003E1933                                                  ; +0x1ac, 0x1003e1a0c\nxor     r10d, r10d                                                     ; +0x1b2, 0x1003e1a12\nmov     rax, r10                                                       ; +0x1b5, 0x1003e1a15\nadd     rsp, 18h                                                       ; +0x1b8, 0x1003e1a18\npop     rbx                                                            ; +0x1bc, 0x1003e1a1c\npop     rbp                                                            ; +0x1bd, 0x1003e1a1d\nretn                                                                   ; +0x1be, 0x1003e1a1e", "xrefs": ["PlayLayer::showCompleteEffect @ 0x1000b45a3", "GJBaseGameLayer::processSongState @ 0x1001622dd", "FMODAudioEngine::resumeMusic @ 0x1003e1844", "FMODAudioEngine::isMusicPlaying_1 @ 0x1003e6a1c", "FMODAudioEngine::isMusicPlaying @ 0x1003e6bc9", "FMODAudioEngine::loadAndPlayMusic @ 0x1003e6eb8", "FMODAudioEngine::playMusic @ 0x1003e6f9f", "FMODAudioEngine::playMusic @ 0x1003e7061", "FMODAudioEngine::playMusic @ 0x1003e708e", "FMODAudioEngine::fadeInMusic @ 0x1003e70d3", "FMODAudioEngine::isPersistentMatchPlaying @ 0x1003e7253", "FMODAudioEngine::pauseMusic @ 0x1003e9ed4", "FMODAudioEngine::fadeOutMusic @ 0x1003e9f03", "FMODAudioEngine::fadeMusic @ 0x1003e9fed"], "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"}