mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-04 22:06:06 +02:00
launch through Steam (fixes #89)
This commit is contained in:
@@ -75,12 +75,39 @@ namespace VRCX
|
|||||||
|
|
||||||
public void StartGame(string arguments)
|
public void StartGame(string arguments)
|
||||||
{
|
{
|
||||||
|
// try stream first
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var key = Registry.ClassesRoot.OpenSubKey(@"steam\shell\open\command"))
|
||||||
|
{
|
||||||
|
// "C:\Program Files (x86)\Steam\steam.exe" -- "%1"
|
||||||
|
var match = Regex.Match(key.GetValue(string.Empty) as string, "^\"(.+?)\\\\steam.exe\"");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
var path = match.Groups[1].Value;
|
||||||
|
var _arguments = Uri.EscapeDataString(arguments);
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
WorkingDirectory = path,
|
||||||
|
FileName = path + "\\steam.exe",
|
||||||
|
UseShellExecute = false,
|
||||||
|
Arguments = $"-- \"steam://rungameid/438100//{_arguments}\""
|
||||||
|
}).Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// fallback
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var key = Registry.ClassesRoot.OpenSubKey(@"VRChat\shell\open\command"))
|
using (var key = Registry.ClassesRoot.OpenSubKey(@"VRChat\shell\open\command"))
|
||||||
{
|
{
|
||||||
// "C:\Program Files (x86)\Steam\steamapps\common\VRChat\launch.bat" "C:\Program Files (x86)\Steam\steamapps\common\VRChat" "%1"
|
// "C:\Program Files (x86)\Steam\steamapps\common\VRChat\launch.bat" "C:\Program Files (x86)\Steam\steamapps\common\VRChat" "%1"
|
||||||
var match = Regex.Match(key.GetValue(string.Empty) as string, "^\"(.+\\\\VRChat)\\\\launch.bat\"");
|
var match = Regex.Match(key.GetValue(string.Empty) as string, "^\"(.+?)\\\\launch.bat\"");
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
var path = match.Groups[1].Value;
|
var path = match.Groups[1].Value;
|
||||||
@@ -89,7 +116,7 @@ namespace VRCX
|
|||||||
WorkingDirectory = path,
|
WorkingDirectory = path,
|
||||||
FileName = path + "\\VRChat.exe",
|
FileName = path + "\\VRChat.exe",
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
Arguments = arguments
|
Arguments = $"\"{arguments}\""
|
||||||
}).Close();
|
}).Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7259,7 +7259,7 @@ CefSharp.BindObjectAsync(
|
|||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.locationToLaunchArg = function (location) {
|
$app.methods.locationToLaunchArg = function (location) {
|
||||||
return `"vrchat://launch?id=${location}"`;
|
return `vrchat://launch?id=${location}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
$app.methods.launchGame = function (...args) {
|
$app.methods.launchGame = function (...args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user