diff --git a/.editorconfig b/.editorconfig index 1059bcdeb..0f9dd369a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -45,10 +45,10 @@ dotnet_separate_import_directive_groups = false dotnet_sort_system_directives_first = false # this. and Me. preferences -dotnet_style_qualification_for_event = false:silent -dotnet_style_qualification_for_field = false:silent -dotnet_style_qualification_for_method = false:silent -dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_event = false:suggestion +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_property = false:suggestion # Language keywords vs BCL types preferences dotnet_style_predefined_type_for_locals_parameters_members = true:silent @@ -257,12 +257,14 @@ csharp_prefer_system_threading_lock = true:suggestion dotnet_diagnostic.CA1069.severity = none # CA1069: Enums values should not be duplicated # Disable Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppression +dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure dotnet_diagnostic.IDE0300.severity = none dotnet_diagnostic.IDE0301.severity = none dotnet_diagnostic.IDE0302.severity = none dotnet_diagnostic.IDE0305.severity = none dotnet_diagnostic.CS9113.severity = none # CS9113: Parameter 'value' is unread -dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure +dotnet_diagnostic.CS0649.severity = none # CS0649: Field is never assigned to, and will always have its default value [src/Ryujinx/UI/ViewModels/**.cs] # Disable "mark members as static" rule for ViewModels diff --git a/assets/locales.json b/assets/locales.json index 6bc44721d..5bb8a1d51 100644 --- a/assets/locales.json +++ b/assets/locales.json @@ -25023,4 +25023,4 @@ } } ] -} +} \ No newline at end of file diff --git a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs index 0d493426b..38398fb6a 100644 --- a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs +++ b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs @@ -1129,7 +1129,6 @@ namespace ARMeilleure.CodeGen.Arm64 }; } -#pragma warning disable IDE0051 // Remove unused private member private void WriteInt16(short value) { WriteUInt16((ushort)value); @@ -1144,7 +1143,6 @@ namespace ARMeilleure.CodeGen.Arm64 { _stream.WriteByte(value); } -#pragma warning restore IDE0051 private void WriteUInt16(ushort value) { diff --git a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs index fbf4c1eb4..e2ac49b23 100644 --- a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs +++ b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs @@ -1570,13 +1570,11 @@ namespace ARMeilleure.CodeGen.Arm64 Debug.Assert(op1.Type == op3.Type); } -#pragma warning disable IDE0051 // Remove unused private member private static void EnsureSameType(Operand op1, Operand op2, Operand op3, Operand op4) { Debug.Assert(op1.Type == op2.Type); Debug.Assert(op1.Type == op3.Type); Debug.Assert(op1.Type == op4.Type); } -#pragma warning restore IDE0051 } } diff --git a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs index 4b226803b..ddceae057 100644 --- a/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs +++ b/src/ARMeilleure/CodeGen/X86/AssemblerTable.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.CodeGen.X86 { diff --git a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs index 8433aaea9..02b91c163 100644 --- a/src/ARMeilleure/CodeGen/X86/CallingConvention.cs +++ b/src/ARMeilleure/CodeGen/X86/CallingConvention.cs @@ -20,12 +20,12 @@ namespace ARMeilleure.CodeGen.X86 { if (GetCurrentCallConv() == CallConvName.Windows) { -#pragma warning disable IDE0055 // Disable formatting + return (1 << (int)X86Register.Rax) | (1 << (int)X86Register.Rcx) | (1 << (int)X86Register.Rdx) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); } @@ -36,11 +36,11 @@ namespace ARMeilleure.CodeGen.X86 (1 << (int)X86Register.Rdx) | (1 << (int)X86Register.Rsi) | (1 << (int)X86Register.Rdi) | - (1 << (int)X86Register.R8) | - (1 << (int)X86Register.R9) | + (1 << (int)X86Register.R8) | + (1 << (int)X86Register.R9) | (1 << (int)X86Register.R10) | (1 << (int)X86Register.R11); -#pragma warning restore IDE0055 + } } diff --git a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs index afae3211f..6d72e0aff 100644 --- a/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs +++ b/src/ARMeilleure/CodeGen/X86/CodeGenContext.cs @@ -2,7 +2,6 @@ using ARMeilleure.CodeGen.RegisterAllocators; using ARMeilleure.IntermediateRepresentation; using Microsoft.IO; using Ryujinx.Common.Memory; -using System.IO; using System.Numerics; namespace ARMeilleure.CodeGen.X86 diff --git a/src/ARMeilleure/CodeGen/X86/X86Register.cs b/src/ARMeilleure/CodeGen/X86/X86Register.cs index bcce4f974..d1394deaa 100644 --- a/src/ARMeilleure/CodeGen/X86/X86Register.cs +++ b/src/ARMeilleure/CodeGen/X86/X86Register.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace ARMeilleure.CodeGen.X86 { enum X86Register diff --git a/src/ARMeilleure/Instructions/CryptoHelper.cs b/src/ARMeilleure/Instructions/CryptoHelper.cs index 046a9bb6d..3ce04aa5c 100644 --- a/src/ARMeilleure/Instructions/CryptoHelper.cs +++ b/src/ARMeilleure/Instructions/CryptoHelper.cs @@ -8,8 +8,8 @@ namespace ARMeilleure.Instructions static class CryptoHelper { #region "LookUp Tables" -#pragma warning disable IDE1006 // Naming rule violation - private static ReadOnlySpan _sBox => + + private static ReadOnlySpan SBox => [ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, @@ -29,7 +29,7 @@ namespace ARMeilleure.Instructions 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 ]; - private static ReadOnlySpan _invSBox => + private static ReadOnlySpan InvSBox => [ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, @@ -49,7 +49,7 @@ namespace ARMeilleure.Instructions 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ]; - private static ReadOnlySpan _gfMul02 => + private static ReadOnlySpan GfMul02 => [ 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, @@ -69,7 +69,7 @@ namespace ARMeilleure.Instructions 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 ]; - private static ReadOnlySpan _gfMul03 => + private static ReadOnlySpan GfMul03 => [ 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, @@ -89,7 +89,7 @@ namespace ARMeilleure.Instructions 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a ]; - private static ReadOnlySpan _gfMul09 => + private static ReadOnlySpan GfMul09 => [ 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, @@ -109,7 +109,7 @@ namespace ARMeilleure.Instructions 0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46 ]; - private static ReadOnlySpan _gfMul0B => + private static ReadOnlySpan GfMul0B => [ 0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, @@ -129,7 +129,7 @@ namespace ARMeilleure.Instructions 0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3 ]; - private static ReadOnlySpan _gfMul0D => + private static ReadOnlySpan GfMul0D => [ 0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, @@ -149,7 +149,7 @@ namespace ARMeilleure.Instructions 0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97 ]; - private static ReadOnlySpan _gfMul0E => + private static ReadOnlySpan GfMul0E => [ 0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, @@ -169,16 +169,16 @@ namespace ARMeilleure.Instructions 0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d ]; - private static ReadOnlySpan _srPerm => + private static ReadOnlySpan SrPerm => [ 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3 ]; - private static ReadOnlySpan _isrPerm => + private static ReadOnlySpan IsrPerm => [ 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11 ]; -#pragma warning restore IDE1006 + #endregion public static V128 AesInvMixColumns(V128 op) @@ -195,10 +195,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)_gfMul0E[row0] ^ _gfMul0B[row1] ^ _gfMul0D[row2] ^ _gfMul09[row3]); - outState[idx + 1] = (byte)((uint)_gfMul09[row0] ^ _gfMul0E[row1] ^ _gfMul0B[row2] ^ _gfMul0D[row3]); - outState[idx + 2] = (byte)((uint)_gfMul0D[row0] ^ _gfMul09[row1] ^ _gfMul0E[row2] ^ _gfMul0B[row3]); - outState[idx + 3] = (byte)((uint)_gfMul0B[row0] ^ _gfMul0D[row1] ^ _gfMul09[row2] ^ _gfMul0E[row3]); + outState[idx + 0] = (byte)((uint)GfMul0E[row0] ^ GfMul0B[row1] ^ GfMul0D[row2] ^ GfMul09[row3]); + outState[idx + 1] = (byte)((uint)GfMul09[row0] ^ GfMul0E[row1] ^ GfMul0B[row2] ^ GfMul0D[row3]); + outState[idx + 2] = (byte)((uint)GfMul0D[row0] ^ GfMul09[row1] ^ GfMul0E[row2] ^ GfMul0B[row3]); + outState[idx + 3] = (byte)((uint)GfMul0B[row0] ^ GfMul0D[row1] ^ GfMul09[row2] ^ GfMul0E[row3]); } return new V128(outState); @@ -211,7 +211,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[_isrPerm[idx]] = inState[idx]; + outState[IsrPerm[idx]] = inState[idx]; } return new V128(outState); @@ -224,7 +224,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = _invSBox[inState[idx]]; + outState[idx] = InvSBox[inState[idx]]; } return new V128(outState); @@ -244,10 +244,10 @@ namespace ARMeilleure.Instructions byte row2 = inState[idx + 2]; // C, G, K, O: [row2, col0-col3] byte row3 = inState[idx + 3]; // D, H, L, P: [row3, col0-col3] - outState[idx + 0] = (byte)((uint)_gfMul02[row0] ^ _gfMul03[row1] ^ row2 ^ row3); - outState[idx + 1] = (byte)((uint)row0 ^ _gfMul02[row1] ^ _gfMul03[row2] ^ row3); - outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ _gfMul02[row2] ^ _gfMul03[row3]); - outState[idx + 3] = (byte)((uint)_gfMul03[row0] ^ row1 ^ row2 ^ _gfMul02[row3]); + outState[idx + 0] = (byte)((uint)GfMul02[row0] ^ GfMul03[row1] ^ row2 ^ row3); + outState[idx + 1] = (byte)((uint)row0 ^ GfMul02[row1] ^ GfMul03[row2] ^ row3); + outState[idx + 2] = (byte)((uint)row0 ^ row1 ^ GfMul02[row2] ^ GfMul03[row3]); + outState[idx + 3] = (byte)((uint)GfMul03[row0] ^ row1 ^ row2 ^ GfMul02[row3]); } return new V128(outState); @@ -260,7 +260,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[_srPerm[idx]] = inState[idx]; + outState[SrPerm[idx]] = inState[idx]; } return new V128(outState); @@ -273,7 +273,7 @@ namespace ARMeilleure.Instructions for (int idx = 0; idx <= 15; idx++) { - outState[idx] = _sBox[inState[idx]]; + outState[idx] = SBox[inState[idx]]; } return new V128(outState); diff --git a/src/ARMeilleure/Instructions/InstEmitMul.cs b/src/ARMeilleure/Instructions/InstEmitMul.cs index cb48deb03..bd2ac8d64 100644 --- a/src/ARMeilleure/Instructions/InstEmitMul.cs +++ b/src/ARMeilleure/Instructions/InstEmitMul.cs @@ -2,7 +2,6 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.Translation; using System; -using System.Diagnostics.CodeAnalysis; using static ARMeilleure.Instructions.InstEmitHelper; namespace ARMeilleure.Instructions diff --git a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs index cee7a4ed8..0fd188f2a 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdArithmetic.cs @@ -11,11 +11,10 @@ using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { public static void Abs_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs index 8fcb06286..64e4078c8 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp.cs @@ -2,15 +2,13 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; -using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { public static void Cmeq_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs index 6ec2b58f9..3068519f3 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs @@ -2,17 +2,15 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.State; using ARMeilleure.Translation; -using System; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper32; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit32 { public static void Vceq_V(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs index cf427eeae..a9787224e 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdCvt.cs @@ -8,11 +8,10 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - static partial class InstEmit { public static void Fcvt_S(ArmEmitterContext context) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs index 11d0c93b4..e44e174fe 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper.cs @@ -8,13 +8,12 @@ using System.Diagnostics; using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper { #region "Masks" diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs index c053fe27b..7b9b0c1b7 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32.cs @@ -7,13 +7,12 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper32 { public static (int, int) GetQuadwordAndSubindex(int index, RegisterSize size) diff --git a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs index a1ca417b4..bfd3064a0 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdHelper32Arm64.cs @@ -7,13 +7,12 @@ using System.Diagnostics; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func1I = System.Func; +using Func2I = System.Func; +using Func3I = System.Func; namespace ARMeilleure.Instructions { - using Func1I = Func; - using Func2I = Func; - using Func3I = Func; - static class InstEmitSimdHelper32Arm64 { // Intrinsic Helpers diff --git a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs index dedf0fa05..5409e6879 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdMemory.cs @@ -40,34 +40,36 @@ namespace ARMeilleure.Instructions long offset = 0; -#pragma warning disable IDE0055 // Disable formatting - for (int rep = 0; rep < op.Reps; rep++) - for (int elem = 0; elem < op.Elems; elem++) - for (int sElem = 0; sElem < op.SElems; sElem++) + for (int rep = 0; rep < op.Reps; rep++) { - int rtt = (op.Rt + rep + sElem) & 0x1f; - - Operand tt = GetVec(rtt); - - Operand address = context.Add(n, Const(offset)); - - if (isLoad) + for (int elem = 0; elem < op.Elems; elem++) { - EmitLoadSimd(context, address, tt, rtt, elem, op.Size); - - if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) + for (int sElem = 0; sElem < op.SElems; sElem++) { - context.Copy(tt, context.VectorZeroUpper64(tt)); + int rtt = (op.Rt + rep + sElem) & 0x1f; + + Operand tt = GetVec(rtt); + + Operand address = context.Add(n, Const(offset)); + + if (isLoad) + { + EmitLoadSimd(context, address, tt, rtt, elem, op.Size); + + if (op.RegisterSize == RegisterSize.Simd64 && elem == op.Elems - 1) + { + context.Copy(tt, context.VectorZeroUpper64(tt)); + } + } + else + { + EmitStoreSimd(context, address, rtt, elem, op.Size); + } + + offset += 1 << op.Size; } } - else - { - EmitStoreSimd(context, address, rtt, elem, op.Size); - } - - offset += 1 << op.Size; } -#pragma warning restore IDE0055 if (op.WBack) { diff --git a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs index 3469434c0..39dadf13d 100644 --- a/src/ARMeilleure/Instructions/InstEmitSimdShift.cs +++ b/src/ARMeilleure/Instructions/InstEmitSimdShift.cs @@ -9,11 +9,10 @@ using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; using static ARMeilleure.IntermediateRepresentation.Operand.Factory; +using Func2I = System.Func; namespace ARMeilleure.Instructions { - using Func2I = Func; - static partial class InstEmit { #region "Masks" diff --git a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs index 9d87c13b3..31dc97bd6 100644 --- a/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs +++ b/src/ARMeilleure/IntermediateRepresentation/Intrinsic.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace ARMeilleure.IntermediateRepresentation { diff --git a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs index d22c89a75..69c56a98c 100644 --- a/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs +++ b/src/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs @@ -7,10 +7,9 @@ namespace ARMeilleure.IntermediateRepresentation { private struct Data { -#pragma warning disable CS0649 // Field is never assigned to public byte Kind; public byte Type; -#pragma warning restore CS0649 + public byte Scale; public Operand BaseAddress; public Operand Index; diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs index 18390de31..297ee040c 100644 --- a/src/ARMeilleure/Optimizations.cs +++ b/src/ARMeilleure/Optimizations.cs @@ -1,8 +1,8 @@ +using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; +using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; + namespace ARMeilleure { - using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; - using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; - public static class Optimizations { // low-core count PPTC diff --git a/src/ARMeilleure/Translation/ArmEmitterContext.cs b/src/ARMeilleure/Translation/ArmEmitterContext.cs index 196120e92..0d6e65d8b 100644 --- a/src/ARMeilleure/Translation/ArmEmitterContext.cs +++ b/src/ARMeilleure/Translation/ArmEmitterContext.cs @@ -218,18 +218,28 @@ namespace ARMeilleure.Translation { switch (condition) { -#pragma warning disable IDE0055 // Disable formatting - case Condition.Eq: return ICompareEqual (n, m); - case Condition.Ne: return ICompareNotEqual (n, m); - case Condition.GeUn: return ICompareGreaterOrEqualUI(n, m); - case Condition.LtUn: return ICompareLessUI (n, m); - case Condition.GtUn: return ICompareGreaterUI (n, m); - case Condition.LeUn: return ICompareLessOrEqualUI (n, m); - case Condition.Ge: return ICompareGreaterOrEqual (n, m); - case Condition.Lt: return ICompareLess (n, m); - case Condition.Gt: return ICompareGreater (n, m); - case Condition.Le: return ICompareLessOrEqual (n, m); -#pragma warning restore IDE0055 + + case Condition.Eq: + return ICompareEqual(n, m); + case Condition.Ne: + return ICompareNotEqual(n, m); + case Condition.GeUn: + return ICompareGreaterOrEqualUI(n, m); + case Condition.LtUn: + return ICompareLessUI(n, m); + case Condition.GtUn: + return ICompareGreaterUI(n, m); + case Condition.LeUn: + return ICompareLessOrEqualUI(n, m); + case Condition.Ge: + return ICompareGreaterOrEqual(n, m); + case Condition.Lt: + return ICompareLess(n, m); + case Condition.Gt: + return ICompareGreater(n, m); + case Condition.Le: + return ICompareLessOrEqual(n, m); + } } else if (cmpName == InstName.Adds && _optOpLastCompare is IOpCodeAluImm op) @@ -254,14 +264,20 @@ namespace ARMeilleure.Translation switch (condition) { -#pragma warning disable IDE0055 // Disable formatting - case Condition.Eq: return ICompareEqual (n, m); - case Condition.Ne: return ICompareNotEqual (n, m); - case Condition.Ge: return ICompareGreaterOrEqual(n, m); - case Condition.Lt: return ICompareLess (n, m); - case Condition.Gt: return ICompareGreater (n, m); - case Condition.Le: return ICompareLessOrEqual (n, m); -#pragma warning restore IDE0055 + + case Condition.Eq: + return ICompareEqual(n, m); + case Condition.Ne: + return ICompareNotEqual(n, m); + case Condition.Ge: + return ICompareGreaterOrEqual(n, m); + case Condition.Lt: + return ICompareLess(n, m); + case Condition.Gt: + return ICompareGreater(n, m); + case Condition.Le: + return ICompareLessOrEqual(n, m); + } } diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index f36d4256d..a9f077dd9 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -22,12 +22,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using static ARMeilleure.Translation.PTC.PtcFormatter; +using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; +using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; namespace ARMeilleure.Translation.PTC { - using Arm64HardwareCapabilities = CodeGen.Arm64.HardwareCapabilities; - using X86HardwareCapabilities = CodeGen.X86.HardwareCapabilities; - class Ptc : IPtcLoadState { private const string OuterHeaderMagicString = "PTCohd\0\0"; diff --git a/src/ARMeilleure/Translation/RegisterUsage.cs b/src/ARMeilleure/Translation/RegisterUsage.cs index 03d4a96e7..e2489b6a9 100644 --- a/src/ARMeilleure/Translation/RegisterUsage.cs +++ b/src/ARMeilleure/Translation/RegisterUsage.cs @@ -297,12 +297,20 @@ namespace ARMeilleure.Translation switch (register.Type) { -#pragma warning disable IDE0055 // Disable formatting - case RegisterType.Flag: intMask = (1L << RegsCount) << register.Index; break; - case RegisterType.Integer: intMask = 1L << register.Index; break; - case RegisterType.FpFlag: vecMask = (1L << RegsCount) << register.Index; break; - case RegisterType.Vector: vecMask = 1L << register.Index; break; -#pragma warning restore IDE0055 + + case RegisterType.Flag: + intMask = (1L << RegsCount) << register.Index; + break; + case RegisterType.Integer: + intMask = 1L << register.Index; + break; + case RegisterType.FpFlag: + vecMask = (1L << RegsCount) << register.Index; + break; + case RegisterType.Vector: + vecMask = 1L << register.Index; + break; + } return new RegisterMask(intMask, vecMask); diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs index d5381209e..f7e1d27b8 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs @@ -12,7 +12,7 @@ using static SDL2.SDL; namespace Ryujinx.Audio.Backends.SDL2 { - public class SDL2HardwareDeviceDriver : IHardwareDeviceDriver + public partial class SDL2HardwareDeviceDriver : IHardwareDeviceDriver { private readonly ManualResetEvent _updateRequiredEvent; private readonly ManualResetEvent _pauseEvent; @@ -22,10 +22,36 @@ namespace Ryujinx.Audio.Backends.SDL2 public float Volume { get; set; } - // TODO: Add this to SDL2-CS - // NOTE: We use a DllImport here because of marshaling issue for spec. - [DllImport("SDL2")] - private static extern int SDL_GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture); + // A safe method to get default audio information. + private static int GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture) + { + int result; + spec = new SDL_AudioSpec(); + IntPtr specPtr = IntPtr.Zero; + + try + { + // Reserve memory + specPtr = Marshal.AllocHGlobal(Marshal.SizeOf()); + // Call method + result = SDL_GetDefaultAudioInfo(name, specPtr, isCapture); + // Copy result to managed structure + spec = Marshal.PtrToStructure(specPtr); + } + finally + { + // Free the unmanaged memory to prevent memory leaks + if (specPtr != IntPtr.Zero) + { + Marshal.FreeHGlobal(specPtr); + } + } + + return result; + } + + [LibraryImport("SDL2")] + private static partial int SDL_GetDefaultAudioInfo(nint name, nint spec, int isCapture); public SDL2HardwareDeviceDriver() { @@ -35,7 +61,7 @@ namespace Ryujinx.Audio.Backends.SDL2 SDL2Driver.Instance.Initialize(); - int res = SDL_GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); + int res = GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0); if (res != 0) { diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs index 6a12e8c0c..62f6b14bc 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs +++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIo.cs @@ -23,7 +23,7 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void JackCallbackDelegate(nint msg); - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct SoundIoStruct { public nint UserData; diff --git a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs index 98b224ebf..b756f9d70 100644 --- a/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs +++ b/src/Ryujinx.Audio/Renderer/Common/UpdateDataHeader.cs @@ -20,9 +20,7 @@ namespace Ryujinx.Audio.Renderer.Common public uint Unknown24; public uint RenderInfoSize; -#pragma warning disable IDE0051, CS0169 // Remove unused field private Array4 _reserved; -#pragma warning restore IDE0051, CS0169 public uint TotalSize; diff --git a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs index 1a5802a37..38429092f 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/AdpcmHelper.cs @@ -12,9 +12,8 @@ namespace Ryujinx.Audio.Renderer.Dsp private const int SamplesPerFrame = 14; private const int NibblesPerFrame = SamplesPerFrame + 2; private const int BytesPerFrame = 8; -#pragma warning disable IDE0051 // Remove unused private member + private const int BitsPerFrame = BytesPerFrame * 8; -#pragma warning restore IDE0051 [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint GetAdpcmDataSize(int sampleCount) diff --git a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs index ee2f23479..c6f126c65 100644 --- a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs +++ b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs @@ -41,10 +41,10 @@ namespace Ryujinx.Audio.Renderer.Server private UpsamplerManager _upsamplerManager; private bool _isActive; private BehaviourContext _behaviourContext; -#pragma warning disable IDE0052 // Remove unread private member + private ulong _totalElapsedTicksUpdating; private ulong _totalElapsedTicks; -#pragma warning restore IDE0052 + private int _sessionId; private Memory _memoryPools; diff --git a/src/Ryujinx.Common/Collections/TreeDictionary.cs b/src/Ryujinx.Common/Collections/TreeDictionary.cs index af104d268..f194a9f93 100644 --- a/src/Ryujinx.Common/Collections/TreeDictionary.cs +++ b/src/Ryujinx.Common/Collections/TreeDictionary.cs @@ -147,9 +147,9 @@ namespace Ryujinx.Common.Collections Queue> nodes = new(); - if (this.Root != null) + if (Root != null) { - nodes.Enqueue(this.Root); + nodes.Enqueue(Root); } while (nodes.TryDequeue(out Node node)) @@ -522,7 +522,7 @@ namespace Ryujinx.Common.Collections public void CopyTo(KeyValuePair[] array, int arrayIndex) { - if (arrayIndex < 0 || array.Length - arrayIndex < this.Count) + if (arrayIndex < 0 || array.Length - arrayIndex < Count) { throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs index f3a9e1646..bae6e35de 100644 --- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs +++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs @@ -36,8 +36,6 @@ namespace Ryujinx.Common.Configuration }; } - - public static float ToFloatY(this AspectRatio aspectRatio) { return aspectRatio switch diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs index ae3416a27..d0565c88a 100644 --- a/src/Ryujinx.Common/Configuration/DirtyHack.cs +++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs @@ -18,8 +18,6 @@ namespace Ryujinx.Common.Configuration public DirtyHack Hack => hack; public int Value => value; - - public ulong Pack() => Raw.PackBitFields(PackedFormat); public static EnabledDirtyHack Unpack(ulong packedHack) diff --git a/src/Ryujinx.Common/Hash128.cs b/src/Ryujinx.Common/Hash128.cs index e95a15caa..f57bb6c84 100644 --- a/src/Ryujinx.Common/Hash128.cs +++ b/src/Ryujinx.Common/Hash128.cs @@ -10,7 +10,7 @@ using System.Runtime.Intrinsics.X86; namespace Ryujinx.Common { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Hash128(ulong low, ulong high) : IEquatable { public ulong Low = low; diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs index e6f68599a..add5ad22f 100644 --- a/src/Ryujinx.Common/Logging/Logger.cs +++ b/src/Ryujinx.Common/Logging/Logger.cs @@ -219,16 +219,34 @@ namespace Ryujinx.Common.Logging switch (logLevel) { #pragma warning disable IDE0055 // Disable formatting - case LogLevel.Debug : Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); break; - case LogLevel.Info : Info = enabled ? new Log(LogLevel.Info) : new Log?(); break; - case LogLevel.Warning : Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); break; - case LogLevel.Error : Error = enabled ? new Log(LogLevel.Error) : new Log?(); break; - case LogLevel.Guest : Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); break; - case LogLevel.AccessLog : AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); break; - case LogLevel.Stub : Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); break; - case LogLevel.Trace : Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); break; - case LogLevel.Notice : break; - default: throw new ArgumentException("Unknown Log Level", nameof(logLevel)); + case LogLevel.Debug: + Debug = enabled ? new Log(LogLevel.Debug) : new Log?(); + break; + case LogLevel.Info: + Info = enabled ? new Log(LogLevel.Info) : new Log?(); + break; + case LogLevel.Warning: + Warning = enabled ? new Log(LogLevel.Warning) : new Log?(); + break; + case LogLevel.Error: + Error = enabled ? new Log(LogLevel.Error) : new Log?(); + break; + case LogLevel.Guest: + Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); + break; + case LogLevel.AccessLog: + AccessLog = enabled ? new Log(LogLevel.AccessLog) : new Log?(); + break; + case LogLevel.Stub: + Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); + break; + case LogLevel.Trace: + Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); + break; + case LogLevel.Notice: + break; + default: + throw new ArgumentException("Unknown Log Level", nameof(logLevel)); #pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index fcb2229a7..6d3435755 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -2,9 +2,9 @@ using System; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; -#pragma warning disable CS0169, IDE0051 // Remove unused private member namespace Ryujinx.Common.Memory { + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array1 : IArray where T : unmanaged { T _e0; @@ -15,6 +15,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array2 : IArray where T : unmanaged { T _e0; @@ -26,6 +27,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array3 : IArray where T : unmanaged { T _e0; @@ -37,6 +39,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array4 : IArray where T : unmanaged { T _e0; @@ -48,6 +51,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array5 : IArray where T : unmanaged { T _e0; @@ -59,6 +63,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array6 : IArray where T : unmanaged { T _e0; @@ -70,6 +75,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array7 : IArray where T : unmanaged { T _e0; @@ -81,6 +87,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array8 : IArray where T : unmanaged { T _e0; @@ -92,6 +99,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array9 : IArray where T : unmanaged { T _e0; @@ -103,6 +111,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array10 : IArray where T : unmanaged { T _e0; @@ -114,6 +123,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array11 : IArray where T : unmanaged { T _e0; @@ -125,6 +135,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array12 : IArray where T : unmanaged { T _e0; @@ -136,6 +147,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array13 : IArray where T : unmanaged { T _e0; @@ -147,6 +159,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array14 : IArray where T : unmanaged { T _e0; @@ -158,6 +171,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array15 : IArray where T : unmanaged { T _e0; @@ -169,6 +183,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array16 : IArray where T : unmanaged { T _e0; @@ -180,6 +195,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array17 : IArray where T : unmanaged { T _e0; @@ -191,6 +207,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array18 : IArray where T : unmanaged { T _e0; @@ -202,6 +219,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array19 : IArray where T : unmanaged { T _e0; @@ -213,6 +231,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array20 : IArray where T : unmanaged { T _e0; @@ -224,6 +243,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array21 : IArray where T : unmanaged { T _e0; @@ -235,6 +255,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array22 : IArray where T : unmanaged { T _e0; @@ -246,6 +267,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array23 : IArray where T : unmanaged { T _e0; @@ -257,6 +279,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array24 : IArray where T : unmanaged { T _e0; @@ -269,6 +292,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array25 : IArray where T : unmanaged { T _e0; @@ -281,6 +305,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array26 : IArray where T : unmanaged { T _e0; @@ -293,6 +318,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array27 : IArray where T : unmanaged { T _e0; @@ -305,6 +331,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array28 : IArray where T : unmanaged { T _e0; @@ -317,6 +344,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array29 : IArray where T : unmanaged { T _e0; @@ -329,6 +357,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array30 : IArray where T : unmanaged { T _e0; @@ -341,6 +370,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array31 : IArray where T : unmanaged { T _e0; @@ -353,6 +383,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array32 : IArray where T : unmanaged { T _e0; @@ -365,6 +396,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array33 : IArray where T : unmanaged { T _e0; @@ -377,6 +409,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array34 : IArray where T : unmanaged { T _e0; @@ -389,6 +422,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array35 : IArray where T : unmanaged { T _e0; @@ -401,6 +435,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array36 : IArray where T : unmanaged { T _e0; @@ -413,6 +448,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array37 : IArray where T : unmanaged { T _e0; @@ -425,6 +461,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array38 : IArray where T : unmanaged { T _e0; @@ -437,6 +474,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array39 : IArray where T : unmanaged { T _e0; @@ -449,6 +487,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array40 : IArray where T : unmanaged { T _e0; @@ -461,6 +500,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array41 : IArray where T : unmanaged { T _e0; @@ -473,6 +513,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array42 : IArray where T : unmanaged { T _e0; @@ -485,6 +526,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array43 : IArray where T : unmanaged { T _e0; @@ -497,6 +539,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array44 : IArray where T : unmanaged { T _e0; @@ -509,6 +552,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array45 : IArray where T : unmanaged { T _e0; @@ -521,6 +565,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array46 : IArray where T : unmanaged { T _e0; @@ -533,6 +578,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array47 : IArray where T : unmanaged { T _e0; @@ -545,6 +591,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array48 : IArray where T : unmanaged { T _e0; @@ -557,6 +604,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array49 : IArray where T : unmanaged { T _e0; @@ -569,6 +617,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array50 : IArray where T : unmanaged { T _e0; @@ -581,6 +630,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array51 : IArray where T : unmanaged { T _e0; @@ -593,6 +643,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array52 : IArray where T : unmanaged { T _e0; @@ -605,6 +656,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array53 : IArray where T : unmanaged { T _e0; @@ -617,6 +669,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array54 : IArray where T : unmanaged { T _e0; @@ -629,6 +682,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array55 : IArray where T : unmanaged { T _e0; @@ -641,6 +695,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array56 : IArray where T : unmanaged { T _e0; @@ -653,6 +708,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array57 : IArray where T : unmanaged { T _e0; @@ -665,6 +721,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array58 : IArray where T : unmanaged { T _e0; @@ -677,6 +734,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array59 : IArray where T : unmanaged { T _e0; @@ -689,6 +747,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array60 : IArray where T : unmanaged { T _e0; @@ -700,6 +759,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array61 : IArray where T : unmanaged { T _e0; @@ -711,6 +771,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array62 : IArray where T : unmanaged { T _e0; @@ -722,6 +783,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array63 : IArray where T : unmanaged { T _e0; @@ -733,6 +795,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array64 : IArray where T : unmanaged { T _e0; @@ -744,6 +807,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array65 : IArray where T : unmanaged { T _e0; @@ -755,6 +819,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array73 : IArray where T : unmanaged { T _e0; @@ -767,6 +832,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array96 : IArray where T : unmanaged { T _e0; @@ -779,6 +845,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array127 : IArray where T : unmanaged { T _e0; @@ -791,6 +858,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array128 : IArray where T : unmanaged { T _e0; @@ -803,6 +871,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array140 : IArray where T : unmanaged { T _e0; @@ -816,6 +885,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array256 : IArray where T : unmanaged { T _e0; @@ -828,6 +898,7 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Array384 : IArray where T : unmanaged { T _e0; @@ -844,4 +915,4 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } } -#pragma warning restore CS0169, IDE0051 + diff --git a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs index 67f067ae2..2a56706d7 100644 --- a/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs +++ b/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs @@ -94,7 +94,7 @@ namespace Ryujinx.Common.PreciseSleep Bias = GetBias(0); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct Timespec { public long tv_sec; // Seconds diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index a5beb1009..3f30ba086 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,10 +1,5 @@ -using Ryujinx.Common.Utilities; using System; -using System.Net.Http; -using System.Net.Http.Json; using System.Reflection; -using System.Text.Json.Serialization; -using System.Threading.Tasks; namespace Ryujinx.Common { @@ -37,6 +32,4 @@ namespace Ryujinx.Common ? $"https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-{currentVersion}...Canary-{newVersion}" : $"https://git.ryujinx.app/ryubing/ryujinx/-/releases/{newVersion}"; } - - } diff --git a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs index c00598c98..0b78aa14d 100644 --- a/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs +++ b/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs @@ -28,12 +28,10 @@ namespace Ryujinx.Common.SystemInterop { public int GdiplusVersion; -#pragma warning disable CS0649 // Field is never assigned to public nint DebugEventCallback; public int SuppressBackgroundThread; public int SuppressExternalCodecs; public int StartupParameters; -#pragma warning restore CS0649 public static StartupInputEx Default => new() { diff --git a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs index 0fbce37e2..1f0c47624 100644 --- a/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs +++ b/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Common.SystemInterop [SupportedOSPlatform("windows")] public partial class WindowsMultimediaTimerResolution : IDisposable { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct TimeCaps { public uint wPeriodMin; diff --git a/src/Ryujinx.Common/Utilities/Buffers.cs b/src/Ryujinx.Common/Utilities/Buffers.cs index b66f6025e..775d96790 100644 --- a/src/Ryujinx.Common/Utilities/Buffers.cs +++ b/src/Ryujinx.Common/Utilities/Buffers.cs @@ -9,8 +9,8 @@ namespace Ryujinx.Common.Utilities [StructLayout(LayoutKind.Sequential, Size = 16)] public struct Buffer16 { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy0; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ulong _dummy1; + public ulong Low { get; set; } + public ulong High { get; set; } public byte this[int i] { diff --git a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs index fa04ee347..60b46697b 100644 --- a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs +++ b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs @@ -241,7 +241,7 @@ namespace Ryujinx.Common.Utilities public IndentedStringBuilder Append(object value) { - this.Append(value.ToString()); + Append(value.ToString()); return this; } @@ -271,7 +271,7 @@ namespace Ryujinx.Common.Utilities { _builder.Append(value); - this.AppendLine(); + AppendLine(); return this; } diff --git a/src/Ryujinx.Common/Utilities/Rainbow.cs b/src/Ryujinx.Common/Utilities/Rainbow.cs index 93129bf10..57177c76d 100644 --- a/src/Ryujinx.Common/Utilities/Rainbow.cs +++ b/src/Ryujinx.Common/Utilities/Rainbow.cs @@ -32,7 +32,6 @@ namespace Ryujinx.Common.Utilities CyclingEnabled = false; } - public static float Speed { get; set; } = 1; private static readonly Lock _lock = new(); diff --git a/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs deleted file mode 100644 index 8e775f094..000000000 --- a/src/Ryujinx.Cpu/AppleHv/DummyDiskCacheLoadState.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Ryujinx.Cpu.AppleHv -{ - public class DummyDiskCacheLoadState : IDiskCacheLoadState - { -#pragma warning disable CS0067 // The event is never used - /// - public event Action StateChanged; -#pragma warning restore CS0067 - - /// - public void Cancel() - { - } - } -} diff --git a/src/Ryujinx.Cpu/AppleHv/HvApi.cs b/src/Ryujinx.Cpu/AppleHv/HvApi.cs index 864f6b063..80662acc2 100644 --- a/src/Ryujinx.Cpu/AppleHv/HvApi.cs +++ b/src/Ryujinx.Cpu/AppleHv/HvApi.cs @@ -6,11 +6,11 @@ namespace Ryujinx.Cpu.AppleHv { struct HvVcpuExitException { -#pragma warning disable CS0649 // Field is never assigned to + public ulong Syndrome; public ulong VirtualAddress; public ulong PhysicalAddress; -#pragma warning restore CS0649 + } enum HvExitReason : uint @@ -23,10 +23,10 @@ namespace Ryujinx.Cpu.AppleHv struct HvVcpuExit { -#pragma warning disable CS0649 // Field is never assigned to + public HvExitReason Reason; public HvVcpuExitException Exception; -#pragma warning restore CS0649 + } enum HvReg : uint diff --git a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs index d050bddeb..d1cccf387 100644 --- a/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs +++ b/src/Ryujinx.Cpu/DummyDiskCacheLoadState.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Cpu { public class DummyDiskCacheLoadState : IDiskCacheLoadState { -#pragma warning disable CS0067 // The event is never used /// public event Action StateChanged; -#pragma warning restore CS0067 + + public DummyDiskCacheLoadState() => StateChanged?.Invoke(LoadState.Unloaded, 0, 0); /// public void Cancel() diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index 3aa616a8d..c50fedf61 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,7 +15,6 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); - public long TickScalar { get; set; } private static long _acumElapsedTicks; diff --git a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 27a2ac896..3a7448c25 100644 --- a/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/src/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.GAL public override bool Equals(object obj) { - return obj is TextureCreateInfo info && this.Equals(info); + return obj is TextureCreateInfo info && Equals(info); } public static bool operator ==(TextureCreateInfo left, TextureCreateInfo right) diff --git a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs index 69de93ad5..79fed54e7 100644 --- a/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs +++ b/src/Ryujinx.Graphics.GAL/ViewportSwizzle.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.Graphics.GAL { public enum ViewportSwizzle diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs index 18f79cc3a..9e491d3dc 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClassState.cs @@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute /// unsafe struct ComputeClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -430,6 +430,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute public readonly int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF); public fixed uint Reserved33E8[6]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs index f258c0070..66e116c8e 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClassState.cs @@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// unsafe struct DmaClassState { -#pragma warning disable CS0649 // Field is never assigned to + public fixed uint Reserved00[64]; public uint Nop; public fixed uint Reserved104[15]; @@ -266,6 +266,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public fixed uint Reserved740[629]; public uint PmTriggerEnd; public fixed uint Reserved1118[2490]; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs index 368158718..cbd31b0ea 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma /// struct DmaTexture { -#pragma warning disable CS0649 // Field is never assigned to + public MemoryLayout MemoryLayout; public int Width; public int Height; @@ -15,6 +15,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma public int RegionZ; public ushort RegionX; public ushort RegionY; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs index 21eb5bfa9..0f2da508e 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/CompressedMethod.cs @@ -25,9 +25,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct CompressedMethod { -#pragma warning disable CS0649 // Field is never assigned to + public uint Method; -#pragma warning restore CS0649 + public readonly int MethodAddressOld => (int)((Method >> 2) & 0x7FF); public readonly int MethodAddress => (int)(Method & 0xFFF); public readonly int SubdeviceMask => (int)((Method >> 4) & 0xFFF); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs index d28f2fbb5..7224a3643 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPEntry.cs @@ -36,15 +36,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo struct GPEntry { -#pragma warning disable CS0649 // Field is never assigned to + public uint Entry0; -#pragma warning restore CS0649 + public readonly Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1); public readonly int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF); public readonly int Entry0Operand => (int)(Entry0); -#pragma warning disable CS0649 // Field is never assigned to + public uint Entry1; -#pragma warning restore CS0649 + public readonly int Entry1GetHi => (int)(Entry1 & 0xFF); public readonly Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1); public readonly Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs index 56bebc336..71fe800ea 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs @@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo /// struct GPFifoClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectNvclass => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngine => (int)((SetObject >> 16) & 0x1F); @@ -228,6 +228,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo public uint LoadMmeStartAddressRamPointer; public uint LoadMmeStartAddressRam; public uint SetMmeShadowRamControl; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs index 1aff0441f..94ccbeae9 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClassState.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory /// unsafe struct InlineToMemoryClassState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -178,6 +178,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory public uint SetI2mSpareNoop03; public fixed uint Reserved200[3200]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs index f62a4c01a..2b30b7c92 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs @@ -469,12 +469,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME for (int i = 0; i < maxDrawCount; i++) { FifoWord count = FetchParam(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - FifoWord instanceCount = FetchParam(); + + _ = FetchParam(); // Instance count FifoWord firstIndex = FetchParam(); - FifoWord firstVertex = FetchParam(); - FifoWord firstInstance = FetchParam(); -#pragma warning restore IDE0059 + _ = FetchParam(); // First vertex + _ = FetchParam(); // First instance if (i == 0) { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs index b4346add1..ce1d4e78d 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs @@ -9,9 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine [StructLayout(LayoutKind.Sequential, Size = 1024)] struct MmeShadowScratch { -#pragma warning disable CS0169 // The private field is never used private uint _e0; -#pragma warning restore CS0169 public ref uint this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 256); } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs index 739d32237..8a59c84e6 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IbStreamer.cs @@ -16,9 +16,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed private int _inlineIndexBufferSize; private int _inlineIndexCount; private uint[] _buffer; -#pragma warning disable IDE0051 // Remove unused private member + private readonly int _bufferOffset; -#pragma warning restore IDE0051 /// /// Indicates if any index buffer data has been pushed. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs index 402e3ff80..5260c9233 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.Graphics.Gpu.Engine.Threed { /// diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs index 35051c6e0..c9c14772a 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs @@ -26,9 +26,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TessMode { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 /// /// Unpacks the tessellation abstract patch type. @@ -63,7 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public GpuVa Address; public int Size; @@ -71,7 +70,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Padding0; public uint Padding1; public uint Padding2; -#pragma warning restore CS0649 + } /// @@ -79,12 +78,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct TfState { -#pragma warning disable CS0649 // Field is never assigned to + public int BufferIndex; public int VaryingsCount; public int Stride; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -92,7 +91,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtColorState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public int WidthOrStride; public int Height; @@ -108,7 +107,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int Padding3; public int Padding4; public int Padding5; -#pragma warning restore CS0649 + } /// @@ -116,7 +115,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportTransform { -#pragma warning disable CS0649 // Field is never assigned to + public float ScaleX; public float ScaleY; public float ScaleZ; @@ -125,7 +124,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public float TranslateZ; public uint Swizzle; public uint SubpixelPrecisionBias; -#pragma warning restore CS0649 /// /// Unpacks viewport swizzle of the position X component. @@ -169,14 +167,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ViewportExtents { -#pragma warning disable CS0649 // Field is never assigned to + public ushort X; public ushort Width; public ushort Y; public ushort Height; public float DepthNear; public float DepthFar; -#pragma warning restore CS0649 + } /// @@ -184,10 +182,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferDrawState { -#pragma warning disable CS0649 // Field is never assigned to + public int First; public int Count; -#pragma warning restore CS0649 + } /// @@ -195,12 +193,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ClearColors { -#pragma warning disable CS0649 // Field is never assigned to + public float Red; public float Green; public float Blue; public float Alpha; -#pragma warning restore CS0649 + } /// @@ -208,11 +206,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct DepthBiasState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 PointEnable; public Boolean32 LineEnable; public Boolean32 FillEnable; -#pragma warning restore CS0649 + } /// @@ -231,14 +229,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScissorState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public ushort X1; public ushort X2; public ushort Y1; public ushort Y2; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -246,11 +244,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackMasks { -#pragma warning disable CS0649 // Field is never assigned to + public int FuncRef; public int Mask; public int FuncMask; -#pragma warning restore CS0649 + } /// @@ -258,12 +256,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtDepthStencilState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public ZetaFormat Format; public MemoryLayout MemoryLayout; public int LayerSize; -#pragma warning restore CS0649 + } /// @@ -271,12 +269,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ScreenScissorState { -#pragma warning disable CS0649 // Field is never assigned to + public ushort X; public ushort Width; public ushort Y; public ushort Height; -#pragma warning restore CS0649 + } /// @@ -319,9 +317,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexAttribState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Attribute; -#pragma warning restore CS0649 /// /// Unpacks the index of the vertex buffer this attribute belongs to. @@ -383,9 +380,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RtControl { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 /// /// Unpacks the number of active draw buffers. @@ -412,7 +408,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct Size3D { -#pragma warning disable CS0649 // Field is never assigned to + public int Width; public int Height; public ushort Depth; @@ -422,7 +418,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { return (Flags & 1) == 0; } -#pragma warning restore CS0649 } /// @@ -430,7 +425,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilTestState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public StencilOp FrontSFail; public StencilOp FrontDpFail; @@ -439,7 +434,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public int FrontFuncRef; public int FrontFuncMask; public int FrontMask; -#pragma warning restore CS0649 + } /// @@ -457,12 +452,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct RgbHalf { -#pragma warning disable CS0649 // Field is never assigned to + public uint R; public uint G; public uint B; public uint Padding; -#pragma warning restore CS0649 /// /// Unpacks the red color component as a 16-bit float value. @@ -512,10 +506,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PoolState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public int MaximumId; -#pragma warning restore CS0649 + } /// @@ -523,13 +517,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct StencilBackTestState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 TwoSided; public StencilOp BackSFail; public StencilOp BackDpFail; public StencilOp BackDpPass; public CompareOp BackFunc; -#pragma warning restore CS0649 + } /// @@ -537,10 +531,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct PrimitiveRestartState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public int Index; -#pragma warning restore CS0649 + } /// @@ -549,12 +543,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct IndexBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public GpuVa Address; public GpuVa EndAddress; public IndexType Type; public int First; -#pragma warning restore CS0649 + } /// @@ -562,11 +556,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct FaceState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 CullEnable; public FrontFace FrontFace; public Face CullFace; -#pragma warning restore CS0649 + } /// @@ -584,10 +578,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct LogicalOpState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 Enable; public LogicalOp LogicalOp; -#pragma warning restore CS0649 + } /// @@ -645,11 +639,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct VertexBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Control; public GpuVa Address; public int Divisor; -#pragma warning restore CS0649 /// /// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory. @@ -675,7 +668,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendStateCommon { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -684,7 +677,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public uint Unknown0x1354; public BlendFactor AlphaDstFactor; -#pragma warning restore CS0649 + } /// @@ -692,7 +685,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct BlendState { -#pragma warning disable CS0649 // Field is never assigned to + public Boolean32 SeparateAlpha; public BlendOp ColorOp; public BlendFactor ColorSrcFactor; @@ -701,7 +694,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public BlendFactor AlphaSrcFactor; public BlendFactor AlphaDstFactor; public uint Padding; -#pragma warning restore CS0649 + } /// @@ -709,7 +702,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct ShaderState { -#pragma warning disable CS0649 // Field is never assigned to + public uint Control; public uint Offset; public uint Unknown0x8; @@ -726,7 +719,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public uint Unknown0x34; public uint Unknown0x38; public uint Unknown0x3c; -#pragma warning restore CS0649 /// /// Unpacks shader enable information. @@ -744,16 +736,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// struct UniformBufferState { -#pragma warning disable CS0649 // Field is never assigned to + public int Size; public GpuVa Address; public int Offset; -#pragma warning restore CS0649 + } unsafe struct ThreedClassState : IShadowState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -1052,6 +1044,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed public Array4> TfVaryingLocations; public fixed uint Reserved2A00[640]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs index 2ea4709ec..2189e9d3f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClassState.cs @@ -486,10 +486,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct RenderSolidPrimPoint { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetX; public uint Y; -#pragma warning restore CS0649 + } /// @@ -497,7 +497,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// unsafe struct TwodClassState : IShadowState { -#pragma warning disable CS0649 // Field is never assigned to + public uint SetObject; public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF); public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F); @@ -811,6 +811,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public readonly bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0; public fixed uint ReservedDF0[2436]; public Array256 SetMmeShadowScratch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs index 8e8afb41c..897fb5a3f 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodTexture.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod /// struct TwodTexture { -#pragma warning disable CS0649 // Field is never assigned to + public ColorFormat Format; public Boolean32 LinearLayout; public MemoryLayout MemoryLayout; @@ -17,6 +17,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod public int Width; public int Height; public GpuVa Address; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs index 404599908..1ea612bc7 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/GpuVa.cs @@ -5,10 +5,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct GpuVa { -#pragma warning disable CS0649 // Field is never assigned to + public uint High; public uint Low; -#pragma warning restore CS0649 /// /// Packs the split address into a 64-bits address value. diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs index 9af5e6103..d243227e7 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/MemoryLayout.cs @@ -5,9 +5,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct MemoryLayout { -#pragma warning disable CS0649 // Field is never assigned to + public uint Packed; -#pragma warning restore CS0649 public readonly int UnpackGobBlocksInX() { diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs index e1cc8c01d..f90eca1ef 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Types/SbDescriptor.cs @@ -5,12 +5,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types /// struct SbDescriptor { -#pragma warning disable CS0649 // Field is never assigned to + public uint AddressLow; public uint AddressHigh; public int Size; public int Padding; -#pragma warning restore CS0649 public readonly ulong PackAddress() { diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs index d0b8277da..979ae226a 100644 --- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -98,7 +98,6 @@ namespace Ryujinx.Graphics.Gpu /// internal DirtyHacks DirtyHacks { get; } - /// /// Host hardware capabilities. /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs index ee217714c..66f4d4de1 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs @@ -1,6 +1,5 @@ using Ryujinx.Graphics.GAL; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Gpu.Image { @@ -555,7 +554,6 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Uscaled, Format.R10G10B10A2Uscaled }, { VertexAttributeFormat.A2B10G10R10Sscaled, Format.R10G10B10A2Sscaled }, }; -#pragma warning restore IDE0055 // Note: Some of those formats have been changed and requires conversion on the shader, // as GPUs don't support them when used as buffer texture format. @@ -640,6 +638,7 @@ namespace Ryujinx.Graphics.Gpu.Image { VertexAttributeFormat.A2B10G10R10Sint, (Format.R10G10B10A2Uint, 4) }, // Sint -> Uint { VertexAttributeFormat.A2B10G10R10Uscaled, (Format.R10G10B10A2Uint, 4) }, // Uscaled -> Uint { VertexAttributeFormat.A2B10G10R10Sscaled, (Format.R10G10B10A2Sint, 4) } // Sscaled -> Sint +#pragma warning restore IDE0055 }; /// diff --git a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs index cd97d68dd..cfc07a19a 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs @@ -53,7 +53,6 @@ namespace Ryujinx.Graphics.Gpu.Image private const float Frac8ToF32 = 1.0f / 256.0f; -#pragma warning disable CS0649 // Field is never assigned to public uint Word0; public uint Word1; public uint Word2; @@ -62,7 +61,6 @@ namespace Ryujinx.Graphics.Gpu.Image public float BorderColorG; public float BorderColorB; public float BorderColorA; -#pragma warning restore CS0649 /// /// Unpacks the texture wrap mode along the X axis. diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs index c82a555ee..c6fde8d66 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureDescriptor.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// struct TextureDescriptor : ITextureDescriptor, IEquatable { -#pragma warning disable CS0649 // Field is never assigned to + public uint Word0; public uint Word1; public uint Word2; @@ -18,7 +18,6 @@ namespace Ryujinx.Graphics.Gpu.Image public uint Word5; public uint Word6; public uint Word7; -#pragma warning restore CS0649 /// /// Unpacks Maxwell texture format integer. diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs index 32d92223f..fb1725532 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderAddresses.cs @@ -9,14 +9,13 @@ namespace Ryujinx.Graphics.Gpu.Shader /// struct ShaderAddresses : IEquatable { -#pragma warning disable CS0649 // Field is never assigned to + public ulong VertexA; public ulong VertexB; public ulong TessControl; public ulong TessEvaluation; public ulong Geometry; public ulong Fragment; -#pragma warning restore CS0649 /// /// Check if the addresses are equal. diff --git a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs index 28f5d24b0..f2abaf0c4 100644 --- a/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/Host1xClassRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct Host1xClassRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public uint IncrSyncpt; public uint IncrSyncptCntrl; public uint IncrSyncptError; @@ -38,6 +38,6 @@ namespace Ryujinx.Graphics.Host1x public uint Xrefctrl; public uint ChannelXrefHi; public uint ChannelXrefLo; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs index bb7534d8a..93a35d6ca 100644 --- a/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs +++ b/src/Ryujinx.Graphics.Host1x/ThiRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Host1x { struct ThiRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public uint IncrSyncpt; public uint Reserved4; public uint IncrSyncptErr; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Host1x public Array12 Reserved48; public uint IntStatus; public uint IntMask; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs index 098622b2a..5cdeb56d4 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint Profiles; public unsafe byte* WrapperName; public nint ChLayouts; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs index 256ccd0a8..bb67291d9 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodec501.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodec501 { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe byte* Name; public unsafe byte* LongName; public int Type; @@ -18,6 +18,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public unsafe nint PrivClass; public nint Profiles; public unsafe byte* WrapperName; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs index 96c1a0f67..c7b6e4582 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVCodecContext.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVCodecContext { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe nint AvClass; public int LogLevelOffset; public int CodecType; @@ -165,6 +165,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long MaxSamples; public int ExportSideData; public nint GetEncodeBuffer; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs index 46b1e06a7..412810c47 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVFrame.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVFrame { -#pragma warning disable CS0649 // Field is never assigned to + public Array8 Data; public Array8 LineSize; public nint ExtendedData; @@ -29,7 +29,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public long ReorderedOpaque; public int SampleRate; public ulong ChannelLayout; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs index 8df4e26a7..bde283c3c 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVPacket.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct AVPacket { -#pragma warning disable CS0649 // Field is never assigned to + public unsafe AVBufferRef* Buf; public long Pts; public long Dts; @@ -19,6 +19,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public AVBufferRef Opaque; public unsafe AVBufferRef* OpaqueRef; public AVRational TimeBase; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs index 09bcc9c31..29eedfdd1 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodec.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodec where T : struct { -#pragma warning disable CS0649 // Field is never assigned to + public T Base; public int CapsInternalOrCbType; public int PrivDataSize; @@ -12,7 +12,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint InitStaticData; public nint Init; public nint CodecCallback; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs index ee0db4730..b9e345bc9 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFCodecLegacy.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native { struct FFCodecLegacy where T : struct { -#pragma warning disable CS0649 // Field is never assigned to + public T Base; public uint CapsInternalOrCbType; public int PrivDataSize; @@ -14,7 +14,6 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native public nint EncodeSub; public nint Encode2; public nint Decode; -#pragma warning restore CS0649 // NOTE: There is more after, but the layout kind of changed a bit and we don't need more than this. This is safe as we only manipulate this behind a reference. } diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs index 546213215..a565f50f8 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/LoopFilterThresh.cs @@ -6,10 +6,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types // passed it can be loaded into vector registers. internal struct LoopFilterThresh { -#pragma warning disable CS0649 // Field is never assigned to + public Array16 Mblim; public Array16 Lim; public Array16 HevThr; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs index bc325715a..77b5ccd46 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecRegisters.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public Array64 Reserved0; public uint Nop; public Array63 Reserved104; @@ -58,6 +58,6 @@ namespace Ryujinx.Graphics.Nvdec public uint Vp9SetColMvWriteBufOffset; public uint Vp9SetColMvReadBufOffset; public uint Vp9SetFilterBufferOffset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs index 1d6b4a60d..68a1a553e 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecStatus.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec { struct NvdecStatus { -#pragma warning disable CS0649 // Field is never assigned to + public uint MbsCorrectlyDecoded; public uint MbsInError; public uint Reserved; public uint ErrorStatus; public FrameStats Stats; public uint SliceHeaderErrorCode; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs index 26ba2ea69..08df2f83e 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs @@ -1,13 +1,14 @@ using Ryujinx.Common.Memory; using Ryujinx.Graphics.Video; +using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Nvdec.Types.H264 { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PictureInfo { -#pragma warning disable IDE0051, CS0169, CS0649 // Remove unused private member Array18 Unknown0; -#pragma warning restore IDE0051 + public uint BitstreamSize; public uint NumSlices; public uint Unknown50; @@ -49,7 +50,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 public Array16 MvcextViewRefMasksL1; public uint Flags2; public Array10 Unknown2D4; -#pragma warning restore CS0169, CS0649 public readonly bool MbAdaptiveFrameFieldFlag => (Flags & (1 << 0)) != 0; public readonly bool Direct8x8InferenceFlag => (Flags & (1 << 1)) != 0; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs index c310abd67..2411e03b1 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs @@ -4,11 +4,10 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 { struct ReferenceFrame { -#pragma warning disable CS0649 // Field is never assigned to + public uint Flags; public Array2 FieldOrderCnt; public uint FrameNum; -#pragma warning restore CS0649 public readonly uint OutputSurfaceIndex => (uint)Flags & 0x7f; } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs index a495cfc89..c6c8a1fc1 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 { struct PictureInfo { -#pragma warning disable CS0649 // Field is never assigned to + public Array13 Unknown0; public uint GpTimerTimeoutValue; public ushort FrameWidth; @@ -58,7 +58,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 public uint ResultValue; // ucode return result public Array8 PartitionOffset; public Array3 Reserved4; -#pragma warning restore CS0649 public Vp8PictureInfo Convert() { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs index 82a09866a..9a147922a 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/EntropyProbs.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct EntropyProbs { -#pragma warning disable CS0649 // Field is never assigned to + public Array10>> KfYModeProbE0ToE7; public Array10> KfYModeProbE8; public Array3 Padding384; @@ -42,7 +42,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public Array5 CompRefProb; public Array17 Padding58F; public Array4>>>>> CoefProbs; -#pragma warning restore CS0649 public void Convert(ref Vp9EntropyProbs fc) { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs index d41c7da13..28db92d5c 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameSize.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameSize { -#pragma warning disable CS0649 // Field is never assigned to + public ushort Width; public ushort Height; public ushort LumaPitch; public ushort ChromaPitch; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs index 47f17e4ed..f8df2c6ea 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameStats.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct FrameStats { -#pragma warning disable CS0649 // Field is never assigned to + public uint Unknown0; public uint Unknown4; public uint Pass2CycleCount; @@ -16,6 +16,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint FrameStatusBwdMvyCnt; public uint ErrorCtbPos; public uint ErrorSlicePos; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs index 139bd87b4..8ea31b0bb 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/LoopFilter.cs @@ -4,10 +4,10 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct LoopFilter { -#pragma warning disable CS0649 // Field is never assigned to + public byte ModeRefDeltaEnabled; public Array4 RefDeltas; public Array2 ModeDeltas; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs index 9da64bfab..eec6adb9c 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct PictureInfo { -#pragma warning disable CS0649 // Field is never assigned to + public Array12 Unknown0; public uint BitstreamSize; public uint IsEncrypted; @@ -42,7 +42,6 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 public uint UnknownF4; public uint UnknownF8; public uint UnknownFC; -#pragma warning restore CS0649 public readonly uint BitDepth => (SurfaceParams >> 1) & 0xf; diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs index 098becc28..a6d5c9232 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/Segmentation.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 { struct Segmentation { -#pragma warning disable CS0649 // Field is never assigned to + public byte Enabled; public byte UpdateMap; public byte TemporalUpdate; public byte AbsDelta; public Array8 FeatureMask; public Array8> FeatureData; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs index bca79cb97..e3566b43f 100644 --- a/src/Ryujinx.Graphics.OpenGL/FormatTable.cs +++ b/src/Ryujinx.Graphics.OpenGL/FormatTable.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.OpenGL _table = new FormatInfo[tableSize]; _tableImage = new SizedInternalFormat[tableSize]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, new FormatInfo(1, true, false, All.R8, PixelFormat.Red, PixelType.UnsignedByte)); Add(Format.R8Snorm, new FormatInfo(1, true, false, All.R8Snorm, PixelFormat.Red, PixelType.Byte)); Add(Format.R8Uint, new FormatInfo(1, false, false, All.R8ui, PixelFormat.RedInteger, PixelType.UnsignedByte)); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs index 4b28f3878..9eae052cd 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { _infoTable = new InstInfo[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Instruction.AtomicAdd, InstType.AtomicBinary, "atomicAdd"); Add(Instruction.AtomicAnd, InstType.AtomicBinary, "atomicAnd"); Add(Instruction.AtomicCompareAndSwap, InstType.AtomicTernary, "atomicCompSwap"); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs index 43ff12168..217c6ae73 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs index 4fe214778..887d9d669 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs @@ -5,11 +5,10 @@ using Spv.Generator; using System; using System.Collections.Generic; using Instruction = Spv.Generator.Instruction; +using IrOperandType = Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandType; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using IrOperandType = IntermediateRepresentation.OperandType; - partial class CodeGenContext : Module { private const uint SpirvVersionMajor = 1; diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 27b5c21c0..fb290c48c 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -6,12 +6,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using static Spv.Specification; +using SpvInstruction = Spv.Generator.Instruction; +using SpvLiteralInteger = Spv.Generator.LiteralInteger; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using SpvInstruction = Spv.Generator.Instruction; - using SpvLiteralInteger = Spv.Generator.LiteralInteger; - static class Instructions { private const MemorySemanticsMask DefaultMemorySemantics = @@ -27,7 +26,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { _instTable = new Func[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Instruction.Absolute, GenerateAbsolute); Add(Instruction.Add, GenerateAdd); Add(Instruction.AtomicAdd, GenerateAtomicAdd); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs index e1561446b..8eadf9d4d 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs @@ -6,14 +6,13 @@ using System; using System.Collections.Generic; using System.Threading; using static Spv.Specification; +using SpvInstruction = Spv.Generator.Instruction; +using SpvInstructionPool = Spv.Generator.GeneratorPool; +using SpvLiteralInteger = Spv.Generator.LiteralInteger; +using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { - using SpvInstruction = Spv.Generator.Instruction; - using SpvInstructionPool = Spv.Generator.GeneratorPool; - using SpvLiteralInteger = Spv.Generator.LiteralInteger; - using SpvLiteralIntegerPool = Spv.Generator.GeneratorPool; - static class SpirvGenerator { // Resource pools for Spirv generation. Note: Increase count when more threads are being used. diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs index 8bf5671ac..303fd0830 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs @@ -3664,9 +3664,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstLepc { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstLepc(ulong opcode) => _opcode = opcode; } @@ -4181,9 +4181,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRam { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstRam(ulong opcode) => _opcode = opcode; } @@ -4252,9 +4252,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstRtt { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstRtt(ulong opcode) => _opcode = opcode; } @@ -4270,9 +4270,9 @@ namespace Ryujinx.Graphics.Shader.Decoders readonly struct InstSam { -#pragma warning disable IDE0052 // Remove unread private member + private readonly ulong _opcode; -#pragma warning restore IDE0052 + public InstSam(ulong opcode) => _opcode = opcode; } diff --git a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs index 35367b8df..d3eca6535 100644 --- a/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs +++ b/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Shader.Decoders _opCodes = new TableEntry[1 << EncodingBits]; #region Instructions -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add("1110111110100xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Al2p, InstEmit.Al2p, InstProps.Rd | InstProps.Ra); Add("1110111111011xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ald, InstEmit.Ald, InstProps.Rd | InstProps.Ra); Add("1110111111110xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", InstName.Ast, InstEmit.Ast, InstProps.Ra | InstProps.Rb2 | InstProps.Rc); diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs index 8061aec28..1b7997113 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs @@ -22,9 +22,7 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Depbar(EmitterContext context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - InstDepbar op = context.GetOp(); -#pragma warning restore IDE0059 + _ = context.GetOp(); // No operation. } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs index 2f3988119..581111c42 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs @@ -510,9 +510,8 @@ namespace Ryujinx.Graphics.Shader.Instructions aLow = context.BitwiseNot(aLow); aHigh = context.BitwiseNot(aHigh); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - aLow = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); -#pragma warning restore IDE0059 + _ = AddWithCarry(context, aLow, Const(1), out Operand aLowCOut); + aHigh = context.IAdd(aHigh, aLowCOut); } diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs index c97e53bfe..c2c7626d2 100644 --- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs +++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs @@ -219,9 +219,8 @@ namespace Ryujinx.Graphics.Shader.Instructions else { res = context.ISubtract(srcA, srcB); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - res = context.IAdd(res, context.BitwiseNot(GetCF())); -#pragma warning restore IDE0059 + + _ = context.IAdd(res, context.BitwiseNot(GetCF())); switch (cond) { diff --git a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs index 61e6ecf5a..3b0e38542 100644 --- a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs +++ b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { diff --git a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs index b2ddf6ab7..f7449671f 100644 --- a/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs +++ b/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { _infoTbl = new InstInfo[(int)Instruction.Count]; -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting // Inst Destination type Source 1 type Source 2 type Source 3 type Source 4 type Add(Instruction.AtomicAdd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); Add(Instruction.AtomicAnd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32); diff --git a/src/Ryujinx.Graphics.Shader/TextureFormat.cs b/src/Ryujinx.Graphics.Shader/TextureFormat.cs index 619598c7f..e8c164648 100644 --- a/src/Ryujinx.Graphics.Shader/TextureFormat.cs +++ b/src/Ryujinx.Graphics.Shader/TextureFormat.cs @@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Shader { return format switch { -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting TextureFormat.R8Unorm => "r8", TextureFormat.R8Snorm => "r8_snorm", TextureFormat.R8Uint => "r8ui", diff --git a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs index 496fbc235..85d58bb0a 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.Graphics.Shader.Translation { diff --git a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index 94448626f..ead428986 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblVertexInBounds, isVertexOob); this.Return(); - this.MarkLabel(lblVertexInBounds); + MarkLabel(lblVertexInBounds); Operand outputInstanceOffset = this.Load(StorageKind.Input, IoVariable.GlobalId, Const(1)); Operand instanceCount = this.Load(StorageKind.ConstantBuffer, vertexInfoCbBinding, Const((int)VertexInfoBufferField.VertexCounts), Const(1)); @@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfFalse(lblInstanceInBounds, isInstanceOob); this.Return(); - this.MarkLabel(lblInstanceInBounds); + MarkLabel(lblInstanceInBounds); if (TranslatorContext.Stage == ShaderStage.Vertex) { @@ -469,7 +469,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(alphaPassLabel, alphaPass); this.Discard(); - this.MarkLabel(alphaPassLabel); + MarkLabel(alphaPassLabel); } } @@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Shader.Translation Operand lblLoopHead = Label(); Operand lblExit = Label(); - this.MarkLabel(lblLoopHead); + MarkLabel(lblLoopHead); Operand writtenIndices = this.Load(StorageKind.LocalMemory, ResourceManager.LocalGeometryOutputIndexCountMemoryId); @@ -581,7 +581,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.Branch(lblLoopHead); - this.MarkLabel(lblExit); + MarkLabel(lblExit); } } @@ -617,7 +617,7 @@ namespace Ryujinx.Graphics.Shader.Translation this.BranchIfTrue(a2cDitherEndLabel, opaque); this.Discard(); - this.MarkLabel(a2cDitherEndLabel); + MarkLabel(a2cDitherEndLabel); } public Operation[] GetOperations() diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs index b16cb0026..4d84f9b28 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcPixel.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Texture.Astc { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AstcPixel { internal const int StructSize = 12; diff --git a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs index 4402df7e5..da14faa2b 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/BitStream128.cs @@ -1,14 +1,12 @@ using Ryujinx.Common.Utilities; -using System; using System.Diagnostics; +using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.Texture.Astc { public struct BitStream128 { -#pragma warning disable IDE0044 // Make field readonly private Buffer16 _data; -#pragma warning restore IDE0044 public int BitsLeft { get; set; } public BitStream128(Buffer16 data) @@ -27,13 +25,11 @@ namespace Ryujinx.Graphics.Texture.Astc } int mask = (1 << bitCount) - 1; - int value = _data.As() & mask; + int value = Unsafe.As(ref _data) & mask; - Span span = _data.AsSpan(); - - ulong carry = span[1] << (64 - bitCount); - span[0] = (span[0] >> bitCount) | carry; - span[1] >>= bitCount; + ulong carry = _data.High << (64 - bitCount); + _data.Low = (_data.Low >> bitCount) | carry; + _data.High >>= bitCount; BitsLeft -= bitCount; @@ -51,23 +47,21 @@ namespace Ryujinx.Graphics.Texture.Astc ulong maskedValue = (uint)(value & ((1 << bitCount) - 1)); - Span span = _data.AsSpan(); - if (BitsLeft < 64) { ulong lowMask = maskedValue << BitsLeft; - span[0] |= lowMask; + _data.Low |= lowMask; } if (BitsLeft + bitCount > 64) { if (BitsLeft > 64) { - span[1] |= maskedValue << (BitsLeft - 64); + _data.High |= maskedValue << (BitsLeft - 64); } else { - span[1] |= maskedValue >> (64 - BitsLeft); + _data.High |= maskedValue >> (64 - BitsLeft); } } diff --git a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs index 2e78f5d4d..5ef33280b 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ClearRectStruct.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct ClearRectStruct { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public int ClearRect0Left => (int)_word0.Extract(0, 14); public int ClearRect0Right => (int)_word0.Extract(16, 14); diff --git a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs index 2496a62e9..7e31125cc 100644 --- a/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs +++ b/src/Ryujinx.Graphics.Vic/Types/ConfigStruct.cs @@ -4,13 +4,13 @@ namespace Ryujinx.Graphics.Vic.Types { struct ConfigStruct { -#pragma warning disable CS0649 // Field is never assigned to + public PipeConfig PipeConfig; public OutputConfig OutputConfig; public OutputSurfaceConfig OutputSurfaceConfig; public MatrixStruct OutColorMatrix; public Array4 ClearRectStruct; public Array8 SlotStruct; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs index 3ce6c93c5..7b4ead1f0 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputConfig.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputConfig { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public int AlphaFillMode => (int)_word0.Extract(0, 3); public int AlphaFillSlot => (int)_word0.Extract(3, 3); diff --git a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs index e72a6a125..e1ac6a091 100644 --- a/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/OutputSurfaceConfig.cs @@ -4,10 +4,9 @@ namespace Ryujinx.Graphics.Vic.Types { readonly struct OutputSurfaceConfig { -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0649 public PixelFormat OutPixelFormat => (PixelFormat)_word0.Extract(0, 7); public int OutChromaLocHoriz => (int)_word0.Extract(7, 2); diff --git a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs index 1e0a7e641..c4b1c5fe9 100644 --- a/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/PipeConfig.cs @@ -1,13 +1,13 @@ using Ryujinx.Common.Utilities; +using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vic.Types { + [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct PipeConfig { -#pragma warning disable CS0169, CS0649, IDE0051 // Remove unused private member private readonly long _word0; private readonly long _word1; -#pragma warning restore CS0169, CS0649, IDE0051 public int DownsampleHoriz => (int)_word0.Extract(0, 11); public int DownsampleVert => (int)_word0.Extract(16, 11); diff --git a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs index 148d06815..921217b16 100644 --- a/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs +++ b/src/Ryujinx.Graphics.Vic/Types/SlotConfig.cs @@ -11,9 +11,8 @@ namespace Ryujinx.Graphics.Vic.Types private readonly long _word4; private readonly long _word5; private readonly long _word6; -#pragma warning disable IDE0051 // Remove unused private member + private readonly long _word7; -#pragma warning restore IDE0051 public bool SlotEnable => _word0.Extract(0); public bool DeNoise => _word0.Extract(1); diff --git a/src/Ryujinx.Graphics.Vic/VicRegisters.cs b/src/Ryujinx.Graphics.Vic/VicRegisters.cs index 7ebc10d9a..0f481fb9d 100644 --- a/src/Ryujinx.Graphics.Vic/VicRegisters.cs +++ b/src/Ryujinx.Graphics.Vic/VicRegisters.cs @@ -4,16 +4,16 @@ namespace Ryujinx.Graphics.Vic { struct PlaneOffsets { -#pragma warning disable CS0649 // Field is never assigned to + public uint LumaOffset; public uint ChromaUOffset; public uint ChromaVOffset; -#pragma warning restore CS0649 + } struct VicRegisters { -#pragma warning disable CS0649 // Field is never assigned to + public Array64 Reserved0; public uint Nop; public Array15 Reserved104; @@ -46,6 +46,6 @@ namespace Ryujinx.Graphics.Vic public Array8 SetSlotContextId; public Array8 SetCompTagBufferOffset; public Array8 SetHistoryBufferOffset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs index 1e54e8ece..fcd649aac 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs @@ -607,7 +607,7 @@ namespace Ryujinx.Graphics.Vulkan srcHolder.SetDataUnchecked(0, data); Auto srcBuffer = srcHolder.GetBuffer(); - Auto dstBuffer = this.GetBuffer(cbs.Value.CommandBuffer, true); + Auto dstBuffer = GetBuffer(cbs.Value.CommandBuffer, true); Copy(_gd, cbs.Value, srcBuffer, dstBuffer, 0, offset, dataSize); diff --git a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs index 305224cad..d5b0b5be2 100644 --- a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs +++ b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vulkan _table = new VkFormat[Enum.GetNames().Length]; _reverseMap = new Dictionary(); -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting Add(Format.R8Unorm, VkFormat.R8Unorm); Add(Format.R8Snorm, VkFormat.R8SNorm); Add(Format.R8Uint, VkFormat.R8Uint); diff --git a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs index 695046198..2c0485b09 100644 --- a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -886,7 +886,7 @@ namespace Ryujinx.Graphics.Vulkan int primitiveCount = pattern.GetPrimitiveCount(indexCount); int convertedCount = pattern.GetConvertedCount(indexCount); int outputIndexSize = 4; - + Buffer dstBuffer = dstIndexBuffer.GetBuffer().Get(cbs, 0, convertedCount * outputIndexSize).Value; const int ParamsBufferSize = 16 * sizeof(int); diff --git a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs index 9054b2e71..852634513 100644 --- a/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs +++ b/src/Ryujinx.Graphics.Vulkan/IndexBufferPattern.cs @@ -1,6 +1,5 @@ using Ryujinx.Graphics.GAL; using System; -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Vulkan diff --git a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs index 271999375..c0cf219b9 100644 --- a/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs +++ b/src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKConfiguration.cs @@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK public static implicit operator Bool32(bool val) => new(val); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct MVKConfiguration { public Bool32 DebugMode; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index eac47e60e..8a498c203 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -701,7 +701,9 @@ namespace Ryujinx.Graphics.Vulkan _vertexBufferUpdater.Commit(Cbs); } +#pragma warning disable CA1822 // Mark members as static public void SetAlphaTest(bool enable, float reference, CompareOp op) +#pragma warning restore CA1822 // Mark members as static { // This is currently handled using shader specialization, as Vulkan does not support alpha test. // In the future, we may want to use this to write the reference value into the support buffer, @@ -900,6 +902,7 @@ namespace Ryujinx.Graphics.Vulkan // TODO: Default levels (likely needs emulation on shaders?) } +#pragma warning disable CA1822 // Mark members as static public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) { // TODO. @@ -909,6 +912,7 @@ namespace Ryujinx.Graphics.Vulkan { // TODO. } +#pragma warning restore CA1822 // Mark members as static public void SetPrimitiveRestart(bool enable, int index) { @@ -1153,10 +1157,12 @@ namespace Ryujinx.Graphics.Vulkan _descriptorSetUpdater.SetUniformBuffers(CommandBuffer, buffers); } +#pragma warning disable CA1822 // Mark members as static public void SetUserClipDistance(int index, bool enableClip) { // TODO. } +#pragma warning restore CA1822 // Mark members as static public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs index b066da8e8..ce7925b97 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgHeader.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgHeader { @@ -14,5 +14,4 @@ namespace Ryujinx.HLE.HOS.Applets public byte EnableSingleMode; public byte EnableIdentificationColor; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs index d5a18d468..e55de105d 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgPrivate.cs @@ -1,6 +1,6 @@ namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + struct ControllerSupportArgPrivate { public uint PrivateSize; @@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets public uint NpadStyleSet; public uint NpadJoyHoldType; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs index 0969493fa..9f303dac6 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + // (8.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgV7 @@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81); } } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs index 886782553..78717075e 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + // (1.0.0+ version) [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportArgVPre7 @@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81); } } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs index 96cfd5903..315e7b263 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportResultInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Applets { -#pragma warning disable CS0649 // Field is never assigned to + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ControllerSupportResultInfo { @@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets public uint SelectedId; public uint Result; } -#pragma warning restore CS0649 } diff --git a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs index 4c54b4666..eb8e1c781 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error { return systemLanguage switch { -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting SystemLanguage.Japanese => "ja", SystemLanguage.AmericanEnglish => "en-US", SystemLanguage.French => "fr", diff --git a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs index 69bff74a5..4624891e2 100644 --- a/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs @@ -12,9 +12,8 @@ namespace Ryujinx.HLE.HOS.Applets private readonly Horizon _system; private AppletSession _normalSession; -#pragma warning disable IDE0052 // Remove unread private member + private AppletSession _interactiveSession; -#pragma warning restore IDE0052 public event EventHandler AppletStateChanged; diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs index 58871a069..808fa605d 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs @@ -43,11 +43,11 @@ namespace Ryujinx.HLE.HOS.Applets private SoftwareKeyboardConfig _keyboardForegroundConfig; // Configuration for background (inline) mode. -#pragma warning disable IDE0052 // Remove unread private member + private SoftwareKeyboardInitialize _keyboardBackgroundInitialize; private SoftwareKeyboardCustomizeDic _keyboardBackgroundDic; private SoftwareKeyboardDictSet _keyboardBackgroundDictSet; -#pragma warning restore IDE0052 + private SoftwareKeyboardUserWord[] _keyboardBackgroundUserWords; private byte[] _transferMemory; diff --git a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs index 30c838ca0..f8f30c188 100644 --- a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs +++ b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/ForwardTemplateReference.cs @@ -6,9 +6,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast { // TODO: Compute inside the Demangler public BaseNode Reference; -#pragma warning disable IDE0052 // Remove unread private member + private readonly int _index; -#pragma warning restore IDE0052 public ForwardTemplateReference(int index) : base(NodeType.ForwardTemplateReference) { diff --git a/src/Ryujinx.HLE/HOS/Horizon.cs b/src/Ryujinx.HLE/HOS/Horizon.cs index 5063b4329..878750f0b 100644 --- a/src/Ryujinx.HLE/HOS/Horizon.cs +++ b/src/Ryujinx.HLE/HOS/Horizon.cs @@ -36,11 +36,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager; namespace Ryujinx.HLE.HOS { - using TimeServiceManager = Services.Time.TimeManager; - public class Horizon : IDisposable { internal const int HidSize = 0x40000; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs index 1ff37282f..1b37e1fce 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightClientSession.cs @@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightClientSession : KAutoObject { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KLightSession _parent; -#pragma warning restore IDE0052 public KLightClientSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs index c355409ec..c1eecae26 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KLightServerSession.cs @@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KLightServerSession : KAutoObject { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KLightSession _parent; -#pragma warning restore IDE0052 public KLightServerSession(KernelContext context, KLightSession parent) : base(context) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs index 84ebcbc3e..cfaa111e3 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KPort.cs @@ -8,9 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc public KServerPort ServerPort { get; } public KClientPort ClientPort { get; } -#pragma warning disable IDE0052 // Remove unread private member private readonly string _name; -#pragma warning restore IDE0052 private readonly ChannelState _state; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs index 58d79c31f..b6b55bc5a 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs @@ -86,11 +86,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30]; -#pragma warning disable IDE0052 // Remove unread private member private readonly ulong _heapAddress; private readonly ulong _heapSize; private ulong _usedSize; -#pragma warning restore IDE0052 + private readonly int _blocksCount; private readonly Block[] _blocks; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs index 6ca54355e..e748378ed 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; namespace Ryujinx.HLE.HOS.Kernel.Process { diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs index beec621bf..4a5762747 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/MemoryInfo.cs @@ -1,7 +1,9 @@ using Ryujinx.HLE.HOS.Kernel.Memory; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { + [StructLayout(LayoutKind.Sequential, Pack = 4)] struct MemoryInfo { public ulong Address; @@ -11,9 +13,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public KMemoryPermission Permission; public int IpcRefCount; public int DeviceRefCount; -#pragma warning disable CS0414, IDE0052 // Remove unread private member private readonly int _padding; -#pragma warning restore CS0414, IDE0052 public MemoryInfo( ulong address, diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index c67220617..76a8ed78c 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x5f)] - public Result FlushProcessDataCache(int processHandle, ulong address, ulong size) + public static Result FlushProcessDataCache(int processHandle, ulong address, ulong size) { // FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0. // As we don't support (and don't actually need) to flush the cache, this is stubbed. @@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x22)] - public Result SendSyncRequestWithUserBuffer( + public static Result SendSyncRequestWithUserBuffer( [PointerSized] ulong messagePtr, [PointerSized] ulong messageSize, int handle) @@ -901,7 +901,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(2)] - public Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -934,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(3)] - public Result SetMemoryAttribute( + public static Result SetMemoryAttribute( [PointerSized] ulong address, [PointerSized] ulong size, MemoryAttribute attributeMask, @@ -983,7 +983,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(4)] - public Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1020,7 +1020,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(5)] - public Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1057,7 +1057,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(6)] - public Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) + public static Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) { Result result = QueryMemory(out MemoryInfo info, out pageInfo, address); @@ -1092,7 +1092,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x13)] - public Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1139,7 +1139,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x14)] - public Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1244,7 +1244,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x51)] - public Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1291,7 +1291,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x52)] - public Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1332,7 +1332,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2c)] - public Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1368,7 +1368,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2d)] - public Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1445,7 +1445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x4c)] - public Result ControlCodeMemory( + public static Result ControlCodeMemory( int handle, CodeMemoryOperation op, ulong address, @@ -1524,7 +1524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x73)] - public Result SetProcessMemoryPermission( + public static Result SetProcessMemoryPermission( int handle, ulong src, ulong size, @@ -1566,7 +1566,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x74)] - public Result MapProcessMemory( + public static Result MapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1623,7 +1623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x75)] - public Result UnmapProcessMemory( + public static Result UnmapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1669,7 +1669,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x77)] - public Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1707,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x78)] - public Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1752,7 +1752,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall // System [Svc(0x7b)] - public Result TerminateProcess(int handle) + public static Result TerminateProcess(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -1782,7 +1782,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(7)] - public void ExitProcess() + public static void ExitProcess() { KernelStatic.GetCurrentProcess().TerminateCurrentProcess(); } @@ -1878,7 +1878,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x26)] - public void Break(ulong reason) + public static void Break(ulong reason) { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -1905,7 +1905,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x27)] - public void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) + public static void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2371,7 +2371,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x30)] - public Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2393,7 +2393,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x31)] - public Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2415,7 +2415,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x37)] - public Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) + public static Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) { peak = 0; @@ -2447,7 +2447,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x7e)] - public Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) + public static Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) { if (resource >= LimitableResource.Count) { @@ -2542,7 +2542,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(9)] - public Result StartThread(int handle) + public static Result StartThread(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2570,7 +2570,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xa)] - public void ExitThread() + public static void ExitThread() { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2602,7 +2602,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xc)] - public Result GetThreadPriority(out int priority, int handle) + public static Result GetThreadPriority(out int priority, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2623,7 +2623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xd)] - public Result SetThreadPriority(int handle, int priority) + public static Result SetThreadPriority(int handle, int priority) { // TODO: NPDM check. @@ -2642,7 +2642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xe)] - public Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) + public static Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2665,7 +2665,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xf)] - public Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) + public static Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -2714,13 +2714,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x10)] - public int GetCurrentProcessorNumber() + public static int GetCurrentProcessorNumber() { return KernelStatic.GetCurrentThread().CurrentCore; } [Svc(0x25)] - public Result GetThreadId(out ulong threadUid, int handle) + public static Result GetThreadId(out ulong threadUid, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2741,7 +2741,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x32)] - public Result SetThreadActivity(int handle, bool pause) + public static Result SetThreadActivity(int handle, bool pause) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2766,7 +2766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x33)] - public Result GetThreadContext3([PointerSized] ulong address, int handle) + public static Result GetThreadContext3([PointerSized] ulong address, int handle) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2931,7 +2931,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1a)] - public Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) + public static Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2949,7 +2949,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1b)] - public Result ArbitrateUnlock([PointerSized] ulong mutexAddress) + public static Result ArbitrateUnlock([PointerSized] ulong mutexAddress) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2967,7 +2967,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1c)] - public Result WaitProcessWideKeyAtomic( + public static Result WaitProcessWideKeyAtomic( [PointerSized] ulong mutexAddress, [PointerSized] ulong condVarAddress, int handle, @@ -2998,7 +2998,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1d)] - public Result SignalProcessWideKey([PointerSized] ulong address, int count) + public static Result SignalProcessWideKey([PointerSized] ulong address, int count) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -3008,7 +3008,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x34)] - public Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) + public static Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) { if (IsPointingInsideKernel(address)) { @@ -3040,7 +3040,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x35)] - public Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) + public static Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) { if (IsPointingInsideKernel(address)) { @@ -3067,7 +3067,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x36)] - public Result SynchronizePreemptionState() + public static Result SynchronizePreemptionState() { KernelStatic.GetCurrentThread().SynchronizePreemptionState(); diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs index cca6dda0f..9998c9209 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ThreadContext.cs @@ -1,8 +1,10 @@ using ARMeilleure.State; using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ThreadContext { public Array29 Registers; @@ -11,9 +13,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public ulong Sp; public ulong Pc; public uint Pstate; -#pragma warning disable CS0169, IDE0051 // Remove unused private member + private readonly uint _padding; -#pragma warning restore CS0169, IDE0051 + public Array32 FpuRegisters; public uint Fpcr; public uint Fpsr; diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs index 8c86788b1..534c06dd7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Security.Claims; using System.Security.Cryptography; -using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -19,9 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService // TODO: Determine where and how NetworkServiceAccountId is set. private const long NetworkServiceAccountId = 0xcafe; -#pragma warning disable IDE0052 // Remove unread private member private readonly UserId _userId; -#pragma warning restore IDE0052 private byte[] _cachedTokenData; private DateTime _cachedTokenExpiry; @@ -128,9 +125,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService public ResultCode LoadIdTokenCache(ServiceCtx context) { ulong bufferPosition = context.Request.ReceiveBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong bufferSize = context.Request.ReceiveBuff[0].Size; -#pragma warning restore IDE0059 // NOTE: This opens the file at "su/cache/USERID_IN_UUID_STRING.dat" (where USERID_IN_UUID_STRING is formatted as "%08x-%04x-%04x-%02x%02x-%08x%04x") // in the "account:/" savedata and writes some data in the buffer. @@ -156,6 +152,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService byte[] tokenData = _cachedTokenData; + if ((ulong)tokenData.Length > bufferSize) + { + return ResultCode.InvalidIdTokenCacheBufferSize; + } + context.Memory.Write(bufferPosition, tokenData); context.ResponseData.Write(tokenData.Length); diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs index a6b1a47b6..74a4ed2ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Account.Acc { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public readonly record struct UserId { public readonly long High; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs index 05a4b0a63..1e5795408 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/IAudioController.cs @@ -10,10 +10,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetExpectedMasterVolume(f32, f32) public ResultCode SetExpectedMasterVolume(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float appletVolume = context.RequestData.ReadSingle(); - float libraryAppletVolume = context.RequestData.ReadSingle(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadSingle(); // applet volume + _ = context.RequestData.ReadSingle(); // library applet volume Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -46,10 +44,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // ChangeMainAppletMasterVolume(f32, u64) public ResultCode ChangeMainAppletMasterVolume(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float unknown0 = context.RequestData.ReadSingle(); - long unknown1 = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + // Unknown parameters. + _ = context.RequestData.ReadSingle(); + _ = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceAm); @@ -60,9 +57,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys // SetTransparentVolumeRate(f32) public ResultCode SetTransparentVolumeRate(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - float unknown0 = context.RequestData.ReadSingle(); -#pragma warning restore IDE0059 + // Unknown parameter. + _ = context.RequestData.ReadSingle(); Logger.Stub?.PrintStub(LogClass.ServiceAm); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs index ad776fe6e..c60a7fafc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs @@ -18,10 +18,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly Apm.SystemManagerServer _apmSystemManagerServer; private bool _vrModeEnabled; -#pragma warning disable CS0414, IDE0052 // Remove unread private member private bool _lcdBacklighOffEnabled; private bool _requestExitToLibraryAppletAtExecuteNextProgramEnabled; -#pragma warning restore CS0414, IDE0052 private int _messageEventHandle; private int _displayResolutionChangedEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs index 23ba99b04..dcfbde54d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ILibraryAppletCreator.cs @@ -12,9 +12,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys public ResultCode CreateLibraryApplet(ServiceCtx context) { AppletId appletId = (AppletId)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int libraryAppletMode = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // libraryAppletMode MakeObject(context, new ILibraryAppletAccessor(appletId, context.Device.System)); diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs index 8e0f515ba..7d7b56af7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs @@ -25,21 +25,21 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys private readonly ulong _accumulatedSuspendedTickValue = 0; // TODO: Determine where those fields are used. -#pragma warning disable IDE0052 // Remove unread private member + private bool _screenShotPermission = false; private bool _operationModeChangedNotification = false; private bool _performanceModeChangedNotification = false; private bool _restartMessageEnabled = false; private bool _outOfFocusSuspendingEnabled = false; private bool _handlesRequestToDisplay = false; -#pragma warning restore IDE0052 + private bool _autoSleepDisabled = false; -#pragma warning disable IDE0052 // Remove unread private member + private bool _albumImageTakenNotificationEnabled = false; private bool _recordVolumeMuted = false; private uint _screenShotImageOrientation = 0; -#pragma warning restore IDE0052 + private uint _idleTimeDetectionExtension = 0; public ISelfController(ServiceCtx context, ulong pid) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs index 926632531..424e9fc63 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletFifo.cs @@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE { try { - this.Push(item); + Push(item); return true; } @@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public bool TryTake(out T item) { - return this.TryPop(out item); + return TryPop(out item); } public T Peek() @@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void CopyTo(Array array, int index) { - this.CopyTo((T[])array, index); + CopyTo((T[])array, index); } public IEnumerator GetEnumerator() diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs index a3f44a45d..0e2d5ee07 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AppletSession.cs @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public void Push(byte[] item) { - if (!this.TryPush(item)) + if (!TryPush(item)) { // TODO(jduncanator): Throw a proper exception throw new InvalidOperationException(); @@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE public byte[] Pop() { - if (this.TryPop(out byte[] item)) + if (TryPop(out byte[] item)) { return item; } @@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE /// public AppletSession GetConsumer() { - return new AppletSession(this._outputData, this._inputData); + return new AppletSession(_outputData, _inputData); } } } diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs index 26089bddb..a901de003 100644 --- a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs +++ b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs @@ -8,9 +8,8 @@ namespace Ryujinx.HLE.HOS.Services.Arp public int Version; public byte BaseGameStorageId; public byte UpdateGameStorageId; -#pragma warning disable CS0649 // Field is never assigned to + public short Padding; -#pragma warning restore CS0649 public static ApplicationLaunchProperty Default { diff --git a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs index 8f2642695..5cbdbd368 100644 --- a/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Bluetooth/IBluetoothDriver.cs @@ -10,9 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth [Service("btdrv")] class IBluetoothDriver : IpcService { -#pragma warning disable CS0414, IDE0052 // Remove unread private member private string _unknownLowEnergy; -#pragma warning restore CS0414, IDE0052 public IBluetoothDriver(ServiceCtx context) { } diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs index 3caea0f6c..d65203156 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs @@ -23,9 +23,8 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SetShimLibraryVersion(ServiceCtx context) { ulong shimLibraryVersion = context.RequestData.ReadUInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong appletResourceUserId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // applet Resource user id // TODO: Service checks if the pid is present in an internal list and returns ResultCode.BlacklistedPid if it is. // The list contents needs to be determined. diff --git a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs index 0723b57cc..91d363eb5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Caps/IScreenShotApplicationService.cs @@ -20,15 +20,13 @@ namespace Ryujinx.HLE.HOS.Services.Caps public ResultCode SaveScreenShotEx0(ServiceCtx context) { // TODO: Use the ScreenShotAttribute. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ScreenShotAttribute screenShotAttribute = context.RequestData.ReadStruct(); + _ = context.RequestData.ReadStruct(); // screenShotAttribute + + _ = context.RequestData.ReadUInt32(); // unknown - uint unknown = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 ulong appletResourceUserId = context.RequestData.ReadUInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid ulong screenshotDataPosition = context.Request.SendBuff[0].Position; ulong screenshotDataSize = context.Request.SendBuff[0].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs index 155077745..4ea7c8294 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs @@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Fatal Logger.Info?.Print(LogClass.ServiceFatal, errorReport.ToString()); - context.Device.System.KernelContext.Syscall.Break((ulong)resultCode); + Kernel.SupervisorCall.Syscall.Break((ulong)resultCode); return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs index 08ede2b5b..8d7d3ce89 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs @@ -50,10 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs // -> object contentFs public ResultCode OpenFileSystemWithId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = (FileSystemType)context.RequestData.ReadInt32(); // fileSystemType + _ = context.RequestData.ReadUInt64(); // titleId + string switchPath = ReadUtf8String(context); string fullPath = FileSystem.VirtualFileSystem.SwitchPathToSystemPath(switchPath); @@ -793,9 +793,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs public ResultCode OpenDataStorageByDataId(ServiceCtx context) { StorageId storageId = (StorageId)context.RequestData.ReadByte(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte[] padding = context.RequestData.ReadBytes(7); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadBytes(7); // Skip 7 bytes of padding. + ulong titleId = context.RequestData.ReadUInt64(); // We do a mitm here to find if the request is for an AOC. diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs index 66b5a5cba..932848690 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs @@ -101,7 +101,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result; result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result; #pragma warning restore IDE0055 - return result; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 834bee6f0..8fa35cd43 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -254,6 +254,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid switch (type) { + #pragma warning disable IDE0055 // Disable formatting case ControllerType.ProController: controller.StyleSet = NpadStyleTag.FullKey; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs index 93f19c915..f0c2b53de 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs @@ -8,9 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer // ActivateVibrationDevice(nn::hid::VibrationDeviceHandle) public ResultCode ActivateVibrationDevice(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int vibrationDeviceHandle = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt32(); // vibrationDeviceHandle return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 0d2fcaa2a..9835e576d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid private long _npadCommunicationMode; private uint _accelerometerPlayMode; -#pragma warning disable CS0649 // Field is never assigned to + private readonly long _vibrationGcErmCommand; -#pragma warning restore CS0649 + private float _sevenSixAxisSensorFusionStrength; private SensorFusionParameters _sensorFusionParams; @@ -64,9 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // CreateAppletResource(nn::applet::AppletResourceUserId) -> object public ResultCode CreateAppletResource(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem)); @@ -735,9 +733,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag public ResultCode GetSupportedNpadStyleSet(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets); @@ -751,9 +746,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array) public ResultCode SetSupportedNpadIdType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId + ulong arrayPosition = context.Request.PtrBuff[0].Position; ulong arraySize = context.Request.PtrBuff[0].Size; @@ -904,9 +898,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType) public ResultCode SetNpadJoyHoldType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64(); @@ -932,9 +924,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType public ResultCode GetNpadJoyHoldType(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers()) { @@ -955,9 +945,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // appletResourceUserId if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -990,9 +979,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // appletResourceUserId if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -1231,9 +1219,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid FrequencyHigh = context.RequestData.ReadSingle(), }; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId Dictionary dualVibrationValues = new() { @@ -1257,9 +1243,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid Reserved = context.RequestData.ReadByte(), }; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position); @@ -1304,9 +1288,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationValues(nn::applet::AppletResourceUserId, buffer, type: 9>, buffer, type: 9>) public ResultCode SendVibrationValues(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // appletResourceUserId byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size]; @@ -1396,10 +1378,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) public ResultCode IsVibrationDeviceMounted(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int vibrationDeviceHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt32(); // VibrationDeviceHandle + _ = context.RequestData.ReadInt64(); // appletResourceUserId // NOTE: Service use vibrationDeviceHandle to get the PlayerIndex. // And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs index 8e061351e..0bb8c6c9c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Hid { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BusHandle { public int AbstractedPadId; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index 99f2f59e4..df5e72624 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -1,20 +1,18 @@ using Ryujinx.Common.Memory; using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Threading; namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RingLifo where T : unmanaged, ISampledDataStruct { private const ulong MaxEntries = 17; -#pragma warning disable IDE0051, CS0169 // Remove unused private member private readonly ulong _unused; -#pragma warning restore IDE0051, CS0169 -#pragma warning disable CS0414, IDE0052 // Remove unread private member private ulong _bufferCount; -#pragma warning restore CS0414, IDE0052 private ulong _index; private ulong _count; private Array17> _storage; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs index 41e841342..26e2e2372 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs @@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NpadGcTriggerState : ISampledDataStruct { -#pragma warning disable CS0649 // Field is never assigned to + public ulong SamplingNumber; public uint TriggerL; public uint TriggerR; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs index f79a2657e..f57f79aaf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs @@ -23,9 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public RingLifo JoyLeftSixAxisSensor; public RingLifo JoyRightSixAxisSensor; public DeviceType DeviceType; -#pragma warning disable IDE0051 // Remove unused private member + private readonly uint _reserved1; -#pragma warning restore IDE0051 + public NpadSystemProperties SystemProperties; public NpadSystemButtonProperties SystemButtonProperties; public NpadBatteryLevel BatteryLevelJoyDual; @@ -33,9 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public NpadBatteryLevel BatteryLevelJoyRight; public uint AppletFooterUiAttributes; public AppletFooterUiType AppletFooterUiType; -#pragma warning disable IDE0051 // Remove unused private member + private readonly Reserved2Struct _reserved2; -#pragma warning restore IDE0051 + public RingLifo GcTrigger; public NpadLarkType LarkTypeLeftAndMain; public NpadLarkType LarkTypeRight; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs index 06be9b24c..cc54c2248 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs @@ -1,19 +1,22 @@ +using System.Runtime.InteropServices; + namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen { + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TouchState { public ulong DeltaTime; -#pragma warning disable CS0649 // Field is never assigned to + public TouchAttribute Attribute; -#pragma warning restore CS0649 + public uint FingerId; public uint X; public uint Y; public uint DiameterX; public uint DiameterY; public uint RotationAngle; -#pragma warning disable CS0169, IDE0051 // Remove unused private member + private readonly uint _reserved; -#pragma warning restore CS0169, IDE0051 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/IpcService.cs b/src/Ryujinx.HLE/HOS/Services/IpcService.cs index 4c354ebc6..11d4f57a1 100644 --- a/src/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/src/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -129,9 +129,8 @@ namespace Ryujinx.HLE.HOS.Services } } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long sfciMagic = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // sfci magic + int commandId = (int)context.RequestData.ReadInt64(); bool serviceExists = service.CmifCommands.TryGetValue(commandId, out MethodInfo processRequest); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs index 667230b81..7f9964b38 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyTcpSession.cs @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy protected override void OnReceived(byte[] buffer, long offset, long size) { - _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, this.Socket.RemoteEndPoint); + _protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, Socket.RemoteEndPoint); } protected override void OnError(SocketError error) @@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy { try { - if (endPoint.Equals(this.Socket.RemoteEndPoint)) + if (endPoint.Equals(Socket.RemoteEndPoint)) { NodeInfo = info; _protocol.InvokeAccept(this); diff --git a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs index 18b267e91..203cf5537 100644 --- a/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Loader/ResultCode.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Loader { enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs index 44054e6b8..deed6cbf6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs @@ -102,7 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types coreData.SetDefault(); -#pragma warning disable IDE0055 // Disable formatting + #pragma warning disable IDE0055 // Disable formatting coreData.Nickname = template.Nickname; coreData.FontRegion = (FontRegion)template.FontRegion; coreData.FavoriteColor = (byte)template.FavoriteColor; diff --git a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs index 71ed56385..c4695e7c0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ncm/Lr/LocationResolverManager/ILocationResolver.cs @@ -1,6 +1,7 @@ using LibHac.Ncm; using LibHac.Tools.FsSystem.NcaUtils; using Ryujinx.HLE.FileSystem; +using System; using System.Text; using static Ryujinx.HLE.Utilities.StringUtils; @@ -228,12 +229,16 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager if (!string.IsNullOrWhiteSpace(contentPath)) { ulong position = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong size = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 byte[] contentPathBuffer = Encoding.UTF8.GetBytes(contentPath); + if ((ulong)contentPathBuffer.Length > size) + { + throw new InvalidOperationException("Content path buffer size is too small."); + } + context.Memory.Write(position, contentPathBuffer); } else @@ -247,9 +252,8 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager private void DeleteContentPath(ServiceCtx context, ulong titleId, NcaContentType contentType) { ContentManager contentManager = context.Device.System.ContentManager; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); -#pragma warning restore IDE0059 + + //string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual); contentManager.ClearEntry(titleId, NcaContentType.Manual, _storageId); } diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index 0e11493d5..06e283f6b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -339,7 +339,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath()); - public static DateTime DateTimeFromTag(ushort dateTimeTag) { try diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs index 5f8d0faaa..cbff95478 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs @@ -22,10 +22,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption if (dumpData.Length < 540) throw new ArgumentException("Incomplete dump. Amiibo data is at least 540 bytes."); - this.data = new byte[540]; - Array.Copy(dumpData, this.data, dumpData.Length); - this.dataMasterKey = dataKey; - this.tagMasterKey = tagKey; + data = new byte[540]; + Array.Copy(dumpData, data, dumpData.Length); + dataMasterKey = dataKey; + tagMasterKey = tagKey; this.isLocked = isLocked; if (!isLocked) @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Append data based on magic size int append = 16 - key.MagicSize; byte[] extract = new byte[16]; - Array.Copy(this.data, 0x011, extract, 0, 2); // Extract two bytes from user data section + Array.Copy(data, 0x011, extract, 0, 2); // Extract two bytes from user data section for (int i = 2; i < 16; i++) { extract[i] = 0x00; @@ -57,13 +57,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption // Extract the UID (UID is 8 bytes) byte[] uid = new byte[8]; - Array.Copy(this.data, 0x000, uid, 0, 8); + Array.Copy(data, 0x000, uid, 0, 8); seed.AddRange(uid); seed.AddRange(uid); // Extract some tag data (pages 0x20 - 0x28) byte[] user = new byte[32]; - Array.Copy(this.data, 0x060, user, 0, 32); + Array.Copy(data, 0x060, user, 0, 32); // XOR it with the key padding (XorPad) byte[] paddedUser = new byte[32]; @@ -137,10 +137,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption private void DeriveKeysAndCipher() { // Derive HMAC Tag Key - this.hmacTagKey = DeriveKey(this.tagMasterKey, false, out _, out _); + hmacTagKey = DeriveKey(tagMasterKey, false, out _, out _); // Derive HMAC Data Key and AES Key/IV - this.hmacDataKey = DeriveKey(this.dataMasterKey, true, out aesKey, out aesIv); + hmacDataKey = DeriveKey(dataMasterKey, true, out aesKey, out aesIv); } private void DecryptData() diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index ca833e33d..94037af0a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -18,10 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { class INfp : IpcService { -#pragma warning disable IDE0052 // Remove unread private member + private ulong _appletResourceUserId; private ulong _mcuVersionData; -#pragma warning restore IDE0052 + private byte[] _mcuData; private State _state = State.NonInitialized; @@ -482,9 +482,8 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // Flush(bytes<8, 4>) public ResultCode Flush(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint deviceHandle = (uint)context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = (uint)context.RequestData.ReadUInt64(); // Device handle + if (context.Device.System.NfpDevices.Count == 0) { return ResultCode.DeviceNotFound; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index dd4efce6e..96a510921 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -155,9 +155,6 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context) { ulong position = context.Request.PtrBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong size = context.Request.PtrBuff[0].Size; -#pragma warning restore IDE0059 int clientId = context.Memory.Read(position); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs index 577d03822..05e636323 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs @@ -21,9 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService private int _event0Handle; private int _event1Handle; -#pragma warning disable IDE0052 // Remove unread private member private readonly uint _version; -#pragma warning restore IDE0052 public IRequest(Horizon system, uint version) { @@ -118,9 +116,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // GetAppletInfo(u32) -> (u32, u32, u32, buffer) public ResultCode GetAppletInfo(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint themeColor = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // Theme color Logger.Stub?.PrintStub(LogClass.ServiceNifm); diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs index fa780fd2e..3b7bf7076 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct InternetConnectionStatus { public InternetConnectionType Type; diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs index 9d902a1ad..cb50ab85e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpV4Address.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct IpV4Address { public uint Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs index c77358803..46575e51e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs @@ -44,10 +44,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CountAddOnContent(pid) -> u32 public ResultCode CountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return CountAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -57,10 +53,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer) public ResultCode ListAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return ListAddContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -79,10 +71,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentBaseId(pid) -> u64 public ResultCode GetAddOnContentBaseId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return GetAddOnContentBaseIdImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -101,10 +89,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // PrepareAddOnContent(u32 index, pid) public ResultCode PrepareAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. return PrepareAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId); @@ -131,10 +115,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentListChangedEventWithProcessId(pid) -> handle public ResultCode GetAddOnContentListChangedEventWithProcessId(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // TODO: Found where stored value is used. @@ -152,10 +132,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyMountAddOnContent(pid, u64 title_id) public ResultCode NotifyMountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -172,10 +148,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyUnmountAddOnContent(pid, u64 title_id) public ResultCode NotifyUnmountAddOnContent(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. ulong aocTitleId = context.RequestData.ReadUInt64(); @@ -189,10 +161,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CheckAddOnContentMountStatus(pid) public ResultCode CheckAddOnContentMountStatus(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pid = context.Request.HandleDesc.PId; -#pragma warning restore IDE0059 - // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // Then it does some internal checks and returns InvalidBufferSize if they fail. diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index f510da594..fd9689186 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -12,10 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte source = (byte)context.RequestData.ReadInt64(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // source + _ = context.RequestData.ReadUInt64(); // titleId ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs index ca7d42b48..1e820c0c3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs @@ -11,10 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte source = (byte)context.RequestData.ReadInt64(); - ulong titleId = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt64(); // source + _ = context.RequestData.ReadUInt64(); // titleId ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index fea09ef47..843b66caf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -93,9 +93,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv private NvResult GetIoctlArgument(ServiceCtx context, NvIoctl ioctlCommand, out Span arguments) { (ulong inputDataPosition, ulong inputDataSize) = context.Request.GetBufferType0x21(0); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong outputDataPosition, ulong outputDataSize) = context.Request.GetBufferType0x22(0); -#pragma warning restore IDE0059 + + (_, ulong outputDataSize) = context.Request.GetBufferType0x22(0); NvIoctl.Direction ioctlDirection = ioctlCommand.DirectionValue; uint ioctlSize = ioctlCommand.Size; @@ -307,9 +306,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv // Initialize(u32 transfer_memory_size, handle current_process, handle transfer_memory) -> u32 error_code public ResultCode Initialize(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long transferMemSize = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // transfer memory size + int transferMemHandle = context.Request.HandleDesc.ToCopy[1]; // TODO: When transfer memory will be implemented, this could be removed. @@ -431,9 +429,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv // SetClientPID(u64, pid) -> u32 error_code public ResultCode SetClientPid(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long pid = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // pid context.ResponseData.Write(0); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs index 231fa7c13..10f602ad2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AllocSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocSpaceArguments { public uint Pages; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs index 51fac8d8f..639619dd0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/BindChannelArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BindChannelArguments { public int Fd; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs index f14b751d4..f8e2c66a6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/FreeSpaceArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct FreeSpaceArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs index 447477823..9c704090c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/GetVaRegionsArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VaRegion { public ulong Offset; @@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types public ulong Pages; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetVaRegionsArguments { public ulong Unused; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs index e86932bb0..264d5b618 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/InitializeExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct InitializeExArguments { public uint Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs index c0f6d40ee..f0ca905f3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/MapBufferExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct MapBufferExArguments { public AddressSpaceFlags Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs index 99afa4bad..bdd46290c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/RemapArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RemapArguments { public ushort Flags; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs index d6bc1bc52..2d5388123 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/UnmapBufferArguments.cs @@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types { struct UnmapBufferArguments { -#pragma warning disable CS0649 // Field is never assigned to + public ulong Offset; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs index a114bd3e0..ad026ff59 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs @@ -19,11 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel private const uint MaxModuleSyncpoint = 16; -#pragma warning disable IDE0052 // Remove unread private member private uint _timeout; private uint _submitTimeout; private uint _timeslice; -#pragma warning restore IDE0052 private readonly Switch _device; @@ -147,10 +145,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { SubmitArguments submitHeader = GetSpanAndSkip(ref arguments, 1)[0]; Span commandBuffers = GetSpanAndSkip(ref arguments, submitHeader.CmdBufsCount); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - Span relocs = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); - Span relocShifts = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); -#pragma warning restore IDE0059 + + _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // relocs + _ = GetSpanAndSkip(ref arguments, submitHeader.RelocsCount); // reloc shifts + Span syncptIncrs = GetSpanAndSkip(ref arguments, submitHeader.SyncptIncrsCount); Span fenceThresholds = GetSpanAndSkip(ref arguments, submitHeader.FencesCount); diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs index 34663e9d7..f6af4ecef 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs @@ -8,11 +8,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile { -#pragma warning disable IDE0052 // Remove unread private member + private readonly KEvent _smExceptionBptIntReportEvent; private readonly KEvent _smExceptionBptPauseReportEvent; private readonly KEvent _errorNotifierEvent; -#pragma warning restore IDE0052 private int _smExceptionBptIntReportEventHandle; private int _smExceptionBptPauseReportEventHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs index 9a06fbebd..f84722cea 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocGpfifoExArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocGpfifoExArguments { public uint NumEntries; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs index 4578ec6a9..6e7b5f23e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/AllocObjCtxArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AllocObjCtxArguments { public uint ClassNumber; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs index 5e74f6f2c..7eb538211 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/GetParameterArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetParameterArguments { public uint Parameter; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs index 88cd6bd94..473d31bf3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/MapCommandBufferArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CommandBufferHandle { public int MapHandle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs index 177f483f0..943ea3d4b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/NvChannel.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel { class NvChannel { -#pragma warning disable CS0649 // Field is never assigned to + public int Timeout; public int SubmitTimeout; public int Timeslice; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs index f285123a7..39ab45085 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SetErrorNotifierArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SetErrorNotifierArguments { public ulong Offset; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs index 0c4ea7625..0f90decb0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CommandBuffer { public int Mem; @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int WordsCount; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Reloc { public int CmdbufMem; @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public int TargetOffset; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptIncr { public uint Id; @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types public uint Reserved3; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SubmitArguments { public int CmdBufsCount; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs index b6bd1e4e8..c29764162 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/SubmitGpfifoArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SubmitGpfifoArguments { public long Address; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs index fe4c74d66..7d75c74ed 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/Types/ZcullBindArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullBindArguments { public ulong GpuVirtualAddress; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs index 0b2133a78..0f3729604 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/EventWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct EventWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs index 48622a224..7d69fd6cf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs @@ -18,9 +18,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl public int EventHandle; private readonly uint _eventId; -#pragma warning disable IDE0052 // Remove unread private member + private readonly NvHostSyncpt _syncpointManager; -#pragma warning restore IDE0052 + private SyncpointWaiterHandle _waiterInformation; private NvFence _previousFailingFence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs index 5138db9ea..cf8d701c8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptWaitArguments { public NvFence Fence; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs index 7bcd38c75..3e29636f6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/SyncptWaitExArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SyncptWaitExArguments { public SyncptWaitArguments Input; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs index 4f447f486..00221eab9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetActiveSlotMaskArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetActiveSlotMaskArguments { public int Slot; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs index 556786de0..10ba9e6ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetCharacteristicsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GpuCharacteristics { public int Arch; @@ -44,13 +44,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types struct CharacteristicsHeader { -#pragma warning disable CS0649 // Field is never assigned to + public long BufferSize; public long BufferAddress; -#pragma warning restore CS0649 + } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetCharacteristicsArguments { public CharacteristicsHeader Header; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs index c1c1a6f91..e42998da3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetGpuTimeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetGpuTimeArguments { public ulong Timestamp; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs index 83ff4f090..09aec7b6d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/GetTpcMasksArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct GetTpcMasksArguments { public int MaskBufferSize; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs index fb5013a70..48a83a927 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/NumVsmsArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NumVsmsArguments { public uint NumVsms; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs index baada9197..ee01ebf4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/VsmsMappingArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VsmsMappingArguments { public byte Sm0GpcIndex; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs index cee339bac..67975ff7b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZbcSetTableArguments.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZbcSetTableArguments { public Array4 ColorDs; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs index 16ffacdac..b661d0997 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetCtxSizeArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullGetCtxSizeArguments { public int Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs index 343643abf..88ea3baa8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrlGpu/Types/ZcullGetInfoArguments.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZcullGetInfoArguments { public int WidthAlignPixels; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs index dc4f5d608..84052df9d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapAlloc.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapAlloc { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs index f4047497a..63a8150a2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapCreate.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapCreate { public uint Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs index ce93e9e5e..dfaec714e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFree.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapFree { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs index 9ec81f9f3..a37dc1954 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapFromId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapFromId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs index 8306ae4ca..231c61475 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapGetId.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapGetId { public int Id; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs index e821b571d..2b24f4564 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapHandle.cs @@ -4,10 +4,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { class NvMapHandle { -#pragma warning disable CS0649 // Field is never assigned to + public int Handle; public int Id; -#pragma warning restore CS0649 + public uint Size; public int Align; public int Kind; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs index 16fd78043..43299d406 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvMap/Types/NvMapParam.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvMapParam { public int Handle; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs index 40e35fa7a..99187bc4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvIoctl.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nv { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NvIoctl { public const int NvHostCustomMagic = 0x00; diff --git a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs index c36482e41..6adede408 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pctl/ParentalControlServiceFactory/IParentalControlService.cs @@ -11,7 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private readonly int _permissionFlag; private ulong _titleId; private ParentalControlFlagValue _parentalControlFlag; -#pragma warning disable IDE0052, CS0414 // Remove unread private member private int[] _ratingAge; // TODO: Find where they are set. @@ -20,7 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory private bool _freeCommunicationEnabled = false; private readonly bool _stereoVisionRestrictionConfigurable = true; private bool _stereoVisionRestriction = false; -#pragma warning restore IDE0052, CS0414 public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag) { @@ -178,7 +176,6 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory return ResultCode.PermissionDenied; } -#pragma warning disable // Remove unnecessary value assignment bool stereoVisionRestriction = false; if (_stereoVisionRestrictionConfigurable) diff --git a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs index 5d90fcbe2..0a7541caf 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs @@ -7,9 +7,9 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager class IClkrstSession : IpcService { private readonly DeviceCode _deviceCode; -#pragma warning disable IDE0052 // Remove unread private member + private readonly uint _unknown; -#pragma warning restore IDE0052 + private uint _clockRate; private readonly DeviceCode[] _allowedDeviceCodeTable = diff --git a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs index 45c4ce7e1..d4fc5d767 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sdb/Pl/ISharedFontManager.cs @@ -17,9 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // RequestLoad(u32) public ResultCode RequestLoad(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (SharedFontType)context.RequestData.ReadInt32(); // font type // We don't need to do anything here because we do lazy initialization // on SharedFontManager (the font is loaded when necessary). @@ -30,9 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetLoadState(u32) -> u32 public ResultCode GetLoadState(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (SharedFontType)context.RequestData.ReadInt32(); // font type // 1 (true) indicates that the font is already loaded. // All fonts are already loaded. @@ -86,9 +82,8 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl // GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer, buffer, buffer) public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long languageCode = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // language code + int loadedCount = 0; for (SharedFontType type = 0; type < SharedFontType.Count; type++) diff --git a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs index dcc01bf38..0b3a27b03 100644 --- a/src/Ryujinx.HLE/HOS/Services/ServerBase.cs +++ b/src/Ryujinx.HLE/HOS/Services/ServerBase.cs @@ -377,9 +377,8 @@ namespace Ryujinx.HLE.HOS.Services else if (request.Type is IpcMessageType.CmifControl or IpcMessageType.CmifControlWithContext) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint magic = (uint)_requestDataReader.ReadUInt64(); -#pragma warning restore IDE0059 + _ = (uint)_requestDataReader.ReadUInt64(); // magic + uint cmdId = (uint)_requestDataReader.ReadUInt64(); switch (cmdId) diff --git a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index f19eeebfc..66bdb4339 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -214,10 +214,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - bool isLight = (context.RequestData.ReadInt32() & 1) != 0; - int maxSessions = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + _ = (context.RequestData.ReadInt32() & 1) != 0; // is light + _ = context.RequestData.ReadInt32(); // max sessions if (string.IsNullOrEmpty(name)) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index fe37ca4fa..79d3bf9c5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -353,9 +353,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int timeout = context.RequestData.ReadInt32(); (ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + + (ulong outputBufferPosition, _) = context.Request.GetBufferType0x22(); if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize) { @@ -603,9 +602,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); (ulong sendPosition, ulong sendSize) = context.Request.GetBufferType0x21(0); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(1); -#pragma warning restore IDE0059 + + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(1); ReadOnlySpan sendBuffer = context.Memory.GetSpan(sendPosition, (int)sendSize); @@ -634,9 +632,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPos, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -679,9 +675,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -702,9 +696,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x21(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -725,9 +717,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -754,9 +744,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPos, _) = context.Request.GetBufferType0x22(); LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -828,9 +816,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { int socketFd = context.RequestData.ReadInt32(); BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int bufferCount = context.RequestData.ReadInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // buffer count LinuxError errno = LinuxError.EBADF; ISocket socket = _context.RetrieveSocket(socketFd); @@ -842,9 +829,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd case BsdIoctl.AtMark: errno = LinuxError.SUCCESS; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22(); -#pragma warning restore IDE0059 + (ulong bufferPosition, _) = context.Request.GetBufferType0x22(); // FIXME: OOB not implemented. context.Memory.Write(bufferPosition, 0); @@ -1036,9 +1021,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd public ResultCode DuplicateSocket(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong reserved = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // Padding, not used. LinuxError errno = LinuxError.ENOENT; int newSockFd = -1; @@ -1065,9 +1049,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int socketFd = context.RequestData.ReadInt32(); int vlen = context.RequestData.ReadInt32(); BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint reserved = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt32(); // Padding, not used. + TimeVal timeout = context.RequestData.ReadStruct(); ulong receivePosition = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs index 684e06598..d99488d85 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs @@ -2,7 +2,6 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy; using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Net.Sockets; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs index 92a013d19..6a250498d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/WSAError.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl { enum WsaError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs index c275f3ba5..2796d95ca 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSocketOption.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum BsdSocketOption diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs index 1219d1476..72dcd0166 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/LinuxError.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { enum LinuxError diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs index 3babb0018..84f2659b8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/PollEventData.cs @@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { struct PollEventData { -#pragma warning disable CS0649 // Field is never assigned to + public int SocketFd; public PollEventTypeMask InputEvents; -#pragma warning restore CS0649 + public PollEventTypeMask OutputEvents; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index 80bdbec8a..8c58822aa 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -28,10 +28,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode SetDnsAddressesPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = context.Request.SendBuff[0].Position; - ulong bufferSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -44,10 +40,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode GetDnsAddressPrivateRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = context.Request.ReceiveBuff[0].Position; - ulong bufferSize = context.Request.ReceiveBuff[0].Size; -#pragma warning restore IDE0059 // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness. Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -170,9 +162,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // GetCancelHandleRequest(u64, pid) -> u32 public ResultCode GetCancelHandleRequest(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt64(); // pid + uint cancelHandleRequest = 0; context.ResponseData.Write(cancelHandleRequest); @@ -187,9 +178,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres public ResultCode CancelRequest(ServiceCtx context) { uint cancelHandleRequest = context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest }); @@ -303,10 +293,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres // TODO: Use params. bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int timeOut = context.RequestData.ReadInt32(); - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadInt32(); // Timeout + _ = context.RequestData.ReadUInt64(); // pid if (withOptions) { @@ -403,12 +392,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres context.Memory.Read(inputBufferPosition, rawIp); // TODO: Use params. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint socketLength = context.RequestData.ReadUInt32(); - uint type = context.RequestData.ReadUInt32(); - int timeOut = context.RequestData.ReadInt32(); - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // socket length + _ = context.RequestData.ReadUInt32(); // type + _ = context.RequestData.ReadInt32(); // timeout + _ = context.RequestData.ReadUInt64(); // pid placeholder if (withOptions) { @@ -506,9 +493,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres ulong optionsBufferSize) { bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint cancelHandle = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt32(); // Cancel handle request string host = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[0].Position, (long)context.Request.SendBuff[0].Size); string service = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[1].Position, (long)context.Request.SendBuff[1].Size); @@ -523,21 +509,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres } // NOTE: We ignore hints for now. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - List hints = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); -#pragma warning restore IDE0059 + _ = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); // hints if (withOptions) { // TODO: Find unknown, Parse and use options. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - uint unknown = context.RequestData.ReadUInt32(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt32(); // unknown } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceHolder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadUInt64(); // pid IPHostEntry hostEntry = null; @@ -625,13 +605,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres private static int SerializeAddrInfos(ServiceCtx context, ulong responseBufferPosition, ulong responseBufferSize, IPHostEntry hostEntry, int port) { - ulong originalBufferPosition = responseBufferPosition; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong bufferPosition = originalBufferPosition; - - byte[] hostName = Encoding.ASCII.GetBytes(hostEntry.HostName + '\0'); -#pragma warning restore IDE0059 - using WritableRegion region = context.Memory.GetWritableRegion(responseBufferPosition, (int)responseBufferSize); Span data = region.Memory.Span; diff --git a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs index 301d415a0..3070710b0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs @@ -1,4 +1,3 @@ -using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Services.Spl.Types; @@ -61,9 +60,6 @@ namespace Ryujinx.HLE.HOS.Services.Spl { configValue = default; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - SystemVersion version = context.Device.System.ContentManager.GetCurrentFirmwareVersion(); -#pragma warning restore IDE0059 MemorySize memorySize = context.Device.Configuration.MemoryConfiguration.ToKernelMemorySize(); switch (configItem) diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs index 763ab8d60..f00608297 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs @@ -50,10 +50,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl { private const uint ValidMagic = 0x546C7373; -#pragma warning disable CS0649 // Field is never assigned to public uint Magic; public uint EntriesCount; -#pragma warning restore CS0649 public readonly bool IsValid() { @@ -63,12 +61,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl private struct CertStoreFileEntry { -#pragma warning disable CS0649 // Field is never assigned to + public CaCertificateId Id; public TrustedCertStatus Status; public uint DataSize; public uint DataOffset; -#pragma warning restore CS0649 + } public class CertStoreEntry diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index 8f38f293f..df4ec11ba 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -21,9 +21,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl public ResultCode CreateContext(ServiceCtx context) { SslVersion sslVersion = (SslVersion)context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong pidPlaceholder = context.RequestData.ReadUInt64(); -#pragma warning restore IDE0059 + + _ = context.RequestData.ReadUInt64(); // pid MakeObject(context, new ISslContext(context.Request.HandleDesc.PId, sslVersion)); diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs index 7b371d299..a35be2cf0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/ISslContext.cs @@ -47,11 +47,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService { CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong certificateDataPosition = context.Request.SendBuff[0].Position; - ulong certificateDataSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 - context.ResponseData.Write(_serverCertificateId++); Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { certificateFormat }); @@ -63,11 +58,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService // ImportClientPki(buffer certificate, buffer ascii_password) -> u64 certificateId public ResultCode ImportClientPki(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong certificateDataPosition = context.Request.SendBuff[0].Position; - ulong certificateDataSize = context.Request.SendBuff[0].Size; -#pragma warning restore IDE0059 - ulong asciiPasswordDataPosition = context.Request.SendBuff[1].Position; ulong asciiPasswordDataSize = context.Request.SendBuff[1].Size; diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs index dc33dd6a5..2e39bf652 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs @@ -69,8 +69,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService EndSslOperation(); } - // NOTE: We silence warnings about TLS 1.0 and 1.1 as games will likely use it. -#pragma warning disable SYSLIB0039 private SslProtocols TranslateSslVersion(SslVersion version) { return (version & SslVersion.VersionMask) switch @@ -83,7 +81,6 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService _ => throw new NotImplementedException(version.ToString()), }; } -#pragma warning restore SYSLIB0039 /// /// Retrieve the hostname of the current remote in case the provided hostname is null or empty. diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs index 9afb26c65..4f0d8e21d 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs @@ -15,9 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger private readonly ITickSource _tickSource; -#pragma warning disable IDE0052 // Remove unread private member private uint _stickyTransform; -#pragma warning restore IDE0052 private uint _nextCallbackTicket; private uint _currentCallbackTicket; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs index 25c89baec..20cf2c754 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Parcel.cs @@ -50,9 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger public string ReadInterfaceToken() { // Ignore the policy flags -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int strictPolicy = ReadInt32(); -#pragma warning restore IDE0059 + _ = ReadInt32(); return ReadString16(); } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs index 0c69bf573..aa3b25ca5 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Status.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum Status diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index 8acc4d756..971778175 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -2,7 +2,6 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.PreciseSleep; -using Ryujinx.Cpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs index b26fb15d1..438c58b72 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/Color/ColorFormat.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger { enum ColorFormat : ulong diff --git a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs index c0b4ad292..5902432b0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Time.Clock { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TimeSpanType { private const long NanoSecondsPerSecond = 1000000000; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs index eaddf9cff..15a3a0206 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs @@ -83,9 +83,7 @@ namespace Ryujinx.HLE.HOS.Services.Time return ResultCode.PermissionDenied; } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - TimeSpanType internalOffset = context.RequestData.ReadStruct(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadStruct(); // internalOffset // TODO: set:sys SetExternalSteadyClockInternalOffset(internalOffset.ToSeconds()) diff --git a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs index ded2c3175..fcb434fae 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.HOS.Services.Time { public enum ResultCode diff --git a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs index b18a4f76c..f7eff6f9f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs @@ -248,9 +248,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong outBufferSize = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); context.ResponseData.Write(1); @@ -270,9 +267,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService if (resultCode == ResultCode.Success) { ulong outBufferPosition = context.Request.RecvListBuff[0].Position; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - ulong outBufferSize = context.Request.RecvListBuff[0].Size; -#pragma warning restore IDE0059 context.Memory.Write(outBufferPosition, posixTime); diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs index 346487030..7c76a82f6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeSharedMemory.cs @@ -14,9 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Time private Switch _device; private KSharedMemory _sharedMemory; private SharedMemoryStorage _timeSharedMemoryStorage; -#pragma warning disable IDE0052 // Remove unread private member + private int _timeSharedMemorySize; -#pragma warning restore IDE0052 private const uint SteadyClockContextOffset = 0x00; private const uint LocalSystemClockContextOffset = 0x38; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index dfacc8170..886d10197 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -649,22 +649,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - long theirDstOffset; - for (int i = 0; i < outRules.TimeCount; i++) - { - int j = outRules.Types[i]; - if (outRules.Ttis[j].IsDaySavingTime) - { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - theirDstOffset = -outRules.Ttis[j].GmtOffset; -#pragma warning restore IDE0059 - } - } - bool isDaySavingTime = false; -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long theirOffset = theirStdOffset; -#pragma warning restore IDE0059 + for (int i = 0; i < outRules.TimeCount; i++) { int j = outRules.Types[i]; @@ -681,16 +667,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - theirOffset = -outRules.Ttis[j].GmtOffset; - if (outRules.Ttis[j].IsDaySavingTime) + if (!outRules.Ttis[j].IsDaySavingTime) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - theirDstOffset = theirOffset; -#pragma warning restore IDE0059 - } - else - { - theirStdOffset = theirOffset; + theirStdOffset = -outRules.Ttis[j].GmtOffset; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs index 0e5d103d1..2e22feaa4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs @@ -29,10 +29,9 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService // CreateManagedLayer(u32, u64, nn::applet::AppletResourceUserId) -> u64 public ResultCode CreateManagedLayer(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long layerFlags = context.RequestData.ReadInt64(); - long displayId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // layerFlags + _ = context.RequestData.ReadInt64(); // displayId + long appletResourceUserId = context.RequestData.ReadInt64(); ulong pid = context.Device.System.AppletState.AppletResourceUserIds.GetData((int)appletResourceUserId); diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index 99c640aa0..a38bf902d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -231,14 +231,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService public ResultCode OpenLayer(ServiceCtx context) { // TODO: support multi display. -#pragma warning disable IDE0059 // Remove unnecessary value assignment - byte[] displayName = context.RequestData.ReadBytes(0x40); -#pragma warning restore IDE0059 - + _ = context.RequestData.ReadBytes(0x40); // display name long layerId = context.RequestData.ReadInt64(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long userId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // user id + ulong parcelPtr = context.Request.ReceiveBuff[0].Position; ResultCode result = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId, out IBinder producer); @@ -276,10 +272,8 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) public ResultCode CreateStrayLayer(ServiceCtx context) { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long layerFlags = context.RequestData.ReadInt64(); - long displayId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 + _ = context.RequestData.ReadInt64(); // layerFlags + _ = context.RequestData.ReadInt64(); // displayId ulong parcelPtr = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/TamperMachine.cs b/src/Ryujinx.HLE/HOS/TamperMachine.cs index 9b565b034..b6fa10190 100644 --- a/src/Ryujinx.HLE/HOS/TamperMachine.cs +++ b/src/Ryujinx.HLE/HOS/TamperMachine.cs @@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS { if (_tamperThread == null || !_tamperThread.IsAlive) { - _tamperThread = new Thread(this.TamperRunner) + _tamperThread = new Thread(TamperRunner) { Name = "HLE.TamperMachine", }; diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs index 9b6eb014e..8887c5ec7 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs @@ -1,5 +1,3 @@ -using System.Diagnostics.CodeAnalysis; - namespace Ryujinx.HLE.Loaders.Elf { enum ElfDynamicTag diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs index 8d4df8942..faffe4461 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol32 { -#pragma warning disable CS0649 // Field is never assigned to + public uint NameOffset; public uint ValueAddress; public uint Size; public byte Info; public byte Other; public ushort SectionIndex; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs index 45a753615..17781503f 100644 --- a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs +++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs @@ -2,13 +2,13 @@ namespace Ryujinx.HLE.Loaders.Elf { struct ElfSymbol64 { -#pragma warning disable CS0649 // Field is never assigned to + public uint NameOffset; public byte Info; public byte Other; public ushort SectionIndex; public ulong ValueAddress; public ulong Size; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs index 249f8dd9d..b2af85b4e 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs @@ -30,9 +30,8 @@ namespace Ryujinx.HLE.Loaders.Npdm { throw new InvalidNpdmException("FsAccessHeader is corrupted!"); } -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int contentOwnerIdSize = reader.ReadInt32(); -#pragma warning restore IDE0059 + + _ = reader.ReadInt32(); // contentOwnerId size int dataAndContentOwnerIdSize = reader.ReadInt32(); if (dataAndContentOwnerIdSize != 0x1c) diff --git a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs index 4a99de98c..59611100a 100644 --- a/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs +++ b/src/Ryujinx.HLE/Loaders/Npdm/Npdm.cs @@ -68,11 +68,10 @@ namespace Ryujinx.HLE.Loaders.Npdm stream.Seek(0x30, SeekOrigin.Current); int aci0Offset = reader.ReadInt32(); -#pragma warning disable IDE0059 // Remove unnecessary value assignment - int aci0Size = reader.ReadInt32(); + + _ = reader.ReadInt32(); // aci0 size int acidOffset = reader.ReadInt32(); - int acidSize = reader.ReadInt32(); -#pragma warning restore IDE0059 + _ = reader.ReadInt32(); // acid size Aci0 = new Aci0(stream, aci0Offset); Acid = new Acid(stream, acidOffset); diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index 23faca9d1..b043f29ef 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -9,7 +9,6 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.Memory; -using System; using System.Linq; using static Ryujinx.HLE.HOS.ModLoader; diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 53ccddc68..18b2b78d1 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -6,7 +6,6 @@ using Ryujinx.Cpu; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Processes.Extensions; using Ryujinx.Horizon.Common; -using System; namespace Ryujinx.HLE.Loaders.Processes { diff --git a/src/Ryujinx.HLE/MemoryConfiguration.cs b/src/Ryujinx.HLE/MemoryConfiguration.cs index 21ecd737f..4ff65584d 100644 --- a/src/Ryujinx.HLE/MemoryConfiguration.cs +++ b/src/Ryujinx.HLE/MemoryConfiguration.cs @@ -18,11 +18,11 @@ namespace Ryujinx.HLE { private const ulong GiB = 1024 * 1024 * 1024; -#pragma warning disable IDE0055 // Disable formatting public static MemoryArrange ToKernelMemoryArrange(this MemoryConfiguration configuration) { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB => MemoryArrange.MemoryArrange4GiB, MemoryConfiguration.MemoryConfiguration4GiBAppletDev => MemoryArrange.MemoryArrange4GiBAppletDev, MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemoryArrange.MemoryArrange4GiBSystemDev, @@ -31,6 +31,7 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemoryArrange.MemoryArrange8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemoryArrange.MemoryArrange12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } @@ -38,6 +39,7 @@ namespace Ryujinx.HLE { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => MemorySize.MemorySize4GiB, @@ -46,6 +48,7 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => MemorySize.MemorySize8GiB, MemoryConfiguration.MemoryConfiguration12GiB => MemorySize.MemorySize12GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } @@ -53,6 +56,7 @@ namespace Ryujinx.HLE { return configuration switch { +#pragma warning disable IDE0055 // Disable formatting MemoryConfiguration.MemoryConfiguration4GiB or MemoryConfiguration.MemoryConfiguration4GiBAppletDev or MemoryConfiguration.MemoryConfiguration4GiBSystemDev => 4 * GiB, @@ -61,8 +65,8 @@ namespace Ryujinx.HLE MemoryConfiguration.MemoryConfiguration8GiB => 8 * GiB, MemoryConfiguration.MemoryConfiguration12GiB => 12 * GiB, _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\"."), +#pragma warning restore IDE0055 }; } -#pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.HLE/StructHelpers.cs b/src/Ryujinx.HLE/StructHelpers.cs index dc9c6d727..ee299896d 100644 --- a/src/Ryujinx.HLE/StructHelpers.cs +++ b/src/Ryujinx.HLE/StructHelpers.cs @@ -17,7 +17,6 @@ namespace Ryujinx.HLE const int SizeOfApplicationTitle = 0x300; const int OffsetOfApplicationPublisherStrings = 0x200; - BlitStruct nacpData = new(1); // name and publisher buffer diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index bdcbe82c7..c9f16021a 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -77,11 +77,13 @@ namespace Ryujinx.HLE Hid = new Hid(this, System.HidStorage); Processes = new ProcessLoader(this); TamperMachine = new TamperMachine(); +#pragma warning restore IDE0055 System.InitializeServices(); System.State.SetLanguage(Configuration.SystemLanguage); System.State.SetRegion(Configuration.Region); - + +#pragma warning disable IDE0055 // Disable formatting VSyncMode = Configuration.VSyncMode; CustomVSyncInterval = Configuration.CustomVSyncInterval; TickScalar = TurboMode ? Configuration.TickScalar : ITickSource.RealityTickScalar; @@ -90,9 +92,9 @@ namespace Ryujinx.HLE System.EnablePtc = Configuration.EnablePtc; System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel; System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode; +#pragma warning restore IDE0055 UpdateVSyncInterval(); -#pragma warning restore IDE0055 Shared = this; } diff --git a/src/Ryujinx.HLE/UI/IHostUIHandler.cs b/src/Ryujinx.HLE/UI/IHostUIHandler.cs index b5c5cb168..68140dd54 100644 --- a/src/Ryujinx.HLE/UI/IHostUIHandler.cs +++ b/src/Ryujinx.HLE/UI/IHostUIHandler.cs @@ -63,7 +63,6 @@ namespace Ryujinx.HLE.UI /// IHostUITheme HostUITheme { get; } - /// /// Displays the player select dialog and returns the selected profile. /// diff --git a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs index 2a09001db..050bf5565 100644 --- a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs +++ b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs @@ -146,11 +146,15 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); List syscalls = []; + Dictionary isStaticMethod = new(); foreach (MethodDeclarationSyntax method in syntaxReceiver.SvcImplementations) { - GenerateMethod32(generator, context.Compilation, method); - GenerateMethod64(generator, context.Compilation, method); + bool isStatic = method.Modifiers.Any(SyntaxKind.StaticKeyword); + isStaticMethod[method.Identifier.Text] = isStatic; + + GenerateMethod32(generator, context.Compilation, method, isStatic); + GenerateMethod64(generator, context.Compilation, method, isStatic); foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList => attributeList.Attributes.Where(attribute => @@ -166,9 +170,9 @@ namespace Ryujinx.Horizon.Kernel.Generators syscalls.Sort(); - GenerateDispatch(generator, syscalls, A32Suffix); + GenerateDispatch(generator, syscalls, A32Suffix, isStaticMethod); generator.AppendLine(); - GenerateDispatch(generator, syscalls, A64Suffix); + GenerateDispatch(generator, syscalls, A64Suffix, isStaticMethod); generator.LeaveScope(); generator.LeaveScope(); @@ -193,9 +197,12 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.LeaveScope(); } - private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int index = 0; @@ -266,9 +273,10 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -289,7 +297,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -313,9 +321,12 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } - private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int registerIndex = 0; @@ -356,9 +367,10 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -374,7 +386,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -393,6 +405,55 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + { + GenerateMethod32(generator, compilation, method, false); + } + + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + { + GenerateMethod64(generator, compilation, method, false); + } + + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix, Dictionary isStaticMethod) + { + generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); + generator.EnterScope("switch (id)"); + + foreach (SyscallIdAndName syscall in syscalls) + { + generator.AppendLine($"case {syscall.Id}:"); + generator.IncreaseIndentation(); + + if (isStaticMethod.TryGetValue(syscall.Name, out bool isStatic) && isStatic) + { + generator.AppendLine($"{syscall.Name}{suffix}(context);"); + } + else + { + generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); + } + + generator.AppendLine("break;"); + + generator.DecreaseIndentation(); + } + + generator.AppendLine($"default:"); + generator.IncreaseIndentation(); + + generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); + + generator.DecreaseIndentation(); + + generator.LeaveScope(); + generator.LeaveScope(); + } + + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) + { + } + private static string GetFormattedLogValue(string value, string canonicalTypeName) { if (Is32BitInteger(canonicalTypeName)) @@ -463,33 +524,6 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine($"Logger.{logLevel}?.PrintMsg(LogClass.{logClass}, $\"{log}\");"); } - private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) - { - generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); - generator.EnterScope("switch (id)"); - - foreach (SyscallIdAndName syscall in syscalls) - { - generator.AppendLine($"case {syscall.Id}:"); - generator.IncreaseIndentation(); - - generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); - generator.AppendLine("break;"); - - generator.DecreaseIndentation(); - } - - generator.AppendLine($"default:"); - generator.IncreaseIndentation(); - - generator.AppendLine("throw new NotImplementedException($\"SVC 0x{id:X4} is not implemented.\");"); - - generator.DecreaseIndentation(); - - generator.LeaveScope(); - generator.LeaveScope(); - } - private static bool Is32BitInteger(string canonicalTypeName) { return canonicalTypeName is TypeSystemInt32 or TypeSystemUInt32; diff --git a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs index 583a04de3..89ba9d8e9 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs @@ -233,6 +233,8 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return Result.Success; } + // Remove this pragma warning when the methods are implemented +#pragma warning disable CA1822 // Mark members as static [CmifCommand(15)] // 17.0.0+ public Result AcquireAudioOutputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) { @@ -274,6 +276,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail return AudioResult.NotImplemented; } +#pragma warning restore CA1822 // Mark members as static protected virtual void Dispose(bool disposing) { diff --git a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs index 2146362df..bc913fd9c 100644 --- a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs +++ b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoder.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail OpusCodecFactory.AttemptToUseNativeLibrary = false; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct OpusPacketHeader { public uint Length; diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs index a2cbad6a6..9c431f73a 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/AccountNotificationSettings.cs @@ -4,12 +4,12 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct AccountNotificationSettings { -#pragma warning disable CS0649 // Field is never assigned to + public Uid UserId; public uint Flags; public byte FriendPresenceOverlayPermission; public byte FriendInvitationOverlayPermission; public ushort Reserved; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs index ec5c97c5a..a6f678565 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/BluetoothDevicesSettings.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Horizon.Sdk.Settings.System { struct BluetoothDevicesSettings { -#pragma warning disable CS0649 // Field is never assigned to + public Array6 BdAddr; public Array32 DeviceName; public Array3 ClassOfDevice; @@ -24,6 +24,6 @@ namespace Ryujinx.Horizon.Sdk.Settings.System public Array9 Brr; public Array256 Reserved; public Array43 Reserved2; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs index 2ce56c4df..e9b658ece 100644 --- a/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs +++ b/src/Ryujinx.Horizon/Sdk/Settings/System/NotificationSettings.cs @@ -21,10 +21,10 @@ namespace Ryujinx.Horizon.Sdk.Settings.System struct NotificationTime { -#pragma warning disable CS0649 // Field is never assigned to + public uint Hour; public uint Minute; -#pragma warning restore CS0649 + } [StructLayout(LayoutKind.Sequential, Size = 0x18, Pack = 0x4)] diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs index 23c1ce248..5fcaa4277 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifDomainOutHeader.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifDomainOutHeader { -#pragma warning disable CS0649 // Field is never assigned to + public uint ObjectsCount; public uint Padding; public uint Padding2; public uint Padding3; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs index ddceca030..f91be62c0 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifOutHeader.cs @@ -4,11 +4,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifOutHeader { -#pragma warning disable CS0649 // Field is never assigned to + public uint Magic; public uint Version; public Result Result; public uint Token; -#pragma warning restore CS0649 + } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs index 370341994..97eed615d 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/CmifRequestFormat.cs @@ -2,7 +2,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif { struct CmifRequestFormat { -#pragma warning disable CS0649 // Field is never assigned to public int ObjectId; public uint RequestId; public uint Context; @@ -19,6 +18,5 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif public int ObjectsCount; public int HandlesCount; public bool SendPid; -#pragma warning restore CS0649 } } diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs index 4e9628947..15c5678d6 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcBufferDescriptor.cs @@ -2,11 +2,10 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcBufferDescriptor { -#pragma warning disable CS0649 // Field is never assigned to + private readonly uint _sizeLow; private readonly uint _addressLow; private readonly uint _word2; -#pragma warning restore CS0649 public ulong Address => _addressLow | (((ulong)_word2 << 4) & 0xf00000000UL) | (((ulong)_word2 << 34) & 0x7000000000UL); public ulong Size => _sizeLow | ((ulong)_word2 << 8) & 0xf00000000UL; diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs index 9a7c23e9a..526e3dae1 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcReceiveListEntry.cs @@ -2,10 +2,9 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { readonly struct HipcReceiveListEntry { -#pragma warning disable IDE0052 // Remove unread private member + private readonly uint _addressLow; private readonly uint _word1; -#pragma warning restore IDE0052 public HipcReceiveListEntry(ulong address, ulong size) { diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs index faf5dc410..0cf58827d 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Hipc/HipcResult.cs @@ -16,6 +16,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc public static Result InvalidCmifRequest => new(ModuleId, 420); public static Result TargetNotDomain => new(ModuleId, 491); public static Result DomainObjectNotFound => new(ModuleId, 492); - #pragma warning restore IDE0055 +#pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs index a1e13aa45..80d239896 100644 --- a/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs +++ b/src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs @@ -1,6 +1,4 @@ using Ryujinx.Common.Configuration.Hid; -using Ryujinx.Common.Configuration.Hid.Controller; -using System; using System.Collections.Generic; using System.Linq; using System.Numerics; diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index 1cbf4d35c..078fe6b4d 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -21,9 +21,8 @@ namespace Ryujinx.Input.SDL2 private readonly Lock _userMappingLock = new(); -#pragma warning disable IDE0052 // Remove unread private member private readonly SDL2KeyboardDriver _driver; -#pragma warning restore IDE0052 + private StandardKeyboardInputConfig _configuration; private readonly List _buttonsUserMapping; diff --git a/src/Ryujinx.Input/IMouse.cs b/src/Ryujinx.Input/IMouse.cs index e20e7798d..19741b96f 100644 --- a/src/Ryujinx.Input/IMouse.cs +++ b/src/Ryujinx.Input/IMouse.cs @@ -8,9 +8,7 @@ namespace Ryujinx.Input /// public interface IMouse : IGamepad { -#pragma warning disable IDE0051 // Remove unused private member private const int SwitchPanelWidth = 1280; -#pragma warning restore IDE0051 private const int SwitchPanelHeight = 720; /// diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs index 41b40b177..5d4055753 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs @@ -113,7 +113,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFu - Uc.EmuStart(this.PC, -1, 0, (long)count); + Uc.EmuStart(PC, -1, 0, (long)count); } public void Step() @@ -141,7 +141,6 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_R15 ]; -#pragma warning disable IDE0051, IDE0052 // Remove unused private member private static readonly int[] _qRegisters = [ Arm.UC_ARM_REG_Q0, @@ -161,7 +160,6 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_Q14, Arm.UC_ARM_REG_Q15 ]; -#pragma warning restore IDE0051, IDE0052 public uint GetX(int index) { diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs index 8525b0446..22dd44b21 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch64.cs @@ -102,7 +102,7 @@ namespace Ryujinx.Tests.Unicorn public void RunForCount(ulong count) { // FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFul - Uc.EmuStart((long)this.PC, -1, 0, (long)count); + Uc.EmuStart((long)PC, -1, 0, (long)count); } public void Step() diff --git a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs index 5aa088e78..f55725c3b 100644 --- a/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs +++ b/src/Ryujinx.Tests/Common/Extensions/SequenceReaderExtensionsTests.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using Ryujinx.Common.Extensions; +using Ryujinx.Common.Utilities; using Ryujinx.Memory; using System; using System.Buffers; @@ -274,11 +275,12 @@ namespace Ryujinx.Tests.Common.Extensions public short EffectsSize; public int RenderInfoSize; - public unsafe fixed byte Reserved[16]; + //public unsafe fixed byte Reserved[16]; + public Buffer16 Reserved; public static readonly int SizeOf = Unsafe.SizeOf(); - public static unsafe MyUnmanagedStruct Generate(Random rng) + public static MyUnmanagedStruct Generate(Random rng) { const int BaseInt32Value = 0x1234abcd; const short BaseInt16Value = 0x5678; @@ -293,7 +295,8 @@ namespace Ryujinx.Tests.Common.Extensions RenderInfoSize = BaseInt32Value ^ rng.Next(), }; - Unsafe.Write(result.Reserved, rng.NextInt64()); + Span reservedSpan = result.Reserved.Bytes; + rng.NextBytes(reservedSpan); return result; } @@ -307,14 +310,7 @@ namespace Ryujinx.Tests.Common.Extensions assert(expected.EffectsSize, actual.EffectsSize); assert(expected.RenderInfoSize, actual.RenderInfoSize); - fixed (void* expectedReservedPtr = expected.Reserved) - fixed (void* actualReservedPtr = actual.Reserved) - { - long expectedReservedLong = Unsafe.Read(expectedReservedPtr); - long actualReservedLong = Unsafe.Read(actualReservedPtr); - - assert(expectedReservedLong, actualReservedLong); - } + assert(expected.Reserved, actual.Reserved); } } diff --git a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs index 207d28f50..3eb42d262 100644 --- a/src/Ryujinx.Tests/Memory/MockMemoryManager.cs +++ b/src/Ryujinx.Tests/Memory/MockMemoryManager.cs @@ -11,9 +11,7 @@ namespace Ryujinx.Tests.Memory public MemoryManagerType Type => MemoryManagerType.HostMappedUnsafe; -#pragma warning disable CS0067 // The event is never used public event Action UnmapEvent; -#pragma warning restore CS0067 public ref T GetRef(ulong va) where T : unmanaged { @@ -49,5 +47,12 @@ namespace Ryujinx.Tests.Memory { throw new NotImplementedException(); } + + // Since the mock never unmaps memory, the UnmapEvent is never used and this causes a warning. + // This method is provided to allow the mock to trigger the event if needed. + public void Unmap(ulong va, ulong size) + { + UnmapEvent?.Invoke(va, size); + } } } diff --git a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs index 92b994279..eb1080e50 100644 --- a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs +++ b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs @@ -11,7 +11,6 @@ using Ryujinx.Memory; using Ryujinx.Memory.Tracking; using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; diff --git a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs index 233ac2b6d..e99f70f5b 100644 --- a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs +++ b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs @@ -44,12 +44,12 @@ namespace Ryujinx.Ava.Common.Models if (obj == null) return false; - return this.Path == obj.Path; + return Path == obj.Path; } public override int GetHashCode() { - return this.Path.GetHashCode(); + return Path.GetHashCode(); } } } diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 09759d7cc..305e4acaa 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -119,7 +119,6 @@ namespace Ryujinx.Ava => ProcessUnhandledException(sender, e.Exception, false); AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit(); - // Setup base data directory. AppDataManager.Initialize(CommandLineState.BaseDirPathArg); @@ -160,7 +159,6 @@ namespace Ryujinx.Ava } } - public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false) { if (string.IsNullOrEmpty(gameId)) @@ -221,10 +219,7 @@ namespace Ryujinx.Ava } // When you first load the program, copy to remember the path for the global configuration - if (GlobalConfigurationPath == null) - { - GlobalConfigurationPath = ConfigurationPath; - } + GlobalConfigurationPath ??= ConfigurationPath; UseHardwareAcceleration = ConfigurationState.Instance.EnableHardwareAcceleration; @@ -342,7 +337,6 @@ namespace Ryujinx.Ava log.PrintMsg(LogClass.Application, message); } - if (isTerminating) Exit(); } diff --git a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs index 5656d6e73..e1fa47362 100644 --- a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs +++ b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs @@ -86,19 +86,17 @@ namespace Ryujinx.Ava.Systems.AppLibrary public string LocalizedStatusTooltip => Compatibility.Convert(x => -#pragma warning disable CS8509 // It is exhaustive for all possible values this can contain. LocaleManager.Instance[x.Status switch -#pragma warning restore CS8509 { LocaleKeys.CompatibilityListPlayable => LocaleKeys.CompatibilityListPlayableTooltip, LocaleKeys.CompatibilityListIngame => LocaleKeys.CompatibilityListIngameTooltip, LocaleKeys.CompatibilityListMenus => LocaleKeys.CompatibilityListMenusTooltip, LocaleKeys.CompatibilityListBoots => LocaleKeys.CompatibilityListBootsTooltip, LocaleKeys.CompatibilityListNothing => LocaleKeys.CompatibilityListNothingTooltip, + _ => throw new ArgumentOutOfRangeException(nameof(x.Status), "Unknown playability status.") }] ).OrElse(string.Empty); - [JsonIgnore] public string IdString => Id.ToString("x16"); [JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL; diff --git a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs index 8b207c6bd..38d42b5d4 100644 --- a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs +++ b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs @@ -11,7 +11,6 @@ namespace Ryujinx.Ava.Systems.AppLibrary LdnData = ldnData ?? []; } - public LdnGameData[] LdnData { get; set; } } } diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs index afabdb4e3..03fe69e83 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs @@ -44,7 +44,6 @@ namespace Ryujinx.Ava.Systems.Configuration configurationFileUpdated = true; } - EnableDiscordIntegration.Value = cff.EnableDiscordIntegration; UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only FocusLostActionType.Value = cff.FocusLostActionType; @@ -147,7 +146,7 @@ namespace Ryujinx.Ava.Systems.Configuration Hid.EnableMouse.Value = cff.EnableMouse; Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus : Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only Hid.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only - Hid.InputConfig.Value = cff.InputConfig ?? [] ; + Hid.InputConfig.Value = cff.InputConfig ?? []; Hid.RainbowSpeed.Value = cff.RainbowSpeed; Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId; diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index 29a390b26..2e0978e7e 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -326,7 +326,6 @@ namespace Ryujinx.Ava.Systems.Configuration /// public ReactiveObject MatchSystemTime { get; private set; } - /// /// Enable or disable use global input config (Independent from controllers binding) /// @@ -769,7 +768,7 @@ namespace Ryujinx.Ava.Systems.Configuration /// public static ConfigurationState Instance { get; private set; } - public static ConfigurationState InstanceExtra{ get; private set; } + public static ConfigurationState InstanceExtra { get; private set; } /// /// The UI section diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs index 4a565d5d3..a22ccdac4 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.cs @@ -15,13 +15,13 @@ namespace Ryujinx.Ava.Systems.Configuration { public static void Initialize() { - if (Instance != null || InstanceExtra!= null) + if (Instance != null || InstanceExtra != null) { throw new InvalidOperationException("Configuration is already initialized"); } Instance = new ConfigurationState(); - InstanceExtra= new ConfigurationState(); + InstanceExtra = new ConfigurationState(); } public ConfigurationFileFormat ToFileFormat() diff --git a/src/Ryujinx/Systems/Rebooter.cs b/src/Ryujinx/Systems/Rebooter.cs index ac22dfb15..5360edee9 100644 --- a/src/Ryujinx/Systems/Rebooter.cs +++ b/src/Ryujinx/Systems/Rebooter.cs @@ -1,11 +1,9 @@ using FluentAvalonia.UI.Controls; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Threading.Tasks; namespace Ryujinx.Ava.Systems diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index f49f60ab9..5f9f3ed96 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -1,4 +1,4 @@ -using Gommon; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common; @@ -57,10 +57,10 @@ namespace Ryujinx.Ava.Systems return default; } - if (CreateUpdateQueryUrl() is not {} updateUrl) + if (CreateUpdateQueryUrl() is not { } updateUrl) { Logger.Error?.Print(LogClass.Application, "Could not determine URL for updates."); - + _running = false; return default; @@ -110,7 +110,6 @@ namespace Ryujinx.Ava.Systems return default; } - if (!Version.TryParse(_buildVer, out Version newVersion)) { Logger.Error?.Print(LogClass.Application, @@ -127,7 +126,7 @@ namespace Ryujinx.Ava.Systems return (currentVersion, newVersion); } - + [JsonSerializable(typeof(UpdaterResponse))] partial class UpdaterResponseJsonContext : JsonSerializerContext; diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index 40c1da175..b9b58e0a9 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -5,19 +5,16 @@ using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models.Github; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.Utilities; using Ryujinx.Common; using Ryujinx.Common.Helper; using Ryujinx.Common.Logging; -using Ryujinx.Common.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Net; using System.Net.Http; using System.Net.NetworkInformation; using System.Runtime.CompilerServices; @@ -43,9 +40,9 @@ namespace Ryujinx.Ava.Systems private static bool _running; private static readonly string[] _windowsDependencyDirs = []; - + private static string _changelogUrlFormat = null; - + public static async Task BeginUpdateAsync(bool showVersionUpToDate = false) { if (_running) @@ -88,7 +85,7 @@ namespace Ryujinx.Ava.Systems try { buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0"); - + // GitLab instance is located in Ukraine. Connection times will vary across the world. buildSizeClient.Timeout = TimeSpan.FromSeconds(10); @@ -245,7 +242,7 @@ namespace Ryujinx.Ava.Systems } } - private static void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) + private static async void DoUpdateWithMultipleThreads(TaskDialog taskDialog, string downloadUrl, string updateFile) { // Multi-Threaded Updater long chunkSize = _buildSize / ConnectionCount; @@ -256,111 +253,95 @@ namespace Ryujinx.Ava.Systems int[] progressPercentage = new int[ConnectionCount]; List list = new(ConnectionCount); - List webClients = new(ConnectionCount); - for (int i = 0; i < ConnectionCount; i++) { list.Add([]); } + using HttpClient httpClient = ConstructHttpClient(); + List downloadTasks = new(); + for (int i = 0; i < ConnectionCount; i++) { -#pragma warning disable SYSLIB0014 - // TODO: WebClient is obsolete and need to be replaced with a more complex logic using HttpClient. - using WebClient client = new(); -#pragma warning restore SYSLIB0014 + int index = i; + long start = chunkSize * index; + long end = (index == ConnectionCount - 1) ? (chunkSize * (index + 1) - 1 + remainderChunk) : (chunkSize * (index + 1) - 1); - webClients.Add(client); - - if (i == ConnectionCount - 1) + downloadTasks.Add(Task.Run(async () => { - client.Headers.Add("Range", $"bytes={chunkSize * i}-{(chunkSize * (i + 1) - 1) + remainderChunk}"); - } - else - { - client.Headers.Add("Range", $"bytes={chunkSize * i}-{chunkSize * (i + 1) - 1}"); - } - - client.DownloadProgressChanged += (_, args) => - { - int index = (int)args.UserState; - - Interlocked.Add(ref totalProgressPercentage, -1 * progressPercentage[index]); - Interlocked.Exchange(ref progressPercentage[index], args.ProgressPercentage); - Interlocked.Add(ref totalProgressPercentage, args.ProgressPercentage); - - taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); - }; - - client.DownloadDataCompleted += (_, args) => - { - int index = (int)args.UserState; - - if (args.Cancelled) + try { - webClients[index].Dispose(); + HttpRequestMessage request = new(HttpMethod.Get, downloadUrl); + request.Headers.Range = new System.Net.Http.Headers.RangeHeaderValue(start, end); - taskDialog.Hide(); + using HttpResponseMessage response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + response.EnsureSuccessStatusCode(); - return; - } + using Stream contentStream = await response.Content.ReadAsStreamAsync(); + using MemoryStream memoryStream = new(); - list[index] = args.Result; - Interlocked.Increment(ref completedRequests); + byte[] buffer = new byte[32 * 1024]; + int bytesRead; + long totalRead = 0; + long totalSize = end - start + 1; - if (Equals(completedRequests, ConnectionCount)) - { - byte[] mergedFileBytes = new byte[_buildSize]; - for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) + while ((bytesRead = await contentStream.ReadAsync(buffer)) > 0) { - Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); - destinationOffset += list[connectionIndex].Length; + memoryStream.Write(buffer, 0, bytesRead); + totalRead += bytesRead; + + int progress = (int)(100 * totalRead / totalSize); + Interlocked.Add(ref totalProgressPercentage, -progressPercentage[index]); + progressPercentage[index] = progress; + Interlocked.Add(ref totalProgressPercentage, progress); + + taskDialog.SetProgressBarState(totalProgressPercentage / ConnectionCount, TaskDialogProgressState.Normal); } - File.WriteAllBytes(updateFile, mergedFileBytes); + list[index] = memoryStream.ToArray(); - // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. - if (OperatingSystem.IsMacOS()) + if (Interlocked.Increment(ref completedRequests) == ConnectionCount) { - using Process xattrProcess = Process.Start("xattr", - ["-d", "com.apple.quarantine", updateFile]); + byte[] mergedFileBytes = new byte[_buildSize]; + for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++) + { + Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length); + destinationOffset += list[connectionIndex].Length; + } - xattrProcess.WaitForExit(); - } + File.WriteAllBytes(updateFile, mergedFileBytes); - try - { - InstallUpdate(taskDialog, updateFile); - } - catch (Exception e) - { - Logger.Warning?.Print(LogClass.Application, e.Message); - Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); + // On macOS, ensure that we remove the quarantine bit to prevent Gatekeeper from blocking execution. + if (OperatingSystem.IsMacOS()) + { + using Process xattrProcess = Process.Start("xattr", + ["-d", "com.apple.quarantine", updateFile]); - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + xattrProcess.WaitForExit(); + } + + try + { + InstallUpdate(taskDialog, updateFile); + } + catch (Exception e) + { + Logger.Warning?.Print(LogClass.Application, e.Message); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); + } } } - }; - - try - { - client.DownloadDataAsync(new Uri(downloadUrl), i); - } - catch (WebException ex) - { - Logger.Warning?.Print(LogClass.Application, ex.Message); - Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); - - foreach (WebClient webClient in webClients) + catch (Exception ex) { - webClient.CancelAsync(); + Logger.Warning?.Print(LogClass.Application, ex.Message); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); + DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); } - - DoUpdateWithSingleThread(taskDialog, downloadUrl, updateFile); - - return; - } + })); } + + await Task.WhenAll(downloadTasks); } private static void DoUpdateWithSingleThreadWorker(TaskDialog taskDialog, string downloadUrl, string updateFile) diff --git a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs index ee0e884d2..74def97c6 100644 --- a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs +++ b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs @@ -118,7 +118,7 @@ namespace Ryujinx.Ava.UI.Applet await ContentDialogHelper.ShowWindowAsync(_mainWindow.SettingsWindow, _mainWindow); _mainWindow.SettingsWindow = null; - this.Close(); + Close(); }); } } diff --git a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs index c54cd390c..34e45114a 100644 --- a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs +++ b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs @@ -1,26 +1,5 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.Platform.Storage; -using CommunityToolkit.Mvvm.Input; -using LibHac.Fs; -using LibHac.Tools.FsSystem.NcaUtils; -using Ryujinx.Ava.Common; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models; -using Ryujinx.Ava.Systems.AppLibrary; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ava.UI.Views.Dialog; -using Ryujinx.Ava.UI.Windows; -using Ryujinx.Ava.Utilities; -using Ryujinx.Common.Configuration; -using Ryujinx.Common.Helper; -using Ryujinx.HLE.HOS; -using SkiaSharp; -using System; -using System.Collections.Generic; -using System.IO; -using Path = System.IO.Path; namespace Ryujinx.Ava.UI.Controls { diff --git a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs index c9d1c79c2..4d83da546 100644 --- a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs +++ b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs @@ -2,17 +2,15 @@ using Avalonia.Logging; using Avalonia.Utilities; using Gommon; using Ryujinx.Ava.Systems.Configuration; -using Ryujinx.Common.Logging; using System; using System.Text; +using AvaLogger = Avalonia.Logging.Logger; +using AvaLogLevel = Avalonia.Logging.LogEventLevel; +using RyuLogClass = Ryujinx.Common.Logging.LogClass; +using RyuLogger = Ryujinx.Common.Logging.Logger; namespace Ryujinx.Ava.UI.Helpers { - using AvaLogger = Avalonia.Logging.Logger; - using AvaLogLevel = LogEventLevel; - using RyuLogClass = LogClass; - using RyuLogger = Ryujinx.Common.Logging.Logger; - internal class LoggerAdapter : ILogSink { private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog; diff --git a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs index c7d217bf5..b5fda471c 100644 --- a/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs +++ b/src/Ryujinx/UI/Helpers/Win32NativeInterop.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -36,7 +35,7 @@ namespace Ryujinx.Ava.UI.Helpers [UnmanagedFunctionPointer(CallingConvention.Winapi)] internal delegate nint WindowProc(nint hWnd, WindowsMessages msg, nint wParam, nint lParam); - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct WndClassEx { public int cbSize; diff --git a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs index 526e63afe..477649909 100644 --- a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs @@ -257,7 +257,7 @@ namespace Ryujinx.Ava.UI.Models.Input Led = new LedConfigController { EnableLed = EnableLedChanging, - TurnOffLed = this.TurnOffLed, + TurnOffLed = TurnOffLed, UseRainbow = UseRainbowLed, LedColor = LedColor.ToUInt32() }, diff --git a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs index 0213d72fe..c8169b6d5 100644 --- a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs @@ -2,7 +2,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Keyboard; -using System.Xml.Linq; namespace Ryujinx.Ava.UI.Models.Input { diff --git a/src/Ryujinx/UI/Renderer/RendererHost.cs b/src/Ryujinx/UI/Renderer/RendererHost.cs index 9d24fbbad..7df02629e 100644 --- a/src/Ryujinx/UI/Renderer/RendererHost.cs +++ b/src/Ryujinx/UI/Renderer/RendererHost.cs @@ -37,7 +37,6 @@ namespace Ryujinx.Ava.UI.Renderer _ => throw new NotImplementedException() }; - private void Initialize() { EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated; diff --git a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs index 8a5ae441b..e24c574bb 100644 --- a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs @@ -1,10 +1,10 @@ using Gommon; +using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Systems; using Ryujinx.Ava.Systems.AppLibrary; using System; using System.Collections.Generic; using System.Linq; -using Ryujinx.Ava.Common.Locale; namespace Ryujinx.Ava.UI.ViewModels { @@ -30,19 +30,18 @@ namespace Ryujinx.Ava.UI.ViewModels public string BootsInfoText { get; set; } public string NothingInfoText { get; set; } - private IEnumerable _currentEntries = CompatibilityDatabase.Entries; private string[] _ownedGameTitleIds = []; - private Func _sortKeySelector = x => x.GameName; // Default sort by GameName + private readonly Func _sortKeySelector = x => x.GameName; // Default sort by GameName public IEnumerable CurrentEntries => OnlyShowOwnedGames ? _currentEntries.Where(x => x.TitleId.Check(tid => _ownedGameTitleIds.ContainsIgnoreCase(tid))) : _currentEntries; - public CompatibilityViewModel() {} + public CompatibilityViewModel() { } private void AppCountUpdated(object _, ApplicationCountUpdatedEventArgs __) => _ownedGameTitleIds = _appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray(); @@ -57,11 +56,11 @@ namespace Ryujinx.Ava.UI.ViewModels public void CountByStatus() { - PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); - InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); - MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); - BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); - NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); + PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable); + InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame); + MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus); + BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots); + NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing); _onlyShowOwnedGames = true; } @@ -87,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public void NameSorting(int nameSort = 0) { _sorting.Name = nameSort; @@ -162,6 +160,5 @@ namespace Ryujinx.Ava.UI.ViewModels }; } } - } } diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 81aae6b74..f96b8a138 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -1,7 +1,6 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Svg.Skia; -using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; using Gommon; using Ryujinx.Ava.Common.Locale; @@ -100,7 +99,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense"); public event Action NotifyChangesEvent; - + public string ChosenProfile { get => _chosenProfile; @@ -327,13 +326,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld])); } - - private void LoadConfiguration(InputConfig inputConfig = null) { if (UseGlobalConfig && Program.UseExtraConfig) { - Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); + Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId); } else { @@ -980,7 +977,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (Device == 0) { - newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == this.PlayerId)); + newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == PlayerId)); } else { diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 8b9b04511..06fb9c13a 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -57,7 +57,6 @@ using Key = Ryujinx.Input.Key; using MissingKeyException = LibHac.Common.Keys.MissingKeyException; using Path = System.IO.Path; using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState; -using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId; namespace Ryujinx.Ava.UI.ViewModels { @@ -1595,9 +1594,9 @@ namespace Ryujinx.Ava.UI.ViewModels // Code where conditions will be executed after loading user configuration if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit) { - Rebooter.RebootAppWithGame(application.Path, + Rebooter.RebootAppWithGame(application.Path, [ - "--bt", + "--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() ]); diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 654eb0c43..e684d6400 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -86,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle); public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1; - public int ResolutionScale { get => _resolutionScale; @@ -144,11 +143,11 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } public bool EnableMouse { get; set; } - public bool DisableInputWhenOutOfFocus { get; set; } + public bool DisableInputWhenOutOfFocus { get; set; } public int FocusLostActionType { get; set; } public bool UseGlobalInputConfig - { + { get => _useInputGlobalConfig; set { @@ -163,7 +162,7 @@ namespace Ryujinx.Ava.UI.ViewModels public VSyncMode VSyncMode { - get => _vSyncMode; + get => _vSyncMode; set { if (value is VSyncMode.Custom or VSyncMode.Switch or VSyncMode.Unbounded) @@ -226,7 +225,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnablePptc { get; set; } public bool EnableLowPowerPptc { get; set; } - public long TurboMultiplier { get => _turboModeMultiplier; @@ -577,7 +575,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void LoadCurrentConfiguration(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; // User Interface EnableDiscordIntegration = config.EnableDiscordIntegration; @@ -688,7 +686,7 @@ namespace Ryujinx.Ava.UI.ViewModels public void SaveSettings(bool global = false) { - ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance; + ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance; // User Interface config.EnableDiscordIntegration.Value = EnableDiscordIntegration; diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs index 02e6e99c9..c485699bd 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs @@ -100,7 +100,7 @@ namespace Ryujinx.Ava.UI.Views.Input { _currentAssigner = new ButtonKeyAssigner(button); - this.Focus(NavigationMethod.Pointer); + Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs index b9a5462b2..043222011 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Views.Settings { _currentAssigner = new ButtonKeyAssigner(button); - this.Focus(NavigationMethod.Pointer); + Focus(NavigationMethod.Pointer); PointerPressed += MouseClick; diff --git a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs index 283efd083..319015c70 100644 --- a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs @@ -1,6 +1,6 @@ using Avalonia.Controls; -using Ryujinx.Ava.Common.Locale; using Avalonia.Interactivity; +using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Systems.Configuration; using Ryujinx.Ava.UI.ViewModels; using System.Threading.Tasks; @@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows if (DataContext is not CompatibilityViewModel cvm) return; - cvm.NameSorting(int.Parse(sortStrategy)); + cvm.NameSorting(int.Parse(sortStrategy)); } } @@ -65,6 +65,5 @@ namespace Ryujinx.Ava.UI.Windows cvm.StatusSorting(int.Parse(sortStrategy)); } } - } } diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index a2d7ff657..0380cb596 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Windows InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver()); _ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it); - this.ScalingChanged += OnScalingChanged; + ScalingChanged += OnScalingChanged; } } @@ -157,7 +157,7 @@ namespace Ryujinx.Ava.UI.Windows private void OnScalingChanged(object sender, EventArgs e) { - Program.DesktopScaleFactor = this.RenderScaling; + Program.DesktopScaleFactor = RenderScaling; } private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e) @@ -563,16 +563,16 @@ namespace Ryujinx.Ava.UI.Windows public static void UpdateGraphicsConfig() { -#pragma warning disable IDE0055 // Disable formatting - GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 - ? ConfigurationState.Instance.Graphics.ResScaleCustom + + GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 + ? ConfigurationState.Instance.Graphics.ResScaleCustom : ConfigurationState.Instance.Graphics.ResScale; - GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; - GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; - GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; + GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy; + GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; + GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache; GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression; - GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; -#pragma warning restore IDE0055 + GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE; + } private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e) diff --git a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs index c6e8894e2..66cdc6125 100644 --- a/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs +++ b/src/Ryujinx/Utilities/SystemInfo/WindowsSystemInfo.cs @@ -43,7 +43,7 @@ namespace Ryujinx.Ava.Utilities.SystemInfo return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim(); } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct MemoryStatusEx { public uint Length; diff --git a/src/Spv.Generator/InstructionOperands.cs b/src/Spv.Generator/InstructionOperands.cs index 38c2b1f2c..7d6b064ad 100644 --- a/src/Spv.Generator/InstructionOperands.cs +++ b/src/Spv.Generator/InstructionOperands.cs @@ -21,11 +21,11 @@ namespace Spv.Generator { if (Count > InternalCount) { - return MemoryMarshal.CreateSpan(ref this.Overflow[0], Count); + return MemoryMarshal.CreateSpan(ref Overflow[0], Count); } else { - return MemoryMarshal.CreateSpan(ref this.Operand1, Count); + return MemoryMarshal.CreateSpan(ref Operand1, Count); } } @@ -33,7 +33,7 @@ namespace Spv.Generator { if (Count < InternalCount) { - MemoryMarshal.CreateSpan(ref this.Operand1, Count + 1)[Count] = operand; + MemoryMarshal.CreateSpan(ref Operand1, Count + 1)[Count] = operand; Count++; } else @@ -41,7 +41,7 @@ namespace Spv.Generator if (Overflow == null) { Overflow = new IOperand[InternalCount * 2]; - MemoryMarshal.CreateSpan(ref this.Operand1, InternalCount).CopyTo(Overflow.AsSpan()); + MemoryMarshal.CreateSpan(ref Operand1, InternalCount).CopyTo(Overflow.AsSpan()); } else if (Count == Overflow.Length) {