diff options
-rw-r--r-- | Ryujinx.Common/ReleaseInformations.cs | 21 | ||||
-rw-r--r-- | Ryujinx.Headless.SDL2/Program.cs | 4 | ||||
-rw-r--r-- | Ryujinx.SDL2.Common/SDL2Driver.cs | 5 | ||||
-rw-r--r-- | Ryujinx/Configuration/LoggerModule.cs | 2 | ||||
-rw-r--r-- | Ryujinx/Modules/Updater/Updater.cs | 15 | ||||
-rw-r--r-- | Ryujinx/Ui/MainWindow.cs | 2 | ||||
-rw-r--r-- | distribution/linux/ryujinx-logo.svg | 1 | ||||
-rw-r--r-- | distribution/linux/ryujinx-mime.xml | 23 | ||||
-rw-r--r-- | distribution/linux/ryujinx.desktop | 14 |
9 files changed, 76 insertions, 11 deletions
diff --git a/Ryujinx.Common/ReleaseInformations.cs b/Ryujinx.Common/ReleaseInformations.cs index 32a01948..35890406 100644 --- a/Ryujinx.Common/ReleaseInformations.cs +++ b/Ryujinx.Common/ReleaseInformations.cs @@ -1,10 +1,14 @@ -using System.Reflection; +using Ryujinx.Common.Configuration; +using System; +using System.Reflection; namespace Ryujinx.Common { // DO NOT EDIT, filled by CI public static class ReleaseInformations { + private const string FlatHubChannelOwner = "flathub"; + public static string BuildVersion = "%%RYUJINX_BUILD_VERSION%%"; public static string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%"; public static string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%"; @@ -19,6 +23,11 @@ namespace Ryujinx.Common !ReleaseChannelRepo.StartsWith("%%"); } + public static bool IsFlatHubBuild() + { + return IsValid() && ReleaseChannelOwner.Equals(FlatHubChannelOwner); + } + public static string GetVersion() { if (IsValid()) @@ -30,5 +39,15 @@ namespace Ryujinx.Common return Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; } } + + public static string GetBaseApplicationDirectory() + { + if (IsFlatHubBuild()) + { + return AppDataManager.BaseDirPath; + } + + return AppDomain.CurrentDomain.BaseDirectory; + } } } diff --git a/Ryujinx.Headless.SDL2/Program.cs b/Ryujinx.Headless.SDL2/Program.cs index 973b4f5e..4daf6084 100644 --- a/Ryujinx.Headless.SDL2/Program.cs +++ b/Ryujinx.Headless.SDL2/Program.cs @@ -310,7 +310,7 @@ namespace Ryujinx.Headless.SDL2 { controllerConfig.RangeLeft = 1.0f; controllerConfig.RangeRight = 1.0f; - + Logger.Info?.Print(LogClass.Application, $"{config.PlayerIndex} stick range reset. Save the profile now to update your configuration"); } } @@ -396,7 +396,7 @@ namespace Ryujinx.Headless.SDL2 if ((bool)option.EnableFileLog) { Logger.AddTarget(new AsyncLogTargetWrapper( - new FileLogTarget(AppDomain.CurrentDomain.BaseDirectory, "file"), + new FileLogTarget(ReleaseInformations.GetBaseApplicationDirectory(), "file"), 1000, AsyncLogTargetOverflowAction.Block )); diff --git a/Ryujinx.SDL2.Common/SDL2Driver.cs b/Ryujinx.SDL2.Common/SDL2Driver.cs index 944f8e57..fbf2b64a 100644 --- a/Ryujinx.SDL2.Common/SDL2Driver.cs +++ b/Ryujinx.SDL2.Common/SDL2Driver.cs @@ -1,4 +1,5 @@ -using Ryujinx.Common.Logging; +using Ryujinx.Common; +using Ryujinx.Common.Logging; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -81,7 +82,7 @@ namespace Ryujinx.SDL2.Common SDL_EventState(SDL_EventType.SDL_CONTROLLERSENSORUPDATE, SDL_DISABLE); - string gamepadDbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SDL_GameControllerDB.txt"); + string gamepadDbPath = Path.Combine(ReleaseInformations.GetBaseApplicationDirectory(), "SDL_GameControllerDB.txt"); if (File.Exists(gamepadDbPath)) { diff --git a/Ryujinx/Configuration/LoggerModule.cs b/Ryujinx/Configuration/LoggerModule.cs index 9e81f725..cf873e56 100644 --- a/Ryujinx/Configuration/LoggerModule.cs +++ b/Ryujinx/Configuration/LoggerModule.cs @@ -80,7 +80,7 @@ namespace Ryujinx.Configuration if (e.NewValue) { Logger.AddTarget(new AsyncLogTargetWrapper( - new FileLogTarget(AppDomain.CurrentDomain.BaseDirectory, "file"), + new FileLogTarget(ReleaseInformations.GetBaseApplicationDirectory(), "file"), 1000, AsyncLogTargetOverflowAction.Block )); diff --git a/Ryujinx/Modules/Updater/Updater.cs b/Ryujinx/Modules/Updater/Updater.cs index f3a25015..bf5f54ed 100644 --- a/Ryujinx/Modules/Updater/Updater.cs +++ b/Ryujinx/Modules/Updater/Updater.cs @@ -311,7 +311,7 @@ namespace Ryujinx.Modules catch (Exception e) { Logger.Warning?.Print(LogClass.Application, e.Message); - Logger.Warning?.Print(LogClass.Application, $"Multi-Threaded update failed, falling back to single-threaded updater."); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); DoUpdateWithSingleThread(updateDialog, downloadUrl, updateFile); @@ -327,8 +327,8 @@ namespace Ryujinx.Modules catch (WebException ex) { Logger.Warning?.Print(LogClass.Application, ex.Message); - Logger.Warning?.Print(LogClass.Application, $"Multi-Threaded update failed, falling back to single-threaded updater."); - + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); + for (int j = 0; j < webClients.Count; j++) { webClients[j].CancelAsync(); @@ -567,7 +567,14 @@ namespace Ryujinx.Modules #else if (showWarnings) { - GtkDialog.CreateWarningDialog("Updater Disabled!", "Please download Ryujinx at https://ryujinx.org/ if you are looking for a supported version."); + if (ReleaseInformations.IsFlatHubBuild()) + { + GtkDialog.CreateWarningDialog("Updater Disabled!", "Please update Ryujinx via FlatHub."); + } + else + { + GtkDialog.CreateWarningDialog("Updater Disabled!", "Please download Ryujinx at https://ryujinx.org/ if you are looking for a supported version."); + } } return false; diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index 0c94fc67..5ab3cf61 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -1291,7 +1291,7 @@ namespace Ryujinx.Ui private void OpenLogsFolder_Pressed(object sender, EventArgs args) { - string logPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs"); + string logPath = System.IO.Path.Combine(ReleaseInformations.GetBaseApplicationDirectory(), "Logs"); new DirectoryInfo(logPath).Create(); diff --git a/distribution/linux/ryujinx-logo.svg b/distribution/linux/ryujinx-logo.svg new file mode 100644 index 00000000..d6a76312 --- /dev/null +++ b/distribution/linux/ryujinx-logo.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 255.76 255.76"><defs><style>.cls-1{fill:#02c5e5;}.cls-2{fill:#ff5f55;}.cls-3{fill:none;}</style></defs><g id="Ebene_2" data-name="Ebene 2"><g id="Ebene_1-2" data-name="Ebene 1"><g id="Ebene_2-2" data-name="Ebene 2"><g id="Ebene_1-2-2" data-name="Ebene 1-2"><path class="cls-1" d="M80.63,0V220.39H44.37c-14,0-35.74-20.74-35.74-39.13V40.13C8.63,19.19,31.36,0,49.06,0Z"/><path class="cls-2" d="M175.13,35.37V255.76h36.26c14,0,35.74-20.74,35.74-39.13V75.5c0-20.94-22.73-40.13-40.43-40.13Z"/><polygon class="cls-1" points="124.34 137.96 122.58 145.57 90.64 145.57 92.89 137.96 124.34 137.96"/><polygon class="cls-2" points="160.29 137.96 157.84 145.57 122.58 145.57 124.34 137.96 160.29 137.96"/><polygon class="cls-1" points="130.39 111.86 128.62 119.47 95.14 119.47 97.39 111.86 130.39 111.86"/><polygon class="cls-2" points="164.79 111.86 162.34 119.47 128.62 119.47 130.39 111.86 164.79 111.86"/><polygon class="cls-1" points="104.24 167.99 122.83 87.77 129.78 87.77 111.19 167.99 104.24 167.99"/><polygon class="cls-2" points="128.18 167.99 146.77 87.77 153.89 87.77 135.3 167.99 128.18 167.99"/></g><rect class="cls-3" width="255.76" height="255.76"/></g></g></g></svg>
\ No newline at end of file diff --git a/distribution/linux/ryujinx-mime.xml b/distribution/linux/ryujinx-mime.xml new file mode 100644 index 00000000..6ec35c84 --- /dev/null +++ b/distribution/linux/ryujinx-mime.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> + <mime-type type="application/x-nx-nca"> + <comment>Nintendo Content Archive</comment> + <glob pattern="*.nca"/> + </mime-type> + <mime-type type="application/x-nx-nro"> + <comment>Nintendo Relocatable Object</comment> + <glob pattern="*.nro"/> + </mime-type> + <mime-type type="application/x-nx-nso"> + <comment>Nintendo Shared Object</comment> + <glob pattern="*.nso"/> + </mime-type> + <mime-type type="application/x-nx-nsp"> + <comment>Nintendo Submission Package</comment> + <glob pattern="*.nsp"/> + </mime-type> + <mime-type type="application/x-nx-xci"> + <comment>Nintendo Switch Cartridge</comment> + <glob pattern="*.xci"/> + </mime-type> +</mime-info> diff --git a/distribution/linux/ryujinx.desktop b/distribution/linux/ryujinx.desktop new file mode 100644 index 00000000..dbfc43e4 --- /dev/null +++ b/distribution/linux/ryujinx.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Version=1.0 +Name=Ryujinx +Comment=A Nintendo Switch Emulator +Type=Application +GenericName=Nintendo Switch Emulator +Icon=ryujinx +Terminal=false +Exec=Ryujinx %f +Categories=Game;Emulator;GTK; +MimeType=application/x-nx-nca;application/x-nx-nro;application/x-nx-nso;application/x-nx-nsp;application/x-nx-xci; +Keywords=Switch;Nintendo;Emulator; +StartupWMClass=Ryujinx +PrefersNonDefaultGPU=true |