Skip to content

Commit

Permalink
Merge pull request #26511 from bdach/i-wish-i-were-a-carpenter-right-now
Browse files Browse the repository at this point in the history
Fix broken windows installer
  • Loading branch information
peppy authored Jan 14, 2024
2 parents 3d3f58c + 1e3c332 commit 779e509
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions osu.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ public static class Program
[STAThread]
public static void Main(string[] args)
{
// NVIDIA profiles are based on the executable name of a process.
// Lazer and stable share the same executable name.
// Stable sets this setting to "Off", which may not be what we want, so let's force it back to the default "Auto" on startup.
NVAPI.ThreadedOptimisations = NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;

// run Squirrel first, as the app may exit after these run
/*
* WARNING: DO NOT PLACE **ANY** CODE ABOVE THE FOLLOWING BLOCK!
*
* Logic handling Squirrel MUST run before EVERYTHING if you do not want to break it.
* To be more precise: Squirrel is internally using a rather... crude method to determine whether it is running under NUnit,
* namely by checking loaded assemblies:
* https://github.com/clowd/Clowd.Squirrel/blob/24427217482deeeb9f2cacac555525edfc7bd9ac/src/Squirrel/SimpleSplat/PlatformModeDetector.cs#L17-L32
*
* If it finds ANY assembly from the ones listed above - REGARDLESS of the reason why it is loaded -
* the app will then do completely broken things like:
* - not creating system shortcuts (as the logic is if'd out if "running tests")
* - not exiting after the install / first-update / uninstall hooks are ran (as the `Environment.Exit()` calls are if'd out if "running tests")
*/
if (OperatingSystem.IsWindows())
{
var windowsVersion = Environment.OSVersion.Version;
Expand All @@ -59,6 +66,11 @@ public static void Main(string[] args)
setupSquirrel();
}

// NVIDIA profiles are based on the executable name of a process.
// Lazer and stable share the same executable name.
// Stable sets this setting to "Off", which may not be what we want, so let's force it back to the default "Auto" on startup.
NVAPI.ThreadedOptimisations = NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;

// Back up the cwd before DesktopGameHost changes it
string cwd = Environment.CurrentDirectory;

Expand Down

0 comments on commit 779e509

Please sign in to comment.