[App] Add portable as a launch option in addition to checking for portable.txt existence

This commit is contained in:
Jonathan Goyvaerts 2020-08-07 23:04:53 +02:00 committed by Triang3l
parent 6dc94d9154
commit 92e445f01a
2 changed files with 9 additions and 1 deletions

View File

@ -73,6 +73,10 @@ DEFINE_bool(mount_cache, false, "Enable cache mount", "Storage");
DEFINE_transient_path(target, "",
"Specifies the target .xex or .iso to execute.",
"General");
DEFINE_transient_bool(portable, false,
"Specifies if Xenia should run in portable mode.",
"General");
DECLARE_bool(debug);
DEFINE_bool(discord, true, "Enable Discord rich presence", "General");
@ -215,7 +219,8 @@ int xenia_main(const std::vector<std::string>& args) {
std::filesystem::path storage_root = cvars::storage_root;
if (storage_root.empty()) {
storage_root = xe::filesystem::GetExecutableFolder();
if (!std::filesystem::exists(storage_root / "portable.txt")) {
if (!cvars::portable &&
!std::filesystem::exists(storage_root / "portable.txt")) {
storage_root = xe::filesystem::GetUserFolder();
#if defined(XE_PLATFORM_WIN32) || defined(XE_PLATFORM_LINUX)
storage_root = storage_root / "Xenia";

View File

@ -298,6 +298,9 @@ T* define_cmdvar(const char* name, T* default_value, const char* description) {
DEFINE_CVar(name, default_value, description, category, false, \
std::filesystem::path)
#define DEFINE_transient_bool(name, default_value, description, category) \
DEFINE_CVar(name, default_value, description, category, true, bool)
#define DEFINE_transient_string(name, default_value, description, category) \
DEFINE_CVar(name, default_value, description, category, true, std::string)