mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-05 06:15:26 +00:00
Detect RTSS missing
This commit is contained in:
parent
10daa36bd6
commit
302dd58551
5 changed files with 50 additions and 33 deletions
|
|
@ -15,10 +15,13 @@ namespace PerformanceOverlay
|
|||
internal class Controller : IDisposable
|
||||
{
|
||||
public const String Title = "Performance Overlay";
|
||||
public readonly String TitleWithVersion = Title + " v" + Application.ProductVersion.ToString();
|
||||
|
||||
Container components = new Container();
|
||||
RTSSSharedMemoryNET.OSD? osd;
|
||||
ToolStripMenuItem showItem;
|
||||
System.Windows.Forms.NotifyIcon notifyIcon;
|
||||
System.Windows.Forms.Timer osdTimer;
|
||||
Sensors sensors = new Sensors();
|
||||
StartupManager startupManager = new StartupManager(
|
||||
Title,
|
||||
|
|
@ -81,13 +84,13 @@ namespace PerformanceOverlay
|
|||
exitItem.Click += ExitItem_Click;
|
||||
|
||||
notifyIcon = new System.Windows.Forms.NotifyIcon(components);
|
||||
notifyIcon.Icon = Resources.traffic_light_outline1;
|
||||
notifyIcon.Text = Title;
|
||||
notifyIcon.Icon = Resources.traffic_light_outline;
|
||||
notifyIcon.Text = TitleWithVersion;
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.ContextMenuStrip = contextMenu;
|
||||
notifyIcon.Click += NotifyIcon_Click;
|
||||
|
||||
var osdTimer = new System.Windows.Forms.Timer(components);
|
||||
osdTimer = new System.Windows.Forms.Timer(components);
|
||||
osdTimer.Tick += OsdTimer_Tick;
|
||||
osdTimer.Interval = 250;
|
||||
osdTimer.Enabled = true;
|
||||
|
|
@ -143,20 +146,26 @@ namespace PerformanceOverlay
|
|||
{
|
||||
try
|
||||
{
|
||||
notifyIcon.Text = Title + ". RTSS Version: " + OSD.Version;
|
||||
notifyIcon.Text = TitleWithVersion + ". RTSS Version: " + OSD.Version;
|
||||
notifyIcon.Icon = Resources.traffic_light_outline;
|
||||
}
|
||||
catch
|
||||
{
|
||||
notifyIcon.Text = Title + ". RTSS Not Available.";
|
||||
notifyIcon.Text = TitleWithVersion + ". RTSS Not Available.";
|
||||
notifyIcon.Icon = Resources.traffic_light_outline_red;
|
||||
osdReset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!showItem.Checked)
|
||||
{
|
||||
using (osd) { }
|
||||
osd = null;
|
||||
osdTimer.Interval = 1000;
|
||||
osdReset();
|
||||
return;
|
||||
}
|
||||
|
||||
osdTimer.Interval = 250;
|
||||
|
||||
sensors.Update();
|
||||
|
||||
var osdOverlay = Overlays.GetOSD(Settings.Default.OSDModeParsed, sensors);
|
||||
|
|
@ -174,10 +183,34 @@ namespace PerformanceOverlay
|
|||
}
|
||||
catch(SystemException)
|
||||
{
|
||||
osd = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void osdReset()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (osd != null)
|
||||
osd.Update("");
|
||||
}
|
||||
catch (SystemException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void osdClose()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (osd != null)
|
||||
osd.Dispose();
|
||||
}
|
||||
catch (SystemException)
|
||||
{
|
||||
}
|
||||
osd = null;
|
||||
}
|
||||
|
||||
private uint osdEmbedGraph(ref uint offset, ref String osdOverlay, String name, int dwWidth, int dwHeight, int dwMargin, float fltMin, float fltMax, EMBEDDED_OBJECT_GRAPH dwFlags)
|
||||
{
|
||||
uint size = osd.EmbedGraph(offset, new float[0], 0, dwWidth, dwHeight, dwMargin, fltMin, fltMax, dwFlags);
|
||||
|
|
@ -195,7 +228,7 @@ namespace PerformanceOverlay
|
|||
public void Dispose()
|
||||
{
|
||||
components.Dispose();
|
||||
using (osd) { }
|
||||
osdClose();
|
||||
using (sensors) { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue