From fd6aeefd93ec126b79f3e02d61a2454b8ff6fbf2 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 30 Aug 2023 18:19:49 +1000 Subject: [PATCH] Settings: Add netplay layer --- src/common/layered_settings_interface.h | 3 ++- src/core/host_settings.h | 3 +++ src/frontend-common/host_settings.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/layered_settings_interface.h b/src/common/layered_settings_interface.h index ec46ca56a..32bc94704 100644 --- a/src/common/layered_settings_interface.h +++ b/src/common/layered_settings_interface.h @@ -10,6 +10,7 @@ class LayeredSettingsInterface final : public SettingsInterface public: enum Layer : u32 { + LAYER_NETPLAY, LAYER_CMDLINE, LAYER_GAME, LAYER_INPUT, @@ -61,7 +62,7 @@ public: using SettingsInterface::GetUIntValue; private: - static constexpr Layer FIRST_LAYER = LAYER_CMDLINE; + static constexpr Layer FIRST_LAYER = LAYER_NETPLAY; static constexpr Layer LAST_LAYER = LAYER_BASE; std::array m_layers{}; diff --git a/src/core/host_settings.h b/src/core/host_settings.h index 384a98ab6..18e34cf1b 100644 --- a/src/core/host_settings.h +++ b/src/core/host_settings.h @@ -69,5 +69,8 @@ void SetGameSettingsLayer(SettingsInterface* sif); /// Sets the input profile settings layer. Called by VMManager when the game changes. void SetInputSettingsLayer(SettingsInterface* sif); + +/// Sets the netplay settings layer. Use once a session is established. +void SetNetplaySettingsLayer(SettingsInterface* sif); } // namespace Internal } // namespace Host \ No newline at end of file diff --git a/src/frontend-common/host_settings.cpp b/src/frontend-common/host_settings.cpp index c342174e2..46df5b203 100644 --- a/src/frontend-common/host_settings.cpp +++ b/src/frontend-common/host_settings.cpp @@ -190,3 +190,9 @@ void Host::Internal::SetInputSettingsLayer(SettingsInterface* sif) std::unique_lock lock(s_settings_mutex); s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_INPUT, sif); } + +void Host::Internal::SetNetplaySettingsLayer(SettingsInterface* sif) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_NETPLAY, sif); +}