Savestates: add sys_rsxaudio

This commit is contained in:
Eladash 2023-10-02 13:10:59 +03:00 committed by Elad Ashkenazi
parent 96d31cf64e
commit 020bff1485
3 changed files with 39 additions and 7 deletions

View File

@ -103,6 +103,38 @@ namespace rsxaudio_ringbuf_reader
}
}
lv2_rsxaudio::lv2_rsxaudio(utils::serial& ar) noexcept
: lv2_obj{1}
, init(ar)
{
if (init)
{
ar(shmem);
for (const auto& port : event_queue)
{
lv2_event_queue::save_ptr(ar, port.get());
}
}
}
void lv2_rsxaudio::save(utils::serial& ar)
{
USING_SERIALIZATION_VERSION(LLE);
ar(init);
if (init)
{
ar(shmem);
for (auto& port : event_queue)
{
port = lv2_event_queue::load_ptr(ar, port);
}
}
}
error_code sys_rsxaudio_initialize(vm::ptr<u32> handle)
{
sys_rsxaudio.trace("sys_rsxaudio_initialize(handle=*0x%x)", handle);
@ -414,7 +446,7 @@ error_code sys_rsxaudio_start_process(u32 handle)
for (u32 q_idx = 0; q_idx < SYS_RSXAUDIO_PORT_CNT; q_idx++)
{
if (auto queue = rsxaudio_obj->event_queue[q_idx].lock(); queue && sh_page->ctrl.ringbuf[q_idx].active)
if (const auto& queue = rsxaudio_obj->event_queue[q_idx]; queue && sh_page->ctrl.ringbuf[q_idx].active)
{
queue->send(rsxaudio_obj->event_port_name[q_idx], q_idx, 0, 0);
}
@ -823,7 +855,7 @@ void rsxaudio_data_thread::extract_audio_data()
// Too late to recover
reset_periods = true;
if (auto queue = rsxaudio_obj->event_queue[dst_raw].lock())
if (const auto& queue = rsxaudio_obj->event_queue[dst_raw])
{
queue->send(rsxaudio_obj->event_port_name[dst_raw], dst_raw, blk_idx, timestamp);
}

View File

@ -161,14 +161,13 @@ struct lv2_rsxaudio final : lv2_obj
vm::addr_t shmem{};
std::array<std::weak_ptr<lv2_event_queue>, SYS_RSXAUDIO_PORT_CNT> event_queue{};
std::array<std::shared_ptr<lv2_event_queue>, SYS_RSXAUDIO_PORT_CNT> event_queue{};
// lv2 uses port memory addresses for their names
static constexpr std::array<u64, SYS_RSXAUDIO_PORT_CNT> event_port_name{ 0x8000000000400100, 0x8000000000400200, 0x8000000000400300 };
lv2_rsxaudio()
{
}
lv2_rsxaudio() noexcept = default;
lv2_rsxaudio(utils::serial& ar) noexcept; void save(utils::serial& ar);
void page_lock()
{

View File

@ -586,11 +586,12 @@ void kernel_explorer::update()
QTreeWidgetItem* rao_obj = add_solid_node(node, qstr(fmt::format(u8"RSXAudio 0x%08x: Shmem: 0x%08x", id, u32{rao.shmem})));
for (u64 q_idx = 0; q_idx < rao.event_queue.size(); q_idx++)
{
if (const auto eq = rao.event_queue[q_idx].lock())
if (const auto& eq = rao.event_queue[q_idx])
{
add_leaf(rao_obj, qstr(fmt::format(u8"Event Queue %u: ID: 0x%08x", q_idx, eq->id)));
}
}
break;
}
default: