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

@@ -19,16 +19,6 @@ namespace VRCX
Program.VRCXVRInstance.SetActive(active, hmdOverlay, wristOverlay, menuButton, overlayHand);
}
public override void RefreshVR()
{
Program.VRCXVRInstance.Restart();
}
public override void RestartVR()
{
Program.VRCXVRInstance.Restart();
}
public override void SetZoom(double zoomLevel)
{
}
@@ -51,11 +41,6 @@ namespace VRCX
return false;
}
public override void ExecuteVrFeedFunction(string function, string json)
{
Program.VRCXVRInstance.ExecuteVrFeedFunction(function, json);
}
public override void ExecuteVrOverlayFunction(string function, string json)
{
Program.VRCXVRInstance.ExecuteVrOverlayFunction(function, json);

View File

@@ -1,97 +0,0 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace VRCX
{
public class AppApiVrElectron : AppApiVr
{
static AppApiVrElectron()
{
Instance = new AppApiVrElectron();
}
public override void Init()
{
}
public override void VrInit()
{
}
public override List<KeyValuePair<string, string>> GetExecuteVrFeedFunctionQueue()
{
var list = new List<KeyValuePair<string, string>>();
while (Program.VRCXVRInstance.GetExecuteVrFeedFunctionQueue().TryDequeue(out var item))
{
list.Add(item);
}
return list;
}
public override List<KeyValuePair<string, string>> GetExecuteVrOverlayFunctionQueue()
{
var list = new List<KeyValuePair<string, string>>();
while (Program.VRCXVRInstance.GetExecuteVrOverlayFunctionQueue().TryDequeue(out var item))
{
list.Add(item);
}
return list;
}
public override void ToggleSystemMonitor(bool enabled)
{
SystemMonitorElectron.Instance.Start(enabled);
}
/// <summary>
/// Returns the current CPU usage as a percentage.
/// </summary>
/// <returns>The current CPU usage as a percentage.</returns>
public override float CpuUsage()
{
return SystemMonitorElectron.Instance.CpuUsage;
}
/// <summary>
/// Returns an array of arrays containing information about the connected VR devices.
/// Each sub-array contains the type of device and its current state
/// </summary>
/// <returns>An array of arrays containing information about the connected VR devices.</returns>
public override string[][] GetVRDevices()
{
return Program.VRCXVRInstance.GetDevices();
}
/// <summary>
/// Returns the number of milliseconds that the system has been running.
/// </summary>
/// <returns>The number of milliseconds that the system has been running.</returns>
public override double GetUptime()
{
return SystemMonitorElectron.Instance.UpTime;
}
/// <summary>
/// Returns the current language of the operating system.
/// </summary>
/// <returns>The current language of the operating system.</returns>
public override string CurrentCulture()
{
return CultureInfo.CurrentCulture.ToString();
}
/// <summary>
/// Returns the file path of the custom user js file, if it exists.
/// </summary>
/// <returns>The file path of the custom user js file, or an empty string if it doesn't exist.</returns>
public override string CustomVrScript()
{
var filePath = Path.Join(Program.AppDataDirectory, "customvr.js");
if (File.Exists(filePath))
return File.ReadAllText(filePath);
return string.Empty;
}
}
}