Compare commits
No commits in common. "43fed6839d88dabde20b91545cb41ed24b56425d" and "b82f1db469b17096d8e6215616bdc93700dac268" have entirely different histories.
43fed6839d
...
b82f1db469
|
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.28010.2019
|
VisualStudioVersion = 15.0.28010.2019
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VRDash", "VRDash\VRDash.csproj", "{C12CDA63-DDBB-427B-B66A-72FA42291B04}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VDash", "VDash\VDash.csproj", "{C12CDA63-DDBB-427B-B66A-72FA42291B04}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<ToolBar Grid.Row="0">
|
<ToolBar Grid.Row="0">
|
||||||
<Button x:Name="btnAdd" Click="btnAdd_Click">Add</Button>
|
<Button x:Name="btnAdd" Click="btnAdd_Click">Add</Button>
|
||||||
<Button x:Name="btnRemove" Click="btnRemove_Click">Remove</Button>
|
<Button x:Name="btnRemove" Click="btnRemove_Click">Remove</Button>
|
||||||
<!--<Button x:Name="btnLoad" Click="btnLoad_Click">Load...</Button>-->
|
<Button x:Name="btnLoad" Click="btnLoad_Click">Load...</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ListView x:Name="lvOverlays" Grid.Row="1" SelectionChanged="lvOverlays_SelectionChanged">
|
<ListView x:Name="lvOverlays" Grid.Row="1" SelectionChanged="lvOverlays_SelectionChanged">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
@ -35,7 +33,6 @@ namespace VRDash
|
||||||
{
|
{
|
||||||
Logger.Setup();
|
Logger.Setup();
|
||||||
this.GetLogger().Info("VDash is starting up...");
|
this.GetLogger().Info("VDash is starting up...");
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//Connect to VR runtime...
|
//Connect to VR runtime...
|
||||||
|
|
@ -66,34 +63,6 @@ namespace VRDash
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (File.Exists(ProfileManager.ConfigLocation))
|
|
||||||
{
|
|
||||||
var profile = ProfileManager.LoadProfile();
|
|
||||||
LoadProfile(profile);
|
|
||||||
this.GetLogger().Info($"Default profile loaded. {profile.OverlayConfigs.Count()} overlays loaded from disk.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
this.GetLogger().Error($"Unable to load profile from disk. Profile location: {ProfileManager.ConfigLocation}", ex);
|
|
||||||
MessageBox.Show($"There was an error while trying to load the default profile: {ex.Message}.", "Error Loading Default Profile", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Task saveTask = Task.Factory.StartNew(() =>
|
|
||||||
{
|
|
||||||
//Update profile on disk every ten seconds. Shitty way of doing things, but it is what it is.
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
if (!ProfileManager.IsProfileSaveUpToDate())
|
|
||||||
{
|
|
||||||
ProfileManager.SaveProfile();
|
|
||||||
this.GetLogger().Info("Updated profile saved to disk.");
|
|
||||||
}
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
#region Debug
|
#region Debug
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,11 +92,6 @@ namespace VRDash
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
||||||
{
|
|
||||||
this.GetLogger().Fatal("Unhandled AppDomain exception.", (Exception)e.ExceptionObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadProfile(Profile profile)
|
private void LoadProfile(Profile profile)
|
||||||
{
|
{
|
||||||
//Dispose of all overlays and clear list.
|
//Dispose of all overlays and clear list.
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace VRDash.Overlay.Actions
|
||||||
if (!Enabled) { return; }
|
if (!Enabled) { return; }
|
||||||
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace VRDash.Overlay.Actions
|
||||||
if (!Enabled) { return; }
|
if (!Enabled) { return; }
|
||||||
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace VRDash.Overlay.Actions
|
||||||
if (!Enabled) { return; }
|
if (!Enabled) { return; }
|
||||||
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace VRDash.Overlay.Actions
|
||||||
if (!Enabled) { return; }
|
if (!Enabled) { return; }
|
||||||
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace VRDash.Overlay.Actions
|
||||||
if (!Enabled) { return; }
|
if (!Enabled) { return; }
|
||||||
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
if (!succ)
|
if (!succ)
|
||||||
{
|
{
|
||||||
this.GetLogger().Warn($"[{Config.Name}] SetCursorPos failed.");
|
Console.WriteLine("SetCursorPos failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -381,13 +381,13 @@ namespace VRDash.Overlay
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.GetLogger().Warn($"[{Config.Name}] Error getting coords to draw cursor.");
|
Console.WriteLine("Error getting coords to draw cursor.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
|
string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
|
||||||
this.GetLogger().Warn($"[{Config.Name}] Error getting cursor info: {errorMessage}");
|
Console.WriteLine($"Error getting cursor info: {errorMessage}");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -428,7 +428,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
HmdVector2_t vecWindowSize = new HmdVector2_t() { v0 = data.Width, v1 = data.Height };
|
HmdVector2_t vecWindowSize = new HmdVector2_t() { v0 = data.Width, v1 = data.Height };
|
||||||
OpenVR.Overlay.SetOverlayMouseScale(m_OverlayHandle, ref vecWindowSize);
|
OpenVR.Overlay.SetOverlayMouseScale(m_OverlayHandle, ref vecWindowSize);
|
||||||
this.GetLogger().Info($"[{Config.Name}] Monitor resized, texture updated.");
|
Console.WriteLine("Updated!");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -488,7 +488,7 @@ namespace VRDash.Overlay
|
||||||
if (result != EVROverlayError.None)
|
if (result != EVROverlayError.None)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.GetLogger().Warn($"Error rendering: {result}");
|
Console.WriteLine($"Error rendering: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
device.ImmediateContext.UnmapSubresource(screenTexture, 0);
|
device.ImmediateContext.UnmapSubresource(screenTexture, 0);
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ namespace VRDash.Overlay
|
||||||
if (IsCreated())
|
if (IsCreated())
|
||||||
{
|
{
|
||||||
destroyInternal();
|
destroyInternal();
|
||||||
this.GetLogger().Info($"Destroyed {Config.Key} because it's window does not exist.");
|
Console.WriteLine($"Destroyed {Config.Key} because it's window does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
|
|
@ -265,7 +265,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
if (!succ)
|
if (!succ)
|
||||||
{
|
{
|
||||||
this.GetLogger().Warn($"[{Config.Name}] ClientToScreen failed.");
|
Console.WriteLine("ClientToScreen failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -273,7 +273,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
if (!succ)
|
if (!succ)
|
||||||
{
|
{
|
||||||
this.GetLogger().Warn($"[{Config.Name}] SetCursorPos failed.");
|
Console.WriteLine("SetCursorPos failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -460,13 +460,13 @@ namespace VRDash.Overlay
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.GetLogger().Warn($"[{Config.Name}] Error getting coords to draw cursor.");
|
Console.WriteLine("Error getting coords to draw cursor.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
|
string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
|
||||||
this.GetLogger().Warn($"[{Config.Name}] Error getting cursor info: {errorMessage}");
|
Console.WriteLine($"Error getting cursor info: {errorMessage}");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -507,7 +507,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
HmdVector2_t vecWindowSize = new HmdVector2_t() { v0 = data.Width, v1 = data.Height };
|
HmdVector2_t vecWindowSize = new HmdVector2_t() { v0 = data.Width, v1 = data.Height };
|
||||||
OpenVR.Overlay.SetOverlayMouseScale(m_OverlayHandle, ref vecWindowSize);
|
OpenVR.Overlay.SetOverlayMouseScale(m_OverlayHandle, ref vecWindowSize);
|
||||||
this.GetLogger().Info($"[{Config.Name}] Window resized, texture updated.");
|
Console.WriteLine("Updated!");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -567,7 +567,7 @@ namespace VRDash.Overlay
|
||||||
if (result != EVROverlayError.None)
|
if (result != EVROverlayError.None)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.GetLogger().Warn($"[{Config.Name}] Error rendering: {result}");
|
Console.WriteLine($"Error rendering: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
device.ImmediateContext.UnmapSubresource(screenTexture, 0);
|
device.ImmediateContext.UnmapSubresource(screenTexture, 0);
|
||||||
|
|
|
||||||
|
|
@ -36,31 +36,14 @@ namespace VRDash
|
||||||
SaveProfile(ConfigLocation);
|
SaveProfile(ConfigLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLoadedProfileJson()
|
|
||||||
{
|
|
||||||
IOverlayConfig[] selection = MainWindow.OverlayManager.Overlays.Select(x => x.Overlay.OverlayConfig).ToArray();
|
|
||||||
var profile = new Profile(selection);
|
|
||||||
var json = JsonConvert.SerializeObject(profile, m_Settings);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetDefaultProfileJson()
|
|
||||||
{
|
|
||||||
var json = File.ReadAllText(ConfigLocation);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsProfileSaveUpToDate()
|
|
||||||
{
|
|
||||||
return GetLoadedProfileJson() == GetDefaultProfileJson();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves config to ConfigLocation
|
/// Saves config to ConfigLocation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveProfile(string location)
|
public void SaveProfile(string location)
|
||||||
{
|
{
|
||||||
var json = GetLoadedProfileJson();
|
IOverlayConfig[] selection = MainWindow.OverlayManager.Overlays.Select(x => x.Overlay.OverlayConfig).ToArray();
|
||||||
|
var profile = new Profile(selection);
|
||||||
|
var json = JsonConvert.SerializeObject(profile, m_Settings);
|
||||||
File.WriteAllText(location, json);
|
File.WriteAllText(location, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{C12CDA63-DDBB-427B-B66A-72FA42291B04}</ProjectGuid>
|
<ProjectGuid>{C12CDA63-DDBB-427B-B66A-72FA42291B04}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>VRDash</RootNamespace>
|
<RootNamespace>VDash</RootNamespace>
|
||||||
<AssemblyName>VRDash</AssemblyName>
|
<AssemblyName>VDash</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue