Savestates: Fix audio_out_configuration initialization

This commit is contained in:
Eladash 2023-12-28 18:39:42 +02:00 committed by Elad Ashkenazi
parent f696107c90
commit d78bbbf69a
4 changed files with 11 additions and 18 deletions

View File

@ -678,9 +678,10 @@ void cell_audio_thread::reset_counters()
cell_audio_thread::cell_audio_thread() cell_audio_thread::cell_audio_thread()
{ {
// Initialize dependencies }
g_fxo->need<audio_out_configuration>();
void cell_audio_thread::operator()()
{
// Initialize loop variables (regardless of provider in order to initialize timestamps) // Initialize loop variables (regardless of provider in order to initialize timestamps)
reset_counters(); reset_counters();
@ -694,14 +695,6 @@ cell_audio_thread::cell_audio_thread()
// Allocate ringbuffer // Allocate ringbuffer
ringbuffer.reset(new audio_ringbuffer(cfg)); ringbuffer.reset(new audio_ringbuffer(cfg));
}
void cell_audio_thread::operator()()
{
if (cfg.raw.provider != audio_provider::cell_audio)
{
return;
}
thread_ctrl::scoped_priority high_prio(+1); thread_ctrl::scoped_priority high_prio(+1);

View File

@ -1306,9 +1306,6 @@ namespace audio
rsxaudio_backend_thread::rsxaudio_backend_thread() rsxaudio_backend_thread::rsxaudio_backend_thread()
{ {
// Initialize dependencies
g_fxo->need<audio_out_configuration>();
new_emu_cfg = get_emu_cfg(); new_emu_cfg = get_emu_cfg();
const u64 new_vol = g_cfg.audio.volume; const u64 new_vol = g_cfg.audio.volume;

View File

@ -463,6 +463,8 @@ public:
static constexpr auto thread_name = "RsxAudio Backend Thread"sv; static constexpr auto thread_name = "RsxAudio Backend Thread"sv;
SAVESTATE_INIT_POS(8.91); // Depends on audio_out_configuration
private: private:
struct emu_audio_cfg struct emu_audio_cfg

View File

@ -85,12 +85,13 @@ namespace stx
if constexpr (std::is_constructible_v<T, exact_t<manual_typemap&>, exact_t<utils::serial&>>) if constexpr (std::is_constructible_v<T, exact_t<manual_typemap&>, exact_t<utils::serial&>>)
{ {
g_tls_serialize_name = name; g_tls_serialize_name = name;
new (ptr) T(_this, exact_t<utils::serial&>(*ar)); new (ptr) T(exact_t<manual_typemap&>(_this), exact_t<utils::serial&>(*ar));
return true; return true;
} }
if constexpr (std::is_constructible_v<T, exact_t<const launch_retainer&>, exact_t<utils::serial&>>) if constexpr (std::is_constructible_v<T, exact_t<const launch_retainer&>, exact_t<utils::serial&>>)
{ {
g_tls_serialize_name = name;
new (ptr) T(exact_t<const launch_retainer&>(launch_retainer{}), exact_t<utils::serial&>(*ar)); new (ptr) T(exact_t<const launch_retainer&>(launch_retainer{}), exact_t<utils::serial&>(*ar));
return true; return true;
} }
@ -106,7 +107,7 @@ namespace stx
// Allow passing reference to "this" // Allow passing reference to "this"
if constexpr (std::is_constructible_v<T, exact_t<manual_typemap&>>) if constexpr (std::is_constructible_v<T, exact_t<manual_typemap&>>)
{ {
new (ptr) T(_this); new (ptr) T(exact_t<manual_typemap&>(_this));
return true; return true;
} }
@ -400,14 +401,14 @@ namespace stx
} }
// Check if object is not initialized but shall be initialized first (to use in initializing other objects) // Check if object is not initialized but shall be initialized first (to use in initializing other objects)
template <typename T> requires (std::is_constructible_v<T, manual_typemap&> || std::is_default_constructible_v<T>) template <typename T> requires (!std::is_constructible_v<T, exact_t<utils::serial&>> && (std::is_constructible_v<T, exact_t<manual_typemap&>> || std::is_default_constructible_v<T>))
void need() noexcept void need() noexcept
{ {
if (!m_init[stx::typeindex<typeinfo, std::decay_t<T>>()]) if (!m_init[stx::typeindex<typeinfo, std::decay_t<T>>()])
{ {
if constexpr (std::is_constructible_v<T, manual_typemap&>) if constexpr (std::is_constructible_v<T, exact_t<manual_typemap&>>)
{ {
init<T>(*this); init<T>(exact_t<manual_typemap&>(*this));
return; return;
} }