Windows default to non-portable + Reworked MLC handling and related UI (#1252)

This commit is contained in:
Exzap 2024-07-23 03:13:36 +02:00 committed by GitHub
parent 7522c8470e
commit 64232ffdbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 515 additions and 651 deletions

View file

@ -7,41 +7,47 @@
#include "config/LaunchSettings.h"
#include "util/helpers/helpers.h"
std::set<fs::path>
ActiveSettings::LoadOnce(
const fs::path& executablePath,
const fs::path& userDataPath,
const fs::path& configPath,
const fs::path& cachePath,
const fs::path& dataPath)
void ActiveSettings::SetPaths(bool isPortableMode,
const fs::path& executablePath,
const fs::path& userDataPath,
const fs::path& configPath,
const fs::path& cachePath,
const fs::path& dataPath,
std::set<fs::path>& failedWriteAccess)
{
cemu_assert_debug(!s_setPathsCalled); // can only change paths before loading
s_isPortableMode = isPortableMode;
s_executable_path = executablePath;
s_user_data_path = userDataPath;
s_config_path = configPath;
s_cache_path = cachePath;
s_data_path = dataPath;
std::set<fs::path> failed_write_access;
failedWriteAccess.clear();
for (auto&& path : {userDataPath, configPath, cachePath})
{
if (!fs::exists(path))
{
std::error_code ec;
std::error_code ec;
if (!fs::exists(path, ec))
fs::create_directories(path, ec);
}
if (!TestWriteAccess(path))
{
cemuLog_log(LogType::Force, "Failed to write to {}", _pathToUtf8(path));
failed_write_access.insert(path);
failedWriteAccess.insert(path);
}
}
s_executable_filename = s_executable_path.filename();
s_setPathsCalled = true;
}
g_config.SetFilename(GetConfigPath("settings.xml").generic_wstring());
g_config.Load();
[[nodiscard]] bool ActiveSettings::IsPortableMode()
{
return s_isPortableMode;
}
void ActiveSettings::Init()
{
cemu_assert_debug(s_setPathsCalled);
std::string additionalErrorInfo;
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
return failed_write_access;
}
bool ActiveSettings::LoadSharedLibrariesEnabled()
@ -229,6 +235,7 @@ bool ActiveSettings::ForceSamplerRoundToPrecision()
fs::path ActiveSettings::GetMlcPath()
{
cemu_assert_debug(s_setPathsCalled);
if(const auto launch_mlc = LaunchSettings::GetMLCPath(); launch_mlc.has_value())
return launch_mlc.value();
@ -238,6 +245,17 @@ fs::path ActiveSettings::GetMlcPath()
return GetDefaultMLCPath();
}
bool ActiveSettings::IsCustomMlcPath()
{
cemu_assert_debug(s_setPathsCalled);
return !GetConfig().mlc_path.GetValue().empty();
}
bool ActiveSettings::IsCommandLineMlcPath()
{
return LaunchSettings::GetMLCPath().has_value();
}
fs::path ActiveSettings::GetDefaultMLCPath()
{
return GetUserDataPath("mlc01");