| 1659 | } |
| 1660 | |
| 1661 | error_code AudioSetNotifyEventQueue(ppu_thread& ppu, u64 key, u32 iFlags) |
| 1662 | { |
| 1663 | auto& g_audio = g_fxo->get<cell_audio>(); |
| 1664 | |
| 1665 | if (!g_audio.init) |
| 1666 | { |
| 1667 | return CELL_AUDIO_ERROR_NOT_INIT; |
| 1668 | } |
| 1669 | |
| 1670 | // Waiting for VSH |
| 1671 | lv2_sleep(20, &ppu); |
| 1672 | |
| 1673 | // Dirty hack for sound: confirm the creation of _mxr000 event queue by _cellsurMixerMain thread |
| 1674 | constexpr u64 c_mxr000 = 0x8000cafe0246030; |
| 1675 | |
| 1676 | if (key == c_mxr000 || key == 0) |
| 1677 | { |
| 1678 | bool has_sur_mixer_thread = false; |
| 1679 | |
| 1680 | for (usz count = 0; !lv2_event_queue::find(c_mxr000) && count < 100; count++) |
| 1681 | { |
| 1682 | if (has_sur_mixer_thread || idm::select<named_thread<ppu_thread>>([&](u32 id, named_thread<ppu_thread>& test_ppu) |
| 1683 | { |
| 1684 | // Confirm thread existence |
| 1685 | if (id == ppu.id) |
| 1686 | { |
| 1687 | return false; |
| 1688 | } |
| 1689 | |
| 1690 | const auto ptr = test_ppu.ppu_tname.load(); |
| 1691 | |
| 1692 | if (!ptr) |
| 1693 | { |
| 1694 | return false; |
| 1695 | } |
| 1696 | |
| 1697 | return *ptr == "_cellsurMixerMain"sv; |
| 1698 | }) |
| 1699 | .ret) |
| 1700 | { |
| 1701 | has_sur_mixer_thread = true; |
| 1702 | } |
| 1703 | else |
| 1704 | { |
| 1705 | break; |
| 1706 | } |
| 1707 | |
| 1708 | if (ppu.is_stopped()) |
| 1709 | { |
| 1710 | ppu.state += cpu_flag::again; |
| 1711 | return {}; |
| 1712 | } |
| 1713 | |
| 1714 | cellAudio.error("AudioSetNotifyEventQueue(): Waiting for _mxr000. x%d", count); |
| 1715 | |
| 1716 | lv2_sleep(50'000, &ppu); |
| 1717 | } |
| 1718 |
no test coverage detected