aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx/Program.cs
diff options
context:
space:
mode:
authorRMED24 <81475204+RMED24@users.noreply.github.com>2023-01-07 08:06:13 +0000
committerGitHub <noreply@github.com>2023-01-07 09:06:13 +0100
commitcbaa845f5d51fe61a46d1a57950aa76a0a976d3e (patch)
tree952dbd2ec9dcc83e8c9ba5b9f4910808068b22bb /Ryujinx/Program.cs
parent9e2681f2d7e9b36af30f600b79107cb9cd6aa5f1 (diff)
Include a start.sh file with correct launch options (#4013)1.1.516
* Include reference to start.sh to be bundled * Add start.sh * Fix silly mistake I made on windows-x64 * ... I cannot read properly * Make same changes for avalonia csproj * Remove notice from start.sh Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx/Ryujinx.csproj Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx.Ava/Ryujinx.Ava.csproj Co-authored-by: Mary-nyan <thog@protonmail.com> * Update distribution/linux/start.sh Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update distribution/linux/start.sh Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/Ryujinx.Ava.csproj Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.csproj * Update Ryujinx.Ava.csproj * Rename start.sh to Ryujinx.sh * Update Ryujinx.csproj * Update Ryujinx.Ava.csproj * Update Ryujinx.Ava.csproj * Update Ryujinx.Ava/Ryujinx.Ava.csproj Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Add `GDK_BACKEND` variable * Update Ryujinx.Ava.csproj * Update Program.cs * Update Program.cs * Update Ryujinx.sh * Update Program.cs * linux: Register mime types on launch * Add DOTNET_EnableAlternateStackCheck=1 to desktop file * linux: Add exclusion for RegisterMimeTypes for flathub builds * Update logo path * Cleanup Ryujinx.sh * Fix typo in ReleaseInformation * gha: Fix permissions for linux release binaries * ava: Rename output assembly to Ryujinx * Update mime database after installing new types Wait until logging is available before registering mime types * Copy mime types to output directory Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Diffstat (limited to 'Ryujinx/Program.cs')
-rw-r--r--Ryujinx/Program.cs53
1 files changed, 52 insertions, 1 deletions
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 787a8ad5..b1fedaad 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -18,6 +18,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Threading.Tasks;
namespace Ryujinx
@@ -72,9 +73,51 @@ namespace Ryujinx
}
}
+ [SupportedOSPlatform("linux")]
+ static void RegisterMimeTypes()
+ {
+ if (ReleaseInformation.IsFlatHubBuild())
+ {
+ return;
+ }
+
+ string mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime");
+
+ if (!File.Exists(Path.Combine(mimeDbPath, "packages", "Ryujinx.xml")))
+ {
+ string mimeTypesFile = Path.Combine(ReleaseInformation.GetBaseApplicationDirectory(), "mime", "Ryujinx.xml");
+ using Process mimeProcess = new();
+
+ mimeProcess.StartInfo.FileName = "xdg-mime";
+ mimeProcess.StartInfo.Arguments = $"install --novendor --mode user {mimeTypesFile}";
+
+ mimeProcess.Start();
+ mimeProcess.WaitForExit();
+
+ if (mimeProcess.ExitCode != 0)
+ {
+ Logger.Error?.PrintMsg(LogClass.Application, $"Unable to install mime types. Make sure xdg-utils is installed. Process exited with code: {mimeProcess.ExitCode}");
+ return;
+ }
+
+ using Process updateMimeProcess = new();
+
+ updateMimeProcess.StartInfo.FileName = "update-mime-database";
+ updateMimeProcess.StartInfo.Arguments = mimeDbPath;
+
+ updateMimeProcess.Start();
+ updateMimeProcess.WaitForExit();
+
+ if (updateMimeProcess.ExitCode != 0)
+ {
+ Logger.Error?.PrintMsg(LogClass.Application, $"Could not update local mime database. Process exited with code: {updateMimeProcess.ExitCode}");
+ }
+ }
+ }
+
static void Main(string[] args)
{
- Version = ReleaseInformations.GetVersion();
+ Version = ReleaseInformation.GetVersion();
if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134))
{
@@ -101,6 +144,8 @@ namespace Ryujinx
if (OperatingSystem.IsLinux())
{
XInitThreads();
+ Environment.SetEnvironmentVariable("GDK_BACKEND", "x11");
+ setenv("GDK_BACKEND", "x11", 1);
}
if (OperatingSystem.IsMacOS())
@@ -144,6 +189,12 @@ namespace Ryujinx
// Initialize the logger system.
LoggerModule.Initialize();
+ // Register mime types on linux.
+ if (OperatingSystem.IsLinux())
+ {
+ RegisterMimeTypes();
+ }
+
// Initialize Discord integration.
DiscordIntegrationModule.Initialize();