diff --git a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp index 41d43c6a3a..9b08176863 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp @@ -44,11 +44,11 @@ audio_out_configuration::audio_out_configuration() 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 bool supports_lpcm_2 = (sound_format & (1 << 0)); // Linear PCM 2 Ch. - const bool supports_lpcm_5_1 = (sound_format & (1 << 2)); // Linear PCM 5.1 Ch. - const bool supports_lpcm_7_1 = (sound_format & (1 << 4)); // Linear PCM 7.1 Ch. - const bool supports_ac3 = (sound_format & (1 << 8)); // Dolby Digital 5.1 Ch. - const bool supports_dts = (sound_format & (1 << 9)); // DTS 5.1 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. + const bool supports_lpcm_7_1 = (sound_format & psf::sound_format_flag::lpcm_7_1); // Linear PCM 7.1 Ch. + const bool supports_ac3 = (sound_format & psf::sound_format_flag::ac3); // Dolby Digital 5.1 Ch. + const bool supports_dts = (sound_format & psf::sound_format_flag::dts); // DTS 5.1 Ch. if (supports_lpcm_2) cellSysutil.notice("cellAudioOut: found support for Linear PCM 2 Ch."); if (supports_lpcm_5_1) cellSysutil.notice("cellAudioOut: found support for Linear PCM 5.1 Ch."); diff --git a/rpcs3/Loader/PSF.h b/rpcs3/Loader/PSF.h index 707d6f7e34..ab2f132524 100644 --- a/rpcs3/Loader/PSF.h +++ b/rpcs3/Loader/PSF.h @@ -12,6 +12,15 @@ namespace fs namespace psf { + enum sound_format_flag : s32 + { + lpcm_2 = 1 << 0, // Linear PCM 2 Ch. + lpcm_5_1 = 1 << 2, // Linear PCM 5.1 Ch. + lpcm_7_1 = 1 << 4, // Linear PCM 7.1 Ch. + ac3 = 1 << 8, // Dolby Digital 5.1 Ch. + dts = 1 << 9, // DTS 5.1 Ch. + }; + enum class format : u16 { array = 0x0004, // claimed to be a non-NTS string (char array) diff --git a/rpcs3/rpcs3qt/localized.cpp b/rpcs3/rpcs3qt/localized.cpp index 2cd89a33ea..c395cfa39a 100644 --- a/rpcs3/rpcs3qt/localized.cpp +++ b/rpcs3/rpcs3qt/localized.cpp @@ -1,4 +1,5 @@ #include "localized.h" +#include "Loader/PSF.h" QString Localized::GetVerboseTimeByMs(quint64 elapsed_ms, bool show_days) const { @@ -45,3 +46,14 @@ QString Localized::GetVerboseTimeByMs(quint64 elapsed_ms, bool show_days) const return str_seconds; } + +Localized::sound::sound() + : format({ + { psf::sound_format_flag::lpcm_2, tr("LPCM 2.0") }, + { psf::sound_format_flag::lpcm_5_1, tr("LPCM 5.1") }, + { psf::sound_format_flag::lpcm_7_1, tr("LPCM 7.1") }, + { psf::sound_format_flag::ac3, tr("Dolby Digital 5.1") }, + { psf::sound_format_flag::dts, tr("DTS 5.1") }, + }) +{ +} diff --git a/rpcs3/rpcs3qt/localized.h b/rpcs3/rpcs3qt/localized.h index 543f0c2fd5..022f00b2e7 100644 --- a/rpcs3/rpcs3qt/localized.h +++ b/rpcs3/rpcs3qt/localized.h @@ -124,14 +124,7 @@ public: const struct sound { - const std::map format - { - { 1 << 0, tr("LPCM 2.0") }, - //{ 1 << 1, tr("LPCM ???") }, - { 1 << 2, tr("LPCM 5.1") }, - { 1 << 4, tr("LPCM 7.1") }, - { 1 << 8, tr("Dolby Digital 5.1") }, - { 1 << 9, tr("DTS 5.1") }, - }; + sound(); + const std::map format; } sound; }; diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 4be66e5c9a..bfc7bc0afd 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -28,6 +28,8 @@ #include "Emu/system_config.h" #include "Emu/title.h" +#include "Loader/PSF.h" + #include #include #include @@ -963,11 +965,11 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std { const std::map> formats { - { 1 << 0, { audio_format::lpcm_2_48khz } }, - { 1 << 2, { audio_format::lpcm_5_1_48khz } }, - { 1 << 4, { audio_format::lpcm_7_1_48khz } }, - { 1 << 8, { audio_format::ac3 } }, - { 1 << 9, { audio_format::dts } }, + { psf::sound_format_flag::lpcm_2, { audio_format::lpcm_2_48khz } }, + { psf::sound_format_flag::lpcm_5_1, { audio_format::lpcm_5_1_48khz } }, + { psf::sound_format_flag::lpcm_7_1, { audio_format::lpcm_7_1_48khz } }, + { psf::sound_format_flag::ac3, { audio_format::ac3 } }, + { psf::sound_format_flag::dts, { audio_format::dts } }, }; const int saved_index = ui->combo_audio_format->currentIndex();