mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 23:03:51 +02:00
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:
51
Dotnet/Overlay/Cef/OverlayProgram.cs
Normal file
51
Dotnet/Overlay/Cef/OverlayProgram.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NLog;
|
||||
|
||||
namespace VRCX.Overlay;
|
||||
|
||||
internal static class OverlayProgram
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static VRCXVRInterface VRCXVRInstance;
|
||||
|
||||
public static void OverlayMain()
|
||||
{
|
||||
logger.Info("VRCX Overlay starting...");
|
||||
CefService.Instance.Init();
|
||||
AppApiVr.Instance = new AppApiVrCef();
|
||||
var isLegacy = VRCXStorage.Instance.Get("VRCX_DisableVrOverlayGpuAcceleration") == "true";
|
||||
VRCXVRInstance = new VRCXVRCef(isLegacy);
|
||||
VRCXVRInstance.Init();
|
||||
|
||||
OverlayClient.Init();
|
||||
|
||||
logger.Info("VRCX Overlay started...");
|
||||
QuitProcess();
|
||||
ApplicationConfiguration.Initialize();
|
||||
var context = new ApplicationContext();
|
||||
Application.Run(context);
|
||||
Exit();
|
||||
}
|
||||
|
||||
private static void Exit()
|
||||
{
|
||||
logger.Info("VRCX Overlay exiting...");
|
||||
// CefService.Instance.Exit();
|
||||
OverlayClient.Exit();
|
||||
VRCXVRInstance.Exit();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static async Task QuitProcess()
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
while (OverlayClient.ConnectedAndActive)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
}
|
||||
Exit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user