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().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 @@ + \ 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 @@ + + + + Nintendo Content Archive + + + + Nintendo Relocatable Object + + + + Nintendo Shared Object + + + + Nintendo Submission Package + + + + Nintendo Switch Cartridge + + + 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