{"type": "func", "start": 4299029968, "end": 4299030430, "name": "FMODAudioEngine::channelForChannelID", "pseudocode": "// \n// FMODAudioEngine::channelForChannelID from 0x1003dfdd0 to 0x1003dff9e (462 bytes)\n// \n// 24 xrefs:\n// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x100161895\n// > FMODAudioEngine::stopAllMusic @ 0x1003de6de\n// > FMODAudioEngine::updateQueuedMusic @ 0x1003df3d3\n// > FMODAudioEngine::saveAudioState @ 0x1003dfbf7\n// > FMODAudioEngine::loadAudioState @ 0x1003e037b\n// > FMODAudioEngine::loadMusic @ 0x1003e1371\n// > FMODAudioEngine::getActiveMusicChannel @ 0x1003e19ef\n// > FMODAudioEngine::playEffectAdvanced @ 0x1003e1a99\n// > FMODAudioEngine::setMusicTimeMS @ 0x1003e27bc\n// > FMODAudioEngine::setChannelVolume @ 0x1003e3373\n// > FMODAudioEngine::setChannelVolume @ 0x1003e33c3\n// > FMODAudioEngine::setChannelPitch @ 0x1003e34e1\n// > FMODAudioEngine::setChannelPitch @ 0x1003e3538\n// > FMODAudioEngine::channelForUniqueID @ 0x1003e5769\n// > FMODAudioEngine::setChannelVolumeMod @ 0x1003e6483\n// > FMODAudioEngine::setChannelVolumeMod @ 0x1003e64d3\n// > FMODAudioEngine::pauseAllMusic @ 0x1003e6a7f\n// > FMODAudioEngine::pauseAllMusic @ 0x1003e6ab6\n// > FMODAudioEngine::resumeAllMusic @ 0x1003e6b16\n// > FMODAudioEngine::startMusic @ 0x1003e7870\n// > FMODAudioEngine::getMusicTimeMS @ 0x1003e97ff\n// > FMODAudioEngine::getMusicTime @ 0x1003e986f\n// > FMODAudioEngine::getMusicLengthMS @ 0x1003e98ef\n// > FMODAudioEngine::stopAndRemoveMusic @ 0x1003e9d1e\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::channelForChannelID(FMODAudioEngine *a1, int a2)\n{\n  unsigned __int64 value; // r10\n  std::unordered_map<int, FMOD::Channel *> *p_m_channelIDToChannel; // rdi\n  unsigned __int64 v4; // r9\n  unsigned __int64 v5; // r8\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMOD::Channel *>, void *> *> *v6; // rax\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMOD::Channel *>, void *> *>::__next_pointer next; // r11\n  unsigned __int64 v9; // r10\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMOD::Channel *>, void *> *>::__next_pointer v10; // rax\n  unsigned __int64 v11; // rax\n  int *v12; // [rsp+0h] [rbp-10h] BYREF\n  int v13; // [rsp+8h] [rbp-8h] BYREF\n  char v14; // [rsp+Fh] [rbp-1h] BYREF\n\n  v13 = a2;\n  value = a1->m_channelIDToChannel.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;\n  if ( !value )\n    return nullptr;\n  p_m_channelIDToChannel = &a1->m_channelIDToChannel;\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;\n    if ( value <= a2 )\n    {\n      if ( !((value | a2) >> 32) )\n      {\n        v5 = a2 % (unsigned int)value;\n        v6 = p_m_channelIDToChannel->__table_.__bucket_list_.__ptr_.__value_[v5];\n        if ( !v6 )\n          return nullptr;\n        goto LABEL_10;\n      }\n      v5 = a2 % value;\n    }\n    v6 = p_m_channelIDToChannel->__table_.__bucket_list_.__ptr_.__value_[v5];\n    if ( !v6 )\n      return nullptr;\n    goto LABEL_10;\n  }\n  v5 = a2 & (value - 1);\n  v6 = p_m_channelIDToChannel->__table_.__bucket_list_.__ptr_.__value_[v5];\n  if ( !v6 )\n    return nullptr;\nLABEL_10:\n  next = v6->__next_;\n  if ( v6->__next_ )\n  {\n    if ( (unsigned int)v4 < 2 )\n    {\n      v9 = value - 1;\n      while ( 1 )\n      {\n        v10 = next[1].__next_;\n        if ( v10 == (std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, FMOD::Channel *>, void *> *>::__next_pointer)a2 )\n        {\n          if ( LODWORD(next[2].__next_) == a2 )\n            goto LABEL_29;\n        }\n        else if ( (v9 & (unsigned __int64)v10) != v5 )\n        {\n          return nullptr;\n        }\n        next = next->__next_;\n        if ( !next )\n          return nullptr;\n      }\n    }\n    while ( 1 )\n    {\n      v11 = (unsigned __int64)next[1].__next_;\n      if ( v11 == a2 )\n      {\n        if ( LODWORD(next[2].__next_) == a2 )\n        {\nLABEL_29:\n          v12 = &v13;\n          return *(FMOD::Channel **)(((__int64 (__fastcall *)(std::unordered_map<int, FMOD::Channel *> *, int *, void *, int **, char *, _QWORD))sub_1003EDB70)(\n                                       p_m_channelIDToChannel,\n                                       &v13,\n                                       &unk_10081B0A2,\n                                       &v12,\n                                       &v14,\n                                       0)\n                                   + 24);\n        }\n      }\n      else\n      {\n        if ( v11 < value )\n          goto LABEL_25;\n        if ( (value | v11) >> 32 )\n        {\n          v11 %= value;\nLABEL_25:\n          if ( v11 != v5 )\n            return nullptr;\n          goto LABEL_20;\n        }\n        if ( (unsigned int)v11 % (unsigned int)value != v5 )\n          return nullptr;\n      }\nLABEL_20:\n      next = next->__next_;\n      if ( !next )\n        return nullptr;\n    }\n  }\n  return nullptr;\n}", "assembly": "; \n; FMODAudioEngine::channelForChannelID from 0x1003dfdd0 to 0x1003dff9e (462 bytes)\n; \n; 24 xrefs:\n; > GJBaseGameLayer::processActivatedAudioTriggers @ 0x100161895\n; > FMODAudioEngine::stopAllMusic @ 0x1003de6de\n; > FMODAudioEngine::updateQueuedMusic @ 0x1003df3d3\n; > FMODAudioEngine::saveAudioState @ 0x1003dfbf7\n; > FMODAudioEngine::loadAudioState @ 0x1003e037b\n; > FMODAudioEngine::loadMusic @ 0x1003e1371\n; > FMODAudioEngine::getActiveMusicChannel @ 0x1003e19ef\n; > FMODAudioEngine::playEffectAdvanced @ 0x1003e1a99\n; > FMODAudioEngine::setMusicTimeMS @ 0x1003e27bc\n; > FMODAudioEngine::setChannelVolume @ 0x1003e3373\n; > FMODAudioEngine::setChannelVolume @ 0x1003e33c3\n; > FMODAudioEngine::setChannelPitch @ 0x1003e34e1\n; > FMODAudioEngine::setChannelPitch @ 0x1003e3538\n; > FMODAudioEngine::channelForUniqueID @ 0x1003e5769\n; > FMODAudioEngine::setChannelVolumeMod @ 0x1003e6483\n; > FMODAudioEngine::setChannelVolumeMod @ 0x1003e64d3\n; > FMODAudioEngine::pauseAllMusic @ 0x1003e6a7f\n; > FMODAudioEngine::pauseAllMusic @ 0x1003e6ab6\n; > FMODAudioEngine::resumeAllMusic @ 0x1003e6b16\n; > FMODAudioEngine::startMusic @ 0x1003e7870\n; > FMODAudioEngine::getMusicTimeMS @ 0x1003e97ff\n; > FMODAudioEngine::getMusicTime @ 0x1003e986f\n; > FMODAudioEngine::getMusicLengthMS @ 0x1003e98ef\n; > FMODAudioEngine::stopAndRemoveMusic @ 0x1003e9d1e\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, 0x1003dfdd0\nmov     rbp, rsp                                                       ; +0x1, 0x1003dfdd1\nsub     rsp, 10h                                                       ; +0x4, 0x1003dfdd4\nmov     [rbp+var_8], esi                                               ; +0x8, 0x1003dfdd8\nmov     r10, [rdi+4D0h]                                                ; +0xb, 0x1003dfddb\ntest    r10, r10                                                       ; +0x12, 0x1003dfde2\njz      loc_1003DFE6F                                                  ; +0x15, 0x1003dfde5\nadd     rdi, 4C8h                                                      ; +0x1b, 0x1003dfdeb\nmovsxd  rcx, esi                                                       ; +0x22, 0x1003dfdf2\nmov     rax, r10                                                       ; +0x25, 0x1003dfdf5\nshr     rax, 1                                                         ; +0x28, 0x1003dfdf8\nmov     rdx, 5555555555555555h                                         ; +0x2b, 0x1003dfdfb\nand     rdx, rax                                                       ; +0x35, 0x1003dfe05\nmov     rax, r10                                                       ; +0x38, 0x1003dfe08\nsub     rax, rdx                                                       ; +0x3b, 0x1003dfe0b\nmov     rdx, 3333333333333333h                                         ; +0x3e, 0x1003dfe0e\nmov     r8, rax                                                        ; +0x48, 0x1003dfe18\nand     r8, rdx                                                        ; +0x4b, 0x1003dfe1b\nshr     rax, 2                                                         ; +0x4e, 0x1003dfe1e\nand     rax, rdx                                                       ; +0x52, 0x1003dfe22\nadd     rax, r8                                                        ; +0x55, 0x1003dfe25\nmov     rdx, rax                                                       ; +0x58, 0x1003dfe28\nshr     rdx, 4                                                         ; +0x5b, 0x1003dfe2b\nadd     rdx, rax                                                       ; +0x5f, 0x1003dfe2f\nmov     rax, 0F0F0F0F0F0F0F0Fh                                         ; +0x62, 0x1003dfe32\nand     rax, rdx                                                       ; +0x6c, 0x1003dfe3c\nmov     r9, 101010101010101h                                           ; +0x6f, 0x1003dfe3f\nimul    r9, rax                                                        ; +0x79, 0x1003dfe49\nshr     r9, 38h                                                        ; +0x7d, 0x1003dfe4d\ncmp     r9, 1                                                          ; +0x81, 0x1003dfe51\nja      short loc_1003DFE7B                                            ; +0x85, 0x1003dfe55\nlea     r8, [r10-1]                                                    ; +0x87, 0x1003dfe57\nand     r8, rcx                                                        ; +0x8b, 0x1003dfe5b\nmov     rax, [rdi]                                                     ; +0x8e, 0x1003dfe5e\nmov     rax, [rax+r8*8]                                                ; +0x91, 0x1003dfe61\ntest    rax, rax                                                       ; +0x95, 0x1003dfe65\njnz     short loc_1003DFEAE                                            ; +0x98, 0x1003dfe68\njmp     loc_1003DFF92                                                  ; +0x9a, 0x1003dfe6a\nxor     r9d, r9d                                                       ; +0x9f, 0x1003dfe6f\nmov     rax, r9                                                        ; +0xa2, 0x1003dfe72\nadd     rsp, 10h                                                       ; +0xa5, 0x1003dfe75\npop     rbp                                                            ; +0xa9, 0x1003dfe79\nretn                                                                   ; +0xaa, 0x1003dfe7a\nmov     r8, rcx                                                        ; +0xab, 0x1003dfe7b\ncmp     r10, rcx                                                       ; +0xae, 0x1003dfe7e\nja      short loc_1003DFE9E                                            ; +0xb1, 0x1003dfe81\nmov     rax, rcx                                                       ; +0xb3, 0x1003dfe83\nor      rax, r10                                                       ; +0xb6, 0x1003dfe86\nshr     rax, 20h                                                       ; +0xb9, 0x1003dfe89\njz      loc_1003DFF78                                                  ; +0xbd, 0x1003dfe8d\nmov     rax, rcx                                                       ; +0xc3, 0x1003dfe93\nxor     edx, edx                                                       ; +0xc6, 0x1003dfe96\ndiv     r10                                                            ; +0xc8, 0x1003dfe98\nmov     r8, rdx                                                        ; +0xcb, 0x1003dfe9b\nmov     rax, [rdi]                                                     ; +0xce, 0x1003dfe9e\nmov     rax, [rax+r8*8]                                                ; +0xd1, 0x1003dfea1\ntest    rax, rax                                                       ; +0xd5, 0x1003dfea5\njz      loc_1003DFF92                                                  ; +0xd8, 0x1003dfea8\nmov     r11, [rax]                                                     ; +0xde, 0x1003dfeae\ntest    r11, r11                                                       ; +0xe1, 0x1003dfeb1\njz      loc_1003DFF92                                                  ; +0xe4, 0x1003dfeb4\ncmp     r9d, 2                                                         ; +0xea, 0x1003dfeba\njnb     short loc_1003DFEF1                                            ; +0xee, 0x1003dfebe\ndec     r10                                                            ; +0xf0, 0x1003dfec0\nxor     r9d, r9d                                                       ; +0xf3, 0x1003dfec3\njmp     short loc_1003DFEDE                                            ; +0xf6, 0x1003dfec6\nalign 10h                                                              ; +0xf8, 0x1003dfec8\ncmp     [r11+10h], esi                                                 ; +0x100, 0x1003dfed0\njz      short loc_1003DFF4F                                            ; +0x104, 0x1003dfed4\nmov     r11, [r11]                                                     ; +0x106, 0x1003dfed6\ntest    r11, r11                                                       ; +0x109, 0x1003dfed9\njz      short loc_1003DFE72                                            ; +0x10c, 0x1003dfedc\nmov     rax, [r11+8]                                                   ; +0x10e, 0x1003dfede\ncmp     rax, rcx                                                       ; +0x112, 0x1003dfee2\njz      short loc_1003DFED0                                            ; +0x115, 0x1003dfee5\nand     rax, r10                                                       ; +0x117, 0x1003dfee7\ncmp     rax, r8                                                        ; +0x11a, 0x1003dfeea\njz      short loc_1003DFED6                                            ; +0x11d, 0x1003dfeed\njmp     short loc_1003DFE72                                            ; +0x11f, 0x1003dfeef\nxor     r9d, r9d                                                       ; +0x121, 0x1003dfef1\njmp     short loc_1003DFF12                                            ; +0x124, 0x1003dfef4\nalign 20h                                                              ; +0x126, 0x1003dfef6\ncmp     [r11+10h], esi                                                 ; +0x130, 0x1003dff00\njz      short loc_1003DFF4F                                            ; +0x134, 0x1003dff04\nmov     r11, [r11]                                                     ; +0x136, 0x1003dff06\ntest    r11, r11                                                       ; +0x139, 0x1003dff09\njz      loc_1003DFE72                                                  ; +0x13c, 0x1003dff0c\nmov     rax, [r11+8]                                                   ; +0x142, 0x1003dff12\ncmp     rax, rcx                                                       ; +0x146, 0x1003dff16\njz      short loc_1003DFF00                                            ; +0x149, 0x1003dff19\ncmp     rax, r10                                                       ; +0x14b, 0x1003dff1b\njb      short loc_1003DFF34                                            ; +0x14e, 0x1003dff1e\nmov     rdx, rax                                                       ; +0x150, 0x1003dff20\nor      rdx, r10                                                       ; +0x153, 0x1003dff23\nshr     rdx, 20h                                                       ; +0x156, 0x1003dff26\njz      short loc_1003DFF3E                                            ; +0x15a, 0x1003dff2a\nxor     edx, edx                                                       ; +0x15c, 0x1003dff2c\ndiv     r10                                                            ; +0x15e, 0x1003dff2e\nmov     rax, rdx                                                       ; +0x161, 0x1003dff31\ncmp     rax, r8                                                        ; +0x164, 0x1003dff34\njz      short loc_1003DFF06                                            ; +0x167, 0x1003dff37\njmp     loc_1003DFE72                                                  ; +0x169, 0x1003dff39\nxor     edx, edx                                                       ; +0x16e, 0x1003dff3e\ndiv     r10d                                                           ; +0x170, 0x1003dff40\nmov     eax, edx                                                       ; +0x173, 0x1003dff43\ncmp     rax, r8                                                        ; +0x175, 0x1003dff45\njz      short loc_1003DFF06                                            ; +0x178, 0x1003dff48\njmp     loc_1003DFE72                                                  ; +0x17a, 0x1003dff4a\nlea     rsi, [rbp+var_8]                                               ; +0x17f, 0x1003dff4f\nmov     [rbp+var_10], rsi                                              ; +0x183, 0x1003dff53\nlea     rdx, unk_10081B0A2                                             ; +0x187, 0x1003dff57\nlea     rcx, [rbp+var_10]                                              ; +0x18e, 0x1003dff5e\nlea     r8, [rbp+var_1]                                                ; +0x192, 0x1003dff62\ncall    sub_1003EDB70                                                  ; +0x196, 0x1003dff66\nmov     r9, [rax+18h]                                                  ; +0x19b, 0x1003dff6b\nmov     rax, r9                                                        ; +0x19f, 0x1003dff6f\nadd     rsp, 10h                                                       ; +0x1a2, 0x1003dff72\npop     rbp                                                            ; +0x1a6, 0x1003dff76\nretn                                                                   ; +0x1a7, 0x1003dff77\nmov     eax, esi                                                       ; +0x1a8, 0x1003dff78\nxor     edx, edx                                                       ; +0x1aa, 0x1003dff7a\ndiv     r10d                                                           ; +0x1ac, 0x1003dff7c\nmov     r8d, edx                                                       ; +0x1af, 0x1003dff7f\nmov     rax, [rdi]                                                     ; +0x1b2, 0x1003dff82\nmov     rax, [rax+r8*8]                                                ; +0x1b5, 0x1003dff85\ntest    rax, rax                                                       ; +0x1b9, 0x1003dff89\njnz     loc_1003DFEAE                                                  ; +0x1bc, 0x1003dff8c\nxor     r9d, r9d                                                       ; +0x1c2, 0x1003dff92\nmov     rax, r9                                                        ; +0x1c5, 0x1003dff95\nadd     rsp, 10h                                                       ; +0x1c8, 0x1003dff98\npop     rbp                                                            ; +0x1cc, 0x1003dff9c\nretn                                                                   ; +0x1cd, 0x1003dff9d", "xrefs": ["GJBaseGameLayer::processActivatedAudioTriggers @ 0x100161895", "FMODAudioEngine::stopAllMusic @ 0x1003de6de", "FMODAudioEngine::updateQueuedMusic @ 0x1003df3d3", "FMODAudioEngine::saveAudioState @ 0x1003dfbf7", "FMODAudioEngine::loadAudioState @ 0x1003e037b", "FMODAudioEngine::loadMusic @ 0x1003e1371", "FMODAudioEngine::getActiveMusicChannel @ 0x1003e19ef", "FMODAudioEngine::playEffectAdvanced @ 0x1003e1a99", "FMODAudioEngine::setMusicTimeMS @ 0x1003e27bc", "FMODAudioEngine::setChannelVolume @ 0x1003e3373", "FMODAudioEngine::setChannelVolume @ 0x1003e33c3", "FMODAudioEngine::setChannelPitch @ 0x1003e34e1", "FMODAudioEngine::setChannelPitch @ 0x1003e3538", "FMODAudioEngine::channelForUniqueID @ 0x1003e5769", "FMODAudioEngine::setChannelVolumeMod @ 0x1003e6483", "FMODAudioEngine::setChannelVolumeMod @ 0x1003e64d3", "FMODAudioEngine::pauseAllMusic @ 0x1003e6a7f", "FMODAudioEngine::pauseAllMusic @ 0x1003e6ab6", "FMODAudioEngine::resumeAllMusic @ 0x1003e6b16", "FMODAudioEngine::startMusic @ 0x1003e7870", "FMODAudioEngine::getMusicTimeMS @ 0x1003e97ff", "FMODAudioEngine::getMusicTime @ 0x1003e986f", "FMODAudioEngine::getMusicLengthMS @ 0x1003e98ef", "FMODAudioEngine::stopAndRemoveMusic @ 0x1003e9d1e"], "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"}