{"type": "func", "start": 5373199680, "end": 5373200497, "name": "SetupSFXPopup::onClose", "pseudocode": "// \n// SetupSFXPopup::onClose from 0x140448540 to 0x140448871 (817 bytes)\n// \n// 2 xrefs:\n// > <???> @ 0x1405ef798\n// > <???> @ 0x1406da658\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\n// Hidden C++ exception states: #wind=7\nvoid SetupSFXPopup::onClose(SetupSFXPopup *a1, cocos2d::CCObject *a2)\n{\n  unsigned int v4; // ebp\n  FMODAudioEngine *v5; // rcx\n  EffectGameObject *m_gameObject; // rcx\n  struct cocos2d::CCArray *m_gameObjects; // r15\n  unsigned int i; // r14d\n  struct cocos2d::CCObject *v9; // rdi\n  __int64 m_unknown2; // rbx\n  cocos2d::CCDictionary *m_sfxObjects; // rcx\n  unsigned int v12; // ebx\n  MusicDownloadManager *v13; // rax\n  int v14; // ebp\n  void **v15; // rax\n  void *v16; // rdx\n  _QWORD *v17; // rbx\n  __int64 v18; // rcx\n  _QWORD *v19; // rbx\n  __int64 v20; // rcx\n  int v21; // eax\n  int v22; // esi\n  int m_nLuaID; // ebx\n  float v24; // xmm0_4\n  FMODAudioEngine *v25; // [rsp+28h] [rbp-B0h]\n  FMODAudioEngine *v26; // [rsp+30h] [rbp-A8h]\n  FMODAudioEngine *v27; // [rsp+38h] [rbp-A0h]\n  FMODAudioEngine *v28; // [rsp+40h] [rbp-98h]\n  _QWORD Src[4]; // [rsp+48h] [rbp-90h] BYREF\n  _QWORD v30[4]; // [rsp+68h] [rbp-70h] BYREF\n\n  v4 = 0;\n  v5 = (FMODAudioEngine *)qword_1406C2E88;\n  if ( !qword_1406C2E88 )\n  {\n    v25 = (FMODAudioEngine *)operator new(0x888u);\n    qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v25);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);\n    v5 = (FMODAudioEngine *)qword_1406C2E88;\n  }\n  FMODAudioEngine::stopAllEffects(v5);\n  m_gameObject = a1->m_gameObject;\n  if ( m_gameObject )\n    m_gameObjects = cocos2d::CCArray::createWithObject(m_gameObject);\n  else\n    m_gameObjects = a1->m_gameObjects;\n  for ( i = 0; i < cocos2d::CCArray::count(m_gameObjects); ++i )\n  {\n    v9 = cocos2d::CCArray::objectAtIndex(m_gameObjects, i);\n    m_unknown2 = v9[33].m_unknown2;\n    m_sfxObjects = MusicDownloadManager::sharedState()->m_sfxObjects;\n    if ( m_sfxObjects )\n      cocos2d::CCDictionary::objectForKey(m_sfxObjects, m_unknown2);\n    v12 = v9[33].m_unknown2;\n    v13 = MusicDownloadManager::sharedState();\n    MusicDownloadManager::pathForSFXFolder((__int64)v13, Src, v12);\n    v14 = v4 | 1;\n    sub_140041270(Src, \"s\", 1u);\n    v15 = (void **)GameToolbox::intToString(v30, v12);\n    v16 = v15;\n    if ( (unsigned __int64)v15[3] > 0xF )\n      v16 = *v15;\n    sub_140041270(Src, v16, (size_t)v15[2]);\n    sub_14003A830((__int64)v30);\n    sub_140041270(Src, \".ogg\", 4u);\n    v17 = (_QWORD *)sub_14003BDB0((__int64)v30, (__int64)Src);\n    v18 = qword_1406C2E88;\n    if ( !qword_1406C2E88 )\n    {\n      v26 = (FMODAudioEngine *)operator new(0x888u);\n      qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v26);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);\n      v18 = qword_1406C2E88;\n    }\n    FMODAudioEngine::preloadEffect(v18, v17);\n    v19 = (_QWORD *)sub_14003BDB0((__int64)v30, (__int64)Src);\n    v20 = qword_1406C2E88;\n    if ( !qword_1406C2E88 )\n    {\n      v27 = (FMODAudioEngine *)operator new(0x888u);\n      qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v27);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);\n      v20 = qword_1406C2E88;\n    }\n    v21 = FMODAudioEngine::lengthForSound(v20, v19);\n    v22 = HIDWORD(v9[34].__vftable);\n    m_nLuaID = v9[34].m_nLuaID;\n    if ( !m_nLuaID || m_nLuaID < v22 )\n      m_nLuaID = v21;\n    v24 = 1.0;\n    if ( v9[33].m_uOrderOfArrival )\n    {\n      if ( !qword_1406C2E88 )\n      {\n        v28 = (FMODAudioEngine *)operator new(0x888u);\n        qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v28);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);\n      }\n      v24 = FMODAudioEngine::pitchForIdx(v9[33].m_uOrderOfArrival);\n    }\n    *(float *)&v9[35].m_uUnknown = (float)(int)(float)((float)(m_nLuaID - v22) / v24) / 1000.0;\n    v4 = v14 & 0xFFFFFFFE;\n    sub_14003A830((__int64)Src);\n  }\n  SetupTriggerPopup::onClose(a1, a2);\n}", "assembly": "; \n; SetupSFXPopup::onClose from 0x140448540 to 0x140448871 (817 bytes)\n; \n; 2 xrefs:\n; > <???> @ 0x1405ef798\n; > <???> @ 0x1406da658\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\nmov     rax, rsp                                                       ; +0x0, 0x140448540\nmov     [rax+10h], rbx                                                 ; +0x3, 0x140448543\nmov     [rax+18h], rbp                                                 ; +0x7, 0x140448547\nmov     [rax+20h], rsi                                                 ; +0xb, 0x14044854b\npush    rdi                                                            ; +0xf, 0x14044854f\npush    r12                                                            ; +0x10, 0x140448550\npush    r13                                                            ; +0x12, 0x140448552\npush    r14                                                            ; +0x14, 0x140448554\npush    r15                                                            ; +0x16, 0x140448556\nsub     rsp, 0B0h                                                      ; +0x18, 0x140448558\nmovaps  xmmword ptr [rax-38h], xmm6                                    ; +0x1f, 0x14044855f\nmovaps  xmmword ptr [rax-48h], xmm7                                    ; +0x23, 0x140448563\nmov     rax, cs:__security_cookie                                      ; +0x27, 0x140448567\nxor     rax, rsp                                                       ; +0x2e, 0x14044856e\nmov     [rsp+0D8h+var_50], rax                                         ; +0x31, 0x140448571\nmov     r12, rdx                                                       ; +0x39, 0x140448579\nmov     r13, rcx                                                       ; +0x3c, 0x14044857c\nxor     ebp, ebp                                                       ; +0x3f, 0x14044857f\nmov     [rsp+0D8h+var_B8], ebp                                         ; +0x41, 0x140448581\nmov     rcx, cs:qword_1406C2E88                                        ; +0x45, 0x140448585\ntest    rcx, rcx                                                       ; +0x4c, 0x14044858c\njnz     short loc_1404485C0                                            ; +0x4f, 0x14044858f\nmov     ecx, 888h; Size                                                ; +0x51, 0x140448591\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x56, 0x140448596\nmov     [rsp+0D8h+var_B0], rax                                         ; +0x5b, 0x14044859b\nmov     rcx, rax                                                       ; +0x60, 0x1404485a0\ncall    FMODAudioEngine__FMODAudioEngine                               ; +0x63, 0x1404485a3\nnop                                                                    ; +0x68, 0x1404485a8\nmov     cs:qword_1406C2E88, rax                                        ; +0x69, 0x1404485a9\nmov     rdx, [rax]                                                     ; +0x70, 0x1404485b0\nmov     rcx, rax                                                       ; +0x73, 0x1404485b3\ncall    qword ptr [rdx+48h]                                            ; +0x76, 0x1404485b6\nmov     rcx, cs:qword_1406C2E88                                        ; +0x79, 0x1404485b9\ncall    FMODAudioEngine__stopAllEffects                                ; +0x80, 0x1404485c0\nmov     rcx, [r13+290h]                                                ; +0x85, 0x1404485c5\ntest    rcx, rcx                                                       ; +0x8c, 0x1404485cc\njz      short loc_1404485DC                                            ; +0x8f, 0x1404485cf\ncall    cs:?createWithObject@CCArray@cocos2d@@SAPEAV12@PEAVCCObject@2@@Z; cocos2d::CCArray::createWithObject(cocos2d::CCObject *) ; +0x91, 0x1404485d1\nmov     r15, rax                                                       ; +0x97, 0x1404485d7\njmp     short loc_1404485E3                                            ; +0x9a, 0x1404485da\nmov     r15, [r13+298h]                                                ; +0x9c, 0x1404485dc\nmov     r14d, ebp                                                      ; +0xa3, 0x1404485e3\nmov     rcx, r15                                                       ; +0xa6, 0x1404485e6\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0xa9, 0x1404485e9\ntest    eax, eax                                                       ; +0xaf, 0x1404485ef\njz      loc_14044882B                                                  ; +0xb1, 0x1404485f1\nmovss   xmm6, cs:flt_140622C24                                         ; +0xb7, 0x1404485f7\nmovss   xmm7, cs:dword_14062350C                                       ; +0xbf, 0x1404485ff\nnop     word ptr [rax+rax+00000000h]                                   ; +0xc7, 0x140448607\nmov     edx, r14d                                                      ; +0xd0, 0x140448610\nmov     rcx, r15                                                       ; +0xd3, 0x140448613\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0xd6, 0x140448616\nmov     rdi, rax                                                       ; +0xdc, 0x14044861c\nmovsxd  rbx, dword ptr [rax+760h]                                      ; +0xdf, 0x14044861f\ncall    MusicDownloadManager__sharedState                              ; +0xe6, 0x140448626\nmov     rcx, [rax+190h]                                                ; +0xeb, 0x14044862b\ntest    rcx, rcx                                                       ; +0xf2, 0x140448632\njz      short loc_140448640                                            ; +0xf5, 0x140448635\nmov     rdx, rbx                                                       ; +0xf7, 0x140448637\ncall    cs:?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@_J@Z; cocos2d::CCDictionary::objectForKey(__int64) ; +0xfa, 0x14044863a\nmov     ebx, [rdi+760h]                                                ; +0x100, 0x140448640\ncall    MusicDownloadManager__sharedState                              ; +0x106, 0x140448646\nnop                                                                    ; +0x10b, 0x14044864b\nmov     r8d, ebx                                                       ; +0x10c, 0x14044864c\nlea     rdx, [rsp+0D8h+Src]                                            ; +0x10f, 0x14044864f\nmov     rcx, rax                                                       ; +0x114, 0x140448654\ncall    MusicDownloadManager__pathForSFXFolder                         ; +0x117, 0x140448657\nor      ebp, 1                                                         ; +0x11c, 0x14044865c\nmov     [rsp+0D8h+var_B8], ebp                                         ; +0x11f, 0x14044865f\nmov     r8d, 1; Size                                                   ; +0x123, 0x140448663\nlea     rdx, aS_1; \"s\"                                                 ; +0x129, 0x140448669\nlea     rcx, [rsp+0D8h+Src]; Src                                       ; +0x130, 0x140448670\ncall    sub_140041270                                                  ; +0x135, 0x140448675\nmov     edx, ebx                                                       ; +0x13a, 0x14044867a\nlea     rcx, [rsp+0D8h+var_70]                                         ; +0x13c, 0x14044867c\ncall    GameToolbox__intToString                                       ; +0x141, 0x140448681\nnop                                                                    ; +0x146, 0x140448686\nmov     rdx, rax                                                       ; +0x147, 0x140448687\ncmp     qword ptr [rax+18h], 0Fh                                       ; +0x14a, 0x14044868a\njbe     short loc_140448694                                            ; +0x14f, 0x14044868f\nmov     rdx, [rax]; void *                                             ; +0x151, 0x140448691\nmov     r8, [rax+10h]; Size                                            ; +0x154, 0x140448694\nlea     rcx, [rsp+0D8h+Src]; Src                                       ; +0x158, 0x140448698\ncall    sub_140041270                                                  ; +0x15d, 0x14044869d\nnop                                                                    ; +0x162, 0x1404486a2\nlea     rcx, [rsp+0D8h+var_70]                                         ; +0x163, 0x1404486a3\ncall    sub_14003A830                                                  ; +0x168, 0x1404486a8\nmov     r8d, 4; Size                                                   ; +0x16d, 0x1404486ad\nlea     rdx, aOgg; \".ogg\"                                              ; +0x173, 0x1404486b3\nlea     rcx, [rsp+0D8h+Src]; Src                                       ; +0x17a, 0x1404486ba\ncall    sub_140041270                                                  ; +0x17f, 0x1404486bf\nlea     rax, [rsp+0D8h+var_70]                                         ; +0x184, 0x1404486c4\nmov     [rsp+0D8h+var_B0], rax                                         ; +0x189, 0x1404486c9\nlea     rdx, [rsp+0D8h+Src]                                            ; +0x18e, 0x1404486ce\nlea     rcx, [rsp+0D8h+var_70]                                         ; +0x193, 0x1404486d3\ncall    sub_14003BDB0                                                  ; +0x198, 0x1404486d8\nmov     rbx, rax                                                       ; +0x19d, 0x1404486dd\nmov     rcx, cs:qword_1406C2E88                                        ; +0x1a0, 0x1404486e0\ntest    rcx, rcx                                                       ; +0x1a7, 0x1404486e7\njnz     short loc_14044871B                                            ; +0x1aa, 0x1404486ea\nmov     ecx, 888h; Size                                                ; +0x1ac, 0x1404486ec\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x1b1, 0x1404486f1\nmov     [rsp+0D8h+var_A8], rax                                         ; +0x1b6, 0x1404486f6\nmov     rcx, rax                                                       ; +0x1bb, 0x1404486fb\ncall    FMODAudioEngine__FMODAudioEngine                               ; +0x1be, 0x1404486fe\nnop                                                                    ; +0x1c3, 0x140448703\nmov     cs:qword_1406C2E88, rax                                        ; +0x1c4, 0x140448704\nmov     rdx, [rax]                                                     ; +0x1cb, 0x14044870b\nmov     rcx, rax                                                       ; +0x1ce, 0x14044870e\ncall    qword ptr [rdx+48h]                                            ; +0x1d1, 0x140448711\nmov     rcx, cs:qword_1406C2E88                                        ; +0x1d4, 0x140448714\nmov     rdx, rbx                                                       ; +0x1db, 0x14044871b\ncall    FMODAudioEngine__preloadEffect                                 ; +0x1de, 0x14044871e\nlea     rax, [rsp+0D8h+var_70]                                         ; +0x1e3, 0x140448723\nmov     [rsp+0D8h+var_B0], rax                                         ; +0x1e8, 0x140448728\nlea     rdx, [rsp+0D8h+Src]                                            ; +0x1ed, 0x14044872d\nlea     rcx, [rsp+0D8h+var_70]                                         ; +0x1f2, 0x140448732\ncall    sub_14003BDB0                                                  ; +0x1f7, 0x140448737\nmov     rbx, rax                                                       ; +0x1fc, 0x14044873c\nmov     rcx, cs:qword_1406C2E88                                        ; +0x1ff, 0x14044873f\ntest    rcx, rcx                                                       ; +0x206, 0x140448746\njnz     short loc_14044877A                                            ; +0x209, 0x140448749\nmov     ecx, 888h; Size                                                ; +0x20b, 0x14044874b\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x210, 0x140448750\nmov     [rsp+0D8h+var_A0], rax                                         ; +0x215, 0x140448755\nmov     rcx, rax                                                       ; +0x21a, 0x14044875a\ncall    FMODAudioEngine__FMODAudioEngine                               ; +0x21d, 0x14044875d\nnop                                                                    ; +0x222, 0x140448762\nmov     cs:qword_1406C2E88, rax                                        ; +0x223, 0x140448763\nmov     rdx, [rax]                                                     ; +0x22a, 0x14044876a\nmov     rcx, rax                                                       ; +0x22d, 0x14044876d\ncall    qword ptr [rdx+48h]                                            ; +0x230, 0x140448770\nmov     rcx, cs:qword_1406C2E88                                        ; +0x233, 0x140448773\nmov     rdx, rbx                                                       ; +0x23a, 0x14044877a\ncall    FMODAudioEngine__lengthForSound                                ; +0x23d, 0x14044877d\nmov     esi, [rdi+774h]                                                ; +0x242, 0x140448782\nmov     ebx, [rdi+77Ch]                                                ; +0x248, 0x140448788\ntest    ebx, ebx                                                       ; +0x24e, 0x14044878e\njz      short loc_140448796                                            ; +0x250, 0x140448790\ncmp     ebx, esi                                                       ; +0x252, 0x140448792\njge     short loc_140448798                                            ; +0x254, 0x140448794\nmov     ebx, eax                                                       ; +0x256, 0x140448796\nmovaps  xmm0, xmm6                                                     ; +0x258, 0x140448798\ncmp     dword ptr [rdi+768h], 0                                        ; +0x25b, 0x14044879b\njz      short loc_1404487E1                                            ; +0x262, 0x1404487a2\ncmp     cs:qword_1406C2E88, 0                                          ; +0x264, 0x1404487a4\njnz     short loc_1404487D6                                            ; +0x26c, 0x1404487ac\nmov     ecx, 888h; Size                                                ; +0x26e, 0x1404487ae\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x273, 0x1404487b3\nmov     [rsp+0D8h+var_98], rax                                         ; +0x278, 0x1404487b8\nmov     rcx, rax                                                       ; +0x27d, 0x1404487bd\ncall    FMODAudioEngine__FMODAudioEngine                               ; +0x280, 0x1404487c0\nnop                                                                    ; +0x285, 0x1404487c5\nmov     cs:qword_1406C2E88, rax                                        ; +0x286, 0x1404487c6\nmov     rdx, [rax]                                                     ; +0x28d, 0x1404487cd\nmov     rcx, rax                                                       ; +0x290, 0x1404487d0\ncall    qword ptr [rdx+48h]                                            ; +0x293, 0x1404487d3\nmov     ecx, [rdi+768h]                                                ; +0x296, 0x1404487d6\ncall    FMODAudioEngine__pitchForIdx                                   ; +0x29c, 0x1404487dc\nsub     ebx, esi                                                       ; +0x2a1, 0x1404487e1\nmovd    xmm1, ebx                                                      ; +0x2a3, 0x1404487e3\ncvtdq2ps xmm1, xmm1                                                    ; +0x2a7, 0x1404487e7\ndivss   xmm1, xmm0                                                     ; +0x2aa, 0x1404487ea\ncvttss2si eax, xmm1                                                    ; +0x2ae, 0x1404487ee\nmovd    xmm0, eax                                                      ; +0x2b2, 0x1404487f2\ncvtdq2ps xmm0, xmm0                                                    ; +0x2b6, 0x1404487f6\ndivss   xmm0, xmm7                                                     ; +0x2b9, 0x1404487f9\nmovss   dword ptr [rdi+7CCh], xmm0                                     ; +0x2bd, 0x1404487fd\nand     ebp, 0FFFFFFFEh                                                ; +0x2c5, 0x140448805\nmov     [rsp+0D8h+var_B8], ebp                                         ; +0x2c8, 0x140448808\nlea     rcx, [rsp+0D8h+Src]                                            ; +0x2cc, 0x14044880c\ncall    sub_14003A830                                                  ; +0x2d1, 0x140448811\ninc     r14d                                                           ; +0x2d6, 0x140448816\nmov     rcx, r15                                                       ; +0x2d9, 0x140448819\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x2dc, 0x14044881c\ncmp     r14d, eax                                                      ; +0x2e2, 0x140448822\njb      loc_140448610                                                  ; +0x2e5, 0x140448825\nmov     rdx, r12                                                       ; +0x2eb, 0x14044882b\nmov     rcx, r13                                                       ; +0x2ee, 0x14044882e\ncall    SetupTriggerPopup__onClose                                     ; +0x2f1, 0x140448831\nmov     rcx, [rsp+0D8h+var_50]                                         ; +0x2f6, 0x140448836\nxor     rcx, rsp; StackCookie                                          ; +0x2fe, 0x14044883e\ncall    __security_check_cookie                                        ; +0x301, 0x140448841\nlea     r11, [rsp+0D8h+var_28]                                         ; +0x306, 0x140448846\nmov     rbx, [r11+38h]                                                 ; +0x30e, 0x14044884e\nmov     rbp, [r11+40h]                                                 ; +0x312, 0x140448852\nmov     rsi, [r11+48h]                                                 ; +0x316, 0x140448856\nmovaps  xmm6, xmmword ptr [r11-10h]                                    ; +0x31a, 0x14044885a\nmovaps  xmm7, xmmword ptr [r11-20h]                                    ; +0x31f, 0x14044885f\nmov     rsp, r11                                                       ; +0x324, 0x140448864\npop     r15                                                            ; +0x327, 0x140448867\npop     r14                                                            ; +0x329, 0x140448869\npop     r13                                                            ; +0x32b, 0x14044886b\npop     r12                                                            ; +0x32d, 0x14044886d\npop     rdi                                                            ; +0x32f, 0x14044886f\nretn                                                                   ; +0x330, 0x140448870", "xrefs": ["<???> @ 0x1405ef798", "<???> @ 0x1406da658"], "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"}