From 77a797f1549718f2ec06cc924d05f364f5c2e295 Mon Sep 17 00:00:00 2001 From: GreemDev Date: Sun, 15 Jun 2025 20:45:26 -0500 Subject: [PATCH] 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) {