mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-14 21:25:45 -04:00
Qt: Fix directory setting changes
This commit is contained in:
@ -66,8 +66,5 @@ void SetGameSettingsLayer(SettingsInterface* sif);
|
||||
|
||||
/// Sets the input profile settings layer. Called by VMManager when the game changes.
|
||||
void SetInputSettingsLayer(SettingsInterface* sif);
|
||||
|
||||
/// Updates the variables in the EmuFolders namespace, reloading subsystems if needed. Must call with the lock held.
|
||||
void UpdateEmuFolders();
|
||||
} // namespace Internal
|
||||
} // namespace Host
|
@ -9,6 +9,8 @@
|
||||
#include "controller.h"
|
||||
#include "host.h"
|
||||
#include "host_display.h"
|
||||
#include "host_settings.h"
|
||||
#include "system.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
@ -1230,6 +1232,26 @@ void EmuFolders::Save(SettingsInterface& si)
|
||||
si.SetStringValue("Folders", "Textures", Path::MakeRelative(Textures, DataRoot).c_str());
|
||||
}
|
||||
|
||||
void EmuFolders::Update()
|
||||
{
|
||||
const std::string old_gamesettings(EmuFolders::GameSettings);
|
||||
const std::string old_inputprofiles(EmuFolders::InputProfiles);
|
||||
const std::string old_memorycards(EmuFolders::MemoryCards);
|
||||
|
||||
// have to manually grab the lock here, because of the ReloadGameSettings() below.
|
||||
{
|
||||
auto lock = Host::GetSettingsLock();
|
||||
LoadConfig(*Host::Internal::GetBaseSettingsLayer());
|
||||
EnsureFoldersExist();
|
||||
}
|
||||
|
||||
if (old_gamesettings != EmuFolders::GameSettings || old_inputprofiles != EmuFolders::InputProfiles)
|
||||
System::ReloadGameSettings(false);
|
||||
|
||||
if (System::IsValid() && old_memorycards != EmuFolders::MemoryCards)
|
||||
System::UpdateMemoryCardTypes();
|
||||
}
|
||||
|
||||
bool EmuFolders::EnsureFoldersExist()
|
||||
{
|
||||
bool result = FileSystem::EnsureDirectoryExists(Bios.c_str(), false);
|
||||
|
@ -445,4 +445,7 @@ void SetDefaults();
|
||||
bool EnsureFoldersExist();
|
||||
void LoadConfig(SettingsInterface& si);
|
||||
void Save(SettingsInterface& si);
|
||||
|
||||
/// Updates the variables in the EmuFolders namespace, reloading subsystems if needed.
|
||||
void Update();
|
||||
} // namespace EmuFolders
|
||||
|
Reference in New Issue
Block a user