From ce31a47934756252dc1237e7c782afebe8636b5f Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 9 Jun 2025 17:57:26 -0500 Subject: [PATCH 01/34] misc: Code styling changes & cleanups --- src/Ryujinx/Program.cs | 12 ++--- .../Systems/AppLibrary/ApplicationLibrary.cs | 2 +- .../UI/ViewModels/Input/InputViewModel.cs | 46 +++++-------------- .../UI/ViewModels/MainWindowViewModel.cs | 22 ++++----- .../UI/ViewModels/SettingsViewModel.cs | 24 +++++----- src/Ryujinx/UI/Views/Input/InputView.axaml | 1 - src/Ryujinx/UI/Views/Input/InputView.axaml.cs | 5 +- .../UI/Views/Settings/SettingsInputView.axaml | 2 +- .../GameSpecificSettingsWindow.axaml.cs | 4 +- 9 files changed, 42 insertions(+), 76 deletions(-) diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 077639b41..09759d7cc 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -25,7 +25,6 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; -using Silk.NET.Vulkan; namespace Ryujinx.Ava { @@ -36,7 +35,7 @@ namespace Ryujinx.Ava public static string Version { get; private set; } public static string ConfigurationPath { get; private set; } public static string GlobalConfigurationPath { get; private set; } - public static bool UseExtraConfig{ get; private set; } + public static bool UseExtraConfig { get; set; } public static bool PreviewerDetached { get; private set; } public static bool UseHardwareAcceleration { get; private set; } public static string BackendThreadingArg { get; private set; } @@ -162,7 +161,7 @@ namespace Ryujinx.Ava } - public static string GetDirGameUserConfig(string gameId, bool rememberGlobalDir = false, bool changeFolderForGame = false) + public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false) { if (string.IsNullOrEmpty(gameId)) { @@ -180,12 +179,7 @@ namespace Ryujinx.Ava return gameDir; } - public static void SetUseExtraConfig(bool value) - { - UseExtraConfig = value; - } - - public static void ReloadConfig(bool rememberGlobalDir = false) + public static void ReloadConfig() { string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.ConfigName); diff --git a/src/Ryujinx/Systems/AppLibrary/ApplicationLibrary.cs b/src/Ryujinx/Systems/AppLibrary/ApplicationLibrary.cs index b5367ffee..1db2332b8 100644 --- a/src/Ryujinx/Systems/AppLibrary/ApplicationLibrary.cs +++ b/src/Ryujinx/Systems/AppLibrary/ApplicationLibrary.cs @@ -556,7 +556,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary data.Favorite = appMetadata.Favorite; data.TimePlayed = appMetadata.TimePlayed; data.LastPlayed = appMetadata.LastPlayed; - data.HasIndependentConfiguration = File.Exists(Program.GetDirGameUserConfig(data.IdBaseString, false, false)); // Just check user config + data.HasIndependentConfiguration = File.Exists(Program.GetDirGameUserConfig(data.IdBaseString)); // Just check user config } data.FileExtension = Path.GetExtension(applicationPath).TrimStart('.').ToUpper(); diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index eccd6eec2..aa8333d68 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -50,6 +50,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private string _controllerImage; private int _device; private object _configViewModel; + private bool _isChangeTrackingActive; + private string _chosenProfile; + [ObservableProperty] private bool _isModified; [ObservableProperty] private string _profileName; [ObservableProperty] private bool _notificationIsVisible; // Automatically call the NotificationView property with OnPropertyChanged() [ObservableProperty] private string _notificationText; // Automatically call the NotificationText property with OnPropertyChanged() @@ -84,9 +87,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public AvaloniaList ProfilesList { get; set; } public AvaloniaList DeviceList { get; set; } - public bool _useExtraConfig; - - public bool _useGlobalInput; + public bool UseGlobalConfig; // XAML Flags public bool ShowSettings => _device > 0; @@ -98,31 +99,16 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool HasLed => SelectedGamepad.Features.HasFlag(GamepadFeaturesFlag.Led); public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense"); - public bool _isChangeTrackingActive; - - public bool _isModified; - - public bool IsModified - { - get => _isModified; - set - { - _isModified = value; - OnPropertyChanged(); - } - } - public event Action NotifyChangesEvent; - - public string _profileChoose; + public string ProfileChoose { - get => _profileChoose; + get => _chosenProfile; set { // When you select a profile, the settings from the profile will be applied. // To save the settings, you still need to click the apply button - _profileChoose = value; + _chosenProfile = value; LoadProfile(); OnPropertyChanged(); } @@ -294,14 +280,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public InputConfig Config { get; set; } - public InputViewModel(UserControl owner, bool UseGlobalInput = false) : this() + public InputViewModel(UserControl owner, bool useGlobal = false) : this() { if (Program.PreviewerDetached) { _mainWindow = RyujinxApp.MainWindow; - _useExtraConfig = Program.UseExtraConfig; - AvaloniaKeyboardDriver = new AvaloniaKeyboardDriver(owner); _mainWindow.InputManager.GamepadDriver.OnGamepadConnected += HandleOnGamepadConnected; @@ -309,7 +293,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input _mainWindow.ViewModel.AppHost?.NpadManager.BlockInputUpdates(); - _useGlobalInput = UseGlobalInput; + UseGlobalConfig = useGlobal; _isLoaded = false; @@ -347,7 +331,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private void LoadConfiguration(InputConfig inputConfig = null) { - if (_useGlobalInput && _useExtraConfig) + if (UseGlobalConfig && Program.UseExtraConfig) { Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); } @@ -983,7 +967,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input List newConfig = []; - if (_useGlobalInput && _useExtraConfig) + if (UseGlobalConfig && Program.UseExtraConfig) { newConfig.AddRange(ConfigurationState.InstanceExtra.Hid.InputConfig.Value); } @@ -1035,7 +1019,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input // NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event. _mainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse); - if (_useGlobalInput && _useExtraConfig) + if (UseGlobalConfig && Program.UseExtraConfig) { // In User Settings when "Use Global Input" is enabled, it saves global input to global setting ConfigurationState.InstanceExtra.Hid.InputConfig.Value = newConfig; @@ -1046,12 +1030,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input ConfigurationState.Instance.Hid.InputConfig.Value = newConfig; ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath); } - - } - - public void NotifyChange(string property) - { - OnPropertyChanged(property); } public void NotifyChanges() diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index be9441b06..8b9b04511 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -1575,16 +1575,14 @@ namespace Ryujinx.Ava.UI.ViewModels public bool InitializeUserConfig(ApplicationData application) { // Code where conditions will be met before loading the user configuration (Global Config) - string BackendThreadingInit = Program.BackendThreadingArg; - - BackendThreadingInit ??= ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString(); + string backendThreadingInit = Program.BackendThreadingArg ?? ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString(); // If a configuration is found in the "/games/xxxxxxxxxxxxxx" folder, the program will load the user setting. string idGame = application.IdBaseString; if (ConfigurationFileFormat.TryLoad(Program.GetDirGameUserConfig(idGame), out ConfigurationFileFormat configurationFileFormat)) { // Loads the user configuration, having previously changed the global configuration to the user configuration - ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(idGame, true, true), idGame); + ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(idGame, true), idGame); if (ConfigurationFileFormat.TryLoad(Program.GlobalConfigurationPath, out ConfigurationFileFormat configurationFileFormatExtra)) { @@ -1595,15 +1593,13 @@ namespace Ryujinx.Ava.UI.ViewModels } // Code where conditions will be executed after loading user configuration - if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != BackendThreadingInit) + if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit) { - - List Arguments = new() - { - "--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() // BackendThreading - }; - - Rebooter.RebootAppWithGame(application.Path, Arguments); + Rebooter.RebootAppWithGame(application.Path, + [ + "--bt", + ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() + ]); return true; } @@ -1998,7 +1994,7 @@ namespace Ryujinx.Ava.UI.ViewModels // just checking for file presence viewModel.SelectedApplication.HasIndependentConfiguration = File.Exists( - Program.GetDirGameUserConfig(viewModel.SelectedApplication.IdString, false, false)); + Program.GetDirGameUserConfig(viewModel.SelectedApplication.IdString)); viewModel.RefreshView(); }); diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 7c80381e6..654eb0c43 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -147,19 +147,19 @@ namespace Ryujinx.Ava.UI.ViewModels public bool DisableInputWhenOutOfFocus { get; set; } public int FocusLostActionType { get; set; } - public bool EnableConfigGlobal + public bool UseGlobalInputConfig { get => _useInputGlobalConfig; set { _useInputGlobalConfig = value; LocalGlobalInputSwitchEvent?.Invoke(_useInputGlobalConfig); - OnPropertyChanged(nameof(PanelOpacityInput)); + OnPropertyChanged(nameof(InputPanelOpacity)); OnPropertyChanged(); } } - public double PanelOpacityInput => EnableConfigGlobal ? 0.5 : 1; + public double InputPanelOpacity => UseGlobalInputConfig ? 0.5 : 1; public VSyncMode VSyncMode { @@ -387,7 +387,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsInvalidLdnPassphraseVisible { get; set; } - public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this(false) + public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this() { _virtualFileSystem = virtualFileSystem; _contentManager = contentManager; @@ -408,7 +408,7 @@ namespace Ryujinx.Ava.UI.ViewModels string gameName, string gameId, byte[] gameIconData, - bool enableToLoadCustomConfig) : this(enableToLoadCustomConfig) + bool customConfig) : this() { _virtualFileSystem = virtualFileSystem; _contentManager = contentManager; @@ -424,11 +424,11 @@ namespace Ryujinx.Ava.UI.ViewModels _gameTitle = gameName; _gameId = gameId; - if (enableToLoadCustomConfig) // During the game. If there is no user config, then load the global config window + if (customConfig) // During the game. If there is no user config, then load the global config window { - string gameDir = Program.GetDirGameUserConfig(gameId, true, true); + string gameDir = Program.GetDirGameUserConfig(gameId, true); - Program.SetUseExtraConfig(true); + Program.UseExtraConfig = true; if (ConfigurationFileFormat.TryLoad(Program.GlobalConfigurationPath, out ConfigurationFileFormat configurationFileFormatExtra)) { @@ -451,7 +451,7 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public SettingsViewModel(bool noLoadGlobalConfig = false) + public SettingsViewModel() { GameDirectories = []; AutoloadDirectories = []; @@ -603,7 +603,7 @@ namespace Ryujinx.Ava.UI.ViewModels }; // Input - EnableConfigGlobal = config.System.UseInputGlobalConfig; + UseGlobalInputConfig = config.System.UseInputGlobalConfig; EnableDockedMode = config.System.EnableDockedMode; EnableKeyboard = config.Hid.EnableKeyboard; EnableMouse = config.Hid.EnableMouse; @@ -710,7 +710,7 @@ namespace Ryujinx.Ava.UI.ViewModels }; // Input - config.System.UseInputGlobalConfig.Value = EnableConfigGlobal; + config.System.UseInputGlobalConfig.Value = UseGlobalInputConfig; config.System.EnableDockedMode.Value = EnableDockedMode; config.Hid.EnableKeyboard.Value = EnableKeyboard; config.Hid.EnableMouse.Value = EnableMouse; @@ -840,7 +840,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void DeleteConfigGame() { - string gameDir = Program.GetDirGameUserConfig(GameId, false, false); + string gameDir = Program.GetDirGameUserConfig(GameId); if (File.Exists(gameDir)) { diff --git a/src/Ryujinx/UI/Views/Input/InputView.axaml b/src/Ryujinx/UI/Views/Input/InputView.axaml index 13c0df768..dea508f10 100644 --- a/src/Ryujinx/UI/Views/Input/InputView.axaml +++ b/src/Ryujinx/UI/Views/Input/InputView.axaml @@ -203,7 +203,6 @@ - + IsChecked="{Binding UseGlobalInputConfig}"> diff --git a/src/Ryujinx/UI/Windows/GameSpecificSettingsWindow.axaml.cs b/src/Ryujinx/UI/Windows/GameSpecificSettingsWindow.axaml.cs index 65ded0877..dc9ce56d6 100644 --- a/src/Ryujinx/UI/Windows/GameSpecificSettingsWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/GameSpecificSettingsWindow.axaml.cs @@ -46,7 +46,7 @@ namespace Ryujinx.Ava.UI.Windows private void Load() { - Pages.Children.Clear(); + Pages.Children.Clear(); NavPanel.SelectionChanged += NavPanelOnSelectionChanged; NavPanel.SelectedItem = NavPanel.MenuItems.ElementAt(0); } @@ -97,7 +97,7 @@ namespace Ryujinx.Ava.UI.Windows protected override void OnClosing(WindowClosingEventArgs e) { - Program.SetUseExtraConfig(false); + Program.UseExtraConfig = false; InputPage.Dispose(); // You need to unload the gamepad settings, otherwise the controls will be blocked base.OnClosing(e); } From 9d83dfd19cd838042abb833891da6aa9dee8b2bc Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 9 Jun 2025 17:59:40 -0500 Subject: [PATCH 02/34] misc: [ci skip] Missed the property part of _chosenProfile --- src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs | 6 +++--- src/Ryujinx/UI/Views/Input/InputView.axaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index aa8333d68..81aae6b74 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -101,7 +101,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public event Action NotifyChangesEvent; - public string ProfileChoose + public string ChosenProfile { get => _chosenProfile; set @@ -903,7 +903,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input LoadProfiles(); - ProfileChoose = ProfileName; // Show new profile + ChosenProfile = ProfileName; // Show new profile } else { @@ -937,7 +937,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input LoadProfiles(); - ProfileChoose = ProfilesList[0].ToString(); // Show default profile + ChosenProfile = ProfilesList[0].ToString(); // Show default profile } } diff --git a/src/Ryujinx/UI/Views/Input/InputView.axaml b/src/Ryujinx/UI/Views/Input/InputView.axaml index dea508f10..c4f61e78e 100644 --- a/src/Ryujinx/UI/Views/Input/InputView.axaml +++ b/src/Ryujinx/UI/Views/Input/InputView.axaml @@ -100,7 +100,7 @@ Name="ProfileBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" - SelectedItem="{Binding ProfileChoose, Mode=TwoWay}" + SelectedItem="{Binding ChosenProfile, Mode=TwoWay}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding ProfilesList}" Text="{Binding ProfileName, Mode=TwoWay}" /> From c58272ac202d7a2024b12d938098c0230eb0b00c Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 9 Jun 2025 18:56:28 -0500 Subject: [PATCH 03/34] infra: CI: Remove GitHub release uploading from Stable workflow. --- .github/workflows/release.yml | 73 +---------------------------------- 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 361e72f09..279b2f36b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,38 +14,6 @@ env: RELEASE: 1 jobs: - tag: - name: Create tag - runs-on: ubuntu-24.04 - steps: - - name: Get version info - id: version_info - run: | - echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT - echo "prev_build_version=${{ env.RYUJINX_BASE_VERSION }}.$((${{ github.run_number }} - 1))" >> $GITHUB_OUTPUT - shell: bash - - - name: Create release - uses: ncipollo/release-action@v1 - with: - name: ${{ steps.version_info.outputs.build_version }} - tag: ${{ steps.version_info.outputs.build_version }} - body: | - # Stable builds: - | Platform | Artifact | - |--|--| - | Windows 64-bit | [Stable Windows Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_x64.zip) | - | Windows ARM 64-bit | [Stable Windows ARM Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_arm64.zip) | - | Linux 64-bit | [Stable Linux Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_x64.tar.gz) | - | Linux ARM 64-bit | [Stable Linux ARM Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_arm64.tar.gz) | - | macOS | [Stable macOS Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz) | - - **[Full Changelog](https://git.ryujinx.app/ryubing/ryujinx/-/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }})** - omitBodyDuringUpdate: true - owner: ${{ secrets.RC_OWNER }} - repo: ${{ secrets.RC_STABLE_NAME }} - token: ${{ secrets.ALT_RELEASE_TOKEN }} - release: name: Release for ${{ matrix.platform.name }} runs-on: ${{ matrix.platform.os }} @@ -169,30 +137,6 @@ jobs: gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/ryujinx --command=UploadGenericPackage "Ryubing|${{ steps.version_info.outputs.build_version }}|release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage.zsync" shell: bash - - name: Pushing new release - uses: ncipollo/release-action@v1 - with: - name: ${{ steps.version_info.outputs.build_version }} - artifacts: "release_output/*.tar.gz,release_output/*.zip,release_output/*AppImage*" - tag: ${{ steps.version_info.outputs.build_version }} - body: | - # Stable builds: - | Platform | Artifact | - |--|--| - | Windows 64-bit | [Stable Windows Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_x64.zip) | - | Windows ARM 64-bit | [Stable Windows ARM Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-win_arm64.zip) | - | Linux 64-bit | [Stable Linux Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_x64.tar.gz) | - | Linux ARM 64-bit | [Stable Linux ARM Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-linux_arm64.tar.gz) | - | macOS | [Stable macOS Artifact](https://github.com/${{ secrets.RC_OWNER }}/${{ secrets.RC_STABLE_NAME }}/releases/download/${{ steps.version_info.outputs.build_version }}/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz) | - - **[Full Changelog](https://git.ryujinx.app/ryubing/ryujinx/-/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }})** - omitBodyDuringUpdate: true - allowUpdates: true - replacesArtifacts: true - owner: ${{ secrets.RC_OWNER }} - repo: ${{ secrets.RC_STABLE_NAME }} - token: ${{ secrets.ALT_RELEASE_TOKEN }} - macos_release: name: Release MacOS universal runs-on: ubuntu-24.04 @@ -249,26 +193,11 @@ jobs: run: | ./distribution/macos/create_macos_build_ava.sh . publish_tmp_ava publish ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release 0 gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/ryujinx --command=UploadGenericPackage "Ryubing|${{ steps.version_info.outputs.build_version }}|publish/ryujinx-${{ steps.version_info.outputs.build_version }}-macos_universal.app.tar.gz" - - - name: Pushing new release - uses: ncipollo/release-action@v1 - with: - name: ${{ steps.version_info.outputs.build_version }} - artifacts: "publish/*.tar.gz" - tag: ${{ steps.version_info.outputs.build_version }} - body: "" - omitBodyDuringUpdate: true - allowUpdates: true - replacesArtifacts: true - owner: ${{ secrets.RC_OWNER }} - repo: ${{ secrets.RC_STABLE_NAME }} - token: ${{ secrets.ALT_RELEASE_TOKEN }} - + create_gitlab_release: name: Create GitLab Release runs-on: ubuntu-24.04 needs: - - tag - macos_release - release steps: From 0409c159034026701f0ca7e504d215a913139d26 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 9 Jun 2025 19:51:53 -0500 Subject: [PATCH 04/34] Remove GitHub updater support. --- assets/locales.json | 67 ++---- src/Ryujinx/Systems/Updater/Updater.GitHub.cs | 190 ------------------ src/Ryujinx/Systems/Updater/Updater.GitLab.cs | 18 +- src/Ryujinx/Systems/Updater/Updater.cs | 22 -- 4 files changed, 29 insertions(+), 268 deletions(-) delete mode 100644 src/Ryujinx/Systems/Updater/Updater.GitHub.cs diff --git a/assets/locales.json b/assets/locales.json index 57f944882..8604e58f1 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -13123,53 +13123,28 @@ } }, { - "ID": "DialogUpdaterFailedToGetVersionMessage", + "ID": "DialogUpdaterConvertFailedServerMessage", "Translations": { - "ar_SA": "حدث خطأ أثناء محاولة الحصول على معلومات الإصدار من إصدار غيت هاب. يمكن أن يحدث هذا إذا تم تجميع إصدار جديد بواسطة إجراءات غيت هاب. جرب مجددا بعد دقائق.", - "de_DE": "Beim Versuch, Veröffentlichungs-Info von GitHub Release zu erhalten, ist ein Fehler aufgetreten. Dies kann aufgrund einer neuen Veröffentlichung, die gerade von GitHub Actions kompiliert wird, verursacht werden.", - "el_GR": "Προέκυψε ένα σφάλμα στη λήψη πληροφοριών έκδοσης από τα GitHub Releases. Αυτό δύναται να συμβεί αν μία έκδοση χτίζεται αυτή τη στιγμή στα GitHub Actions. Παρακαλούμε προσπαθήστε αργότερα.", - "en_US": "An error occurred while trying to retrieve release information from GitHub. This may happen if a new release is currently being compiled by GitHub Actions. Please try again in a few minutes.", - "es_ES": "Se ha producido un error al intentar obtener información de liberación de GitHub Release. Esto puede ser causado si una nueva versión está siendo compilada por GitHub Actions. Inténtalo de nuevo en unos minutos.", - "fr_FR": "Une erreur s'est produite lors de la tentative d'obtention des informations de publication de la version GitHub. Cela peut survenir lorsqu'une nouvelle version est en cours de compilation par GitHub Actions. Réessayez dans quelques minutes.", - "he_IL": "אירעה שגיאה בעת ניסיון לקבל עדכונים מ-גיטהב. זה יכול להיגרם אם הגרסה המעודכנת האחרונה נוצרה על ידי פעולות של גיטהב. נסה שוב בעוד מספר דקות.", - "it_IT": "Si è verificato un errore durante il tentativo di recuperare le informazioni sulla versione da GitHub Release. Ciò può verificarsi se una nuova versione è in fase di compilazione da GitHub Actions. Riprova tra qualche minuto.", - "ja_JP": "Github からのリリース情報取得時にエラーが発生しました. Github Actions でリリースファイルを作成中かもしれません. 後ほどもう一度試してみてください.", - "ko_KR": "GitHub에서 릴리스 정보를 검색하는 동안 오류가 발생했습니다. 현재 GitHub Actions에서 새 릴리스를 컴파일하는 중일 때 발생할 수 있습니다. 몇 분 후에 다시 시도해 주세요.", - "no_NO": "En feil oppstod ved forsøk på å få utgivelsesinformasjon fra GitHub Utgivelse. Dette kan forårsakes hvis en ny utgave blir samlet av GitHub Handlinger. Prøv igjen om noen minutter.", - "pl_PL": "Wystąpił błąd podczas próby uzyskania informacji o obecnej wersji z GitHub Release. Może to być spowodowane nową wersją kompilowaną przez GitHub Actions. Spróbuj ponownie za kilka minut.", - "pt_BR": "Ocorreu um erro ao tentar obter as informações de atualização do GitHub Release. Isso pode ser causado se uma nova versão estiver sendo compilado pelas Ações do GitHub. Tente novamente em alguns minutos.", - "ru_RU": "Произошла ошибка при попытке получить информацию о выпуске от GitHub Release. Это может быть вызвано тем, что в данный момент в GitHub Actions компилируется новый релиз. Повторите попытку позже.", - "sv_SE": "Ett fel inträffade vid försök att hämta information om utgåvan från GitHub. Detta kan hända om en ny utgåva har kompilerats av GitHub Actions. Försök igen om några minuter.", - "th_TH": "เกิดข้อผิดพลาดขณะพยายามรับข้อมูลเวอร์ชั่นจาก GitHub Release ปัญหานี้อาจเกิดขึ้นได้หากมีการรวบรวมเวอร์ชั่นใหม่โดย GitHub โปรดลองอีกครั้งในอีกไม่กี่นาทีข้างหน้า", - "tr_TR": "GitHub tarafından sürüm bilgileri alınırken bir hata oluştu. Eğer yeni sürüm için hazırlıklar yapılıyorsa bu hatayı almanız olasıdır. Lütfen birkaç dakika sonra tekrar deneyiniz.", - "uk_UA": "Під час спроби отримати інформацію про випуск із GitHub Release сталася помилка. Це може бути спричинено, якщо новий випуск компілюється GitHub Actions. Повторіть спробу через кілька хвилин.", - "zh_CN": "尝试从 Github 获取版本信息时无效,可能由于 GitHub Actions 正在编译新版本。\n请过一会再试。", - "zh_TW": "嘗試從 GitHub Release 取得發布資訊時發生錯誤。如果 GitHub Actions 正在編譯新版本,則可能會出現這種情況。請幾分鐘後再試一次。" - } - }, - { - "ID": "DialogUpdaterConvertFailedGithubMessage", - "Translations": { - "ar_SA": "فشل تحويل إصدار ريوجينكس المستلم من إصدار غيت هاب.", - "de_DE": "Fehler beim Konvertieren der erhaltenen Ryujinx-Version von GitHub Release.", - "el_GR": "Αποτυχία μετατροπής της ληφθείσας έκδοσης Ryujinx από την έκδοση GitHub.", - "en_US": "Failed to convert the Ryujinx version received from GitHub.", - "es_ES": "No se pudo convertir la versión de Ryujinx recibida de GitHub Release.", - "fr_FR": "Impossible de convertir la version reçue de Ryujinx depuis GitHub Release.", - "he_IL": "המרת גרסת ריוג'ינקס שהתקבלה מ-עדכון הגרסאות של גיטהב נכשלה.", - "it_IT": "La conversione della versione di Ryujinx ricevuta da GitHub Release è fallita.", - "ja_JP": "Github から取得した Ryujinx バージョンの変換に失敗しました.", - "ko_KR": "GitHub에서 받은 Ryujinx 버전을 변환하지 못했습니다.", - "no_NO": "Kan ikke konvertere mottatt Ryujinx-versjon fra GitHub Utgivelse.", - "pl_PL": "Nie udało się przekonwertować otrzymanej wersji Ryujinx z Github Release.", - "pt_BR": "Falha ao converter a versão Ryujinx recebida do GitHub.", - "ru_RU": "Не удалось преобразовать полученную версию Ryujinx из GitHub Release.", - "sv_SE": "Misslyckades med att konvertera mottagen Ryujinx-version från GitHub.", - "th_TH": "ไม่สามารถแปลงเวอร์ชั่น Ryujinx ที่ได้รับจาก GitHub Release", - "tr_TR": "Github Release'den alınan Ryujinx sürümü dönüştürülemedi.", - "uk_UA": "Не вдалося конвертувати отриману версію Ryujinx із випуску GitHub.", - "zh_CN": "无法切换至从 GitHub 接收到的新版 Ryujinx 模拟器。", - "zh_TW": "無法轉換從 GitHub Release 接收到的 Ryujinx 版本。" + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "Failed to convert the Ryujinx version received from the update server.", + "es_ES": "", + "fr_FR": "La conversion de la version de Ryujinx reçue du serveur a échoué.", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "Kunne ikke konvertere Ryujinx-versjonen som ble mottatt fra oppdateringsserveren.", + "pl_PL": "", + "pt_BR": "Falha em atualizar a versão do Ryujinx recebida do servidor de atualização.", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" } }, { diff --git a/src/Ryujinx/Systems/Updater/Updater.GitHub.cs b/src/Ryujinx/Systems/Updater/Updater.GitHub.cs deleted file mode 100644 index e90610e66..000000000 --- a/src/Ryujinx/Systems/Updater/Updater.GitHub.cs +++ /dev/null @@ -1,190 +0,0 @@ -using Gommon; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models.Github; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Common; -using Ryujinx.Common.Helper; -using Ryujinx.Common.Logging; -using Ryujinx.Common.Utilities; -using System; -using System.Net.Http; -using System.Net.Http.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace Ryujinx.Ava.Systems -{ - internal static partial class Updater - { - private static GitHubReleaseChannels.Channel? _currentGitHubReleaseChannel; - - private static async Task> CheckGitHubVersionAsync(bool showVersionUpToDate = false) - { - if (!Version.TryParse(Program.Version, out Version currentVersion)) - { - Logger.Error?.Print(LogClass.Application, $"Failed to convert the current {RyujinxApp.FullAppName} version!"); - - await ContentDialogHelper.CreateWarningDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedMessage], - LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]); - - _running = false; - - return default; - } - - Logger.Info?.Print(LogClass.Application, "Checking for updates from GitHub."); - - // Get latest version number from GitHub API - try - { - using HttpClient jsonClient = ConstructHttpClient(); - - if (_currentGitHubReleaseChannel == null) - { - GitHubReleaseChannels releaseChannels = await GitHubReleaseChannels.GetAsync(jsonClient); - - _currentGitHubReleaseChannel = ReleaseInformation.IsCanaryBuild - ? releaseChannels.Canary - : releaseChannels.Stable; - - Logger.Info?.Print(LogClass.Application, $"Loaded GitHub release channel for '{(ReleaseInformation.IsCanaryBuild ? "canary" : "stable")}'"); - - _changelogUrlFormat = _currentGitHubReleaseChannel.Value.UrlFormat; - } - - string fetchedJson = await jsonClient.GetStringAsync(_currentGitHubReleaseChannel.Value.GetLatestReleaseApiUrl()); - GithubReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _ghSerializerContext.GithubReleasesJsonResponse); - _buildVer = fetched.TagName; - - foreach (GithubReleaseAssetJsonResponse asset in fetched.Assets) - { - if (asset.Name.StartsWith("ryujinx") && asset.Name.EndsWith(_platformExt)) - { - _buildUrl = asset.BrowserDownloadUrl; - - if (asset.State != "uploaded") - { - if (showVersionUpToDate) - { - UserResult userResult = await ContentDialogHelper.CreateUpdaterUpToDateInfoDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], - string.Empty); - - if (userResult is UserResult.Ok) - { - OpenHelper.OpenUrl(_changelogUrlFormat.Format(currentVersion)); - } - } - - Logger.Info?.Print(LogClass.Application, "Up to date."); - - _running = false; - - return default; - } - - break; - } - } - - // If build not done, assume no new update is available. - if (_buildUrl is null) - { - if (showVersionUpToDate) - { - UserResult userResult = await ContentDialogHelper.CreateUpdaterUpToDateInfoDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], - string.Empty); - - if (userResult is UserResult.Ok) - { - OpenHelper.OpenUrl(_changelogUrlFormat.Format(currentVersion)); - } - } - - Logger.Info?.Print(LogClass.Application, "Up to date."); - - _running = false; - - return default; - } - } - catch (Exception exception) - { - Logger.Error?.Print(LogClass.Application, exception.Message); - - await ContentDialogHelper.CreateErrorDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterFailedToGetVersionMessage]); - - _running = false; - - return default; - } - - if (!Version.TryParse(_buildVer, out Version newVersion)) - { - Logger.Error?.Print(LogClass.Application, $"Failed to convert the received {RyujinxApp.FullAppName} version from GitHub!"); - - await ContentDialogHelper.CreateWarningDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedGithubMessage], - LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]); - - _running = false; - - return default; - } - - return (currentVersion, newVersion); - } - } - - public readonly struct GitHubReleaseChannels - { - public static async Task GetAsync(HttpClient httpClient) - { - ReleaseChannelPair releaseChannelPair = await httpClient.GetFromJsonAsync("https://ryujinx.app/api/release-channels", ReleaseChannelPairContext.Default.ReleaseChannelPair); - return new GitHubReleaseChannels(releaseChannelPair); - } - - internal GitHubReleaseChannels(ReleaseChannelPair channelPair) - { - Stable = new Channel(channelPair.Stable); - Canary = new Channel(channelPair.Canary); - } - - public readonly Channel Stable; - public readonly Channel Canary; - - public readonly struct Channel - { - public Channel(string raw) - { - string[] parts = raw.Split('/'); - Owner = parts[0]; - Repo = parts[1]; - } - - public readonly string Owner; - public readonly string Repo; - - public string UrlFormat => $"https://github.com/{ToString()}/releases/{{0}}"; - - public override string ToString() => $"{Owner}/{Repo}"; - - public string GetLatestReleaseApiUrl() => - $"https://api.github.com/repos/{ToString()}/releases/latest"; - } - } - - [JsonSerializable(typeof(ReleaseChannelPair))] - partial class ReleaseChannelPairContext : JsonSerializerContext; - - class ReleaseChannelPair - { - [JsonPropertyName("stable")] - public string Stable { get; set; } - [JsonPropertyName("canary")] - public string Canary { get; set; } - } -} diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index d609af522..f49f60ab9 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -41,7 +41,7 @@ namespace Ryujinx.Ava.Systems return $"https://update.ryujinx.app/latest/query?os={os}&arch={arch}&rc={rc}"; } - private static async Task> CheckGitLabVersionAsync(bool showVersionUpToDate = false) + public static async Task> CheckVersionAsync(bool showVersionUpToDate = false) { if (!Version.TryParse(Program.Version, out Version currentVersion)) { @@ -68,12 +68,9 @@ namespace Ryujinx.Ava.Systems Logger.Info?.Print(LogClass.Application, $"Checking for updates from {updateUrl}."); - // Get latest version number from GitLab API + // Get latest version number from update.ryujinx.app API using HttpClient jsonClient = ConstructHttpClient(); - // GitLab instance is located in Ukraine. Connection times will vary across the world. - jsonClient.Timeout = TimeSpan.FromSeconds(10); - try { UpdaterResponse response = @@ -85,9 +82,10 @@ namespace Ryujinx.Ava.Systems } catch (Exception e) { - throw new AggregateException( - $"An error occurred when parsing JSON response from API ({e.GetType().AsFullNamePrettyString()}): {e.Message}", - e); + Logger.Error?.Print(LogClass.Application, $"An error occurred when parsing JSON response from API ({e.GetType().AsFullNamePrettyString()}): {e.Message}"); + + _running = false; + return default; } // If build URL not found, assume no new update is available. @@ -116,10 +114,10 @@ namespace Ryujinx.Ava.Systems if (!Version.TryParse(_buildVer, out Version newVersion)) { Logger.Error?.Print(LogClass.Application, - $"Failed to convert the received {RyujinxApp.FullAppName} version from GitLab!"); + $"Failed to convert the received {RyujinxApp.FullAppName} version from the update server!"); await ContentDialogHelper.CreateWarningDialog( - LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedGithubMessage], + LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedServerMessage], LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]); _running = false; diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index f4d49a1d1..40c1da175 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -31,9 +31,6 @@ namespace Ryujinx.Ava.Systems { internal static partial class Updater { - private static readonly GithubReleasesJsonSerializerContext _ghSerializerContext = new(JsonHelper.GetDefaultSerializerOptions()); - - private static readonly string _platformExt = BuildPlatformExtension(); private static readonly string _homeDir = AppDomain.CurrentDomain.BaseDirectory; private static readonly string _updateDir = Path.Combine(Path.GetTempPath(), "Ryujinx", "update"); private static readonly string _updatePublishDir = Path.Combine(_updateDir, "publish"); @@ -48,25 +45,6 @@ namespace Ryujinx.Ava.Systems private static readonly string[] _windowsDependencyDirs = []; private static string _changelogUrlFormat = null; - - public static async Task> CheckVersionAsync(bool showVersionUpToDate = false) - { - Optional<(Version, Version)> versionTuple; - - try - { - versionTuple = await CheckGitLabVersionAsync(showVersionUpToDate); - } - catch (Exception e) - { - Logger.Error?.PrintMsg(LogClass.Application, "Update checking from GitLab failed; falling back to GitHub."); - Logger.Error?.PrintMsg(LogClass.Application, e.Message); - versionTuple = await CheckGitHubVersionAsync(showVersionUpToDate); - } - - return versionTuple; - } - public static async Task BeginUpdateAsync(bool showVersionUpToDate = false) { From eed6ef632d40e7c22f97380f70804a7fcc2a31f5 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 9 Jun 2025 19:57:31 -0500 Subject: [PATCH 05/34] infra: [ci skip] update CHANGELOG.md --- CHANGELOG.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dac7f328..9a2b4ccb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,20 +2,17 @@ All updates to this Ryujinx branch will be documented in this file. +## [1.3.2]() - 2025-06-09 + ## [1.3.1]() - 2025-04-23 -A list of notable changes can be found on the release linked in the version number above. ## [1.2.86]() - 2025-03-13 -A list of notable changes can be found on the release linked in the version number above. ## [1.2.82]() - 2025-02-16 -A list of notable changes can be found on the release linked in the version number above. ## [1.2.80-81]() - 2025-01-22 -A list of notable changes can be found on the release linked in the version number above. ## [1.2.78]() - 2024-12-19 -A list of notable changes can be found on the release linked in the version number above. ## [1.2.73-1.2.76]() - 2024-11-19 A list of notable changes can be found on the release linked in the version number above. @@ -254,4 +251,4 @@ Added Low-power PPTC mode strings to the translation files. - Autoload DLC/Updates from dir ([#12](https://github.com/GreemDev/Ryujinx/pull/12)). - Changed executable icon to rainbow logo. - Extract Data > Logo now also extracts the square thumbnail you see for the game in the UI. -- The "use random UUID hack" checkbox in the Amiibo screen now remembers its last state when you reopen the window in a given session. \ No newline at end of file +- The "use random UUID hack" checkbox in the Amiibo screen now remembers its last state when you reopen the window in a given session. From b97fae08b5b914f1a68b4dab91045d4c716e04ec Mon Sep 17 00:00:00 2001 From: rockingdice Date: Tue, 10 Jun 2025 15:41:39 -0500 Subject: [PATCH 06/34] fix: use the correct font family for CJK characters See merge request ryubing/ryujinx!52 --- src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs | 95 +++++++++++++++++--- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs b/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs index 79a1eacd8..3ab2fdc70 100644 --- a/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs +++ b/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs @@ -2,29 +2,104 @@ using Avalonia.Media; using Ryujinx.Ava.UI.Windows; using Ryujinx.HLE.UI; using System; +using System.Globalization; namespace Ryujinx.Ava.UI.Applet { - class AvaloniaHostUITheme(MainWindow parent) : IHostUITheme + class AvaloniaHostUITheme : IHostUITheme { - public string FontFamily { get; } = OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) ? "Segoe UI Variable" : parent.FontFamily.Name; + private readonly MainWindow _parent; - public ThemeColor DefaultBackgroundColor { get; } = BrushToThemeColor(parent.Background); - public ThemeColor DefaultForegroundColor { get; } = BrushToThemeColor(parent.Foreground); - public ThemeColor DefaultBorderColor { get; } = BrushToThemeColor(parent.BorderBrush); - public ThemeColor SelectionBackgroundColor { get; } = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionBrush); - public ThemeColor SelectionForegroundColor { get; } = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionForegroundBrush); + public string FontFamily { get; } + public ThemeColor DefaultBackgroundColor { get; } + public ThemeColor DefaultForegroundColor { get; } + public ThemeColor DefaultBorderColor { get; } + public ThemeColor SelectionBackgroundColor { get; } + public ThemeColor SelectionForegroundColor { get; } + + public AvaloniaHostUITheme(MainWindow parent) + { + _parent = parent; + + // Initialize font property + FontFamily = GetSystemFontFamily(); + + // Initialize all properties that depend on parent + DefaultBackgroundColor = BrushToThemeColor(parent.Background); + DefaultForegroundColor = BrushToThemeColor(parent.Foreground); + DefaultBorderColor = BrushToThemeColor(parent.BorderBrush); + SelectionBackgroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionBrush); + SelectionForegroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionForegroundBrush); + } + + private string GetSystemFontFamily() + { + if (OperatingSystem.IsWindows()) + { + return GetWindowsFontByLanguage(); + } + else if (OperatingSystem.IsMacOS()) + { + return GetMacOSFontByLanguage(); + } + else // Linux and other platforms + { + return GetLinuxFontByLanguage(); + } + } + + private string GetWindowsFontByLanguage() + { + var culture = CultureInfo.CurrentUICulture; + string langCode = culture.Name; + + return culture.TwoLetterISOLanguageName switch + { + "zh" => langCode == "zh-CN" || langCode == "zh-Hans" || langCode == "zh-SG" + ? "Microsoft YaHei UI" // Simplified Chinese + : "Microsoft JhengHei UI", // Traditional Chinese + + "ja" => "Yu Gothic UI", // Japanese + "ko" => "Malgun Gothic", // Korean + _ => OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) + ? "Segoe UI Variable" // Other languages - Windows 11+ + : _parent.FontFamily.Name // Fallback to parent window font + }; + } + + private string GetMacOSFontByLanguage() + { + return CultureInfo.CurrentUICulture.TwoLetterISOLanguageName switch + { + "zh" => "PingFang SC", // Chinese (both simplified and traditional) + "ja" => "Hiragino Sans", // Japanese + "ko" => "Apple SD Gothic Neo", // Korean + _ => _parent.FontFamily.Name // Fallback to parent window font + }; + } + + private string GetLinuxFontByLanguage() + { + return CultureInfo.CurrentUICulture.TwoLetterISOLanguageName switch + { + "zh" => "Noto Sans CJK SC", // Chinese + "ja" => "Noto Sans CJK JP", // Japanese + "ko" => "Noto Sans CJK KR", // Korean + _ => _parent.FontFamily.Name // Fallback to parent window font + }; + } private static ThemeColor BrushToThemeColor(IBrush brush) { if (brush is SolidColorBrush solidColor) { - return new ThemeColor((float)solidColor.Color.A / 255, + return new ThemeColor( + (float)solidColor.Color.A / 255, (float)solidColor.Color.R / 255, (float)solidColor.Color.G / 255, - (float)solidColor.Color.B / 255); + (float)solidColor.Color.B / 255 + ); } - return new ThemeColor(); } } From 90582e9e93ef9c32a56829049cfc9cdd3bfbbde7 Mon Sep 17 00:00:00 2001 From: rockingdice Date: Tue, 10 Jun 2025 16:34:12 -0500 Subject: [PATCH 07/34] fix: crash caused by cursor overflow See merge request ryubing/ryujinx!53 --- .../Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs index 5c9885639..5e048e55d 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs @@ -377,7 +377,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard bool cursorVisible = false; - if (state.CursorBegin != state.CursorEnd) + if (state.CursorBegin != state.CursorEnd && state.CursorEnd <= state.InputText.Length) { Debug.Assert(state.InputText.Length > 0); From 512120db04fe4ba909dde3016688277a652cd735 Mon Sep 17 00:00:00 2001 From: mqudsi Date: Tue, 10 Jun 2025 22:52:08 -0500 Subject: [PATCH 08/34] Work around Escape hotkey race with exit confirmation dialog See merge request ryubing/ryujinx!54 --- src/Ryujinx/Systems/AppHost.cs | 18 ++++++++++++++++++ src/Ryujinx/UI/Helpers/Win32NativeInterop.cs | 3 +++ 2 files changed, 21 insertions(+) diff --git a/src/Ryujinx/Systems/AppHost.cs b/src/Ryujinx/Systems/AppHost.cs index 7089479d3..74005400c 100644 --- a/src/Ryujinx/Systems/AppHost.cs +++ b/src/Ryujinx/Systems/AppHost.cs @@ -1152,6 +1152,24 @@ namespace Ryujinx.Ava.Systems _dialogShown = true; + // The hard-coded hotkey mapped to exit is Escape, but it's also the same key + // that causes the dialog we launch to close (without doing anything). In release + // mode, a race is observed that between ShowExitPrompt() appearing on KeyDown + // and the ContentDialog we create seeing the key state before KeyUp. Merely waiting + // for the key to no longer be pressed appears to be insufficient. + // NB: Using _keyboardInterface.IsPressed(Key.Escape) does not currently work. + if (OperatingSystem.IsWindows()) + { + while (GetAsyncKeyState(0x1B) != 0) + { + await Task.Delay(100); + } + } + else + { + await Task.Delay(250); + } + shouldExit = await ContentDialogHelper.CreateStopEmulationDialog(); _dialogShown = false; diff --git a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs index d7466e95b..c7d217bf5 100644 --- a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs +++ b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs @@ -110,5 +110,8 @@ namespace Ryujinx.Ava.UI.Helpers [LibraryImport("user32.dll", SetLastError = true)] public static partial nint SetWindowLongPtrW(nint hWnd, int nIndex, nint value); + + [LibraryImport("user32.dll", SetLastError = true)] + public static partial ushort GetAsyncKeyState(int nVirtKey); } } From 90e9492f6c15b72a9dd43bb07f36ab51a3ba87ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hack=E8=8C=B6=E3=82=93?= Date: Wed, 11 Jun 2025 15:37:48 -0500 Subject: [PATCH 09/34] Update Korean translation (ryubing/ryujinx!56) See merge request ryubing/ryujinx!56 --- assets/locales.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/locales.json b/assets/locales.json index 8604e58f1..6bc44721d 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -13134,7 +13134,7 @@ "he_IL": "", "it_IT": "", "ja_JP": "", - "ko_KR": "", + "ko_KR": "업데이트 서버에서 받은 Ryujinx 버전을 변환하는 데 실패했습니다.", "no_NO": "Kunne ikke konvertere Ryujinx-versjonen som ble mottatt fra oppdateringsserveren.", "pl_PL": "", "pt_BR": "Falha em atualizar a versão do Ryujinx recebida do servidor de atualização.", @@ -16559,7 +16559,7 @@ "he_IL": "", "it_IT": "", "ja_JP": "", - "ko_KR": "", + "ko_KR": "사용자 지정 설정에서 이 옵션을 활성화하면 전역 입력 구성이 사용됩니다.\n\n전역 설정에서 필요에 따라 활성화하거나 비활성화할 수 있습니다. 이 설정은 새로 생성된 모든 사용자 지정 구성에 상속됩니다.", "no_NO": "", "pl_PL": "", "pt_BR": "", From d03ae9c1640e59d139a5c53087427f52ad2c70e4 Mon Sep 17 00:00:00 2001 From: Coxxs <58-coxxs@users.noreply.git.ryujinx.app> Date: Wed, 11 Jun 2025 16:44:07 -0500 Subject: [PATCH 10/34] fix: socket blocking flag is inverted when setting it (ryubing/ryujinx!57) See merge request ryubing/ryujinx!57 --- src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index a23bd3a11..fe37ca4fa 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -885,7 +885,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd // F_SETFL else if (cmd == 0x4) { - socket.Blocking = (arg & 0x800) != 0; + socket.Blocking = (arg & 0x800) == 0; result = 0; } else From ea027d65a7204685c7ab75105e4fbf01c6ecb2a7 Mon Sep 17 00:00:00 2001 From: MrKev <41-mrkev@users.noreply.git.ryujinx.app> Date: Wed, 11 Jun 2025 17:58:27 -0500 Subject: [PATCH 11/34] Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47) See merge request ryubing/ryujinx!47 --- .editorconfig | 12 +- assets/locales.json | 2 +- src/ARMeilleure/CodeGen/Arm64/Assembler.cs | 2 - .../CodeGen/Arm64/CodeGenerator.cs | 2 - src/ARMeilleure/CodeGen/X86/AssemblerTable.cs | 1 - .../CodeGen/X86/CallingConvention.cs | 12 +- src/ARMeilleure/CodeGen/X86/CodeGenContext.cs | 1 - src/ARMeilleure/CodeGen/X86/X86Register.cs | 2 - src/ARMeilleure/Instructions/CryptoHelper.cs | 48 +++--- src/ARMeilleure/Instructions/InstEmitMul.cs | 1 - .../Instructions/InstEmitSimdArithmetic.cs | 3 +- .../Instructions/InstEmitSimdCmp.cs | 4 +- .../Instructions/InstEmitSimdCmp32.cs | 4 +- .../Instructions/InstEmitSimdCvt.cs | 3 +- .../Instructions/InstEmitSimdHelper.cs | 7 +- .../Instructions/InstEmitSimdHelper32.cs | 7 +- .../Instructions/InstEmitSimdHelper32Arm64.cs | 7 +- .../Instructions/InstEmitSimdMemory.cs | 46 +++--- .../Instructions/InstEmitSimdShift.cs | 3 +- .../IntermediateRepresentation/Intrinsic.cs | 1 - .../MemoryOperand.cs | 3 +- src/ARMeilleure/Optimizations.cs | 6 +- .../Translation/ArmEmitterContext.cs | 56 ++++--- src/ARMeilleure/Translation/PTC/Ptc.cs | 5 +- src/ARMeilleure/Translation/RegisterUsage.cs | 20 ++- .../SDL2HardwareDeviceDriver.cs | 38 ++++- .../Native/SoundIo.cs | 2 +- .../Renderer/Common/UpdateDataHeader.cs | 2 - src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs | 3 +- .../Renderer/Server/AudioRenderSystem.cs | 4 +- .../Collections/TreeDictionary.cs | 6 +- .../Configuration/AspectRatioExtensions.cs | 2 - src/Ryujinx.Common/Configuration/DirtyHack.cs | 2 - src/Ryujinx.Common/Hash128.cs | 2 +- src/Ryujinx.Common/Logging/Logger.cs | 38 +++-- .../Memory/StructArrayHelpers.cs | 75 ++++++++- src/Ryujinx.Common/PreciseSleep/Nanosleep.cs | 2 +- src/Ryujinx.Common/ReleaseInformation.cs | 7 - .../SystemInterop/GdiPlusHelper.cs | 2 - .../WindowsMultimediaTimerResolution.cs | 2 +- src/Ryujinx.Common/Utilities/Buffers.cs | 4 +- .../Utilities/MessagePackObjectFormatter.cs | 4 +- src/Ryujinx.Common/Utilities/Rainbow.cs | 1 - .../AppleHv/DummyDiskCacheLoadState.cs | 17 -- src/Ryujinx.Cpu/AppleHv/HvApi.cs | 8 +- src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs | 4 +- src/Ryujinx.Cpu/TickSource.cs | 1 - src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs | 2 +- src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs | 2 - .../Engine/Compute/ComputeClassState.cs | 4 +- .../Engine/Dma/DmaClassState.cs | 4 +- .../Engine/Dma/DmaTexture.cs | 4 +- .../Engine/GPFifo/CompressedMethod.cs | 4 +- .../Engine/GPFifo/GPEntry.cs | 8 +- .../Engine/GPFifo/GPFifoClassState.cs | 4 +- .../InlineToMemoryClassState.cs | 4 +- .../Engine/MME/MacroHLE.cs | 9 +- .../Engine/MmeShadowScratch.cs | 2 - .../Engine/Threed/IbStreamer.cs | 3 +- .../Engine/Threed/IndirectDrawType.cs | 2 - .../Engine/Threed/ThreedClassState.cs | 112 ++++++------- .../Engine/Twod/TwodClassState.cs | 8 +- .../Engine/Twod/TwodTexture.cs | 4 +- .../Engine/Types/GpuVa.cs | 3 +- .../Engine/Types/MemoryLayout.cs | 3 +- .../Engine/Types/SbDescriptor.cs | 3 +- src/Ryujinx.Graphics.Gpu/GpuContext.cs | 1 - src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs | 3 +- .../Image/SamplerDescriptor.cs | 2 - .../Image/TextureDescriptor.cs | 3 +- .../Shader/ShaderAddresses.cs | 3 +- .../Host1xClassRegisters.cs | 4 +- src/Ryujinx.Graphics.Host1x/ThiRegisters.cs | 4 +- .../Native/AVCodec.cs | 4 +- .../Native/AVCodec501.cs | 4 +- .../Native/AVCodecContext.cs | 4 +- .../Native/AVFrame.cs | 3 +- .../Native/AVPacket.cs | 4 +- .../Native/FFCodec.cs | 3 +- .../Native/FFCodecLegacy.cs | 3 +- .../Types/LoopFilterThresh.cs | 4 +- src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs | 4 +- src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs | 4 +- .../Types/H264/PictureInfo.cs | 6 +- .../Types/H264/ReferenceFrame.cs | 3 +- .../Types/Vp8/PictureInfo.cs | 3 +- .../Types/Vp9/EntropyProbs.cs | 3 +- .../Types/Vp9/FrameSize.cs | 4 +- .../Types/Vp9/FrameStats.cs | 4 +- .../Types/Vp9/LoopFilter.cs | 4 +- .../Types/Vp9/PictureInfo.cs | 3 +- .../Types/Vp9/Segmentation.cs | 4 +- src/Ryujinx.Graphics.OpenGL/FormatTable.cs | 2 +- .../Glsl/Instructions/InstGenHelper.cs | 2 +- .../CodeGen/Glsl/Instructions/InstType.cs | 1 - .../CodeGen/Spirv/CodeGenContext.cs | 3 +- .../CodeGen/Spirv/Instructions.cs | 7 +- .../CodeGen/Spirv/SpirvGenerator.cs | 9 +- .../Decoders/InstDecoders.cs | 16 +- .../Decoders/InstTable.cs | 2 +- .../Instructions/InstEmitBarrier.cs | 4 +- .../Instructions/InstEmitIntegerArithmetic.cs | 5 +- .../Instructions/InstEmitIntegerComparison.cs | 5 +- .../TextureFlags.cs | 1 - .../StructuredIr/InstructionInfo.cs | 2 +- src/Ryujinx.Graphics.Shader/TextureFormat.cs | 2 +- .../Translation/AggregateType.cs | 1 - .../Translation/EmitterContext.cs | 12 +- .../Astc/AstcPixel.cs | 2 +- .../Astc/BitStream128.cs | 22 +-- .../Types/ClearRectStruct.cs | 3 +- .../Types/ConfigStruct.cs | 4 +- .../Types/OutputConfig.cs | 3 +- .../Types/OutputSurfaceConfig.cs | 3 +- src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs | 4 +- src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs | 3 +- src/Ryujinx.Graphics.Vic/VicRegisters.cs | 8 +- src/Ryujinx.Graphics.Vulkan/BufferHolder.cs | 2 +- src/Ryujinx.Graphics.Vulkan/FormatTable.cs | 2 +- src/Ryujinx.Graphics.Vulkan/HelperShader.cs | 2 +- .../IndexBufferPattern.cs | 1 - .../MoltenVK/MVKConfiguration.cs | 2 +- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 6 + .../Controller/ControllerSupportArgHeader.cs | 3 +- .../Controller/ControllerSupportArgPrivate.cs | 3 +- .../Controller/ControllerSupportArgV7.cs | 3 +- .../Controller/ControllerSupportArgVPre7.cs | 3 +- .../Controller/ControllerSupportResultInfo.cs | 3 +- .../HOS/Applets/Error/ErrorApplet.cs | 2 +- .../PlayerSelect/PlayerSelectApplet.cs | 3 +- .../SoftwareKeyboardApplet.cs | 4 +- .../Demangler/Ast/ForwardTemplateReference.cs | 3 +- src/Ryujinx.HLE/HOS/Horizon.cs | 3 +- .../HOS/Kernel/Ipc/KLightClientSession.cs | 3 +- .../HOS/Kernel/Ipc/KLightServerSession.cs | 3 +- src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs | 2 - .../HOS/Kernel/Memory/KPageHeap.cs | 3 +- .../Kernel/Process/ProcessCreationFlags.cs | 1 - .../HOS/Kernel/SupervisorCall/MemoryInfo.cs | 4 +- .../HOS/Kernel/SupervisorCall/Syscall.cs | 88 +++++----- .../Kernel/SupervisorCall/ThreadContext.cs | 6 +- .../Acc/AccountService/ManagerServer.cs | 11 +- .../HOS/Services/Account/Acc/Types/UserId.cs | 2 +- .../SystemAppletProxy/IAudioController.cs | 18 +-- .../SystemAppletProxy/ICommonStateGetter.cs | 2 - .../ILibraryAppletCreator.cs | 5 +- .../SystemAppletProxy/ISelfController.cs | 8 +- .../HOS/Services/Am/AppletAE/AppletFifo.cs | 6 +- .../HOS/Services/Am/AppletAE/AppletSession.cs | 6 +- .../Services/Arp/ApplicationLaunchProperty.cs | 3 +- .../Services/Bluetooth/IBluetoothDriver.cs | 2 - .../HOS/Services/Caps/CaptureManager.cs | 5 +- .../Caps/IScreenShotApplicationService.cs | 12 +- .../HOS/Services/Fatal/IService.cs | 2 +- .../HOS/Services/Fs/IFileSystemProxy.cs | 14 +- src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs | 1 - .../Services/Hid/HidDevices/NpadDevices.cs | 1 + .../HidServer/IActiveVibrationDeviceList.cs | 4 +- .../HOS/Services/Hid/IHidServer.cs | 52 ++---- .../HOS/Services/Hid/Types/Npad/BusHandle.cs | 2 +- .../Hid/Types/SharedMemory/Common/RingLifo.cs | 6 +- .../SharedMemory/Npad/NpadGcTriggerState.cs | 4 +- .../SharedMemory/Npad/NpadInternalState.cs | 8 +- .../SharedMemory/TouchScreen/TouchState.cs | 11 +- src/Ryujinx.HLE/HOS/Services/IpcService.cs | 5 +- .../LdnMitm/Proxy/LdnProxyTcpSession.cs | 4 +- .../HOS/Services/Loader/ResultCode.cs | 2 - .../HOS/Services/Mii/Types/StoreData.cs | 2 +- .../ILocationResolver.cs | 14 +- .../Nfc/AmiiboDecryption/AmiiboBinReader.cs | 1 - .../Nfc/AmiiboDecryption/AmiiboDump.cs | 18 +-- .../HOS/Services/Nfc/Nfp/NfpManager/INfp.cs | 9 +- .../Nifm/StaticService/IGeneralService.cs | 3 - .../Services/Nifm/StaticService/IRequest.cs | 6 +- .../Types/InternetConnectionStatus.cs | 2 +- .../Nifm/StaticService/Types/IpV4Address.cs | 2 +- .../Services/Ns/Aoc/IAddOnContentManager.cs | 32 ---- .../Ns/IApplicationManagerInterface.cs | 7 +- ...ReadOnlyApplicationControlDataInterface.cs | 7 +- .../HOS/Services/Nv/INvDrvServices.cs | 14 +- .../NvHostAsGpu/Types/AllocSpaceArguments.cs | 2 +- .../NvHostAsGpu/Types/BindChannelArguments.cs | 2 +- .../NvHostAsGpu/Types/FreeSpaceArguments.cs | 2 +- .../Types/GetVaRegionsArguments.cs | 4 +- .../Types/InitializeExArguments.cs | 2 +- .../NvHostAsGpu/Types/MapBufferExArguments.cs | 2 +- .../NvHostAsGpu/Types/RemapArguments.cs | 2 +- .../NvHostAsGpu/Types/UnmapBufferArguments.cs | 4 +- .../NvHostChannel/NvHostChannelDeviceFile.cs | 10 +- .../NvHostChannel/NvHostGpuDeviceFile.cs | 3 +- .../Types/AllocGpfifoExArguments.cs | 2 +- .../Types/AllocObjCtxArguments.cs | 2 +- .../Types/GetParameterArguments.cs | 2 +- .../Types/MapCommandBufferArguments.cs | 2 +- .../NvHostChannel/Types/NvChannel.cs | 4 +- .../Types/SetErrorNotifierArguments.cs | 2 +- .../NvHostChannel/Types/SubmitArguments.cs | 8 +- .../Types/SubmitGpfifoArguments.cs | 2 +- .../NvHostChannel/Types/ZcullBindArguments.cs | 2 +- .../NvHostCtrl/Types/EventWaitArguments.cs | 2 +- .../NvHostCtrl/Types/NvHostEvent.cs | 4 +- .../NvHostCtrl/Types/SyncptWaitArguments.cs | 2 +- .../NvHostCtrl/Types/SyncptWaitExArguments.cs | 2 +- .../Types/GetActiveSlotMaskArguments.cs | 2 +- .../Types/GetCharacteristicsArguments.cs | 8 +- .../Types/GetGpuTimeArguments.cs | 2 +- .../Types/GetTpcMasksArguments.cs | 2 +- .../NvHostCtrlGpu/Types/NumVsmsArguments.cs | 2 +- .../Types/VsmsMappingArguments.cs | 2 +- .../Types/ZbcSetTableArguments.cs | 2 +- .../Types/ZcullGetCtxSizeArguments.cs | 2 +- .../Types/ZcullGetInfoArguments.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapAlloc.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapCreate.cs | 2 +- .../Nv/NvDrvServices/NvMap/Types/NvMapFree.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapFromId.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapGetId.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapHandle.cs | 4 +- .../NvDrvServices/NvMap/Types/NvMapParam.cs | 2 +- src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs | 2 +- .../IParentalControlService.cs | 3 - .../Clkrst/ClkrstManager/IClkrstSession.cs | 4 +- .../HOS/Services/Sdb/Pl/ISharedFontManager.cs | 13 +- src/Ryujinx.HLE/HOS/Services/ServerBase.cs | 5 +- .../HOS/Services/Sm/IUserInterface.cs | 6 +- .../HOS/Services/Sockets/Bsd/IClient.cs | 50 ++---- .../Sockets/Bsd/Impl/ManagedSocket.cs | 1 - .../HOS/Services/Sockets/Bsd/Impl/WSAError.cs | 2 - .../Sockets/Bsd/Types/BsdSocketOption.cs | 2 - .../Services/Sockets/Bsd/Types/LinuxError.cs | 2 - .../Sockets/Bsd/Types/PollEventData.cs | 4 +- .../Services/Sockets/Sfdnsres/IResolver.cs | 59 ++----- .../HOS/Services/Spl/IGeneralInterface.cs | 4 - .../Services/Ssl/BuiltInCertificateManager.cs | 6 +- .../HOS/Services/Ssl/ISslService.cs | 5 +- .../Services/Ssl/SslService/ISslContext.cs | 10 -- .../SslService/SslManagedSocketConnection.cs | 3 - .../SurfaceFlinger/BufferQueueProducer.cs | 2 - .../HOS/Services/SurfaceFlinger/Parcel.cs | 4 +- .../HOS/Services/SurfaceFlinger/Status.cs | 2 - .../Services/SurfaceFlinger/SurfaceFlinger.cs | 1 - .../SurfaceFlinger/Types/Color/ColorFormat.cs | 2 - .../Services/Time/Clock/Types/TimeSpanType.cs | 2 +- .../Services/Time/IStaticServiceForGlue.cs | 4 +- .../HOS/Services/Time/ResultCode.cs | 2 - .../StaticService/ITimeZoneServiceForPsc.cs | 6 - .../HOS/Services/Time/TimeSharedMemory.cs | 3 +- .../HOS/Services/Time/TimeZone/TimeZone.cs | 27 +--- .../IManagerDisplayService.cs | 7 +- .../RootService/IApplicationDisplayService.cs | 16 +- src/Ryujinx.HLE/HOS/TamperMachine.cs | 2 +- src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs | 2 - src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs | 4 +- src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs | 4 +- .../Loaders/Npdm/FsAccessHeader.cs | 5 +- src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs | 7 +- .../Extensions/FileSystemExtensions.cs | 1 - .../Loaders/Processes/ProcessResult.cs | 1 - src/Ryujinx.HLE/MemoryConfiguration.cs | 8 +- src/Ryujinx.HLE/StructHelpers.cs | 1 - src/Ryujinx.HLE/Switch.cs | 6 +- src/Ryujinx.HLE/UI/IHostUIHandler.cs | 1 - .../SyscallGenerator.cs | 112 ++++++++----- .../Sdk/Audio/Detail/AudioDevice.cs | 3 + .../Sdk/Codec/Detail/HardwareOpusDecoder.cs | 2 +- .../System/AccountNotificationSettings.cs | 4 +- .../System/BluetoothDevicesSettings.cs | 4 +- .../Settings/System/NotificationSettings.cs | 4 +- .../Sdk/Sf/Cmif/CmifDomainOutHeader.cs | 4 +- .../Sdk/Sf/Cmif/CmifOutHeader.cs | 4 +- .../Sdk/Sf/Cmif/CmifRequestFormat.cs | 2 - .../Sdk/Sf/Hipc/HipcBufferDescriptor.cs | 3 +- .../Sdk/Sf/Hipc/HipcReceiveListEntry.cs | 3 +- src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs | 2 +- src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs | 2 - src/Ryujinx.Input.SDL2/SDL2Keyboard.cs | 3 +- src/Ryujinx.Input/IMouse.cs | 2 - src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs | 4 +- src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs | 2 +- .../SequenceReaderExtensionsTests.cs | 18 +-- src/Ryujinx.Tests/Memory/MockMemoryManager.cs | 9 +- src/Ryujinx.Tests/Memory/PartialUnmaps.cs | 1 - .../Common/Models/XCITrimmerFileModel.cs | 4 +- src/Ryujinx/Program.cs | 8 +- .../Systems/AppLibrary/ApplicationData.cs | 4 +- .../LdnGameDataReceivedEventArgs.cs | 1 - .../ConfigurationState.Migration.cs | 3 +- .../Configuration/ConfigurationState.Model.cs | 3 +- .../Configuration/ConfigurationState.cs | 4 +- src/Ryujinx/Systems/Rebooter.cs | 2 - src/Ryujinx/Systems/Updater/Updater.GitLab.cs | 9 +- src/Ryujinx/Systems/Updater/Updater.cs | 151 ++++++++---------- .../UI/Applet/ControllerAppletDialog.axaml.cs | 2 +- .../Controls/ApplicationContextMenu.axaml.cs | 21 --- src/Ryujinx/UI/Helpers/LoggerAdapter.cs | 10 +- src/Ryujinx/UI/Helpers/Win32NativeInterop.cs | 3 +- .../UI/Models/Input/GamepadInputConfig.cs | 2 +- .../UI/Models/Input/KeyboardInputConfig.cs | 1 - src/Ryujinx/UI/Renderer/RendererHost.cs | 1 - .../UI/ViewModels/CompatibilityViewModel.cs | 19 +-- .../UI/ViewModels/Input/InputViewModel.cs | 9 +- .../UI/ViewModels/MainWindowViewModel.cs | 5 +- .../UI/ViewModels/SettingsViewModel.cs | 12 +- .../Views/Input/ControllerInputView.axaml.cs | 2 +- .../Settings/SettingsHotkeysView.axaml.cs | 2 +- .../Windows/CompatibilityListWindow.axaml.cs | 5 +- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 20 +-- .../Utilities/SystemInfo/WindowsSystemInfo.cs | 2 +- src/Spv.Generator/InstructionOperands.cs | 8 +- 309 files changed, 1018 insertions(+), 1247 deletions(-) delete mode 100644 src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs diff --git a/.editorconfig b/.editorconfig index 1059bcdeb..0f9dd369a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -45,10 +45,10 @@ dotnet_separate_import_directive_groups = false dotnet_sort_system_directives_first = false # this. and Me. preferences -dotnet_style_qualification_for_event = false:silent -dotnet_style_qualification_for_field = false:silent -dotnet_style_qualification_for_method = false:silent -dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_event = false:suggestion +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_property = false:suggestion # Language keywords vs BCL types preferences dotnet_style_predefined_type_for_locals_parameters_members = true:silent @@ -257,12 +257,14 @@ csharp_prefer_system_threading_lock = true:suggestion dotnet_diagnostic.CA1069.severity = none # CA1069: Enums values should not be duplicated # Disable Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppression +dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure dotnet_diagnostic.IDE0300.severity = none dotnet_diagnostic.IDE0301.severity = none dotnet_diagnostic.IDE0302.severity = none dotnet_diagnostic.IDE0305.severity = none dotnet_diagnostic.CS9113.severity = none # CS9113: Parameter 'value' is unread -dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure +dotnet_diagnostic.CS0649.severity = none # CS0649: Field is never assigned to, and will always have its default value [src/Ryujinx/UI/ViewModels/**.cs] # Disable "mark members as static" rule for ViewModels diff --git a/assets/locales.json b/assets/locales.json index 6bc44721d..5bb8a1d51 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -25023,4 +25023,4 @@ } } ] -} +} \ No newline at end of file diff --git a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs index 0d493426b..38398fb6a 100644 --- a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs +++ b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs @@ -1129,7 +1129,6 @@ namespace ARMeilleure.CodeGen.Arm64 }; } -#pragma warning disable IDE0051 // Remove unused private member private void WriteInt16(short value) { WriteUInt16((ushort)value); @@ -1144,7 +1143,6 @@ namespace ARMeilleure.CodeGen.Arm64 { _stream.WriteByte(value); } -#pragma warning restore IDE0051 private void WriteUInt16(ushort value) { diff --git a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs index fbf4c1eb4..e2ac49b23 100644 --- a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs +++ b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs @@ -1570,13 +1570,11 @@ namespace ARMeilleure.CodeGen.Arm64 Debug.Assert(op1.Type == op3.Type); } -#pragma warning disable IDE0051 // Remove unused private member private static void EnsureSameType(Operand op1, Operand op2, Operand op3, Operand op4) { Debug.Assert(op1.Type == op2.Type); Debug.Assert(op1.Type == op3.Type); Debug.Assert(op1.Type == op4.Type); } -#pragma warning restore IDE0051 } } diff --git a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs index 4b226803b..ddceae057 100644 --- a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs +++ b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.CodeGen.X86 { diff --git a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs index 8433aaea9..02b91c163 100644 --- a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs +++ b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs @@ -20,12 +20,12 @@ namespace ARMeilleure.CodeGen.X86 { if (GetCurrentCallConv() == CallConvName.Windows) { -#pragma warning disable IDE0055 // Disable formatting + return (1 << (int)X86Register.Rax) | (1 << (int)X86Register.Rcx) | (1 << (int)X86Register.Rdx) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); } @@ -36,11 +36,11 @@ namespace ARMeilleure.CodeGen.X86 (1 << (int)X86Register.Rdx) | (1 << (int)X86Register.Rsi) | (1 << (int)X86Register.Rdi) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); -#pragma warning restore IDE0055 + } } diff --git a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs index afae3211f..6d72e0aff 100644 --- a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs +++ b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs @@ -2,7 +2,6 @@ using ARMeilleure.CodeGen.RegisterAllocators; using ARMeilleure.IntermediateRepresentation; using Microsoft.IO; using Ryujinx.Common.Memory; -using System.IO; using System.Numerics; namespace ARMeilleure.CodeGen.X86 diff --git a/src/ARMeilleure/CodeGen/X86/X86Register.cs b/src/ARMeilleure/CodeGen/X86/X86Register.cs index bcce4f974..d1394deaa 100644 --- a/src/ARMeilleure/CodeGen/X86/X86Register.cs +++ b/src/ARMeilleure/CodeGen/X86/X86Register.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace ARMeilleure.CodeGen.X86 { enum X86Register diff --git a/src/ARMeilleure/Instructions/CryptoHelper.cs b/src/ARMeilleure/Instructions/CryptoHelper.cs index 046a9bb6d..3ce04aa5c 100644 --- a/src/ARMeilleure/Instructions/CryptoHelper.cs +++ b/src/ARMeilleure/Instructions/CryptoHelper.cs @@ -8,8 +8,8 @@ namespace ARMeilleure.Instructions static class CryptoHelper { #region "LookUp Tables" -#pragma warning disable IDE1006 // Naming rule violation - private static ReadOnlySpan _sBox => + + private static ReadOnlySpan SBox => [ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, @@ -29,7 +29,7 @@ namespace ARMeilleure.Instructions 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 ]; - private static ReadOnlySpan _invSBox => + private static ReadOnlySpan InvSBox => [ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, @@ -49,7 +49,7 @@ namespace ARMeilleure.Instructions 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ]; - private static ReadOnlySpan _gfMul02 => + private static ReadOnlySpan GfMul02 => [ 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, @@ -69,7 +69,7 @@ namespace ARMeilleure.Instructions 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 ]; - private static ReadOnlySpan _gfMul03 => + private static ReadOnlySpan GfMul03 => [ 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, @@ -89,7 +89,7 @@ namespace ARMeilleure.Instructions 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a ]; - private static ReadOnlySpan _gfMul09 => + private static ReadOnlySpan GfMul09 => [ 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, @@ -109,7 +109,7 @@ namespace ARMeilleure.Instructions 0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46 ]; - private static ReadOnlySpan _gfMul0B => + private static ReadOnlySpan GfMul0B => [ 0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, @@ -129,7 +129,7 @@ namespace ARMeilleure.Instructions 0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3 ]; - private static ReadOnlySpan _gfMul0D => + private static ReadOnlySpan GfMul0D => [ 0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, @@ -149,7 +149,7 @@ namespace ARMeilleure.Instructions 0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97 ]; - private static ReadOnlySpan _gfMul0E => + private static ReadOnlySpan GfMul0E => [ 0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, @@ -169,16 +169,16 @@ namespace ARMeilleure.Instructions 0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d ]; - private static ReadOnlySpan _srPerm => + private static ReadOnlySpan SrPerm => [ 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3 ]; - private static ReadOnlySpan _isrPerm => + private static ReadOnlySpan IsrPerm => [ 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11 ]; -#pragma warning restore IDE1006 + #endregion public static V128 AesInvMixColumns(V128 op) @@ -195,10 +195,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)_gfMul0E[row0] ^ _gfMul0B[row1] ^ _gfMul0D[row2] ^ _gfMul09[row3]); - outState[idx + 1] = (byte)((uint)_gfMul09[row0] ^ _gfMul0E[row1] ^ _gfMul0B[row2] ^ _gfMul0D[row3]); - outState[idx + 2] = (byte)((uint)_gfMul0D[row0] ^ _gfMul09[row1] ^ _gfMul0E[row2] ^ _gfMul0B[row3]); - outState[idx + 3] = (byte)((uint)_gfMul0B[row0] ^ _gfMul0D[row1] ^ _gfMul09[row2] ^ _gfMul0E[row3]); + outState[idx + 0] = (byte)((uint)GfMul0E[row0] ^ GfMul0B[row1] ^ GfMul0D[row2] ^ GfMul09[row3]); + outState[idx + 1] = (byte)((uint)GfMul09[row0] ^ GfMul0E[row1] ^ GfMul0B[row2] ^ GfMul0D[row3]); + outState[idx + 2] = (byte)((uint)GfMul0D[row0] ^ GfMul09[row1] ^ GfMul0E[row2] ^ GfMul0B[row3]); + outState[idx + 3] = (byte)((uint)GfMul0B[row0] ^ GfMul0D[row1] ^ GfMul09[row2] ^ GfMul0E[row3]); } return new V128(outState); @@ -211,7 +211,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[_isrPerm[idx]] = inState[idx]; + outState[IsrPerm[idx]] = inState[idx]; } return new V128(outState); @@ -224,7 +224,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = _invSBox[inState[idx]]; + outState[idx] = InvSBox[inState[idx]]; } return new V128(outState); @@ -244,10 +244,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)_gfMul02[row0] ^ _gfMul03[row1] ^ row2 ^ row3); - outState[idx + 1] = (byte)((uint)row0 ^ _gfMul02[row1] ^ _gfMul03[row2] ^ row3); - outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ _gfMul02[row2] ^ _gfMul03[row3]); - outState[idx + 3] = (byte)((uint)_gfMul03[row0] ^ row1 ^ row2 ^ _gfMul02[row3]); + outState[idx + 0] = (byte)((uint)GfMul02[row0] ^ GfMul03[row1] ^ row2 ^ row3); + outState[idx + 1] = (byte)((uint)row0 ^ GfMul02[row1] ^ GfMul03[row2] ^ row3); + outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ GfMul02[row2] ^ GfMul03[row3]); + outState[idx + 3] = (byte)((uint)GfMul03[row0] ^ row1 ^ row2 ^ GfMul02[row3]); } return new V128(outState); @@ -260,7 +260,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[_srPerm[idx]] = inState[idx]; + outState[SrPerm[idx]] = inState[idx]; } return new V128(outState); @@ -273,7 +273,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = _sBox[inState[idx]]; + outState[idx] = SBox[inState[idx]]; } return new V128(outState); diff --git a/src/ARMeilleure/Instructions/InstEmitMul.cs b/src/ARMeilleure/Instructions/InstEmitMul.cs index cb48deb03..bd2ac8d64 100644 --- a/src/ARMeilleure/Instructions/InstEmitMul.cs +++ b/src/ARMeilleure/Instructions/InstEmitMul.cs @@ -2,7 +2,6 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.Translation; using System; -using System.Diagnostics.CodeAnalysis; using static ARMeilleure.Instructions.InstEmitHelper; namespace ARMeilleure.Instructions diff --git a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs index cee7a4ed8..0fd188f2a 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs @@ -11,11 +11,10 @@ using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { public static void Abs_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs index 8fcb06286..64e4078c8 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs @@ -2,15 +2,13 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; -using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { public static void Cmeq_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs index 6ec2b58f9..3068519f3 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs @@ -2,17 +2,15 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; -using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit32 { public static void Vceq_V(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs index cf427eeae..a9787224e 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs @@ -8,11 +8,10 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - static partial class InstEmit { public static void Fcvt_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs index 11d0c93b4..e44e174fe 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs @@ -8,13 +8,12 @@ using System.Diagnostics; using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper { #region "Masks" diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs index c053fe27b..7b9b0c1b7 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs @@ -7,13 +7,12 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper32 { public static (int, int) GetQuadwordAndSubindex(int index, RegisterSize size) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs index a1ca417b4..bfd3064a0 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs @@ -7,13 +7,12 @@ using System.Diagnostics; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper32Arm64 { // Intrinsic Helpers diff --git a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs index dedf0fa05..5409e6879 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs @@ -40,34 +40,36 @@ namespace ARMeilleure.Instructions long offset = 0; -#pragma warning disable IDE0055 // Disable formatting - for (int rep = 0; rep < op.Reps; rep++) - for (int elem = 0; elem < op.Elems; elem++) - for (int sElem = 0; sElem < op.SElems; sElem++) + for (int rep = 0; rep < op.Reps; rep++) { - int rtt = (op.Rt + rep + sElem) & 0x1f; - - Operand tt = GetVec(rtt); - - Operand address = context.Add(n, Const(offset)); - - if (isLoad) + for (int elem = 0; elem < op.Elems; elem++) { - EmitLoadSimd(context, address, tt, rtt, elem, op.Size); - - if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) + for (int sElem = 0; sElem < op.SElems; sElem++) { - context.Copy(tt, context.VectorZeroUpper64(tt)); + int rtt = (op.Rt + rep + sElem) & 0x1f; + + Operand tt = GetVec(rtt); + + Operand address = context.Add(n, Const(offset)); + + if (isLoad) + { + EmitLoadSimd(context, address, tt, rtt, elem, op.Size); + + if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) + { + context.Copy(tt, context.VectorZeroUpper64(tt)); + } + } + else + { + EmitStoreSimd(context, address, rtt, elem, op.Size); + } + + offset += 1 << op.Size; } } - else - { - EmitStoreSimd(context, address, rtt, elem, op.Size); - } - - offset += 1 << op.Size; } -#pragma warning restore IDE0055 if (op.WBack) { diff --git a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs index 3469434c0..39dadf13d 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs @@ -9,11 +9,10 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { #region "Masks" diff --git a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs index 9d87c13b3..31dc97bd6 100644 --- a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs +++ b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.IntermediateRepresentation { diff --git a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs index d22c89a75..69c56a98c 100644 --- a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs +++ b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs @@ -7,10 +7,9 @@ namespace ARMeilleure.IntermediateRepresentation { private struct Data { -#pragma warning disable CS0649 // Field is never assigned to public byte Kind; public byte Type; -#pragma warning restore CS0649 + public byte Scale; public Operand BaseAddress; public Operand Index; diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs index 18390de31..297ee040c 100644 --- a/src/ARMeilleure/Optimizations.cs +++ b/src/ARMeilleure/Optimizations.cs @@ -1,8 +1,8 @@ +using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; +using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; + namespace ARMeilleure { - using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; - using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; - public static class Optimizations { // low-core count PPTC diff --git a/src/ARMeilleure/Translation/ArmEmitterContext.cs b/src/ARMeilleure/Translation/ArmEmitterContext.cs index 196120e92..0d6e65d8b 100644 --- a/src/ARMeilleure/Translation/ArmEmitterContext.cs +++ b/src/ARMeilleure/Translation/ArmEmitterContext.cs @@ -218,18 +218,28 @@ namespace ARMeilleure.Translation { switch (condition) { -#pragma warning disable IDE0055 // Disable formatting - case Condition.Eq: return ICompareEqual (n, m); - case Condition.Ne: return ICompareNotEqual (n, m); - case Condition.GeUn: return ICompareGreaterOrEqualUI(n, m); - case Condition.LtUn: return ICompareLessUI (n, m); - case Condition.GtUn: return ICompareGreaterUI (n, m); - case Condition.LeUn: return ICompareLessOrEqualUI (n, m); - case Condition.Ge: return ICompareGreaterOrEqual (n, m); - case Condition.Lt: return ICompareLess (n, m); - case Condition.Gt: return ICompareGreater (n, m); - case Condition.Le: return ICompareLessOrEqual (n, m); -#pragma warning restore IDE0055 + + case Condition.Eq: + return ICompareEqual(n, m); + case Condition.Ne: + return ICompareNotEqual(n, m); + case Condition.GeUn: + return ICompareGreaterOrEqualUI(n, m); + case Condition.LtUn: + return ICompareLessUI(n, m); + case Condition.GtUn: + return ICompareGreaterUI(n, m); + case Condition.LeUn: + return ICompareLessOrEqualUI(n, m); + case Condition.Ge: + return ICompareGreaterOrEqual(n, m); + case Condition.Lt: + return ICompareLess(n, m); + case Condition.Gt: + return ICompareGreater(n, m); + case Condition.Le: + return ICompareLessOrEqual(n, m); + } } else if (cmpName == InstName.Adds && _optOpLastCompare is IOpCodeAluImm op) @@ -254,14 +264,20 @@ namespace ARMeilleure.Translation switch (condition) { -#pragma warning disable IDE0055 // Disable formatting - case Condition.Eq: return ICompareEqual (n, m); - case Condition.Ne: return ICompareNotEqual (n, m); - case Condition.Ge: return ICompareGreaterOrEqual(n, m); - case Condition.Lt: return ICompareLess (n, m); - case Condition.Gt: return ICompareGreater (n, m); - case Condition.Le: return ICompareLessOrEqual (n, m); -#pragma warning restore IDE0055 + + case Condition.Eq: + return ICompareEqual(n, m); + case Condition.Ne: + return ICompareNotEqual(n, m); + case Condition.Ge: + return ICompareGreaterOrEqual(n, m); + case Condition.Lt: + return ICompareLess(n, m); + case Condition.Gt: + return ICompareGreater(n, m); + case Condition.Le: + return ICompareLessOrEqual(n, m); + } } diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index f36d4256d..a9f077dd9 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -22,12 +22,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using static ARMeilleure.Translation.PTC.PtcFormatter; +using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; +using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; namespace ARMeilleure.Translation.PTC { - using Arm64HardwareCapabilities = CodeGen.Arm64.HardwareCapabilities; - using X86HardwareCapabilities = CodeGen.X86.HardwareCapabilities; - class Ptc : IPtcLoadState { private const string OuterHeaderMagicString = "PTCohd\0\0"; diff --git a/src/ARMeilleure/Translation/RegisterUsage.cs b/src/ARMeilleure/Translation/RegisterUsage.cs index 03d4a96e7..e2489b6a9 100644 --- a/src/ARMeilleure/Translation/RegisterUsage.cs +++ b/src/ARMeilleure/Translation/RegisterUsage.cs @@ -297,12 +297,20 @@ namespace ARMeilleure.Translation switch (register.Type) { -#pragma warning disable IDE0055 // Disable formatting - case RegisterType.Flag: intMask = (1L << RegsCount) << register.Index; break; - case RegisterType.Integer: intMask = 1L << register.Index; break; - case RegisterType.FpFlag: vecMask = (1L << RegsCount) << register.Index; break; - case RegisterType.Vector: vecMask = 1L << register.Index; break; -#pragma warning restore IDE0055 + + case RegisterType.Flag: + intMask = (1L << RegsCount) << register.Index; + break; + case RegisterType.Integer: + intMask = 1L << register.Index; + break; + case RegisterType.FpFlag: + vecMask = (1L << RegsCount) << register.Index; + break; + case RegisterType.Vector: + vecMask = 1L << register.Index; + break; + } return new RegisterMask(intMask, vecMask); diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs index d5381209e..f7e1d27b8 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs @@ -12,7 +12,7 @@ using static SDL2.SDL; namespace Ryujinx.Audio.Backends.SDL2 { - public class SDL2HardwareDeviceDriver : IHardwareDeviceDriver + public partial class SDL2HardwareDeviceDriver : IHardwareDeviceDriver { private readonly ManualResetEvent _updateRequiredEvent; private readonly ManualResetEvent _pauseEvent; @@ -22,10 +22,36 @@ namespace Ryujinx.Audio.Backends.SDL2 public float Volume { get; set; } - // TODO: Add this to SDL2-CS - // NOTE: We use a DllImport here because of marshaling issue for spec. - [DllImport("SDL2")] - private static extern int SDL_GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture); + // A safe method to get default audio information. + private static int GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture) + { + int result; + spec = new SDL_AudioSpec(); + IntPtr specPtr = IntPtr.Zero; + + try + { + // Reserve memory + specPtr = Marshal.AllocHGlobal(Marshal.SizeOf()); + // Call method + result = SDL_GetDefaultAudioInfo(name, specPtr, isCapture); + // Copy result to managed structure + spec = Marshal.PtrToStructure(specPtr); + } + finally + { + // Free the unmanaged memory to prevent memory leaks + if (specPtr != IntPtr.Zero) + { + Marshal.FreeHGlobal(specPtr); + } + } + + return result; + } + + [LibraryImport("SDL2")] + private static partial int SDL_GetDefaultAudioInfo(nint name, nint spec, int isCapture); public SDL2HardwareDeviceDriver() { @@ -35,7 +61,7 @@ namespace Ryujinx.Audio.Backends.SDL2 SDL2Driver.Instance.Initialize(); - int res = SDL_GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); + int res = GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); if (res != 0) { diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs index 6a12e8c0c..62f6b14bc 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs +++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs @@ -23,7 +23,7 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void JackCallbackDelegate(nint msg); - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct SoundIoStruct { public nint UserData; diff --git a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs index 98b224ebf..b756f9d70 100644 --- a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs +++ b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs @@ -20,9 +20,7 @@ namespace Ryujinx.Audio.Renderer.Common public uint Unknown24; public uint RenderInfoSize; -#pragma warning disable IDE0051, CS0169 // Remove unused field private Array4 _reserved; -#pragma warning restore IDE0051, CS0169 public uint TotalSize; diff --git a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs index 1a5802a37..38429092f 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs @@ -12,9 +12,8 @@ namespace Ryujinx.Audio.Renderer.Dsp private const int SamplesPerFrame = 14; private const int NibblesPerFrame = SamplesPerFrame + 2; private const int BytesPerFrame = 8; -#pragma warning disable IDE0051 // Remove unused private member + private const int BitsPerFrame = BytesPerFrame * 8; -#pragma warning restore IDE0051 [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint GetAdpcmDataSize(int sampleCount) diff --git a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs index ee2f23479..c6f126c65 100644 --- a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs +++ b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs @@ -41,10 +41,10 @@ namespace Ryujinx.Audio.Renderer.Server private UpsamplerManager _upsamplerManager; private bool _isActive; private BehaviourContext _behaviourContext; -#pragma warning disable IDE0052 // Remove unread private member + private ulong _totalElapsedTicksUpdating; private ulong _totalElapsedTicks; -#pragma warning restore IDE0052 + private int _sessionId; private Memory _memoryPools; diff --git a/src/Ryujinx.Common/Collections/TreeDictionary.cs b/src/Ryujinx.Common/Collections/TreeDictionary.cs index af104d268..f194a9f93 100644 --- a/src/Ryujinx.Common/Collections/TreeDictionary.cs +++ b/src/Ryujinx.Common/Collections/TreeDictionary.cs @@ -147,9 +147,9 @@ namespace Ryujinx.Common.Collections Queue> nodes = new(); - if (this.Root != null) + if (Root != null) { - nodes.Enqueue(this.Root); + nodes.Enqueue(Root); } while (nodes.TryDequeue(out Node node)) @@ -522,7 +522,7 @@ namespace Ryujinx.Common.Collections public void CopyTo(KeyValuePair[] array, int arrayIndex) { - if (arrayIndex < 0 || array.Length - arrayIndex < this.Count) + if (arrayIndex < 0 || array.Length - arrayIndex < Count) { throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs index f3a9e1646..bae6e35de 100644 --- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs +++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs @@ -36,8 +36,6 @@ namespace Ryujinx.Common.Configuration }; } - - public static float ToFloatY(this AspectRatio aspectRatio) { return aspectRatio switch diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs index ae3416a27..d0565c88a 100644 --- a/src/Ryujinx.Common/Configuration/DirtyHack.cs +++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs @@ -18,8 +18,6 @@ namespace Ryujinx.Common.Configuration public DirtyHack Hack => hack; public int Value => value; - - public ulong Pack() => Raw.PackBitFields(PackedFormat); public static EnabledDirtyHack Unpack(ulong packedHack) diff --git a/src/Ryujinx.Common/Hash128.cs b/src/Ryujinx.Common/Hash128.cs index e95a15caa..f57bb6c84 100644 --- a/src/Ryujinx.Common/Hash128.cs +++ b/src/Ryujinx.Common/Hash128.cs @@ -10,7 +10,7 @@ using System.Runtime.Intrinsics.X86; namespace Ryujinx.Common { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Hash128(ulong low, ulong high) : IEquatable { public ulong Low = low; diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs index e6f68599a..add5ad22f 100644 --- a/src/Ryujinx.Common/Logging/Logger.cs +++ b/src/Ryujinx.Common/Logging/Logger.cs @@ -219,16 +219,34 @@ namespace Ryujinx.Common.Logging switch (logLevel) { #pragma warning disable IDE0055 // Disable formatting - case LogLevel.Debug : Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); break; - case LogLevel.Info : Info = enabled ? new Log(LogLevel.Info) : new Log?(); break; - case LogLevel.Warning : Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); break; - case LogLevel.Error : Error = enabled ? new Log(LogLevel.Error) : new Log?(); break; - case LogLevel.Guest : Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); break; - case LogLevel.AccessLog : AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); break; - case LogLevel.Stub : Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); break; - case LogLevel.Trace : Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); break; - case LogLevel.Notice : break; - default: throw new ArgumentException("Unknown Log Level", nameof(logLevel)); + case LogLevel.Debug: + Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); + break; + case LogLevel.Info: + Info = enabled ? new Log(LogLevel.Info) : new Log?(); + break; + case LogLevel.Warning: + Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); + break; + case LogLevel.Error: + Error = enabled ? new Log(LogLevel.Error) : new Log?(); + break; + case LogLevel.Guest: + Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); + break; + case LogLevel.AccessLog: + AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); + break; + case LogLevel.Stub: + Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); + break; + case LogLevel.Trace: + Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); + break; + case LogLevel.Notice: + break; + default: + throw new ArgumentException("Unknown Log Level", nameof(logLevel)); #pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index fcb2229a7..6d3435755 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -2,9 +2,9 @@ using System; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; -#pragma warning disable CS0169, IDE0051 // Remove unused private member namespace Ryujinx.Common.Memory { + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array1 : IArray where T : unmanaged { T _e0; @@ -15,6 +15,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array2 : IArray where T : unmanaged { T _e0; @@ -26,6 +27,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array3 : IArray where T : unmanaged { T _e0; @@ -37,6 +39,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array4 : IArray where T : unmanaged { T _e0; @@ -48,6 +51,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array5 : IArray where T : unmanaged { T _e0; @@ -59,6 +63,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array6 : IArray where T : unmanaged { T _e0; @@ -70,6 +75,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array7 : IArray where T : unmanaged { T _e0; @@ -81,6 +87,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array8 : IArray where T : unmanaged { T _e0; @@ -92,6 +99,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array9 : IArray where T : unmanaged { T _e0; @@ -103,6 +111,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array10 : IArray where T : unmanaged { T _e0; @@ -114,6 +123,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array11 : IArray where T : unmanaged { T _e0; @@ -125,6 +135,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array12 : IArray where T : unmanaged { T _e0; @@ -136,6 +147,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array13 : IArray where T : unmanaged { T _e0; @@ -147,6 +159,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array14 : IArray where T : unmanaged { T _e0; @@ -158,6 +171,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array15 : IArray where T : unmanaged { T _e0; @@ -169,6 +183,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array16 : IArray where T : unmanaged { T _e0; @@ -180,6 +195,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array17 : IArray where T : unmanaged { T _e0; @@ -191,6 +207,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array18 : IArray where T : unmanaged { T _e0; @@ -202,6 +219,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array19 : IArray where T : unmanaged { T _e0; @@ -213,6 +231,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array20 : IArray where T : unmanaged { T _e0; @@ -224,6 +243,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array21 : IArray where T : unmanaged { T _e0; @@ -235,6 +255,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array22 : IArray where T : unmanaged { T _e0; @@ -246,6 +267,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array23 : IArray where T : unmanaged { T _e0; @@ -257,6 +279,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array24 : IArray where T : unmanaged { T _e0; @@ -269,6 +292,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array25 : IArray where T : unmanaged { T _e0; @@ -281,6 +305,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array26 : IArray where T : unmanaged { T _e0; @@ -293,6 +318,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array27 : IArray where T : unmanaged { T _e0; @@ -305,6 +331,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array28 : IArray where T : unmanaged { T _e0; @@ -317,6 +344,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array29 : IArray where T : unmanaged { T _e0; @@ -329,6 +357,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array30 : IArray where T : unmanaged { T _e0; @@ -341,6 +370,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array31 : IArray where T : unmanaged { T _e0; @@ -353,6 +383,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array32 : IArray where T : unmanaged { T _e0; @@ -365,6 +396,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array33 : IArray where T : unmanaged { T _e0; @@ -377,6 +409,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array34 : IArray where T : unmanaged { T _e0; @@ -389,6 +422,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array35 : IArray where T : unmanaged { T _e0; @@ -401,6 +435,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array36 : IArray where T : unmanaged { T _e0; @@ -413,6 +448,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array37 : IArray where T : unmanaged { T _e0; @@ -425,6 +461,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array38 : IArray where T : unmanaged { T _e0; @@ -437,6 +474,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array39 : IArray where T : unmanaged { T _e0; @@ -449,6 +487,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array40 : IArray where T : unmanaged { T _e0; @@ -461,6 +500,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array41 : IArray where T : unmanaged { T _e0; @@ -473,6 +513,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array42 : IArray where T : unmanaged { T _e0; @@ -485,6 +526,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array43 : IArray where T : unmanaged { T _e0; @@ -497,6 +539,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array44 : IArray where T : unmanaged { T _e0; @@ -509,6 +552,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array45 : IArray where T : unmanaged { T _e0; @@ -521,6 +565,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array46 : IArray where T : unmanaged { T _e0; @@ -533,6 +578,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array47 : IArray where T : unmanaged { T _e0; @@ -545,6 +591,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array48 : IArray where T : unmanaged { T _e0; @@ -557,6 +604,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array49 : IArray where T : unmanaged { T _e0; @@ -569,6 +617,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array50 : IArray where T : unmanaged { T _e0; @@ -581,6 +630,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array51 : IArray where T : unmanaged { T _e0; @@ -593,6 +643,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array52 : IArray where T : unmanaged { T _e0; @@ -605,6 +656,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array53 : IArray where T : unmanaged { T _e0; @@ -617,6 +669,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array54 : IArray where T : unmanaged { T _e0; @@ -629,6 +682,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array55 : IArray where T : unmanaged { T _e0; @@ -641,6 +695,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array56 : IArray where T : unmanaged { T _e0; @@ -653,6 +708,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array57 : IArray where T : unmanaged { T _e0; @@ -665,6 +721,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array58 : IArray where T : unmanaged { T _e0; @@ -677,6 +734,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array59 : IArray where T : unmanaged { T _e0; @@ -689,6 +747,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array60 : IArray where T : unmanaged { T _e0; @@ -700,6 +759,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array61 : IArray where T : unmanaged { T _e0; @@ -711,6 +771,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array62 : IArray where T : unmanaged { T _e0; @@ -722,6 +783,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array63 : IArray where T : unmanaged { T _e0; @@ -733,6 +795,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array64 : IArray where T : unmanaged { T _e0; @@ -744,6 +807,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array65 : IArray where T : unmanaged { T _e0; @@ -755,6 +819,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array73 : IArray where T : unmanaged { T _e0; @@ -767,6 +832,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array96 : IArray where T : unmanaged { T _e0; @@ -779,6 +845,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array127 : IArray where T : unmanaged { T _e0; @@ -791,6 +858,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array128 : IArray where T : unmanaged { T _e0; @@ -803,6 +871,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array140 : IArray where T : unmanaged { T _e0; @@ -816,6 +885,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array256 : IArray where T : unmanaged { T _e0; @@ -828,6 +898,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array384 : IArray where T : unmanaged { T _e0; @@ -844,4 +915,4 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } } -#pragma warning restore CS0169, IDE0051 + diff --git a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs index 67f067ae2..2a56706d7 100644 --- a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs +++ b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs @@ -94,7 +94,7 @@ namespace Ryujinx.Common.PreciseSleep Bias = GetBias(0); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct Timespec { public long tv_sec; // Seconds diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index a5beb1009..3f30ba086 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,10 +1,5 @@ -using Ryujinx.Common.Utilities; using System; -using System.Net.Http; -using System.Net.Http.Json; using System.Reflection; -using System.Text.Json.Serialization; -using System.Threading.Tasks; namespace Ryujinx.Common { @@ -37,6 +32,4 @@ namespace Ryujinx.Common ? $"https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-{currentVersion}...Canary-{newVersion}" : $"https://git.ryujinx.app/ryubing/ryujinx/-/releases/{newVersion}"; } - - } diff --git a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs index c00598c98..0b78aa14d 100644 --- a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs +++ b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs @@ -28,12 +28,10 @@ namespace Ryujinx.Common.SystemInterop { public int GdiplusVersion; -#pragma warning disable CS0649 // Field is never assigned to public nint DebugEventCallback; public int SuppressBackgroundThread; public int SuppressExternalCodecs; public int StartupParameters; -#pragma warning restore CS0649 public static StartupInputEx Default => new() { diff --git a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs index 0fbce37e2..1f0c47624 100644 --- a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs +++ b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Common.SystemInterop [SupportedOSPlatform("windows")] public partial class WindowsMultimediaTimerResolution : IDisposable { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct TimeCaps { public uint wPeriodMin; diff --git a/src/Ryujinx.Common/Utilities/Buffers.cs b/src/Ryujinx.Common/Utilities/Buffers.cs index b66f6025e..775d96790 100644 --- a/src/Ryujinx.Common/Utilities/Buffers.cs +++ b/src/Ryujinx.Common/Utilities/Buffers.cs @@ -9,8 +9,8 @@ namespace Ryujinx.Common.Utilities [StructLayout(LayoutKind.Sequential, Size = 16)] public struct Buffer16 { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy0; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy1; + public ulong Low { get; set; } + public ulong High { get; set; } public byte this[int i] { diff --git a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs index fa04ee347..60b46697b 100644 --- a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs +++ b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs @@ -241,7 +241,7 @@ namespace Ryujinx.Common.Utilities public IndentedStringBuilder Append(object value) { - this.Append(value.ToString()); + Append(value.ToString()); return this; } @@ -271,7 +271,7 @@ namespace Ryujinx.Common.Utilities { _builder.Append(value); - this.AppendLine(); + AppendLine(); return this; } diff --git a/src/Ryujinx.Common/Utilities/Rainbow.cs b/src/Ryujinx.Common/Utilities/Rainbow.cs index 93129bf10..57177c76d 100644 --- a/src/Ryujinx.Common/Utilities/Rainbow.cs +++ b/src/Ryujinx.Common/Utilities/Rainbow.cs @@ -32,7 +32,6 @@ namespace Ryujinx.Common.Utilities CyclingEnabled = false; } - public static float Speed { get; set; } = 1; private static readonly Lock _lock = new(); diff --git a/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs deleted file mode 100644 index 8e775f094..000000000 --- a/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Ryujinx.Cpu.AppleHv -{ - public class DummyDiskCacheLoadState : IDiskCacheLoadState - { -#pragma warning disable CS0067 // The event is never used - /// - public event Action StateChanged; -#pragma warning restore CS0067 - - /// - public void Cancel() - { - } - } -} diff --git a/src/Ryujinx.Cpu/AppleHv/HvApi.cs b/src/Ryujinx.Cpu/AppleHv/HvApi.cs index 864f6b063..80662acc2 100644 --- a/src/Ryujinx.Cpu/AppleHv/HvApi.cs +++ b/src/Ryujinx.Cpu/AppleHv/HvApi.cs @@ -6,11 +6,11 @@ namespace Ryujinx.Cpu.AppleHv { struct HvVcpuExitException { -#pragma warning disable CS0649 // Field is never assigned to + public ulong Syndrome; public ulong VirtualAddress; public ulong PhysicalAddress; -#pragma warning restore CS0649 + } enum HvExitReason : uint @@ -23,10 +23,10 @@ namespace Ryujinx.Cpu.AppleHv struct HvVcpuExit { -#pragma warning disable CS0649 // Field is never assigned to + public HvExitReason Reason; public HvVcpuExitException Exception; -#pragma warning restore CS0649 + } enum HvReg : uint diff --git a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs index d050bddeb..d1cccf387 100644 --- a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs +++ b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Cpu { public class DummyDiskCacheLoadState : IDiskCacheLoadState { -#pragma warning disable CS0067 // The event is never used /// public event Action StateChanged; -#pragma warning restore CS0067 + + public DummyDiskCacheLoadState() => StateChanged?.Invoke(LoadState.Unloaded, 0, 0); /// public void Cancel() diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index 3aa616a8d..c50fedf61 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,7 +15,6 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); - public long TickScalar { get; set; } private static long _acumElapsedTicks; diff --git a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 27a2ac896..3a7448c25 100644 --- a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.GAL public override bool Equals(object obj) { - return obj is TextureCreateInfo info && this.Equals(info); + return obj is TextureCreateInfo info && Equals(info); } public static bool operator ==(TextureCreateInfo left, TextureCreateInfo right) diff --git a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs index 69de93ad5..79fed54e7 100644 --- a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs +++ b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.Graphics.GAL { public enum ViewportSwizzle diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs index 18f79cc3a..9e491d3dc 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs @@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute /// unsafe struct ComputeClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -430,6 +430,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute public readonly int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF); public fixed uint Reserved33E8[6]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs index f258c0070..66e116c8e 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs @@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// unsafe struct DmaClassState { -#pragma warning disable CS0649 // Field is never assigned to + public fixed uint Reserved00[64]; public uint Nop; public fixed uint Reserved104[15]; @@ -266,6 +266,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public fixed uint Reserved740[629]; public uint PmTriggerEnd; public fixed uint Reserved1118[2490]; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs index 368158718..cbd31b0ea 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// struct DmaTexture { -#pragma warning disable CS0649 // Field is never assigned to + public MemoryLayout MemoryLayout; public int Width; public int Height; @@ -15,6 +15,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public int RegionZ; public ushort RegionX; public ushort RegionY; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs index 21eb5bfa9..0f2da508e 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs @@ -25,9 +25,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct CompressedMethod { -#pragma warning disable CS0649 // Field is never assigned to + public uint Method; -#pragma warning restore CS0649 + public readonly int MethodAddressOld => (int)((Method >> 2) & 0x7FF); public readonly int MethodAddress => (int)(Method & 0xFFF); public readonly int SubdeviceMask => (int)((Method >> 4) & 0xFFF); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs index d28f2fbb5..7224a3643 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs @@ -36,15 +36,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct GPEntry { -#pragma warning disable CS0649 // Field is never assigned to + public uint Entry0; -#pragma warning restore CS0649 + public readonly Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1); public readonly int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF); public readonly int Entry0Operand => (int)(Entry0); -#pragma warning disable CS0649 // Field is never assigned to + public uint Entry1; -#pragma warning restore CS0649 + public readonly int Entry1GetHi => (int)(Entry1 & 0xFF); public readonly Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1); public readonly Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs index 56bebc336..71fe800ea 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs @@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo /// struct GPFifoClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectNvclass => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngine => (int)((SetObject >> 16) & 0x1F); @@ -228,6 +228,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo public uint LoadMmeStartAddressRamPointer; public uint LoadMmeStartAddressRam; public uint SetMmeShadowRamControl; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs index 1aff0441f..94ccbeae9 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory /// unsafe struct InlineToMemoryClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -178,6 +178,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory public uint SetI2mSpareNoop03; public fixed uint Reserved200[3200]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs index f62a4c01a..2b30b7c92 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs @@ -469,12 +469,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME for (int i = 0; i < maxDrawCount; i++) { FifoWord count = FetchParam(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - FifoWord instanceCount = FetchParam(); + + _ = FetchParam(); // Instance count FifoWord firstIndex = FetchParam(); - FifoWord firstVertex = FetchParam(); - FifoWord firstInstance = FetchParam(); -#pragma warning restore IDE0059 + _ = FetchParam(); // First vertex + _ = FetchParam(); // First instance if (i == 0) { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs index b4346add1..ce1d4e78d 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs @@ -9,9 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine [StructLayout(LayoutKind.Sequential, Size = 1024)] struct MmeShadowScratch { -#pragma warning disable CS0169 // The private field is never used private uint _e0; -#pragma warning restore CS0169 public ref uint this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 256); } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs index 739d32237..8a59c84e6 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs @@ -16,9 +16,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed private int _inlineIndexBufferSize; private int _inlineIndexCount; private uint[] _buffer; -#pragma warning disable IDE0051 // Remove unused private member + private readonly int _bufferOffset; -#pragma warning restore IDE0051 /// /// Indicates if any index buffer data has been pushed. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs index 402e3ff80..5260c9233 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.Graphics.Gpu.Engine.Threed { /// diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs index 35051c6e0..c9c14772a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs @@ -26,9 +26,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TessMode { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 /// /// Unpacks the tessellation abstract patch type. @@ -63,7 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public GpuVa Address; public int Size; @@ -71,7 +70,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Padding0; public uint Padding1; public uint Padding2; -#pragma warning restore CS0649 + } /// @@ -79,12 +78,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfState { -#pragma warning disable CS0649 // Field is never assigned to + public int BufferIndex; public int VaryingsCount; public int Stride; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -92,7 +91,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtColorState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public int WidthOrStride; public int Height; @@ -108,7 +107,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int Padding3; public int Padding4; public int Padding5; -#pragma warning restore CS0649 + } /// @@ -116,7 +115,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportTransform { -#pragma warning disable CS0649 // Field is never assigned to + public float ScaleX; public float ScaleY; public float ScaleZ; @@ -125,7 +124,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public float TranslateZ; public uint Swizzle; public uint SubpixelPrecisionBias; -#pragma warning restore CS0649 /// /// Unpacks viewport swizzle of the position X component. @@ -169,14 +167,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportExtents { -#pragma warning disable CS0649 // Field is never assigned to + public ushort X; public ushort Width; public ushort Y; public ushort Height; public float DepthNear; public float DepthFar; -#pragma warning restore CS0649 + } /// @@ -184,10 +182,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferDrawState { -#pragma warning disable CS0649 // Field is never assigned to + public int First; public int Count; -#pragma warning restore CS0649 + } /// @@ -195,12 +193,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ClearColors { -#pragma warning disable CS0649 // Field is never assigned to + public float Red; public float Green; public float Blue; public float Alpha; -#pragma warning restore CS0649 + } /// @@ -208,11 +206,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct DepthBiasState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 PointEnable; public Boolean32 LineEnable; public Boolean32 FillEnable; -#pragma warning restore CS0649 + } /// @@ -231,14 +229,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScissorState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public ushort X1; public ushort X2; public ushort Y1; public ushort Y2; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -246,11 +244,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackMasks { -#pragma warning disable CS0649 // Field is never assigned to + public int FuncRef; public int Mask; public int FuncMask; -#pragma warning restore CS0649 + } /// @@ -258,12 +256,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtDepthStencilState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public ZetaFormat Format; public MemoryLayout MemoryLayout; public int LayerSize; -#pragma warning restore CS0649 + } /// @@ -271,12 +269,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScreenScissorState { -#pragma warning disable CS0649 // Field is never assigned to + public ushort X; public ushort Width; public ushort Y; public ushort Height; -#pragma warning restore CS0649 + } /// @@ -319,9 +317,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexAttribState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Attribute; -#pragma warning restore CS0649 /// /// Unpacks the index of the vertex buffer this attribute belongs to. @@ -383,9 +380,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtControl { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 /// /// Unpacks the number of active draw buffers. @@ -412,7 +408,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct Size3D { -#pragma warning disable CS0649 // Field is never assigned to + public int Width; public int Height; public ushort Depth; @@ -422,7 +418,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { return (Flags & 1) == 0; } -#pragma warning restore CS0649 } /// @@ -430,7 +425,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilTestState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public StencilOp FrontSFail; public StencilOp FrontDpFail; @@ -439,7 +434,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int FrontFuncRef; public int FrontFuncMask; public int FrontMask; -#pragma warning restore CS0649 + } /// @@ -457,12 +452,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RgbHalf { -#pragma warning disable CS0649 // Field is never assigned to + public uint R; public uint G; public uint B; public uint Padding; -#pragma warning restore CS0649 /// /// Unpacks the red color component as a 16-bit float value. @@ -512,10 +506,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PoolState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public int MaximumId; -#pragma warning restore CS0649 + } /// @@ -523,13 +517,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackTestState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 TwoSided; public StencilOp BackSFail; public StencilOp BackDpFail; public StencilOp BackDpPass; public CompareOp BackFunc; -#pragma warning restore CS0649 + } /// @@ -537,10 +531,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PrimitiveRestartState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public int Index; -#pragma warning restore CS0649 + } /// @@ -549,12 +543,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct IndexBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public GpuVa EndAddress; public IndexType Type; public int First; -#pragma warning restore CS0649 + } /// @@ -562,11 +556,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct FaceState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 CullEnable; public FrontFace FrontFace; public Face CullFace; -#pragma warning restore CS0649 + } /// @@ -584,10 +578,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct LogicalOpState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public LogicalOp LogicalOp; -#pragma warning restore CS0649 + } /// @@ -645,11 +639,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Control; public GpuVa Address; public int Divisor; -#pragma warning restore CS0649 /// /// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory. @@ -675,7 +668,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendStateCommon { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -684,7 +677,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public uint Unknown0x1354; public BlendFactor AlphaDstFactor; -#pragma warning restore CS0649 + } /// @@ -692,7 +685,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -701,7 +694,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public BlendFactor AlphaDstFactor; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -709,7 +702,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ShaderState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Control; public uint Offset; public uint Unknown0x8; @@ -726,7 +719,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Unknown0x34; public uint Unknown0x38; public uint Unknown0x3c; -#pragma warning restore CS0649 /// /// Unpacks shader enable information. @@ -744,16 +736,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct UniformBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public int Size; public GpuVa Address; public int Offset; -#pragma warning restore CS0649 + } unsafe struct ThreedClassState : IShadowState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -1052,6 +1044,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public Array4> TfVaryingLocations; public fixed uint Reserved2A00[640]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs index 2ea4709ec..2189e9d3f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs @@ -486,10 +486,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct RenderSolidPrimPoint { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetX; public uint Y; -#pragma warning restore CS0649 + } /// @@ -497,7 +497,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// unsafe struct TwodClassState : IShadowState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -811,6 +811,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public readonly bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0; public fixed uint ReservedDF0[2436]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs index 8e8afb41c..897fb5a3f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct TwodTexture { -#pragma warning disable CS0649 // Field is never assigned to + public ColorFormat Format; public Boolean32 LinearLayout; public MemoryLayout MemoryLayout; @@ -17,6 +17,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public int Width; public int Height; public GpuVa Address; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs index 404599908..1ea612bc7 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs @@ -5,10 +5,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct GpuVa { -#pragma warning disable CS0649 // Field is never assigned to + public uint High; public uint Low; -#pragma warning restore CS0649 /// /// Packs the split address into a 64-bits address value. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs index 9af5e6103..d243227e7 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs @@ -5,9 +5,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct MemoryLayout { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 public readonly int UnpackGobBlocksInX() { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs index e1cc8c01d..f90eca1ef 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs @@ -5,12 +5,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct SbDescriptor { -#pragma warning disable CS0649 // Field is never assigned to + public uint AddressLow; public uint AddressHigh; public int Size; public int Padding; -#pragma warning restore CS0649 public readonly ulong PackAddress() { diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs index d0b8277da..979ae226a 100644 --- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -98,7 +98,6 @@ namespace Ryujinx.Graphics.Gpu /// internal DirtyHacks DirtyHacks { get; } - /// /// Host hardware capabilities. /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs index ee217714c..66f4d4de1 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs @@ -1,6 +1,5 @@ using Ryujinx.Graphics.GAL; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Gpu.Image { @@ -555,7 +554,6 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Uscaled, Format.R10G10B10A2Uscaled }, { VertexAttributeFormat.A2B10G10R10Sscaled, Format.R10G10B10A2Sscaled }, }; -#pragma warning restore IDE0055 // Note: Some of those formats have been changed and requires conversion on the shader, // as GPUs don't support them when used as buffer texture format. @@ -640,6 +638,7 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Sint, (Format.R10G10B10A2Uint, 4) }, // Sint -> Uint { VertexAttributeFormat.A2B10G10R10Uscaled, (Format.R10G10B10A2Uint, 4) }, // Uscaled -> Uint { VertexAttributeFormat.A2B10G10R10Sscaled, (Format.R10G10B10A2Sint, 4) } // Sscaled -> Sint +#pragma warning restore IDE0055 }; /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs index cd97d68dd..cfc07a19a 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs @@ -53,7 +53,6 @@ namespace Ryujinx.Graphics.Gpu.Image private const float Frac8ToF32 = 1.0f / 256.0f; -#pragma warning disable CS0649 // Field is never assigned to public uint Word0; public uint Word1; public uint Word2; @@ -62,7 +61,6 @@ namespace Ryujinx.Graphics.Gpu.Image public float BorderColorG; public float BorderColorB; public float BorderColorA; -#pragma warning restore CS0649 /// /// Unpacks the texture wrap mode along the X axis. diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs index c82a555ee..c6fde8d66 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// struct TextureDescriptor : ITextureDescriptor, IEquatable { -#pragma warning disable CS0649 // Field is never assigned to + public uint Word0; public uint Word1; public uint Word2; @@ -18,7 +18,6 @@ namespace Ryujinx.Graphics.Gpu.Image public uint Word5; public uint Word6; public uint Word7; -#pragma warning restore CS0649 /// /// Unpacks Maxwell texture format integer. diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs index 32d92223f..fb1725532 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs @@ -9,14 +9,13 @@ namespace Ryujinx.Graphics.Gpu.Shader /// struct ShaderAddresses : IEquatable { -#pragma warning disable CS0649 // Field is never assigned to + public ulong VertexA; public ulong VertexB; public ulong TessControl; public ulong TessEvaluation; public ulong Geometry; public ulong Fragment; -#pragma warning restore CS0649 /// /// Check if the addresses are equal. diff --git a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs index 28f5d24b0..f2abaf0c4 100644 --- a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct Host1xClassRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public uint IncrSyncpt; public uint IncrSyncptCntrl; public uint IncrSyncptError; @@ -38,6 +38,6 @@ namespace Ryujinx.Graphics.Host1x public uint Xrefctrl; public uint ChannelXrefHi; public uint ChannelXrefLo; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs index bb7534d8a..93a35d6ca 100644 --- a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct ThiRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public uint IncrSyncpt; public uint Reserved4; public uint IncrSyncptErr; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Host1x public Array12 Reserved48; public uint IntStatus; public uint IntMask; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs index 098622b2a..5cdeb56d4 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint Profiles; public unsafe byte* WrapperName; public nint ChLayouts; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs index 256ccd0a8..bb67291d9 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec501 { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -18,6 +18,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public unsafe nint PrivClass; public nint Profiles; public unsafe byte* WrapperName; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs index 96c1a0f67..c7b6e4582 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodecContext { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe nint AvClass; public int LogLevelOffset; public int CodecType; @@ -165,6 +165,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long MaxSamples; public int ExportSideData; public nint GetEncodeBuffer; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs index 46b1e06a7..412810c47 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVFrame { -#pragma warning disable CS0649 // Field is never assigned to + public Array8 Data; public Array8 LineSize; public nint ExtendedData; @@ -29,7 +29,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long ReorderedOpaque; public int SampleRate; public ulong ChannelLayout; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs index 8df4e26a7..bde283c3c 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVPacket { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe AVBufferRef* Buf; public long Pts; public long Dts; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public AVBufferRef Opaque; public unsafe AVBufferRef* OpaqueRef; public AVRational TimeBase; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs index 09bcc9c31..29eedfdd1 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodec where T : struct { -#pragma warning disable CS0649 // Field is never assigned to + public T Base; public int CapsInternalOrCbType; public int PrivDataSize; @@ -12,7 +12,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint InitStaticData; public nint Init; public nint CodecCallback; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs index ee0db4730..b9e345bc9 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodecLegacy where T : struct { -#pragma warning disable CS0649 // Field is never assigned to + public T Base; public uint CapsInternalOrCbType; public int PrivDataSize; @@ -14,7 +14,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint EncodeSub; public nint Encode2; public nint Decode; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs index 546213215..a565f50f8 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs @@ -6,10 +6,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types // passed it can be loaded into vector registers. internal struct LoopFilterThresh { -#pragma warning disable CS0649 // Field is never assigned to + public Array16 Mblim; public Array16 Lim; public Array16 HevThr; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs index bc325715a..77b5ccd46 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public Array64 Reserved0; public uint Nop; public Array63 Reserved104; @@ -58,6 +58,6 @@ namespace Ryujinx.Graphics.Nvdec public uint Vp9SetColMvWriteBufOffset; public uint Vp9SetColMvReadBufOffset; public uint Vp9SetFilterBufferOffset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs index 1d6b4a60d..68a1a553e 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecStatus { -#pragma warning disable CS0649 // Field is never assigned to + public uint MbsCorrectlyDecoded; public uint MbsInError; public uint Reserved; public uint ErrorStatus; public FrameStats Stats; public uint SliceHeaderErrorCode; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs index 26ba2ea69..08df2f83e 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs @@ -1,13 +1,14 @@ using Ryujinx.Common.Memory; using Ryujinx.Graphics.Video; +using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Nvdec.Types.H264 { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PictureInfo { -#pragma warning disable IDE0051, CS0169, CS0649 // Remove unused private member Array18 Unknown0; -#pragma warning restore IDE0051 + public uint BitstreamSize; public uint NumSlices; public uint Unknown50; @@ -49,7 +50,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 public Array16 MvcextViewRefMasksL1; public uint Flags2; public Array10 Unknown2D4; -#pragma warning restore CS0169, CS0649 public readonly bool MbAdaptiveFrameFieldFlag => (Flags & (1 << 0)) != 0; public readonly bool Direct8x8InferenceFlag => (Flags & (1 << 1)) != 0; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs index c310abd67..2411e03b1 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs @@ -4,11 +4,10 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 { struct ReferenceFrame { -#pragma warning disable CS0649 // Field is never assigned to + public uint Flags; public Array2 FieldOrderCnt; public uint FrameNum; -#pragma warning restore CS0649 public readonly uint OutputSurfaceIndex => (uint)Flags & 0x7f; } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs index a495cfc89..c6c8a1fc1 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 { struct PictureInfo { -#pragma warning disable CS0649 // Field is never assigned to + public Array13 Unknown0; public uint GpTimerTimeoutValue; public ushort FrameWidth; @@ -58,7 +58,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 public uint ResultValue; // ucode return result public Array8 PartitionOffset; public Array3 Reserved4; -#pragma warning restore CS0649 public Vp8PictureInfo Convert() { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs index 82a09866a..9a147922a 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct EntropyProbs { -#pragma warning disable CS0649 // Field is never assigned to + public Array10>> KfYModeProbE0ToE7; public Array10> KfYModeProbE8; public Array3 Padding384; @@ -42,7 +42,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public Array5 CompRefProb; public Array17 Padding58F; public Array4>>>>> CoefProbs; -#pragma warning restore CS0649 public void Convert(ref Vp9EntropyProbs fc) { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs index d41c7da13..28db92d5c 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameSize { -#pragma warning disable CS0649 // Field is never assigned to + public ushort Width; public ushort Height; public ushort LumaPitch; public ushort ChromaPitch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs index 47f17e4ed..f8df2c6ea 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameStats { -#pragma warning disable CS0649 // Field is never assigned to + public uint Unknown0; public uint Unknown4; public uint Pass2CycleCount; @@ -16,6 +16,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint FrameStatusBwdMvyCnt; public uint ErrorCtbPos; public uint ErrorSlicePos; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs index 139bd87b4..8ea31b0bb 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct LoopFilter { -#pragma warning disable CS0649 // Field is never assigned to + public byte ModeRefDeltaEnabled; public Array4 RefDeltas; public Array2 ModeDeltas; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs index 9da64bfab..eec6adb9c 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct PictureInfo { -#pragma warning disable CS0649 // Field is never assigned to + public Array12 Unknown0; public uint BitstreamSize; public uint IsEncrypted; @@ -42,7 +42,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint UnknownF4; public uint UnknownF8; public uint UnknownFC; -#pragma warning restore CS0649 public readonly uint BitDepth => (SurfaceParams >> 1) & 0xf; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs index 098becc28..a6d5c9232 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct Segmentation { -#pragma warning disable CS0649 // Field is never assigned to + public byte Enabled; public byte UpdateMap; public byte TemporalUpdate; public byte AbsDelta; public Array8 FeatureMask; public Array8> FeatureData; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs index bca79cb97..e3566b43f 100644 --- a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs +++ b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.OpenGL _table = new FormatInfo[tableSize]; _tableImage = new SizedInternalFormat[tableSize]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, new FormatInfo(1, true, false, All.R8, PixelFormat.Red, PixelType.UnsignedByte)); Add(Format.R8Snorm, new FormatInfo(1, true, false, All.R8Snorm, PixelFormat.Red, PixelType.Byte)); Add(Format.R8Uint, new FormatInfo(1, false, false, All.R8ui, PixelFormat.RedInteger, PixelType.UnsignedByte)); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs index 4b28f3878..9eae052cd 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { _infoTable = new InstInfo[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Instruction.AtomicAdd, InstType.AtomicBinary, "atomicAdd"); Add(Instruction.AtomicAnd, InstType.AtomicBinary, "atomicAnd"); Add(Instruction.AtomicCompareAndSwap, InstType.AtomicTernary, "atomicCompSwap"); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs index 43ff12168..217c6ae73 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs index 4fe214778..887d9d669 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs @@ -5,11 +5,10 @@ using Spv.Generator; using System; using System.Collections.Generic; using Instruction = Spv.Generator.Instruction; +using IrOperandType = Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandType; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using IrOperandType = IntermediateRepresentation.OperandType; - partial class CodeGenContext : Module { private const uint SpirvVersionMajor = 1; diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 27b5c21c0..fb290c48c 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -6,12 +6,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using static Spv.Specification; +using SpvInstruction = Spv.Generator.Instruction; +using SpvLiteralInteger = Spv.Generator.LiteralInteger; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using SpvInstruction = Spv.Generator.Instruction; - using SpvLiteralInteger = Spv.Generator.LiteralInteger; - static class Instructions { private const MemorySemanticsMask DefaultMemorySemantics = @@ -27,7 +26,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { _instTable = new Func[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Instruction.Absolute, GenerateAbsolute); Add(Instruction.Add, GenerateAdd); Add(Instruction.AtomicAdd, GenerateAtomicAdd); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs index e1561446b..8eadf9d4d 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs @@ -6,14 +6,13 @@ using System; using System.Collections.Generic; using System.Threading; using static Spv.Specification; +using SpvInstruction = Spv.Generator.Instruction; +using SpvInstructionPool = Spv.Generator.GeneratorPool; +using SpvLiteralInteger = Spv.Generator.LiteralInteger; +using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using SpvInstruction = Spv.Generator.Instruction; - using SpvInstructionPool = Spv.Generator.GeneratorPool; - using SpvLiteralInteger = Spv.Generator.LiteralInteger; - using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; - static class SpirvGenerator { // Resource pools for Spirv generation. Note: Increase count when more threads are being used. diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs index 8bf5671ac..303fd0830 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs @@ -3664,9 +3664,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstLepc { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstLepc(ulong opcode) => _opcode = opcode; } @@ -4181,9 +4181,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRam { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstRam(ulong opcode) => _opcode = opcode; } @@ -4252,9 +4252,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRtt { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstRtt(ulong opcode) => _opcode = opcode; } @@ -4270,9 +4270,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstSam { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstSam(ulong opcode) => _opcode = opcode; } diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs index 35367b8df..d3eca6535 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Shader.Decoders _opCodes = new TableEntry[1 << EncodingBits]; #region Instructions -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add("1110111110100xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Al2p, InstEmit.Al2p, InstProps.Rd | InstProps.Ra); Add("1110111111011xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ald, InstEmit.Ald, InstProps.Rd | InstProps.Ra); Add("1110111111110xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ast, InstEmit.Ast, InstProps.Ra | InstProps.Rb2 | InstProps.Rc); diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs index 8061aec28..1b7997113 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs @@ -22,9 +22,7 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Depbar(EmitterContext context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - InstDepbar op = context.GetOp(); -#pragma warning restore IDE0059 + _ = context.GetOp(); // No operation. } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs index 2f3988119..581111c42 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs @@ -510,9 +510,8 @@ namespace Ryujinx.Graphics.Shader.Instructions aLow = context.BitwiseNot(aLow); aHigh = context.BitwiseNot(aHigh); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - aLow = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); -#pragma warning restore IDE0059 + _ = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); + aHigh = context.IAdd(aHigh, aLowCOut); } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs index c97e53bfe..c2c7626d2 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs @@ -219,9 +219,8 @@ namespace Ryujinx.Graphics.Shader.Instructions else { res = context.ISubtract(srcA, srcB); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - res = context.IAdd(res, context.BitwiseNot(GetCF())); -#pragma warning restore IDE0059 + + _ = context.IAdd(res, context.BitwiseNot(GetCF())); switch (cond) { diff --git a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs index 61e6ecf5a..3b0e38542 100644 --- a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs +++ b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { diff --git a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs index b2ddf6ab7..f7449671f 100644 --- a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs +++ b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { _infoTbl = new InstInfo[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting // Inst Destination type Source 1 type Source 2 type Source 3 type Source 4 type Add(Instruction.AtomicAdd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); Add(Instruction.AtomicAnd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); diff --git a/src/Ryujinx.Graphics.Shader/TextureFormat.cs b/src/Ryujinx.Graphics.Shader/TextureFormat.cs index 619598c7f..e8c164648 100644 --- a/src/Ryujinx.Graphics.Shader/TextureFormat.cs +++ b/src/Ryujinx.Graphics.Shader/TextureFormat.cs @@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Shader { return format switch { -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting TextureFormat.R8Unorm => "r8", TextureFormat.R8Snorm => "r8_snorm", TextureFormat.R8Uint => "r8ui", diff --git a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs index 496fbc235..85d58bb0a 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.Translation { diff --git a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index 94448626f..ead428986 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblVertexInBounds, isVertexOob); this.Return(); - this.MarkLabel(lblVertexInBounds); + MarkLabel(lblVertexInBounds); Operand outputInstanceOffset = this.Load(StorageKind.Input, IoVariable.GlobalId, Const(1)); Operand instanceCount = this.Load(StorageKind.ConstantBuffer, vertexInfoCbBinding, Const((int)VertexInfoBufferField.VertexCounts), Const(1)); @@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblInstanceInBounds, isInstanceOob); this.Return(); - this.MarkLabel(lblInstanceInBounds); + MarkLabel(lblInstanceInBounds); if (TranslatorContext.Stage == ShaderStage.Vertex) { @@ -469,7 +469,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(alphaPassLabel, alphaPass); this.Discard(); - this.MarkLabel(alphaPassLabel); + MarkLabel(alphaPassLabel); } } @@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Shader.Translation Operand lblLoopHead = Label(); Operand lblExit = Label(); - this.MarkLabel(lblLoopHead); + MarkLabel(lblLoopHead); Operand writtenIndices = this.Load(StorageKind.LocalMemory, ResourceManager.LocalGeometryOutputIndexCountMemoryId); @@ -581,7 +581,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.Branch(lblLoopHead); - this.MarkLabel(lblExit); + MarkLabel(lblExit); } } @@ -617,7 +617,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(a2cDitherEndLabel, opaque); this.Discard(); - this.MarkLabel(a2cDitherEndLabel); + MarkLabel(a2cDitherEndLabel); } public Operation[] GetOperations() diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs index b16cb0026..4d84f9b28 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Texture.Astc { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AstcPixel { internal const int StructSize = 12; diff --git a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs index 4402df7e5..da14faa2b 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs @@ -1,14 +1,12 @@ using Ryujinx.Common.Utilities; -using System; using System.Diagnostics; +using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.Texture.Astc { public struct BitStream128 { -#pragma warning disable IDE0044 // Make field readonly private Buffer16 _data; -#pragma warning restore IDE0044 public int BitsLeft { get; set; } public BitStream128(Buffer16 data) @@ -27,13 +25,11 @@ namespace Ryujinx.Graphics.Texture.Astc } int mask = (1 << bitCount) - 1; - int value = _data.As() & mask; + int value = Unsafe.As(ref _data) & mask; - Span span = _data.AsSpan(); - - ulong carry = span[1] << (64 - bitCount); - span[0] = (span[0] >> bitCount) | carry; - span[1] >>= bitCount; + ulong carry = _data.High << (64 - bitCount); + _data.Low = (_data.Low >> bitCount) | carry; + _data.High >>= bitCount; BitsLeft -= bitCount; @@ -51,23 +47,21 @@ namespace Ryujinx.Graphics.Texture.Astc ulong maskedValue = (uint)(value & ((1 << bitCount) - 1)); - Span span = _data.AsSpan(); - if (BitsLeft < 64) { ulong lowMask = maskedValue << BitsLeft; - span[0] |= lowMask; + _data.Low |= lowMask; } if (BitsLeft + bitCount > 64) { if (BitsLeft > 64) { - span[1] |= maskedValue << (BitsLeft - 64); + _data.High |= maskedValue << (BitsLeft - 64); } else { - span[1] |= maskedValue >> (64 - BitsLeft); + _data.High |= maskedValue >> (64 - BitsLeft); } } diff --git a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs index 2e78f5d4d..5ef33280b 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct ClearRectStruct { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public int ClearRect0Left => (int)_word0.Extract(0, 14); public int ClearRect0Right => (int)_word0.Extract(16, 14); diff --git a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs index 2496a62e9..7e31125cc 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Vic.Types { struct ConfigStruct { -#pragma warning disable CS0649 // Field is never assigned to + public PipeConfig PipeConfig; public OutputConfig OutputConfig; public OutputSurfaceConfig OutputSurfaceConfig; public MatrixStruct OutColorMatrix; public Array4 ClearRectStruct; public Array8 SlotStruct; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs index 3ce6c93c5..7b4ead1f0 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputConfig { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public int AlphaFillMode => (int)_word0.Extract(0, 3); public int AlphaFillSlot => (int)_word0.Extract(3, 3); diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs index e72a6a125..e1ac6a091 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputSurfaceConfig { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public PixelFormat OutPixelFormat => (PixelFormat)_word0.Extract(0, 7); public int OutChromaLocHoriz => (int)_word0.Extract(7, 2); diff --git a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs index 1e0a7e641..c4b1c5fe9 100644 --- a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs @@ -1,13 +1,13 @@ using Ryujinx.Common.Utilities; +using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vic.Types { + [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct PipeConfig { -#pragma warning disable CS0169, CS0649, IDE0051 // Remove unused private member private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0169, CS0649, IDE0051 public int DownsampleHoriz => (int)_word0.Extract(0, 11); public int DownsampleVert => (int)_word0.Extract(16, 11); diff --git a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs index 148d06815..921217b16 100644 --- a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs @@ -11,9 +11,8 @@ namespace Ryujinx.Graphics.Vic.Types private readonly long _word4; private readonly long _word5; private readonly long _word6; -#pragma warning disable IDE0051 // Remove unused private member + private readonly long _word7; -#pragma warning restore IDE0051 public bool SlotEnable => _word0.Extract(0); public bool DeNoise => _word0.Extract(1); diff --git a/src/Ryujinx.Graphics.Vic/VicRegisters.cs b/src/Ryujinx.Graphics.Vic/VicRegisters.cs index 7ebc10d9a..0f481fb9d 100644 --- a/src/Ryujinx.Graphics.Vic/VicRegisters.cs +++ b/src/Ryujinx.Graphics.Vic/VicRegisters.cs @@ -4,16 +4,16 @@ namespace Ryujinx.Graphics.Vic { struct PlaneOffsets { -#pragma warning disable CS0649 // Field is never assigned to + public uint LumaOffset; public uint ChromaUOffset; public uint ChromaVOffset; -#pragma warning restore CS0649 + } struct VicRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public Array64 Reserved0; public uint Nop; public Array15 Reserved104; @@ -46,6 +46,6 @@ namespace Ryujinx.Graphics.Vic public Array8 SetSlotContextId; public Array8 SetCompTagBufferOffset; public Array8 SetHistoryBufferOffset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs index 1e54e8ece..fcd649aac 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs @@ -607,7 +607,7 @@ namespace Ryujinx.Graphics.Vulkan srcHolder.SetDataUnchecked(0, data); Auto srcBuffer = srcHolder.GetBuffer(); - Auto dstBuffer = this.GetBuffer(cbs.Value.CommandBuffer, true); + Auto dstBuffer = GetBuffer(cbs.Value.CommandBuffer, true); Copy(_gd, cbs.Value, srcBuffer, dstBuffer, 0, offset, dataSize); diff --git a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs index 305224cad..d5b0b5be2 100644 --- a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs +++ b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vulkan _table = new VkFormat[Enum.GetNames().Length]; _reverseMap = new Dictionary(); -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, VkFormat.R8Unorm); Add(Format.R8Snorm, VkFormat.R8SNorm); Add(Format.R8Uint, VkFormat.R8Uint); diff --git a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs index 695046198..2c0485b09 100644 --- a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -886,7 +886,7 @@ namespace Ryujinx.Graphics.Vulkan int primitiveCount = pattern.GetPrimitiveCount(indexCount); int convertedCount = pattern.GetConvertedCount(indexCount); int outputIndexSize = 4; - + Buffer dstBuffer = dstIndexBuffer.GetBuffer().Get(cbs, 0, convertedCount * outputIndexSize).Value; const int ParamsBufferSize = 16 * sizeof(int); diff --git a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs index 9054b2e71..852634513 100644 --- a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs +++ b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs @@ -1,6 +1,5 @@ using Ryujinx.Graphics.GAL; using System; -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vulkan diff --git a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs index 271999375..c0cf219b9 100644 --- a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs +++ b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs @@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK public static implicit operator Bool32(bool val) => new(val); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct MVKConfiguration { public Bool32 DebugMode; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index eac47e60e..8a498c203 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -701,7 +701,9 @@ namespace Ryujinx.Graphics.Vulkan _vertexBufferUpdater.Commit(Cbs); } +#pragma warning disable CA1822 // Mark members as static public void SetAlphaTest(bool enable, float reference, CompareOp op) +#pragma warning restore CA1822 // Mark members as static { // This is currently handled using shader specialization, as Vulkan does not support alpha test. // In the future, we may want to use this to write the reference value into the support buffer, @@ -900,6 +902,7 @@ namespace Ryujinx.Graphics.Vulkan // TODO: Default levels (likely needs emulation on shaders?) } +#pragma warning disable CA1822 // Mark members as static public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) { // TODO. @@ -909,6 +912,7 @@ namespace Ryujinx.Graphics.Vulkan { // TODO. } +#pragma warning restore CA1822 // Mark members as static public void SetPrimitiveRestart(bool enable, int index) { @@ -1153,10 +1157,12 @@ namespace Ryujinx.Graphics.Vulkan _descriptorSetUpdater.SetUniformBuffers(CommandBuffer, buffers); } +#pragma warning disable CA1822 // Mark members as static public void SetUserClipDistance(int index, bool enableClip) { // TODO. } +#pragma warning restore CA1822 // Mark members as static public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs index b066da8e8..ce7925b97 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgHeader { @@ -14,5 +14,4 @@ namespace Ryujinx.HLE.HOS.Applets public byte EnableSingleMode; public byte EnableIdentificationColor; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs index d5a18d468..e55de105d 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs @@ -1,6 +1,6 @@ namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + struct ControllerSupportArgPrivate { public uint PrivateSize; @@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets public uint NpadStyleSet; public uint NpadJoyHoldType; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs index 0969493fa..9f303dac6 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + // (8.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgV7 @@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81); } } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs index 886782553..78717075e 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + // (1.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgVPre7 @@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81); } } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs index 96cfd5903..315e7b263 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportResultInfo { @@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets public uint SelectedId; public uint Result; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs index 4c54b4666..eb8e1c781 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error { return systemLanguage switch { -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting SystemLanguage.Japanese => "ja", SystemLanguage.AmericanEnglish => "en-US", SystemLanguage.French => "fr", diff --git a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs index 69bff74a5..4624891e2 100644 --- a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs @@ -12,9 +12,8 @@ namespace Ryujinx.HLE.HOS.Applets private readonly Horizon _system; private AppletSession _normalSession; -#pragma warning disable IDE0052 // Remove unread private member + private AppletSession _interactiveSession; -#pragma warning restore IDE0052 public event EventHandler AppletStateChanged; diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs index 58871a069..808fa605d 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs @@ -43,11 +43,11 @@ namespace Ryujinx.HLE.HOS.Applets private SoftwareKeyboardConfig _keyboardForegroundConfig; // Configuration for background (inline) mode. -#pragma warning disable IDE0052 // Remove unread private member + private SoftwareKeyboardInitialize _keyboardBackgroundInitialize; private SoftwareKeyboardCustomizeDic _keyboardBackgroundDic; private SoftwareKeyboardDictSet _keyboardBackgroundDictSet; -#pragma warning restore IDE0052 + private SoftwareKeyboardUserWord[] _keyboardBackgroundUserWords; private byte[] _transferMemory; diff --git a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs index 30c838ca0..f8f30c188 100644 --- a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs +++ b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs @@ -6,9 +6,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast { // TODO: Compute inside the Demangler public BaseNode Reference; -#pragma warning disable IDE0052 // Remove unread private member + private readonly int _index; -#pragma warning restore IDE0052 public ForwardTemplateReference(int index) : base(NodeType.ForwardTemplateReference) { diff --git a/src/Ryujinx.HLE/HOS/Horizon.cs b/src/Ryujinx.HLE/HOS/Horizon.cs index 5063b4329..878750f0b 100644 --- a/src/Ryujinx.HLE/HOS/Horizon.cs +++ b/src/Ryujinx.HLE/HOS/Horizon.cs @@ -36,11 +36,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager; namespace Ryujinx.HLE.HOS { - using TimeServiceManager = Services.Time.TimeManager; - public class Horizon : IDisposable { internal const int HidSize = 0x40000; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs index 1ff37282f..1b37e1fce 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs @@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightClientSession : KAutoObject { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KLightSession _parent; -#pragma warning restore IDE0052 public KLightClientSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs index c355409ec..c1eecae26 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs @@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightServerSession : KAutoObject { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KLightSession _parent; -#pragma warning restore IDE0052 public KLightServerSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs index 84ebcbc3e..cfaa111e3 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs @@ -8,9 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc public KServerPort ServerPort { get; } public KClientPort ClientPort { get; } -#pragma warning disable IDE0052 // Remove unread private member private readonly string _name; -#pragma warning restore IDE0052 private readonly ChannelState _state; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs index 58d79c31f..b6b55bc5a 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs @@ -86,11 +86,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30]; -#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _heapAddress; private readonly ulong _heapSize; private ulong _usedSize; -#pragma warning restore IDE0052 + private readonly int _blocksCount; private readonly Block[] _blocks; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs index 6ca54355e..e748378ed 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.HLE.HOS.Kernel.Process { diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs index beec621bf..4a5762747 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs @@ -1,7 +1,9 @@ using Ryujinx.HLE.HOS.Kernel.Memory; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { + [StructLayout(LayoutKind.Sequential, Pack = 4)] struct MemoryInfo { public ulong Address; @@ -11,9 +13,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public KMemoryPermission Permission; public int IpcRefCount; public int DeviceRefCount; -#pragma warning disable CS0414, IDE0052 // Remove unread private member private readonly int _padding; -#pragma warning restore CS0414, IDE0052 public MemoryInfo( ulong address, diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index c67220617..76a8ed78c 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x5f)] - public Result FlushProcessDataCache(int processHandle, ulong address, ulong size) + public static Result FlushProcessDataCache(int processHandle, ulong address, ulong size) { // FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0. // As we don't support (and don't actually need) to flush the cache, this is stubbed. @@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x22)] - public Result SendSyncRequestWithUserBuffer( + public static Result SendSyncRequestWithUserBuffer( [PointerSized] ulong messagePtr, [PointerSized] ulong messageSize, int handle) @@ -901,7 +901,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(2)] - public Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -934,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(3)] - public Result SetMemoryAttribute( + public static Result SetMemoryAttribute( [PointerSized] ulong address, [PointerSized] ulong size, MemoryAttribute attributeMask, @@ -983,7 +983,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(4)] - public Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1020,7 +1020,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(5)] - public Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1057,7 +1057,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(6)] - public Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) + public static Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) { Result result = QueryMemory(out MemoryInfo info, out pageInfo, address); @@ -1092,7 +1092,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x13)] - public Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1139,7 +1139,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x14)] - public Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1244,7 +1244,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x51)] - public Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1291,7 +1291,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x52)] - public Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1332,7 +1332,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2c)] - public Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1368,7 +1368,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2d)] - public Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1445,7 +1445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x4c)] - public Result ControlCodeMemory( + public static Result ControlCodeMemory( int handle, CodeMemoryOperation op, ulong address, @@ -1524,7 +1524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x73)] - public Result SetProcessMemoryPermission( + public static Result SetProcessMemoryPermission( int handle, ulong src, ulong size, @@ -1566,7 +1566,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x74)] - public Result MapProcessMemory( + public static Result MapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1623,7 +1623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x75)] - public Result UnmapProcessMemory( + public static Result UnmapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1669,7 +1669,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x77)] - public Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1707,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x78)] - public Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1752,7 +1752,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall // System [Svc(0x7b)] - public Result TerminateProcess(int handle) + public static Result TerminateProcess(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -1782,7 +1782,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(7)] - public void ExitProcess() + public static void ExitProcess() { KernelStatic.GetCurrentProcess().TerminateCurrentProcess(); } @@ -1878,7 +1878,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x26)] - public void Break(ulong reason) + public static void Break(ulong reason) { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -1905,7 +1905,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x27)] - public void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) + public static void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2371,7 +2371,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x30)] - public Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2393,7 +2393,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x31)] - public Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2415,7 +2415,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x37)] - public Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) + public static Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) { peak = 0; @@ -2447,7 +2447,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x7e)] - public Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) + public static Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) { if (resource >= LimitableResource.Count) { @@ -2542,7 +2542,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(9)] - public Result StartThread(int handle) + public static Result StartThread(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2570,7 +2570,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xa)] - public void ExitThread() + public static void ExitThread() { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2602,7 +2602,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xc)] - public Result GetThreadPriority(out int priority, int handle) + public static Result GetThreadPriority(out int priority, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2623,7 +2623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xd)] - public Result SetThreadPriority(int handle, int priority) + public static Result SetThreadPriority(int handle, int priority) { // TODO: NPDM check. @@ -2642,7 +2642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xe)] - public Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) + public static Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2665,7 +2665,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xf)] - public Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) + public static Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -2714,13 +2714,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x10)] - public int GetCurrentProcessorNumber() + public static int GetCurrentProcessorNumber() { return KernelStatic.GetCurrentThread().CurrentCore; } [Svc(0x25)] - public Result GetThreadId(out ulong threadUid, int handle) + public static Result GetThreadId(out ulong threadUid, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2741,7 +2741,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x32)] - public Result SetThreadActivity(int handle, bool pause) + public static Result SetThreadActivity(int handle, bool pause) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2766,7 +2766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x33)] - public Result GetThreadContext3([PointerSized] ulong address, int handle) + public static Result GetThreadContext3([PointerSized] ulong address, int handle) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2931,7 +2931,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1a)] - public Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) + public static Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2949,7 +2949,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1b)] - public Result ArbitrateUnlock([PointerSized] ulong mutexAddress) + public static Result ArbitrateUnlock([PointerSized] ulong mutexAddress) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2967,7 +2967,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1c)] - public Result WaitProcessWideKeyAtomic( + public static Result WaitProcessWideKeyAtomic( [PointerSized] ulong mutexAddress, [PointerSized] ulong condVarAddress, int handle, @@ -2998,7 +2998,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1d)] - public Result SignalProcessWideKey([PointerSized] ulong address, int count) + public static Result SignalProcessWideKey([PointerSized] ulong address, int count) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -3008,7 +3008,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x34)] - public Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) + public static Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) { if (IsPointingInsideKernel(address)) { @@ -3040,7 +3040,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x35)] - public Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) + public static Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) { if (IsPointingInsideKernel(address)) { @@ -3067,7 +3067,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x36)] - public Result SynchronizePreemptionState() + public static Result SynchronizePreemptionState() { KernelStatic.GetCurrentThread().SynchronizePreemptionState(); diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs index cca6dda0f..9998c9209 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs @@ -1,8 +1,10 @@ using ARMeilleure.State; using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ThreadContext { public Array29 Registers; @@ -11,9 +13,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public ulong Sp; public ulong Pc; public uint Pstate; -#pragma warning disable CS0169, IDE0051 // Remove unused private member + private readonly uint _padding; -#pragma warning restore CS0169, IDE0051 + public Array32 FpuRegisters; public uint Fpcr; public uint Fpsr; diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs index 8c86788b1..534c06dd7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Security.Claims; using System.Security.Cryptography; -using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -19,9 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService // TODO: Determine where and how NetworkServiceAccountId is set. private const long NetworkServiceAccountId = 0xcafe; -#pragma warning disable IDE0052 // Remove unread private member private readonly UserId _userId; -#pragma warning restore IDE0052 private byte[] _cachedTokenData; private DateTime _cachedTokenExpiry; @@ -128,9 +125,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService public ResultCode LoadIdTokenCache(ServiceCtx context) { ulong bufferPosition = context.Request.ReceiveBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong bufferSize = context.Request.ReceiveBuff[0].Size; -#pragma warning restore IDE0059 // NOTE: This opens the file at "su/cache/USERID_IN_UUID_STRING.dat" (where USERID_IN_UUID_STRING is formatted as "%08x-%04x-%04x-%02x%02x-%08x%04x") // in the "account:/" savedata and writes some data in the buffer. @@ -156,6 +152,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService byte[] tokenData = _cachedTokenData; + if ((ulong)tokenData.Length > bufferSize) + { + return ResultCode.InvalidIdTokenCacheBufferSize; + } + context.Memory.Write(bufferPosition, tokenData); context.ResponseData.Write(tokenData.Length); diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs index a6b1a47b6..74a4ed2ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Account.Acc { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public readonly record struct UserId { public readonly long High; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs index 05a4b0a63..1e5795408 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs @@ -10,10 +10,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetExpectedMasterVolume(f32, f32) public ResultCode SetExpectedMasterVolume(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float appletVolume = context.RequestData.ReadSingle(); - float libraryAppletVolume = context.RequestData.ReadSingle(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadSingle(); // applet volume + _ = context.RequestData.ReadSingle(); // library applet volume Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -46,10 +44,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // ChangeMainAppletMasterVolume(f32, u64) public ResultCode ChangeMainAppletMasterVolume(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float unknown0 = context.RequestData.ReadSingle(); - long unknown1 = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + // Unknown parameters. + _ = context.RequestData.ReadSingle(); + _ = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -60,9 +57,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetTransparentVolumeRate(f32) public ResultCode SetTransparentVolumeRate(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float unknown0 = context.RequestData.ReadSingle(); -#pragma warning restore IDE0059 + // Unknown parameter. + _ = context.RequestData.ReadSingle(); Logger.Stub?.PrintStub(LogClass.ServiceAm); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs index ad776fe6e..c60a7fafc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs @@ -18,10 +18,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly Apm.SystemManagerServer _apmSystemManagerServer; private bool _vrModeEnabled; -#pragma warning disable CS0414, IDE0052 // Remove unread private member private bool _lcdBacklighOffEnabled; private bool _requestExitToLibraryAppletAtExecuteNextProgramEnabled; -#pragma warning restore CS0414, IDE0052 private int _messageEventHandle; private int _displayResolutionChangedEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs index 23ba99b04..dcfbde54d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs @@ -12,9 +12,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys public ResultCode CreateLibraryApplet(ServiceCtx context) { AppletId appletId = (AppletId)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int libraryAppletMode = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // libraryAppletMode MakeObject(context, new ILibraryAppletAccessor(appletId, context.Device.System)); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs index 8e0f515ba..7d7b56af7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs @@ -25,21 +25,21 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly ulong _accumulatedSuspendedTickValue = 0; // TODO: Determine where those fields are used. -#pragma warning disable IDE0052 // Remove unread private member + private bool _screenShotPermission = false; private bool _operationModeChangedNotification = false; private bool _performanceModeChangedNotification = false; private bool _restartMessageEnabled = false; private bool _outOfFocusSuspendingEnabled = false; private bool _handlesRequestToDisplay = false; -#pragma warning restore IDE0052 + private bool _autoSleepDisabled = false; -#pragma warning disable IDE0052 // Remove unread private member + private bool _albumImageTakenNotificationEnabled = false; private bool _recordVolumeMuted = false; private uint _screenShotImageOrientation = 0; -#pragma warning restore IDE0052 + private uint _idleTimeDetectionExtension = 0; public ISelfController(ServiceCtx context, ulong pid) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs index 926632531..424e9fc63 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs @@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE { try { - this.Push(item); + Push(item); return true; } @@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public bool TryTake(out T item) { - return this.TryPop(out item); + return TryPop(out item); } public T Peek() @@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void CopyTo(Array array, int index) { - this.CopyTo((T[])array, index); + CopyTo((T[])array, index); } public IEnumerator GetEnumerator() diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs index a3f44a45d..0e2d5ee07 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void Push(byte[] item) { - if (!this.TryPush(item)) + if (!TryPush(item)) { // TODO(jduncanator): Throw a proper exception throw new InvalidOperationException(); @@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public byte[] Pop() { - if (this.TryPop(out byte[] item)) + if (TryPop(out byte[] item)) { return item; } @@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE /// public AppletSession GetConsumer() { - return new AppletSession(this._outputData, this._inputData); + return new AppletSession(_outputData, _inputData); } } } diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs index 26089bddb..a901de003 100644 --- a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs +++ b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs @@ -8,9 +8,8 @@ namespace Ryujinx.HLE.HOS.Services.Arp public int Version; public byte BaseGameStorageId; public byte UpdateGameStorageId; -#pragma warning disable CS0649 // Field is never assigned to + public short Padding; -#pragma warning restore CS0649 public static ApplicationLaunchProperty Default { diff --git a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs index 8f2642695..5cbdbd368 100644 --- a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs @@ -10,9 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth [Service("btdrv")] class IBluetoothDriver : IpcService { -#pragma warning disable CS0414, IDE0052 // Remove unread private member private string _unknownLowEnergy; -#pragma warning restore CS0414, IDE0052 public IBluetoothDriver(ServiceCtx context) { } diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs index 3caea0f6c..d65203156 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs @@ -23,9 +23,8 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SetShimLibraryVersion(ServiceCtx context) { ulong shimLibraryVersion = context.RequestData.ReadUInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong appletResourceUserId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // applet Resource user id // TODO: Service checks if the pid is present in an internal list and returns ResultCode.BlacklistedPid if it is. // The list contents needs to be determined. diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs index 0723b57cc..91d363eb5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs @@ -20,15 +20,13 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SaveScreenShotEx0(ServiceCtx context) { // TODO: Use the ScreenShotAttribute. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ScreenShotAttribute screenShotAttribute = context.RequestData.ReadStruct(); + _ = context.RequestData.ReadStruct(); // screenShotAttribute + + _ = context.RequestData.ReadUInt32(); // unknown - uint unknown = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 ulong appletResourceUserId = context.RequestData.ReadUInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid ulong screenshotDataPosition = context.Request.SendBuff[0].Position; ulong screenshotDataSize = context.Request.SendBuff[0].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs index 155077745..4ea7c8294 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs @@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Fatal Logger.Info?.Print(LogClass.ServiceFatal, errorReport.ToString()); - context.Device.System.KernelContext.Syscall.Break((ulong)resultCode); + Kernel.SupervisorCall.Syscall.Break((ulong)resultCode); return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs index 08ede2b5b..8d7d3ce89 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs @@ -50,10 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs // -> object contentFs public ResultCode OpenFileSystemWithId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = (FileSystemType)context.RequestData.ReadInt32(); // fileSystemType + _ = context.RequestData.ReadUInt64(); // titleId + string switchPath = ReadUtf8String(context); string fullPath = FileSystem.VirtualFileSystem.SwitchPathToSystemPath(switchPath); @@ -793,9 +793,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs public ResultCode OpenDataStorageByDataId(ServiceCtx context) { StorageId storageId = (StorageId)context.RequestData.ReadByte(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte[] padding = context.RequestData.ReadBytes(7); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadBytes(7); // Skip 7 bytes of padding. + ulong titleId = context.RequestData.ReadUInt64(); // We do a mitm here to find if the request is for an AOC. diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs index 66b5a5cba..932848690 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs @@ -101,7 +101,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result; result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result; #pragma warning restore IDE0055 - return result; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 834bee6f0..8fa35cd43 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -254,6 +254,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid switch (type) { + #pragma warning disable IDE0055 // Disable formatting case ControllerType.ProController: controller.StyleSet = NpadStyleTag.FullKey; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs index 93f19c915..f0c2b53de 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs @@ -8,9 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer // ActivateVibrationDevice(nn::hid::VibrationDeviceHandle) public ResultCode ActivateVibrationDevice(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int vibrationDeviceHandle = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt32(); // vibrationDeviceHandle return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 0d2fcaa2a..9835e576d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid private long _npadCommunicationMode; private uint _accelerometerPlayMode; -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _vibrationGcErmCommand; -#pragma warning restore CS0649 + private float _sevenSixAxisSensorFusionStrength; private SensorFusionParameters _sensorFusionParams; @@ -64,9 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // CreateAppletResource(nn::applet::AppletResourceUserId) -> object public ResultCode CreateAppletResource(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem)); @@ -735,9 +733,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag public ResultCode GetSupportedNpadStyleSet(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets); @@ -751,9 +746,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array) public ResultCode SetSupportedNpadIdType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId + ulong arrayPosition = context.Request.PtrBuff[0].Position; ulong arraySize = context.Request.PtrBuff[0].Size; @@ -904,9 +898,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType) public ResultCode SetNpadJoyHoldType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64(); @@ -932,9 +924,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType public ResultCode GetNpadJoyHoldType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers()) { @@ -955,9 +945,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // appletResourceUserId if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -990,9 +979,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // appletResourceUserId if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -1231,9 +1219,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid FrequencyHigh = context.RequestData.ReadSingle(), }; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId Dictionary dualVibrationValues = new() { @@ -1257,9 +1243,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid Reserved = context.RequestData.ReadByte(), }; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position); @@ -1304,9 +1288,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationValues(nn::applet::AppletResourceUserId, buffer, type: 9>, buffer, type: 9>) public ResultCode SendVibrationValues(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size]; @@ -1396,10 +1378,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) public ResultCode IsVibrationDeviceMounted(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int vibrationDeviceHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt32(); // VibrationDeviceHandle + _ = context.RequestData.ReadInt64(); // appletResourceUserId // NOTE: Service use vibrationDeviceHandle to get the PlayerIndex. // And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs index 8e061351e..0bb8c6c9c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Hid { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BusHandle { public int AbstractedPadId; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index 99f2f59e4..df5e72624 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -1,20 +1,18 @@ using Ryujinx.Common.Memory; using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Threading; namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RingLifo where T : unmanaged, ISampledDataStruct { private const ulong MaxEntries = 17; -#pragma warning disable IDE0051, CS0169 // Remove unused private member private readonly ulong _unused; -#pragma warning restore IDE0051, CS0169 -#pragma warning disable CS0414, IDE0052 // Remove unread private member private ulong _bufferCount; -#pragma warning restore CS0414, IDE0052 private ulong _index; private ulong _count; private Array17> _storage; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs index 41e841342..26e2e2372 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs @@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NpadGcTriggerState : ISampledDataStruct { -#pragma warning disable CS0649 // Field is never assigned to + public ulong SamplingNumber; public uint TriggerL; public uint TriggerR; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs index f79a2657e..f57f79aaf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs @@ -23,9 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public RingLifo JoyLeftSixAxisSensor; public RingLifo JoyRightSixAxisSensor; public DeviceType DeviceType; -#pragma warning disable IDE0051 // Remove unused private member + private readonly uint _reserved1; -#pragma warning restore IDE0051 + public NpadSystemProperties SystemProperties; public NpadSystemButtonProperties SystemButtonProperties; public NpadBatteryLevel BatteryLevelJoyDual; @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public NpadBatteryLevel BatteryLevelJoyRight; public uint AppletFooterUiAttributes; public AppletFooterUiType AppletFooterUiType; -#pragma warning disable IDE0051 // Remove unused private member + private readonly Reserved2Struct _reserved2; -#pragma warning restore IDE0051 + public RingLifo GcTrigger; public NpadLarkType LarkTypeLeftAndMain; public NpadLarkType LarkTypeRight; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs index 06be9b24c..cc54c2248 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs @@ -1,19 +1,22 @@ +using System.Runtime.InteropServices; + namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TouchState { public ulong DeltaTime; -#pragma warning disable CS0649 // Field is never assigned to + public TouchAttribute Attribute; -#pragma warning restore CS0649 + public uint FingerId; public uint X; public uint Y; public uint DiameterX; public uint DiameterY; public uint RotationAngle; -#pragma warning disable CS0169, IDE0051 // Remove unused private member + private readonly uint _reserved; -#pragma warning restore CS0169, IDE0051 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/IpcService.cs b/src/Ryujinx.HLE/HOS/Services/IpcService.cs index 4c354ebc6..11d4f57a1 100644 --- a/src/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/src/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -129,9 +129,8 @@ namespace Ryujinx.HLE.HOS.Services } } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long sfciMagic = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // sfci magic + int commandId = (int)context.RequestData.ReadInt64(); bool serviceExists = service.CmifCommands.TryGetValue(commandId, out MethodInfo processRequest); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs index 667230b81..7f9964b38 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy protected override void OnReceived(byte[] buffer, long offset, long size) { - _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, this.Socket.RemoteEndPoint); + _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, Socket.RemoteEndPoint); } protected override void OnError(SocketError error) @@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy { try { - if (endPoint.Equals(this.Socket.RemoteEndPoint)) + if (endPoint.Equals(Socket.RemoteEndPoint)) { NodeInfo = info; _protocol.InvokeAccept(this); diff --git a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs index 18b267e91..203cf5537 100644 --- a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Loader { enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs index 44054e6b8..deed6cbf6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs @@ -102,7 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types coreData.SetDefault(); -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting coreData.Nickname = template.Nickname; coreData.FontRegion = (FontRegion)template.FontRegion; coreData.FavoriteColor = (byte)template.FavoriteColor; diff --git a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs index 71ed56385..c4695e7c0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs @@ -1,6 +1,7 @@ using LibHac.Ncm; using LibHac.Tools.FsSystem.NcaUtils; using Ryujinx.HLE.FileSystem; +using System; using System.Text; using static Ryujinx.HLE.Utilities.StringUtils; @@ -228,12 +229,16 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager if (!string.IsNullOrWhiteSpace(contentPath)) { ulong position = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong size = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 byte[] contentPathBuffer = Encoding.UTF8.GetBytes(contentPath); + if ((ulong)contentPathBuffer.Length > size) + { + throw new InvalidOperationException("Content path buffer size is too small."); + } + context.Memory.Write(position, contentPathBuffer); } else @@ -247,9 +252,8 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager private void DeleteContentPath(ServiceCtx context, ulong titleId, NcaContentType contentType) { ContentManager contentManager = context.Device.System.ContentManager; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); -#pragma warning restore IDE0059 + + //string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); contentManager.ClearEntry(titleId, NcaContentType.Manual, _storageId); } diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index 0e11493d5..06e283f6b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -339,7 +339,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath()); - public static DateTime DateTimeFromTag(ushort dateTimeTag) { try diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs index 5f8d0faaa..cbff95478 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs @@ -22,10 +22,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption if (dumpData.Length < 540) throw new ArgumentException("Incomplete dump. Amiibo data is at least 540 bytes."); - this.data = new byte[540]; - Array.Copy(dumpData, this.data, dumpData.Length); - this.dataMasterKey = dataKey; - this.tagMasterKey = tagKey; + data = new byte[540]; + Array.Copy(dumpData, data, dumpData.Length); + dataMasterKey = dataKey; + tagMasterKey = tagKey; this.isLocked = isLocked; if (!isLocked) @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Append data based on magic size int append = 16 - key.MagicSize; byte[] extract = new byte[16]; - Array.Copy(this.data, 0x011, extract, 0, 2); // Extract two bytes from user data section + Array.Copy(data, 0x011, extract, 0, 2); // Extract two bytes from user data section for (int i = 2; i < 16; i++) { extract[i] = 0x00; @@ -57,13 +57,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Extract the UID (UID is 8 bytes) byte[] uid = new byte[8]; - Array.Copy(this.data, 0x000, uid, 0, 8); + Array.Copy(data, 0x000, uid, 0, 8); seed.AddRange(uid); seed.AddRange(uid); // Extract some tag data (pages 0x20 - 0x28) byte[] user = new byte[32]; - Array.Copy(this.data, 0x060, user, 0, 32); + Array.Copy(data, 0x060, user, 0, 32); // XOR it with the key padding (XorPad) byte[] paddedUser = new byte[32]; @@ -137,10 +137,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption private void DeriveKeysAndCipher() { // Derive HMAC Tag Key - this.hmacTagKey = DeriveKey(this.tagMasterKey, false, out _, out _); + hmacTagKey = DeriveKey(tagMasterKey, false, out _, out _); // Derive HMAC Data Key and AES Key/IV - this.hmacDataKey = DeriveKey(this.dataMasterKey, true, out aesKey, out aesIv); + hmacDataKey = DeriveKey(dataMasterKey, true, out aesKey, out aesIv); } private void DecryptData() diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index ca833e33d..94037af0a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -18,10 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { class INfp : IpcService { -#pragma warning disable IDE0052 // Remove unread private member + private ulong _appletResourceUserId; private ulong _mcuVersionData; -#pragma warning restore IDE0052 + private byte[] _mcuData; private State _state = State.NonInitialized; @@ -482,9 +482,8 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // Flush(bytes<8, 4>) public ResultCode Flush(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint deviceHandle = (uint)context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = (uint)context.RequestData.ReadUInt64(); // Device handle + if (context.Device.System.NfpDevices.Count == 0) { return ResultCode.DeviceNotFound; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index dd4efce6e..96a510921 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -155,9 +155,6 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context) { ulong position = context.Request.PtrBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong size = context.Request.PtrBuff[0].Size; -#pragma warning restore IDE0059 int clientId = context.Memory.Read(position); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs index 577d03822..05e636323 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs @@ -21,9 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService private int _event0Handle; private int _event1Handle; -#pragma warning disable IDE0052 // Remove unread private member private readonly uint _version; -#pragma warning restore IDE0052 public IRequest(Horizon system, uint version) { @@ -118,9 +116,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // GetAppletInfo(u32) -> (u32, u32, u32, buffer) public ResultCode GetAppletInfo(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint themeColor = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // Theme color Logger.Stub?.PrintStub(LogClass.ServiceNifm); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs index fa780fd2e..3b7bf7076 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct InternetConnectionStatus { public InternetConnectionType Type; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs index 9d902a1ad..cb50ab85e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct IpV4Address { public uint Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs index c77358803..46575e51e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs @@ -44,10 +44,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CountAddOnContent(pid) -> u32 public ResultCode CountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return CountAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -57,10 +53,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer) public ResultCode ListAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return ListAddContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -79,10 +71,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentBaseId(pid) -> u64 public ResultCode GetAddOnContentBaseId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return GetAddOnContentBaseIdImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -101,10 +89,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // PrepareAddOnContent(u32 index, pid) public ResultCode PrepareAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return PrepareAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -131,10 +115,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentListChangedEventWithProcessId(pid) -> handle public ResultCode GetAddOnContentListChangedEventWithProcessId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // TODO: Found where stored value is used. @@ -152,10 +132,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyMountAddOnContent(pid, u64 title_id) public ResultCode NotifyMountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -172,10 +148,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyUnmountAddOnContent(pid, u64 title_id) public ResultCode NotifyUnmountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -189,10 +161,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CheckAddOnContentMountStatus(pid) public ResultCode CheckAddOnContentMountStatus(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // Then it does some internal checks and returns InvalidBufferSize if they fail. diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index f510da594..fd9689186 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -12,10 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte source = (byte)context.RequestData.ReadInt64(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // source + _ = context.RequestData.ReadUInt64(); // titleId ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs index ca7d42b48..1e820c0c3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs @@ -11,10 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte source = (byte)context.RequestData.ReadInt64(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // source + _ = context.RequestData.ReadUInt64(); // titleId ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index fea09ef47..843b66caf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -93,9 +93,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv private NvResult GetIoctlArgument(ServiceCtx context, NvIoctl ioctlCommand, out Span arguments) { (ulong inputDataPosition, ulong inputDataSize) = context.Request.GetBufferType0x21(0); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong outputDataPosition, ulong outputDataSize) = context.Request.GetBufferType0x22(0); -#pragma warning restore IDE0059 + + (_, ulong outputDataSize) = context.Request.GetBufferType0x22(0); NvIoctl.Direction ioctlDirection = ioctlCommand.DirectionValue; uint ioctlSize = ioctlCommand.Size; @@ -307,9 +306,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv // Initialize(u32 transfer_memory_size, handle current_process, handle transfer_memory) -> u32 error_code public ResultCode Initialize(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long transferMemSize = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // transfer memory size + int transferMemHandle = context.Request.HandleDesc.ToCopy[1]; // TODO: When transfer memory will be implemented, this could be removed. @@ -431,9 +429,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv // SetClientPID(u64, pid) -> u32 error_code public ResultCode SetClientPid(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long pid = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // pid context.ResponseData.Write(0); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs index 231fa7c13..10f602ad2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocSpaceArguments { public uint Pages; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs index 51fac8d8f..639619dd0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BindChannelArguments { public int Fd; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs index f14b751d4..f8e2c66a6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct FreeSpaceArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs index 447477823..9c704090c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VaRegion { public ulong Offset; @@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types public ulong Pages; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetVaRegionsArguments { public ulong Unused; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs index e86932bb0..264d5b618 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct InitializeExArguments { public uint Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs index c0f6d40ee..f0ca905f3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct MapBufferExArguments { public AddressSpaceFlags Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs index 99afa4bad..bdd46290c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RemapArguments { public ushort Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs index d6bc1bc52..2d5388123 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs @@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { struct UnmapBufferArguments { -#pragma warning disable CS0649 // Field is never assigned to + public ulong Offset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs index a114bd3e0..ad026ff59 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs @@ -19,11 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel private const uint MaxModuleSyncpoint = 16; -#pragma warning disable IDE0052 // Remove unread private member private uint _timeout; private uint _submitTimeout; private uint _timeslice; -#pragma warning restore IDE0052 private readonly Switch _device; @@ -147,10 +145,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { SubmitArguments submitHeader = GetSpanAndSkip(ref arguments, 1)[0]; Span commandBuffers = GetSpanAndSkip(ref arguments, submitHeader.CmdBufsCount); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - Span relocs = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); - Span relocShifts = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); -#pragma warning restore IDE0059 + + _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // relocs + _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // reloc shifts + Span syncptIncrs = GetSpanAndSkip(ref arguments, submitHeader.SyncptIncrsCount); Span fenceThresholds = GetSpanAndSkip(ref arguments, submitHeader.FencesCount); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs index 34663e9d7..f6af4ecef 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs @@ -8,11 +8,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KEvent _smExceptionBptIntReportEvent; private readonly KEvent _smExceptionBptPauseReportEvent; private readonly KEvent _errorNotifierEvent; -#pragma warning restore IDE0052 private int _smExceptionBptIntReportEventHandle; private int _smExceptionBptPauseReportEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs index 9a06fbebd..f84722cea 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocGpfifoExArguments { public uint NumEntries; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs index 4578ec6a9..6e7b5f23e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocObjCtxArguments { public uint ClassNumber; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs index 5e74f6f2c..7eb538211 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetParameterArguments { public uint Parameter; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs index 88cd6bd94..473d31bf3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CommandBufferHandle { public int MapHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs index 177f483f0..943ea3d4b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { class NvChannel { -#pragma warning disable CS0649 // Field is never assigned to + public int Timeout; public int SubmitTimeout; public int Timeslice; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs index f285123a7..39ab45085 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SetErrorNotifierArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs index 0c4ea7625..0f90decb0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CommandBuffer { public int Mem; @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int WordsCount; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Reloc { public int CmdbufMem; @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int TargetOffset; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptIncr { public uint Id; @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public uint Reserved3; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SubmitArguments { public int CmdBufsCount; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs index b6bd1e4e8..c29764162 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SubmitGpfifoArguments { public long Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs index fe4c74d66..7d75c74ed 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullBindArguments { public ulong GpuVirtualAddress; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs index 0b2133a78..0f3729604 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct EventWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs index 48622a224..7d69fd6cf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs @@ -18,9 +18,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl public int EventHandle; private readonly uint _eventId; -#pragma warning disable IDE0052 // Remove unread private member + private readonly NvHostSyncpt _syncpointManager; -#pragma warning restore IDE0052 + private SyncpointWaiterHandle _waiterInformation; private NvFence _previousFailingFence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs index 5138db9ea..cf8d701c8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs index 7bcd38c75..3e29636f6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptWaitExArguments { public SyncptWaitArguments Input; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs index 4f447f486..00221eab9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetActiveSlotMaskArguments { public int Slot; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs index 556786de0..10ba9e6ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GpuCharacteristics { public int Arch; @@ -44,13 +44,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types struct CharacteristicsHeader { -#pragma warning disable CS0649 // Field is never assigned to + public long BufferSize; public long BufferAddress; -#pragma warning restore CS0649 + } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetCharacteristicsArguments { public CharacteristicsHeader Header; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs index c1c1a6f91..e42998da3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetGpuTimeArguments { public ulong Timestamp; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs index 83ff4f090..09aec7b6d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetTpcMasksArguments { public int MaskBufferSize; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs index fb5013a70..48a83a927 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NumVsmsArguments { public uint NumVsms; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs index baada9197..ee01ebf4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VsmsMappingArguments { public byte Sm0GpcIndex; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs index cee339bac..67975ff7b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZbcSetTableArguments { public Array4 ColorDs; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs index 16ffacdac..b661d0997 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullGetCtxSizeArguments { public int Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs index 343643abf..88ea3baa8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullGetInfoArguments { public int WidthAlignPixels; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs index dc4f5d608..84052df9d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapAlloc { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs index f4047497a..63a8150a2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapCreate { public uint Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs index ce93e9e5e..dfaec714e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapFree { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs index 9ec81f9f3..a37dc1954 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapFromId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs index 8306ae4ca..231c61475 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapGetId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs index e821b571d..2b24f4564 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs @@ -4,10 +4,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { class NvMapHandle { -#pragma warning disable CS0649 // Field is never assigned to + public int Handle; public int Id; -#pragma warning restore CS0649 + public uint Size; public int Align; public int Kind; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs index 16fd78043..43299d406 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapParam { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs index 40e35fa7a..99187bc4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvIoctl { public const int NvHostCustomMagic = 0x00; diff --git a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs index c36482e41..6adede408 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs @@ -11,7 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private readonly int _permissionFlag; private ulong _titleId; private ParentalControlFlagValue _parentalControlFlag; -#pragma warning disable IDE0052, CS0414 // Remove unread private member private int[] _ratingAge; // TODO: Find where they are set. @@ -20,7 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private bool _freeCommunicationEnabled = false; private readonly bool _stereoVisionRestrictionConfigurable = true; private bool _stereoVisionRestriction = false; -#pragma warning restore IDE0052, CS0414 public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag) { @@ -178,7 +176,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory return ResultCode.PermissionDenied; } -#pragma warning disable // Remove unnecessary value assignment bool stereoVisionRestriction = false; if (_stereoVisionRestrictionConfigurable) diff --git a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs index 5d90fcbe2..0a7541caf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs @@ -7,9 +7,9 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager class IClkrstSession : IpcService { private readonly DeviceCode _deviceCode; -#pragma warning disable IDE0052 // Remove unread private member + private readonly uint _unknown; -#pragma warning restore IDE0052 + private uint _clockRate; private readonly DeviceCode[] _allowedDeviceCodeTable = diff --git a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs index 45c4ce7e1..d4fc5d767 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs @@ -17,9 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // RequestLoad(u32) public ResultCode RequestLoad(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (SharedFontType)context.RequestData.ReadInt32(); // font type // We don't need to do anything here because we do lazy initialization // on SharedFontManager (the font is loaded when necessary). @@ -30,9 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetLoadState(u32) -> u32 public ResultCode GetLoadState(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (SharedFontType)context.RequestData.ReadInt32(); // font type // 1 (true) indicates that the font is already loaded. // All fonts are already loaded. @@ -86,9 +82,8 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer, buffer, buffer) public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long languageCode = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // language code + int loadedCount = 0; for (SharedFontType type = 0; type < SharedFontType.Count; type++) diff --git a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs index dcc01bf38..0b3a27b03 100644 --- a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs +++ b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs @@ -377,9 +377,8 @@ namespace Ryujinx.HLE.HOS.Services else if (request.Type is IpcMessageType.CmifControl or IpcMessageType.CmifControlWithContext) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint magic = (uint)_requestDataReader.ReadUInt64(); -#pragma warning restore IDE0059 + _ = (uint)_requestDataReader.ReadUInt64(); // magic + uint cmdId = (uint)_requestDataReader.ReadUInt64(); switch (cmdId) diff --git a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index f19eeebfc..66bdb4339 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -214,10 +214,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - bool isLight = (context.RequestData.ReadInt32() & 1) != 0; - int maxSessions = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (context.RequestData.ReadInt32() & 1) != 0; // is light + _ = context.RequestData.ReadInt32(); // max sessions if (string.IsNullOrEmpty(name)) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index fe37ca4fa..79d3bf9c5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -353,9 +353,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int timeout = context.RequestData.ReadInt32(); (ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + + (ulong outputBufferPosition, _) = context.Request.GetBufferType0x22(); if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize) { @@ -603,9 +602,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); (ulong sendPosition, ulong sendSize) = context.Request.GetBufferType0x21(0); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(1); -#pragma warning restore IDE0059 + + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(1); ReadOnlySpan sendBuffer = context.Memory.GetSpan(sendPosition, (int)sendSize); @@ -634,9 +632,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPos, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -679,9 +675,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -702,9 +696,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -725,9 +717,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -754,9 +744,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPos, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -828,9 +816,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int bufferCount = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // buffer count LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -842,9 +829,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd case BsdIoctl.AtMark: errno = LinuxError.SUCCESS; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); // FIXME: OOB not implemented. context.Memory.Write(bufferPosition, 0); @@ -1036,9 +1021,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd public ResultCode DuplicateSocket(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong reserved = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // Padding, not used. LinuxError errno = LinuxError.ENOENT; int newSockFd = -1; @@ -1065,9 +1049,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int socketFd = context.RequestData.ReadInt32(); int vlen = context.RequestData.ReadInt32(); BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint reserved = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt32(); // Padding, not used. + TimeVal timeout = context.RequestData.ReadStruct(); ulong receivePosition = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs index 684e06598..d99488d85 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs @@ -2,7 +2,6 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Net.Sockets; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs index 92a013d19..6a250498d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl { enum WsaError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs index c275f3ba5..2796d95ca 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum BsdSocketOption diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs index 1219d1476..72dcd0166 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum LinuxError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs index 3babb0018..84f2659b8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { struct PollEventData { -#pragma warning disable CS0649 // Field is never assigned to + public int SocketFd; public PollEventTypeMask InputEvents; -#pragma warning restore CS0649 + public PollEventTypeMask OutputEvents; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index 80bdbec8a..8c58822aa 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -28,10 +28,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode SetDnsAddressesPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = context.Request.SendBuff[0].Position; - ulong bufferSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -44,10 +40,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode GetDnsAddressPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = context.Request.ReceiveBuff[0].Position; - ulong bufferSize = context.Request.ReceiveBuff[0].Size; -#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -170,9 +162,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // GetCancelHandleRequest(u64, pid) -> u32 public ResultCode GetCancelHandleRequest(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt64(); // pid + uint cancelHandleRequest = 0; context.ResponseData.Write(cancelHandleRequest); @@ -187,9 +178,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode CancelRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -303,10 +293,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // TODO: Use params. bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int timeOut = context.RequestData.ReadInt32(); - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // Timeout + _ = context.RequestData.ReadUInt64(); // pid if (withOptions) { @@ -403,12 +392,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres context.Memory.Read(inputBufferPosition, rawIp); // TODO: Use params. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint socketLength = context.RequestData.ReadUInt32(); - uint type = context.RequestData.ReadUInt32(); - int timeOut = context.RequestData.ReadInt32(); - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // socket length + _ = context.RequestData.ReadUInt32(); // type + _ = context.RequestData.ReadInt32(); // timeout + _ = context.RequestData.ReadUInt64(); // pid placeholder if (withOptions) { @@ -506,9 +493,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres ulong optionsBufferSize) { bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint cancelHandle = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt32(); // Cancel handle request string host = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[0].Position, (long)context.Request.SendBuff[0].Size); string service = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[1].Position, (long)context.Request.SendBuff[1].Size); @@ -523,21 +509,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres } // NOTE: We ignore hints for now. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - List hints = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); -#pragma warning restore IDE0059 + _ = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); // hints if (withOptions) { // TODO: Find unknown, Parse and use options. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint unknown = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // unknown } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt64(); // pid IPHostEntry hostEntry = null; @@ -625,13 +605,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres private static int SerializeAddrInfos(ServiceCtx context, ulong responseBufferPosition, ulong responseBufferSize, IPHostEntry hostEntry, int port) { - ulong originalBufferPosition = responseBufferPosition; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = originalBufferPosition; - - byte[] hostName = Encoding.ASCII.GetBytes(hostEntry.HostName + '\0'); -#pragma warning restore IDE0059 - using WritableRegion region = context.Memory.GetWritableRegion(responseBufferPosition, (int)responseBufferSize); Span data = region.Memory.Span; diff --git a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs index 301d415a0..3070710b0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs @@ -1,4 +1,3 @@ -using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Services.Spl.Types; @@ -61,9 +60,6 @@ namespace Ryujinx.HLE.HOS.Services.Spl { configValue = default; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SystemVersion version = context.Device.System.ContentManager.GetCurrentFirmwareVersion(); -#pragma warning restore IDE0059 MemorySize memorySize = context.Device.Configuration.MemoryConfiguration.ToKernelMemorySize(); switch (configItem) diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs index 763ab8d60..f00608297 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs @@ -50,10 +50,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl { private const uint ValidMagic = 0x546C7373; -#pragma warning disable CS0649 // Field is never assigned to public uint Magic; public uint EntriesCount; -#pragma warning restore CS0649 public readonly bool IsValid() { @@ -63,12 +61,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl private struct CertStoreFileEntry { -#pragma warning disable CS0649 // Field is never assigned to + public CaCertificateId Id; public TrustedCertStatus Status; public uint DataSize; public uint DataOffset; -#pragma warning restore CS0649 + } public class CertStoreEntry diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index 8f38f293f..df4ec11ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -21,9 +21,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl public ResultCode CreateContext(ServiceCtx context) { SslVersion sslVersion = (SslVersion)context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid MakeObject(context, new ISslContext(context.Request.HandleDesc.PId, sslVersion)); diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs index 7b371d299..a35be2cf0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs @@ -47,11 +47,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService { CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong certificateDataPosition = context.Request.SendBuff[0].Position; - ulong certificateDataSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 - context.ResponseData.Write(_serverCertificateId++); Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { certificateFormat }); @@ -63,11 +58,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService // ImportClientPki(buffer certificate, buffer ascii_password) -> u64 certificateId public ResultCode ImportClientPki(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong certificateDataPosition = context.Request.SendBuff[0].Position; - ulong certificateDataSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 - ulong asciiPasswordDataPosition = context.Request.SendBuff[1].Position; ulong asciiPasswordDataSize = context.Request.SendBuff[1].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs index dc33dd6a5..2e39bf652 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs @@ -69,8 +69,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService EndSslOperation(); } - // NOTE: We silence warnings about TLS 1.0 and 1.1 as games will likely use it. -#pragma warning disable SYSLIB0039 private SslProtocols TranslateSslVersion(SslVersion version) { return (version & SslVersion.VersionMask) switch @@ -83,7 +81,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService _ => throw new NotImplementedException(version.ToString()), }; } -#pragma warning restore SYSLIB0039 /// /// Retrieve the hostname of the current remote in case the provided hostname is null or empty. diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs index 9afb26c65..4f0d8e21d 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs @@ -15,9 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger private readonly ITickSource _tickSource; -#pragma warning disable IDE0052 // Remove unread private member private uint _stickyTransform; -#pragma warning restore IDE0052 private uint _nextCallbackTicket; private uint _currentCallbackTicket; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs index 25c89baec..20cf2c754 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs @@ -50,9 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger public string ReadInterfaceToken() { // Ignore the policy flags -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int strictPolicy = ReadInt32(); -#pragma warning restore IDE0059 + _ = ReadInt32(); return ReadString16(); } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs index 0c69bf573..aa3b25ca5 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum Status diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index 8acc4d756..971778175 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -2,7 +2,6 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.PreciseSleep; -using Ryujinx.Cpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs index b26fb15d1..438c58b72 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum ColorFormat : ulong diff --git a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs index c0b4ad292..5902432b0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Time.Clock { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TimeSpanType { private const long NanoSecondsPerSecond = 1000000000; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs index eaddf9cff..15a3a0206 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs @@ -83,9 +83,7 @@ namespace Ryujinx.HLE.HOS.Services.Time return ResultCode.PermissionDenied; } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - TimeSpanType internalOffset = context.RequestData.ReadStruct(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadStruct(); // internalOffset // TODO: set:sys SetExternalSteadyClockInternalOffset(internalOffset.ToSeconds()) diff --git a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs index ded2c3175..fcb434fae 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Time { public enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs index b18a4f76c..f7eff6f9f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs @@ -248,9 +248,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong outBufferSize = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); context.ResponseData.Write(1); @@ -270,9 +267,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong outBufferSize = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs index 346487030..7c76a82f6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs @@ -14,9 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Time private Switch _device; private KSharedMemory _sharedMemory; private SharedMemoryStorage _timeSharedMemoryStorage; -#pragma warning disable IDE0052 // Remove unread private member + private int _timeSharedMemorySize; -#pragma warning restore IDE0052 private const uint SteadyClockContextOffset = 0x00; private const uint LocalSystemClockContextOffset = 0x38; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index dfacc8170..886d10197 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -649,22 +649,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - long theirDstOffset; - for (int i = 0; i < outRules.TimeCount; i++) - { - int j = outRules.Types[i]; - if (outRules.Ttis[j].IsDaySavingTime) - { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - theirDstOffset = -outRules.Ttis[j].GmtOffset; -#pragma warning restore IDE0059 - } - } - bool isDaySavingTime = false; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long theirOffset = theirStdOffset; -#pragma warning restore IDE0059 + for (int i = 0; i < outRules.TimeCount; i++) { int j = outRules.Types[i]; @@ -681,16 +667,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - theirOffset = -outRules.Ttis[j].GmtOffset; - if (outRules.Ttis[j].IsDaySavingTime) + if (!outRules.Ttis[j].IsDaySavingTime) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - theirDstOffset = theirOffset; -#pragma warning restore IDE0059 - } - else - { - theirStdOffset = theirOffset; + theirStdOffset = -outRules.Ttis[j].GmtOffset; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs index 0e5d103d1..2e22feaa4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs @@ -29,10 +29,9 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService // CreateManagedLayer(u32, u64, nn::applet::AppletResourceUserId) -> u64 public ResultCode CreateManagedLayer(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long layerFlags = context.RequestData.ReadInt64(); - long displayId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // layerFlags + _ = context.RequestData.ReadInt64(); // displayId + long appletResourceUserId = context.RequestData.ReadInt64(); ulong pid = context.Device.System.AppletState.AppletResourceUserIds.GetData((int)appletResourceUserId); diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index 99c640aa0..a38bf902d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -231,14 +231,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService public ResultCode OpenLayer(ServiceCtx context) { // TODO: support multi display. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte[] displayName = context.RequestData.ReadBytes(0x40); -#pragma warning restore IDE0059 - + _ = context.RequestData.ReadBytes(0x40); // display name long layerId = context.RequestData.ReadInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long userId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // user id + ulong parcelPtr = context.Request.ReceiveBuff[0].Position; ResultCode result = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId, out IBinder producer); @@ -276,10 +272,8 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) public ResultCode CreateStrayLayer(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long layerFlags = context.RequestData.ReadInt64(); - long displayId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // layerFlags + _ = context.RequestData.ReadInt64(); // displayId ulong parcelPtr = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/TamperMachine.cs b/src/Ryujinx.HLE/HOS/TamperMachine.cs index 9b565b034..b6fa10190 100644 --- a/src/Ryujinx.HLE/HOS/TamperMachine.cs +++ b/src/Ryujinx.HLE/HOS/TamperMachine.cs @@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS { if (_tamperThread == null || !_tamperThread.IsAlive) { - _tamperThread = new Thread(this.TamperRunner) + _tamperThread = new Thread(TamperRunner) { Name = "HLE.TamperMachine", }; diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs index 9b6eb014e..8887c5ec7 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.Loaders.Elf { enum ElfDynamicTag diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs index 8d4df8942..faffe4461 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol32 { -#pragma warning disable CS0649 // Field is never assigned to + public uint NameOffset; public uint ValueAddress; public uint Size; public byte Info; public byte Other; public ushort SectionIndex; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs index 45a753615..17781503f 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol64 { -#pragma warning disable CS0649 // Field is never assigned to + public uint NameOffset; public byte Info; public byte Other; public ushort SectionIndex; public ulong ValueAddress; public ulong Size; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs index 249f8dd9d..b2af85b4e 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs @@ -30,9 +30,8 @@ namespace Ryujinx.HLE.Loaders.Npdm { throw new InvalidNpdmException("FsAccessHeader is corrupted!"); } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int contentOwnerIdSize = reader.ReadInt32(); -#pragma warning restore IDE0059 + + _ = reader.ReadInt32(); // contentOwnerId size int dataAndContentOwnerIdSize = reader.ReadInt32(); if (dataAndContentOwnerIdSize != 0x1c) diff --git a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs index 4a99de98c..59611100a 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs @@ -68,11 +68,10 @@ namespace Ryujinx.HLE.Loaders.Npdm stream.Seek(0x30, SeekOrigin.Current); int aci0Offset = reader.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int aci0Size = reader.ReadInt32(); + + _ = reader.ReadInt32(); // aci0 size int acidOffset = reader.ReadInt32(); - int acidSize = reader.ReadInt32(); -#pragma warning restore IDE0059 + _ = reader.ReadInt32(); // acid size Aci0 = new Aci0(stream, aci0Offset); Acid = new Acid(stream, acidOffset); diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index 23faca9d1..b043f29ef 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -9,7 +9,6 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.Memory; -using System; using System.Linq; using static Ryujinx.HLE.HOS.ModLoader; diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 53ccddc68..18b2b78d1 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -6,7 +6,6 @@ using Ryujinx.Cpu; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Processes.Extensions; using Ryujinx.Horizon.Common; -using System; namespace Ryujinx.HLE.Loaders.Processes { diff --git a/src/Ryujinx.HLE/MemoryConfiguration.cs b/src/Ryujinx.HLE/MemoryConfiguration.cs index 21ecd737f..4ff65584d 100644 --- a/src/Ryujinx.HLE/MemoryConfiguration.cs +++ b/src/Ryujinx.HLE/MemoryConfiguration.cs @@ -18,11 +18,11 @@ namespace Ryujinx.HLE { private const ulong GiB = 1024 * 1024 * 1024; -#pragma warning disable IDE0055 // Disable formatting public static MemoryArrange ToKernelMemoryArrange(this MemoryConfiguration configuration) { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB => MemoryArrange.MemoryArrange4GiB, MemoryConfiguration.MemoryConfiguration4GiBAppletDev => MemoryArrange.MemoryArrange4GiBAppletDev, MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemoryArrange.MemoryArrange4GiBSystemDev, @@ -31,6 +31,7 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemoryArrange.MemoryArrange8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemoryArrange.MemoryArrange12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } @@ -38,6 +39,7 @@ namespace Ryujinx.HLE { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemorySize.MemorySize4GiB, @@ -46,6 +48,7 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemorySize.MemorySize8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemorySize.MemorySize12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } @@ -53,6 +56,7 @@ namespace Ryujinx.HLE { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => 4 * GiB, @@ -61,8 +65,8 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => 8 * GiB, MemoryConfiguration.MemoryConfiguration12GiB => 12 * GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } -#pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.HLE/StructHelpers.cs b/src/Ryujinx.HLE/StructHelpers.cs index dc9c6d727..ee299896d 100644 --- a/src/Ryujinx.HLE/StructHelpers.cs +++ b/src/Ryujinx.HLE/StructHelpers.cs @@ -17,7 +17,6 @@ namespace Ryujinx.HLE const int SizeOfApplicationTitle = 0x300; const int OffsetOfApplicationPublisherStrings = 0x200; - BlitStruct nacpData = new(1); // name and publisher buffer diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index bdcbe82c7..c9f16021a 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -77,11 +77,13 @@ namespace Ryujinx.HLE Hid = new Hid(this, System.HidStorage); Processes = new ProcessLoader(this); TamperMachine = new TamperMachine(); +#pragma warning restore IDE0055 System.InitializeServices(); System.State.SetLanguage(Configuration.SystemLanguage); System.State.SetRegion(Configuration.Region); - + +#pragma warning disable IDE0055 // Disable formatting VSyncMode = Configuration.VSyncMode; CustomVSyncInterval = Configuration.CustomVSyncInterval; TickScalar = TurboMode ? Configuration.TickScalar : ITickSource.RealityTickScalar; @@ -90,9 +92,9 @@ namespace Ryujinx.HLE System.EnablePtc = Configuration.EnablePtc; System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel; System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode; +#pragma warning restore IDE0055 UpdateVSyncInterval(); -#pragma warning restore IDE0055 Shared = this; } diff --git a/src/Ryujinx.HLE/UI/IHostUIHandler.cs b/src/Ryujinx.HLE/UI/IHostUIHandler.cs index b5c5cb168..68140dd54 100644 --- a/src/Ryujinx.HLE/UI/IHostUIHandler.cs +++ b/src/Ryujinx.HLE/UI/IHostUIHandler.cs @@ -63,7 +63,6 @@ namespace Ryujinx.HLE.UI /// IHostUITheme HostUITheme { get; } - /// /// Displays the player select dialog and returns the selected profile. /// diff --git a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs index 2a09001db..050bf5565 100644 --- a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs +++ b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs @@ -146,11 +146,15 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); List syscalls = []; + Dictionary isStaticMethod = new(); foreach (MethodDeclarationSyntax method in syntaxReceiver.SvcImplementations) { - GenerateMethod32(generator, context.Compilation, method); - GenerateMethod64(generator, context.Compilation, method); + bool isStatic = method.Modifiers.Any(SyntaxKind.StaticKeyword); + isStaticMethod[method.Identifier.Text] = isStatic; + + GenerateMethod32(generator, context.Compilation, method, isStatic); + GenerateMethod64(generator, context.Compilation, method, isStatic); foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList => attributeList.Attributes.Where(attribute => @@ -166,9 +170,9 @@ namespace Ryujinx.Horizon.Kernel.Generators syscalls.Sort(); - GenerateDispatch(generator, syscalls, A32Suffix); + GenerateDispatch(generator, syscalls, A32Suffix, isStaticMethod); generator.AppendLine(); - GenerateDispatch(generator, syscalls, A64Suffix); + GenerateDispatch(generator, syscalls, A64Suffix, isStaticMethod); generator.LeaveScope(); generator.LeaveScope(); @@ -193,9 +197,12 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.LeaveScope(); } - private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int index = 0; @@ -266,9 +273,10 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -289,7 +297,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -313,9 +321,12 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } - private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int registerIndex = 0; @@ -356,9 +367,10 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -374,7 +386,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -393,6 +405,55 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + { + GenerateMethod32(generator, compilation, method, false); + } + + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + { + GenerateMethod64(generator, compilation, method, false); + } + + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix, Dictionary isStaticMethod) + { + generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); + generator.EnterScope("switch (id)"); + + foreach (SyscallIdAndName syscall in syscalls) + { + generator.AppendLine($"case {syscall.Id}:"); + generator.IncreaseIndentation(); + + if (isStaticMethod.TryGetValue(syscall.Name, out bool isStatic) && isStatic) + { + generator.AppendLine($"{syscall.Name}{suffix}(context);"); + } + else + { + generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); + } + + generator.AppendLine("break;"); + + generator.DecreaseIndentation(); + } + + generator.AppendLine($"default:"); + generator.IncreaseIndentation(); + + generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); + + generator.DecreaseIndentation(); + + generator.LeaveScope(); + generator.LeaveScope(); + } + + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) + { + } + private static string GetFormattedLogValue(string value, string canonicalTypeName) { if (Is32BitInteger(canonicalTypeName)) @@ -463,33 +524,6 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine($"Logger.{logLevel}?.PrintMsg(LogClass.{logClass}, $\"{log}\");"); } - private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) - { - generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); - generator.EnterScope("switch (id)"); - - foreach (SyscallIdAndName syscall in syscalls) - { - generator.AppendLine($"case {syscall.Id}:"); - generator.IncreaseIndentation(); - - generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); - generator.AppendLine("break;"); - - generator.DecreaseIndentation(); - } - - generator.AppendLine($"default:"); - generator.IncreaseIndentation(); - - generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); - - generator.DecreaseIndentation(); - - generator.LeaveScope(); - generator.LeaveScope(); - } - private static bool Is32BitInteger(string canonicalTypeName) { return canonicalTypeName is TypeSystemInt32 or TypeSystemUInt32; diff --git a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs index 583a04de3..89ba9d8e9 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs @@ -233,6 +233,8 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return Result.Success; } + // Remove this pragma warning when the methods are implemented +#pragma warning disable CA1822 // Mark members as static [CmifCommand(15)] // 17.0.0+ public Result AcquireAudioOutputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) { @@ -274,6 +276,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return AudioResult.NotImplemented; } +#pragma warning restore CA1822 // Mark members as static protected virtual void Dispose(bool disposing) { diff --git a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs index 2146362df..bc913fd9c 100644 --- a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs +++ b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail OpusCodecFactory.AttemptToUseNativeLibrary = false; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct OpusPacketHeader { public uint Length; diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs index a2cbad6a6..9c431f73a 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs @@ -4,12 +4,12 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct AccountNotificationSettings { -#pragma warning disable CS0649 // Field is never assigned to + public Uid UserId; public uint Flags; public byte FriendPresenceOverlayPermission; public byte FriendInvitationOverlayPermission; public ushort Reserved; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs index ec5c97c5a..a6f678565 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct BluetoothDevicesSettings { -#pragma warning disable CS0649 // Field is never assigned to + public Array6 BdAddr; public Array32 DeviceName; public Array3 ClassOfDevice; @@ -24,6 +24,6 @@ namespace Ryujinx.Horizon.Sdk.Settings.System public Array9 Brr; public Array256 Reserved; public Array43 Reserved2; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs index 2ce56c4df..e9b658ece 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs @@ -21,10 +21,10 @@ namespace Ryujinx.Horizon.Sdk.Settings.System struct NotificationTime { -#pragma warning disable CS0649 // Field is never assigned to + public uint Hour; public uint Minute; -#pragma warning restore CS0649 + } [StructLayout(LayoutKind.Sequential, Size = 0x18, Pack = 0x4)] diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs index 23c1ce248..5fcaa4277 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifDomainOutHeader { -#pragma warning disable CS0649 // Field is never assigned to + public uint ObjectsCount; public uint Padding; public uint Padding2; public uint Padding3; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs index ddceca030..f91be62c0 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs @@ -4,11 +4,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifOutHeader { -#pragma warning disable CS0649 // Field is never assigned to + public uint Magic; public uint Version; public Result Result; public uint Token; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs index 370341994..97eed615d 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs @@ -2,7 +2,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifRequestFormat { -#pragma warning disable CS0649 // Field is never assigned to public int ObjectId; public uint RequestId; public uint Context; @@ -19,6 +18,5 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif public int ObjectsCount; public int HandlesCount; public bool SendPid; -#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs index 4e9628947..15c5678d6 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs @@ -2,11 +2,10 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcBufferDescriptor { -#pragma warning disable CS0649 // Field is never assigned to + private readonly uint _sizeLow; private readonly uint _addressLow; private readonly uint _word2; -#pragma warning restore CS0649 public ulong Address => _addressLow | (((ulong)_word2 << 4) & 0xf00000000UL) | (((ulong)_word2 << 34) & 0x7000000000UL); public ulong Size => _sizeLow | ((ulong)_word2 << 8) & 0xf00000000UL; diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs index 9a7c23e9a..526e3dae1 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs @@ -2,10 +2,9 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcReceiveListEntry { -#pragma warning disable IDE0052 // Remove unread private member + private readonly uint _addressLow; private readonly uint _word1; -#pragma warning restore IDE0052 public HipcReceiveListEntry(ulong address, ulong size) { diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs index faf5dc410..0cf58827d 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs @@ -16,6 +16,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc public static Result InvalidCmifRequest => new(ModuleId, 420); public static Result TargetNotDomain => new(ModuleId, 491); public static Result DomainObjectNotFound => new(ModuleId, 492); - #pragma warning restore IDE0055 +#pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs index a1e13aa45..80d239896 100644 --- a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs +++ b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs @@ -1,6 +1,4 @@ using Ryujinx.Common.Configuration.Hid; -using Ryujinx.Common.Configuration.Hid.Controller; -using System; using System.Collections.Generic; using System.Linq; using System.Numerics; diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index 1cbf4d35c..078fe6b4d 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -21,9 +21,8 @@ namespace Ryujinx.Input.SDL2 private readonly Lock _userMappingLock = new(); -#pragma warning disable IDE0052 // Remove unread private member private readonly SDL2KeyboardDriver _driver; -#pragma warning restore IDE0052 + private StandardKeyboardInputConfig _configuration; private readonly List _buttonsUserMapping; diff --git a/src/Ryujinx.Input/IMouse.cs b/src/Ryujinx.Input/IMouse.cs index e20e7798d..19741b96f 100644 --- a/src/Ryujinx.Input/IMouse.cs +++ b/src/Ryujinx.Input/IMouse.cs @@ -8,9 +8,7 @@ namespace Ryujinx.Input /// public interface IMouse : IGamepad { -#pragma warning disable IDE0051 // Remove unused private member private const int SwitchPanelWidth = 1280; -#pragma warning restore IDE0051 private const int SwitchPanelHeight = 720; /// diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs index 41b40b177..5d4055753 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFu - Uc.EmuStart(this.PC, -1, 0, (long)count); + Uc.EmuStart(PC, -1, 0, (long)count); } public void Step() @@ -141,7 +141,6 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_R15 ]; -#pragma warning disable IDE0051, IDE0052 // Remove unused private member private static readonly int[] _qRegisters = [ Arm.UC_ARM_REG_Q0, @@ -161,7 +160,6 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_Q14, Arm.UC_ARM_REG_Q15 ]; -#pragma warning restore IDE0051, IDE0052 public uint GetX(int index) { diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs index 8525b0446..22dd44b21 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs @@ -102,7 +102,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFul - Uc.EmuStart((long)this.PC, -1, 0, (long)count); + Uc.EmuStart((long)PC, -1, 0, (long)count); } public void Step() diff --git a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs index 5aa088e78..f55725c3b 100644 --- a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs +++ b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using Ryujinx.Common.Extensions; +using Ryujinx.Common.Utilities; using Ryujinx.Memory; using System; using System.Buffers; @@ -274,11 +275,12 @@ namespace Ryujinx.Tests.Common.Extensions public short EffectsSize; public int RenderInfoSize; - public unsafe fixed byte Reserved[16]; + //public unsafe fixed byte Reserved[16]; + public Buffer16 Reserved; public static readonly int SizeOf = Unsafe.SizeOf(); - public static unsafe MyUnmanagedStruct Generate(Random rng) + public static MyUnmanagedStruct Generate(Random rng) { const int BaseInt32Value = 0x1234abcd; const short BaseInt16Value = 0x5678; @@ -293,7 +295,8 @@ namespace Ryujinx.Tests.Common.Extensions RenderInfoSize = BaseInt32Value ^ rng.Next(), }; - Unsafe.Write(result.Reserved, rng.NextInt64()); + Span reservedSpan = result.Reserved.Bytes; + rng.NextBytes(reservedSpan); return result; } @@ -307,14 +310,7 @@ namespace Ryujinx.Tests.Common.Extensions assert(expected.EffectsSize, actual.EffectsSize); assert(expected.RenderInfoSize, actual.RenderInfoSize); - fixed (void* expectedReservedPtr = expected.Reserved) - fixed (void* actualReservedPtr = actual.Reserved) - { - long expectedReservedLong = Unsafe.Read(expectedReservedPtr); - long actualReservedLong = Unsafe.Read(actualReservedPtr); - - assert(expectedReservedLong, actualReservedLong); - } + assert(expected.Reserved, actual.Reserved); } } diff --git a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs index 207d28f50..3eb42d262 100644 --- a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs +++ b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs @@ -11,9 +11,7 @@ namespace Ryujinx.Tests.Memory public MemoryManagerType Type => MemoryManagerType.HostMappedUnsafe; -#pragma warning disable CS0067 // The event is never used public event Action UnmapEvent; -#pragma warning restore CS0067 public ref T GetRef(ulong va) where T : unmanaged { @@ -49,5 +47,12 @@ namespace Ryujinx.Tests.Memory { throw new NotImplementedException(); } + + // Since the mock never unmaps memory, the UnmapEvent is never used and this causes a warning. + // This method is provided to allow the mock to trigger the event if needed. + public void Unmap(ulong va, ulong size) + { + UnmapEvent?.Invoke(va, size); + } } } diff --git a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs index 92b994279..eb1080e50 100644 --- a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs +++ b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs @@ -11,7 +11,6 @@ using Ryujinx.Memory; using Ryujinx.Memory.Tracking; using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; diff --git a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs index 233ac2b6d..e99f70f5b 100644 --- a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs +++ b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs @@ -44,12 +44,12 @@ namespace Ryujinx.Ava.Common.Models if (obj == null) return false; - return this.Path == obj.Path; + return Path == obj.Path; } public override int GetHashCode() { - return this.Path.GetHashCode(); + return Path.GetHashCode(); } } } diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 09759d7cc..305e4acaa 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -119,7 +119,6 @@ namespace Ryujinx.Ava => ProcessUnhandledException(sender, e.Exception, false); AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit(); - // Setup base data directory. AppDataManager.Initialize(CommandLineState.BaseDirPathArg); @@ -160,7 +159,6 @@ namespace Ryujinx.Ava } } - public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false) { if (string.IsNullOrEmpty(gameId)) @@ -221,10 +219,7 @@ namespace Ryujinx.Ava } // When you first load the program, copy to remember the path for the global configuration - if (GlobalConfigurationPath == null) - { - GlobalConfigurationPath = ConfigurationPath; - } + GlobalConfigurationPath ??= ConfigurationPath; UseHardwareAcceleration = ConfigurationState.Instance.EnableHardwareAcceleration; @@ -342,7 +337,6 @@ namespace Ryujinx.Ava log.PrintMsg(LogClass.Application, message); } - if (isTerminating) Exit(); } diff --git a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs index 5656d6e73..e1fa47362 100644 --- a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs +++ b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs @@ -86,19 +86,17 @@ namespace Ryujinx.Ava.Systems.AppLibrary public string LocalizedStatusTooltip => Compatibility.Convert(x => -#pragma warning disable CS8509 // It is exhaustive for all possible values this can contain. LocaleManager.Instance[x.Status switch -#pragma warning restore CS8509 { LocaleKeys.CompatibilityListPlayable => LocaleKeys.CompatibilityListPlayableTooltip, LocaleKeys.CompatibilityListIngame => LocaleKeys.CompatibilityListIngameTooltip, LocaleKeys.CompatibilityListMenus => LocaleKeys.CompatibilityListMenusTooltip, LocaleKeys.CompatibilityListBoots => LocaleKeys.CompatibilityListBootsTooltip, LocaleKeys.CompatibilityListNothing => LocaleKeys.CompatibilityListNothingTooltip, + _ => throw new ArgumentOutOfRangeException(nameof(x.Status), "Unknown playability status.") }] ).OrElse(string.Empty); - [JsonIgnore] public string IdString => Id.ToString("x16"); [JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL; diff --git a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs index 8b207c6bd..38d42b5d4 100644 --- a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs +++ b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs @@ -11,7 +11,6 @@ namespace Ryujinx.Ava.Systems.AppLibrary LdnData = ldnData ?? []; } - public LdnGameData[] LdnData { get; set; } } } diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs index afabdb4e3..03fe69e83 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs @@ -44,7 +44,6 @@ namespace Ryujinx.Ava.Systems.Configuration configurationFileUpdated = true; } - EnableDiscordIntegration.Value = cff.EnableDiscordIntegration; UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only FocusLostActionType.Value = cff.FocusLostActionType; @@ -147,7 +146,7 @@ namespace Ryujinx.Ava.Systems.Configuration Hid.EnableMouse.Value = cff.EnableMouse; Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus : Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only Hid.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only - Hid.InputConfig.Value = cff.InputConfig ?? [] ; + Hid.InputConfig.Value = cff.InputConfig ?? []; Hid.RainbowSpeed.Value = cff.RainbowSpeed; Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId; diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index 29a390b26..2e0978e7e 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -326,7 +326,6 @@ namespace Ryujinx.Ava.Systems.Configuration /// public ReactiveObject MatchSystemTime { get; private set; } - /// /// Enable or disable use global input config (Independent from controllers binding) /// @@ -769,7 +768,7 @@ namespace Ryujinx.Ava.Systems.Configuration /// public static ConfigurationState Instance { get; private set; } - public static ConfigurationState InstanceExtra{ get; private set; } + public static ConfigurationState InstanceExtra { get; private set; } /// /// The UI section diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs index 4a565d5d3..a22ccdac4 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs @@ -15,13 +15,13 @@ namespace Ryujinx.Ava.Systems.Configuration { public static void Initialize() { - if (Instance != null || InstanceExtra!= null) + if (Instance != null || InstanceExtra != null) { throw new InvalidOperationException("Configuration is already initialized"); } Instance = new ConfigurationState(); - InstanceExtra= new ConfigurationState(); + InstanceExtra = new ConfigurationState(); } public ConfigurationFileFormat ToFileFormat() diff --git a/src/Ryujinx/Systems/Rebooter.cs b/src/Ryujinx/Systems/Rebooter.cs index ac22dfb15..5360edee9 100644 --- a/src/Ryujinx/Systems/Rebooter.cs +++ b/src/Ryujinx/Systems/Rebooter.cs @@ -1,11 +1,9 @@ using FluentAvalonia.UI.Controls; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Threading.Tasks; namespace Ryujinx.Ava.Systems diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index f49f60ab9..5f9f3ed96 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -1,4 +1,4 @@ -using Gommon; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common; @@ -57,10 +57,10 @@ namespace Ryujinx.Ava.Systems return default; } - if (CreateUpdateQueryUrl() is not {} updateUrl) + if (CreateUpdateQueryUrl() is not { } updateUrl) { Logger.Error?.Print(LogClass.Application, "Could not determine URL for updates."); - + _running = false; return default; @@ -110,7 +110,6 @@ namespace Ryujinx.Ava.Systems return default; } - if (!Version.TryParse(_buildVer, out Version newVersion)) { Logger.Error?.Print(LogClass.Application, @@ -127,7 +126,7 @@ namespace Ryujinx.Ava.Systems return (currentVersion, newVersion); } - + [JsonSerializable(typeof(UpdaterResponse))] partial class UpdaterResponseJsonContext : JsonSerializerContext; diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index 40c1da175..b9b58e0a9 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -5,19 +5,16 @@ using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models.Github; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.Utilities; using Ryujinx.Common; using Ryujinx.Common.Helper; using Ryujinx.Common.Logging; -using Ryujinx.Common.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Net; using System.Net.Http; using System.Net.NetworkInformation; using System.Runtime.CompilerServices; @@ -43,9 +40,9 @@ namespace Ryujinx.Ava.Systems private static bool _running; private static readonly string[] _windowsDependencyDirs = []; - + private static string _changelogUrlFormat = null; - + public static async Task BeginUpdateAsync(bool showVersionUpToDate = false) { if (_running) @@ -88,7 +85,7 @@ namespace Ryujinx.Ava.Systems try { buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0"); - + // GitLab instance is located in Ukraine. Connection times will vary across the world. buildSizeClient.Timeout = TimeSpan.FromSeconds(10); @@ -245,7 +242,7 @@ namespace Ryujinx.Ava.Systems } } - private static void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) + private static async void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) { // Multi-Threaded Updater long chunkSize = _buildSize / ConnectionCount; @@ -256,111 +253,95 @@ namespace Ryujinx.Ava.Systems int[] progressPercentage = new int[ConnectionCount]; List list = new(ConnectionCount); - List webClients = new(ConnectionCount); - for (int i = 0; i < ConnectionCount; i++) { list.Add([]); } + using HttpClient httpClient = ConstructHttpClient(); + List downloadTasks = new(); + for (int i = 0; i < ConnectionCount; i++) { -#pragma warning disable SYSLIB0014 - // TODO: WebClient is obsolete and need to be replaced with a more complex logic using HttpClient. - using WebClient client = new(); -#pragma warning restore SYSLIB0014 + int index = i; + long start = chunkSize * index; + long end = (index == ConnectionCount - 1) ? (chunkSize * (index + 1) - 1 + remainderChunk) : (chunkSize * (index + 1) - 1); - webClients.Add(client); - - if (i == ConnectionCount - 1) + downloadTasks.Add(Task.Run(async () => { - client.Headers.Add("Range", $"bytes={chunkSize * i}-{(chunkSize * (i + 1) - 1) + remainderChunk}"); - } - else - { - client.Headers.Add("Range", $"bytes={chunkSize * i}-{chunkSize * (i + 1) - 1}"); - } - - client.DownloadProgressChanged += (_, args) => - { - int index = (int)args.UserState; - - Interlocked.Add(ref totalProgressPercentage, -1 * progressPercentage[index]); - Interlocked.Exchange(ref progressPercentage[index], args.ProgressPercentage); - Interlocked.Add(ref totalProgressPercentage, args.ProgressPercentage); - - taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); - }; - - client.DownloadDataCompleted += (_, args) => - { - int index = (int)args.UserState; - - if (args.Cancelled) + try { - webClients[index].Dispose(); + HttpRequestMessage request = new(HttpMethod.Get, downloadUrl); + request.Headers.Range = new System.Net.Http.Headers.RangeHeaderValue(start, end); - taskDialog.Hide(); + using HttpResponseMessage response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + response.EnsureSuccessStatusCode(); - return; - } + using Stream contentStream = await response.Content.ReadAsStreamAsync(); + using MemoryStream memoryStream = new(); - list[index] = args.Result; - Interlocked.Increment(ref completedRequests); + byte[] buffer = new byte[32 * 1024]; + int bytesRead; + long totalRead = 0; + long totalSize = end - start + 1; - if (Equals(completedRequests, ConnectionCount)) - { - byte[] mergedFileBytes = new byte[_buildSize]; - for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) + while ((bytesRead = await contentStream.ReadAsync(buffer)) > 0) { - Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); - destinationOffset += list[connectionIndex].Length; + memoryStream.Write(buffer, 0, bytesRead); + totalRead += bytesRead; + + int progress = (int)(100 * totalRead / totalSize); + Interlocked.Add(ref totalProgressPercentage, -progressPercentage[index]); + progressPercentage[index] = progress; + Interlocked.Add(ref totalProgressPercentage, progress); + + taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); } - File.WriteAllBytes(updateFile, mergedFileBytes); + list[index] = memoryStream.ToArray(); - // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. - if (OperatingSystem.IsMacOS()) + if (Interlocked.Increment(ref completedRequests) == ConnectionCount) { - using Process xattrProcess = Process.Start("xattr", - ["-d", "com.apple.quarantine", updateFile]); + byte[] mergedFileBytes = new byte[_buildSize]; + for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) + { + Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); + destinationOffset += list[connectionIndex].Length; + } - xattrProcess.WaitForExit(); - } + File.WriteAllBytes(updateFile, mergedFileBytes); - try - { - InstallUpdate(taskDialog, updateFile); - } - 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."); + // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. + if (OperatingSystem.IsMacOS()) + { + using Process xattrProcess = Process.Start("xattr", + ["-d", "com.apple.quarantine", updateFile]); - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + xattrProcess.WaitForExit(); + } + + try + { + InstallUpdate(taskDialog, updateFile); + } + 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."); + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + } } } - }; - - try - { - client.DownloadDataAsync(new Uri(downloadUrl), i); - } - 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."); - - foreach (WebClient webClient in webClients) + catch (Exception ex) { - webClient.CancelAsync(); + Logger.Warning?.Print(LogClass.Application, ex.Message); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); } - - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); - - return; - } + })); } + + await Task.WhenAll(downloadTasks); } private static void DoUpdateWithSingleThreadWorker(TaskDialog taskDialog, string downloadUrl, string updateFile) diff --git a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs index ee0e884d2..74def97c6 100644 --- a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs +++ b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs @@ -118,7 +118,7 @@ namespace Ryujinx.Ava.UI.Applet await ContentDialogHelper.ShowWindowAsync(_mainWindow.SettingsWindow, _mainWindow); _mainWindow.SettingsWindow = null; - this.Close(); + Close(); }); } } diff --git a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs index c54cd390c..34e45114a 100644 --- a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs +++ b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs @@ -1,26 +1,5 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.Platform.Storage; -using CommunityToolkit.Mvvm.Input; -using LibHac.Fs; -using LibHac.Tools.FsSystem.NcaUtils; -using Ryujinx.Ava.Common; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models; -using Ryujinx.Ava.Systems.AppLibrary; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ava.UI.Views.Dialog; -using Ryujinx.Ava.UI.Windows; -using Ryujinx.Ava.Utilities; -using Ryujinx.Common.Configuration; -using Ryujinx.Common.Helper; -using Ryujinx.HLE.HOS; -using SkiaSharp; -using System; -using System.Collections.Generic; -using System.IO; -using Path = System.IO.Path; namespace Ryujinx.Ava.UI.Controls { diff --git a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs index c9d1c79c2..4d83da546 100644 --- a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs +++ b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs @@ -2,17 +2,15 @@ using Avalonia.Logging; using Avalonia.Utilities; using Gommon; using Ryujinx.Ava.Systems.Configuration; -using Ryujinx.Common.Logging; using System; using System.Text; +using AvaLogger = Avalonia.Logging.Logger; +using AvaLogLevel = Avalonia.Logging.LogEventLevel; +using RyuLogClass = Ryujinx.Common.Logging.LogClass; +using RyuLogger = Ryujinx.Common.Logging.Logger; namespace Ryujinx.Ava.UI.Helpers { - using AvaLogger = Avalonia.Logging.Logger; - using AvaLogLevel = LogEventLevel; - using RyuLogClass = LogClass; - using RyuLogger = Ryujinx.Common.Logging.Logger; - internal class LoggerAdapter : ILogSink { private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog; diff --git a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs index c7d217bf5..b5fda471c 100644 --- a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs +++ b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -36,7 +35,7 @@ namespace Ryujinx.Ava.UI.Helpers [UnmanagedFunctionPointer(CallingConvention.Winapi)] internal delegate nint WindowProc(nint hWnd, WindowsMessages msg, nint wParam, nint lParam); - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct WndClassEx { public int cbSize; diff --git a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs index 526e63afe..477649909 100644 --- a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs @@ -257,7 +257,7 @@ namespace Ryujinx.Ava.UI.Models.Input Led = new LedConfigController { EnableLed = EnableLedChanging, - TurnOffLed = this.TurnOffLed, + TurnOffLed = TurnOffLed, UseRainbow = UseRainbowLed, LedColor = LedColor.ToUInt32() }, diff --git a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs index 0213d72fe..c8169b6d5 100644 --- a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs @@ -2,7 +2,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Keyboard; -using System.Xml.Linq; namespace Ryujinx.Ava.UI.Models.Input { diff --git a/src/Ryujinx/UI/Renderer/RendererHost.cs b/src/Ryujinx/UI/Renderer/RendererHost.cs index 9d24fbbad..7df02629e 100644 --- a/src/Ryujinx/UI/Renderer/RendererHost.cs +++ b/src/Ryujinx/UI/Renderer/RendererHost.cs @@ -37,7 +37,6 @@ namespace Ryujinx.Ava.UI.Renderer _ => throw new NotImplementedException() }; - private void Initialize() { EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated; diff --git a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs index 8a5ae441b..e24c574bb 100644 --- a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs @@ -1,10 +1,10 @@ using Gommon; +using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Systems; using Ryujinx.Ava.Systems.AppLibrary; using System; using System.Collections.Generic; using System.Linq; -using Ryujinx.Ava.Common.Locale; namespace Ryujinx.Ava.UI.ViewModels { @@ -30,19 +30,18 @@ namespace Ryujinx.Ava.UI.ViewModels public string BootsInfoText { get; set; } public string NothingInfoText { get; set; } - private IEnumerable _currentEntries = CompatibilityDatabase.Entries; private string[] _ownedGameTitleIds = []; - private Func _sortKeySelector = x => x.GameName; // Default sort by GameName + private readonly Func _sortKeySelector = x => x.GameName; // Default sort by GameName public IEnumerable CurrentEntries => OnlyShowOwnedGames ? _currentEntries.Where(x => x.TitleId.Check(tid => _ownedGameTitleIds.ContainsIgnoreCase(tid))) : _currentEntries; - public CompatibilityViewModel() {} + public CompatibilityViewModel() { } private void AppCountUpdated(object _, ApplicationCountUpdatedEventArgs __) => _ownedGameTitleIds = _appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray(); @@ -57,11 +56,11 @@ namespace Ryujinx.Ava.UI.ViewModels public void CountByStatus() { - PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); - InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); - MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); - BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); - NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); + PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); + InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); + MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); + BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); + NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); _onlyShowOwnedGames = true; } @@ -87,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public void NameSorting(int nameSort = 0) { _sorting.Name = nameSort; @@ -162,6 +160,5 @@ namespace Ryujinx.Ava.UI.ViewModels }; } } - } } diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 81aae6b74..f96b8a138 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -1,7 +1,6 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Svg.Skia; -using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; using Gommon; using Ryujinx.Ava.Common.Locale; @@ -100,7 +99,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense"); public event Action NotifyChangesEvent; - + public string ChosenProfile { get => _chosenProfile; @@ -327,13 +326,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld])); } - - private void LoadConfiguration(InputConfig inputConfig = null) { if (UseGlobalConfig && Program.UseExtraConfig) { - Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); + Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); } else { @@ -980,7 +977,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (Device == 0) { - newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == this.PlayerId)); + newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == PlayerId)); } else { diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 8b9b04511..06fb9c13a 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -57,7 +57,6 @@ using Key = Ryujinx.Input.Key; using MissingKeyException = LibHac.Common.Keys.MissingKeyException; using Path = System.IO.Path; using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState; -using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId; namespace Ryujinx.Ava.UI.ViewModels { @@ -1595,9 +1594,9 @@ namespace Ryujinx.Ava.UI.ViewModels // Code where conditions will be executed after loading user configuration if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit) { - Rebooter.RebootAppWithGame(application.Path, + Rebooter.RebootAppWithGame(application.Path, [ - "--bt", + "--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() ]); diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 654eb0c43..e684d6400 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -86,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle); public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1; - public int ResolutionScale { get => _resolutionScale; @@ -144,11 +143,11 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } public bool EnableMouse { get; set; } - public bool DisableInputWhenOutOfFocus { get; set; } + public bool DisableInputWhenOutOfFocus { get; set; } public int FocusLostActionType { get; set; } public bool UseGlobalInputConfig - { + { get => _useInputGlobalConfig; set { @@ -163,7 +162,7 @@ namespace Ryujinx.Ava.UI.ViewModels public VSyncMode VSyncMode { - get => _vSyncMode; + get => _vSyncMode; set { if (value is VSyncMode.Custom or VSyncMode.Switch or VSyncMode.Unbounded) @@ -226,7 +225,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnablePptc { get; set; } public bool EnableLowPowerPptc { get; set; } - public long TurboMultiplier { get => _turboModeMultiplier; @@ -577,7 +575,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void LoadCurrentConfiguration(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; // User Interface EnableDiscordIntegration = config.EnableDiscordIntegration; @@ -688,7 +686,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void SaveSettings(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; // User Interface config.EnableDiscordIntegration.Value = EnableDiscordIntegration; diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs index 02e6e99c9..c485699bd 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs @@ -100,7 +100,7 @@ namespace Ryujinx.Ava.UI.Views.Input { _currentAssigner = new ButtonKeyAssigner(button); - this.Focus(NavigationMethod.Pointer); + Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs index b9a5462b2..043222011 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Views.Settings { _currentAssigner = new ButtonKeyAssigner(button); - this.Focus(NavigationMethod.Pointer); + Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs index 283efd083..319015c70 100644 --- a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs @@ -1,6 +1,6 @@ using Avalonia.Controls; -using Ryujinx.Ava.Common.Locale; using Avalonia.Interactivity; +using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Systems.Configuration; using Ryujinx.Ava.UI.ViewModels; using System.Threading.Tasks; @@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows if (DataContext is not CompatibilityViewModel cvm) return; - cvm.NameSorting(int.Parse(sortStrategy)); + cvm.NameSorting(int.Parse(sortStrategy)); } } @@ -65,6 +65,5 @@ namespace Ryujinx.Ava.UI.Windows cvm.StatusSorting(int.Parse(sortStrategy)); } } - } } diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index a2d7ff657..0380cb596 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Windows InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver()); _ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it); - this.ScalingChanged += OnScalingChanged; + ScalingChanged += OnScalingChanged; } } @@ -157,7 +157,7 @@ namespace Ryujinx.Ava.UI.Windows private void OnScalingChanged(object sender, EventArgs e) { - Program.DesktopScaleFactor = this.RenderScaling; + Program.DesktopScaleFactor = RenderScaling; } private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e) @@ -563,16 +563,16 @@ namespace Ryujinx.Ava.UI.Windows public static void UpdateGraphicsConfig() { -#pragma warning disable IDE0055 // Disable formatting - GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 - ? ConfigurationState.Instance.Graphics.ResScaleCustom + + GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 + ? ConfigurationState.Instance.Graphics.ResScaleCustom : ConfigurationState.Instance.Graphics.ResScale; - GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; - GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; - GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; + GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; + GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; + GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression; - GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; -#pragma warning restore IDE0055 + GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; + } private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e) diff --git a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs index c6e8894e2..66cdc6125 100644 --- a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs +++ b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs @@ -43,7 +43,7 @@ namespace Ryujinx.Ava.Utilities.SystemInfo return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim(); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct MemoryStatusEx { public uint Length; diff --git a/src/Spv.Generator/InstructionOperands.cs b/src/Spv.Generator/InstructionOperands.cs index 38c2b1f2c..7d6b064ad 100644 --- a/src/Spv.Generator/InstructionOperands.cs +++ b/src/Spv.Generator/InstructionOperands.cs @@ -21,11 +21,11 @@ namespace Spv.Generator { if (Count > InternalCount) { - return MemoryMarshal.CreateSpan(ref this.Overflow[0], Count); + return MemoryMarshal.CreateSpan(ref Overflow[0], Count); } else { - return MemoryMarshal.CreateSpan(ref this.Operand1, Count); + return MemoryMarshal.CreateSpan(ref Operand1, Count); } } @@ -33,7 +33,7 @@ namespace Spv.Generator { if (Count < InternalCount) { - MemoryMarshal.CreateSpan(ref this.Operand1, Count + 1)[Count] = operand; + MemoryMarshal.CreateSpan(ref Operand1, Count + 1)[Count] = operand; Count++; } else @@ -41,7 +41,7 @@ namespace Spv.Generator if (Overflow == null) { Overflow = new IOperand[InternalCount * 2]; - MemoryMarshal.CreateSpan(ref this.Operand1, InternalCount).CopyTo(Overflow.AsSpan()); + MemoryMarshal.CreateSpan(ref Operand1, InternalCount).CopyTo(Overflow.AsSpan()); } else if (Count == Overflow.Length) { From b51ad11574173d7c08c2a5aa5f1f541c3db76c77 Mon Sep 17 00:00:00 2001 From: shinyoyo Date: Wed, 11 Jun 2025 19:43:50 -0500 Subject: [PATCH 12/34] Updated Simplified Chinese translation (ryubing/ryujinx!58) See merge request ryubing/ryujinx!58 --- assets/locales.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/locales.json b/assets/locales.json index 5bb8a1d51..a88b07b01 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -13143,7 +13143,7 @@ "th_TH": "", "tr_TR": "", "uk_UA": "", - "zh_CN": "", + "zh_CN": "无法转换从更新服务器接收的 Ryujinx 版本。", "zh_TW": "" } }, @@ -16568,7 +16568,7 @@ "th_TH": "", "tr_TR": "", "uk_UA": "", - "zh_CN": "", + "zh_CN": "如果在自定义设置中启用了此选项,则将使用全局输入配置。\n\n在全局设置中: 您可以根据需要启用或禁用它;之后创建的任何自定义配置都将继承此设置。", "zh_TW": "" } }, @@ -25023,4 +25023,4 @@ } } ] -} \ No newline at end of file +} From 908273d848f4fd78a289e0afc68195c25369825d Mon Sep 17 00:00:00 2001 From: GreemDev Date: Fri, 13 Jun 2025 01:57:07 -0500 Subject: [PATCH 13/34] [ci skip] UpdateClient package source https://git.ryujinx.app/ryubing/update-server/-/packages --- nuget.config | 1 + 1 file changed, 1 insertion(+) diff --git a/nuget.config b/nuget.config index f24a44b48..dc4af42a7 100644 --- a/nuget.config +++ b/nuget.config @@ -6,5 +6,6 @@ + From aa9e74339b0cdf807ed8ffb65dfea845658b7b93 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Fri, 13 Jun 2025 01:57:41 -0500 Subject: [PATCH 14/34] Add support for notifying the update server when a new update has been pushed instead of relying on periodic refreshes --- .github/workflows/canary.yml | 4 ++++ .github/workflows/release.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index db38c9f99..cf250eb08 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -243,3 +243,7 @@ jobs: - name: Send notification webhook run: | gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/canary --command=SendUpdateMessage "${{ steps.version_info.outputs.build_version }}|FF4500|${{ secrets.CANARY_DISCORD_WEBHOOK }}|https://avatars.githubusercontent.com/u/192939710?s=200&v=4|false" + + - name: Notify update server of new builds + run: | + curl 'https://update.ryujinx.app/api/v1/admin/refresh_cache?rc=canary' -X PATCH -H 'accept: */*' -H 'Authorization: ${{ secrets.UPDATE_SERVER_ADMIN_TOKEN }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 279b2f36b..9f2099719 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -228,3 +228,7 @@ jobs: - name: Send notification webhook run: | gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/ryujinx --command=SendUpdateMessage "${{ steps.version_info.outputs.build_version }}|32cd32|${{ secrets.STABLE_DISCORD_WEBHOOK }}|https://avatars.githubusercontent.com/u/192939710?s=200&v=4|false" + + - name: Notify update server of new builds + run: | + curl 'https://update.ryujinx.app/api/v1/admin/refresh_cache?rc=stable' -X PATCH -H 'accept: */*' -H 'Authorization: ${{ secrets.UPDATE_SERVER_ADMIN_TOKEN }}' From bab3beb0ac5d0b0ae3004b740f26ac6e8e934f6d Mon Sep 17 00:00:00 2001 From: GreemDev Date: Fri, 13 Jun 2025 15:51:23 -0500 Subject: [PATCH 15/34] [ci skip] Forgot closing / lol --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index dc4af42a7..4e51027dc 100644 --- a/nuget.config +++ b/nuget.config @@ -6,6 +6,6 @@ - + From a1d44ec496fbefab54e5063243029f096e50ea7e Mon Sep 17 00:00:00 2001 From: WilliamWsyHK <25-WilliamWsyHK@users.noreply.git.ryujinx.app> Date: Sat, 14 Jun 2025 20:06:12 -0500 Subject: [PATCH 16/34] Update translation for Traditional Chinese (ryubing/ryujinx!61) See merge request ryubing/ryujinx!61 --- assets/locales.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/locales.json b/assets/locales.json index a88b07b01..8336adf94 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -2094,7 +2094,7 @@ "tr_TR": "Toplam Oyun Süresi: {0}", "uk_UA": "", "zh_CN": "总游戏时间: {0}", - "zh_TW": "" + "zh_TW": "總遊戲時間: {0}" } }, { @@ -7219,7 +7219,7 @@ "tr_TR": "", "uk_UA": "", "zh_CN": "发现配置:\n\n名称:\t{0}\nGUID:\t{1}\n\n 正在等待控制器连接...", - "zh_TW": "" + "zh_TW": "找到控制器的配置:\n\n名稱:\t{0}\nGUID:\t{1}\n\n 正在等待控制器連線..." } }, { @@ -13144,7 +13144,7 @@ "tr_TR": "", "uk_UA": "", "zh_CN": "无法转换从更新服务器接收的 Ryujinx 版本。", - "zh_TW": "" + "zh_TW": "無法轉換從更新何服器接收的 Ryujinx 版本。" } }, { @@ -16569,7 +16569,7 @@ "tr_TR": "", "uk_UA": "", "zh_CN": "如果在自定义设置中启用了此选项,则将使用全局输入配置。\n\n在全局设置中: 您可以根据需要启用或禁用它;之后创建的任何自定义配置都将继承此设置。", - "zh_TW": "" + "zh_TW": "如果在自訂設定啟用了此選項,則將使用全域輸入配置。\n\n在全域設定中:你可以根據需要啟用或停用它;之後建立的任何自訂配置都將繼承此設定。" } }, { @@ -18544,7 +18544,7 @@ "tr_TR": "", "uk_UA": "", "zh_CN": "{0} FPS ({1}毫秒)", - "zh_TW": "" + "zh_TW": "{0} FPS ({1}毫秒)" } }, { @@ -23444,7 +23444,7 @@ "tr_TR": "", "uk_UA": "", "zh_CN": "查看更新日志", - "zh_TW": "" + "zh_TW": "檢視更新日誌" } }, { From 7bc80ed4fee9befd85f51af7ede0a19d90a27035 Mon Sep 17 00:00:00 2001 From: Godzilaa4 Date: Sun, 15 Jun 2025 10:28:41 -0500 Subject: [PATCH 17/34] Updated Brazilian Portuguese translation (ryubing/ryujinx!62) See merge request ryubing/ryujinx!62 --- assets/locales.json | 90 ++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/assets/locales.json b/assets/locales.json index 8336adf94..a53c0047a 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -187,7 +187,7 @@ "ko_KR": "소프트웨어", "no_NO": "Programvare", "pl_PL": "Oprogramowanie", - "pt_BR": "", + "pt_BR": "Programa", "ru_RU": "Программное обеспечение", "sv_SE": "Programvara", "th_TH": "ซอฟต์แวร์", @@ -2537,7 +2537,7 @@ "ko_KR": "PPTC 디렉터리 열기", "no_NO": "Åpne PPTC mappe", "pl_PL": "Otwórz katalog PPTC", - "pt_BR": "Abrir Diretório de PPTC Cache", + "pt_BR": "Abrir Diretório de Cache PPTC", "ru_RU": "Открыть папку PPTC", "sv_SE": "Öppna PPTC-katalog", "th_TH": "เปิดไดเรกทอรี่ PPTC", @@ -2912,7 +2912,7 @@ "ko_KR": "사용자 정의 구성 만들기", "no_NO": "Opprett egendefinert konfigurasjon", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Criar Configuração Custumizada", "ru_RU": "Задать индивидуальные параметры", "sv_SE": "Skapa anpassad konfiguration", "th_TH": "", @@ -2937,7 +2937,7 @@ "ko_KR": "사용자 정의 구성 편집", "no_NO": "Rediger egendefinert konfigurasjon", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Editar Configuração Customizada", "ru_RU": "Изменить индивидуальные параметры", "sv_SE": "Redigera anpassad konfiguration", "th_TH": "", @@ -3012,7 +3012,7 @@ "ko_KR": "선택한 게임에 대한 기존 독립 구성 편집", "no_NO": "Rediger din eksisterende uavhengige konfigurasjon for det valgte spillet", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Editar sua configuração independente existente para o jogo selecionado", "ru_RU": "Отредактировать существующие независимые параметры для выбранной игры.", "sv_SE": "Redigera din befintliga oberoende konfiguration för det valda spelet", "th_TH": "", @@ -3162,7 +3162,7 @@ "ko_KR": "앱의 모드가 포함된 디렉터리 열기", "no_NO": "Åpner mappen som inneholder programmets modifikasjoner", "pl_PL": "Otwiera katalog zawierający mody dla danej aplikacji", - "pt_BR": "Abre a pasta que contém os mods da aplicação ", + "pt_BR": "Abre a pasta que contém os mods da aplicação", "ru_RU": "Открывает папку, содержащую моды для приложений и игр", "sv_SE": "Öppnar katalogen som innehåller applikationens Mods", "th_TH": "เปิดไดเร็กทอรี่ Mods ของแอปพลิเคชัน", @@ -3987,7 +3987,7 @@ "ko_KR": "원래 UI 스타일 표시(다시 시작 필요)", "no_NO": "Vis original UI-stil (krever omstart)", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Mostrar Estilo Original da Interface (Requer Reinicialização)", "ru_RU": "Включить оригинальный интерфейса (требуется перезагрузка)", "sv_SE": "Visa ursprunglig gränssnittsstil (kräver omstart)", "th_TH": "", @@ -4012,7 +4012,7 @@ "ko_KR": "Ryujinx 1.1.1403을 연상시키는 이전 Avalonia Ryujinx UI를 표시합니다. 이 기능은 Windows가 아닌 플랫폼에서는 기본적으로 활성화됩니다.\n 클래식 스타일의 타이틀 바가 돌아왔고 주요 창 레이아웃 재작업이 역전되었습니다. 이 툴팁 위의 설정 탐색 배치와 같은 작업입니다.", "no_NO": "Vis det eldre Avalonia Ryujinx-grensesnittet som minner om Ryujinx 1.1.1403. Dette er aktivert som standard på plattformer som ikke er Windows.\nTittellinjen i klassisk stil er tilbake, og store omarbeidinger av vindusoppsettet er reversert, for eksempel plasseringen av innstillingsnavigasjonen over dette verktøytipset.", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Mostrar a Interface Avalonia antiga do Ryujinx 1.1.1403. Esta versão é ativada por padrão nas plataformas que não sejam Windows. \nO estilo clássico da Barra de Título retorna e grande parte das mudanças do Layout de janela são revertidas; assim como as configurações de posicionamento da navegação acima dessa descrição.", "ru_RU": "Показать старый пользовательский интерфейс Avalonia Ryujinx, напоминающий Ryujinx 1.1.1403. Включено по умолчанию на платформах, отличных от Windows.\nСтрока заголовка в классическом стиле вернётся на место, а основные изменения в оформлении окна будут отменены; например, расположение навигации по настройкам над этой всплывающей подсказкой.", "sv_SE": "Visa det gamla Ryuijinx-gränssnittet baserat på Avalonia som påminner om version 1.1.1403. Detta är aktiverat som standard på plattformat som inte är Windows.\nDen klassiska titelfältet är tillbaka och de stora omarbetningarna av fönsterlayouten är omvända, till exempel placeringen av inställningsnavigeringen ovanför detta verktygstips.", "th_TH": "", @@ -5087,7 +5087,7 @@ "ko_KR": "터보 모드 배수 :", "no_NO": "Multiplikator i turbomodus:", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Multiplicador do Modo Turbo", "ru_RU": "", "sv_SE": "Multiplikator för turboläge:", "th_TH": "", @@ -5112,7 +5112,7 @@ "ko_KR": "터보 모드 배수 목표 값입니다.\n\n모르면 200으로 두세요.", "no_NO": "Målverdien for multiplikatoren i turbomodus. \n\nLa syå på 200 hvis du er usikker.", "pl_PL": "", - "pt_BR": "", + "pt_BR": "O valor do Multiplicador do Modo Turbo. Deixe em 200 se não tiver certeza.", "ru_RU": "", "sv_SE": "Målvärdet för multiplikatorn i turboläget. \n\nLämna den på 200 om du är osäker.", "th_TH": "", @@ -5137,7 +5137,7 @@ "ko_KR": "터보 모드는 게임이 프레임 속도에 민감하지 않을 때 효과적으로 속도를 높이거나 낮추는 에뮬레이터 기능입니다.\n이 기능은 Ryujinx 키보드 단축키 설정에서 구성할 수 있는 단축키를 사용하여 게임 내에서 전환할 수 있습니다.\n\n모르면 200으로 두세요.", "no_NO": "Turbo-modus er en emulatorfunksjon som effektivt øker eller senker hastigheten når et spill ikke er følsom for bildefrekvens.\nDu kan slå på denne funksjonen i spillet med en hurtigtast, som kan konfigureres i Ryujinx Keyboard Hotkeys-innstillingene.\n\nLa den stå på 200 hvis du er usikker.", "pl_PL": "", - "pt_BR": "", + "pt_BR": "O Modo Turbo é um recurso do emulador que efetivamente aumenta ou dimimui a velocidade de um jogo quando o mesmo não é sensivel à taxa de quadros. \nVocê pode ativar esse recurso dentro do jogo com uma tecla de atalho, configurável nas Configurações de Teclas de Atalho do Ryujinx. \n\nDeixe em 200 se não tiver certeza.", "ru_RU": "", "sv_SE": "Turboläget är en emulatorfunktion som effektivt ökar eller sänker hastigheten när ett spel inte är känsligt för bildfrekvens.\nDu kan växla denna funktion i spelet med en snabbtangent, konfigurerbar i Ryujinx inställningar för snabbtangenter.\n\nLämna den på 200 om du är osäker.", "th_TH": "", @@ -5312,7 +5312,7 @@ "ko_KR": "핵", "no_NO": "", "pl_PL": "Hacki", - "pt_BR": "", + "pt_BR": "Trapaças", "ru_RU": "Хаки", "sv_SE": "Hack", "th_TH": "แฮ็ก", @@ -6112,7 +6112,7 @@ "ko_KR": "개발자 옵션", "no_NO": "Utvikleralternativer", "pl_PL": "Opcje programisty", - "pt_BR": "Opções do desenvolvedor", + "pt_BR": "Opções do Desenvolvedor", "ru_RU": "Параметры разработчика", "sv_SE": "Utvecklarinställningar", "th_TH": "ตัวเลือกนักพัฒนา", @@ -6237,7 +6237,7 @@ "ko_KR": "조각 기록 활성화", "no_NO": "Aktiver Stub-logger", "pl_PL": "Wlącz Skróty Logów", - "pt_BR": "Habilitar logs de Stub", + "pt_BR": "Habilitar Logs de Stub", "ru_RU": "Включить журнал-заглушку", "sv_SE": "Aktivera stubbloggar", "th_TH": "เปิดใช้งานการบันทึกประวัติ", @@ -6262,7 +6262,7 @@ "ko_KR": "정보 기록 활성화", "no_NO": "Aktiver informasjonslogger", "pl_PL": "Włącz Logi Informacyjne", - "pt_BR": "Habilitar logs de Informação", + "pt_BR": "Habilitar Logs de Informação", "ru_RU": "Включить информационный журнал", "sv_SE": "Aktivera informationsloggar", "th_TH": "เปิดใช้งานการบันทึกประวัติการใช้งาน", @@ -6462,7 +6462,7 @@ "ko_KR": "개발자 옵션", "no_NO": "Utvikleralternativer", "pl_PL": "Opcje programisty (UWAGA: wpływa na wydajność)", - "pt_BR": "Opções do desenvolvedor", + "pt_BR": "Opções do Desenvolvedor", "ru_RU": "Параметры разработчика", "sv_SE": "Utvecklarinställningar", "th_TH": "ตัวเลือกนักพัฒนา", @@ -7212,7 +7212,7 @@ "ko_KR": "발견된 구성 :\n\n이름 : \t{0}\n가이드 : \t{1}\n\n 컨트롤러 연결 대기 중...", "no_NO": "", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Configuração encontrada:\n\nNome:\t{0}\nGUID:\t{1}\n\n Aguardando conexão do controle...", "ru_RU": "", "sv_SE": "", "th_TH": "", @@ -10912,7 +10912,7 @@ "ko_KR": "좌측 스틱 버튼", "no_NO": "Venstre Styrespak Trykk", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Botão Analógico Esquerdo", "ru_RU": "Кнопка лев. стика", "sv_SE": "L-spakknapp", "th_TH": "", @@ -10937,7 +10937,7 @@ "ko_KR": "우측 스틱 버튼", "no_NO": "Høyre Styrespak Trykk", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Botão Analógico Direito", "ru_RU": "Кнопка пр. стика", "sv_SE": "R-spakknapp", "th_TH": "", @@ -10962,7 +10962,7 @@ "ko_KR": "좌측 숄더", "no_NO": "Venstre Skulder", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Ombro Esquerdo", "ru_RU": "Левый бампер", "sv_SE": "Vänster kantknapp", "th_TH": "", @@ -10987,7 +10987,7 @@ "ko_KR": "우측 숄더", "no_NO": "Høyre Skulder", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Ombro Direito", "ru_RU": "Правый бампер", "sv_SE": "Höger kantknapp", "th_TH": "", @@ -11012,7 +11012,7 @@ "ko_KR": "좌측 트리거", "no_NO": "Venstre utløser", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Gatilho Esquerdo", "ru_RU": "Левый триггер", "sv_SE": "Vänster avtryckare", "th_TH": "", @@ -11037,7 +11037,7 @@ "ko_KR": "우측 트리거", "no_NO": "Høyre utløser", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Gatilho Direito", "ru_RU": "Правый триггер", "sv_SE": "Höger avtryckare", "th_TH": "", @@ -11062,7 +11062,7 @@ "ko_KR": "↑", "no_NO": "Opp", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Cima", "ru_RU": "Вверх", "sv_SE": "Upp", "th_TH": "", @@ -11087,7 +11087,7 @@ "ko_KR": "↓", "no_NO": "Ned", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Baixo", "ru_RU": "Вниз", "sv_SE": "Ner", "th_TH": "", @@ -11112,7 +11112,7 @@ "ko_KR": "←", "no_NO": "Venstre", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Esquerda", "ru_RU": "Влево", "sv_SE": "Vänster", "th_TH": "", @@ -11137,7 +11137,7 @@ "ko_KR": "→", "no_NO": "Høyre", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Direita", "ru_RU": "Вправо", "sv_SE": "Höger", "th_TH": "", @@ -11212,7 +11212,7 @@ "ko_KR": "가이드", "no_NO": "Veiledning", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Guia", "ru_RU": "Кнопка меню", "sv_SE": "", "th_TH": "", @@ -11387,7 +11387,7 @@ "ko_KR": "좌측 트리거 0", "no_NO": "Venstre utløser 0", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Gatilho Esquerdo 0", "ru_RU": "Левый триггер 0", "sv_SE": "Vänster avtryckare 0", "th_TH": "", @@ -11412,7 +11412,7 @@ "ko_KR": "우측 트리거 0", "no_NO": "Høyre utløser 0", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Gatilho Direito 0", "ru_RU": "Правый триггер 0", "sv_SE": "Höger avtryckare 0", "th_TH": "", @@ -11437,7 +11437,7 @@ "ko_KR": "좌측 트리거 1", "no_NO": "Venstre utløser 1", "pl_PL": "", - "pt_BR": "", + "pt_BR": " Gatilho Esquerdo 1", "ru_RU": "Левый триггер 1", "sv_SE": "Vänster avtryckare 1", "th_TH": "", @@ -11462,7 +11462,7 @@ "ko_KR": "우측 트리거 1", "no_NO": "Høyre utløser 1", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Gatilho Direito 1", "ru_RU": "Правый триггер 1", "sv_SE": "Höger avtryckare 1", "th_TH": "", @@ -11487,7 +11487,7 @@ "ko_KR": "좌측 스틱", "no_NO": "Venstre styrespak", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Analógico Esquerdo", "ru_RU": "Левый стик", "sv_SE": "Vänster spak", "th_TH": "", @@ -11512,7 +11512,7 @@ "ko_KR": "우측 스틱", "no_NO": "Høyre styrespak", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Analógico Direito", "ru_RU": "Правый стик", "sv_SE": "Höger spak", "th_TH": "", @@ -11787,7 +11787,7 @@ "ko_KR": "사용자 지정 프로필 이미지를 가져오거나 시스템 펌웨어에서 아바타 선택 가능", "no_NO": "Du kan importere et tilpasset profilbilde, eller velge en avatar fra system fastvare", "pl_PL": "Możesz zaimportować niestandardowy obraz profilu lub wybrać awatar z firmware'u systemowego", - "pt_BR": "Você pode importar uma imagem customizada, ou selecionar um avatar do firmware", + "pt_BR": "Você pode importar uma imagem customizada, ou selecionar um avatar do Firmware", "ru_RU": "Вы можете импортировать собственное изображение или выбрать аватар из системной прошивки.", "sv_SE": "Du kan importera en anpassad profilbild eller välja en avatar från systemets firmware", "th_TH": "คุณสามารถนำเข้ารูปโปรไฟล์ที่กำหนดเองได้ หรือ เลือกรูปที่มีจากระบบ", @@ -13087,7 +13087,7 @@ "ko_KR": "업데이트가 취소되었습니다!", "no_NO": "Avbryter oppdatering!", "pl_PL": "Anulowanie aktualizacji!", - "pt_BR": "Cancelando atualização!", + "pt_BR": "Atualização Cancelada!", "ru_RU": "Отмена обновления...", "sv_SE": "Avbryter uppdatering!", "th_TH": "ยกเลิกการอัพเดต!", @@ -16562,7 +16562,7 @@ "ko_KR": "사용자 지정 설정에서 이 옵션을 활성화하면 전역 입력 구성이 사용됩니다.\n\n전역 설정에서 필요에 따라 활성화하거나 비활성화할 수 있습니다. 이 설정은 새로 생성된 모든 사용자 지정 구성에 상속됩니다.", "no_NO": "", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Se esta opção está ativada nas configurações customizadas, as configurações globais de entrada serão usadas.\n\nNas configurações globais: você pode ativar ou desativá-las se necessário; está configuração será herdada por qualquer nova configuração customizada criada.", "ru_RU": "Если эта опция включена в пользовательских настройках, будет использована глобальная конфигурация ввода.\n\nВ глобальных настройках: переключите эту опцию по своему усмотрению, это будет унаследовано для вновь созданых пользовательских конфигураций", "sv_SE": "", "th_TH": "", @@ -23062,7 +23062,7 @@ "ko_KR": "근린", "no_NO": "Nærmeste", "pl_PL": "Najbliższe", - "pt_BR": "", + "pt_BR": "Mais Próximo", "ru_RU": "Ступенчатая", "sv_SE": "Närmaste", "th_TH": "ใกล้สุด", @@ -23437,7 +23437,7 @@ "ko_KR": "변경 로그 보기", "no_NO": "", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Ver Registro", "ru_RU": "", "sv_SE": "", "th_TH": "ด", @@ -24312,7 +24312,7 @@ "ko_KR": "터보 모드 :", "no_NO": "", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Modo Turbo:", "ru_RU": "", "sv_SE": "Turboläge:", "th_TH": "", @@ -24337,7 +24337,7 @@ "ko_KR": "터보 모드 단축키입니다.\nRyujinx CPU 설정에서 터보 모드의 동작을 구성합니다.\n\n모르면 바인딩 해제 상태로 두세요.", "no_NO": "Hurtigtasten for turbo-modus.\nKonfigurer oppførselen til turbo-modus i Ryujinx CPU-innstillinger.\n\nLa være ubundet hvis du er usikker.", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Tecla de atalho do Modo Turbo.\nConfigure o comportamento do Modo Turbo nas configurações de CPU do Ryujinx.\n\nDeixe Não Atribuído se não tiver certeza.", "ru_RU": "", "sv_SE": "Snabbtangenten för turboläge.\nKonfigurera beteendet för turboläge i Ryujinx CPU-inställningar.\n\nLämna Obunden om du är osäker.", "th_TH": "", @@ -24362,7 +24362,7 @@ "ko_KR": "누르고 있는 동안만", "no_NO": "Bare mens du trykker på", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Somente enquanto pressionado.", "ru_RU": "", "sv_SE": "Endast när du trycker ner", "th_TH": "", @@ -24412,7 +24412,7 @@ "ko_KR": "호환성 목록 - {0}개 항목", "no_NO": "Kompatibilitetsliste - {0} oppføringer", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Lista de Compatibilidade - {0} registros", "ru_RU": "Список совместимости — записей: {0}", "sv_SE": "Kompatibilitetslista - {0} poster", "th_TH": "", @@ -24487,7 +24487,7 @@ "ko_KR": "어카이브 {0} 호환성 항목...", "no_NO": "Søk i {0} kompatibilitetsoppføringer...", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Procurando {0} registros de compatibilidade...", "ru_RU": "Поиск среди {0} записей о совместимости...", "sv_SE": "Sök i {0} kompatibilitetsposter...", "th_TH": "", @@ -24912,7 +24912,7 @@ "ko_KR": "사용자 정의 설정", "no_NO": "Tilpasset konfigurasjon", "pl_PL": "", - "pt_BR": "", + "pt_BR": "Configurações Customizadas", "ru_RU": "Индивидуальные параметры", "sv_SE": "Anpassad konfiguration", "th_TH": "", From faf9e3cdd72b7e0b027bf5e4a325716c9c4dd71e Mon Sep 17 00:00:00 2001 From: Emiyl Date: Sun, 15 Jun 2025 18:24:45 -0500 Subject: [PATCH 18/34] macOS: Fix MoltenVK config packing (ryubing/ryujinx!65) See merge request ryubing/ryujinx!65 --- src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs index c0cf219b9..271999375 100644 --- a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs +++ b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs @@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK public static implicit operator Bool32(bool val) => new(val); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct MVKConfiguration { public Bool32 DebugMode; From 77a797f1549718f2ec06cc924d05f364f5c2e295 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Sun, 15 Jun 2025 20:45:26 -0500 Subject: [PATCH 19/34] Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" This reverts merge request !47 --- .editorconfig | 12 +- src/ARMeilleure/CodeGen/Arm64/Assembler.cs | 2 + .../CodeGen/Arm64/CodeGenerator.cs | 2 + src/ARMeilleure/CodeGen/X86/AssemblerTable.cs | 1 + .../CodeGen/X86/CallingConvention.cs | 12 +- src/ARMeilleure/CodeGen/X86/CodeGenContext.cs | 1 + src/ARMeilleure/CodeGen/X86/X86Register.cs | 2 + src/ARMeilleure/Instructions/CryptoHelper.cs | 48 +++--- src/ARMeilleure/Instructions/InstEmitMul.cs | 1 + .../Instructions/InstEmitSimdArithmetic.cs | 3 +- .../Instructions/InstEmitSimdCmp.cs | 4 +- .../Instructions/InstEmitSimdCmp32.cs | 4 +- .../Instructions/InstEmitSimdCvt.cs | 3 +- .../Instructions/InstEmitSimdHelper.cs | 7 +- .../Instructions/InstEmitSimdHelper32.cs | 7 +- .../Instructions/InstEmitSimdHelper32Arm64.cs | 7 +- .../Instructions/InstEmitSimdMemory.cs | 46 +++--- .../Instructions/InstEmitSimdShift.cs | 3 +- .../IntermediateRepresentation/Intrinsic.cs | 1 + .../MemoryOperand.cs | 3 +- src/ARMeilleure/Optimizations.cs | 6 +- .../Translation/ArmEmitterContext.cs | 56 +++---- src/ARMeilleure/Translation/PTC/Ptc.cs | 5 +- src/ARMeilleure/Translation/RegisterUsage.cs | 20 +-- .../SDL2HardwareDeviceDriver.cs | 38 +---- .../Native/SoundIo.cs | 2 +- .../Renderer/Common/UpdateDataHeader.cs | 2 + src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs | 3 +- .../Renderer/Server/AudioRenderSystem.cs | 4 +- .../Collections/TreeDictionary.cs | 6 +- .../Configuration/AspectRatioExtensions.cs | 2 + src/Ryujinx.Common/Configuration/DirtyHack.cs | 2 + src/Ryujinx.Common/Hash128.cs | 2 +- src/Ryujinx.Common/Logging/Logger.cs | 38 ++--- .../Memory/StructArrayHelpers.cs | 75 +-------- src/Ryujinx.Common/PreciseSleep/Nanosleep.cs | 2 +- src/Ryujinx.Common/ReleaseInformation.cs | 7 + .../SystemInterop/GdiPlusHelper.cs | 2 + .../WindowsMultimediaTimerResolution.cs | 2 +- src/Ryujinx.Common/Utilities/Buffers.cs | 4 +- .../Utilities/MessagePackObjectFormatter.cs | 4 +- src/Ryujinx.Common/Utilities/Rainbow.cs | 1 + .../AppleHv/DummyDiskCacheLoadState.cs | 17 ++ src/Ryujinx.Cpu/AppleHv/HvApi.cs | 8 +- src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs | 4 +- src/Ryujinx.Cpu/TickSource.cs | 1 + src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs | 2 +- src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs | 2 + .../Engine/Compute/ComputeClassState.cs | 4 +- .../Engine/Dma/DmaClassState.cs | 4 +- .../Engine/Dma/DmaTexture.cs | 4 +- .../Engine/GPFifo/CompressedMethod.cs | 4 +- .../Engine/GPFifo/GPEntry.cs | 8 +- .../Engine/GPFifo/GPFifoClassState.cs | 4 +- .../InlineToMemoryClassState.cs | 4 +- .../Engine/MME/MacroHLE.cs | 9 +- .../Engine/MmeShadowScratch.cs | 2 + .../Engine/Threed/IbStreamer.cs | 3 +- .../Engine/Threed/IndirectDrawType.cs | 2 + .../Engine/Threed/ThreedClassState.cs | 112 +++++++------ .../Engine/Twod/TwodClassState.cs | 8 +- .../Engine/Twod/TwodTexture.cs | 4 +- .../Engine/Types/GpuVa.cs | 3 +- .../Engine/Types/MemoryLayout.cs | 3 +- .../Engine/Types/SbDescriptor.cs | 3 +- src/Ryujinx.Graphics.Gpu/GpuContext.cs | 1 + src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs | 3 +- .../Image/SamplerDescriptor.cs | 2 + .../Image/TextureDescriptor.cs | 3 +- .../Shader/ShaderAddresses.cs | 3 +- .../Host1xClassRegisters.cs | 4 +- src/Ryujinx.Graphics.Host1x/ThiRegisters.cs | 4 +- .../Native/AVCodec.cs | 4 +- .../Native/AVCodec501.cs | 4 +- .../Native/AVCodecContext.cs | 4 +- .../Native/AVFrame.cs | 3 +- .../Native/AVPacket.cs | 4 +- .../Native/FFCodec.cs | 3 +- .../Native/FFCodecLegacy.cs | 3 +- .../Types/LoopFilterThresh.cs | 4 +- src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs | 4 +- src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs | 4 +- .../Types/H264/PictureInfo.cs | 6 +- .../Types/H264/ReferenceFrame.cs | 3 +- .../Types/Vp8/PictureInfo.cs | 3 +- .../Types/Vp9/EntropyProbs.cs | 3 +- .../Types/Vp9/FrameSize.cs | 4 +- .../Types/Vp9/FrameStats.cs | 4 +- .../Types/Vp9/LoopFilter.cs | 4 +- .../Types/Vp9/PictureInfo.cs | 3 +- .../Types/Vp9/Segmentation.cs | 4 +- src/Ryujinx.Graphics.OpenGL/FormatTable.cs | 2 +- .../Glsl/Instructions/InstGenHelper.cs | 2 +- .../CodeGen/Glsl/Instructions/InstType.cs | 1 + .../CodeGen/Spirv/CodeGenContext.cs | 3 +- .../CodeGen/Spirv/Instructions.cs | 7 +- .../CodeGen/Spirv/SpirvGenerator.cs | 9 +- .../Decoders/InstDecoders.cs | 16 +- .../Decoders/InstTable.cs | 2 +- .../Instructions/InstEmitBarrier.cs | 4 +- .../Instructions/InstEmitIntegerArithmetic.cs | 5 +- .../Instructions/InstEmitIntegerComparison.cs | 5 +- .../TextureFlags.cs | 1 + .../StructuredIr/InstructionInfo.cs | 2 +- src/Ryujinx.Graphics.Shader/TextureFormat.cs | 2 +- .../Translation/AggregateType.cs | 1 + .../Translation/EmitterContext.cs | 12 +- .../Astc/AstcPixel.cs | 2 +- .../Astc/BitStream128.cs | 22 ++- .../Types/ClearRectStruct.cs | 3 +- .../Types/ConfigStruct.cs | 4 +- .../Types/OutputConfig.cs | 3 +- .../Types/OutputSurfaceConfig.cs | 3 +- src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs | 4 +- src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs | 3 +- src/Ryujinx.Graphics.Vic/VicRegisters.cs | 8 +- src/Ryujinx.Graphics.Vulkan/BufferHolder.cs | 2 +- src/Ryujinx.Graphics.Vulkan/FormatTable.cs | 2 +- src/Ryujinx.Graphics.Vulkan/HelperShader.cs | 2 +- .../IndexBufferPattern.cs | 1 + src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 6 - .../Controller/ControllerSupportArgHeader.cs | 3 +- .../Controller/ControllerSupportArgPrivate.cs | 3 +- .../Controller/ControllerSupportArgV7.cs | 3 +- .../Controller/ControllerSupportArgVPre7.cs | 3 +- .../Controller/ControllerSupportResultInfo.cs | 3 +- .../HOS/Applets/Error/ErrorApplet.cs | 2 +- .../PlayerSelect/PlayerSelectApplet.cs | 3 +- .../SoftwareKeyboardApplet.cs | 4 +- .../Demangler/Ast/ForwardTemplateReference.cs | 3 +- src/Ryujinx.HLE/HOS/Horizon.cs | 3 +- .../HOS/Kernel/Ipc/KLightClientSession.cs | 3 +- .../HOS/Kernel/Ipc/KLightServerSession.cs | 3 +- src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs | 2 + .../HOS/Kernel/Memory/KPageHeap.cs | 3 +- .../Kernel/Process/ProcessCreationFlags.cs | 1 + .../HOS/Kernel/SupervisorCall/MemoryInfo.cs | 4 +- .../HOS/Kernel/SupervisorCall/Syscall.cs | 88 +++++----- .../Kernel/SupervisorCall/ThreadContext.cs | 6 +- .../Acc/AccountService/ManagerServer.cs | 11 +- .../HOS/Services/Account/Acc/Types/UserId.cs | 2 +- .../SystemAppletProxy/IAudioController.cs | 18 ++- .../SystemAppletProxy/ICommonStateGetter.cs | 2 + .../ILibraryAppletCreator.cs | 5 +- .../SystemAppletProxy/ISelfController.cs | 8 +- .../HOS/Services/Am/AppletAE/AppletFifo.cs | 6 +- .../HOS/Services/Am/AppletAE/AppletSession.cs | 6 +- .../Services/Arp/ApplicationLaunchProperty.cs | 3 +- .../Services/Bluetooth/IBluetoothDriver.cs | 2 + .../HOS/Services/Caps/CaptureManager.cs | 5 +- .../Caps/IScreenShotApplicationService.cs | 12 +- .../HOS/Services/Fatal/IService.cs | 2 +- .../HOS/Services/Fs/IFileSystemProxy.cs | 14 +- src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs | 1 + .../Services/Hid/HidDevices/NpadDevices.cs | 1 - .../HidServer/IActiveVibrationDeviceList.cs | 4 +- .../HOS/Services/Hid/IHidServer.cs | 52 ++++-- .../HOS/Services/Hid/Types/Npad/BusHandle.cs | 2 +- .../Hid/Types/SharedMemory/Common/RingLifo.cs | 6 +- .../SharedMemory/Npad/NpadGcTriggerState.cs | 4 +- .../SharedMemory/Npad/NpadInternalState.cs | 8 +- .../SharedMemory/TouchScreen/TouchState.cs | 11 +- src/Ryujinx.HLE/HOS/Services/IpcService.cs | 5 +- .../LdnMitm/Proxy/LdnProxyTcpSession.cs | 4 +- .../HOS/Services/Loader/ResultCode.cs | 2 + .../HOS/Services/Mii/Types/StoreData.cs | 2 +- .../ILocationResolver.cs | 14 +- .../Nfc/AmiiboDecryption/AmiiboBinReader.cs | 1 + .../Nfc/AmiiboDecryption/AmiiboDump.cs | 18 +-- .../HOS/Services/Nfc/Nfp/NfpManager/INfp.cs | 9 +- .../Nifm/StaticService/IGeneralService.cs | 3 + .../Services/Nifm/StaticService/IRequest.cs | 6 +- .../Types/InternetConnectionStatus.cs | 2 +- .../Nifm/StaticService/Types/IpV4Address.cs | 2 +- .../Services/Ns/Aoc/IAddOnContentManager.cs | 32 ++++ .../Ns/IApplicationManagerInterface.cs | 7 +- ...ReadOnlyApplicationControlDataInterface.cs | 7 +- .../HOS/Services/Nv/INvDrvServices.cs | 14 +- .../NvHostAsGpu/Types/AllocSpaceArguments.cs | 2 +- .../NvHostAsGpu/Types/BindChannelArguments.cs | 2 +- .../NvHostAsGpu/Types/FreeSpaceArguments.cs | 2 +- .../Types/GetVaRegionsArguments.cs | 4 +- .../Types/InitializeExArguments.cs | 2 +- .../NvHostAsGpu/Types/MapBufferExArguments.cs | 2 +- .../NvHostAsGpu/Types/RemapArguments.cs | 2 +- .../NvHostAsGpu/Types/UnmapBufferArguments.cs | 4 +- .../NvHostChannel/NvHostChannelDeviceFile.cs | 10 +- .../NvHostChannel/NvHostGpuDeviceFile.cs | 3 +- .../Types/AllocGpfifoExArguments.cs | 2 +- .../Types/AllocObjCtxArguments.cs | 2 +- .../Types/GetParameterArguments.cs | 2 +- .../Types/MapCommandBufferArguments.cs | 2 +- .../NvHostChannel/Types/NvChannel.cs | 4 +- .../Types/SetErrorNotifierArguments.cs | 2 +- .../NvHostChannel/Types/SubmitArguments.cs | 8 +- .../Types/SubmitGpfifoArguments.cs | 2 +- .../NvHostChannel/Types/ZcullBindArguments.cs | 2 +- .../NvHostCtrl/Types/EventWaitArguments.cs | 2 +- .../NvHostCtrl/Types/NvHostEvent.cs | 4 +- .../NvHostCtrl/Types/SyncptWaitArguments.cs | 2 +- .../NvHostCtrl/Types/SyncptWaitExArguments.cs | 2 +- .../Types/GetActiveSlotMaskArguments.cs | 2 +- .../Types/GetCharacteristicsArguments.cs | 8 +- .../Types/GetGpuTimeArguments.cs | 2 +- .../Types/GetTpcMasksArguments.cs | 2 +- .../NvHostCtrlGpu/Types/NumVsmsArguments.cs | 2 +- .../Types/VsmsMappingArguments.cs | 2 +- .../Types/ZbcSetTableArguments.cs | 2 +- .../Types/ZcullGetCtxSizeArguments.cs | 2 +- .../Types/ZcullGetInfoArguments.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapAlloc.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapCreate.cs | 2 +- .../Nv/NvDrvServices/NvMap/Types/NvMapFree.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapFromId.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapGetId.cs | 2 +- .../NvDrvServices/NvMap/Types/NvMapHandle.cs | 4 +- .../NvDrvServices/NvMap/Types/NvMapParam.cs | 2 +- src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs | 2 +- .../IParentalControlService.cs | 3 + .../Clkrst/ClkrstManager/IClkrstSession.cs | 4 +- .../HOS/Services/Sdb/Pl/ISharedFontManager.cs | 13 +- src/Ryujinx.HLE/HOS/Services/ServerBase.cs | 5 +- .../HOS/Services/Sm/IUserInterface.cs | 6 +- .../HOS/Services/Sockets/Bsd/IClient.cs | 50 ++++-- .../Sockets/Bsd/Impl/ManagedSocket.cs | 1 + .../HOS/Services/Sockets/Bsd/Impl/WSAError.cs | 2 + .../Sockets/Bsd/Types/BsdSocketOption.cs | 2 + .../Services/Sockets/Bsd/Types/LinuxError.cs | 2 + .../Sockets/Bsd/Types/PollEventData.cs | 4 +- .../Services/Sockets/Sfdnsres/IResolver.cs | 59 +++++-- .../HOS/Services/Spl/IGeneralInterface.cs | 4 + .../Services/Ssl/BuiltInCertificateManager.cs | 6 +- .../HOS/Services/Ssl/ISslService.cs | 5 +- .../Services/Ssl/SslService/ISslContext.cs | 10 ++ .../SslService/SslManagedSocketConnection.cs | 3 + .../SurfaceFlinger/BufferQueueProducer.cs | 2 + .../HOS/Services/SurfaceFlinger/Parcel.cs | 4 +- .../HOS/Services/SurfaceFlinger/Status.cs | 2 + .../Services/SurfaceFlinger/SurfaceFlinger.cs | 1 + .../SurfaceFlinger/Types/Color/ColorFormat.cs | 2 + .../Services/Time/Clock/Types/TimeSpanType.cs | 2 +- .../Services/Time/IStaticServiceForGlue.cs | 4 +- .../HOS/Services/Time/ResultCode.cs | 2 + .../StaticService/ITimeZoneServiceForPsc.cs | 6 + .../HOS/Services/Time/TimeSharedMemory.cs | 3 +- .../HOS/Services/Time/TimeZone/TimeZone.cs | 27 +++- .../IManagerDisplayService.cs | 7 +- .../RootService/IApplicationDisplayService.cs | 16 +- src/Ryujinx.HLE/HOS/TamperMachine.cs | 2 +- src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs | 2 + src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs | 4 +- src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs | 4 +- .../Loaders/Npdm/FsAccessHeader.cs | 5 +- src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs | 7 +- .../Extensions/FileSystemExtensions.cs | 1 + .../Loaders/Processes/ProcessResult.cs | 1 + src/Ryujinx.HLE/MemoryConfiguration.cs | 8 +- src/Ryujinx.HLE/StructHelpers.cs | 1 + src/Ryujinx.HLE/Switch.cs | 6 +- src/Ryujinx.HLE/UI/IHostUIHandler.cs | 1 + .../SyscallGenerator.cs | 112 +++++-------- .../Sdk/Audio/Detail/AudioDevice.cs | 3 - .../Sdk/Codec/Detail/HardwareOpusDecoder.cs | 2 +- .../System/AccountNotificationSettings.cs | 4 +- .../System/BluetoothDevicesSettings.cs | 4 +- .../Settings/System/NotificationSettings.cs | 4 +- .../Sdk/Sf/Cmif/CmifDomainOutHeader.cs | 4 +- .../Sdk/Sf/Cmif/CmifOutHeader.cs | 4 +- .../Sdk/Sf/Cmif/CmifRequestFormat.cs | 2 + .../Sdk/Sf/Hipc/HipcBufferDescriptor.cs | 3 +- .../Sdk/Sf/Hipc/HipcReceiveListEntry.cs | 3 +- src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs | 2 +- src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs | 2 + src/Ryujinx.Input.SDL2/SDL2Keyboard.cs | 3 +- src/Ryujinx.Input/IMouse.cs | 2 + src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs | 4 +- src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs | 2 +- .../SequenceReaderExtensionsTests.cs | 18 ++- src/Ryujinx.Tests/Memory/MockMemoryManager.cs | 9 +- src/Ryujinx.Tests/Memory/PartialUnmaps.cs | 1 + .../Common/Models/XCITrimmerFileModel.cs | 4 +- src/Ryujinx/Program.cs | 8 +- .../Systems/AppLibrary/ApplicationData.cs | 4 +- .../LdnGameDataReceivedEventArgs.cs | 1 + .../ConfigurationState.Migration.cs | 3 +- .../Configuration/ConfigurationState.Model.cs | 3 +- .../Configuration/ConfigurationState.cs | 4 +- src/Ryujinx/Systems/Rebooter.cs | 2 + src/Ryujinx/Systems/Updater/Updater.GitLab.cs | 9 +- src/Ryujinx/Systems/Updater/Updater.cs | 151 ++++++++++-------- .../UI/Applet/ControllerAppletDialog.axaml.cs | 2 +- .../Controls/ApplicationContextMenu.axaml.cs | 21 +++ src/Ryujinx/UI/Helpers/LoggerAdapter.cs | 10 +- src/Ryujinx/UI/Helpers/Win32NativeInterop.cs | 3 +- .../UI/Models/Input/GamepadInputConfig.cs | 2 +- .../UI/Models/Input/KeyboardInputConfig.cs | 1 + src/Ryujinx/UI/Renderer/RendererHost.cs | 1 + .../UI/ViewModels/CompatibilityViewModel.cs | 19 ++- .../UI/ViewModels/Input/InputViewModel.cs | 9 +- .../UI/ViewModels/MainWindowViewModel.cs | 5 +- .../UI/ViewModels/SettingsViewModel.cs | 12 +- .../Views/Input/ControllerInputView.axaml.cs | 2 +- .../Settings/SettingsHotkeysView.axaml.cs | 2 +- .../Windows/CompatibilityListWindow.axaml.cs | 5 +- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 20 +-- .../Utilities/SystemInfo/WindowsSystemInfo.cs | 2 +- src/Spv.Generator/InstructionOperands.cs | 8 +- 307 files changed, 1245 insertions(+), 1016 deletions(-) create mode 100644 src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs diff --git a/.editorconfig b/.editorconfig index 0f9dd369a..1059bcdeb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -45,10 +45,10 @@ dotnet_separate_import_directive_groups = false dotnet_sort_system_directives_first = false # this. and Me. preferences -dotnet_style_qualification_for_event = false:suggestion -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent # Language keywords vs BCL types preferences dotnet_style_predefined_type_for_locals_parameters_members = true:silent @@ -257,14 +257,12 @@ csharp_prefer_system_threading_lock = true:suggestion dotnet_diagnostic.CA1069.severity = none # CA1069: Enums values should not be duplicated # Disable Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = none -dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppression -dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure dotnet_diagnostic.IDE0300.severity = none dotnet_diagnostic.IDE0301.severity = none dotnet_diagnostic.IDE0302.severity = none dotnet_diagnostic.IDE0305.severity = none dotnet_diagnostic.CS9113.severity = none # CS9113: Parameter 'value' is unread -dotnet_diagnostic.CS0649.severity = none # CS0649: Field is never assigned to, and will always have its default value +dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure [src/Ryujinx/UI/ViewModels/**.cs] # Disable "mark members as static" rule for ViewModels diff --git a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs index 38398fb6a..0d493426b 100644 --- a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs +++ b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs @@ -1129,6 +1129,7 @@ namespace ARMeilleure.CodeGen.Arm64 }; } +#pragma warning disable IDE0051 // Remove unused private member private void WriteInt16(short value) { WriteUInt16((ushort)value); @@ -1143,6 +1144,7 @@ namespace ARMeilleure.CodeGen.Arm64 { _stream.WriteByte(value); } +#pragma warning restore IDE0051 private void WriteUInt16(ushort value) { diff --git a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs index e2ac49b23..fbf4c1eb4 100644 --- a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs +++ b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs @@ -1570,11 +1570,13 @@ namespace ARMeilleure.CodeGen.Arm64 Debug.Assert(op1.Type == op3.Type); } +#pragma warning disable IDE0051 // Remove unused private member private static void EnsureSameType(Operand op1, Operand op2, Operand op3, Operand op4) { Debug.Assert(op1.Type == op2.Type); Debug.Assert(op1.Type == op3.Type); Debug.Assert(op1.Type == op4.Type); } +#pragma warning restore IDE0051 } } diff --git a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs index ddceae057..4b226803b 100644 --- a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs +++ b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.CodeGen.X86 { diff --git a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs index 02b91c163..8433aaea9 100644 --- a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs +++ b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs @@ -20,12 +20,12 @@ namespace ARMeilleure.CodeGen.X86 { if (GetCurrentCallConv() == CallConvName.Windows) { - +#pragma warning disable IDE0055 // Disable formatting return (1 << (int)X86Register.Rax) | (1 << (int)X86Register.Rcx) | (1 << (int)X86Register.Rdx) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); } @@ -36,11 +36,11 @@ namespace ARMeilleure.CodeGen.X86 (1 << (int)X86Register.Rdx) | (1 << (int)X86Register.Rsi) | (1 << (int)X86Register.Rdi) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); - +#pragma warning restore IDE0055 } } diff --git a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs index 6d72e0aff..afae3211f 100644 --- a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs +++ b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs @@ -2,6 +2,7 @@ using ARMeilleure.CodeGen.RegisterAllocators; using ARMeilleure.IntermediateRepresentation; using Microsoft.IO; using Ryujinx.Common.Memory; +using System.IO; using System.Numerics; namespace ARMeilleure.CodeGen.X86 diff --git a/src/ARMeilleure/CodeGen/X86/X86Register.cs b/src/ARMeilleure/CodeGen/X86/X86Register.cs index d1394deaa..bcce4f974 100644 --- a/src/ARMeilleure/CodeGen/X86/X86Register.cs +++ b/src/ARMeilleure/CodeGen/X86/X86Register.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace ARMeilleure.CodeGen.X86 { enum X86Register diff --git a/src/ARMeilleure/Instructions/CryptoHelper.cs b/src/ARMeilleure/Instructions/CryptoHelper.cs index 3ce04aa5c..046a9bb6d 100644 --- a/src/ARMeilleure/Instructions/CryptoHelper.cs +++ b/src/ARMeilleure/Instructions/CryptoHelper.cs @@ -8,8 +8,8 @@ namespace ARMeilleure.Instructions static class CryptoHelper { #region "LookUp Tables" - - private static ReadOnlySpan SBox => +#pragma warning disable IDE1006 // Naming rule violation + private static ReadOnlySpan _sBox => [ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, @@ -29,7 +29,7 @@ namespace ARMeilleure.Instructions 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 ]; - private static ReadOnlySpan InvSBox => + private static ReadOnlySpan _invSBox => [ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, @@ -49,7 +49,7 @@ namespace ARMeilleure.Instructions 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ]; - private static ReadOnlySpan GfMul02 => + private static ReadOnlySpan _gfMul02 => [ 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, @@ -69,7 +69,7 @@ namespace ARMeilleure.Instructions 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 ]; - private static ReadOnlySpan GfMul03 => + private static ReadOnlySpan _gfMul03 => [ 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, @@ -89,7 +89,7 @@ namespace ARMeilleure.Instructions 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a ]; - private static ReadOnlySpan GfMul09 => + private static ReadOnlySpan _gfMul09 => [ 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, @@ -109,7 +109,7 @@ namespace ARMeilleure.Instructions 0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46 ]; - private static ReadOnlySpan GfMul0B => + private static ReadOnlySpan _gfMul0B => [ 0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, @@ -129,7 +129,7 @@ namespace ARMeilleure.Instructions 0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3 ]; - private static ReadOnlySpan GfMul0D => + private static ReadOnlySpan _gfMul0D => [ 0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, @@ -149,7 +149,7 @@ namespace ARMeilleure.Instructions 0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97 ]; - private static ReadOnlySpan GfMul0E => + private static ReadOnlySpan _gfMul0E => [ 0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, @@ -169,16 +169,16 @@ namespace ARMeilleure.Instructions 0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d ]; - private static ReadOnlySpan SrPerm => + private static ReadOnlySpan _srPerm => [ 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3 ]; - private static ReadOnlySpan IsrPerm => + private static ReadOnlySpan _isrPerm => [ 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11 ]; - +#pragma warning restore IDE1006 #endregion public static V128 AesInvMixColumns(V128 op) @@ -195,10 +195,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)GfMul0E[row0] ^ GfMul0B[row1] ^ GfMul0D[row2] ^ GfMul09[row3]); - outState[idx + 1] = (byte)((uint)GfMul09[row0] ^ GfMul0E[row1] ^ GfMul0B[row2] ^ GfMul0D[row3]); - outState[idx + 2] = (byte)((uint)GfMul0D[row0] ^ GfMul09[row1] ^ GfMul0E[row2] ^ GfMul0B[row3]); - outState[idx + 3] = (byte)((uint)GfMul0B[row0] ^ GfMul0D[row1] ^ GfMul09[row2] ^ GfMul0E[row3]); + outState[idx + 0] = (byte)((uint)_gfMul0E[row0] ^ _gfMul0B[row1] ^ _gfMul0D[row2] ^ _gfMul09[row3]); + outState[idx + 1] = (byte)((uint)_gfMul09[row0] ^ _gfMul0E[row1] ^ _gfMul0B[row2] ^ _gfMul0D[row3]); + outState[idx + 2] = (byte)((uint)_gfMul0D[row0] ^ _gfMul09[row1] ^ _gfMul0E[row2] ^ _gfMul0B[row3]); + outState[idx + 3] = (byte)((uint)_gfMul0B[row0] ^ _gfMul0D[row1] ^ _gfMul09[row2] ^ _gfMul0E[row3]); } return new V128(outState); @@ -211,7 +211,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[IsrPerm[idx]] = inState[idx]; + outState[_isrPerm[idx]] = inState[idx]; } return new V128(outState); @@ -224,7 +224,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = InvSBox[inState[idx]]; + outState[idx] = _invSBox[inState[idx]]; } return new V128(outState); @@ -244,10 +244,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)GfMul02[row0] ^ GfMul03[row1] ^ row2 ^ row3); - outState[idx + 1] = (byte)((uint)row0 ^ GfMul02[row1] ^ GfMul03[row2] ^ row3); - outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ GfMul02[row2] ^ GfMul03[row3]); - outState[idx + 3] = (byte)((uint)GfMul03[row0] ^ row1 ^ row2 ^ GfMul02[row3]); + outState[idx + 0] = (byte)((uint)_gfMul02[row0] ^ _gfMul03[row1] ^ row2 ^ row3); + outState[idx + 1] = (byte)((uint)row0 ^ _gfMul02[row1] ^ _gfMul03[row2] ^ row3); + outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ _gfMul02[row2] ^ _gfMul03[row3]); + outState[idx + 3] = (byte)((uint)_gfMul03[row0] ^ row1 ^ row2 ^ _gfMul02[row3]); } return new V128(outState); @@ -260,7 +260,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[SrPerm[idx]] = inState[idx]; + outState[_srPerm[idx]] = inState[idx]; } return new V128(outState); @@ -273,7 +273,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = SBox[inState[idx]]; + outState[idx] = _sBox[inState[idx]]; } return new V128(outState); diff --git a/src/ARMeilleure/Instructions/InstEmitMul.cs b/src/ARMeilleure/Instructions/InstEmitMul.cs index bd2ac8d64..cb48deb03 100644 --- a/src/ARMeilleure/Instructions/InstEmitMul.cs +++ b/src/ARMeilleure/Instructions/InstEmitMul.cs @@ -2,6 +2,7 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.Translation; using System; +using System.Diagnostics.CodeAnalysis; using static ARMeilleure.Instructions.InstEmitHelper; namespace ARMeilleure.Instructions diff --git a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs index 0fd188f2a..cee7a4ed8 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs @@ -11,10 +11,11 @@ using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func2I = System.Func; namespace ARMeilleure.Instructions { + using Func2I = Func; + static partial class InstEmit { public static void Abs_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs index 64e4078c8..8fcb06286 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs @@ -2,13 +2,15 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; +using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func2I = System.Func; namespace ARMeilleure.Instructions { + using Func2I = Func; + static partial class InstEmit { public static void Cmeq_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs index 3068519f3..6ec2b58f9 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs @@ -2,15 +2,17 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; +using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func2I = System.Func; namespace ARMeilleure.Instructions { + using Func2I = Func; + static partial class InstEmit32 { public static void Vceq_V(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs index a9787224e..cf427eeae 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs @@ -8,10 +8,11 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func1I = System.Func; namespace ARMeilleure.Instructions { + using Func1I = Func; + static partial class InstEmit { public static void Fcvt_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs index e44e174fe..11d0c93b4 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs @@ -8,12 +8,13 @@ using System.Diagnostics; using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func1I = System.Func; -using Func2I = System.Func; -using Func3I = System.Func; namespace ARMeilleure.Instructions { + using Func1I = Func; + using Func2I = Func; + using Func3I = Func; + static class InstEmitSimdHelper { #region "Masks" diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs index 7b9b0c1b7..c053fe27b 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs @@ -7,12 +7,13 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func1I = System.Func; -using Func2I = System.Func; -using Func3I = System.Func; namespace ARMeilleure.Instructions { + using Func1I = Func; + using Func2I = Func; + using Func3I = Func; + static class InstEmitSimdHelper32 { public static (int, int) GetQuadwordAndSubindex(int index, RegisterSize size) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs index bfd3064a0..a1ca417b4 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs @@ -7,12 +7,13 @@ using System.Diagnostics; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func1I = System.Func; -using Func2I = System.Func; -using Func3I = System.Func; namespace ARMeilleure.Instructions { + using Func1I = Func; + using Func2I = Func; + using Func3I = Func; + static class InstEmitSimdHelper32Arm64 { // Intrinsic Helpers diff --git a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs index 5409e6879..dedf0fa05 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs @@ -40,36 +40,34 @@ namespace ARMeilleure.Instructions long offset = 0; - for (int rep = 0; rep < op.Reps; rep++) +#pragma warning disable IDE0055 // Disable formatting + for (int rep = 0; rep < op.Reps; rep++) + for (int elem = 0; elem < op.Elems; elem++) + for (int sElem = 0; sElem < op.SElems; sElem++) { - for (int elem = 0; elem < op.Elems; elem++) + int rtt = (op.Rt + rep + sElem) & 0x1f; + + Operand tt = GetVec(rtt); + + Operand address = context.Add(n, Const(offset)); + + if (isLoad) { - for (int sElem = 0; sElem < op.SElems; sElem++) + EmitLoadSimd(context, address, tt, rtt, elem, op.Size); + + if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) { - int rtt = (op.Rt + rep + sElem) & 0x1f; - - Operand tt = GetVec(rtt); - - Operand address = context.Add(n, Const(offset)); - - if (isLoad) - { - EmitLoadSimd(context, address, tt, rtt, elem, op.Size); - - if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) - { - context.Copy(tt, context.VectorZeroUpper64(tt)); - } - } - else - { - EmitStoreSimd(context, address, rtt, elem, op.Size); - } - - offset += 1 << op.Size; + context.Copy(tt, context.VectorZeroUpper64(tt)); } } + else + { + EmitStoreSimd(context, address, rtt, elem, op.Size); + } + + offset += 1 << op.Size; } +#pragma warning restore IDE0055 if (op.WBack) { diff --git a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs index 39dadf13d..3469434c0 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs @@ -9,10 +9,11 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; -using Func2I = System.Func; namespace ARMeilleure.Instructions { + using Func2I = Func; + static partial class InstEmit { #region "Masks" diff --git a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs index 31dc97bd6..9d87c13b3 100644 --- a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs +++ b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.IntermediateRepresentation { diff --git a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs index 69c56a98c..d22c89a75 100644 --- a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs +++ b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs @@ -7,9 +7,10 @@ namespace ARMeilleure.IntermediateRepresentation { private struct Data { +#pragma warning disable CS0649 // Field is never assigned to public byte Kind; public byte Type; - +#pragma warning restore CS0649 public byte Scale; public Operand BaseAddress; public Operand Index; diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs index 297ee040c..18390de31 100644 --- a/src/ARMeilleure/Optimizations.cs +++ b/src/ARMeilleure/Optimizations.cs @@ -1,8 +1,8 @@ -using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; -using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; - namespace ARMeilleure { + using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; + using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; + public static class Optimizations { // low-core count PPTC diff --git a/src/ARMeilleure/Translation/ArmEmitterContext.cs b/src/ARMeilleure/Translation/ArmEmitterContext.cs index 0d6e65d8b..196120e92 100644 --- a/src/ARMeilleure/Translation/ArmEmitterContext.cs +++ b/src/ARMeilleure/Translation/ArmEmitterContext.cs @@ -218,28 +218,18 @@ namespace ARMeilleure.Translation { switch (condition) { - - case Condition.Eq: - return ICompareEqual(n, m); - case Condition.Ne: - return ICompareNotEqual(n, m); - case Condition.GeUn: - return ICompareGreaterOrEqualUI(n, m); - case Condition.LtUn: - return ICompareLessUI(n, m); - case Condition.GtUn: - return ICompareGreaterUI(n, m); - case Condition.LeUn: - return ICompareLessOrEqualUI(n, m); - case Condition.Ge: - return ICompareGreaterOrEqual(n, m); - case Condition.Lt: - return ICompareLess(n, m); - case Condition.Gt: - return ICompareGreater(n, m); - case Condition.Le: - return ICompareLessOrEqual(n, m); - +#pragma warning disable IDE0055 // Disable formatting + case Condition.Eq: return ICompareEqual (n, m); + case Condition.Ne: return ICompareNotEqual (n, m); + case Condition.GeUn: return ICompareGreaterOrEqualUI(n, m); + case Condition.LtUn: return ICompareLessUI (n, m); + case Condition.GtUn: return ICompareGreaterUI (n, m); + case Condition.LeUn: return ICompareLessOrEqualUI (n, m); + case Condition.Ge: return ICompareGreaterOrEqual (n, m); + case Condition.Lt: return ICompareLess (n, m); + case Condition.Gt: return ICompareGreater (n, m); + case Condition.Le: return ICompareLessOrEqual (n, m); +#pragma warning restore IDE0055 } } else if (cmpName == InstName.Adds && _optOpLastCompare is IOpCodeAluImm op) @@ -264,20 +254,14 @@ namespace ARMeilleure.Translation switch (condition) { - - case Condition.Eq: - return ICompareEqual(n, m); - case Condition.Ne: - return ICompareNotEqual(n, m); - case Condition.Ge: - return ICompareGreaterOrEqual(n, m); - case Condition.Lt: - return ICompareLess(n, m); - case Condition.Gt: - return ICompareGreater(n, m); - case Condition.Le: - return ICompareLessOrEqual(n, m); - +#pragma warning disable IDE0055 // Disable formatting + case Condition.Eq: return ICompareEqual (n, m); + case Condition.Ne: return ICompareNotEqual (n, m); + case Condition.Ge: return ICompareGreaterOrEqual(n, m); + case Condition.Lt: return ICompareLess (n, m); + case Condition.Gt: return ICompareGreater (n, m); + case Condition.Le: return ICompareLessOrEqual (n, m); +#pragma warning restore IDE0055 } } diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index a9f077dd9..f36d4256d 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -22,11 +22,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using static ARMeilleure.Translation.PTC.PtcFormatter; -using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; -using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; namespace ARMeilleure.Translation.PTC { + using Arm64HardwareCapabilities = CodeGen.Arm64.HardwareCapabilities; + using X86HardwareCapabilities = CodeGen.X86.HardwareCapabilities; + class Ptc : IPtcLoadState { private const string OuterHeaderMagicString = "PTCohd\0\0"; diff --git a/src/ARMeilleure/Translation/RegisterUsage.cs b/src/ARMeilleure/Translation/RegisterUsage.cs index e2489b6a9..03d4a96e7 100644 --- a/src/ARMeilleure/Translation/RegisterUsage.cs +++ b/src/ARMeilleure/Translation/RegisterUsage.cs @@ -297,20 +297,12 @@ namespace ARMeilleure.Translation switch (register.Type) { - - case RegisterType.Flag: - intMask = (1L << RegsCount) << register.Index; - break; - case RegisterType.Integer: - intMask = 1L << register.Index; - break; - case RegisterType.FpFlag: - vecMask = (1L << RegsCount) << register.Index; - break; - case RegisterType.Vector: - vecMask = 1L << register.Index; - break; - +#pragma warning disable IDE0055 // Disable formatting + case RegisterType.Flag: intMask = (1L << RegsCount) << register.Index; break; + case RegisterType.Integer: intMask = 1L << register.Index; break; + case RegisterType.FpFlag: vecMask = (1L << RegsCount) << register.Index; break; + case RegisterType.Vector: vecMask = 1L << register.Index; break; +#pragma warning restore IDE0055 } return new RegisterMask(intMask, vecMask); diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs index f7e1d27b8..d5381209e 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs @@ -12,7 +12,7 @@ using static SDL2.SDL; namespace Ryujinx.Audio.Backends.SDL2 { - public partial class SDL2HardwareDeviceDriver : IHardwareDeviceDriver + public class SDL2HardwareDeviceDriver : IHardwareDeviceDriver { private readonly ManualResetEvent _updateRequiredEvent; private readonly ManualResetEvent _pauseEvent; @@ -22,36 +22,10 @@ namespace Ryujinx.Audio.Backends.SDL2 public float Volume { get; set; } - // A safe method to get default audio information. - private static int GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture) - { - int result; - spec = new SDL_AudioSpec(); - IntPtr specPtr = IntPtr.Zero; - - try - { - // Reserve memory - specPtr = Marshal.AllocHGlobal(Marshal.SizeOf()); - // Call method - result = SDL_GetDefaultAudioInfo(name, specPtr, isCapture); - // Copy result to managed structure - spec = Marshal.PtrToStructure(specPtr); - } - finally - { - // Free the unmanaged memory to prevent memory leaks - if (specPtr != IntPtr.Zero) - { - Marshal.FreeHGlobal(specPtr); - } - } - - return result; - } - - [LibraryImport("SDL2")] - private static partial int SDL_GetDefaultAudioInfo(nint name, nint spec, int isCapture); + // TODO: Add this to SDL2-CS + // NOTE: We use a DllImport here because of marshaling issue for spec. + [DllImport("SDL2")] + private static extern int SDL_GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture); public SDL2HardwareDeviceDriver() { @@ -61,7 +35,7 @@ namespace Ryujinx.Audio.Backends.SDL2 SDL2Driver.Instance.Initialize(); - int res = GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); + int res = SDL_GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); if (res != 0) { diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs index 62f6b14bc..6a12e8c0c 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs +++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs @@ -23,7 +23,7 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void JackCallbackDelegate(nint msg); - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] public struct SoundIoStruct { public nint UserData; diff --git a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs index b756f9d70..98b224ebf 100644 --- a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs +++ b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs @@ -20,7 +20,9 @@ namespace Ryujinx.Audio.Renderer.Common public uint Unknown24; public uint RenderInfoSize; +#pragma warning disable IDE0051, CS0169 // Remove unused field private Array4 _reserved; +#pragma warning restore IDE0051, CS0169 public uint TotalSize; diff --git a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs index 38429092f..1a5802a37 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs @@ -12,8 +12,9 @@ namespace Ryujinx.Audio.Renderer.Dsp private const int SamplesPerFrame = 14; private const int NibblesPerFrame = SamplesPerFrame + 2; private const int BytesPerFrame = 8; - +#pragma warning disable IDE0051 // Remove unused private member private const int BitsPerFrame = BytesPerFrame * 8; +#pragma warning restore IDE0051 [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint GetAdpcmDataSize(int sampleCount) diff --git a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs index c6f126c65..ee2f23479 100644 --- a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs +++ b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs @@ -41,10 +41,10 @@ namespace Ryujinx.Audio.Renderer.Server private UpsamplerManager _upsamplerManager; private bool _isActive; private BehaviourContext _behaviourContext; - +#pragma warning disable IDE0052 // Remove unread private member private ulong _totalElapsedTicksUpdating; private ulong _totalElapsedTicks; - +#pragma warning restore IDE0052 private int _sessionId; private Memory _memoryPools; diff --git a/src/Ryujinx.Common/Collections/TreeDictionary.cs b/src/Ryujinx.Common/Collections/TreeDictionary.cs index f194a9f93..af104d268 100644 --- a/src/Ryujinx.Common/Collections/TreeDictionary.cs +++ b/src/Ryujinx.Common/Collections/TreeDictionary.cs @@ -147,9 +147,9 @@ namespace Ryujinx.Common.Collections Queue> nodes = new(); - if (Root != null) + if (this.Root != null) { - nodes.Enqueue(Root); + nodes.Enqueue(this.Root); } while (nodes.TryDequeue(out Node node)) @@ -522,7 +522,7 @@ namespace Ryujinx.Common.Collections public void CopyTo(KeyValuePair[] array, int arrayIndex) { - if (arrayIndex < 0 || array.Length - arrayIndex < Count) + if (arrayIndex < 0 || array.Length - arrayIndex < this.Count) { throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs index bae6e35de..f3a9e1646 100644 --- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs +++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs @@ -36,6 +36,8 @@ namespace Ryujinx.Common.Configuration }; } + + public static float ToFloatY(this AspectRatio aspectRatio) { return aspectRatio switch diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs index d0565c88a..ae3416a27 100644 --- a/src/Ryujinx.Common/Configuration/DirtyHack.cs +++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs @@ -18,6 +18,8 @@ namespace Ryujinx.Common.Configuration public DirtyHack Hack => hack; public int Value => value; + + public ulong Pack() => Raw.PackBitFields(PackedFormat); public static EnabledDirtyHack Unpack(ulong packedHack) diff --git a/src/Ryujinx.Common/Hash128.cs b/src/Ryujinx.Common/Hash128.cs index f57bb6c84..e95a15caa 100644 --- a/src/Ryujinx.Common/Hash128.cs +++ b/src/Ryujinx.Common/Hash128.cs @@ -10,7 +10,7 @@ using System.Runtime.Intrinsics.X86; namespace Ryujinx.Common { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] public struct Hash128(ulong low, ulong high) : IEquatable { public ulong Low = low; diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs index add5ad22f..e6f68599a 100644 --- a/src/Ryujinx.Common/Logging/Logger.cs +++ b/src/Ryujinx.Common/Logging/Logger.cs @@ -219,34 +219,16 @@ namespace Ryujinx.Common.Logging switch (logLevel) { #pragma warning disable IDE0055 // Disable formatting - case LogLevel.Debug: - Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); - break; - case LogLevel.Info: - Info = enabled ? new Log(LogLevel.Info) : new Log?(); - break; - case LogLevel.Warning: - Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); - break; - case LogLevel.Error: - Error = enabled ? new Log(LogLevel.Error) : new Log?(); - break; - case LogLevel.Guest: - Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); - break; - case LogLevel.AccessLog: - AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); - break; - case LogLevel.Stub: - Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); - break; - case LogLevel.Trace: - Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); - break; - case LogLevel.Notice: - break; - default: - throw new ArgumentException("Unknown Log Level", nameof(logLevel)); + case LogLevel.Debug : Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); break; + case LogLevel.Info : Info = enabled ? new Log(LogLevel.Info) : new Log?(); break; + case LogLevel.Warning : Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); break; + case LogLevel.Error : Error = enabled ? new Log(LogLevel.Error) : new Log?(); break; + case LogLevel.Guest : Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); break; + case LogLevel.AccessLog : AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); break; + case LogLevel.Stub : Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); break; + case LogLevel.Trace : Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); break; + case LogLevel.Notice : break; + default: throw new ArgumentException("Unknown Log Level", nameof(logLevel)); #pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index 6d3435755..fcb2229a7 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -2,9 +2,9 @@ using System; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; +#pragma warning disable CS0169, IDE0051 // Remove unused private member namespace Ryujinx.Common.Memory { - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array1 : IArray where T : unmanaged { T _e0; @@ -15,7 +15,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array2 : IArray where T : unmanaged { T _e0; @@ -27,7 +26,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array3 : IArray where T : unmanaged { T _e0; @@ -39,7 +37,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array4 : IArray where T : unmanaged { T _e0; @@ -51,7 +48,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array5 : IArray where T : unmanaged { T _e0; @@ -63,7 +59,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array6 : IArray where T : unmanaged { T _e0; @@ -75,7 +70,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array7 : IArray where T : unmanaged { T _e0; @@ -87,7 +81,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array8 : IArray where T : unmanaged { T _e0; @@ -99,7 +92,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array9 : IArray where T : unmanaged { T _e0; @@ -111,7 +103,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array10 : IArray where T : unmanaged { T _e0; @@ -123,7 +114,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array11 : IArray where T : unmanaged { T _e0; @@ -135,7 +125,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array12 : IArray where T : unmanaged { T _e0; @@ -147,7 +136,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array13 : IArray where T : unmanaged { T _e0; @@ -159,7 +147,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array14 : IArray where T : unmanaged { T _e0; @@ -171,7 +158,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array15 : IArray where T : unmanaged { T _e0; @@ -183,7 +169,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array16 : IArray where T : unmanaged { T _e0; @@ -195,7 +180,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array17 : IArray where T : unmanaged { T _e0; @@ -207,7 +191,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array18 : IArray where T : unmanaged { T _e0; @@ -219,7 +202,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array19 : IArray where T : unmanaged { T _e0; @@ -231,7 +213,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array20 : IArray where T : unmanaged { T _e0; @@ -243,7 +224,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array21 : IArray where T : unmanaged { T _e0; @@ -255,7 +235,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array22 : IArray where T : unmanaged { T _e0; @@ -267,7 +246,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array23 : IArray where T : unmanaged { T _e0; @@ -279,7 +257,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array24 : IArray where T : unmanaged { T _e0; @@ -292,7 +269,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array25 : IArray where T : unmanaged { T _e0; @@ -305,7 +281,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array26 : IArray where T : unmanaged { T _e0; @@ -318,7 +293,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array27 : IArray where T : unmanaged { T _e0; @@ -331,7 +305,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array28 : IArray where T : unmanaged { T _e0; @@ -344,7 +317,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array29 : IArray where T : unmanaged { T _e0; @@ -357,7 +329,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array30 : IArray where T : unmanaged { T _e0; @@ -370,7 +341,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array31 : IArray where T : unmanaged { T _e0; @@ -383,7 +353,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array32 : IArray where T : unmanaged { T _e0; @@ -396,7 +365,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array33 : IArray where T : unmanaged { T _e0; @@ -409,7 +377,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array34 : IArray where T : unmanaged { T _e0; @@ -422,7 +389,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array35 : IArray where T : unmanaged { T _e0; @@ -435,7 +401,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array36 : IArray where T : unmanaged { T _e0; @@ -448,7 +413,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array37 : IArray where T : unmanaged { T _e0; @@ -461,7 +425,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array38 : IArray where T : unmanaged { T _e0; @@ -474,7 +437,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array39 : IArray where T : unmanaged { T _e0; @@ -487,7 +449,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array40 : IArray where T : unmanaged { T _e0; @@ -500,7 +461,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array41 : IArray where T : unmanaged { T _e0; @@ -513,7 +473,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array42 : IArray where T : unmanaged { T _e0; @@ -526,7 +485,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array43 : IArray where T : unmanaged { T _e0; @@ -539,7 +497,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array44 : IArray where T : unmanaged { T _e0; @@ -552,7 +509,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array45 : IArray where T : unmanaged { T _e0; @@ -565,7 +521,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array46 : IArray where T : unmanaged { T _e0; @@ -578,7 +533,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array47 : IArray where T : unmanaged { T _e0; @@ -591,7 +545,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array48 : IArray where T : unmanaged { T _e0; @@ -604,7 +557,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array49 : IArray where T : unmanaged { T _e0; @@ -617,7 +569,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array50 : IArray where T : unmanaged { T _e0; @@ -630,7 +581,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array51 : IArray where T : unmanaged { T _e0; @@ -643,7 +593,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array52 : IArray where T : unmanaged { T _e0; @@ -656,7 +605,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array53 : IArray where T : unmanaged { T _e0; @@ -669,7 +617,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array54 : IArray where T : unmanaged { T _e0; @@ -682,7 +629,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array55 : IArray where T : unmanaged { T _e0; @@ -695,7 +641,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array56 : IArray where T : unmanaged { T _e0; @@ -708,7 +653,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array57 : IArray where T : unmanaged { T _e0; @@ -721,7 +665,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array58 : IArray where T : unmanaged { T _e0; @@ -734,7 +677,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array59 : IArray where T : unmanaged { T _e0; @@ -747,7 +689,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array60 : IArray where T : unmanaged { T _e0; @@ -759,7 +700,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array61 : IArray where T : unmanaged { T _e0; @@ -771,7 +711,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array62 : IArray where T : unmanaged { T _e0; @@ -783,7 +722,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array63 : IArray where T : unmanaged { T _e0; @@ -795,7 +733,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array64 : IArray where T : unmanaged { T _e0; @@ -807,7 +744,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array65 : IArray where T : unmanaged { T _e0; @@ -819,7 +755,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array73 : IArray where T : unmanaged { T _e0; @@ -832,7 +767,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array96 : IArray where T : unmanaged { T _e0; @@ -845,7 +779,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array127 : IArray where T : unmanaged { T _e0; @@ -858,7 +791,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array128 : IArray where T : unmanaged { T _e0; @@ -871,7 +803,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array140 : IArray where T : unmanaged { T _e0; @@ -885,7 +816,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array256 : IArray where T : unmanaged { T _e0; @@ -898,7 +828,6 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array384 : IArray where T : unmanaged { T _e0; @@ -915,4 +844,4 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } } - +#pragma warning restore CS0169, IDE0051 diff --git a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs index 2a56706d7..67f067ae2 100644 --- a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs +++ b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs @@ -94,7 +94,7 @@ namespace Ryujinx.Common.PreciseSleep Bias = GetBias(0); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] private struct Timespec { public long tv_sec; // Seconds diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index 3f30ba086..a5beb1009 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,5 +1,10 @@ +using Ryujinx.Common.Utilities; using System; +using System.Net.Http; +using System.Net.Http.Json; using System.Reflection; +using System.Text.Json.Serialization; +using System.Threading.Tasks; namespace Ryujinx.Common { @@ -32,4 +37,6 @@ namespace Ryujinx.Common ? $"https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-{currentVersion}...Canary-{newVersion}" : $"https://git.ryujinx.app/ryubing/ryujinx/-/releases/{newVersion}"; } + + } diff --git a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs index 0b78aa14d..c00598c98 100644 --- a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs +++ b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs @@ -28,10 +28,12 @@ namespace Ryujinx.Common.SystemInterop { public int GdiplusVersion; +#pragma warning disable CS0649 // Field is never assigned to public nint DebugEventCallback; public int SuppressBackgroundThread; public int SuppressExternalCodecs; public int StartupParameters; +#pragma warning restore CS0649 public static StartupInputEx Default => new() { diff --git a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs index 1f0c47624..0fbce37e2 100644 --- a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs +++ b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Common.SystemInterop [SupportedOSPlatform("windows")] public partial class WindowsMultimediaTimerResolution : IDisposable { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] public struct TimeCaps { public uint wPeriodMin; diff --git a/src/Ryujinx.Common/Utilities/Buffers.cs b/src/Ryujinx.Common/Utilities/Buffers.cs index 775d96790..b66f6025e 100644 --- a/src/Ryujinx.Common/Utilities/Buffers.cs +++ b/src/Ryujinx.Common/Utilities/Buffers.cs @@ -9,8 +9,8 @@ namespace Ryujinx.Common.Utilities [StructLayout(LayoutKind.Sequential, Size = 16)] public struct Buffer16 { - public ulong Low { get; set; } - public ulong High { get; set; } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy0; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy1; public byte this[int i] { diff --git a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs index 60b46697b..fa04ee347 100644 --- a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs +++ b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs @@ -241,7 +241,7 @@ namespace Ryujinx.Common.Utilities public IndentedStringBuilder Append(object value) { - Append(value.ToString()); + this.Append(value.ToString()); return this; } @@ -271,7 +271,7 @@ namespace Ryujinx.Common.Utilities { _builder.Append(value); - AppendLine(); + this.AppendLine(); return this; } diff --git a/src/Ryujinx.Common/Utilities/Rainbow.cs b/src/Ryujinx.Common/Utilities/Rainbow.cs index 57177c76d..93129bf10 100644 --- a/src/Ryujinx.Common/Utilities/Rainbow.cs +++ b/src/Ryujinx.Common/Utilities/Rainbow.cs @@ -32,6 +32,7 @@ namespace Ryujinx.Common.Utilities CyclingEnabled = false; } + public static float Speed { get; set; } = 1; private static readonly Lock _lock = new(); diff --git a/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs new file mode 100644 index 000000000..8e775f094 --- /dev/null +++ b/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs @@ -0,0 +1,17 @@ +using System; + +namespace Ryujinx.Cpu.AppleHv +{ + public class DummyDiskCacheLoadState : IDiskCacheLoadState + { +#pragma warning disable CS0067 // The event is never used + /// + public event Action StateChanged; +#pragma warning restore CS0067 + + /// + public void Cancel() + { + } + } +} diff --git a/src/Ryujinx.Cpu/AppleHv/HvApi.cs b/src/Ryujinx.Cpu/AppleHv/HvApi.cs index 80662acc2..864f6b063 100644 --- a/src/Ryujinx.Cpu/AppleHv/HvApi.cs +++ b/src/Ryujinx.Cpu/AppleHv/HvApi.cs @@ -6,11 +6,11 @@ namespace Ryujinx.Cpu.AppleHv { struct HvVcpuExitException { - +#pragma warning disable CS0649 // Field is never assigned to public ulong Syndrome; public ulong VirtualAddress; public ulong PhysicalAddress; - +#pragma warning restore CS0649 } enum HvExitReason : uint @@ -23,10 +23,10 @@ namespace Ryujinx.Cpu.AppleHv struct HvVcpuExit { - +#pragma warning disable CS0649 // Field is never assigned to public HvExitReason Reason; public HvVcpuExitException Exception; - +#pragma warning restore CS0649 } enum HvReg : uint diff --git a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs index d1cccf387..d050bddeb 100644 --- a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs +++ b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Cpu { public class DummyDiskCacheLoadState : IDiskCacheLoadState { +#pragma warning disable CS0067 // The event is never used /// public event Action StateChanged; - - public DummyDiskCacheLoadState() => StateChanged?.Invoke(LoadState.Unloaded, 0, 0); +#pragma warning restore CS0067 /// public void Cancel() diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index c50fedf61..3aa616a8d 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,6 +15,7 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); + public long TickScalar { get; set; } private static long _acumElapsedTicks; diff --git a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 3a7448c25..27a2ac896 100644 --- a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.GAL public override bool Equals(object obj) { - return obj is TextureCreateInfo info && Equals(info); + return obj is TextureCreateInfo info && this.Equals(info); } public static bool operator ==(TextureCreateInfo left, TextureCreateInfo right) diff --git a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs index 79fed54e7..69de93ad5 100644 --- a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs +++ b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.Graphics.GAL { public enum ViewportSwizzle diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs index 9e491d3dc..18f79cc3a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs @@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute /// unsafe struct ComputeClassState { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -430,6 +430,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute public readonly int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF); public fixed uint Reserved33E8[6]; public Array256 SetMmeShadowScratch; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs index 66e116c8e..f258c0070 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs @@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// unsafe struct DmaClassState { - +#pragma warning disable CS0649 // Field is never assigned to public fixed uint Reserved00[64]; public uint Nop; public fixed uint Reserved104[15]; @@ -266,6 +266,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public fixed uint Reserved740[629]; public uint PmTriggerEnd; public fixed uint Reserved1118[2490]; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs index cbd31b0ea..368158718 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// struct DmaTexture { - +#pragma warning disable CS0649 // Field is never assigned to public MemoryLayout MemoryLayout; public int Width; public int Height; @@ -15,6 +15,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public int RegionZ; public ushort RegionX; public ushort RegionY; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs index 0f2da508e..21eb5bfa9 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs @@ -25,9 +25,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct CompressedMethod { - +#pragma warning disable CS0649 // Field is never assigned to public uint Method; - +#pragma warning restore CS0649 public readonly int MethodAddressOld => (int)((Method >> 2) & 0x7FF); public readonly int MethodAddress => (int)(Method & 0xFFF); public readonly int SubdeviceMask => (int)((Method >> 4) & 0xFFF); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs index 7224a3643..d28f2fbb5 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs @@ -36,15 +36,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct GPEntry { - +#pragma warning disable CS0649 // Field is never assigned to public uint Entry0; - +#pragma warning restore CS0649 public readonly Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1); public readonly int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF); public readonly int Entry0Operand => (int)(Entry0); - +#pragma warning disable CS0649 // Field is never assigned to public uint Entry1; - +#pragma warning restore CS0649 public readonly int Entry1GetHi => (int)(Entry1 & 0xFF); public readonly Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1); public readonly Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs index 71fe800ea..56bebc336 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs @@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo /// struct GPFifoClassState { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetObject; public readonly int SetObjectNvclass => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngine => (int)((SetObject >> 16) & 0x1F); @@ -228,6 +228,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo public uint LoadMmeStartAddressRamPointer; public uint LoadMmeStartAddressRam; public uint SetMmeShadowRamControl; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs index 94ccbeae9..1aff0441f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory /// unsafe struct InlineToMemoryClassState { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -178,6 +178,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory public uint SetI2mSpareNoop03; public fixed uint Reserved200[3200]; public Array256 SetMmeShadowScratch; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs index 2b30b7c92..f62a4c01a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs @@ -469,11 +469,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME for (int i = 0; i < maxDrawCount; i++) { FifoWord count = FetchParam(); - - _ = FetchParam(); // Instance count +#pragma warning disable IDE0059 // Remove unnecessary value assignment + FifoWord instanceCount = FetchParam(); FifoWord firstIndex = FetchParam(); - _ = FetchParam(); // First vertex - _ = FetchParam(); // First instance + FifoWord firstVertex = FetchParam(); + FifoWord firstInstance = FetchParam(); +#pragma warning restore IDE0059 if (i == 0) { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs index ce1d4e78d..b4346add1 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs @@ -9,7 +9,9 @@ namespace Ryujinx.Graphics.Gpu.Engine [StructLayout(LayoutKind.Sequential, Size = 1024)] struct MmeShadowScratch { +#pragma warning disable CS0169 // The private field is never used private uint _e0; +#pragma warning restore CS0169 public ref uint this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 256); } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs index 8a59c84e6..739d32237 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs @@ -16,8 +16,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed private int _inlineIndexBufferSize; private int _inlineIndexCount; private uint[] _buffer; - +#pragma warning disable IDE0051 // Remove unused private member private readonly int _bufferOffset; +#pragma warning restore IDE0051 /// /// Indicates if any index buffer data has been pushed. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs index 5260c9233..402e3ff80 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.Graphics.Gpu.Engine.Threed { /// diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs index c9c14772a..35051c6e0 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs @@ -26,8 +26,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TessMode { - +#pragma warning disable CS0649 // Field is never assigned to public uint Packed; +#pragma warning restore CS0649 /// /// Unpacks the tessellation abstract patch type. @@ -62,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfBufferState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 Enable; public GpuVa Address; public int Size; @@ -70,7 +71,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Padding0; public uint Padding1; public uint Padding2; - +#pragma warning restore CS0649 } /// @@ -78,12 +79,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfState { - +#pragma warning disable CS0649 // Field is never assigned to public int BufferIndex; public int VaryingsCount; public int Stride; public uint Padding; - +#pragma warning restore CS0649 } /// @@ -91,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtColorState { - +#pragma warning disable CS0649 // Field is never assigned to public GpuVa Address; public int WidthOrStride; public int Height; @@ -107,7 +108,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int Padding3; public int Padding4; public int Padding5; - +#pragma warning restore CS0649 } /// @@ -115,7 +116,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportTransform { - +#pragma warning disable CS0649 // Field is never assigned to public float ScaleX; public float ScaleY; public float ScaleZ; @@ -124,6 +125,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public float TranslateZ; public uint Swizzle; public uint SubpixelPrecisionBias; +#pragma warning restore CS0649 /// /// Unpacks viewport swizzle of the position X component. @@ -167,14 +169,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportExtents { - +#pragma warning disable CS0649 // Field is never assigned to public ushort X; public ushort Width; public ushort Y; public ushort Height; public float DepthNear; public float DepthFar; - +#pragma warning restore CS0649 } /// @@ -182,10 +184,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferDrawState { - +#pragma warning disable CS0649 // Field is never assigned to public int First; public int Count; - +#pragma warning restore CS0649 } /// @@ -193,12 +195,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ClearColors { - +#pragma warning disable CS0649 // Field is never assigned to public float Red; public float Green; public float Blue; public float Alpha; - +#pragma warning restore CS0649 } /// @@ -206,11 +208,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct DepthBiasState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 PointEnable; public Boolean32 LineEnable; public Boolean32 FillEnable; - +#pragma warning restore CS0649 } /// @@ -229,14 +231,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScissorState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 Enable; public ushort X1; public ushort X2; public ushort Y1; public ushort Y2; public uint Padding; - +#pragma warning restore CS0649 } /// @@ -244,11 +246,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackMasks { - +#pragma warning disable CS0649 // Field is never assigned to public int FuncRef; public int Mask; public int FuncMask; - +#pragma warning restore CS0649 } /// @@ -256,12 +258,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtDepthStencilState { - +#pragma warning disable CS0649 // Field is never assigned to public GpuVa Address; public ZetaFormat Format; public MemoryLayout MemoryLayout; public int LayerSize; - +#pragma warning restore CS0649 } /// @@ -269,12 +271,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScreenScissorState { - +#pragma warning disable CS0649 // Field is never assigned to public ushort X; public ushort Width; public ushort Y; public ushort Height; - +#pragma warning restore CS0649 } /// @@ -317,8 +319,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexAttribState { - +#pragma warning disable CS0649 // Field is never assigned to public uint Attribute; +#pragma warning restore CS0649 /// /// Unpacks the index of the vertex buffer this attribute belongs to. @@ -380,8 +383,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtControl { - +#pragma warning disable CS0649 // Field is never assigned to public uint Packed; +#pragma warning restore CS0649 /// /// Unpacks the number of active draw buffers. @@ -408,7 +412,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct Size3D { - +#pragma warning disable CS0649 // Field is never assigned to public int Width; public int Height; public ushort Depth; @@ -418,6 +422,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { return (Flags & 1) == 0; } +#pragma warning restore CS0649 } /// @@ -425,7 +430,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilTestState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 Enable; public StencilOp FrontSFail; public StencilOp FrontDpFail; @@ -434,7 +439,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int FrontFuncRef; public int FrontFuncMask; public int FrontMask; - +#pragma warning restore CS0649 } /// @@ -452,11 +457,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RgbHalf { - +#pragma warning disable CS0649 // Field is never assigned to public uint R; public uint G; public uint B; public uint Padding; +#pragma warning restore CS0649 /// /// Unpacks the red color component as a 16-bit float value. @@ -506,10 +512,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PoolState { - +#pragma warning disable CS0649 // Field is never assigned to public GpuVa Address; public int MaximumId; - +#pragma warning restore CS0649 } /// @@ -517,13 +523,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackTestState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 TwoSided; public StencilOp BackSFail; public StencilOp BackDpFail; public StencilOp BackDpPass; public CompareOp BackFunc; - +#pragma warning restore CS0649 } /// @@ -531,10 +537,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PrimitiveRestartState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 Enable; public int Index; - +#pragma warning restore CS0649 } /// @@ -543,12 +549,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct IndexBufferState { - +#pragma warning disable CS0649 // Field is never assigned to public GpuVa Address; public GpuVa EndAddress; public IndexType Type; public int First; - +#pragma warning restore CS0649 } /// @@ -556,11 +562,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct FaceState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 CullEnable; public FrontFace FrontFace; public Face CullFace; - +#pragma warning restore CS0649 } /// @@ -578,10 +584,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct LogicalOpState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 Enable; public LogicalOp LogicalOp; - +#pragma warning restore CS0649 } /// @@ -639,10 +645,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferState { - +#pragma warning disable CS0649 // Field is never assigned to public uint Control; public GpuVa Address; public int Divisor; +#pragma warning restore CS0649 /// /// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory. @@ -668,7 +675,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendStateCommon { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -677,7 +684,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public uint Unknown0x1354; public BlendFactor AlphaDstFactor; - +#pragma warning restore CS0649 } /// @@ -685,7 +692,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendState { - +#pragma warning disable CS0649 // Field is never assigned to public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -694,7 +701,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public BlendFactor AlphaDstFactor; public uint Padding; - +#pragma warning restore CS0649 } /// @@ -702,7 +709,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ShaderState { - +#pragma warning disable CS0649 // Field is never assigned to public uint Control; public uint Offset; public uint Unknown0x8; @@ -719,6 +726,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Unknown0x34; public uint Unknown0x38; public uint Unknown0x3c; +#pragma warning restore CS0649 /// /// Unpacks shader enable information. @@ -736,16 +744,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct UniformBufferState { - +#pragma warning disable CS0649 // Field is never assigned to public int Size; public GpuVa Address; public int Offset; - +#pragma warning restore CS0649 } unsafe struct ThreedClassState : IShadowState { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -1044,6 +1052,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public Array4> TfVaryingLocations; public fixed uint Reserved2A00[640]; public Array256 SetMmeShadowScratch; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs index 2189e9d3f..2ea4709ec 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs @@ -486,10 +486,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct RenderSolidPrimPoint { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetX; public uint Y; - +#pragma warning restore CS0649 } /// @@ -497,7 +497,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// unsafe struct TwodClassState : IShadowState { - +#pragma warning disable CS0649 // Field is never assigned to public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -811,6 +811,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public readonly bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0; public fixed uint ReservedDF0[2436]; public Array256 SetMmeShadowScratch; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs index 897fb5a3f..8e8afb41c 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct TwodTexture { - +#pragma warning disable CS0649 // Field is never assigned to public ColorFormat Format; public Boolean32 LinearLayout; public MemoryLayout MemoryLayout; @@ -17,6 +17,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public int Width; public int Height; public GpuVa Address; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs index 1ea612bc7..404599908 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs @@ -5,9 +5,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct GpuVa { - +#pragma warning disable CS0649 // Field is never assigned to public uint High; public uint Low; +#pragma warning restore CS0649 /// /// Packs the split address into a 64-bits address value. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs index d243227e7..9af5e6103 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs @@ -5,8 +5,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct MemoryLayout { - +#pragma warning disable CS0649 // Field is never assigned to public uint Packed; +#pragma warning restore CS0649 public readonly int UnpackGobBlocksInX() { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs index f90eca1ef..e1cc8c01d 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs @@ -5,11 +5,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct SbDescriptor { - +#pragma warning disable CS0649 // Field is never assigned to public uint AddressLow; public uint AddressHigh; public int Size; public int Padding; +#pragma warning restore CS0649 public readonly ulong PackAddress() { diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs index 979ae226a..d0b8277da 100644 --- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -98,6 +98,7 @@ namespace Ryujinx.Graphics.Gpu /// internal DirtyHacks DirtyHacks { get; } + /// /// Host hardware capabilities. /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs index 66f4d4de1..ee217714c 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs @@ -1,5 +1,6 @@ using Ryujinx.Graphics.GAL; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Gpu.Image { @@ -554,6 +555,7 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Uscaled, Format.R10G10B10A2Uscaled }, { VertexAttributeFormat.A2B10G10R10Sscaled, Format.R10G10B10A2Sscaled }, }; +#pragma warning restore IDE0055 // Note: Some of those formats have been changed and requires conversion on the shader, // as GPUs don't support them when used as buffer texture format. @@ -638,7 +640,6 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Sint, (Format.R10G10B10A2Uint, 4) }, // Sint -> Uint { VertexAttributeFormat.A2B10G10R10Uscaled, (Format.R10G10B10A2Uint, 4) }, // Uscaled -> Uint { VertexAttributeFormat.A2B10G10R10Sscaled, (Format.R10G10B10A2Sint, 4) } // Sscaled -> Sint -#pragma warning restore IDE0055 }; /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs index cfc07a19a..cd97d68dd 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs @@ -53,6 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Image private const float Frac8ToF32 = 1.0f / 256.0f; +#pragma warning disable CS0649 // Field is never assigned to public uint Word0; public uint Word1; public uint Word2; @@ -61,6 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Image public float BorderColorG; public float BorderColorB; public float BorderColorA; +#pragma warning restore CS0649 /// /// Unpacks the texture wrap mode along the X axis. diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs index c6fde8d66..c82a555ee 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// struct TextureDescriptor : ITextureDescriptor, IEquatable { - +#pragma warning disable CS0649 // Field is never assigned to public uint Word0; public uint Word1; public uint Word2; @@ -18,6 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Image public uint Word5; public uint Word6; public uint Word7; +#pragma warning restore CS0649 /// /// Unpacks Maxwell texture format integer. diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs index fb1725532..32d92223f 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs @@ -9,13 +9,14 @@ namespace Ryujinx.Graphics.Gpu.Shader /// struct ShaderAddresses : IEquatable { - +#pragma warning disable CS0649 // Field is never assigned to public ulong VertexA; public ulong VertexB; public ulong TessControl; public ulong TessEvaluation; public ulong Geometry; public ulong Fragment; +#pragma warning restore CS0649 /// /// Check if the addresses are equal. diff --git a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs index f2abaf0c4..28f5d24b0 100644 --- a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct Host1xClassRegisters { - +#pragma warning disable CS0649 // Field is never assigned to public uint IncrSyncpt; public uint IncrSyncptCntrl; public uint IncrSyncptError; @@ -38,6 +38,6 @@ namespace Ryujinx.Graphics.Host1x public uint Xrefctrl; public uint ChannelXrefHi; public uint ChannelXrefLo; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs index 93a35d6ca..bb7534d8a 100644 --- a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct ThiRegisters { - +#pragma warning disable CS0649 // Field is never assigned to public uint IncrSyncpt; public uint Reserved4; public uint IncrSyncptErr; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Host1x public Array12 Reserved48; public uint IntStatus; public uint IntMask; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs index 5cdeb56d4..098622b2a 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec { - +#pragma warning disable CS0649 // Field is never assigned to public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint Profiles; public unsafe byte* WrapperName; public nint ChLayouts; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs index bb67291d9..256ccd0a8 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec501 { - +#pragma warning disable CS0649 // Field is never assigned to public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -18,6 +18,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public unsafe nint PrivClass; public nint Profiles; public unsafe byte* WrapperName; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs index c7b6e4582..96c1a0f67 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodecContext { - +#pragma warning disable CS0649 // Field is never assigned to public unsafe nint AvClass; public int LogLevelOffset; public int CodecType; @@ -165,6 +165,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long MaxSamples; public int ExportSideData; public nint GetEncodeBuffer; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs index 412810c47..46b1e06a7 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVFrame { - +#pragma warning disable CS0649 // Field is never assigned to public Array8 Data; public Array8 LineSize; public nint ExtendedData; @@ -29,6 +29,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long ReorderedOpaque; public int SampleRate; public ulong ChannelLayout; +#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs index bde283c3c..8df4e26a7 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVPacket { - +#pragma warning disable CS0649 // Field is never assigned to public unsafe AVBufferRef* Buf; public long Pts; public long Dts; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public AVBufferRef Opaque; public unsafe AVBufferRef* OpaqueRef; public AVRational TimeBase; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs index 29eedfdd1..09bcc9c31 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodec where T : struct { - +#pragma warning disable CS0649 // Field is never assigned to public T Base; public int CapsInternalOrCbType; public int PrivDataSize; @@ -12,6 +12,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint InitStaticData; public nint Init; public nint CodecCallback; +#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs index b9e345bc9..ee0db4730 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodecLegacy where T : struct { - +#pragma warning disable CS0649 // Field is never assigned to public T Base; public uint CapsInternalOrCbType; public int PrivDataSize; @@ -14,6 +14,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint EncodeSub; public nint Encode2; public nint Decode; +#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs index a565f50f8..546213215 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs @@ -6,10 +6,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types // passed it can be loaded into vector registers. internal struct LoopFilterThresh { - +#pragma warning disable CS0649 // Field is never assigned to public Array16 Mblim; public Array16 Lim; public Array16 HevThr; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs index 77b5ccd46..bc325715a 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecRegisters { - +#pragma warning disable CS0649 // Field is never assigned to public Array64 Reserved0; public uint Nop; public Array63 Reserved104; @@ -58,6 +58,6 @@ namespace Ryujinx.Graphics.Nvdec public uint Vp9SetColMvWriteBufOffset; public uint Vp9SetColMvReadBufOffset; public uint Vp9SetFilterBufferOffset; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs index 68a1a553e..1d6b4a60d 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecStatus { - +#pragma warning disable CS0649 // Field is never assigned to public uint MbsCorrectlyDecoded; public uint MbsInError; public uint Reserved; public uint ErrorStatus; public FrameStats Stats; public uint SliceHeaderErrorCode; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs index 08df2f83e..26ba2ea69 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs @@ -1,14 +1,13 @@ using Ryujinx.Common.Memory; using Ryujinx.Graphics.Video; -using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Nvdec.Types.H264 { - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PictureInfo { +#pragma warning disable IDE0051, CS0169, CS0649 // Remove unused private member Array18 Unknown0; - +#pragma warning restore IDE0051 public uint BitstreamSize; public uint NumSlices; public uint Unknown50; @@ -50,6 +49,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 public Array16 MvcextViewRefMasksL1; public uint Flags2; public Array10 Unknown2D4; +#pragma warning restore CS0169, CS0649 public readonly bool MbAdaptiveFrameFieldFlag => (Flags & (1 << 0)) != 0; public readonly bool Direct8x8InferenceFlag => (Flags & (1 << 1)) != 0; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs index 2411e03b1..c310abd67 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs @@ -4,10 +4,11 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 { struct ReferenceFrame { - +#pragma warning disable CS0649 // Field is never assigned to public uint Flags; public Array2 FieldOrderCnt; public uint FrameNum; +#pragma warning restore CS0649 public readonly uint OutputSurfaceIndex => (uint)Flags & 0x7f; } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs index c6c8a1fc1..a495cfc89 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 { struct PictureInfo { - +#pragma warning disable CS0649 // Field is never assigned to public Array13 Unknown0; public uint GpTimerTimeoutValue; public ushort FrameWidth; @@ -58,6 +58,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 public uint ResultValue; // ucode return result public Array8 PartitionOffset; public Array3 Reserved4; +#pragma warning restore CS0649 public Vp8PictureInfo Convert() { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs index 9a147922a..82a09866a 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct EntropyProbs { - +#pragma warning disable CS0649 // Field is never assigned to public Array10>> KfYModeProbE0ToE7; public Array10> KfYModeProbE8; public Array3 Padding384; @@ -42,6 +42,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public Array5 CompRefProb; public Array17 Padding58F; public Array4>>>>> CoefProbs; +#pragma warning restore CS0649 public void Convert(ref Vp9EntropyProbs fc) { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs index 28db92d5c..d41c7da13 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameSize { - +#pragma warning disable CS0649 // Field is never assigned to public ushort Width; public ushort Height; public ushort LumaPitch; public ushort ChromaPitch; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs index f8df2c6ea..47f17e4ed 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameStats { - +#pragma warning disable CS0649 // Field is never assigned to public uint Unknown0; public uint Unknown4; public uint Pass2CycleCount; @@ -16,6 +16,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint FrameStatusBwdMvyCnt; public uint ErrorCtbPos; public uint ErrorSlicePos; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs index 8ea31b0bb..139bd87b4 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct LoopFilter { - +#pragma warning disable CS0649 // Field is never assigned to public byte ModeRefDeltaEnabled; public Array4 RefDeltas; public Array2 ModeDeltas; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs index eec6adb9c..9da64bfab 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct PictureInfo { - +#pragma warning disable CS0649 // Field is never assigned to public Array12 Unknown0; public uint BitstreamSize; public uint IsEncrypted; @@ -42,6 +42,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint UnknownF4; public uint UnknownF8; public uint UnknownFC; +#pragma warning restore CS0649 public readonly uint BitDepth => (SurfaceParams >> 1) & 0xf; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs index a6d5c9232..098becc28 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct Segmentation { - +#pragma warning disable CS0649 // Field is never assigned to public byte Enabled; public byte UpdateMap; public byte TemporalUpdate; public byte AbsDelta; public Array8 FeatureMask; public Array8> FeatureData; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs index e3566b43f..bca79cb97 100644 --- a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs +++ b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.OpenGL _table = new FormatInfo[tableSize]; _tableImage = new SizedInternalFormat[tableSize]; - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, new FormatInfo(1, true, false, All.R8, PixelFormat.Red, PixelType.UnsignedByte)); Add(Format.R8Snorm, new FormatInfo(1, true, false, All.R8Snorm, PixelFormat.Red, PixelType.Byte)); Add(Format.R8Uint, new FormatInfo(1, false, false, All.R8ui, PixelFormat.RedInteger, PixelType.UnsignedByte)); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs index 9eae052cd..4b28f3878 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { _infoTable = new InstInfo[(int)Instruction.Count]; - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting Add(Instruction.AtomicAdd, InstType.AtomicBinary, "atomicAdd"); Add(Instruction.AtomicAnd, InstType.AtomicBinary, "atomicAnd"); Add(Instruction.AtomicCompareAndSwap, InstType.AtomicTernary, "atomicCompSwap"); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs index 217c6ae73..43ff12168 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs index 887d9d669..4fe214778 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs @@ -5,10 +5,11 @@ using Spv.Generator; using System; using System.Collections.Generic; using Instruction = Spv.Generator.Instruction; -using IrOperandType = Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandType; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { + using IrOperandType = IntermediateRepresentation.OperandType; + partial class CodeGenContext : Module { private const uint SpirvVersionMajor = 1; diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index fb290c48c..27b5c21c0 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -6,11 +6,12 @@ using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using static Spv.Specification; -using SpvInstruction = Spv.Generator.Instruction; -using SpvLiteralInteger = Spv.Generator.LiteralInteger; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { + using SpvInstruction = Spv.Generator.Instruction; + using SpvLiteralInteger = Spv.Generator.LiteralInteger; + static class Instructions { private const MemorySemanticsMask DefaultMemorySemantics = @@ -26,7 +27,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { _instTable = new Func[(int)Instruction.Count]; - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting Add(Instruction.Absolute, GenerateAbsolute); Add(Instruction.Add, GenerateAdd); Add(Instruction.AtomicAdd, GenerateAtomicAdd); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs index 8eadf9d4d..e1561446b 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs @@ -6,13 +6,14 @@ using System; using System.Collections.Generic; using System.Threading; using static Spv.Specification; -using SpvInstruction = Spv.Generator.Instruction; -using SpvInstructionPool = Spv.Generator.GeneratorPool; -using SpvLiteralInteger = Spv.Generator.LiteralInteger; -using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { + using SpvInstruction = Spv.Generator.Instruction; + using SpvInstructionPool = Spv.Generator.GeneratorPool; + using SpvLiteralInteger = Spv.Generator.LiteralInteger; + using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; + static class SpirvGenerator { // Resource pools for Spirv generation. Note: Increase count when more threads are being used. diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs index 303fd0830..8bf5671ac 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs @@ -3664,9 +3664,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstLepc { - +#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _opcode; - +#pragma warning restore IDE0052 public InstLepc(ulong opcode) => _opcode = opcode; } @@ -4181,9 +4181,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRam { - +#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _opcode; - +#pragma warning restore IDE0052 public InstRam(ulong opcode) => _opcode = opcode; } @@ -4252,9 +4252,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRtt { - +#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _opcode; - +#pragma warning restore IDE0052 public InstRtt(ulong opcode) => _opcode = opcode; } @@ -4270,9 +4270,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstSam { - +#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _opcode; - +#pragma warning restore IDE0052 public InstSam(ulong opcode) => _opcode = opcode; } diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs index d3eca6535..35367b8df 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Shader.Decoders _opCodes = new TableEntry[1 << EncodingBits]; #region Instructions - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting Add("1110111110100xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Al2p, InstEmit.Al2p, InstProps.Rd | InstProps.Ra); Add("1110111111011xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ald, InstEmit.Ald, InstProps.Rd | InstProps.Ra); Add("1110111111110xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ast, InstEmit.Ast, InstProps.Ra | InstProps.Rb2 | InstProps.Rc); diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs index 1b7997113..8061aec28 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs @@ -22,7 +22,9 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Depbar(EmitterContext context) { - _ = context.GetOp(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + InstDepbar op = context.GetOp(); +#pragma warning restore IDE0059 // No operation. } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs index 581111c42..2f3988119 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs @@ -510,8 +510,9 @@ namespace Ryujinx.Graphics.Shader.Instructions aLow = context.BitwiseNot(aLow); aHigh = context.BitwiseNot(aHigh); - _ = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + aLow = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); +#pragma warning restore IDE0059 aHigh = context.IAdd(aHigh, aLowCOut); } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs index c2c7626d2..c97e53bfe 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs @@ -219,8 +219,9 @@ namespace Ryujinx.Graphics.Shader.Instructions else { res = context.ISubtract(srcA, srcB); - - _ = context.IAdd(res, context.BitwiseNot(GetCF())); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + res = context.IAdd(res, context.BitwiseNot(GetCF())); +#pragma warning restore IDE0059 switch (cond) { diff --git a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs index 3b0e38542..61e6ecf5a 100644 --- a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs +++ b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { diff --git a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs index f7449671f..b2ddf6ab7 100644 --- a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs +++ b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { _infoTbl = new InstInfo[(int)Instruction.Count]; - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting // Inst Destination type Source 1 type Source 2 type Source 3 type Source 4 type Add(Instruction.AtomicAdd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); Add(Instruction.AtomicAnd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); diff --git a/src/Ryujinx.Graphics.Shader/TextureFormat.cs b/src/Ryujinx.Graphics.Shader/TextureFormat.cs index e8c164648..619598c7f 100644 --- a/src/Ryujinx.Graphics.Shader/TextureFormat.cs +++ b/src/Ryujinx.Graphics.Shader/TextureFormat.cs @@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Shader { return format switch { - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting TextureFormat.R8Unorm => "r8", TextureFormat.R8Snorm => "r8_snorm", TextureFormat.R8Uint => "r8ui", diff --git a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs index 85d58bb0a..496fbc235 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.Translation { diff --git a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index ead428986..94448626f 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblVertexInBounds, isVertexOob); this.Return(); - MarkLabel(lblVertexInBounds); + this.MarkLabel(lblVertexInBounds); Operand outputInstanceOffset = this.Load(StorageKind.Input, IoVariable.GlobalId, Const(1)); Operand instanceCount = this.Load(StorageKind.ConstantBuffer, vertexInfoCbBinding, Const((int)VertexInfoBufferField.VertexCounts), Const(1)); @@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblInstanceInBounds, isInstanceOob); this.Return(); - MarkLabel(lblInstanceInBounds); + this.MarkLabel(lblInstanceInBounds); if (TranslatorContext.Stage == ShaderStage.Vertex) { @@ -469,7 +469,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(alphaPassLabel, alphaPass); this.Discard(); - MarkLabel(alphaPassLabel); + this.MarkLabel(alphaPassLabel); } } @@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Shader.Translation Operand lblLoopHead = Label(); Operand lblExit = Label(); - MarkLabel(lblLoopHead); + this.MarkLabel(lblLoopHead); Operand writtenIndices = this.Load(StorageKind.LocalMemory, ResourceManager.LocalGeometryOutputIndexCountMemoryId); @@ -581,7 +581,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.Branch(lblLoopHead); - MarkLabel(lblExit); + this.MarkLabel(lblExit); } } @@ -617,7 +617,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(a2cDitherEndLabel, opaque); this.Discard(); - MarkLabel(a2cDitherEndLabel); + this.MarkLabel(a2cDitherEndLabel); } public Operation[] GetOperations() diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs index 4d84f9b28..b16cb0026 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Texture.Astc { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct AstcPixel { internal const int StructSize = 12; diff --git a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs index da14faa2b..4402df7e5 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs @@ -1,12 +1,14 @@ using Ryujinx.Common.Utilities; +using System; using System.Diagnostics; -using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.Texture.Astc { public struct BitStream128 { +#pragma warning disable IDE0044 // Make field readonly private Buffer16 _data; +#pragma warning restore IDE0044 public int BitsLeft { get; set; } public BitStream128(Buffer16 data) @@ -25,11 +27,13 @@ namespace Ryujinx.Graphics.Texture.Astc } int mask = (1 << bitCount) - 1; - int value = Unsafe.As(ref _data) & mask; + int value = _data.As() & mask; - ulong carry = _data.High << (64 - bitCount); - _data.Low = (_data.Low >> bitCount) | carry; - _data.High >>= bitCount; + Span span = _data.AsSpan(); + + ulong carry = span[1] << (64 - bitCount); + span[0] = (span[0] >> bitCount) | carry; + span[1] >>= bitCount; BitsLeft -= bitCount; @@ -47,21 +51,23 @@ namespace Ryujinx.Graphics.Texture.Astc ulong maskedValue = (uint)(value & ((1 << bitCount) - 1)); + Span span = _data.AsSpan(); + if (BitsLeft < 64) { ulong lowMask = maskedValue << BitsLeft; - _data.Low |= lowMask; + span[0] |= lowMask; } if (BitsLeft + bitCount > 64) { if (BitsLeft > 64) { - _data.High |= maskedValue << (BitsLeft - 64); + span[1] |= maskedValue << (BitsLeft - 64); } else { - _data.High |= maskedValue >> (64 - BitsLeft); + span[1] |= maskedValue >> (64 - BitsLeft); } } diff --git a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs index 5ef33280b..2e78f5d4d 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs @@ -4,9 +4,10 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct ClearRectStruct { - +#pragma warning disable CS0649 // Field is never assigned to private readonly long _word0; private readonly long _word1; +#pragma warning restore CS0649 public int ClearRect0Left => (int)_word0.Extract(0, 14); public int ClearRect0Right => (int)_word0.Extract(16, 14); diff --git a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs index 7e31125cc..2496a62e9 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Vic.Types { struct ConfigStruct { - +#pragma warning disable CS0649 // Field is never assigned to public PipeConfig PipeConfig; public OutputConfig OutputConfig; public OutputSurfaceConfig OutputSurfaceConfig; public MatrixStruct OutColorMatrix; public Array4 ClearRectStruct; public Array8 SlotStruct; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs index 7b4ead1f0..3ce6c93c5 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs @@ -4,9 +4,10 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputConfig { - +#pragma warning disable CS0649 // Field is never assigned to private readonly long _word0; private readonly long _word1; +#pragma warning restore CS0649 public int AlphaFillMode => (int)_word0.Extract(0, 3); public int AlphaFillSlot => (int)_word0.Extract(3, 3); diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs index e1ac6a091..e72a6a125 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs @@ -4,9 +4,10 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputSurfaceConfig { - +#pragma warning disable CS0649 // Field is never assigned to private readonly long _word0; private readonly long _word1; +#pragma warning restore CS0649 public PixelFormat OutPixelFormat => (PixelFormat)_word0.Extract(0, 7); public int OutChromaLocHoriz => (int)_word0.Extract(7, 2); diff --git a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs index c4b1c5fe9..1e0a7e641 100644 --- a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs @@ -1,13 +1,13 @@ using Ryujinx.Common.Utilities; -using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vic.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct PipeConfig { +#pragma warning disable CS0169, CS0649, IDE0051 // Remove unused private member private readonly long _word0; private readonly long _word1; +#pragma warning restore CS0169, CS0649, IDE0051 public int DownsampleHoriz => (int)_word0.Extract(0, 11); public int DownsampleVert => (int)_word0.Extract(16, 11); diff --git a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs index 921217b16..148d06815 100644 --- a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs @@ -11,8 +11,9 @@ namespace Ryujinx.Graphics.Vic.Types private readonly long _word4; private readonly long _word5; private readonly long _word6; - +#pragma warning disable IDE0051 // Remove unused private member private readonly long _word7; +#pragma warning restore IDE0051 public bool SlotEnable => _word0.Extract(0); public bool DeNoise => _word0.Extract(1); diff --git a/src/Ryujinx.Graphics.Vic/VicRegisters.cs b/src/Ryujinx.Graphics.Vic/VicRegisters.cs index 0f481fb9d..7ebc10d9a 100644 --- a/src/Ryujinx.Graphics.Vic/VicRegisters.cs +++ b/src/Ryujinx.Graphics.Vic/VicRegisters.cs @@ -4,16 +4,16 @@ namespace Ryujinx.Graphics.Vic { struct PlaneOffsets { - +#pragma warning disable CS0649 // Field is never assigned to public uint LumaOffset; public uint ChromaUOffset; public uint ChromaVOffset; - +#pragma warning restore CS0649 } struct VicRegisters { - +#pragma warning disable CS0649 // Field is never assigned to public Array64 Reserved0; public uint Nop; public Array15 Reserved104; @@ -46,6 +46,6 @@ namespace Ryujinx.Graphics.Vic public Array8 SetSlotContextId; public Array8 SetCompTagBufferOffset; public Array8 SetHistoryBufferOffset; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs index fcd649aac..1e54e8ece 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs @@ -607,7 +607,7 @@ namespace Ryujinx.Graphics.Vulkan srcHolder.SetDataUnchecked(0, data); Auto srcBuffer = srcHolder.GetBuffer(); - Auto dstBuffer = GetBuffer(cbs.Value.CommandBuffer, true); + Auto dstBuffer = this.GetBuffer(cbs.Value.CommandBuffer, true); Copy(_gd, cbs.Value, srcBuffer, dstBuffer, 0, offset, dataSize); diff --git a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs index d5b0b5be2..305224cad 100644 --- a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs +++ b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vulkan _table = new VkFormat[Enum.GetNames().Length]; _reverseMap = new Dictionary(); - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, VkFormat.R8Unorm); Add(Format.R8Snorm, VkFormat.R8SNorm); Add(Format.R8Uint, VkFormat.R8Uint); diff --git a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs index 2c0485b09..695046198 100644 --- a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -886,7 +886,7 @@ namespace Ryujinx.Graphics.Vulkan int primitiveCount = pattern.GetPrimitiveCount(indexCount); int convertedCount = pattern.GetConvertedCount(indexCount); int outputIndexSize = 4; - + Buffer dstBuffer = dstIndexBuffer.GetBuffer().Get(cbs, 0, convertedCount * outputIndexSize).Value; const int ParamsBufferSize = 16 * sizeof(int); diff --git a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs index 852634513..9054b2e71 100644 --- a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs +++ b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs @@ -1,5 +1,6 @@ using Ryujinx.Graphics.GAL; using System; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vulkan diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 8a498c203..eac47e60e 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -701,9 +701,7 @@ namespace Ryujinx.Graphics.Vulkan _vertexBufferUpdater.Commit(Cbs); } -#pragma warning disable CA1822 // Mark members as static public void SetAlphaTest(bool enable, float reference, CompareOp op) -#pragma warning restore CA1822 // Mark members as static { // This is currently handled using shader specialization, as Vulkan does not support alpha test. // In the future, we may want to use this to write the reference value into the support buffer, @@ -902,7 +900,6 @@ namespace Ryujinx.Graphics.Vulkan // TODO: Default levels (likely needs emulation on shaders?) } -#pragma warning disable CA1822 // Mark members as static public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) { // TODO. @@ -912,7 +909,6 @@ namespace Ryujinx.Graphics.Vulkan { // TODO. } -#pragma warning restore CA1822 // Mark members as static public void SetPrimitiveRestart(bool enable, int index) { @@ -1157,12 +1153,10 @@ namespace Ryujinx.Graphics.Vulkan _descriptorSetUpdater.SetUniformBuffers(CommandBuffer, buffers); } -#pragma warning disable CA1822 // Mark members as static public void SetUserClipDistance(int index, bool enableClip) { // TODO. } -#pragma warning restore CA1822 // Mark members as static public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs index ce7925b97..b066da8e8 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { - +#pragma warning disable CS0649 // Field is never assigned to [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgHeader { @@ -14,4 +14,5 @@ namespace Ryujinx.HLE.HOS.Applets public byte EnableSingleMode; public byte EnableIdentificationColor; } +#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs index e55de105d..d5a18d468 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs @@ -1,6 +1,6 @@ namespace Ryujinx.HLE.HOS.Applets { - +#pragma warning disable CS0649 // Field is never assigned to struct ControllerSupportArgPrivate { public uint PrivateSize; @@ -12,4 +12,5 @@ namespace Ryujinx.HLE.HOS.Applets public uint NpadStyleSet; public uint NpadJoyHoldType; } +#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs index 9f303dac6..0969493fa 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { - +#pragma warning disable CS0649 // Field is never assigned to // (8.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgV7 @@ -22,4 +22,5 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81); } } +#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs index 78717075e..886782553 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { - +#pragma warning disable CS0649 // Field is never assigned to // (1.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgVPre7 @@ -22,4 +22,5 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81); } } +#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs index 315e7b263..96cfd5903 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { - +#pragma warning disable CS0649 // Field is never assigned to [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportResultInfo { @@ -12,4 +12,5 @@ namespace Ryujinx.HLE.HOS.Applets public uint SelectedId; public uint Result; } +#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs index eb8e1c781..4c54b4666 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error { return systemLanguage switch { - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting SystemLanguage.Japanese => "ja", SystemLanguage.AmericanEnglish => "en-US", SystemLanguage.French => "fr", diff --git a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs index 4624891e2..69bff74a5 100644 --- a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs @@ -12,8 +12,9 @@ namespace Ryujinx.HLE.HOS.Applets private readonly Horizon _system; private AppletSession _normalSession; - +#pragma warning disable IDE0052 // Remove unread private member private AppletSession _interactiveSession; +#pragma warning restore IDE0052 public event EventHandler AppletStateChanged; diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs index 808fa605d..58871a069 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs @@ -43,11 +43,11 @@ namespace Ryujinx.HLE.HOS.Applets private SoftwareKeyboardConfig _keyboardForegroundConfig; // Configuration for background (inline) mode. - +#pragma warning disable IDE0052 // Remove unread private member private SoftwareKeyboardInitialize _keyboardBackgroundInitialize; private SoftwareKeyboardCustomizeDic _keyboardBackgroundDic; private SoftwareKeyboardDictSet _keyboardBackgroundDictSet; - +#pragma warning restore IDE0052 private SoftwareKeyboardUserWord[] _keyboardBackgroundUserWords; private byte[] _transferMemory; diff --git a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs index f8f30c188..30c838ca0 100644 --- a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs +++ b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs @@ -6,8 +6,9 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast { // TODO: Compute inside the Demangler public BaseNode Reference; - +#pragma warning disable IDE0052 // Remove unread private member private readonly int _index; +#pragma warning restore IDE0052 public ForwardTemplateReference(int index) : base(NodeType.ForwardTemplateReference) { diff --git a/src/Ryujinx.HLE/HOS/Horizon.cs b/src/Ryujinx.HLE/HOS/Horizon.cs index 878750f0b..5063b4329 100644 --- a/src/Ryujinx.HLE/HOS/Horizon.cs +++ b/src/Ryujinx.HLE/HOS/Horizon.cs @@ -36,10 +36,11 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; -using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager; namespace Ryujinx.HLE.HOS { + using TimeServiceManager = Services.Time.TimeManager; + public class Horizon : IDisposable { internal const int HidSize = 0x40000; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs index 1b37e1fce..1ff37282f 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs @@ -4,8 +4,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightClientSession : KAutoObject { - +#pragma warning disable IDE0052 // Remove unread private member private readonly KLightSession _parent; +#pragma warning restore IDE0052 public KLightClientSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs index c1eecae26..c355409ec 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs @@ -4,8 +4,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightServerSession : KAutoObject { - +#pragma warning disable IDE0052 // Remove unread private member private readonly KLightSession _parent; +#pragma warning restore IDE0052 public KLightServerSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs index cfaa111e3..84ebcbc3e 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs @@ -8,7 +8,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc public KServerPort ServerPort { get; } public KClientPort ClientPort { get; } +#pragma warning disable IDE0052 // Remove unread private member private readonly string _name; +#pragma warning restore IDE0052 private readonly ChannelState _state; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs index b6b55bc5a..58d79c31f 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs @@ -86,10 +86,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30]; +#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _heapAddress; private readonly ulong _heapSize; private ulong _usedSize; - +#pragma warning restore IDE0052 private readonly int _blocksCount; private readonly Block[] _blocks; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs index e748378ed..6ca54355e 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace Ryujinx.HLE.HOS.Kernel.Process { diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs index 4a5762747..beec621bf 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs @@ -1,9 +1,7 @@ using Ryujinx.HLE.HOS.Kernel.Memory; -using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { - [StructLayout(LayoutKind.Sequential, Pack = 4)] struct MemoryInfo { public ulong Address; @@ -13,7 +11,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public KMemoryPermission Permission; public int IpcRefCount; public int DeviceRefCount; +#pragma warning disable CS0414, IDE0052 // Remove unread private member private readonly int _padding; +#pragma warning restore CS0414, IDE0052 public MemoryInfo( ulong address, diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index 76a8ed78c..c67220617 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x5f)] - public static Result FlushProcessDataCache(int processHandle, ulong address, ulong size) + public Result FlushProcessDataCache(int processHandle, ulong address, ulong size) { // FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0. // As we don't support (and don't actually need) to flush the cache, this is stubbed. @@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x22)] - public static Result SendSyncRequestWithUserBuffer( + public Result SendSyncRequestWithUserBuffer( [PointerSized] ulong messagePtr, [PointerSized] ulong messageSize, int handle) @@ -901,7 +901,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(2)] - public static Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -934,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(3)] - public static Result SetMemoryAttribute( + public Result SetMemoryAttribute( [PointerSized] ulong address, [PointerSized] ulong size, MemoryAttribute attributeMask, @@ -983,7 +983,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(4)] - public static Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1020,7 +1020,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(5)] - public static Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1057,7 +1057,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(6)] - public static Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) + public Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) { Result result = QueryMemory(out MemoryInfo info, out pageInfo, address); @@ -1092,7 +1092,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x13)] - public static Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1139,7 +1139,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x14)] - public static Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1244,7 +1244,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x51)] - public static Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1291,7 +1291,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x52)] - public static Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1332,7 +1332,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2c)] - public static Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1368,7 +1368,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2d)] - public static Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1445,7 +1445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x4c)] - public static Result ControlCodeMemory( + public Result ControlCodeMemory( int handle, CodeMemoryOperation op, ulong address, @@ -1524,7 +1524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x73)] - public static Result SetProcessMemoryPermission( + public Result SetProcessMemoryPermission( int handle, ulong src, ulong size, @@ -1566,7 +1566,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x74)] - public static Result MapProcessMemory( + public Result MapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1623,7 +1623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x75)] - public static Result UnmapProcessMemory( + public Result UnmapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1669,7 +1669,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x77)] - public static Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1707,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x78)] - public static Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1752,7 +1752,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall // System [Svc(0x7b)] - public static Result TerminateProcess(int handle) + public Result TerminateProcess(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -1782,7 +1782,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(7)] - public static void ExitProcess() + public void ExitProcess() { KernelStatic.GetCurrentProcess().TerminateCurrentProcess(); } @@ -1878,7 +1878,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x26)] - public static void Break(ulong reason) + public void Break(ulong reason) { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -1905,7 +1905,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x27)] - public static void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) + public void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2371,7 +2371,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x30)] - public static Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) + public Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2393,7 +2393,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x31)] - public static Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) + public Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2415,7 +2415,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x37)] - public static Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) + public Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) { peak = 0; @@ -2447,7 +2447,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x7e)] - public static Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) + public Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) { if (resource >= LimitableResource.Count) { @@ -2542,7 +2542,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(9)] - public static Result StartThread(int handle) + public Result StartThread(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2570,7 +2570,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xa)] - public static void ExitThread() + public void ExitThread() { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2602,7 +2602,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xc)] - public static Result GetThreadPriority(out int priority, int handle) + public Result GetThreadPriority(out int priority, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2623,7 +2623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xd)] - public static Result SetThreadPriority(int handle, int priority) + public Result SetThreadPriority(int handle, int priority) { // TODO: NPDM check. @@ -2642,7 +2642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xe)] - public static Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) + public Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2665,7 +2665,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xf)] - public static Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) + public Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -2714,13 +2714,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x10)] - public static int GetCurrentProcessorNumber() + public int GetCurrentProcessorNumber() { return KernelStatic.GetCurrentThread().CurrentCore; } [Svc(0x25)] - public static Result GetThreadId(out ulong threadUid, int handle) + public Result GetThreadId(out ulong threadUid, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2741,7 +2741,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x32)] - public static Result SetThreadActivity(int handle, bool pause) + public Result SetThreadActivity(int handle, bool pause) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2766,7 +2766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x33)] - public static Result GetThreadContext3([PointerSized] ulong address, int handle) + public Result GetThreadContext3([PointerSized] ulong address, int handle) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2931,7 +2931,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1a)] - public static Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) + public Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2949,7 +2949,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1b)] - public static Result ArbitrateUnlock([PointerSized] ulong mutexAddress) + public Result ArbitrateUnlock([PointerSized] ulong mutexAddress) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2967,7 +2967,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1c)] - public static Result WaitProcessWideKeyAtomic( + public Result WaitProcessWideKeyAtomic( [PointerSized] ulong mutexAddress, [PointerSized] ulong condVarAddress, int handle, @@ -2998,7 +2998,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1d)] - public static Result SignalProcessWideKey([PointerSized] ulong address, int count) + public Result SignalProcessWideKey([PointerSized] ulong address, int count) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -3008,7 +3008,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x34)] - public static Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) + public Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) { if (IsPointingInsideKernel(address)) { @@ -3040,7 +3040,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x35)] - public static Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) + public Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) { if (IsPointingInsideKernel(address)) { @@ -3067,7 +3067,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x36)] - public static Result SynchronizePreemptionState() + public Result SynchronizePreemptionState() { KernelStatic.GetCurrentThread().SynchronizePreemptionState(); diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs index 9998c9209..cca6dda0f 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs @@ -1,10 +1,8 @@ using ARMeilleure.State; using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ThreadContext { public Array29 Registers; @@ -13,9 +11,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public ulong Sp; public ulong Pc; public uint Pstate; - +#pragma warning disable CS0169, IDE0051 // Remove unused private member private readonly uint _padding; - +#pragma warning restore CS0169, IDE0051 public Array32 FpuRegisters; public uint Fpcr; public uint Fpsr; diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs index 534c06dd7..8c86788b1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Security.Claims; using System.Security.Cryptography; +using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -18,7 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService // TODO: Determine where and how NetworkServiceAccountId is set. private const long NetworkServiceAccountId = 0xcafe; +#pragma warning disable IDE0052 // Remove unread private member private readonly UserId _userId; +#pragma warning restore IDE0052 private byte[] _cachedTokenData; private DateTime _cachedTokenExpiry; @@ -125,8 +128,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService public ResultCode LoadIdTokenCache(ServiceCtx context) { ulong bufferPosition = context.Request.ReceiveBuff[0].Position; - +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong bufferSize = context.Request.ReceiveBuff[0].Size; +#pragma warning restore IDE0059 // NOTE: This opens the file at "su/cache/USERID_IN_UUID_STRING.dat" (where USERID_IN_UUID_STRING is formatted as "%08x-%04x-%04x-%02x%02x-%08x%04x") // in the "account:/" savedata and writes some data in the buffer. @@ -152,11 +156,6 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService byte[] tokenData = _cachedTokenData; - if ((ulong)tokenData.Length > bufferSize) - { - return ResultCode.InvalidIdTokenCacheBufferSize; - } - context.Memory.Write(bufferPosition, tokenData); context.ResponseData.Write(tokenData.Length); diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs index 74a4ed2ba..a6b1a47b6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Account.Acc { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] public readonly record struct UserId { public readonly long High; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs index 1e5795408..05a4b0a63 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs @@ -10,8 +10,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetExpectedMasterVolume(f32, f32) public ResultCode SetExpectedMasterVolume(ServiceCtx context) { - _ = context.RequestData.ReadSingle(); // applet volume - _ = context.RequestData.ReadSingle(); // library applet volume +#pragma warning disable IDE0059 // Remove unnecessary value assignment + float appletVolume = context.RequestData.ReadSingle(); + float libraryAppletVolume = context.RequestData.ReadSingle(); +#pragma warning restore IDE0059 Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -44,9 +46,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // ChangeMainAppletMasterVolume(f32, u64) public ResultCode ChangeMainAppletMasterVolume(ServiceCtx context) { - // Unknown parameters. - _ = context.RequestData.ReadSingle(); - _ = context.RequestData.ReadInt64(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + float unknown0 = context.RequestData.ReadSingle(); + long unknown1 = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -57,8 +60,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetTransparentVolumeRate(f32) public ResultCode SetTransparentVolumeRate(ServiceCtx context) { - // Unknown parameter. - _ = context.RequestData.ReadSingle(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + float unknown0 = context.RequestData.ReadSingle(); +#pragma warning restore IDE0059 Logger.Stub?.PrintStub(LogClass.ServiceAm); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs index c60a7fafc..ad776fe6e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs @@ -18,8 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly Apm.SystemManagerServer _apmSystemManagerServer; private bool _vrModeEnabled; +#pragma warning disable CS0414, IDE0052 // Remove unread private member private bool _lcdBacklighOffEnabled; private bool _requestExitToLibraryAppletAtExecuteNextProgramEnabled; +#pragma warning restore CS0414, IDE0052 private int _messageEventHandle; private int _displayResolutionChangedEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs index dcfbde54d..23ba99b04 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs @@ -12,8 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys public ResultCode CreateLibraryApplet(ServiceCtx context) { AppletId appletId = (AppletId)context.RequestData.ReadInt32(); - - _ = context.RequestData.ReadInt32(); // libraryAppletMode +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int libraryAppletMode = context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 MakeObject(context, new ILibraryAppletAccessor(appletId, context.Device.System)); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs index 7d7b56af7..8e0f515ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs @@ -25,21 +25,21 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly ulong _accumulatedSuspendedTickValue = 0; // TODO: Determine where those fields are used. - +#pragma warning disable IDE0052 // Remove unread private member private bool _screenShotPermission = false; private bool _operationModeChangedNotification = false; private bool _performanceModeChangedNotification = false; private bool _restartMessageEnabled = false; private bool _outOfFocusSuspendingEnabled = false; private bool _handlesRequestToDisplay = false; - +#pragma warning restore IDE0052 private bool _autoSleepDisabled = false; - +#pragma warning disable IDE0052 // Remove unread private member private bool _albumImageTakenNotificationEnabled = false; private bool _recordVolumeMuted = false; private uint _screenShotImageOrientation = 0; - +#pragma warning restore IDE0052 private uint _idleTimeDetectionExtension = 0; public ISelfController(ServiceCtx context, ulong pid) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs index 424e9fc63..926632531 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs @@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE { try { - Push(item); + this.Push(item); return true; } @@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public bool TryTake(out T item) { - return TryPop(out item); + return this.TryPop(out item); } public T Peek() @@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void CopyTo(Array array, int index) { - CopyTo((T[])array, index); + this.CopyTo((T[])array, index); } public IEnumerator GetEnumerator() diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs index 0e2d5ee07..a3f44a45d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void Push(byte[] item) { - if (!TryPush(item)) + if (!this.TryPush(item)) { // TODO(jduncanator): Throw a proper exception throw new InvalidOperationException(); @@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public byte[] Pop() { - if (TryPop(out byte[] item)) + if (this.TryPop(out byte[] item)) { return item; } @@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE /// public AppletSession GetConsumer() { - return new AppletSession(_outputData, _inputData); + return new AppletSession(this._outputData, this._inputData); } } } diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs index a901de003..26089bddb 100644 --- a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs +++ b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs @@ -8,8 +8,9 @@ namespace Ryujinx.HLE.HOS.Services.Arp public int Version; public byte BaseGameStorageId; public byte UpdateGameStorageId; - +#pragma warning disable CS0649 // Field is never assigned to public short Padding; +#pragma warning restore CS0649 public static ApplicationLaunchProperty Default { diff --git a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs index 5cbdbd368..8f2642695 100644 --- a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs @@ -10,7 +10,9 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth [Service("btdrv")] class IBluetoothDriver : IpcService { +#pragma warning disable CS0414, IDE0052 // Remove unread private member private string _unknownLowEnergy; +#pragma warning restore CS0414, IDE0052 public IBluetoothDriver(ServiceCtx context) { } diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs index d65203156..3caea0f6c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs @@ -23,8 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SetShimLibraryVersion(ServiceCtx context) { ulong shimLibraryVersion = context.RequestData.ReadUInt64(); - - _ = context.RequestData.ReadUInt64(); // applet Resource user id +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong appletResourceUserId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 // TODO: Service checks if the pid is present in an internal list and returns ResultCode.BlacklistedPid if it is. // The list contents needs to be determined. diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs index 91d363eb5..0723b57cc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs @@ -20,13 +20,15 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SaveScreenShotEx0(ServiceCtx context) { // TODO: Use the ScreenShotAttribute. - _ = context.RequestData.ReadStruct(); // screenShotAttribute - - _ = context.RequestData.ReadUInt32(); // unknown +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ScreenShotAttribute screenShotAttribute = context.RequestData.ReadStruct(); + uint unknown = context.RequestData.ReadUInt32(); +#pragma warning restore IDE0059 ulong appletResourceUserId = context.RequestData.ReadUInt64(); - - _ = context.RequestData.ReadUInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pidPlaceholder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 ulong screenshotDataPosition = context.Request.SendBuff[0].Position; ulong screenshotDataSize = context.Request.SendBuff[0].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs index 4ea7c8294..155077745 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs @@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Fatal Logger.Info?.Print(LogClass.ServiceFatal, errorReport.ToString()); - Kernel.SupervisorCall.Syscall.Break((ulong)resultCode); + context.Device.System.KernelContext.Syscall.Break((ulong)resultCode); return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs index 8d7d3ce89..08ede2b5b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs @@ -50,10 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs // -> object contentFs public ResultCode OpenFileSystemWithId(ServiceCtx context) { - - _ = (FileSystemType)context.RequestData.ReadInt32(); // fileSystemType - _ = context.RequestData.ReadUInt64(); // titleId - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32(); + ulong titleId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 string switchPath = ReadUtf8String(context); string fullPath = FileSystem.VirtualFileSystem.SwitchPathToSystemPath(switchPath); @@ -793,9 +793,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs public ResultCode OpenDataStorageByDataId(ServiceCtx context) { StorageId storageId = (StorageId)context.RequestData.ReadByte(); - - _ = context.RequestData.ReadBytes(7); // Skip 7 bytes of padding. - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + byte[] padding = context.RequestData.ReadBytes(7); +#pragma warning restore IDE0059 ulong titleId = context.RequestData.ReadUInt64(); // We do a mitm here to find if the request is for an AOC. diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs index 932848690..66b5a5cba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs @@ -101,6 +101,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result; result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result; #pragma warning restore IDE0055 + return result; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 8fa35cd43..834bee6f0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -254,7 +254,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid switch (type) { - #pragma warning disable IDE0055 // Disable formatting case ControllerType.ProController: controller.StyleSet = NpadStyleTag.FullKey; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs index f0c2b53de..93f19c915 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs @@ -8,7 +8,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer // ActivateVibrationDevice(nn::hid::VibrationDeviceHandle) public ResultCode ActivateVibrationDevice(ServiceCtx context) { - _ = context.RequestData.ReadInt32(); // vibrationDeviceHandle +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int vibrationDeviceHandle = context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 9835e576d..0d2fcaa2a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid private long _npadCommunicationMode; private uint _accelerometerPlayMode; - +#pragma warning disable CS0649 // Field is never assigned to private readonly long _vibrationGcErmCommand; - +#pragma warning restore CS0649 private float _sevenSixAxisSensorFusionStrength; private SensorFusionParameters _sensorFusionParams; @@ -64,7 +64,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // CreateAppletResource(nn::applet::AppletResourceUserId) -> object public ResultCode CreateAppletResource(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem)); @@ -733,6 +735,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag public ResultCode GetSupportedNpadStyleSet(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets); @@ -746,8 +751,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array) public ResultCode SetSupportedNpadIdType(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // appletResourceUserId - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 ulong arrayPosition = context.Request.PtrBuff[0].Position; ulong arraySize = context.Request.PtrBuff[0].Size; @@ -898,7 +904,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType) public ResultCode SetNpadJoyHoldType(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64(); @@ -924,7 +932,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType public ResultCode GetNpadJoyHoldType(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers()) { @@ -945,8 +955,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding - - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -979,8 +990,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding - - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -1219,7 +1231,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid FrequencyHigh = context.RequestData.ReadSingle(), }; - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 Dictionary dualVibrationValues = new() { @@ -1243,7 +1257,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid Reserved = context.RequestData.ReadByte(), }; - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position); @@ -1288,7 +1304,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationValues(nn::applet::AppletResourceUserId, buffer, type: 9>, buffer, type: 9>) public ResultCode SendVibrationValues(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size]; @@ -1378,8 +1396,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid // IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) public ResultCode IsVibrationDeviceMounted(ServiceCtx context) { - _ = context.RequestData.ReadInt32(); // VibrationDeviceHandle - _ = context.RequestData.ReadInt64(); // appletResourceUserId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int vibrationDeviceHandle = context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 // NOTE: Service use vibrationDeviceHandle to get the PlayerIndex. // And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs index 0bb8c6c9c..8e061351e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Hid { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct BusHandle { public int AbstractedPadId; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index df5e72624..99f2f59e4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -1,18 +1,20 @@ using Ryujinx.Common.Memory; using System; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Threading; namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RingLifo where T : unmanaged, ISampledDataStruct { private const ulong MaxEntries = 17; +#pragma warning disable IDE0051, CS0169 // Remove unused private member private readonly ulong _unused; +#pragma warning restore IDE0051, CS0169 +#pragma warning disable CS0414, IDE0052 // Remove unread private member private ulong _bufferCount; +#pragma warning restore CS0414, IDE0052 private ulong _index; private ulong _count; private Array17> _storage; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs index 26e2e2372..41e841342 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs @@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NpadGcTriggerState : ISampledDataStruct { - +#pragma warning disable CS0649 // Field is never assigned to public ulong SamplingNumber; public uint TriggerL; public uint TriggerR; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs index f57f79aaf..f79a2657e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs @@ -23,9 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public RingLifo JoyLeftSixAxisSensor; public RingLifo JoyRightSixAxisSensor; public DeviceType DeviceType; - +#pragma warning disable IDE0051 // Remove unused private member private readonly uint _reserved1; - +#pragma warning restore IDE0051 public NpadSystemProperties SystemProperties; public NpadSystemButtonProperties SystemButtonProperties; public NpadBatteryLevel BatteryLevelJoyDual; @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public NpadBatteryLevel BatteryLevelJoyRight; public uint AppletFooterUiAttributes; public AppletFooterUiType AppletFooterUiType; - +#pragma warning disable IDE0051 // Remove unused private member private readonly Reserved2Struct _reserved2; - +#pragma warning restore IDE0051 public RingLifo GcTrigger; public NpadLarkType LarkTypeLeftAndMain; public NpadLarkType LarkTypeRight; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs index cc54c2248..06be9b24c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs @@ -1,22 +1,19 @@ -using System.Runtime.InteropServices; - namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen { - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TouchState { public ulong DeltaTime; - +#pragma warning disable CS0649 // Field is never assigned to public TouchAttribute Attribute; - +#pragma warning restore CS0649 public uint FingerId; public uint X; public uint Y; public uint DiameterX; public uint DiameterY; public uint RotationAngle; - +#pragma warning disable CS0169, IDE0051 // Remove unused private member private readonly uint _reserved; - +#pragma warning restore CS0169, IDE0051 } } diff --git a/src/Ryujinx.HLE/HOS/Services/IpcService.cs b/src/Ryujinx.HLE/HOS/Services/IpcService.cs index 11d4f57a1..4c354ebc6 100644 --- a/src/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/src/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -129,8 +129,9 @@ namespace Ryujinx.HLE.HOS.Services } } - _ = context.RequestData.ReadInt64(); // sfci magic - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long sfciMagic = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 int commandId = (int)context.RequestData.ReadInt64(); bool serviceExists = service.CmifCommands.TryGetValue(commandId, out MethodInfo processRequest); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs index 7f9964b38..667230b81 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy protected override void OnReceived(byte[] buffer, long offset, long size) { - _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, Socket.RemoteEndPoint); + _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, this.Socket.RemoteEndPoint); } protected override void OnError(SocketError error) @@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy { try { - if (endPoint.Equals(Socket.RemoteEndPoint)) + if (endPoint.Equals(this.Socket.RemoteEndPoint)) { NodeInfo = info; _protocol.InvokeAccept(this); diff --git a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs index 203cf5537..18b267e91 100644 --- a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.Loader { enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs index deed6cbf6..44054e6b8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs @@ -102,7 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types coreData.SetDefault(); - #pragma warning disable IDE0055 // Disable formatting +#pragma warning disable IDE0055 // Disable formatting coreData.Nickname = template.Nickname; coreData.FontRegion = (FontRegion)template.FontRegion; coreData.FavoriteColor = (byte)template.FavoriteColor; diff --git a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs index c4695e7c0..71ed56385 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs @@ -1,7 +1,6 @@ using LibHac.Ncm; using LibHac.Tools.FsSystem.NcaUtils; using Ryujinx.HLE.FileSystem; -using System; using System.Text; using static Ryujinx.HLE.Utilities.StringUtils; @@ -229,16 +228,12 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager if (!string.IsNullOrWhiteSpace(contentPath)) { ulong position = context.Request.RecvListBuff[0].Position; - +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong size = context.Request.RecvListBuff[0].Size; +#pragma warning restore IDE0059 byte[] contentPathBuffer = Encoding.UTF8.GetBytes(contentPath); - if ((ulong)contentPathBuffer.Length > size) - { - throw new InvalidOperationException("Content path buffer size is too small."); - } - context.Memory.Write(position, contentPathBuffer); } else @@ -252,8 +247,9 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager private void DeleteContentPath(ServiceCtx context, ulong titleId, NcaContentType contentType) { ContentManager contentManager = context.Device.System.ContentManager; - - //string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); +#pragma warning restore IDE0059 contentManager.ClearEntry(titleId, NcaContentType.Manual, _storageId); } diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index 06e283f6b..0e11493d5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -339,6 +339,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath()); + public static DateTime DateTimeFromTag(ushort dateTimeTag) { try diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs index cbff95478..5f8d0faaa 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs @@ -22,10 +22,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption if (dumpData.Length < 540) throw new ArgumentException("Incomplete dump. Amiibo data is at least 540 bytes."); - data = new byte[540]; - Array.Copy(dumpData, data, dumpData.Length); - dataMasterKey = dataKey; - tagMasterKey = tagKey; + this.data = new byte[540]; + Array.Copy(dumpData, this.data, dumpData.Length); + this.dataMasterKey = dataKey; + this.tagMasterKey = tagKey; this.isLocked = isLocked; if (!isLocked) @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Append data based on magic size int append = 16 - key.MagicSize; byte[] extract = new byte[16]; - Array.Copy(data, 0x011, extract, 0, 2); // Extract two bytes from user data section + Array.Copy(this.data, 0x011, extract, 0, 2); // Extract two bytes from user data section for (int i = 2; i < 16; i++) { extract[i] = 0x00; @@ -57,13 +57,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Extract the UID (UID is 8 bytes) byte[] uid = new byte[8]; - Array.Copy(data, 0x000, uid, 0, 8); + Array.Copy(this.data, 0x000, uid, 0, 8); seed.AddRange(uid); seed.AddRange(uid); // Extract some tag data (pages 0x20 - 0x28) byte[] user = new byte[32]; - Array.Copy(data, 0x060, user, 0, 32); + Array.Copy(this.data, 0x060, user, 0, 32); // XOR it with the key padding (XorPad) byte[] paddedUser = new byte[32]; @@ -137,10 +137,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption private void DeriveKeysAndCipher() { // Derive HMAC Tag Key - hmacTagKey = DeriveKey(tagMasterKey, false, out _, out _); + this.hmacTagKey = DeriveKey(this.tagMasterKey, false, out _, out _); // Derive HMAC Data Key and AES Key/IV - hmacDataKey = DeriveKey(dataMasterKey, true, out aesKey, out aesIv); + this.hmacDataKey = DeriveKey(this.dataMasterKey, true, out aesKey, out aesIv); } private void DecryptData() diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index 94037af0a..ca833e33d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -18,10 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { class INfp : IpcService { - +#pragma warning disable IDE0052 // Remove unread private member private ulong _appletResourceUserId; private ulong _mcuVersionData; - +#pragma warning restore IDE0052 private byte[] _mcuData; private State _state = State.NonInitialized; @@ -482,8 +482,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // Flush(bytes<8, 4>) public ResultCode Flush(ServiceCtx context) { - _ = (uint)context.RequestData.ReadUInt64(); // Device handle - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint deviceHandle = (uint)context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 if (context.Device.System.NfpDevices.Count == 0) { return ResultCode.DeviceNotFound; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index 96a510921..dd4efce6e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -155,6 +155,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context) { ulong position = context.Request.PtrBuff[0].Position; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong size = context.Request.PtrBuff[0].Size; +#pragma warning restore IDE0059 int clientId = context.Memory.Read(position); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs index 05e636323..577d03822 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs @@ -21,7 +21,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService private int _event0Handle; private int _event1Handle; +#pragma warning disable IDE0052 // Remove unread private member private readonly uint _version; +#pragma warning restore IDE0052 public IRequest(Horizon system, uint version) { @@ -116,7 +118,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // GetAppletInfo(u32) -> (u32, u32, u32, buffer) public ResultCode GetAppletInfo(ServiceCtx context) { - _ = context.RequestData.ReadUInt32(); // Theme color +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint themeColor = context.RequestData.ReadUInt32(); +#pragma warning restore IDE0059 Logger.Stub?.PrintStub(LogClass.ServiceNifm); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs index 3b7bf7076..fa780fd2e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct InternetConnectionStatus { public InternetConnectionType Type; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs index cb50ab85e..9d902a1ad 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct IpV4Address { public uint Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs index 46575e51e..c77358803 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs @@ -44,6 +44,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CountAddOnContent(pid) -> u32 public ResultCode CountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return CountAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -53,6 +57,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer) public ResultCode ListAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return ListAddContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -71,6 +79,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentBaseId(pid) -> u64 public ResultCode GetAddOnContentBaseId(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return GetAddOnContentBaseIdImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -89,6 +101,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // PrepareAddOnContent(u32 index, pid) public ResultCode PrepareAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return PrepareAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -115,6 +131,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentListChangedEventWithProcessId(pid) -> handle public ResultCode GetAddOnContentListChangedEventWithProcessId(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // TODO: Found where stored value is used. @@ -132,6 +152,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyMountAddOnContent(pid, u64 title_id) public ResultCode NotifyMountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -148,6 +172,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyUnmountAddOnContent(pid, u64 title_id) public ResultCode NotifyUnmountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -161,6 +189,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CheckAddOnContentMountStatus(pid) public ResultCode CheckAddOnContentMountStatus(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // Then it does some internal checks and returns InvalidBufferSize if they fail. diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index fd9689186..f510da594 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -12,9 +12,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { - - _ = context.RequestData.ReadInt64(); // source - _ = context.RequestData.ReadUInt64(); // titleId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + byte source = (byte)context.RequestData.ReadInt64(); + ulong titleId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs index 1e820c0c3..ca7d42b48 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs @@ -11,9 +11,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { - - _ = context.RequestData.ReadInt64(); // source - _ = context.RequestData.ReadUInt64(); // titleId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + byte source = (byte)context.RequestData.ReadInt64(); + ulong titleId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index 843b66caf..fea09ef47 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -93,8 +93,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv private NvResult GetIoctlArgument(ServiceCtx context, NvIoctl ioctlCommand, out Span arguments) { (ulong inputDataPosition, ulong inputDataSize) = context.Request.GetBufferType0x21(0); - - (_, ulong outputDataSize) = context.Request.GetBufferType0x22(0); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong outputDataPosition, ulong outputDataSize) = context.Request.GetBufferType0x22(0); +#pragma warning restore IDE0059 NvIoctl.Direction ioctlDirection = ioctlCommand.DirectionValue; uint ioctlSize = ioctlCommand.Size; @@ -306,8 +307,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv // Initialize(u32 transfer_memory_size, handle current_process, handle transfer_memory) -> u32 error_code public ResultCode Initialize(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // transfer memory size - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long transferMemSize = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 int transferMemHandle = context.Request.HandleDesc.ToCopy[1]; // TODO: When transfer memory will be implemented, this could be removed. @@ -429,7 +431,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv // SetClientPID(u64, pid) -> u32 error_code public ResultCode SetClientPid(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long pid = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 context.ResponseData.Write(0); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs index 10f602ad2..231fa7c13 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct AllocSpaceArguments { public uint Pages; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs index 639619dd0..51fac8d8f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct BindChannelArguments { public int Fd; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs index f8e2c66a6..f14b751d4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct FreeSpaceArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs index 9c704090c..447477823 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct VaRegion { public ulong Offset; @@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types public ulong Pages; } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetVaRegionsArguments { public ulong Unused; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs index 264d5b618..e86932bb0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct InitializeExArguments { public uint Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs index f0ca905f3..c0f6d40ee 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct MapBufferExArguments { public AddressSpaceFlags Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs index bdd46290c..99afa4bad 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct RemapArguments { public ushort Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs index 2d5388123..d6bc1bc52 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs @@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { struct UnmapBufferArguments { - +#pragma warning disable CS0649 // Field is never assigned to public ulong Offset; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs index ad026ff59..a114bd3e0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs @@ -19,9 +19,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel private const uint MaxModuleSyncpoint = 16; +#pragma warning disable IDE0052 // Remove unread private member private uint _timeout; private uint _submitTimeout; private uint _timeslice; +#pragma warning restore IDE0052 private readonly Switch _device; @@ -145,10 +147,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { SubmitArguments submitHeader = GetSpanAndSkip(ref arguments, 1)[0]; Span commandBuffers = GetSpanAndSkip(ref arguments, submitHeader.CmdBufsCount); - - _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // relocs - _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // reloc shifts - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + Span relocs = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); + Span relocShifts = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); +#pragma warning restore IDE0059 Span syncptIncrs = GetSpanAndSkip(ref arguments, submitHeader.SyncptIncrsCount); Span fenceThresholds = GetSpanAndSkip(ref arguments, submitHeader.FencesCount); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs index f6af4ecef..34663e9d7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs @@ -8,10 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile { - +#pragma warning disable IDE0052 // Remove unread private member private readonly KEvent _smExceptionBptIntReportEvent; private readonly KEvent _smExceptionBptPauseReportEvent; private readonly KEvent _errorNotifierEvent; +#pragma warning restore IDE0052 private int _smExceptionBptIntReportEventHandle; private int _smExceptionBptPauseReportEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs index f84722cea..9a06fbebd 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct AllocGpfifoExArguments { public uint NumEntries; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs index 6e7b5f23e..4578ec6a9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct AllocObjCtxArguments { public uint ClassNumber; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs index 7eb538211..5e74f6f2c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetParameterArguments { public uint Parameter; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs index 473d31bf3..88cd6bd94 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct CommandBufferHandle { public int MapHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs index 943ea3d4b..177f483f0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { class NvChannel { - +#pragma warning disable CS0649 // Field is never assigned to public int Timeout; public int SubmitTimeout; public int Timeslice; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs index 39ab45085..f285123a7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SetErrorNotifierArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs index 0f90decb0..0c4ea7625 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct CommandBuffer { public int Mem; @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int WordsCount; } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct Reloc { public int CmdbufMem; @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int TargetOffset; } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SyncptIncr { public uint Id; @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public uint Reserved3; } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SubmitArguments { public int CmdBufsCount; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs index c29764162..b6bd1e4e8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SubmitGpfifoArguments { public long Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs index 7d75c74ed..fe4c74d66 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct ZcullBindArguments { public ulong GpuVirtualAddress; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs index 0f3729604..0b2133a78 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct EventWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs index 7d69fd6cf..48622a224 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs @@ -18,9 +18,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl public int EventHandle; private readonly uint _eventId; - +#pragma warning disable IDE0052 // Remove unread private member private readonly NvHostSyncpt _syncpointManager; - +#pragma warning restore IDE0052 private SyncpointWaiterHandle _waiterInformation; private NvFence _previousFailingFence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs index cf8d701c8..5138db9ea 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SyncptWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs index 3e29636f6..7bcd38c75 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct SyncptWaitExArguments { public SyncptWaitArguments Input; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs index 00221eab9..4f447f486 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetActiveSlotMaskArguments { public int Slot; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs index 10ba9e6ba..556786de0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GpuCharacteristics { public int Arch; @@ -44,13 +44,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types struct CharacteristicsHeader { - +#pragma warning disable CS0649 // Field is never assigned to public long BufferSize; public long BufferAddress; - +#pragma warning restore CS0649 } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetCharacteristicsArguments { public CharacteristicsHeader Header; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs index e42998da3..c1c1a6f91 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetGpuTimeArguments { public ulong Timestamp; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs index 09aec7b6d..83ff4f090 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct GetTpcMasksArguments { public int MaskBufferSize; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs index 48a83a927..fb5013a70 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NumVsmsArguments { public uint NumVsms; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs index ee01ebf4f..baada9197 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct VsmsMappingArguments { public byte Sm0GpcIndex; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs index 67975ff7b..cee339bac 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct ZbcSetTableArguments { public Array4 ColorDs; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs index b661d0997..16ffacdac 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct ZcullGetCtxSizeArguments { public int Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs index 88ea3baa8..343643abf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct ZcullGetInfoArguments { public int WidthAlignPixels; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs index 84052df9d..dc4f5d608 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapAlloc { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs index 63a8150a2..f4047497a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapCreate { public uint Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs index dfaec714e..ce93e9e5e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapFree { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs index a37dc1954..9ec81f9f3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapFromId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs index 231c61475..8306ae4ca 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapGetId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs index 2b24f4564..e821b571d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs @@ -4,10 +4,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { class NvMapHandle { - +#pragma warning disable CS0649 // Field is never assigned to public int Handle; public int Id; - +#pragma warning restore CS0649 public uint Size; public int Align; public int Kind; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs index 43299d406..16fd78043 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvMapParam { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs index 99187bc4f..40e35fa7a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct NvIoctl { public const int NvHostCustomMagic = 0x00; diff --git a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs index 6adede408..c36482e41 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs @@ -11,6 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private readonly int _permissionFlag; private ulong _titleId; private ParentalControlFlagValue _parentalControlFlag; +#pragma warning disable IDE0052, CS0414 // Remove unread private member private int[] _ratingAge; // TODO: Find where they are set. @@ -19,6 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private bool _freeCommunicationEnabled = false; private readonly bool _stereoVisionRestrictionConfigurable = true; private bool _stereoVisionRestriction = false; +#pragma warning restore IDE0052, CS0414 public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag) { @@ -176,6 +178,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory return ResultCode.PermissionDenied; } +#pragma warning disable // Remove unnecessary value assignment bool stereoVisionRestriction = false; if (_stereoVisionRestrictionConfigurable) diff --git a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs index 0a7541caf..5d90fcbe2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs @@ -7,9 +7,9 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager class IClkrstSession : IpcService { private readonly DeviceCode _deviceCode; - +#pragma warning disable IDE0052 // Remove unread private member private readonly uint _unknown; - +#pragma warning restore IDE0052 private uint _clockRate; private readonly DeviceCode[] _allowedDeviceCodeTable = diff --git a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs index d4fc5d767..45c4ce7e1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs @@ -17,7 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // RequestLoad(u32) public ResultCode RequestLoad(ServiceCtx context) { - _ = (SharedFontType)context.RequestData.ReadInt32(); // font type +#pragma warning disable IDE0059 // Remove unnecessary value assignment + SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 // We don't need to do anything here because we do lazy initialization // on SharedFontManager (the font is loaded when necessary). @@ -28,7 +30,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetLoadState(u32) -> u32 public ResultCode GetLoadState(ServiceCtx context) { - _ = (SharedFontType)context.RequestData.ReadInt32(); // font type +#pragma warning disable IDE0059 // Remove unnecessary value assignment + SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 // 1 (true) indicates that the font is already loaded. // All fonts are already loaded. @@ -82,8 +86,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer, buffer, buffer) public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // language code - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long languageCode = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 int loadedCount = 0; for (SharedFontType type = 0; type < SharedFontType.Count; type++) diff --git a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs index 0b3a27b03..dcc01bf38 100644 --- a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs +++ b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs @@ -377,8 +377,9 @@ namespace Ryujinx.HLE.HOS.Services else if (request.Type is IpcMessageType.CmifControl or IpcMessageType.CmifControlWithContext) { - _ = (uint)_requestDataReader.ReadUInt64(); // magic - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint magic = (uint)_requestDataReader.ReadUInt64(); +#pragma warning restore IDE0059 uint cmdId = (uint)_requestDataReader.ReadUInt64(); switch (cmdId) diff --git a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index 66bdb4339..f19eeebfc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -214,8 +214,10 @@ namespace Ryujinx.HLE.HOS.Services.Sm context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin); - _ = (context.RequestData.ReadInt32() & 1) != 0; // is light - _ = context.RequestData.ReadInt32(); // max sessions +#pragma warning disable IDE0059 // Remove unnecessary value assignment + bool isLight = (context.RequestData.ReadInt32() & 1) != 0; + int maxSessions = context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 if (string.IsNullOrEmpty(name)) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index 79d3bf9c5..fe37ca4fa 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -353,8 +353,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int timeout = context.RequestData.ReadInt32(); (ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21(); - - (ulong outputBufferPosition, _) = context.Request.GetBufferType0x22(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22(); +#pragma warning restore IDE0059 if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize) { @@ -602,8 +603,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); (ulong sendPosition, ulong sendSize) = context.Request.GetBufferType0x21(0); - - (ulong bufferPosition, _) = context.Request.GetBufferType0x21(1); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(1); +#pragma warning restore IDE0059 ReadOnlySpan sendBuffer = context.Memory.GetSpan(sendPosition, (int)sendSize); @@ -632,7 +634,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); - (ulong bufferPos, _) = context.Request.GetBufferType0x22(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -675,7 +679,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); - (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -696,7 +702,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); - (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -717,7 +725,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); - (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -744,7 +754,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); - (ulong bufferPos, _) = context.Request.GetBufferType0x22(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -816,8 +828,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32(); - - _ = context.RequestData.ReadInt32(); // buffer count +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int bufferCount = context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -829,7 +842,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd case BsdIoctl.AtMark: errno = LinuxError.SUCCESS; - (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); +#pragma warning restore IDE0059 // FIXME: OOB not implemented. context.Memory.Write(bufferPosition, 0); @@ -1021,8 +1036,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd public ResultCode DuplicateSocket(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); - - _ = context.RequestData.ReadUInt64(); // Padding, not used. +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong reserved = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 LinuxError errno = LinuxError.ENOENT; int newSockFd = -1; @@ -1049,9 +1065,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int socketFd = context.RequestData.ReadInt32(); int vlen = context.RequestData.ReadInt32(); BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); - - _ = context.RequestData.ReadUInt32(); // Padding, not used. - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint reserved = context.RequestData.ReadUInt32(); +#pragma warning restore IDE0059 TimeVal timeout = context.RequestData.ReadStruct(); ulong receivePosition = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs index d99488d85..684e06598 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs @@ -2,6 +2,7 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Net.Sockets; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs index 6a250498d..92a013d19 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl { enum WsaError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs index 2796d95ca..c275f3ba5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum BsdSocketOption diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs index 72dcd0166..1219d1476 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum LinuxError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs index 84f2659b8..3babb0018 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { struct PollEventData { - +#pragma warning disable CS0649 // Field is never assigned to public int SocketFd; public PollEventTypeMask InputEvents; - +#pragma warning restore CS0649 public PollEventTypeMask OutputEvents; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index 8c58822aa..80bdbec8a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -28,6 +28,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode SetDnsAddressesPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong bufferPosition = context.Request.SendBuff[0].Position; + ulong bufferSize = context.Request.SendBuff[0].Size; +#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -40,6 +44,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode GetDnsAddressPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong bufferPosition = context.Request.ReceiveBuff[0].Position; + ulong bufferSize = context.Request.ReceiveBuff[0].Size; +#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -162,8 +170,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // GetCancelHandleRequest(u64, pid) -> u32 public ResultCode GetCancelHandleRequest(ServiceCtx context) { - _ = context.RequestData.ReadUInt64(); // pid - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pidPlaceHolder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 uint cancelHandleRequest = 0; context.ResponseData.Write(cancelHandleRequest); @@ -178,8 +187,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode CancelRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); - - _ = context.RequestData.ReadUInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pidPlaceHolder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -293,9 +303,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // TODO: Use params. bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; - - _ = context.RequestData.ReadInt32(); // Timeout - _ = context.RequestData.ReadUInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int timeOut = context.RequestData.ReadInt32(); + ulong pidPlaceholder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 if (withOptions) { @@ -392,10 +403,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres context.Memory.Read(inputBufferPosition, rawIp); // TODO: Use params. - _ = context.RequestData.ReadUInt32(); // socket length - _ = context.RequestData.ReadUInt32(); // type - _ = context.RequestData.ReadInt32(); // timeout - _ = context.RequestData.ReadUInt64(); // pid placeholder +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint socketLength = context.RequestData.ReadUInt32(); + uint type = context.RequestData.ReadUInt32(); + int timeOut = context.RequestData.ReadInt32(); + ulong pidPlaceholder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 if (withOptions) { @@ -493,8 +506,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres ulong optionsBufferSize) { bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; - - _ = context.RequestData.ReadUInt32(); // Cancel handle request +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint cancelHandle = context.RequestData.ReadUInt32(); +#pragma warning restore IDE0059 string host = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[0].Position, (long)context.Request.SendBuff[0].Size); string service = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[1].Position, (long)context.Request.SendBuff[1].Size); @@ -509,15 +523,21 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres } // NOTE: We ignore hints for now. - _ = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); // hints +#pragma warning disable IDE0059 // Remove unnecessary value assignment + List hints = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); +#pragma warning restore IDE0059 if (withOptions) { // TODO: Find unknown, Parse and use options. - _ = context.RequestData.ReadUInt32(); // unknown +#pragma warning disable IDE0059 // Remove unnecessary value assignment + uint unknown = context.RequestData.ReadUInt32(); +#pragma warning restore IDE0059 } - _ = context.RequestData.ReadUInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pidPlaceHolder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 IPHostEntry hostEntry = null; @@ -605,6 +625,13 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres private static int SerializeAddrInfos(ServiceCtx context, ulong responseBufferPosition, ulong responseBufferSize, IPHostEntry hostEntry, int port) { + ulong originalBufferPosition = responseBufferPosition; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong bufferPosition = originalBufferPosition; + + byte[] hostName = Encoding.ASCII.GetBytes(hostEntry.HostName + '\0'); +#pragma warning restore IDE0059 + using WritableRegion region = context.Memory.GetWritableRegion(responseBufferPosition, (int)responseBufferSize); Span data = region.Memory.Span; diff --git a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs index 3070710b0..301d415a0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs @@ -1,3 +1,4 @@ +using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Services.Spl.Types; @@ -60,6 +61,9 @@ namespace Ryujinx.HLE.HOS.Services.Spl { configValue = default; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + SystemVersion version = context.Device.System.ContentManager.GetCurrentFirmwareVersion(); +#pragma warning restore IDE0059 MemorySize memorySize = context.Device.Configuration.MemoryConfiguration.ToKernelMemorySize(); switch (configItem) diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs index f00608297..763ab8d60 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs @@ -50,8 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Ssl { private const uint ValidMagic = 0x546C7373; +#pragma warning disable CS0649 // Field is never assigned to public uint Magic; public uint EntriesCount; +#pragma warning restore CS0649 public readonly bool IsValid() { @@ -61,12 +63,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl private struct CertStoreFileEntry { - +#pragma warning disable CS0649 // Field is never assigned to public CaCertificateId Id; public TrustedCertStatus Status; public uint DataSize; public uint DataOffset; - +#pragma warning restore CS0649 } public class CertStoreEntry diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index df4ec11ba..8f38f293f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -21,8 +21,9 @@ namespace Ryujinx.HLE.HOS.Services.Ssl public ResultCode CreateContext(ServiceCtx context) { SslVersion sslVersion = (SslVersion)context.RequestData.ReadUInt32(); - - _ = context.RequestData.ReadUInt64(); // pid +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pidPlaceholder = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 MakeObject(context, new ISslContext(context.Request.HandleDesc.PId, sslVersion)); diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs index a35be2cf0..7b371d299 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs @@ -47,6 +47,11 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService { CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong certificateDataPosition = context.Request.SendBuff[0].Position; + ulong certificateDataSize = context.Request.SendBuff[0].Size; +#pragma warning restore IDE0059 + context.ResponseData.Write(_serverCertificateId++); Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { certificateFormat }); @@ -58,6 +63,11 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService // ImportClientPki(buffer certificate, buffer ascii_password) -> u64 certificateId public ResultCode ImportClientPki(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong certificateDataPosition = context.Request.SendBuff[0].Position; + ulong certificateDataSize = context.Request.SendBuff[0].Size; +#pragma warning restore IDE0059 + ulong asciiPasswordDataPosition = context.Request.SendBuff[1].Position; ulong asciiPasswordDataSize = context.Request.SendBuff[1].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs index 2e39bf652..dc33dd6a5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs @@ -69,6 +69,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService EndSslOperation(); } + // NOTE: We silence warnings about TLS 1.0 and 1.1 as games will likely use it. +#pragma warning disable SYSLIB0039 private SslProtocols TranslateSslVersion(SslVersion version) { return (version & SslVersion.VersionMask) switch @@ -81,6 +83,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService _ => throw new NotImplementedException(version.ToString()), }; } +#pragma warning restore SYSLIB0039 /// /// Retrieve the hostname of the current remote in case the provided hostname is null or empty. diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs index 4f0d8e21d..9afb26c65 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs @@ -15,7 +15,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger private readonly ITickSource _tickSource; +#pragma warning disable IDE0052 // Remove unread private member private uint _stickyTransform; +#pragma warning restore IDE0052 private uint _nextCallbackTicket; private uint _currentCallbackTicket; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs index 20cf2c754..25c89baec 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs @@ -50,7 +50,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger public string ReadInterfaceToken() { // Ignore the policy flags - _ = ReadInt32(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int strictPolicy = ReadInt32(); +#pragma warning restore IDE0059 return ReadString16(); } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs index aa3b25ca5..0c69bf573 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum Status diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index 971778175..8acc4d756 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -2,6 +2,7 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.PreciseSleep; +using Ryujinx.Cpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs index 438c58b72..b26fb15d1 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum ColorFormat : ulong diff --git a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs index 5902432b0..c0b4ad292 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Time.Clock { - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] struct TimeSpanType { private const long NanoSecondsPerSecond = 1000000000; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs index 15a3a0206..eaddf9cff 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs @@ -83,7 +83,9 @@ namespace Ryujinx.HLE.HOS.Services.Time return ResultCode.PermissionDenied; } - _ = context.RequestData.ReadStruct(); // internalOffset +#pragma warning disable IDE0059 // Remove unnecessary value assignment + TimeSpanType internalOffset = context.RequestData.ReadStruct(); +#pragma warning restore IDE0059 // TODO: set:sys SetExternalSteadyClockInternalOffset(internalOffset.ToSeconds()) diff --git a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs index fcb434fae..ded2c3175 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.HOS.Services.Time { public enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs index f7eff6f9f..b18a4f76c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs @@ -248,6 +248,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong outBufferSize = context.Request.RecvListBuff[0].Size; +#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); context.ResponseData.Write(1); @@ -267,6 +270,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong outBufferSize = context.Request.RecvListBuff[0].Size; +#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs index 7c76a82f6..346487030 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs @@ -14,8 +14,9 @@ namespace Ryujinx.HLE.HOS.Services.Time private Switch _device; private KSharedMemory _sharedMemory; private SharedMemoryStorage _timeSharedMemoryStorage; - +#pragma warning disable IDE0052 // Remove unread private member private int _timeSharedMemorySize; +#pragma warning restore IDE0052 private const uint SteadyClockContextOffset = 0x00; private const uint LocalSystemClockContextOffset = 0x38; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index 886d10197..dfacc8170 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -649,8 +649,22 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - bool isDaySavingTime = false; + long theirDstOffset; + for (int i = 0; i < outRules.TimeCount; i++) + { + int j = outRules.Types[i]; + if (outRules.Ttis[j].IsDaySavingTime) + { +#pragma warning disable IDE0059 // Remove unnecessary value assignment + theirDstOffset = -outRules.Ttis[j].GmtOffset; +#pragma warning restore IDE0059 + } + } + bool isDaySavingTime = false; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long theirOffset = theirStdOffset; +#pragma warning restore IDE0059 for (int i = 0; i < outRules.TimeCount; i++) { int j = outRules.Types[i]; @@ -667,9 +681,16 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - if (!outRules.Ttis[j].IsDaySavingTime) + theirOffset = -outRules.Ttis[j].GmtOffset; + if (outRules.Ttis[j].IsDaySavingTime) { - theirStdOffset = -outRules.Ttis[j].GmtOffset; +#pragma warning disable IDE0059 // Remove unnecessary value assignment + theirDstOffset = theirOffset; +#pragma warning restore IDE0059 + } + else + { + theirStdOffset = theirOffset; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs index 2e22feaa4..0e5d103d1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs @@ -29,9 +29,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService // CreateManagedLayer(u32, u64, nn::applet::AppletResourceUserId) -> u64 public ResultCode CreateManagedLayer(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // layerFlags - _ = context.RequestData.ReadInt64(); // displayId - +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long layerFlags = context.RequestData.ReadInt64(); + long displayId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 long appletResourceUserId = context.RequestData.ReadInt64(); ulong pid = context.Device.System.AppletState.AppletResourceUserIds.GetData((int)appletResourceUserId); diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index a38bf902d..99c640aa0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -231,10 +231,14 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService public ResultCode OpenLayer(ServiceCtx context) { // TODO: support multi display. - _ = context.RequestData.ReadBytes(0x40); // display name - long layerId = context.RequestData.ReadInt64(); - _ = context.RequestData.ReadInt64(); // user id +#pragma warning disable IDE0059 // Remove unnecessary value assignment + byte[] displayName = context.RequestData.ReadBytes(0x40); +#pragma warning restore IDE0059 + long layerId = context.RequestData.ReadInt64(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long userId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 ulong parcelPtr = context.Request.ReceiveBuff[0].Position; ResultCode result = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId, out IBinder producer); @@ -272,8 +276,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) public ResultCode CreateStrayLayer(ServiceCtx context) { - _ = context.RequestData.ReadInt64(); // layerFlags - _ = context.RequestData.ReadInt64(); // displayId +#pragma warning disable IDE0059 // Remove unnecessary value assignment + long layerFlags = context.RequestData.ReadInt64(); + long displayId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 ulong parcelPtr = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/TamperMachine.cs b/src/Ryujinx.HLE/HOS/TamperMachine.cs index b6fa10190..9b565b034 100644 --- a/src/Ryujinx.HLE/HOS/TamperMachine.cs +++ b/src/Ryujinx.HLE/HOS/TamperMachine.cs @@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS { if (_tamperThread == null || !_tamperThread.IsAlive) { - _tamperThread = new Thread(TamperRunner) + _tamperThread = new Thread(this.TamperRunner) { Name = "HLE.TamperMachine", }; diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs index 8887c5ec7..9b6eb014e 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Ryujinx.HLE.Loaders.Elf { enum ElfDynamicTag diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs index faffe4461..8d4df8942 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol32 { - +#pragma warning disable CS0649 // Field is never assigned to public uint NameOffset; public uint ValueAddress; public uint Size; public byte Info; public byte Other; public ushort SectionIndex; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs index 17781503f..45a753615 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol64 { - +#pragma warning disable CS0649 // Field is never assigned to public uint NameOffset; public byte Info; public byte Other; public ushort SectionIndex; public ulong ValueAddress; public ulong Size; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs index b2af85b4e..249f8dd9d 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs @@ -30,8 +30,9 @@ namespace Ryujinx.HLE.Loaders.Npdm { throw new InvalidNpdmException("FsAccessHeader is corrupted!"); } - - _ = reader.ReadInt32(); // contentOwnerId size +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int contentOwnerIdSize = reader.ReadInt32(); +#pragma warning restore IDE0059 int dataAndContentOwnerIdSize = reader.ReadInt32(); if (dataAndContentOwnerIdSize != 0x1c) diff --git a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs index 59611100a..4a99de98c 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs @@ -68,10 +68,11 @@ namespace Ryujinx.HLE.Loaders.Npdm stream.Seek(0x30, SeekOrigin.Current); int aci0Offset = reader.ReadInt32(); - - _ = reader.ReadInt32(); // aci0 size +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int aci0Size = reader.ReadInt32(); int acidOffset = reader.ReadInt32(); - _ = reader.ReadInt32(); // acid size + int acidSize = reader.ReadInt32(); +#pragma warning restore IDE0059 Aci0 = new Aci0(stream, aci0Offset); Acid = new Acid(stream, acidOffset); diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index b043f29ef..23faca9d1 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -9,6 +9,7 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.Memory; +using System; using System.Linq; using static Ryujinx.HLE.HOS.ModLoader; diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 18b2b78d1..53ccddc68 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -6,6 +6,7 @@ using Ryujinx.Cpu; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Processes.Extensions; using Ryujinx.Horizon.Common; +using System; namespace Ryujinx.HLE.Loaders.Processes { diff --git a/src/Ryujinx.HLE/MemoryConfiguration.cs b/src/Ryujinx.HLE/MemoryConfiguration.cs index 4ff65584d..21ecd737f 100644 --- a/src/Ryujinx.HLE/MemoryConfiguration.cs +++ b/src/Ryujinx.HLE/MemoryConfiguration.cs @@ -18,11 +18,11 @@ namespace Ryujinx.HLE { private const ulong GiB = 1024 * 1024 * 1024; +#pragma warning disable IDE0055 // Disable formatting public static MemoryArrange ToKernelMemoryArrange(this MemoryConfiguration configuration) { return configuration switch { -#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB => MemoryArrange.MemoryArrange4GiB, MemoryConfiguration.MemoryConfiguration4GiBAppletDev => MemoryArrange.MemoryArrange4GiBAppletDev, MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemoryArrange.MemoryArrange4GiBSystemDev, @@ -31,7 +31,6 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemoryArrange.MemoryArrange8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemoryArrange.MemoryArrange12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), -#pragma warning restore IDE0055 }; } @@ -39,7 +38,6 @@ namespace Ryujinx.HLE { return configuration switch { -#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemorySize.MemorySize4GiB, @@ -48,7 +46,6 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemorySize.MemorySize8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemorySize.MemorySize12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), -#pragma warning restore IDE0055 }; } @@ -56,7 +53,6 @@ namespace Ryujinx.HLE { return configuration switch { -#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => 4 * GiB, @@ -65,8 +61,8 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => 8 * GiB, MemoryConfiguration.MemoryConfiguration12GiB => 12 * GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), -#pragma warning restore IDE0055 }; } +#pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.HLE/StructHelpers.cs b/src/Ryujinx.HLE/StructHelpers.cs index ee299896d..dc9c6d727 100644 --- a/src/Ryujinx.HLE/StructHelpers.cs +++ b/src/Ryujinx.HLE/StructHelpers.cs @@ -17,6 +17,7 @@ namespace Ryujinx.HLE const int SizeOfApplicationTitle = 0x300; const int OffsetOfApplicationPublisherStrings = 0x200; + BlitStruct nacpData = new(1); // name and publisher buffer diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index c9f16021a..bdcbe82c7 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -77,13 +77,11 @@ namespace Ryujinx.HLE Hid = new Hid(this, System.HidStorage); Processes = new ProcessLoader(this); TamperMachine = new TamperMachine(); -#pragma warning restore IDE0055 System.InitializeServices(); System.State.SetLanguage(Configuration.SystemLanguage); System.State.SetRegion(Configuration.Region); - -#pragma warning disable IDE0055 // Disable formatting + VSyncMode = Configuration.VSyncMode; CustomVSyncInterval = Configuration.CustomVSyncInterval; TickScalar = TurboMode ? Configuration.TickScalar : ITickSource.RealityTickScalar; @@ -92,9 +90,9 @@ namespace Ryujinx.HLE System.EnablePtc = Configuration.EnablePtc; System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel; System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode; -#pragma warning restore IDE0055 UpdateVSyncInterval(); +#pragma warning restore IDE0055 Shared = this; } diff --git a/src/Ryujinx.HLE/UI/IHostUIHandler.cs b/src/Ryujinx.HLE/UI/IHostUIHandler.cs index 68140dd54..b5c5cb168 100644 --- a/src/Ryujinx.HLE/UI/IHostUIHandler.cs +++ b/src/Ryujinx.HLE/UI/IHostUIHandler.cs @@ -63,6 +63,7 @@ namespace Ryujinx.HLE.UI /// IHostUITheme HostUITheme { get; } + /// /// Displays the player select dialog and returns the selected profile. /// diff --git a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs index 050bf5565..2a09001db 100644 --- a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs +++ b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs @@ -146,15 +146,11 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); List syscalls = []; - Dictionary isStaticMethod = new(); foreach (MethodDeclarationSyntax method in syntaxReceiver.SvcImplementations) { - bool isStatic = method.Modifiers.Any(SyntaxKind.StaticKeyword); - isStaticMethod[method.Identifier.Text] = isStatic; - - GenerateMethod32(generator, context.Compilation, method, isStatic); - GenerateMethod64(generator, context.Compilation, method, isStatic); + GenerateMethod32(generator, context.Compilation, method); + GenerateMethod64(generator, context.Compilation, method); foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList => attributeList.Attributes.Where(attribute => @@ -170,9 +166,9 @@ namespace Ryujinx.Horizon.Kernel.Generators syscalls.Sort(); - GenerateDispatch(generator, syscalls, A32Suffix, isStaticMethod); + GenerateDispatch(generator, syscalls, A32Suffix); generator.AppendLine(); - GenerateDispatch(generator, syscalls, A64Suffix, isStaticMethod); + GenerateDispatch(generator, syscalls, A64Suffix); generator.LeaveScope(); generator.LeaveScope(); @@ -197,12 +193,9 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.LeaveScope(); } - private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) { - string methodParams = isStatic - ? $"{TypeExecutionContext} context" - : $"Syscall syscall, {TypeExecutionContext} context"; - generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}({methodParams})"); + generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}(Syscall syscall, {TypeExecutionContext} context)"); string[] args = new string[method.ParameterList.Parameters.Count]; int index = 0; @@ -273,10 +266,9 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; - string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -297,7 +289,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"{callPrefix}({argsList});"); + generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -321,12 +313,9 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } - private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) { - string methodParams = isStatic - ? $"{TypeExecutionContext} context" - : $"Syscall syscall, {TypeExecutionContext} context"; - generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}({methodParams})"); + generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}(Syscall syscall, {TypeExecutionContext} context)"); string[] args = new string[method.ParameterList.Parameters.Count]; int registerIndex = 0; @@ -367,10 +356,9 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; - string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -386,7 +374,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"{callPrefix}({argsList});"); + generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -405,55 +393,6 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } - private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) - { - GenerateMethod32(generator, compilation, method, false); - } - - private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) - { - GenerateMethod64(generator, compilation, method, false); - } - - private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix, Dictionary isStaticMethod) - { - generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); - generator.EnterScope("switch (id)"); - - foreach (SyscallIdAndName syscall in syscalls) - { - generator.AppendLine($"case {syscall.Id}:"); - generator.IncreaseIndentation(); - - if (isStaticMethod.TryGetValue(syscall.Name, out bool isStatic) && isStatic) - { - generator.AppendLine($"{syscall.Name}{suffix}(context);"); - } - else - { - generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); - } - - generator.AppendLine("break;"); - - generator.DecreaseIndentation(); - } - - generator.AppendLine($"default:"); - generator.IncreaseIndentation(); - - generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); - - generator.DecreaseIndentation(); - - generator.LeaveScope(); - generator.LeaveScope(); - } - - private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) - { - } - private static string GetFormattedLogValue(string value, string canonicalTypeName) { if (Is32BitInteger(canonicalTypeName)) @@ -524,6 +463,33 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine($"Logger.{logLevel}?.PrintMsg(LogClass.{logClass}, $\"{log}\");"); } + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) + { + generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); + generator.EnterScope("switch (id)"); + + foreach (SyscallIdAndName syscall in syscalls) + { + generator.AppendLine($"case {syscall.Id}:"); + generator.IncreaseIndentation(); + + generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); + generator.AppendLine("break;"); + + generator.DecreaseIndentation(); + } + + generator.AppendLine($"default:"); + generator.IncreaseIndentation(); + + generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); + + generator.DecreaseIndentation(); + + generator.LeaveScope(); + generator.LeaveScope(); + } + private static bool Is32BitInteger(string canonicalTypeName) { return canonicalTypeName is TypeSystemInt32 or TypeSystemUInt32; diff --git a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs index 89ba9d8e9..583a04de3 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs @@ -233,8 +233,6 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return Result.Success; } - // Remove this pragma warning when the methods are implemented -#pragma warning disable CA1822 // Mark members as static [CmifCommand(15)] // 17.0.0+ public Result AcquireAudioOutputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) { @@ -276,7 +274,6 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return AudioResult.NotImplemented; } -#pragma warning restore CA1822 // Mark members as static protected virtual void Dispose(bool disposing) { diff --git a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs index bc913fd9c..2146362df 100644 --- a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs +++ b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail OpusCodecFactory.AttemptToUseNativeLibrary = false; } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] private struct OpusPacketHeader { public uint Length; diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs index 9c431f73a..a2cbad6a6 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs @@ -4,12 +4,12 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct AccountNotificationSettings { - +#pragma warning disable CS0649 // Field is never assigned to public Uid UserId; public uint Flags; public byte FriendPresenceOverlayPermission; public byte FriendInvitationOverlayPermission; public ushort Reserved; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs index a6f678565..ec5c97c5a 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct BluetoothDevicesSettings { - +#pragma warning disable CS0649 // Field is never assigned to public Array6 BdAddr; public Array32 DeviceName; public Array3 ClassOfDevice; @@ -24,6 +24,6 @@ namespace Ryujinx.Horizon.Sdk.Settings.System public Array9 Brr; public Array256 Reserved; public Array43 Reserved2; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs index e9b658ece..2ce56c4df 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs @@ -21,10 +21,10 @@ namespace Ryujinx.Horizon.Sdk.Settings.System struct NotificationTime { - +#pragma warning disable CS0649 // Field is never assigned to public uint Hour; public uint Minute; - +#pragma warning restore CS0649 } [StructLayout(LayoutKind.Sequential, Size = 0x18, Pack = 0x4)] diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs index 5fcaa4277..23c1ce248 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifDomainOutHeader { - +#pragma warning disable CS0649 // Field is never assigned to public uint ObjectsCount; public uint Padding; public uint Padding2; public uint Padding3; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs index f91be62c0..ddceca030 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs @@ -4,11 +4,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifOutHeader { - +#pragma warning disable CS0649 // Field is never assigned to public uint Magic; public uint Version; public Result Result; public uint Token; - +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs index 97eed615d..370341994 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs @@ -2,6 +2,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifRequestFormat { +#pragma warning disable CS0649 // Field is never assigned to public int ObjectId; public uint RequestId; public uint Context; @@ -18,5 +19,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif public int ObjectsCount; public int HandlesCount; public bool SendPid; +#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs index 15c5678d6..4e9628947 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs @@ -2,10 +2,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcBufferDescriptor { - +#pragma warning disable CS0649 // Field is never assigned to private readonly uint _sizeLow; private readonly uint _addressLow; private readonly uint _word2; +#pragma warning restore CS0649 public ulong Address => _addressLow | (((ulong)_word2 << 4) & 0xf00000000UL) | (((ulong)_word2 << 34) & 0x7000000000UL); public ulong Size => _sizeLow | ((ulong)_word2 << 8) & 0xf00000000UL; diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs index 526e3dae1..9a7c23e9a 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs @@ -2,9 +2,10 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcReceiveListEntry { - +#pragma warning disable IDE0052 // Remove unread private member private readonly uint _addressLow; private readonly uint _word1; +#pragma warning restore IDE0052 public HipcReceiveListEntry(ulong address, ulong size) { diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs index 0cf58827d..faf5dc410 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs @@ -16,6 +16,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc public static Result InvalidCmifRequest => new(ModuleId, 420); public static Result TargetNotDomain => new(ModuleId, 491); public static Result DomainObjectNotFound => new(ModuleId, 492); -#pragma warning restore IDE0055 + #pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs index 80d239896..a1e13aa45 100644 --- a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs +++ b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs @@ -1,4 +1,6 @@ using Ryujinx.Common.Configuration.Hid; +using Ryujinx.Common.Configuration.Hid.Controller; +using System; using System.Collections.Generic; using System.Linq; using System.Numerics; diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index 078fe6b4d..1cbf4d35c 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -21,8 +21,9 @@ namespace Ryujinx.Input.SDL2 private readonly Lock _userMappingLock = new(); +#pragma warning disable IDE0052 // Remove unread private member private readonly SDL2KeyboardDriver _driver; - +#pragma warning restore IDE0052 private StandardKeyboardInputConfig _configuration; private readonly List _buttonsUserMapping; diff --git a/src/Ryujinx.Input/IMouse.cs b/src/Ryujinx.Input/IMouse.cs index 19741b96f..e20e7798d 100644 --- a/src/Ryujinx.Input/IMouse.cs +++ b/src/Ryujinx.Input/IMouse.cs @@ -8,7 +8,9 @@ namespace Ryujinx.Input /// public interface IMouse : IGamepad { +#pragma warning disable IDE0051 // Remove unused private member private const int SwitchPanelWidth = 1280; +#pragma warning restore IDE0051 private const int SwitchPanelHeight = 720; /// diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs index 5d4055753..41b40b177 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFu - Uc.EmuStart(PC, -1, 0, (long)count); + Uc.EmuStart(this.PC, -1, 0, (long)count); } public void Step() @@ -141,6 +141,7 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_R15 ]; +#pragma warning disable IDE0051, IDE0052 // Remove unused private member private static readonly int[] _qRegisters = [ Arm.UC_ARM_REG_Q0, @@ -160,6 +161,7 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_Q14, Arm.UC_ARM_REG_Q15 ]; +#pragma warning restore IDE0051, IDE0052 public uint GetX(int index) { diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs index 22dd44b21..8525b0446 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs @@ -102,7 +102,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFul - Uc.EmuStart((long)PC, -1, 0, (long)count); + Uc.EmuStart((long)this.PC, -1, 0, (long)count); } public void Step() diff --git a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs index f55725c3b..5aa088e78 100644 --- a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs +++ b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs @@ -1,6 +1,5 @@ using NUnit.Framework; using Ryujinx.Common.Extensions; -using Ryujinx.Common.Utilities; using Ryujinx.Memory; using System; using System.Buffers; @@ -275,12 +274,11 @@ namespace Ryujinx.Tests.Common.Extensions public short EffectsSize; public int RenderInfoSize; - //public unsafe fixed byte Reserved[16]; - public Buffer16 Reserved; + public unsafe fixed byte Reserved[16]; public static readonly int SizeOf = Unsafe.SizeOf(); - public static MyUnmanagedStruct Generate(Random rng) + public static unsafe MyUnmanagedStruct Generate(Random rng) { const int BaseInt32Value = 0x1234abcd; const short BaseInt16Value = 0x5678; @@ -295,8 +293,7 @@ namespace Ryujinx.Tests.Common.Extensions RenderInfoSize = BaseInt32Value ^ rng.Next(), }; - Span reservedSpan = result.Reserved.Bytes; - rng.NextBytes(reservedSpan); + Unsafe.Write(result.Reserved, rng.NextInt64()); return result; } @@ -310,7 +307,14 @@ namespace Ryujinx.Tests.Common.Extensions assert(expected.EffectsSize, actual.EffectsSize); assert(expected.RenderInfoSize, actual.RenderInfoSize); - assert(expected.Reserved, actual.Reserved); + fixed (void* expectedReservedPtr = expected.Reserved) + fixed (void* actualReservedPtr = actual.Reserved) + { + long expectedReservedLong = Unsafe.Read(expectedReservedPtr); + long actualReservedLong = Unsafe.Read(actualReservedPtr); + + assert(expectedReservedLong, actualReservedLong); + } } } diff --git a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs index 3eb42d262..207d28f50 100644 --- a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs +++ b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs @@ -11,7 +11,9 @@ namespace Ryujinx.Tests.Memory public MemoryManagerType Type => MemoryManagerType.HostMappedUnsafe; +#pragma warning disable CS0067 // The event is never used public event Action UnmapEvent; +#pragma warning restore CS0067 public ref T GetRef(ulong va) where T : unmanaged { @@ -47,12 +49,5 @@ namespace Ryujinx.Tests.Memory { throw new NotImplementedException(); } - - // Since the mock never unmaps memory, the UnmapEvent is never used and this causes a warning. - // This method is provided to allow the mock to trigger the event if needed. - public void Unmap(ulong va, ulong size) - { - UnmapEvent?.Invoke(va, size); - } } } diff --git a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs index eb1080e50..92b994279 100644 --- a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs +++ b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs @@ -11,6 +11,7 @@ using Ryujinx.Memory; using Ryujinx.Memory.Tracking; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; diff --git a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs index e99f70f5b..233ac2b6d 100644 --- a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs +++ b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs @@ -44,12 +44,12 @@ namespace Ryujinx.Ava.Common.Models if (obj == null) return false; - return Path == obj.Path; + return this.Path == obj.Path; } public override int GetHashCode() { - return Path.GetHashCode(); + return this.Path.GetHashCode(); } } } diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 305e4acaa..09759d7cc 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -119,6 +119,7 @@ namespace Ryujinx.Ava => ProcessUnhandledException(sender, e.Exception, false); AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit(); + // Setup base data directory. AppDataManager.Initialize(CommandLineState.BaseDirPathArg); @@ -159,6 +160,7 @@ namespace Ryujinx.Ava } } + public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false) { if (string.IsNullOrEmpty(gameId)) @@ -219,7 +221,10 @@ namespace Ryujinx.Ava } // When you first load the program, copy to remember the path for the global configuration - GlobalConfigurationPath ??= ConfigurationPath; + if (GlobalConfigurationPath == null) + { + GlobalConfigurationPath = ConfigurationPath; + } UseHardwareAcceleration = ConfigurationState.Instance.EnableHardwareAcceleration; @@ -337,6 +342,7 @@ namespace Ryujinx.Ava log.PrintMsg(LogClass.Application, message); } + if (isTerminating) Exit(); } diff --git a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs index e1fa47362..5656d6e73 100644 --- a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs +++ b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs @@ -86,17 +86,19 @@ namespace Ryujinx.Ava.Systems.AppLibrary public string LocalizedStatusTooltip => Compatibility.Convert(x => +#pragma warning disable CS8509 // It is exhaustive for all possible values this can contain. LocaleManager.Instance[x.Status switch +#pragma warning restore CS8509 { LocaleKeys.CompatibilityListPlayable => LocaleKeys.CompatibilityListPlayableTooltip, LocaleKeys.CompatibilityListIngame => LocaleKeys.CompatibilityListIngameTooltip, LocaleKeys.CompatibilityListMenus => LocaleKeys.CompatibilityListMenusTooltip, LocaleKeys.CompatibilityListBoots => LocaleKeys.CompatibilityListBootsTooltip, LocaleKeys.CompatibilityListNothing => LocaleKeys.CompatibilityListNothingTooltip, - _ => throw new ArgumentOutOfRangeException(nameof(x.Status), "Unknown playability status.") }] ).OrElse(string.Empty); + [JsonIgnore] public string IdString => Id.ToString("x16"); [JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL; diff --git a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs index 38d42b5d4..8b207c6bd 100644 --- a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs +++ b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs @@ -11,6 +11,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary LdnData = ldnData ?? []; } + public LdnGameData[] LdnData { get; set; } } } diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs index 03fe69e83..afabdb4e3 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs @@ -44,6 +44,7 @@ namespace Ryujinx.Ava.Systems.Configuration configurationFileUpdated = true; } + EnableDiscordIntegration.Value = cff.EnableDiscordIntegration; UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only FocusLostActionType.Value = cff.FocusLostActionType; @@ -146,7 +147,7 @@ namespace Ryujinx.Ava.Systems.Configuration Hid.EnableMouse.Value = cff.EnableMouse; Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus : Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only Hid.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only - Hid.InputConfig.Value = cff.InputConfig ?? []; + Hid.InputConfig.Value = cff.InputConfig ?? [] ; Hid.RainbowSpeed.Value = cff.RainbowSpeed; Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId; diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index 2e0978e7e..29a390b26 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -326,6 +326,7 @@ namespace Ryujinx.Ava.Systems.Configuration /// public ReactiveObject MatchSystemTime { get; private set; } + /// /// Enable or disable use global input config (Independent from controllers binding) /// @@ -768,7 +769,7 @@ namespace Ryujinx.Ava.Systems.Configuration /// public static ConfigurationState Instance { get; private set; } - public static ConfigurationState InstanceExtra { get; private set; } + public static ConfigurationState InstanceExtra{ get; private set; } /// /// The UI section diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs index a22ccdac4..4a565d5d3 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs @@ -15,13 +15,13 @@ namespace Ryujinx.Ava.Systems.Configuration { public static void Initialize() { - if (Instance != null || InstanceExtra != null) + if (Instance != null || InstanceExtra!= null) { throw new InvalidOperationException("Configuration is already initialized"); } Instance = new ConfigurationState(); - InstanceExtra = new ConfigurationState(); + InstanceExtra= new ConfigurationState(); } public ConfigurationFileFormat ToFileFormat() diff --git a/src/Ryujinx/Systems/Rebooter.cs b/src/Ryujinx/Systems/Rebooter.cs index 5360edee9..ac22dfb15 100644 --- a/src/Ryujinx/Systems/Rebooter.cs +++ b/src/Ryujinx/Systems/Rebooter.cs @@ -1,9 +1,11 @@ using FluentAvalonia.UI.Controls; using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Threading.Tasks; namespace Ryujinx.Ava.Systems diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index 5f9f3ed96..f49f60ab9 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -1,4 +1,4 @@ -using Gommon; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common; @@ -57,10 +57,10 @@ namespace Ryujinx.Ava.Systems return default; } - if (CreateUpdateQueryUrl() is not { } updateUrl) + if (CreateUpdateQueryUrl() is not {} updateUrl) { Logger.Error?.Print(LogClass.Application, "Could not determine URL for updates."); - + _running = false; return default; @@ -110,6 +110,7 @@ namespace Ryujinx.Ava.Systems return default; } + if (!Version.TryParse(_buildVer, out Version newVersion)) { Logger.Error?.Print(LogClass.Application, @@ -126,7 +127,7 @@ namespace Ryujinx.Ava.Systems return (currentVersion, newVersion); } - + [JsonSerializable(typeof(UpdaterResponse))] partial class UpdaterResponseJsonContext : JsonSerializerContext; diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index b9b58e0a9..40c1da175 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -5,16 +5,19 @@ using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.Common.Models.Github; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.Utilities; using Ryujinx.Common; using Ryujinx.Common.Helper; using Ryujinx.Common.Logging; +using Ryujinx.Common.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Net; using System.Net.Http; using System.Net.NetworkInformation; using System.Runtime.CompilerServices; @@ -40,9 +43,9 @@ namespace Ryujinx.Ava.Systems private static bool _running; private static readonly string[] _windowsDependencyDirs = []; - + private static string _changelogUrlFormat = null; - + public static async Task BeginUpdateAsync(bool showVersionUpToDate = false) { if (_running) @@ -85,7 +88,7 @@ namespace Ryujinx.Ava.Systems try { buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0"); - + // GitLab instance is located in Ukraine. Connection times will vary across the world. buildSizeClient.Timeout = TimeSpan.FromSeconds(10); @@ -242,7 +245,7 @@ namespace Ryujinx.Ava.Systems } } - private static async void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) + private static void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) { // Multi-Threaded Updater long chunkSize = _buildSize / ConnectionCount; @@ -253,95 +256,111 @@ namespace Ryujinx.Ava.Systems int[] progressPercentage = new int[ConnectionCount]; List list = new(ConnectionCount); + List webClients = new(ConnectionCount); + for (int i = 0; i < ConnectionCount; i++) { list.Add([]); } - using HttpClient httpClient = ConstructHttpClient(); - List downloadTasks = new(); - for (int i = 0; i < ConnectionCount; i++) { - int index = i; - long start = chunkSize * index; - long end = (index == ConnectionCount - 1) ? (chunkSize * (index + 1) - 1 + remainderChunk) : (chunkSize * (index + 1) - 1); +#pragma warning disable SYSLIB0014 + // TODO: WebClient is obsolete and need to be replaced with a more complex logic using HttpClient. + using WebClient client = new(); +#pragma warning restore SYSLIB0014 - downloadTasks.Add(Task.Run(async () => + webClients.Add(client); + + if (i == ConnectionCount - 1) { - try + client.Headers.Add("Range", $"bytes={chunkSize * i}-{(chunkSize * (i + 1) - 1) + remainderChunk}"); + } + else + { + client.Headers.Add("Range", $"bytes={chunkSize * i}-{chunkSize * (i + 1) - 1}"); + } + + client.DownloadProgressChanged += (_, args) => + { + int index = (int)args.UserState; + + Interlocked.Add(ref totalProgressPercentage, -1 * progressPercentage[index]); + Interlocked.Exchange(ref progressPercentage[index], args.ProgressPercentage); + Interlocked.Add(ref totalProgressPercentage, args.ProgressPercentage); + + taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); + }; + + client.DownloadDataCompleted += (_, args) => + { + int index = (int)args.UserState; + + if (args.Cancelled) { - HttpRequestMessage request = new(HttpMethod.Get, downloadUrl); - request.Headers.Range = new System.Net.Http.Headers.RangeHeaderValue(start, end); + webClients[index].Dispose(); - using HttpResponseMessage response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); - response.EnsureSuccessStatusCode(); + taskDialog.Hide(); - using Stream contentStream = await response.Content.ReadAsStreamAsync(); - using MemoryStream memoryStream = new(); + return; + } - byte[] buffer = new byte[32 * 1024]; - int bytesRead; - long totalRead = 0; - long totalSize = end - start + 1; + list[index] = args.Result; + Interlocked.Increment(ref completedRequests); - while ((bytesRead = await contentStream.ReadAsync(buffer)) > 0) + if (Equals(completedRequests, ConnectionCount)) + { + byte[] mergedFileBytes = new byte[_buildSize]; + for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) { - memoryStream.Write(buffer, 0, bytesRead); - totalRead += bytesRead; - - int progress = (int)(100 * totalRead / totalSize); - Interlocked.Add(ref totalProgressPercentage, -progressPercentage[index]); - progressPercentage[index] = progress; - Interlocked.Add(ref totalProgressPercentage, progress); - - taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); + Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); + destinationOffset += list[connectionIndex].Length; } - list[index] = memoryStream.ToArray(); + File.WriteAllBytes(updateFile, mergedFileBytes); - if (Interlocked.Increment(ref completedRequests) == ConnectionCount) + // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. + if (OperatingSystem.IsMacOS()) { - byte[] mergedFileBytes = new byte[_buildSize]; - for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) - { - Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); - destinationOffset += list[connectionIndex].Length; - } + using Process xattrProcess = Process.Start("xattr", + ["-d", "com.apple.quarantine", updateFile]); - File.WriteAllBytes(updateFile, mergedFileBytes); + xattrProcess.WaitForExit(); + } - // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. - if (OperatingSystem.IsMacOS()) - { - using Process xattrProcess = Process.Start("xattr", - ["-d", "com.apple.quarantine", updateFile]); + try + { + InstallUpdate(taskDialog, updateFile); + } + 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."); - xattrProcess.WaitForExit(); - } - - try - { - InstallUpdate(taskDialog, updateFile); - } - 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."); - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); - } + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); } } - catch (Exception ex) + }; + + try + { + client.DownloadDataAsync(new Uri(downloadUrl), i); + } + 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."); + + foreach (WebClient webClient in webClients) { - Logger.Warning?.Print(LogClass.Application, ex.Message); - Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + webClient.CancelAsync(); } - })); + + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + + return; + } } - - await Task.WhenAll(downloadTasks); } private static void DoUpdateWithSingleThreadWorker(TaskDialog taskDialog, string downloadUrl, string updateFile) diff --git a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs index 74def97c6..ee0e884d2 100644 --- a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs +++ b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs @@ -118,7 +118,7 @@ namespace Ryujinx.Ava.UI.Applet await ContentDialogHelper.ShowWindowAsync(_mainWindow.SettingsWindow, _mainWindow); _mainWindow.SettingsWindow = null; - Close(); + this.Close(); }); } } diff --git a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs index 34e45114a..c54cd390c 100644 --- a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs +++ b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs @@ -1,5 +1,26 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; +using Avalonia.Platform.Storage; +using CommunityToolkit.Mvvm.Input; +using LibHac.Fs; +using LibHac.Tools.FsSystem.NcaUtils; +using Ryujinx.Ava.Common; +using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.Common.Models; +using Ryujinx.Ava.Systems.AppLibrary; +using Ryujinx.Ava.UI.Helpers; +using Ryujinx.Ava.UI.ViewModels; +using Ryujinx.Ava.UI.Views.Dialog; +using Ryujinx.Ava.UI.Windows; +using Ryujinx.Ava.Utilities; +using Ryujinx.Common.Configuration; +using Ryujinx.Common.Helper; +using Ryujinx.HLE.HOS; +using SkiaSharp; +using System; +using System.Collections.Generic; +using System.IO; +using Path = System.IO.Path; namespace Ryujinx.Ava.UI.Controls { diff --git a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs index 4d83da546..c9d1c79c2 100644 --- a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs +++ b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs @@ -2,15 +2,17 @@ using Avalonia.Logging; using Avalonia.Utilities; using Gommon; using Ryujinx.Ava.Systems.Configuration; +using Ryujinx.Common.Logging; using System; using System.Text; -using AvaLogger = Avalonia.Logging.Logger; -using AvaLogLevel = Avalonia.Logging.LogEventLevel; -using RyuLogClass = Ryujinx.Common.Logging.LogClass; -using RyuLogger = Ryujinx.Common.Logging.Logger; namespace Ryujinx.Ava.UI.Helpers { + using AvaLogger = Avalonia.Logging.Logger; + using AvaLogLevel = LogEventLevel; + using RyuLogClass = LogClass; + using RyuLogger = Ryujinx.Common.Logging.Logger; + internal class LoggerAdapter : ILogSink { private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog; diff --git a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs index b5fda471c..c7d217bf5 100644 --- a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs +++ b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -35,7 +36,7 @@ namespace Ryujinx.Ava.UI.Helpers [UnmanagedFunctionPointer(CallingConvention.Winapi)] internal delegate nint WindowProc(nint hWnd, WindowsMessages msg, nint wParam, nint lParam); - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] public struct WndClassEx { public int cbSize; diff --git a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs index 477649909..526e63afe 100644 --- a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs @@ -257,7 +257,7 @@ namespace Ryujinx.Ava.UI.Models.Input Led = new LedConfigController { EnableLed = EnableLedChanging, - TurnOffLed = TurnOffLed, + TurnOffLed = this.TurnOffLed, UseRainbow = UseRainbowLed, LedColor = LedColor.ToUInt32() }, diff --git a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs index c8169b6d5..0213d72fe 100644 --- a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs @@ -2,6 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Keyboard; +using System.Xml.Linq; namespace Ryujinx.Ava.UI.Models.Input { diff --git a/src/Ryujinx/UI/Renderer/RendererHost.cs b/src/Ryujinx/UI/Renderer/RendererHost.cs index 7df02629e..9d24fbbad 100644 --- a/src/Ryujinx/UI/Renderer/RendererHost.cs +++ b/src/Ryujinx/UI/Renderer/RendererHost.cs @@ -37,6 +37,7 @@ namespace Ryujinx.Ava.UI.Renderer _ => throw new NotImplementedException() }; + private void Initialize() { EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated; diff --git a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs index e24c574bb..8a5ae441b 100644 --- a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs @@ -1,10 +1,10 @@ using Gommon; -using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Systems; using Ryujinx.Ava.Systems.AppLibrary; using System; using System.Collections.Generic; using System.Linq; +using Ryujinx.Ava.Common.Locale; namespace Ryujinx.Ava.UI.ViewModels { @@ -30,18 +30,19 @@ namespace Ryujinx.Ava.UI.ViewModels public string BootsInfoText { get; set; } public string NothingInfoText { get; set; } + private IEnumerable _currentEntries = CompatibilityDatabase.Entries; private string[] _ownedGameTitleIds = []; - private readonly Func _sortKeySelector = x => x.GameName; // Default sort by GameName + private Func _sortKeySelector = x => x.GameName; // Default sort by GameName public IEnumerable CurrentEntries => OnlyShowOwnedGames ? _currentEntries.Where(x => x.TitleId.Check(tid => _ownedGameTitleIds.ContainsIgnoreCase(tid))) : _currentEntries; - public CompatibilityViewModel() { } + public CompatibilityViewModel() {} private void AppCountUpdated(object _, ApplicationCountUpdatedEventArgs __) => _ownedGameTitleIds = _appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray(); @@ -56,11 +57,11 @@ namespace Ryujinx.Ava.UI.ViewModels public void CountByStatus() { - PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); - InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); - MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); - BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); - NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); + PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); + InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); + MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); + BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); + NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); _onlyShowOwnedGames = true; } @@ -86,6 +87,7 @@ namespace Ryujinx.Ava.UI.ViewModels } } + public void NameSorting(int nameSort = 0) { _sorting.Name = nameSort; @@ -160,5 +162,6 @@ namespace Ryujinx.Ava.UI.ViewModels }; } } + } } diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index f96b8a138..81aae6b74 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -1,6 +1,7 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Svg.Skia; +using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; using Gommon; using Ryujinx.Ava.Common.Locale; @@ -99,7 +100,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense"); public event Action NotifyChangesEvent; - + public string ChosenProfile { get => _chosenProfile; @@ -326,11 +327,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld])); } + + private void LoadConfiguration(InputConfig inputConfig = null) { if (UseGlobalConfig && Program.UseExtraConfig) { - Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); + Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); } else { @@ -977,7 +980,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (Device == 0) { - newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == PlayerId)); + newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == this.PlayerId)); } else { diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 06fb9c13a..8b9b04511 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -57,6 +57,7 @@ using Key = Ryujinx.Input.Key; using MissingKeyException = LibHac.Common.Keys.MissingKeyException; using Path = System.IO.Path; using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState; +using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId; namespace Ryujinx.Ava.UI.ViewModels { @@ -1594,9 +1595,9 @@ namespace Ryujinx.Ava.UI.ViewModels // Code where conditions will be executed after loading user configuration if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit) { - Rebooter.RebootAppWithGame(application.Path, + Rebooter.RebootAppWithGame(application.Path, [ - "--bt", + "--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() ]); diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index e684d6400..654eb0c43 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -86,6 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle); public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1; + public int ResolutionScale { get => _resolutionScale; @@ -143,11 +144,11 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } public bool EnableMouse { get; set; } - public bool DisableInputWhenOutOfFocus { get; set; } + public bool DisableInputWhenOutOfFocus { get; set; } public int FocusLostActionType { get; set; } public bool UseGlobalInputConfig - { + { get => _useInputGlobalConfig; set { @@ -162,7 +163,7 @@ namespace Ryujinx.Ava.UI.ViewModels public VSyncMode VSyncMode { - get => _vSyncMode; + get => _vSyncMode; set { if (value is VSyncMode.Custom or VSyncMode.Switch or VSyncMode.Unbounded) @@ -225,6 +226,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnablePptc { get; set; } public bool EnableLowPowerPptc { get; set; } + public long TurboMultiplier { get => _turboModeMultiplier; @@ -575,7 +577,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void LoadCurrentConfiguration(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; // User Interface EnableDiscordIntegration = config.EnableDiscordIntegration; @@ -686,7 +688,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void SaveSettings(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; // User Interface config.EnableDiscordIntegration.Value = EnableDiscordIntegration; diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs index c485699bd..02e6e99c9 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs @@ -100,7 +100,7 @@ namespace Ryujinx.Ava.UI.Views.Input { _currentAssigner = new ButtonKeyAssigner(button); - Focus(NavigationMethod.Pointer); + this.Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs index 043222011..b9a5462b2 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Views.Settings { _currentAssigner = new ButtonKeyAssigner(button); - Focus(NavigationMethod.Pointer); + this.Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs index 319015c70..283efd083 100644 --- a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs @@ -1,6 +1,6 @@ using Avalonia.Controls; -using Avalonia.Interactivity; using Ryujinx.Ava.Common.Locale; +using Avalonia.Interactivity; using Ryujinx.Ava.Systems.Configuration; using Ryujinx.Ava.UI.ViewModels; using System.Threading.Tasks; @@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows if (DataContext is not CompatibilityViewModel cvm) return; - cvm.NameSorting(int.Parse(sortStrategy)); + cvm.NameSorting(int.Parse(sortStrategy)); } } @@ -65,5 +65,6 @@ namespace Ryujinx.Ava.UI.Windows cvm.StatusSorting(int.Parse(sortStrategy)); } } + } } diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 0380cb596..a2d7ff657 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Windows InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver()); _ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it); - ScalingChanged += OnScalingChanged; + this.ScalingChanged += OnScalingChanged; } } @@ -157,7 +157,7 @@ namespace Ryujinx.Ava.UI.Windows private void OnScalingChanged(object sender, EventArgs e) { - Program.DesktopScaleFactor = RenderScaling; + Program.DesktopScaleFactor = this.RenderScaling; } private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e) @@ -563,16 +563,16 @@ namespace Ryujinx.Ava.UI.Windows public static void UpdateGraphicsConfig() { - - GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 - ? ConfigurationState.Instance.Graphics.ResScaleCustom +#pragma warning disable IDE0055 // Disable formatting + GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 + ? ConfigurationState.Instance.Graphics.ResScaleCustom : ConfigurationState.Instance.Graphics.ResScale; - GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; - GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; - GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; + GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; + GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; + GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression; - GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; - + GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; +#pragma warning restore IDE0055 } private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e) diff --git a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs index 66cdc6125..c6e8894e2 100644 --- a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs +++ b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs @@ -43,7 +43,7 @@ namespace Ryujinx.Ava.Utilities.SystemInfo return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim(); } - [StructLayout(LayoutKind.Sequential, Pack = 1)] + [StructLayout(LayoutKind.Sequential)] private struct MemoryStatusEx { public uint Length; diff --git a/src/Spv.Generator/InstructionOperands.cs b/src/Spv.Generator/InstructionOperands.cs index 7d6b064ad..38c2b1f2c 100644 --- a/src/Spv.Generator/InstructionOperands.cs +++ b/src/Spv.Generator/InstructionOperands.cs @@ -21,11 +21,11 @@ namespace Spv.Generator { if (Count > InternalCount) { - return MemoryMarshal.CreateSpan(ref Overflow[0], Count); + return MemoryMarshal.CreateSpan(ref this.Overflow[0], Count); } else { - return MemoryMarshal.CreateSpan(ref Operand1, Count); + return MemoryMarshal.CreateSpan(ref this.Operand1, Count); } } @@ -33,7 +33,7 @@ namespace Spv.Generator { if (Count < InternalCount) { - MemoryMarshal.CreateSpan(ref Operand1, Count + 1)[Count] = operand; + MemoryMarshal.CreateSpan(ref this.Operand1, Count + 1)[Count] = operand; Count++; } else @@ -41,7 +41,7 @@ namespace Spv.Generator if (Overflow == null) { Overflow = new IOperand[InternalCount * 2]; - MemoryMarshal.CreateSpan(ref Operand1, InternalCount).CopyTo(Overflow.AsSpan()); + MemoryMarshal.CreateSpan(ref this.Operand1, InternalCount).CopyTo(Overflow.AsSpan()); } else if (Count == Overflow.Length) { From 557c2a50b2164823d2731f9ddd8e57ae27f01486 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 16 Jun 2025 02:04:48 -0500 Subject: [PATCH 20/34] infra: Add NuGet config to solution items --- Ryujinx.sln | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Ryujinx.sln b/Ryujinx.sln index 9ed282d09..4babf3fb9 100644 --- a/Ryujinx.sln +++ b/Ryujinx.sln @@ -77,6 +77,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Horizon.Kernel.Gene EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.HLE.Generators", "src\Ryujinx.HLE.Generators\Ryujinx.HLE.Generators.csproj", "{B575BCDE-2FD8-4A5D-8756-31CDD7FE81F0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ryujinx.BuildValidationTasks", "src\Ryujinx.BuildValidationTasks\Ryujinx.BuildValidationTasks.csproj", "{4A89A234-4F19-497D-A576-DDE8CDFC5B22}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{36F870C1-3E5F-485F-B426-F0645AF78751}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -84,10 +86,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .github\workflows\canary.yml = .github\workflows\canary.yml Directory.Packages.props = Directory.Packages.props .github\workflows\release.yml = .github\workflows\release.yml + nuget.config = nuget.config EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ryujinx.BuildValidationTasks", "src\Ryujinx.BuildValidationTasks\Ryujinx.BuildValidationTasks.csproj", "{4A89A234-4F19-497D-A576-DDE8CDFC5B22}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU From 6803c91da8784e56284e5740150e9df515da0d2a Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 16 Jun 2025 02:05:11 -0500 Subject: [PATCH 21/34] infra: Add package source mappings for Ryujinx.UpdateClient to silence compile warnings --- nuget.config | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nuget.config b/nuget.config index 4e51027dc..77eadcf88 100644 --- a/nuget.config +++ b/nuget.config @@ -8,4 +8,16 @@ + + + + + + + + + + From 973c6ba5df30d25f79097c6708b29bdc4f371bef Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 16 Jun 2025 02:06:45 -0500 Subject: [PATCH 22/34] UI: RPC: Squeakross: Home Squeak Home image docs: compat: Squeakross: Home Squeak Home: Playable --- docs/compatibility.csv | 1 + src/Ryujinx.Common/TitleIDs.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/compatibility.csv b/docs/compatibility.csv index 684fc7833..56d737aa2 100644 --- a/docs/compatibility.csv +++ b/docs/compatibility.csv @@ -2746,6 +2746,7 @@ 01005D701264A000,"SpyHack",,playable,2021-04-15 10:53:51 010077B00E046000,"Spyro™ Reignited Trilogy",nvdec;UE4,playable,2022-09-11 18:38:33 0100085012A0E000,"Squeakers",,playable,2020-12-13 12:13:05 +0100E1D01EB2E000,"Squeakross: Home Squeak Home",,playable,2025-06-16 02:02:00 010009300D31C000,"Squidgies Takeover",,playable,2020-07-20 22:28:08 0100FCD0102EC000,"Squidlit",,playable,2020-08-06 12:38:32 0100EBF00E702000,"STAR OCEAN First Departure R",nvdec,playable,2021-07-05 19:29:16 diff --git a/src/Ryujinx.Common/TitleIDs.cs b/src/Ryujinx.Common/TitleIDs.cs index 16c9ea05f..d753caa33 100644 --- a/src/Ryujinx.Common/TitleIDs.cs +++ b/src/Ryujinx.Common/TitleIDs.cs @@ -195,6 +195,7 @@ namespace Ryujinx.Common "01008d100d43e000", // Saints Row IV "0100de600beee000", // Saints Row: The Third - The Full Package "01001180021fa000", // Shovel Knight: Specter of Torment + "0100e1D01eb2e000", // Squeakross: Home Squeak Home "0100e65002bb8000", // Stardew Valley "0100d7a01b7a2000", // Star Wars: Bounty Hunter "0100800015926000", // Suika Game From 39944b20630399e303a1652ae309df7a75f02ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hack=E8=8C=B6=E3=82=93?= Date: Tue, 17 Jun 2025 03:21:30 -0500 Subject: [PATCH 23/34] Update Korean translation (ryubing/ryujinx!64) See merge request ryubing/ryujinx!64 --- assets/locales.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/locales.json b/assets/locales.json index a53c0047a..1158fd5a0 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -4009,7 +4009,7 @@ "he_IL": "", "it_IT": "", "ja_JP": "", - "ko_KR": "Ryujinx 1.1.1403을 연상시키는 이전 Avalonia Ryujinx UI를 표시합니다. 이 기능은 Windows가 아닌 플랫폼에서는 기본적으로 활성화됩니다.\n 클래식 스타일의 타이틀 바가 돌아왔고 주요 창 레이아웃 재작업이 역전되었습니다. 이 툴팁 위의 설정 탐색 배치와 같은 작업입니다.", + "ko_KR": "Ryujinx 1.1.1403을 연상시키는 이전 Avalonia Ryujinx UI를 표시합니다. 이 기능은 윈도가 아닌 플랫폼에서는 기본적으로 활성화됩니다.\n 클래식 스타일의 타이틀 바가 돌아왔고 주요 창 레이아웃 변경 사항이 원래대로 적용됩니다. 이 툴팁 위의 설정 탐색 배치와 같은 경우입니다.", "no_NO": "Vis det eldre Avalonia Ryujinx-grensesnittet som minner om Ryujinx 1.1.1403. Dette er aktivert som standard på plattformer som ikke er Windows.\nTittellinjen i klassisk stil er tilbake, og store omarbeidinger av vindusoppsettet er reversert, for eksempel plasseringen av innstillingsnavigasjonen over dette verktøytipset.", "pl_PL": "", "pt_BR": "Mostrar a Interface Avalonia antiga do Ryujinx 1.1.1403. Esta versão é ativada por padrão nas plataformas que não sejam Windows. \nO estilo clássico da Barra de Título retorna e grande parte das mudanças do Layout de janela são revertidas; assim como as configurações de posicionamento da navegação acima dessa descrição.", From b1cde5fd9745fcb3e5d82bc5343e99caa711fa1e Mon Sep 17 00:00:00 2001 From: yeager Date: Tue, 17 Jun 2025 13:05:39 -0500 Subject: [PATCH 24/34] Updated Swedish translation (ryubing/ryujinx!66) See merge request ryubing/ryujinx!66 --- assets/locales.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/locales.json b/assets/locales.json index 1158fd5a0..8b60c04bd 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -2089,7 +2089,7 @@ "pl_PL": "Całkowity czas gry: {0}", "pt_BR": "Tempo total de jogo: {0}", "ru_RU": "", - "sv_SE": "", + "sv_SE": "Total speltid: {0}", "th_TH": "", "tr_TR": "Toplam Oyun Süresi: {0}", "uk_UA": "", @@ -7214,7 +7214,7 @@ "pl_PL": "", "pt_BR": "Configuração encontrada:\n\nNome:\t{0}\nGUID:\t{1}\n\n Aguardando conexão do controle...", "ru_RU": "", - "sv_SE": "", + "sv_SE": "Konfiguration hittad:\n\nNamn:\t{0}\nGUID:\t{1}\n\n Väntar på anslutning till kontroller...", "th_TH": "", "tr_TR": "", "uk_UA": "", @@ -13139,7 +13139,7 @@ "pl_PL": "", "pt_BR": "Falha em atualizar a versão do Ryujinx recebida do servidor de atualização.", "ru_RU": "", - "sv_SE": "", + "sv_SE": "Det gick inte att konvertera Ryujinx-versionen som mottogs från uppdateringsservern.", "th_TH": "", "tr_TR": "", "uk_UA": "", @@ -16564,7 +16564,7 @@ "pl_PL": "", "pt_BR": "Se esta opção está ativada nas configurações customizadas, as configurações globais de entrada serão usadas.\n\nNas configurações globais: você pode ativar ou desativá-las se necessário; está configuração será herdada por qualquer nova configuração customizada criada.", "ru_RU": "Если эта опция включена в пользовательских настройках, будет использована глобальная конфигурация ввода.\n\nВ глобальных настройках: переключите эту опцию по своему усмотрению, это будет унаследовано для вновь созданых пользовательских конфигураций", - "sv_SE": "", + "sv_SE": "Om det här alternativet är aktiverat i anpassade inställningar kommer den globala inmatningskonfigurationen att användas.\n\nI de globala inställningarna: du kan aktivera eller inaktivera det efter behov; den här inställningen kommer att ärvas av alla nya anpassade konfigurationer som skapas.", "th_TH": "", "tr_TR": "", "uk_UA": "", @@ -23439,7 +23439,7 @@ "pl_PL": "", "pt_BR": "Ver Registro", "ru_RU": "", - "sv_SE": "", + "sv_SE": "Visa ändringslogg", "th_TH": "ด", "tr_TR": "", "uk_UA": "", @@ -24539,7 +24539,7 @@ "pl_PL": "Gry i Aplikacje", "pt_BR": "Jogos e Aplicativos", "ru_RU": "Игры и Приложения", - "sv_SE": "Spel och Applikationer", + "sv_SE": "Spel och applikationer", "th_TH": "", "tr_TR": "Oyunlar ve Uygulamalar", "uk_UA": "Ігри та Додатки", @@ -24589,7 +24589,7 @@ "pl_PL": "Problemy i Cechy", "pt_BR": "Problemas e Características", "ru_RU": "Проблемы и Особенности", - "sv_SE": "Problem och Egenskaper", + "sv_SE": "Problem och egenskaper", "th_TH": "", "tr_TR": "Sorunlar ve Özellikler", "uk_UA": "Проблеми та Особливості", From 6226eadf5548023511c0315bb1a9dd631cf99295 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Wed, 18 Jun 2025 14:31:08 -0500 Subject: [PATCH 25/34] docs: compat: The Legend of Nayuta: Boundless Trails: ingame (ryubing/ryujinx!59) --- docs/compatibility.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/compatibility.csv b/docs/compatibility.csv index 56d737aa2..6499c8a7a 100644 --- a/docs/compatibility.csv +++ b/docs/compatibility.csv @@ -3017,6 +3017,7 @@ 01009B101044C000,"The Legend of Heroes: Trails of Cold Steel III Demo",demo;nvdec,playable,2021-04-23 01:07:32 0100D3C010DE8000,"The Legend of Heroes: Trails of Cold Steel IV",nvdec,playable,2021-04-23 14:01:05 01005E5013862000,"THE LEGEND OF HEROES: ZERO NO KISEKI KAI [英雄傳說 零之軌跡:改]",crash,nothing,2021-09-30 14:41:07 +01009C901ACEE000,"The Legend of Nayuta: Boundless Trails",,ingame,2025-06-12 15:47 01008CF01BAAC000,"The Legend of Zelda Echoes of Wisdom",nvdec;ASTC;intel-vendor-bug,playable,2024-10-01 14:11:01 0100509005AF2000,"The Legend of Zelda: Breath of the Wild Demo",demo,ingame,2022-12-24 05:02:58 01007EF00011E000,"The Legend of Zelda™: Breath of the Wild",gpu;amd-vendor-bug;mac-bug,ingame,2024-09-23 19:35:46 From 6773406bb69b3b4845997d835de5d41a8dca0678 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Thu, 19 Jun 2025 04:18:02 -0500 Subject: [PATCH 26/34] infra: Use Ryujinx.UpdateClient NuGet package for checking for updates. Main benefit to this is sharing the C# model definitions from what the server returns and Ryujinx uses in-app without differences. Additionally removed the GitHub API JSON models. --- Directory.Packages.props | 2 + nuget.config | 2 + .../Github/GithubReleaseAssetJsonResponse.cs | 9 -- .../Github/GithubReleasesJsonResponse.cs | 12 --- .../GithubReleasesJsonSerializerContext.cs | 7 -- src/Ryujinx/Ryujinx.csproj | 2 + src/Ryujinx/Systems/Updater/Updater.GitLab.cs | 91 ++++++------------- src/Ryujinx/Systems/Updater/Updater.cs | 14 +-- 8 files changed, 38 insertions(+), 101 deletions(-) delete mode 100644 src/Ryujinx/Common/Models/Github/GithubReleaseAssetJsonResponse.cs delete mode 100644 src/Ryujinx/Common/Models/Github/GithubReleasesJsonResponse.cs delete mode 100644 src/Ryujinx/Common/Models/Github/GithubReleasesJsonSerializerContext.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index ccbcb3f6b..ce2a152d1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -42,6 +42,8 @@ + + diff --git a/nuget.config b/nuget.config index 77eadcf88..26f795ba1 100644 --- a/nuget.config +++ b/nuget.config @@ -10,11 +10,13 @@ + +