From c9687bd4933e3d365f102580192de3f4c501569a Mon Sep 17 00:00:00 2001 From: Natsumi Date: Mon, 26 May 2025 04:38:27 +1000 Subject: [PATCH] Linux fixes --- Dotnet/AppApi/Electron/Folders.cs | 14 ++++++++ Dotnet/AppApi/Electron/GameHandler.cs | 36 +++++++++++-------- src-electron/main.js | 3 +- src/app.js | 2 +- .../Settings/dialogs/LaunchOptionsDialog.vue | 2 ++ 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Dotnet/AppApi/Electron/Folders.cs b/Dotnet/AppApi/Electron/Folders.cs index 56c0f46a..65f652e3 100644 --- a/Dotnet/AppApi/Electron/Folders.cs +++ b/Dotnet/AppApi/Electron/Folders.cs @@ -104,6 +104,20 @@ namespace VRCX public override string GetVRChatPhotosLocation() { + var json = ReadConfigFile(); + if (!string.IsNullOrEmpty(json)) + { + var obj = JsonConvert.DeserializeObject(json); + if (obj["picture_output_folder"] != null) + { + var photosDir = (string)obj["picture_output_folder"]; + if (!string.IsNullOrEmpty(photosDir) && Directory.Exists(photosDir)) + { + return photosDir; + } + } + } + return Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat"); } diff --git a/Dotnet/AppApi/Electron/GameHandler.cs b/Dotnet/AppApi/Electron/GameHandler.cs index c1112c00..866a2a06 100644 --- a/Dotnet/AppApi/Electron/GameHandler.cs +++ b/Dotnet/AppApi/Electron/GameHandler.cs @@ -70,6 +70,26 @@ namespace VRCX public override bool StartGame(string arguments) { + try + { + var process = Process.Start(new ProcessStartInfo + { + FileName = "steam", + Arguments = $"-applaunch 438100 {arguments}", + UseShellExecute = false, + }); + if (process?.ExitCode == 0) + { + process.Close(); + return true; + } + process?.Close(); + } + catch (Exception e) + { + logger.Error($"Failed to start VRChat: {e.Message}, attempting to start via Steam path."); + } + try { var steamPath = _steamPath; @@ -104,20 +124,8 @@ namespace VRCX public override bool StartGameFromPath(string path, string arguments) { - if (!path.EndsWith(".exe")) - path = Path.Join(path, "launch.exe"); - - if (!path.EndsWith("launch.exe") || !File.Exists(path)) - return false; - - Process.Start(new ProcessStartInfo - { - WorkingDirectory = Path.GetDirectoryName(path), - FileName = path, - UseShellExecute = false, - Arguments = arguments - })?.Close(); - return true; + // This method is not used + return false; } } } diff --git a/src-electron/main.js b/src-electron/main.js index 461f131c..1598876e 100644 --- a/src-electron/main.js +++ b/src-electron/main.js @@ -30,6 +30,7 @@ const args = process.argv.slice(1); const noInstall = args.includes('--no-install'); const x11 = args.includes('--x11'); const noDesktop = args.includes('--no-desktop'); +const startup = args.includes('--startup'); const homePath = getHomePath(); tryRelaunchWithArgs(args); @@ -567,7 +568,7 @@ function tryCopyFromWinePrefix() { } function applyWindowState() { - if (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true') { + if (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true' && startup) { if (isCloseToTray) { mainWindow.hide(); return; diff --git a/src/app.js b/src/app.js index bc2bc058..d8acb4b5 100644 --- a/src/app.js +++ b/src/app.js @@ -10077,7 +10077,7 @@ console.log(`isLinux: ${LINUX}`); if (desktopMode) { args.push('--no-vr'); } - if (vrcLaunchPathOverride) { + if (vrcLaunchPathOverride && !LINUX) { AppApi.StartGameFromPath( vrcLaunchPathOverride, args.join(' ') diff --git a/src/views/Settings/dialogs/LaunchOptionsDialog.vue b/src/views/Settings/dialogs/LaunchOptionsDialog.vue index f8f94ce2..39005922 100644 --- a/src/views/Settings/dialogs/LaunchOptionsDialog.vue +++ b/src/views/Settings/dialogs/LaunchOptionsDialog.vue @@ -28,6 +28,7 @@