diff --git a/src/xenia/app/xenia_main.cc b/src/xenia/app/xenia_main.cc index 50bfb24e0..50ee600c4 100644 --- a/src/xenia/app/xenia_main.cc +++ b/src/xenia/app/xenia_main.cc @@ -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& 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"; diff --git a/src/xenia/base/cvar.h b/src/xenia/base/cvar.h index 564f32ff7..d7ed12b86 100644 --- a/src/xenia/base/cvar.h +++ b/src/xenia/base/cvar.h @@ -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)