From d78bbbf69a435db77371affee012100180775aa6 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:39:42 +0200 Subject: [PATCH] Savestates: Fix audio_out_configuration initialization --- rpcs3/Emu/Cell/Modules/cellAudio.cpp | 13 +++---------- rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp | 3 --- rpcs3/Emu/Cell/lv2/sys_rsxaudio.h | 2 ++ rpcs3/util/fixed_typemap.hpp | 11 ++++++----- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index ab217fa5b0..76e75e2146 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -678,9 +678,10 @@ void cell_audio_thread::reset_counters() cell_audio_thread::cell_audio_thread() { - // Initialize dependencies - g_fxo->need(); +} +void cell_audio_thread::operator()() +{ // Initialize loop variables (regardless of provider in order to initialize timestamps) reset_counters(); @@ -694,14 +695,6 @@ cell_audio_thread::cell_audio_thread() // Allocate ringbuffer 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); diff --git a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp index 9343b925f5..bdfda23c2b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp @@ -1306,9 +1306,6 @@ namespace audio rsxaudio_backend_thread::rsxaudio_backend_thread() { - // Initialize dependencies - g_fxo->need(); - new_emu_cfg = get_emu_cfg(); const u64 new_vol = g_cfg.audio.volume; diff --git a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h index fc02a12733..0e0b6327ef 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h +++ b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h @@ -463,6 +463,8 @@ public: static constexpr auto thread_name = "RsxAudio Backend Thread"sv; + SAVESTATE_INIT_POS(8.91); // Depends on audio_out_configuration + private: struct emu_audio_cfg diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index fac3208cfd..0e302bfad7 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -85,12 +85,13 @@ namespace stx if constexpr (std::is_constructible_v, exact_t>) { g_tls_serialize_name = name; - new (ptr) T(_this, exact_t(*ar)); + new (ptr) T(exact_t(_this), exact_t(*ar)); return true; } if constexpr (std::is_constructible_v, exact_t>) { + g_tls_serialize_name = name; new (ptr) T(exact_t(launch_retainer{}), exact_t(*ar)); return true; } @@ -106,7 +107,7 @@ namespace stx // Allow passing reference to "this" if constexpr (std::is_constructible_v>) { - new (ptr) T(_this); + new (ptr) T(exact_t(_this)); 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) - template requires (std::is_constructible_v || std::is_default_constructible_v) + template requires (!std::is_constructible_v> && (std::is_constructible_v> || std::is_default_constructible_v)) void need() noexcept { if (!m_init[stx::typeindex>()]) { - if constexpr (std::is_constructible_v) + if constexpr (std::is_constructible_v>) { - init(*this); + init(exact_t(*this)); return; }