CommonHostInterface: Move settings interface pointer to base class
This commit is contained in:
@@ -38,6 +38,9 @@ const char* NoGUIHostInterface::GetFrontendName() const
|
||||
|
||||
bool NoGUIHostInterface::Initialize()
|
||||
{
|
||||
SetUserDirectory();
|
||||
m_settings_interface = std::make_unique<INISettingsInterface>(GetSettingsFileName());
|
||||
|
||||
// TODO: Make command line.
|
||||
m_fullscreen_ui_enabled = true;
|
||||
|
||||
@@ -81,52 +84,6 @@ void NoGUIHostInterface::Shutdown()
|
||||
DestroyPlatformWindow();
|
||||
}
|
||||
|
||||
std::string NoGUIHostInterface::GetStringSettingValue(const char* section, const char* key,
|
||||
const char* default_value /*= ""*/)
|
||||
{
|
||||
return m_settings_interface->GetStringValue(section, key, default_value);
|
||||
}
|
||||
|
||||
bool NoGUIHostInterface::GetBoolSettingValue(const char* section, const char* key, bool default_value /* = false */)
|
||||
{
|
||||
return m_settings_interface->GetBoolValue(section, key, default_value);
|
||||
}
|
||||
|
||||
int NoGUIHostInterface::GetIntSettingValue(const char* section, const char* key, int default_value /* = 0 */)
|
||||
{
|
||||
return m_settings_interface->GetIntValue(section, key, default_value);
|
||||
}
|
||||
|
||||
float NoGUIHostInterface::GetFloatSettingValue(const char* section, const char* key, float default_value /* = 0.0f */)
|
||||
{
|
||||
return m_settings_interface->GetFloatValue(section, key, default_value);
|
||||
}
|
||||
|
||||
void NoGUIHostInterface::LoadSettings()
|
||||
{
|
||||
m_settings_interface = std::make_unique<INISettingsInterface>(GetSettingsFileName());
|
||||
|
||||
if (!CommonHostInterface::CheckSettings(*m_settings_interface.get()))
|
||||
AddOSDMessage("Settings version mismatch, settings have been reset to defaults.", 30.0f);
|
||||
|
||||
CommonHostInterface::LoadSettings(*m_settings_interface.get());
|
||||
CommonHostInterface::FixIncompatibleSettings(false);
|
||||
}
|
||||
|
||||
void NoGUIHostInterface::UpdateInputMap()
|
||||
{
|
||||
CommonHostInterface::UpdateInputMap(*m_settings_interface.get());
|
||||
}
|
||||
|
||||
void NoGUIHostInterface::ApplySettings(bool display_osd_messages)
|
||||
{
|
||||
Settings old_settings(std::move(g_settings));
|
||||
CommonHostInterface::LoadSettings(*m_settings_interface.get());
|
||||
CommonHostInterface::ApplyGameSettings(display_osd_messages);
|
||||
CommonHostInterface::FixIncompatibleSettings(display_osd_messages);
|
||||
CheckForSettingsChanges(old_settings);
|
||||
}
|
||||
|
||||
void NoGUIHostInterface::CreateImGuiContext()
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
|
||||
@@ -29,13 +29,7 @@ public:
|
||||
void ReportError(const char* message) override;
|
||||
bool ConfirmMessage(const char* message) override;
|
||||
|
||||
std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = "") override;
|
||||
bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false) override;
|
||||
int GetIntSettingValue(const char* section, const char* key, int default_value = 0) override;
|
||||
float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f) override;
|
||||
|
||||
void RunLater(std::function<void()> callback) override;
|
||||
void ApplySettings(bool display_osd_messages) override;
|
||||
|
||||
protected:
|
||||
enum : u32
|
||||
@@ -44,13 +38,9 @@ protected:
|
||||
DEFAULT_WINDOW_HEIGHT = 720
|
||||
};
|
||||
|
||||
virtual void LoadSettings() override;
|
||||
|
||||
bool AcquireHostDisplay() override;
|
||||
void ReleaseHostDisplay() override;
|
||||
|
||||
void UpdateInputMap() override;
|
||||
|
||||
void OnSystemCreated() override;
|
||||
void OnSystemPaused(bool paused) override;
|
||||
void OnSystemDestroyed() override;
|
||||
@@ -70,7 +60,6 @@ protected:
|
||||
void CreateImGuiContext();
|
||||
void RunCallbacks();
|
||||
|
||||
std::unique_ptr<INISettingsInterface> m_settings_interface;
|
||||
std::deque<std::function<void()>> m_queued_callbacks;
|
||||
std::mutex m_queued_callbacks_lock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user