Merge overlays, move overlay to separate process (#44)

* refactor: merge two overlay offScreenBrowser into one

* Electron support for shared overlay

* Separate overlay into its own process

* fix: invalid overlay texture size

* Handle duplicate processes

* Remove logging

---------

Co-authored-by: pa <maplenagisa@gmail.com>
Co-authored-by: rs189 <35667100+rs189@users.noreply.github.com>
This commit is contained in:
Natsumi
2026-01-12 11:31:10 +13:00
committed by Natsumi
parent 9135adf6d1
commit d2fd205476
41 changed files with 1122 additions and 2108 deletions

View File

@@ -49,7 +49,7 @@ namespace VRCX
#if !LINUX
var disableClosing = LaunchArguments.IsUpgrade || // we're upgrading, allow it
!string.IsNullOrEmpty(CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument)); // we're launching a subprocess, allow it
!string.IsNullOrEmpty(CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument)); // we're launching a subprocess, allow it
// if we're launching a second instance with same config directory, focus the first instance then exit
if (!disableClosing && IsDuplicateProcessRunning(LaunchArguments))
@@ -74,6 +74,9 @@ namespace VRCX
if (arg.StartsWith(VrcxLaunchArguments.IsDebugPrefix))
arguments.IsDebug = true;
if (arg == VrcxLaunchArguments.Overlay)
arguments.IsOverlay = true;
if (arg.StartsWith(VrcxLaunchArguments.LaunchCommandPrefix) && arg.Length > VrcxLaunchArguments.LaunchCommandPrefix.Length)
arguments.LaunchCommand = arg.Substring(VrcxLaunchArguments.LaunchCommandPrefix.Length);
@@ -100,6 +103,9 @@ namespace VRCX
public const string IsDebugPrefix = "--debug";
public bool IsDebug { get; set; } = false;
public const string Overlay = "--overlay";
public bool IsOverlay { get; set; } = false;
public const string LaunchCommandPrefix = "/uri=vrcx://";
public const string LinuxLaunchCommandPrefix = "vrcx://";
@@ -138,6 +144,19 @@ namespace VRCX
if (commandLine.Contains(SubProcessTypeArgument)) // ignore subprocesses
continue;
if (launchArguments.IsOverlay)
{
if (commandLine.Contains(VrcxLaunchArguments.Overlay))
{
Console.WriteLine(@"Another overlay instance is already running. Exiting this instance.");
Environment.Exit(0);
}
continue; // we are an overlay, ignore non-overlay instances
}
if (commandLine.Contains(VrcxLaunchArguments.Overlay))
continue; // we aren't an overlay, ignore overlay instances
var processArguments = ParseArgs(commandLine.Split(' '));
if (processArguments.ConfigDirectory == launchArguments.ConfigDirectory)
{