diff --git a/CommonHelpers/AntiCheatSettings.cs b/CommonHelpers/AntiCheatSettings.cs index 6d53a7b..3d92429 100644 --- a/CommonHelpers/AntiCheatSettings.cs +++ b/CommonHelpers/AntiCheatSettings.cs @@ -86,11 +86,7 @@ namespace CommonHelpers if (footnote is not null) page.Footnote.Text += "\n" + footnote; - page.HelpRequest += delegate - { - try { System.Diagnostics.Process.Start("explorer.exe", HelpURL); } - catch { } - }; + page.HelpRequest += delegate { Dependencies.OpenLink(HelpURL); }; var result = TaskDialog.ShowDialog(new Form { TopMost = true }, page, TaskDialogStartupLocation.CenterScreen); if (result != continueButton) diff --git a/CommonHelpers/Dependencies.cs b/CommonHelpers/Dependencies.cs index df52dfa..60bd16e 100644 --- a/CommonHelpers/Dependencies.cs +++ b/CommonHelpers/Dependencies.cs @@ -25,8 +25,9 @@ namespace CommonHelpers "RTSSHooks64.dll" }; - private static string VCRuntimeURL = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; - private static string RTSSURL = "https://www.guru3d.com/files-details/rtss-rivatuner-statistics-server-download.html"; + public static string SDTURL = "https://steam-deck-tools.ayufan.dev"; + public static string VCRuntimeURL = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; + public static string RTSSURL = "https://www.guru3d.com/files-details/rtss-rivatuner-statistics-server-download.html"; public static void ValidateHidapi(string title) { @@ -107,7 +108,7 @@ namespace CommonHelpers ); if (result == downloadButton) - ExecuteLink(url); + OpenLink(url); return false; } @@ -136,7 +137,7 @@ namespace CommonHelpers if (result == downloadButton) { - ExecuteLink(url); + OpenLink(url); Environment.Exit(1); } else if (result == exitButton) @@ -189,7 +190,7 @@ namespace CommonHelpers page.HelpRequest += delegate { - try { ExecuteLink(url); } + try { OpenLink(url); } catch { } }; } @@ -197,7 +198,7 @@ namespace CommonHelpers return TaskDialog.ShowDialog(new Form { TopMost = true }, page, TaskDialogStartupLocation.CenterScreen); } - private static void ExecuteLink(string link) + public static void OpenLink(string link) { try { Process.Start("explorer.exe", link); } catch { } diff --git a/CommonHelpers/OSDHelpers.cs b/CommonHelpers/OSDHelpers.cs index 4cd70ab..fd001a1 100644 --- a/CommonHelpers/OSDHelpers.cs +++ b/CommonHelpers/OSDHelpers.cs @@ -27,6 +27,15 @@ namespace CommonHelpers return Applications.Instance.FindForeground(out processId, out processName); } + public static bool IsLoaded + { + get + { + Applications.Instance.Refresh(); + return Applications.Instance.IsLoaded; + } + } + public class Applications { public readonly static Applications Instance = new Applications(); @@ -45,6 +54,7 @@ namespace CommonHelpers } public IDictionary IDs { get; private set; } = new Dictionary(); + public bool IsLoaded { get; private set; } private const int FrameTimeoutMs = 5000; @@ -60,8 +70,16 @@ namespace CommonHelpers var oldIDs = IDs; var newIDs = new Dictionary(); - try { appEntries = OSD.GetAppEntries(AppFlags.MASK); } - catch { return; } + try + { + appEntries = OSD.GetAppEntries(AppFlags.MASK); + IsLoaded = true; + } + catch + { + IsLoaded = false; + return; + } var now = DateTimeOffset.UtcNow; diff --git a/FanControl/FanControlForm.cs b/FanControl/FanControlForm.cs index ff79842..585a72a 100644 --- a/FanControl/FanControlForm.cs +++ b/FanControl/FanControlForm.cs @@ -215,7 +215,7 @@ namespace FanControl private void help_DoubleClick(object sender, EventArgs e) { - System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev"); + Dependencies.OpenLink(Dependencies.SDTURL); } private void toolStripMenuItemAlwaysOnTop_Click(object sender, EventArgs e) diff --git a/PerformanceOverlay/Controller.cs b/PerformanceOverlay/Controller.cs index 77f584e..723b1a9 100644 --- a/PerformanceOverlay/Controller.cs +++ b/PerformanceOverlay/Controller.cs @@ -45,6 +45,10 @@ namespace PerformanceOverlay if (Instance.WantsRunOnStartup) startupManager.Startup = true; + var notRunningRTSSItem = contextMenu.Items.Add("&RTSS is not running"); + notRunningRTSSItem.Enabled = false; + contextMenu.Opening += delegate { notRunningRTSSItem.Visible = Dependencies.EnsureRTSS(null) && !OSDHelpers.IsLoaded; }; + showItem = new ToolStripMenuItem("&Show OSD"); showItem.Click += ShowItem_Click; showItem.Checked = Settings.Default.ShowOSD; @@ -84,11 +88,15 @@ namespace PerformanceOverlay contextMenu.Items.Add(startupItem); } + var missingRTSSItem = contextMenu.Items.Add("&Install missing RTSS"); + missingRTSSItem.Click += delegate { Dependencies.OpenLink(Dependencies.RTSSURL); }; + contextMenu.Opening += delegate { missingRTSSItem.Visible = !Dependencies.EnsureRTSS(null); }; + var checkForUpdatesItem = contextMenu.Items.Add("&Check for Updates"); checkForUpdatesItem.Click += delegate { Instance.RunUpdater(TitleWithVersion, true); }; var helpItem = contextMenu.Items.Add("&Help"); - helpItem.Click += delegate { System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev"); }; + helpItem.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL); }; contextMenu.Items.Add(new ToolStripSeparator()); diff --git a/PowerControl/Controller.cs b/PowerControl/Controller.cs index be46e00..ab42857 100644 --- a/PowerControl/Controller.cs +++ b/PowerControl/Controller.cs @@ -58,6 +58,10 @@ namespace PowerControl var contextMenu = new System.Windows.Forms.ContextMenuStrip(components); + var notRunningRTSSItem = contextMenu.Items.Add("&RTSS is not running"); + notRunningRTSSItem.Enabled = false; + contextMenu.Opening += delegate { notRunningRTSSItem.Visible = Dependencies.EnsureRTSS(null) && !OSDHelpers.IsLoaded; }; + rootMenu.Init(); rootMenu.Visible = false; rootMenu.Update(); @@ -77,11 +81,15 @@ namespace PowerControl contextMenu.Items.Add(startupItem); } + var missingRTSSItem = contextMenu.Items.Add("&Install missing RTSS"); + missingRTSSItem.Click += delegate { Dependencies.OpenLink(Dependencies.RTSSURL); }; + contextMenu.Opening += delegate { missingRTSSItem.Visible = !Dependencies.EnsureRTSS(null); }; + var checkForUpdatesItem = contextMenu.Items.Add("&Check for Updates"); checkForUpdatesItem.Click += delegate { Instance.RunUpdater(TitleWithVersion, true); }; var helpItem = contextMenu.Items.Add("&Help"); - helpItem.Click += delegate { System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev"); }; + helpItem.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL); }; contextMenu.Items.Add(new ToolStripSeparator()); var exitItem = contextMenu.Items.Add("&Exit"); diff --git a/RELEASE.md b/RELEASE.md index 12ceb7f..6c1552f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,6 +9,7 @@ ## 0.6.x +- All: Show `Missing RTSS` button to install RTSS - PowerControl: Retain FPS Limit (proportion) on refresh rate change - PowerControl: Support RTSS in custom folder - SteamController: Fix Steam Big Picture detection for non-english diff --git a/SteamController/Controller.cs b/SteamController/Controller.cs index 79030da..a7bbe42 100644 --- a/SteamController/Controller.cs +++ b/SteamController/Controller.cs @@ -133,7 +133,7 @@ namespace SteamController settingsItem.Click += Settings_Click; var shortcutsItem = contextMenu.Items.Add("&Shortcuts"); - shortcutsItem.Click += delegate { Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev/shortcuts.html"); }; + shortcutsItem.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL + "/shortcuts.html"); }; contextMenu.Items.Add(new ToolStripSeparator()); @@ -149,7 +149,7 @@ namespace SteamController checkForUpdatesItem.Click += delegate { Instance.RunUpdater(TitleWithVersion, true); }; var helpItem = contextMenu.Items.Add("&Help"); - helpItem.Click += delegate { Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev"); }; + helpItem.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL); }; contextMenu.Items.Add(new ToolStripSeparator()); @@ -338,11 +338,7 @@ namespace SteamController page.Footnote.Text += "Close Steam before confirming as otherwise Steam will be forcefully closed."; page.Footnote.Icon = TaskDialogIcon.Warning; - page.HelpRequest += delegate - { - try { System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev/steam-controller"); } - catch { } - }; + page.HelpRequest += delegate { Dependencies.OpenLink(Dependencies.SDTURL + "/steam-controller"); }; var result = TaskDialog.ShowDialog(new Form { TopMost = true }, page, TaskDialogStartupLocation.CenterScreen); if (result != continueButton) @@ -414,7 +410,7 @@ namespace SteamController Dock = DockStyle.Top, Font = new Font("Segoe UI", 9F, FontStyle.Bold | FontStyle.Underline), ForeColor = SystemColors.HotTrack, - Text = "https://steam-deck-tools.ayufan.dev", + Text = Dependencies.SDTURL, TextAlign = ContentAlignment.MiddleCenter }; @@ -432,8 +428,8 @@ namespace SteamController Height = 100 }; - helpLabel.Click += delegate { Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev"); }; - donateLabel.Click += delegate { Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev/#help-this-project"); }; + helpLabel.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL); }; + donateLabel.Click += delegate { Dependencies.OpenLink(Dependencies.SDTURL + "/#help-this-project"); }; propertyGrid.ExpandAllGridItems(); form.Controls.Add(propertyGrid);