Add '--title-id' parameter and desktop shortcut creation (#889)

* Add '--title-id' launch option to launch titles by title id
* Add title id column to game list
* Add option to create game shortcuts

Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com>
This commit is contained in:
capitalistspz 2023-07-07 23:48:41 +00:00 committed by GitHub
parent ea86c77088
commit f1c200a016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 195 additions and 8 deletions

View file

@ -100,6 +100,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
column_width.game_time = loadColumnSize("game_time_width", DefaultColumnSize::game_time);
column_width.game_started = loadColumnSize("game_started_width", DefaultColumnSize::game_started);
column_width.region = loadColumnSize("region_width", DefaultColumnSize::region);
column_width.title_id = loadColumnSize("title_id", DefaultColumnSize::title_id);
recent_launch_files.clear();
auto launch_parser = parser.get("RecentLaunchFiles");
@ -398,6 +399,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
gamelist.set("game_time_width", column_width.game_time);
gamelist.set("game_started_width", column_width.game_started);
gamelist.set("region_width", column_width.region);
gamelist.set("title_id", column_width.title_id);
auto launch_files_parser = config.set("RecentLaunchFiles");
for (const auto& entry : recent_launch_files)

View file

@ -340,6 +340,7 @@ namespace DefaultColumnSize {
game_time = 140u,
game_started = 160u,
region = 80u,
title_id = 160u
};
};
@ -427,6 +428,7 @@ struct CemuConfig
uint32 game_time = DefaultColumnSize::game_time;
uint32 game_started = DefaultColumnSize::game_started;
uint32 region = DefaultColumnSize::region;
uint32 title_id = 0;
} column_width{};
// graphics

View file

@ -60,6 +60,7 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
("version,v", "Displays the version of Cemu")
("game,g", po::wvalue<std::wstring>(), "Path of game to launch")
("title-id,t", po::value<std::string>(), "Title ID of the title to be launched (overridden by --game)")
("mlc,m", po::wvalue<std::wstring>(), "Custom mlc folder location")
("fullscreen,f", po::value<bool>()->implicit_value(true), "Launch games in fullscreen mode")
@ -133,6 +134,21 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
s_load_game_file = tmp;
}
if (vm.count("title-id"))
{
auto title_param = vm["title-id"].as<std::string>();
try {
if (title_param.starts_with('=')){
title_param.erase(title_param.begin());
}
s_load_title_id = std::stoull(title_param, nullptr, 16);
}
catch (std::invalid_argument const& e)
{
std::cerr << "Expected title_param ID as an unsigned 64-bit hexadecimal string\n";
}
}
if (vm.count("mlc"))
{

View file

@ -16,6 +16,7 @@ public:
static bool HandleCommandline(const std::vector<std::wstring>& args);
static std::optional<fs::path> GetLoadFile() { return s_load_game_file; }
static std::optional<uint64> GetLoadTitleID() {return s_load_title_id;}
static std::optional<fs::path> GetMLCPath() { return s_mlc_path; }
static std::optional<bool> RenderUpsideDownEnabled() { return s_render_upside_down; }
@ -35,6 +36,7 @@ public:
private:
inline static std::optional<fs::path> s_load_game_file{};
inline static std::optional<uint64> s_load_title_id{};
inline static std::optional<fs::path> s_mlc_path{};
inline static std::optional<bool> s_render_upside_down{};