Browse Source

misc: chore: Improve autoloading DLC/updates logging, deliberately switch to Vulkan if Metal was somehow chosen on a non-mac system, add logger lines in the updater, cleanup enabled logs printing

Evan Husted 1 year ago
parent
commit
789d6ab959

+ 1 - 0
src/Ryujinx.Common/TitleIDs.cs

@@ -14,6 +14,7 @@ namespace Ryujinx.Common
         {
         {
             switch (currentBackend)
             switch (currentBackend)
             {
             {
+                case GraphicsBackend.Metal when !OperatingSystem.IsMacOS():
                 case GraphicsBackend.OpenGl when OperatingSystem.IsMacOS():
                 case GraphicsBackend.OpenGl when OperatingSystem.IsMacOS():
                     return GraphicsBackend.Vulkan;
                     return GraphicsBackend.Vulkan;
                 case GraphicsBackend.Vulkan or GraphicsBackend.OpenGl or GraphicsBackend.Metal:
                 case GraphicsBackend.Vulkan or GraphicsBackend.OpenGl or GraphicsBackend.Metal:

+ 6 - 2
src/Ryujinx/AppHost.cs

@@ -674,7 +674,7 @@ namespace Ryujinx.Ava
 
 
         public async Task<bool> LoadGuestApplication(BlitStruct<ApplicationControlProperty>? customNacpData = null)
         public async Task<bool> LoadGuestApplication(BlitStruct<ApplicationControlProperty>? customNacpData = null)
         {
         {
-            InitializeSwitchInstance();
+            InitEmulatedSwitch();
             MainWindow.UpdateGraphicsConfig();
             MainWindow.UpdateGraphicsConfig();
 
 
             SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
             SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
@@ -757,6 +757,8 @@ namespace Ryujinx.Ava
                 {
                 {
                     romFsFiles = Directory.GetFiles(ApplicationPath, "*.romfs");
                     romFsFiles = Directory.GetFiles(ApplicationPath, "*.romfs");
                 }
                 }
+                
+                Logger.Notice.Print(LogClass.Application, $"Loading unpacked content archive from '{ApplicationPath}'.");
 
 
                 if (romFsFiles.Length > 0)
                 if (romFsFiles.Length > 0)
                 {
                 {
@@ -783,6 +785,8 @@ namespace Ryujinx.Ava
             }
             }
             else if (File.Exists(ApplicationPath))
             else if (File.Exists(ApplicationPath))
             {
             {
+                Logger.Notice.Print(LogClass.Application, $"Loading content archive from '{ApplicationPath}'.");
+                
                 switch (Path.GetExtension(ApplicationPath).ToLowerInvariant())
                 switch (Path.GetExtension(ApplicationPath).ToLowerInvariant())
                 {
                 {
                     case ".xci":
                     case ".xci":
@@ -885,7 +889,7 @@ namespace Ryujinx.Ava
             Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
             Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
         }
         }
 
 
-        private void InitializeSwitchInstance()
+        private void InitEmulatedSwitch()
         {
         {
             // Initialize KeySet.
             // Initialize KeySet.
             VirtualFileSystem.ReloadKeySet();
             VirtualFileSystem.ReloadKeySet();

+ 7 - 5
src/Ryujinx/Program.cs

@@ -233,11 +233,13 @@ namespace Ryujinx.Ava
             Logger.Notice.Print(LogClass.Application, $".NET Runtime: {RuntimeInformation.FrameworkDescription}");
             Logger.Notice.Print(LogClass.Application, $".NET Runtime: {RuntimeInformation.FrameworkDescription}");
             SystemInfo.Gather().Print();
             SystemInfo.Gather().Print();
 
 
-            var enabledLogLevels = Logger.GetEnabledLevels().ToArray();
-
-            Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(enabledLogLevels.Length is 0
-                    ? "<None>"
-                    : enabledLogLevels.JoinToString(", "))}");
+            Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {
+                Logger.GetEnabledLevels()
+                    .FormatCollection(
+                        x => x.ToString(), 
+                        separator: ", ", 
+                        emptyCollectionFallback: "<None>")
+            }");
 
 
             Logger.Notice.Print(LogClass.Application,
             Logger.Notice.Print(LogClass.Application,
                 AppDataManager.Mode == AppDataManager.LaunchMode.Custom
                 AppDataManager.Mode == AppDataManager.LaunchMode.Custom

+ 1 - 0
src/Ryujinx/UI/Windows/MainWindow.axaml.cs

@@ -691,6 +691,7 @@ namespace Ryujinx.Ava.UI.Windows
                 ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs);
                 ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs);
 
 
                 var autoloadDirs = ConfigurationState.Instance.UI.AutoloadDirs.Value;
                 var autoloadDirs = ConfigurationState.Instance.UI.AutoloadDirs.Value;
+                autoloadDirs.ForEach(dir => Logger.Info?.Print(LogClass.Application, $"Auto loading DLC & updates from: {dir}"));
                 if (autoloadDirs.Count > 0)
                 if (autoloadDirs.Count > 0)
                 {
                 {
                     var updatesLoaded = ApplicationLibrary.AutoLoadTitleUpdates(autoloadDirs, out int updatesRemoved);
                     var updatesLoaded = ApplicationLibrary.AutoLoadTitleUpdates(autoloadDirs, out int updatesRemoved);

+ 6 - 0
src/Ryujinx/Updater.cs

@@ -87,6 +87,8 @@ namespace Ryujinx.Ava
 
 
                 return;
                 return;
             }
             }
+            
+            Logger.Info?.Print(LogClass.Application, "Checking for updates.");
 
 
             // Get latest version number from GitHub API
             // Get latest version number from GitHub API
             try
             try
@@ -140,6 +142,8 @@ namespace Ryujinx.Ava
                             OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
                             OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
                         }
                         }
                     }
                     }
+                    
+                    Logger.Info?.Print(LogClass.Application, "Up to date.");
 
 
                     _running = false;
                     _running = false;
 
 
@@ -214,6 +218,8 @@ namespace Ryujinx.Ava
                     ? $"Canary {currentVersion} -> Canary {newVersion}"
                     ? $"Canary {currentVersion} -> Canary {newVersion}"
                     : $"{currentVersion} -> {newVersion}";
                     : $"{currentVersion} -> {newVersion}";
                 
                 
+                Logger.Info?.Print(LogClass.Application, $"Version found: {newVersionString}");
+                
             RequestUserToUpdate:
             RequestUserToUpdate:
                 // Show a message asking the user if they want to update
                 // Show a message asking the user if they want to update
                 UserResult shouldUpdate = await ContentDialogHelper.CreateUpdaterChoiceDialog(
                 UserResult shouldUpdate = await ContentDialogHelper.CreateUpdaterChoiceDialog(

+ 0 - 6
src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs

@@ -840,7 +840,6 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
             try
             try
             {
             {
                 // Remove any downloadable content which can no longer be located on disk
                 // Remove any downloadable content which can no longer be located on disk
-                Logger.Notice.Print(LogClass.Application, $"Removing non-existing Title DLCs");
                 var dlcToRemove = _downloadableContents.Items
                 var dlcToRemove = _downloadableContents.Items
                     .Where(dlc => !File.Exists(dlc.Dlc.ContainerPath))
                     .Where(dlc => !File.Exists(dlc.Dlc.ContainerPath))
                     .ToList();
                     .ToList();
@@ -852,8 +851,6 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
 
 
                 foreach (string appDir in appDirs)
                 foreach (string appDir in appDirs)
                 {
                 {
-                    Logger.Notice.Print(LogClass.Application, $"Auto loading DLC from: {appDir}");
-
                     if (_cancellationToken.Token.IsCancellationRequested)
                     if (_cancellationToken.Token.IsCancellationRequested)
                     {
                     {
                         return newDlcLoaded;
                         return newDlcLoaded;
@@ -956,7 +953,6 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
                 var titleIdsToRefresh = new HashSet<ulong>();
                 var titleIdsToRefresh = new HashSet<ulong>();
 
 
                 // Remove any updates which can no longer be located on disk
                 // Remove any updates which can no longer be located on disk
-                Logger.Notice.Print(LogClass.Application, $"Removing non-existing Title Updates");
                 var updatesToRemove = _titleUpdates.Items
                 var updatesToRemove = _titleUpdates.Items
                     .Where(it => !File.Exists(it.TitleUpdate.Path))
                     .Where(it => !File.Exists(it.TitleUpdate.Path))
                     .ToList();
                     .ToList();
@@ -971,8 +967,6 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
 
 
                 foreach (string appDir in appDirs)
                 foreach (string appDir in appDirs)
                 {
                 {
-                    Logger.Notice.Print(LogClass.Application, $"Auto loading updates from: {appDir}");
-
                     if (_cancellationToken.Token.IsCancellationRequested)
                     if (_cancellationToken.Token.IsCancellationRequested)
                     {
                     {
                         return numUpdatesLoaded;
                         return numUpdatesLoaded;