From 40f709ff550065eed9bf083c84dd7a06d94310f1 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Tue, 28 Oct 2025 19:04:25 -0500 Subject: [PATCH] misc: Add a launch guard for program files (the emulator does not work properly when put here as it does not require admin) --- src/Ryujinx/Program.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index f0e0c2ec3..1659683c1 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -48,11 +48,21 @@ namespace Ryujinx.Ava public static int Main(string[] args) { Version = ReleaseInformation.Version; - - if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 19041)) + + if (OperatingSystem.IsWindows()) { - _ = MessageBoxA(nint.Zero, "You are running an outdated version of Windows.\n\nRyujinx supports Windows 10 version 20H1 and newer.\n", $"Ryujinx {Version}", MbIconwarning); - return 0; + if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 19041)) + { + _ = MessageBoxA(nint.Zero, "You are running an outdated version of Windows.\n\nRyujinx supports Windows 10 version 20H1 and newer.\n", $"Ryujinx {Version}", MbIconwarning); + return 0; + } + + if (Environment.CurrentDirectory.StartsWithIgnoreCase("C:\\Program Files") || + Environment.CurrentDirectory.StartsWithIgnoreCase("C:\\Program Files (x86)")) + { + _ = MessageBoxA(nint.Zero, "Ryujinx is not intended to be run from the Program Files folder. Please move it out and relaunch.", $"Ryujinx {Version}", MbIconwarning); + return 0; + } } PreviewerDetached = true;