Add support for non portable mode (#356)

This commit is contained in:
SSimco 2022-10-11 23:03:26 -07:00 committed by GitHub
parent 2b9edced81
commit d6ba61cf64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 233 additions and 163 deletions

View file

@ -1,6 +1,7 @@
#include "config/ActiveSettings.h"
#include "Cafe/GameProfile/GameProfile.h"
#include "Cemu/Logging/CemuLogging.h"
#include "LaunchSettings.h"
#include "util/helpers/helpers.h"
@ -12,17 +13,41 @@
extern bool alwaysDisplayDRC;
void ActiveSettings::LoadOnce()
std::set<fs::path>
ActiveSettings::LoadOnce(const fs::path& user_data_path,
const fs::path& config_path,
const fs::path& cache_path,
const fs::path& data_path)
{
s_full_path = boost::dll::program_location().generic_wstring();
s_path = s_full_path.parent_path();
s_user_data_path = user_data_path;
s_config_path = config_path;
s_cache_path = cache_path;
s_data_path = data_path;
std::set<fs::path> failed_write_access;
for (auto&& path : {user_data_path, config_path, cache_path})
{
if (!fs::exists(path))
{
std::error_code ec;
fs::create_directories(path, ec);
}
if (!TestWriteAccess(path))
{
cemuLog_log(LogType::Force, "Failed to write to {}", path.generic_string());
failed_write_access.insert(path);
}
}
s_filename = s_full_path.filename();
g_config.SetFilename(GetPath("settings.xml").generic_wstring());
g_config.SetFilename(GetConfigPath("settings.xml").generic_wstring());
g_config.Load();
LaunchSettings::ChangeNetworkServiceURL(GetConfig().account.active_service);
std::wstring additionalErrorInfo;
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
return failed_write_access;
}
bool ActiveSettings::LoadSharedLibrariesEnabled()
@ -226,6 +251,6 @@ fs::path ActiveSettings::GetMlcPath()
fs::path ActiveSettings::GetDefaultMLCPath()
{
return GetPath("mlc01");
return GetUserDataPath("mlc01");
}