From 0ead1430137478a078bf13ed83e77e119baab523 Mon Sep 17 00:00:00 2001 From: The Dax Date: Wed, 14 Aug 2013 14:36:54 -0400 Subject: [PATCH] Overhaul the sound fix. It was rooted deeper than I thought. This should cover all complaints now(except pressing escape which discards any settings changed: is this by design? :\). Also add new menu option to Win32 UI under Emulation to control whether Atrac 3 should be on/off. --- UI/GameSettingsScreen.cpp | 8 ++++++++ UI/GameSettingsScreen.h | 2 +- UI/MenuScreens.cpp | 13 +++++++++---- Windows/WndMainWindow.cpp | 19 +++++++++++++++++++ Windows/ppsspp.rc | Bin 40070 -> 40202 bytes Windows/resource.h | Bin 21856 -> 21952 bytes 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 5e9f554112..1f1878719f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -335,6 +335,14 @@ UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) { if(PSP_IsInited() && !IsAudioInitialised()) Audio_Init(); } + // It doesn't matter if audio is inited or not, it'll still output no sound + // if the mixer isn't available, so go ahead and init/shutdown at our leisure. + if(Atrac3plus_Decoder::IsInstalled()) { + if(g_Config.bEnableAtrac3plus) + Atrac3plus_Decoder::Init(); + else Atrac3plus_Decoder::Shutdown(); + } + return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index d93ac6f751..b682adc906 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -43,7 +43,7 @@ private: UI::EventReturn OnDownloadPlugin(UI::EventParams &e); UI::EventReturn OnControlMapping(UI::EventParams &e); UI::EventReturn OnBack(UI::EventParams &e); - + // Temporaries to convert bools to int settings bool cap60FPS_; }; diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index a4c4b812e1..a84f337c2b 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -861,14 +861,19 @@ void AudioScreen::render() { int columnw = 400; UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound); if (g_Config.bEnableSound) { - if (Atrac3plus_Decoder::IsInstalled()) { - UICheckBox(GEN_ID, x, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus); - } - + if(PSP_IsInited() && !IsAudioInitialised()) { Audio_Init(); } + if (Atrac3plus_Decoder::IsInstalled()) { + UICheckBox(GEN_ID, x, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus); + + if(g_Config.bEnableAtrac3plus) + Atrac3plus_Decoder::Init(); + else Atrac3plus_Decoder::Shutdown(); + } + // Show the download button even if not installed - might want to upgrade. VLinear vlinear(30, 400, 20); std::string atracString; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 5f9fc46ef6..9d29aaf52d 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -42,6 +42,7 @@ #include "Core/SaveState.h" #include "Core/System.h" #include "Core/Config.h" +#include "Core/HW/atrac3plus.h" #include "Windows/EmuThread.h" #include "resource.h" @@ -1029,6 +1030,23 @@ namespace MainWindow case ID_EMULATION_SOUND: g_Config.bEnableSound = !g_Config.bEnableSound; + if(!g_Config.bEnableSound) { + EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED); + if(!IsAudioInitialised()) + Audio_Init(); + } + else + EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED); + break; + + case ID_EMULATION_ATRAC3_SOUND: + g_Config.bEnableAtrac3plus = !g_Config.bEnableAtrac3plus; + + if(Atrac3plus_Decoder::IsInstalled()) { + if(g_Config.bEnableAtrac3plus) + Atrac3plus_Decoder::Init(); + else Atrac3plus_Decoder::Shutdown(); + } break; case ID_HELP_OPENWEBSITE: @@ -1217,6 +1235,7 @@ namespace MainWindow CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost); CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound); CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize); + CHECKITEM(ID_EMULATION_ATRAC3_SOUND, g_Config.bEnableAtrac3plus); static const int zoomitems[4] = { ID_OPTIONS_SCREEN1X, diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index c287ade3ef090e5e0d91bd19dc0cd52ef919828b..6d592f5a57a2786d6e27ff896436b7f82a32e6c7 100644 GIT binary patch delta 52 zcmZqM$<(!rX~UMJ$;)O)@H#S-FcdK)G9)t?GiXo#SSUNWAxVVWks*X3h{2J;nZbDT I#H6p50N1n-r2qf` delta 18 acmeC$#niTwX~UMJ$yq6Jo2Mn0SONf1t_WrT diff --git a/Windows/resource.h b/Windows/resource.h index baede30ca5f639d58949a4ddfe9183426bf7b9ee..2fb2a7fb35366738d638df5e7e4baf1a58507cee 100644 GIT binary patch delta 70 zcmV-M0J;C*ssX^O0kDu!ljuzrlfVcR6+r-008#)!07C#X0AB!808ao_08W$PEEAKG cQWCS2Q3e44Gm$YFli)56lg>p3v&d4I0yS3_*#H0l delta 30 ocmV+(0O9|@s{!Du0kDu!v+z+00h8)c3XwVxlfXq3vnW%T0@*_huK)l5