feat: add %launch_args%
to other games as well
This commit is contained in:
parent
0f2163d22d
commit
cd76037015
3 changed files with 35 additions and 17 deletions
|
@ -75,9 +75,11 @@ pub fn run() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
// Prepare bash -c '<command>'
|
||||
// %command% = %bash_command% %windows_command% %launch_args%
|
||||
|
||||
let mut bash_command = String::new();
|
||||
let mut windows_command = String::new();
|
||||
let mut launch_args = String::new();
|
||||
|
||||
if config.game.enhancements.gamemode {
|
||||
bash_command += "gamemoderun ";
|
||||
|
@ -98,12 +100,12 @@ pub fn run() -> anyhow::Result<()> {
|
|||
windows_command += &format!("'{}/jadeite.exe' 'Z:\\{}/BH3.exe' -- ", folders.patch.to_string_lossy(), folders.game.to_string_lossy());
|
||||
|
||||
if config.game.wine.borderless {
|
||||
windows_command += "-screen-fullscreen 0 -popupwindow ";
|
||||
launch_args += "-screen-fullscreen 0 -popupwindow ";
|
||||
}
|
||||
|
||||
// https://notabug.org/Krock/dawn/src/master/TWEAKS.md
|
||||
if config.game.enhancements.fsr.enabled {
|
||||
windows_command += "-window-mode exclusive ";
|
||||
launch_args += "-window-mode exclusive ";
|
||||
}
|
||||
|
||||
// gamescope <params> -- <command to run>
|
||||
|
@ -113,9 +115,10 @@ pub fn run() -> anyhow::Result<()> {
|
|||
|
||||
// Bundle all windows arguments used to run the game into a single file
|
||||
if features.compact_launch {
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command}\nexit"))?;
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command} {launch_args}\nexit"))?;
|
||||
|
||||
windows_command = String::from("compact_launch.bat");
|
||||
launch_args = String::new();
|
||||
}
|
||||
|
||||
// bwrap <params> -- <command to run>
|
||||
|
@ -159,12 +162,13 @@ pub fn run() -> anyhow::Result<()> {
|
|||
bash_command = match &config.game.command {
|
||||
// Use user-given launch command
|
||||
Some(command) => replace_keywords(command, &folders)
|
||||
.replace("%command%", &format!("{bash_command} {windows_command}"))
|
||||
.replace("%command%", &format!("{bash_command} {windows_command} {launch_args}"))
|
||||
.replace("%bash_command%", &bash_command)
|
||||
.replace("%windows_command%", &windows_command),
|
||||
.replace("%windows_command%", &windows_command)
|
||||
.replace("%launch_args%", &launch_args),
|
||||
|
||||
// Combine bash and windows parts of the command
|
||||
None => format!("{bash_command} {windows_command}")
|
||||
None => format!("{bash_command} {windows_command} {launch_args}")
|
||||
};
|
||||
|
||||
let mut command = Command::new("bash");
|
||||
|
|
|
@ -71,9 +71,11 @@ pub fn run() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
// Prepare bash -c '<command>'
|
||||
// %command% = %bash_command% %windows_command% %launch_args%
|
||||
|
||||
let mut bash_command = String::new();
|
||||
let mut windows_command = String::new();
|
||||
let mut launch_args = String::new();
|
||||
|
||||
if config.game.enhancements.gamemode {
|
||||
bash_command += "gamemoderun ";
|
||||
|
@ -94,12 +96,12 @@ pub fn run() -> anyhow::Result<()> {
|
|||
windows_command += "PGR.exe ";
|
||||
|
||||
if config.game.wine.borderless {
|
||||
windows_command += "-screen-fullscreen 0 -popupwindow ";
|
||||
launch_args += "-screen-fullscreen 0 -popupwindow ";
|
||||
}
|
||||
|
||||
// https://notabug.org/Krock/dawn/src/master/TWEAKS.md
|
||||
if config.game.enhancements.fsr.enabled {
|
||||
windows_command += "-window-mode exclusive ";
|
||||
launch_args += "-window-mode exclusive ";
|
||||
}
|
||||
|
||||
// gamescope <params> -- <command to run>
|
||||
|
@ -109,9 +111,10 @@ pub fn run() -> anyhow::Result<()> {
|
|||
|
||||
// Bundle all windows arguments used to run the game into a single file
|
||||
if features.compact_launch {
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command}\nexit"))?;
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command} {launch_args}\nexit"))?;
|
||||
|
||||
windows_command = String::from("compact_launch.bat");
|
||||
launch_args = String::new();
|
||||
}
|
||||
|
||||
// bwrap <params> -- <command to run>
|
||||
|
@ -136,6 +139,12 @@ pub fn run() -> anyhow::Result<()> {
|
|||
.replace(folders.game.to_str().unwrap(), sandboxed_folders.game.to_str().unwrap())
|
||||
.replace(folders.temp.to_str().unwrap(), sandboxed_folders.temp.to_str().unwrap());
|
||||
|
||||
windows_command = windows_command
|
||||
.replace(folders.wine.to_str().unwrap(), sandboxed_folders.wine.to_str().unwrap())
|
||||
.replace(folders.prefix.to_str().unwrap(), sandboxed_folders.prefix.to_str().unwrap())
|
||||
.replace(folders.game.to_str().unwrap(), sandboxed_folders.game.to_str().unwrap())
|
||||
.replace(folders.temp.to_str().unwrap(), sandboxed_folders.temp.to_str().unwrap());
|
||||
|
||||
bash_command = format!("{bwrap} --chdir /tmp/sandbox/game -- {bash_command}");
|
||||
folders = sandboxed_folders;
|
||||
}
|
||||
|
@ -144,12 +153,13 @@ pub fn run() -> anyhow::Result<()> {
|
|||
bash_command = match &config.game.command {
|
||||
// Use user-given launch command
|
||||
Some(command) => replace_keywords(command, &folders)
|
||||
.replace("%command%", &format!("{bash_command} {windows_command}"))
|
||||
.replace("%command%", &format!("{bash_command} {windows_command} {launch_args}"))
|
||||
.replace("%bash_command%", &bash_command)
|
||||
.replace("%windows_command%", &windows_command),
|
||||
.replace("%windows_command%", &windows_command)
|
||||
.replace("%launch_args%", &launch_args),
|
||||
|
||||
// Combine bash and windows parts of the command
|
||||
None => format!("{bash_command} {windows_command}")
|
||||
None => format!("{bash_command} {windows_command} {launch_args}")
|
||||
};
|
||||
|
||||
let mut command = Command::new("bash");
|
||||
|
|
|
@ -75,9 +75,11 @@ pub fn run() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
// Prepare bash -c '<command>'
|
||||
// %command% = %bash_command% %windows_command% %launch_args%
|
||||
|
||||
let mut bash_command = String::new();
|
||||
let mut windows_command = String::new();
|
||||
let mut launch_args = String::new();
|
||||
|
||||
if config.game.enhancements.gamemode {
|
||||
bash_command += "gamemoderun ";
|
||||
|
@ -98,12 +100,12 @@ pub fn run() -> anyhow::Result<()> {
|
|||
windows_command += &format!("'{}/jadeite.exe' 'Z:\\{}/StarRail.exe' -- ", folders.patch.to_string_lossy(), folders.game.to_string_lossy());
|
||||
|
||||
if config.game.wine.borderless {
|
||||
windows_command += "-screen-fullscreen 0 -popupwindow ";
|
||||
launch_args += "-screen-fullscreen 0 -popupwindow ";
|
||||
}
|
||||
|
||||
// https://notabug.org/Krock/dawn/src/master/TWEAKS.md
|
||||
if config.game.enhancements.fsr.enabled {
|
||||
windows_command += "-window-mode exclusive ";
|
||||
launch_args += "-window-mode exclusive ";
|
||||
}
|
||||
|
||||
// gamescope <params> -- <command to run>
|
||||
|
@ -113,9 +115,10 @@ pub fn run() -> anyhow::Result<()> {
|
|||
|
||||
// Bundle all windows arguments used to run the game into a single file
|
||||
if features.compact_launch {
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command}\nexit"))?;
|
||||
std::fs::write(folders.game.join("compact_launch.bat"), format!("start {windows_command} {launch_args}\nexit"))?;
|
||||
|
||||
windows_command = String::from("compact_launch.bat");
|
||||
launch_args = String::new();
|
||||
}
|
||||
|
||||
// bwrap <params> -- <command to run>
|
||||
|
@ -161,10 +164,11 @@ pub fn run() -> anyhow::Result<()> {
|
|||
Some(command) => replace_keywords(command, &folders)
|
||||
.replace("%command%", &format!("{bash_command} {windows_command}"))
|
||||
.replace("%bash_command%", &bash_command)
|
||||
.replace("%windows_command%", &windows_command),
|
||||
.replace("%windows_command%", &windows_command)
|
||||
.replace("%launch_args%", &launch_args),
|
||||
|
||||
// Combine bash and windows parts of the command
|
||||
None => format!("{bash_command} {windows_command}")
|
||||
None => format!("{bash_command} {windows_command} {launch_args}")
|
||||
};
|
||||
|
||||
let mut command = Command::new("bash");
|
||||
|
|
Loading…
Reference in a new issue