From cab8a1f3c585c3d4756cfd18ad33d9aa69548b5e Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:40:19 +0100 Subject: [PATCH] add config option to enable/disable boot sound, don't play during OSScreen section --- src/Cafe/HW/Latte/Core/LatteThread.cpp | 11 ++++++++--- src/config/CemuConfig.cpp | 2 ++ src/config/CemuConfig.h | 1 + src/gui/GeneralSettings2.cpp | 8 ++++++++ src/gui/GeneralSettings2.h | 1 + 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteThread.cpp b/src/Cafe/HW/Latte/Core/LatteThread.cpp index 8710a7543..9e79addca 100644 --- a/src/Cafe/HW/Latte/Core/LatteThread.cpp +++ b/src/Cafe/HW/Latte/Core/LatteThread.cpp @@ -185,9 +185,16 @@ int Latte_ThreadEntry() // before doing anything with game specific shaders, we need to wait for graphic packs to finish loading GraphicPack2::WaitUntilReady(); - LatteThread_InitBootSound(); + // initialise resources for playing bootup sound + if(GetConfig().play_boot_sound) + LatteThread_InitBootSound(); + // load disk shader cache LatteShaderCache_Load(); + + // free resources for playing boot sound + LatteThread_ShutdownBootSound(); + // init registers Latte_LoadInitialRegisters(); // let CPU thread know the GPU is done initializing @@ -198,11 +205,9 @@ int Latte_ThreadEntry() std::this_thread::yield(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); LatteThread_HandleOSScreen(); - LatteThread_StreamBootSound(); if (Latte_GetStopSignal()) LatteThread_Exit(); } - LatteThread_ShutdownBootSound(); gxRingBufferReadPtr = gx2WriteGatherPipe.gxRingBuffer; LatteCP_ProcessRingbuffer(); cemu_assert_debug(false); // should never reach diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index 1801759af..a47e87376 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -63,6 +63,7 @@ void CemuConfig::Load(XMLConfigParser& parser) fullscreen = parser.get("fullscreen", fullscreen); proxy_server = parser.get("proxy_server", ""); disable_screensaver = parser.get("disable_screensaver", disable_screensaver); + play_boot_sound = parser.get("play_boot_sound", play_boot_sound); console_language = parser.get("console_language", console_language.GetInitValue()); window_position.x = parser.get("window_position").get("x", -1); @@ -364,6 +365,7 @@ void CemuConfig::Save(XMLConfigParser& parser) config.set("fullscreen", fullscreen); config.set("proxy_server", proxy_server.GetValue().c_str()); config.set("disable_screensaver", disable_screensaver); + config.set("play_boot_sound", play_boot_sound); // config.set("cpu_mode", cpu_mode.GetValue()); //config.set("console_region", console_region.GetValue()); diff --git a/src/config/CemuConfig.h b/src/config/CemuConfig.h index fe6040d46..78dd0857d 100644 --- a/src/config/CemuConfig.h +++ b/src/config/CemuConfig.h @@ -378,6 +378,7 @@ struct CemuConfig #endif ConfigValue disable_screensaver{DISABLE_SCREENSAVER_DEFAULT}; #undef DISABLE_SCREENSAVER_DEFAULT + ConfigValue play_boot_sound{true}; std::vector game_paths; std::mutex game_cache_entries_mutex; diff --git a/src/gui/GeneralSettings2.cpp b/src/gui/GeneralSettings2.cpp index f8493b10d..5f0449ac1 100644 --- a/src/gui/GeneralSettings2.cpp +++ b/src/gui/GeneralSettings2.cpp @@ -182,8 +182,13 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook) m_disable_screensaver->SetToolTip(_("Prevents the system from activating the screen saver or going to sleep while running a game.")); second_row->Add(m_disable_screensaver, 0, botflag, 5); + m_play_boot_sound = new wxCheckBox(box, wxID_ANY, _("Enable intro sound")); + m_play_boot_sound->SetToolTip(_("Play bootSound file while compiling shaders/pipelines.")); + second_row->Add(m_play_boot_sound, 0, botflag, 5); + // Enable/disable feral interactive gamemode #if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE) + second_row->AddSpacer(10); m_feral_gamemode = new wxCheckBox(box, wxID_ANY, _("Enable Feral GameMode")); m_feral_gamemode->SetToolTip(_("Use FeralInteractive GameMode if installed.")); second_row->Add(m_feral_gamemode, 0, botflag, 5); @@ -912,6 +917,8 @@ void GeneralSettings2::StoreConfig() ScreenSaver::SetInhibit(config.disable_screensaver); } + config.play_boot_sound = m_play_boot_sound->IsChecked(); + if (!LaunchSettings::GetMLCPath().has_value()) config.SetMLCPath(wxHelper::MakeFSPath(m_mlc_path->GetValue()), false); @@ -1518,6 +1525,7 @@ void GeneralSettings2::ApplyConfig() m_permanent_storage->SetValue(config.permanent_storage); m_disable_screensaver->SetValue(config.disable_screensaver); + m_play_boot_sound->SetValue(config.play_boot_sound); #if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE) m_feral_gamemode->SetValue(config.feral_gamemode); #endif diff --git a/src/gui/GeneralSettings2.h b/src/gui/GeneralSettings2.h index 2846af38a..461abf2cf 100644 --- a/src/gui/GeneralSettings2.h +++ b/src/gui/GeneralSettings2.h @@ -44,6 +44,7 @@ class GeneralSettings2 : public wxDialog wxCheckBox* m_auto_update, *m_save_screenshot; wxCheckBox* m_permanent_storage; wxCheckBox* m_disable_screensaver; + wxCheckBox* m_play_boot_sound; #if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE) wxCheckBox* m_feral_gamemode; #endif