mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Savestates: Fix rsxaudio
This commit is contained in:
parent
6db8b84048
commit
b2e969eb8f
@ -419,7 +419,7 @@ cell_audio_thread::cell_audio_thread(utils::serial& ar)
|
||||
for (key_info& k : keys)
|
||||
{
|
||||
ar(k.start_period, k.flags, k.source);
|
||||
k.port = lv2_event_queue::load_ptr(ar, k.port);
|
||||
k.port = lv2_event_queue::load_ptr(ar, k.port, "audio");
|
||||
}
|
||||
|
||||
ar(ports);
|
||||
|
@ -57,7 +57,7 @@ void lv2_event_queue::save_ptr(utils::serial& ar, lv2_event_queue* q)
|
||||
ar(q->id);
|
||||
}
|
||||
|
||||
std::shared_ptr<lv2_event_queue> lv2_event_queue::load_ptr(utils::serial& ar, std::shared_ptr<lv2_event_queue>& queue)
|
||||
std::shared_ptr<lv2_event_queue> lv2_event_queue::load_ptr(utils::serial& ar, std::shared_ptr<lv2_event_queue>& queue, std::string_view msg)
|
||||
{
|
||||
const u32 id = ar.operator u32();
|
||||
|
||||
@ -72,10 +72,20 @@ std::shared_ptr<lv2_event_queue> lv2_event_queue::load_ptr(utils::serial& ar, st
|
||||
return q;
|
||||
}
|
||||
|
||||
Emu.DeferDeserialization([id, &queue]()
|
||||
if (id >> 24 != id_base >> 24)
|
||||
{
|
||||
fmt::throw_exception("Failed in event queue pointer deserialization (invalid ID): location: %s, id=0x%x", msg, id);
|
||||
}
|
||||
|
||||
Emu.DeferDeserialization([id, &queue, msg_str = std::string{msg}]()
|
||||
{
|
||||
// Defer resolving
|
||||
queue = ensure(idm::get_unlocked<lv2_obj, lv2_event_queue>(id));
|
||||
queue = idm::get_unlocked<lv2_obj, lv2_event_queue>(id);
|
||||
|
||||
if (!queue)
|
||||
{
|
||||
fmt::throw_exception("Failed in event queue pointer deserialization (not found): location: %s, id=0x%x", msg_str, id);
|
||||
}
|
||||
});
|
||||
|
||||
// Null until resolved
|
||||
@ -85,7 +95,7 @@ std::shared_ptr<lv2_event_queue> lv2_event_queue::load_ptr(utils::serial& ar, st
|
||||
lv2_event_port::lv2_event_port(utils::serial& ar)
|
||||
: type(ar)
|
||||
, name(ar)
|
||||
, queue(lv2_event_queue::load_ptr(ar, queue))
|
||||
, queue(lv2_event_queue::load_ptr(ar, queue, "eventport"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ struct lv2_event_queue final : public lv2_obj
|
||||
static std::shared_ptr<void> load(utils::serial& ar);
|
||||
void save(utils::serial& ar);
|
||||
static void save_ptr(utils::serial&, lv2_event_queue*);
|
||||
static std::shared_ptr<lv2_event_queue> load_ptr(utils::serial& ar, std::shared_ptr<lv2_event_queue>& queue);
|
||||
static std::shared_ptr<lv2_event_queue> load_ptr(utils::serial& ar, std::shared_ptr<lv2_event_queue>& queue, std::string_view msg = {});
|
||||
|
||||
CellError send(lv2_event event);
|
||||
|
||||
|
@ -111,9 +111,9 @@ lv2_rsxaudio::lv2_rsxaudio(utils::serial& ar) noexcept
|
||||
{
|
||||
ar(shmem);
|
||||
|
||||
for (const auto& port : event_queue)
|
||||
for (auto& port : event_queue)
|
||||
{
|
||||
lv2_event_queue::save_ptr(ar, port.get());
|
||||
port = lv2_event_queue::load_ptr(ar, port, "rsxaudio");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,9 +128,9 @@ void lv2_rsxaudio::save(utils::serial& ar)
|
||||
{
|
||||
ar(shmem);
|
||||
|
||||
for (auto& port : event_queue)
|
||||
for (const auto& port : event_queue)
|
||||
{
|
||||
port = lv2_event_queue::load_ptr(ar, port);
|
||||
lv2_event_queue::save_ptr(ar, port.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ struct lv2_timer_thread
|
||||
lv2_timer::lv2_timer(utils::serial& ar)
|
||||
: lv2_obj{1}
|
||||
, state(ar)
|
||||
, port(lv2_event_queue::load_ptr(ar, port))
|
||||
, port(lv2_event_queue::load_ptr(ar, port, "timer"))
|
||||
, source(ar)
|
||||
, data1(ar)
|
||||
, data2(ar)
|
||||
|
Loading…
Reference in New Issue
Block a user