Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)

See merge request ryubing/ryujinx!47
This commit is contained in:
MrKev
2025-06-11 17:58:27 -05:00
committed by LotP
parent d03ae9c164
commit ea027d65a7
309 changed files with 1018 additions and 1247 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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));

View File

@@ -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)

View File

@@ -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<T> GetEnumerator()

View File

@@ -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
/// </summary>
public AppletSession GetConsumer()
{
return new AppletSession(this._outputData, this._inputData);
return new AppletSession(_outputData, _inputData);
}
}
}

View File

@@ -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
{

View File

@@ -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) { }

View File

@@ -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.

View File

@@ -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<ScreenShotAttribute>();
_ = context.RequestData.ReadStruct<ScreenShotAttribute>(); // 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;

View File

@@ -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;
}

View File

@@ -50,10 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs
// -> object<nn::fssrv::sf::IFileSystem> 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.

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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<nn::hid::IAppletResource>
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<NpadIdType, 9>)
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<byte, VibrationValue> 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<array<nn::hid::VibrationDeviceHandle>, type: 9>, buffer<array<nn::hid::VibrationValue>, 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)

View File

@@ -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;

View File

@@ -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<T> 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<AtomicStorage<T>> _storage;

View File

@@ -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
}
}

View File

@@ -23,9 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
public RingLifo<SixAxisSensorState> JoyLeftSixAxisSensor;
public RingLifo<SixAxisSensorState> 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<NpadGcTriggerState> GcTrigger;
public NpadLarkType LarkTypeLeftAndMain;
public NpadLarkType LarkTypeRight;

View File

@@ -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
}
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -1,5 +1,3 @@
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.Loader
{
enum ResultCode

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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()

View File

@@ -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;

View File

@@ -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<int>(position);

View File

@@ -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<bytes, 6>)
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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<u32>)
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<copy>
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.

View File

@@ -12,10 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
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;

View File

@@ -11,10 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
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;

View File

@@ -93,9 +93,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv
private NvResult GetIoctlArgument(ServiceCtx context, NvIoctl ioctlCommand, out Span<byte> 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<copy, process> current_process, handle<copy, transfer_memory> 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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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
}
}

View File

@@ -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<SubmitArguments>(ref arguments, 1)[0];
Span<CommandBuffer> commandBuffers = GetSpanAndSkip<CommandBuffer>(ref arguments, submitHeader.CmdBufsCount);
#pragma warning disable IDE0059 // Remove unnecessary value assignment
Span<Reloc> relocs = GetSpanAndSkip<Reloc>(ref arguments, submitHeader.RelocsCount);
Span<uint> relocShifts = GetSpanAndSkip<uint>(ref arguments, submitHeader.RelocsCount);
#pragma warning restore IDE0059
_ = GetSpanAndSkip<Reloc>(ref arguments, submitHeader.RelocsCount); // relocs
_ = GetSpanAndSkip<uint>(ref arguments, submitHeader.RelocsCount); // reloc shifts
Span<SyncptIncr> syncptIncrs = GetSpanAndSkip<SyncptIncr>(ref arguments, submitHeader.SyncptIncrsCount);
Span<uint> fenceThresholds = GetSpanAndSkip<uint>(ref arguments, submitHeader.FencesCount);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<uint> ColorDs;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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 =

View File

@@ -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<unknown, 6>, buffer<unknown, 6>, buffer<unknown, 6>)
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++)

View File

@@ -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)

View File

@@ -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))
{

View File

@@ -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<byte> 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<TimeVal>();
ulong receivePosition = context.Request.ReceiveBuff[0].Position;

View File

@@ -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;

View File

@@ -1,5 +1,3 @@
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{
enum WsaError

View File

@@ -1,5 +1,3 @@
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
{
enum BsdSocketOption

View File

@@ -1,5 +1,3 @@
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
{
enum LinuxError

View File

@@ -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;
}
}

View File

@@ -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<AddrInfoSerialized> 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<byte> data = region.Memory.Span;

View File

@@ -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)

View File

@@ -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

View File

@@ -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));

View File

@@ -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<bytes, 5> certificate, buffer<bytes, 5> 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;

View File

@@ -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
/// <summary>
/// Retrieve the hostname of the current remote in case the provided hostname is null or empty.

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -1,5 +1,3 @@
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
enum Status

View File

@@ -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;

Some files were not shown because too many files have changed in this diff Show More