Skip to content

添加了代理命令(包装命令) #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HainanWinter-l
Copy link

@HainanWinter-l HainanWinter-l commented Jun 27, 2025

预期目标 What does the pull request do

  • 实现代理命令(包装命令)启动游戏,例如用于 Linux 下使用 prime-run 强制使用N卡渲染游戏

检查清单 Checklist

  • 预期的目标都已经实现 All expected objectives have been achieved
  • 已经在本地测试了所有更改 All changes have been tested locally

关联事件 Related

  • 无 N/A

补充说明 Additional Information

无 N/A


PR-Codex overview

This PR introduces a new property and modifies the process launching logic to support a command proxy in LaunchSettings. It enhances the flexibility of game launching by allowing an alternative command to be specified.

Detailed summary

  • Added CommandProxy property to LaunchSettings.
  • Replaced ProcessStartInfo psi with ProcessStartInfo processStartInfo.
  • Introduced logic to determine command and arguments based on CommandProxy.
  • Updated environment variable handling to use processStartInfo.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@@ -394,9 +402,11 @@ public override async Task<LaunchResult> LaunchTaskAsync(LaunchSettings settings
else
{
var normalJavaPath = java!.JavaPath.Replace("javaw", "java", StringComparison.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this pr but @laolarou726 what's this? what if the path is "myjavawow/javaw.exe"? as a launcher core i think we should exactly use the given path. the problem that users might accidently select javaw should be addressed by the user inferface part.

var javaCommand = $"\"{normalJavaPath}\" {string.Join(' ', arguments)}";
var javaCommand = string.IsNullOrWhiteSpace(commandProxy)
? $"\"{normalJavaPath}\" {string.Join(' ', arguments)}"
: $"\"{commandProxy}\" \"{normalJavaPath}\" {string.Join(' ', arguments)}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we shouldn't use " for commandProxy, as it might be something like dotnet run

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, what about to use a commandFormat instead of commandProxy? For example we could directly change the format to "prime-run {java} even to put something here {args} maybe something more".

Copy link
Member

@yueyinqiu yueyinqiu Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阿巴阿巴()好像说太多了()木有为难的意思,现在这样也可以()我先approve了()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we shouldn't use " for commandProxy, as it might be something like dotnet run

我想的是,如果用的是/path to/file这样的格式,应该考虑双引号封一起,不然路径有问题。至于dotnet run这种就不太好处理,这个要用dotnet作为程序主体吧,然后run 其他参数。其实也可以是分成代理命令主体和代理命令参数两个部分。但是这样要是用ls | grep 之类的管道符就很复杂了吧。一般就用一个prime-run,问题应该不大

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, what about to use a commandFormat instead of commandProxy? For example we could directly change the format to "prime-run {java} even to put something here {args} maybe something more".

或许是可行的办法,在useShellExecute的时候通过,在不使用的情况下需要确定命令的主体

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants