Update copyright year

This commit is contained in:
Natsumi
2025-01-31 16:38:25 +13:00
parent a7c400f9b7
commit 481e5439c3
33 changed files with 266 additions and 265 deletions
+7 -7
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
@@ -25,7 +25,7 @@ namespace VRCX
private DeviceMultithread _deviceMultithread;
private Query _query;
private Texture2D _renderTarget;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public OffScreenBrowser(string address, int width, int height)
@@ -37,18 +37,18 @@ namespace VRCX
windowInfo.SharedTextureEnabled = true;
windowInfo.Width = width;
windowInfo.Height = height;
var browserSettings = new BrowserSettings()
{
DefaultEncoding = "UTF-8",
WindowlessFrameRate = 60
};
CreateBrowser(windowInfo, browserSettings);
Size = new System.Drawing.Size(width, height);
RenderHandler = this;
JavascriptBindings.ApplyVrJavascriptBindings(JavascriptObjectRepository);
}
@@ -56,13 +56,13 @@ namespace VRCX
{
_device = device;
_device1 = _device.QueryInterface<Device1>();
_deviceMultithread?.Dispose();
_deviceMultithread = _device.QueryInterfaceOrNull<DeviceMultithread>();
_deviceMultithread?.SetMultithreadProtected(true);
_renderTarget = renderTarget;
_query?.Dispose();
_query = new Query(_device, new QueryDescription
{
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
@@ -66,7 +66,7 @@ namespace VRCX
// Safeguard against uninitialized texture
if (texture == null)
return;
_paintBufferLock.EnterReadLock();
try
{
+8 -8
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
@@ -31,7 +31,7 @@ namespace VRCX
{
if (enabled == _enabled)
return;
_enabled = enabled;
if (enabled)
StartThread();
@@ -61,11 +61,11 @@ namespace VRCX
_performanceCounterUpTime?.Dispose();
_performanceCounterUpTime = null;
}
private void StartThread()
{
Exit();
try
{
_performanceCounterCpuUsage = new PerformanceCounter(
@@ -99,7 +99,7 @@ namespace VRCX
logger.Warn($"Failed to create \"Processor Time\" PerformanceCounter ${ex}");
}
}
try
{
_performanceCounterUpTime = new PerformanceCounter("System", "System Up Time");
@@ -117,14 +117,14 @@ namespace VRCX
return;
}
logger.Info("SystemMonitor started");
_thread = new Thread(ThreadProc)
{
IsBackground = true
};
_thread.Start();
}
private void ThreadProc()
{
try
@@ -136,7 +136,7 @@ namespace VRCX
if (_performanceCounterUpTime != null)
UpTime = TimeSpan.FromSeconds(_performanceCounterUpTime.NextValue()).TotalMilliseconds;
Thread.Sleep(1000);
}
}
+85 -85
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
@@ -51,11 +51,11 @@ namespace VRCX
private ulong _hmdOverlayHandle;
private bool _hmdOverlayActive;
private bool _hmdOverlayWasActive;
private ulong _wristOverlayHandle;
private bool _wristOverlayActive;
private bool _wristOverlayWasActive;
static VRCXVR()
{
@@ -98,7 +98,7 @@ namespace VRCX
private void SetupTextures()
{
_factory ??= new Factory1();
_device?.Dispose();
_device = new Device(_factory.GetAdapter(OpenVR.System.GetD3D9AdapterIndex()),
DeviceCreationFlags.BgraSupport);
@@ -136,7 +136,7 @@ namespace VRCX
);
_hmdOverlay?.UpdateRender(_device, _texture2);
}
private void UpgradeDevice()
{
Device5 device5 = _device.QueryInterfaceOrNull<Device5>();
@@ -186,7 +186,7 @@ namespace VRCX
var overlayVisible1 = false;
var overlayVisible2 = false;
var dashboardHandle = 0UL;
_wristOverlay = new OffScreenBrowser(
"file://vrcx/vr.html?1",
512,
@@ -340,15 +340,15 @@ namespace VRCX
OpenVR.Overlay.DestroyOverlay(_hmdOverlayHandle);
_hmdOverlayHandle = 0;
}
_hmdOverlayWasActive = _hmdOverlayActive;
if (_wristOverlayActive != _wristOverlayWasActive && _wristOverlayHandle != 0)
{
OpenVR.Overlay.DestroyOverlay(_wristOverlayHandle);
_wristOverlayHandle = 0;
}
_wristOverlayWasActive = _wristOverlayActive;
}
@@ -396,7 +396,7 @@ namespace VRCX
var success = system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state));
if (!success)
break; // this fails while SteamVR overlay is open
var prox = state.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_ProximitySensor));
var isHmdAfk = prox == 0;
if (isHmdAfk != IsHmdAfk)
@@ -438,82 +438,82 @@ namespace VRCX
case ETrackedDeviceClass.Controller:
case ETrackedDeviceClass.GenericTracker:
case ETrackedDeviceClass.TrackingReference:
{
var err = ETrackedPropertyError.TrackedProp_Success;
var batteryPercentage = system.GetFloatTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceBatteryPercentage_Float, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
batteryPercentage = 1f;
}
err = ETrackedPropertyError.TrackedProp_Success;
var isCharging = system.GetBoolTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceIsCharging_Bool, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
isCharging = false;
}
sb.Clear();
system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err);
var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
// Oculus : B/Y, Bit 1, Mask 2
// Oculus : A/X, Bit 7, Mask 128
// Vive : Menu, Bit 1, Mask 2,
// Vive : Grip, Bit 2, Mask 4
var role = system.GetControllerRoleForTrackedDeviceIndex(i);
if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand)
{
if (_overlayHand == 0 ||
(_overlayHand == 1 && role == ETrackedControllerRole.LeftHand) ||
(_overlayHand == 2 && role == ETrackedControllerRole.RightHand))
var err = ETrackedPropertyError.TrackedProp_Success;
var batteryPercentage = system.GetFloatTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceBatteryPercentage_Float, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) &&
(state.ulButtonPressed & (_menuButton ? 2u : isOculus ? 128u : 4u)) != 0)
{
_nextOverlayUpdate = DateTime.MinValue;
if (role == ETrackedControllerRole.LeftHand)
{
Array.Copy(_translationLeft, _translation, 3);
Array.Copy(_rotationLeft, _rotation, 3);
}
else
{
Array.Copy(_translationRight, _translation, 3);
Array.Copy(_rotationRight, _rotation, 3);
}
batteryPercentage = 1f;
}
overlayIndex = i;
err = ETrackedPropertyError.TrackedProp_Success;
var isCharging = system.GetBoolTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceIsCharging_Bool, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
isCharging = false;
}
sb.Clear();
system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err);
var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
// Oculus : B/Y, Bit 1, Mask 2
// Oculus : A/X, Bit 7, Mask 128
// Vive : Menu, Bit 1, Mask 2,
// Vive : Grip, Bit 2, Mask 4
var role = system.GetControllerRoleForTrackedDeviceIndex(i);
if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand)
{
if (_overlayHand == 0 ||
(_overlayHand == 1 && role == ETrackedControllerRole.LeftHand) ||
(_overlayHand == 2 && role == ETrackedControllerRole.RightHand))
{
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) &&
(state.ulButtonPressed & (_menuButton ? 2u : isOculus ? 128u : 4u)) != 0)
{
_nextOverlayUpdate = DateTime.MinValue;
if (role == ETrackedControllerRole.LeftHand)
{
Array.Copy(_translationLeft, _translation, 3);
Array.Copy(_rotationLeft, _rotation, 3);
}
else
{
Array.Copy(_translationRight, _translation, 3);
Array.Copy(_rotationRight, _rotation, 3);
}
overlayIndex = i;
}
}
}
}
var type = string.Empty;
if (devClass == ETrackedDeviceClass.Controller)
{
if (role == ETrackedControllerRole.LeftHand)
var type = string.Empty;
if (devClass == ETrackedDeviceClass.Controller)
{
type = "leftController";
if (role == ETrackedControllerRole.LeftHand)
{
type = "leftController";
}
else if (role == ETrackedControllerRole.RightHand)
{
type = "rightController";
}
else
{
type = "controller";
}
}
else if (role == ETrackedControllerRole.RightHand)
else if (devClass == ETrackedDeviceClass.GenericTracker)
{
type = "rightController";
type = "tracker";
}
else
else if (devClass == ETrackedDeviceClass.TrackingReference)
{
type = "controller";
type = "base";
}
}
else if (devClass == ETrackedDeviceClass.GenericTracker)
{
type = "tracker";
}
else if (devClass == ETrackedDeviceClass.TrackingReference)
{
type = "base";
}
var item = new[]
{
var item = new[]
{
type,
system.IsTrackedDeviceConnected(i)
? "connected"
@@ -524,18 +524,18 @@ namespace VRCX
(batteryPercentage * 100).ToString(),
poses[i].eTrackingResult.ToString()
};
_deviceListLock.EnterWriteLock();
try
{
_deviceList.Add(item);
}
finally
{
_deviceListLock.ExitWriteLock();
}
_deviceListLock.EnterWriteLock();
try
{
_deviceList.Add(item);
}
finally
{
_deviceListLock.ExitWriteLock();
}
break;
}
break;
}
}
}
}
@@ -833,7 +833,7 @@ namespace VRCX
return err;
}
public override void ExecuteVrFeedFunction(string function, string json)
{
if (_wristOverlay == null) return;
+79 -79
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
@@ -105,7 +105,7 @@ namespace VRCX
CpuAccessFlags = CpuAccessFlags.Write
}
);
_texture2?.Dispose();
_texture2 = new Texture2D(
_device,
@@ -137,7 +137,7 @@ namespace VRCX
var dashboardHandle = 0UL;
var overlayHandle1 = 0UL;
var overlayHandle2 = 0UL;
_wristOverlay = new OffScreenBrowserLegacy(
"file://vrcx/vr.html?1",
512,
@@ -324,7 +324,7 @@ namespace VRCX
var success = system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state));
if (!success)
break; // this fails while SteamVR overlay is open
var prox = state.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_ProximitySensor));
var isHmdAfk = prox == 0;
if (isHmdAfk != IsHmdAfk)
@@ -366,82 +366,82 @@ namespace VRCX
case ETrackedDeviceClass.Controller:
case ETrackedDeviceClass.GenericTracker:
case ETrackedDeviceClass.TrackingReference:
{
var err = ETrackedPropertyError.TrackedProp_Success;
var batteryPercentage = system.GetFloatTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceBatteryPercentage_Float, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
batteryPercentage = 1f;
}
err = ETrackedPropertyError.TrackedProp_Success;
var isCharging = system.GetBoolTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceIsCharging_Bool, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
isCharging = false;
}
sb.Clear();
system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err);
var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
// Oculus : B/Y, Bit 1, Mask 2
// Oculus : A/X, Bit 7, Mask 128
// Vive : Menu, Bit 1, Mask 2,
// Vive : Grip, Bit 2, Mask 4
var role = system.GetControllerRoleForTrackedDeviceIndex(i);
if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand)
{
if (_overlayHand == 0 ||
(_overlayHand == 1 && role == ETrackedControllerRole.LeftHand) ||
(_overlayHand == 2 && role == ETrackedControllerRole.RightHand))
var err = ETrackedPropertyError.TrackedProp_Success;
var batteryPercentage = system.GetFloatTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceBatteryPercentage_Float, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) &&
(state.ulButtonPressed & (_menuButton ? 2u : isOculus ? 128u : 4u)) != 0)
{
_nextOverlayUpdate = DateTime.MinValue;
if (role == ETrackedControllerRole.LeftHand)
{
Array.Copy(_translationLeft, _translation, 3);
Array.Copy(_rotationLeft, _rotation, 3);
}
else
{
Array.Copy(_translationRight, _translation, 3);
Array.Copy(_rotationRight, _rotation, 3);
}
batteryPercentage = 1f;
}
overlayIndex = i;
err = ETrackedPropertyError.TrackedProp_Success;
var isCharging = system.GetBoolTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceIsCharging_Bool, ref err);
if (err != ETrackedPropertyError.TrackedProp_Success)
{
isCharging = false;
}
sb.Clear();
system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err);
var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
// Oculus : B/Y, Bit 1, Mask 2
// Oculus : A/X, Bit 7, Mask 128
// Vive : Menu, Bit 1, Mask 2,
// Vive : Grip, Bit 2, Mask 4
var role = system.GetControllerRoleForTrackedDeviceIndex(i);
if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand)
{
if (_overlayHand == 0 ||
(_overlayHand == 1 && role == ETrackedControllerRole.LeftHand) ||
(_overlayHand == 2 && role == ETrackedControllerRole.RightHand))
{
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) &&
(state.ulButtonPressed & (_menuButton ? 2u : isOculus ? 128u : 4u)) != 0)
{
_nextOverlayUpdate = DateTime.MinValue;
if (role == ETrackedControllerRole.LeftHand)
{
Array.Copy(_translationLeft, _translation, 3);
Array.Copy(_rotationLeft, _rotation, 3);
}
else
{
Array.Copy(_translationRight, _translation, 3);
Array.Copy(_rotationRight, _rotation, 3);
}
overlayIndex = i;
}
}
}
}
var type = string.Empty;
if (devClass == ETrackedDeviceClass.Controller)
{
if (role == ETrackedControllerRole.LeftHand)
var type = string.Empty;
if (devClass == ETrackedDeviceClass.Controller)
{
type = "leftController";
if (role == ETrackedControllerRole.LeftHand)
{
type = "leftController";
}
else if (role == ETrackedControllerRole.RightHand)
{
type = "rightController";
}
else
{
type = "controller";
}
}
else if (role == ETrackedControllerRole.RightHand)
else if (devClass == ETrackedDeviceClass.GenericTracker)
{
type = "rightController";
type = "tracker";
}
else
else if (devClass == ETrackedDeviceClass.TrackingReference)
{
type = "controller";
type = "base";
}
}
else if (devClass == ETrackedDeviceClass.GenericTracker)
{
type = "tracker";
}
else if (devClass == ETrackedDeviceClass.TrackingReference)
{
type = "base";
}
var item = new[]
{
var item = new[]
{
type,
system.IsTrackedDeviceConnected(i)
? "connected"
@@ -452,18 +452,18 @@ namespace VRCX
(batteryPercentage * 100).ToString(),
poses[i].eTrackingResult.ToString()
};
_deviceListLock.EnterWriteLock();
try
{
_deviceList.Add(item);
}
finally
{
_deviceListLock.ExitWriteLock();
}
_deviceListLock.EnterWriteLock();
try
{
_deviceList.Add(item);
}
finally
{
_deviceListLock.ExitWriteLock();
}
break;
}
break;
}
}
}
}
@@ -761,7 +761,7 @@ namespace VRCX
return err;
}
public override void ExecuteVrFeedFunction(string function, string json)
{
if (_wristOverlay == null) return;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
// All rights reserved.
//
// This work is licensed under the terms of the MIT license.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright(c) 2019 pypy. All rights reserved.
// Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.