From 9ab1e6969762f54b3649523a2fe95bb55666f2f8 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 1 Jun 2022 20:26:53 +0200 Subject: [PATCH] cellAudioOut: simplify sfo access and make it foolproof --- rpcs3/Emu/Cell/Modules/cellAudioOut.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp index 9b08176863..478cc849cc 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp @@ -39,10 +39,8 @@ audio_out_configuration::audio_out_configuration() std::vector& primary_modes = primary_output.sound_modes; std::vector& secondary_modes = secondary_output.sound_modes; - s32 sound_format = (1 << 0); // Linear PCM 2 Ch. - - const psf::registry psf = psf::load_object(fs::file(Emu.GetSfoDir() + "/PARAM.SFO")); - if (psf.contains("SOUND_FORMAT")) sound_format = psf.at("SOUND_FORMAT").as_integer(); + const psf::registry sfo = psf::load_object(fs::file(Emu.GetSfoDir() + "/PARAM.SFO")); + const s32 sound_format = psf::get_integer(sfo, "SOUND_FORMAT", psf::sound_format_flag::lpcm_2); // Default to Linear PCM 2 Ch. const bool supports_lpcm_2 = (sound_format & psf::sound_format_flag::lpcm_2); // Linear PCM 2 Ch. const bool supports_lpcm_5_1 = (sound_format & psf::sound_format_flag::lpcm_5_1); // Linear PCM 5.1 Ch.