diff --git a/VRCX.cs b/VRCX.cs index acc91b19..106cd398 100644 --- a/VRCX.cs +++ b/VRCX.cs @@ -50,7 +50,7 @@ namespace VRCX return WinApi.FindWindow("UnityWndClass", "VRChat") != IntPtr.Zero; } - public void StartGame(string location, bool desktop) + public void StartGame(string arguments) { try { @@ -61,21 +61,12 @@ namespace VRCX if (match.Success) { var path = match.Groups[1].Value; - var args = new StringBuilder(); - if (desktop) - { - args.Append("--no-vr "); - } - args.Append("--enable-debug-gui "); - args.Append("\"vrchat://launch?id="); - args.Append(location); - args.Append('"'); Process.Start(new ProcessStartInfo { WorkingDirectory = path, FileName = path + "\\VRChat.exe", UseShellExecute = false, - Arguments = args.ToString() + Arguments = arguments }).Close(); } } diff --git a/html/src/app.js b/html/src/app.js index d4436e7d..871aa2bb 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -6964,6 +6964,40 @@ CefSharp.BindObjectAsync( }); }; + // App: Launch Options + + $app.data.launchArguments = VRCXStorage.Get('launchArguments'); + + // App: Launch Options Dialog + + $app.data.launchOptionsDialog = { + visible: false, + arguments: '' + }; + + API.$on('LOGOUT', function () { + $app.launchOptionsDialog.visible = false; + }); + + $app.methods.updateLaunchOptions = function () { + var D = this.launchOptionsDialog; + D.visible = false; + var args = String(D.arguments).replace(/\s+/g, ' ').trim(); + this.launchArguments = args; + VRCXStorage.Set('launchArguments', args); + this.$message({ + message: 'updated', + type: 'success' + }); + }; + + $app.methods.showLaunchOptions = function () { + this.$nextTick(() => adjustDialogZ(this.$refs.launchOptionsDialog.$el)); + var D = this.launchOptionsDialog; + D.arguments = this.launchArguments; + D.visible = true; + }; + // App: Launch Dialog $app.data.launchDialog = { @@ -7000,9 +7034,19 @@ CefSharp.BindObjectAsync( D.visible = true; }; - $app.methods.launchGame = function () { + $app.methods.locationToLaunchArg = function (location) { + return `"vrchat://launch?id=${location}"`; + } + + $app.methods.launchGame = function (...args) { var D = this.launchDialog; - VRCX.StartGame(D.location, D.desktop); + if (this.launchArguments) { + args.push(this.launchArguments); + } + if (D.desktop === true) { + args.push('--no-vr'); + } + VRCX.StartGame(args.join(' ')); D.visible = false; }; diff --git a/html/src/index.pug b/html/src/index.pug index fc2beed7..ba073c80 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -378,6 +378,9 @@ html .detail span.name Repository URL span.extra https://github.com/pypy-vrc/VRCX + div(style="margin-top:5px") + el-button-group + el-button(size="small" icon="el-icon-s-operation" @click="showLaunchOptions()") VRChat Launch Options div(style="margin-top:30px") span(style="font-weight:bold") Direct Access div(style="margin-top:5px") @@ -1031,13 +1034,25 @@ html el-button(size="small" @click="showInviteDialog(newInstanceDialog.location)") Invite el-button(type="primary" size="small" @click="showLaunchDialog(newInstanceDialog.location)") Launch + //- dialog: launch options + el-dialog.x-dialog(ref="launchOptionsDialog" :visible.sync="launchOptionsDialog.visible" title="Launch Options" width="400px") + div(style='font-size:12px;') + | These options are for advanced users only. #[br] + | to change fps: --fps=<N> ex) #[el-tag(size="mini") --fps=144] + el-input(type="textarea" v-model="launchOptionsDialog.arguments" size="mini" show-word-limit :autosize="{ minRows:2, maxRows:5 }" placeholder="" style="margin-top:10px") + template(#footer) + div(style="display:flex") + el-button(size="small" @click="openExternalLink('https://docs.vrchat.com/docs/launch-options')") VRChat Docs + el-button(size="small" @click="openExternalLink('https://docs.unity3d.com/Manual/CommandLineArguments.html')") Unity Manual + el-button(type="primary" size="small" :disabled="launchOptionsDialog.loading" @click="updateLaunchOptions" style="margin-left:auto") OK + //- dialog: launch el-dialog.x-dialog(ref="launchDialog" :visible.sync="launchDialog.visible" title="Launch" width="400px") div #[span(v-text="launchDialog.url" style="word-break:break-all;font-size:12px")] template(#footer) el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") Start as Desktop (No VR) el-button(size="small" @click="showInviteDialog(launchDialog.location)") Invite - el-button(type="primary" size="small" @click="launchGame()") Launch + el-button(type="primary" size="small" @click="launchGame(locationToLaunchArg(launchDialog.location))") Launch //- dialog: open source software notice el-dialog.x-dialog(:visible.sync="ossDialog" title="Open Source Software Notice" width="650px")