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

This reverts merge request !47
This commit is contained in:
GreemDev
2025-06-15 20:45:26 -05:00
parent faf9e3cdd7
commit 77a797f154
307 changed files with 1245 additions and 1016 deletions

View File

@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -18,7 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
// TODO: Determine where and how NetworkServiceAccountId is set.
private const long NetworkServiceAccountId = 0xcafe;
#pragma warning disable IDE0052 // Remove unread private member
private readonly UserId _userId;
#pragma warning restore IDE0052
private byte[] _cachedTokenData;
private DateTime _cachedTokenExpiry;
@@ -125,8 +128,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
public ResultCode LoadIdTokenCache(ServiceCtx context)
{
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
#pragma warning restore IDE0059
// NOTE: This opens the file at "su/cache/USERID_IN_UUID_STRING.dat" (where USERID_IN_UUID_STRING is formatted as "%08x-%04x-%04x-%02x%02x-%08x%04x")
// in the "account:/" savedata and writes some data in the buffer.
@@ -152,11 +156,6 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
byte[] tokenData = _cachedTokenData;
if ((ulong)tokenData.Length > bufferSize)
{
return ResultCode.InvalidIdTokenCacheBufferSize;
}
context.Memory.Write(bufferPosition, tokenData);
context.ResponseData.Write(tokenData.Length);

View File

@@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
public readonly record struct UserId
{
public readonly long High;

View File

@@ -10,8 +10,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetExpectedMasterVolume(f32, f32)
public ResultCode SetExpectedMasterVolume(ServiceCtx context)
{
_ = context.RequestData.ReadSingle(); // applet volume
_ = context.RequestData.ReadSingle(); // library applet volume
#pragma warning disable IDE0059 // Remove unnecessary value assignment
float appletVolume = context.RequestData.ReadSingle();
float libraryAppletVolume = context.RequestData.ReadSingle();
#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceAm);
@@ -44,9 +46,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// ChangeMainAppletMasterVolume(f32, u64)
public ResultCode ChangeMainAppletMasterVolume(ServiceCtx context)
{
// Unknown parameters.
_ = context.RequestData.ReadSingle();
_ = context.RequestData.ReadInt64();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
float unknown0 = context.RequestData.ReadSingle();
long unknown1 = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceAm);
@@ -57,8 +60,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetTransparentVolumeRate(f32)
public ResultCode SetTransparentVolumeRate(ServiceCtx context)
{
// Unknown parameter.
_ = context.RequestData.ReadSingle();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
float unknown0 = context.RequestData.ReadSingle();
#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceAm);

View File

@@ -18,8 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
private readonly Apm.SystemManagerServer _apmSystemManagerServer;
private bool _vrModeEnabled;
#pragma warning disable CS0414, IDE0052 // Remove unread private member
private bool _lcdBacklighOffEnabled;
private bool _requestExitToLibraryAppletAtExecuteNextProgramEnabled;
#pragma warning restore CS0414, IDE0052
private int _messageEventHandle;
private int _displayResolutionChangedEventHandle;

View File

@@ -12,8 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
public ResultCode CreateLibraryApplet(ServiceCtx context)
{
AppletId appletId = (AppletId)context.RequestData.ReadInt32();
_ = context.RequestData.ReadInt32(); // libraryAppletMode
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int libraryAppletMode = context.RequestData.ReadInt32();
#pragma warning restore IDE0059
MakeObject(context, new ILibraryAppletAccessor(appletId, context.Device.System));

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
{
Push(item);
this.Push(item);
return true;
}
@@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
public bool TryTake(out T item)
{
return TryPop(out item);
return this.TryPop(out item);
}
public T Peek()
@@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
public void CopyTo(Array array, int index)
{
CopyTo((T[])array, index);
this.CopyTo((T[])array, index);
}
public IEnumerator<T> GetEnumerator()

View File

@@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
public void Push(byte[] item)
{
if (!TryPush(item))
if (!this.TryPush(item))
{
// TODO(jduncanator): Throw a proper exception
throw new InvalidOperationException();
@@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
public byte[] Pop()
{
if (TryPop(out byte[] item))
if (this.TryPop(out byte[] item))
{
return item;
}
@@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
/// </summary>
public AppletSession GetConsumer()
{
return new AppletSession(_outputData, _inputData);
return new AppletSession(this._outputData, this._inputData);
}
}
}

View File

@@ -8,8 +8,9 @@ namespace Ryujinx.HLE.HOS.Services.Arp
public int Version;
public byte BaseGameStorageId;
public byte UpdateGameStorageId;
#pragma warning disable CS0649 // Field is never assigned to
public short Padding;
#pragma warning restore CS0649
public static ApplicationLaunchProperty Default
{

View File

@@ -10,7 +10,9 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth
[Service("btdrv")]
class IBluetoothDriver : IpcService
{
#pragma warning disable CS0414, IDE0052 // Remove unread private member
private string _unknownLowEnergy;
#pragma warning restore CS0414, IDE0052
public IBluetoothDriver(ServiceCtx context) { }

View File

@@ -23,8 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Caps
public ResultCode SetShimLibraryVersion(ServiceCtx context)
{
ulong shimLibraryVersion = context.RequestData.ReadUInt64();
_ = context.RequestData.ReadUInt64(); // applet Resource user id
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong appletResourceUserId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
// TODO: Service checks if the pid is present in an internal list and returns ResultCode.BlacklistedPid if it is.
// The list contents needs to be determined.

View File

@@ -20,13 +20,15 @@ namespace Ryujinx.HLE.HOS.Services.Caps
public ResultCode SaveScreenShotEx0(ServiceCtx context)
{
// TODO: Use the ScreenShotAttribute.
_ = context.RequestData.ReadStruct<ScreenShotAttribute>(); // screenShotAttribute
_ = context.RequestData.ReadUInt32(); // unknown
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ScreenShotAttribute screenShotAttribute = context.RequestData.ReadStruct<ScreenShotAttribute>();
uint unknown = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
ulong appletResourceUserId = context.RequestData.ReadUInt64();
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pidPlaceholder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
ulong screenshotDataPosition = context.Request.SendBuff[0].Position;
ulong screenshotDataSize = context.Request.SendBuff[0].Size;

View File

@@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Fatal
Logger.Info?.Print(LogClass.ServiceFatal, errorReport.ToString());
Kernel.SupervisorCall.Syscall.Break((ulong)resultCode);
context.Device.System.KernelContext.Syscall.Break((ulong)resultCode);
return ResultCode.Success;
}

View File

@@ -50,10 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs
// -> object<nn::fssrv::sf::IFileSystem> contentFs
public ResultCode OpenFileSystemWithId(ServiceCtx context)
{
_ = (FileSystemType)context.RequestData.ReadInt32(); // fileSystemType
_ = context.RequestData.ReadUInt64(); // titleId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32();
ulong titleId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
string switchPath = ReadUtf8String(context);
string fullPath = FileSystem.VirtualFileSystem.SwitchPathToSystemPath(switchPath);
@@ -793,9 +793,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs
public ResultCode OpenDataStorageByDataId(ServiceCtx context)
{
StorageId storageId = (StorageId)context.RequestData.ReadByte();
_ = context.RequestData.ReadBytes(7); // Skip 7 bytes of padding.
#pragma warning disable IDE0059 // Remove unnecessary value assignment
byte[] padding = context.RequestData.ReadBytes(7);
#pragma warning restore IDE0059
ulong titleId = context.RequestData.ReadUInt64();
// We do a mitm here to find if the request is for an AOC.

View File

@@ -101,6 +101,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result;
result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result;
#pragma warning restore IDE0055
return result;
}

View File

@@ -254,7 +254,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
switch (type)
{
#pragma warning disable IDE0055 // Disable formatting
case ControllerType.ProController:
controller.StyleSet = NpadStyleTag.FullKey;

View File

@@ -8,7 +8,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
// ActivateVibrationDevice(nn::hid::VibrationDeviceHandle)
public ResultCode ActivateVibrationDevice(ServiceCtx context)
{
_ = context.RequestData.ReadInt32(); // vibrationDeviceHandle
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int vibrationDeviceHandle = context.RequestData.ReadInt32();
#pragma warning restore IDE0059
return ResultCode.Success;
}

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,7 +64,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// CreateAppletResource(nn::applet::AppletResourceUserId) -> object<nn::hid::IAppletResource>
public ResultCode CreateAppletResource(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem));
@@ -733,6 +735,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag
public ResultCode GetSupportedNpadStyleSet(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
long appletResourceUserId = context.RequestData.ReadInt64();
context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets);
@@ -746,8 +751,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array<NpadIdType, 9>)
public ResultCode SetSupportedNpadIdType(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
ulong arrayPosition = context.Request.PtrBuff[0].Position;
ulong arraySize = context.Request.PtrBuff[0].Size;
@@ -898,7 +904,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType)
public ResultCode SetNpadJoyHoldType(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64();
@@ -924,7 +932,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType
public ResultCode GetNpadJoyHoldType(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
{
@@ -945,8 +955,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
{
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
context.RequestData.BaseStream.Position += 4; // Padding
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
if (HidUtils.IsValidNpadIdType(npadIdType))
{
@@ -979,8 +990,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
{
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
context.RequestData.BaseStream.Position += 4; // Padding
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
if (HidUtils.IsValidNpadIdType(npadIdType))
{
@@ -1219,7 +1231,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
FrequencyHigh = context.RequestData.ReadSingle(),
};
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
Dictionary<byte, VibrationValue> dualVibrationValues = new()
{
@@ -1243,7 +1257,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
Reserved = context.RequestData.ReadByte(),
};
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position);
@@ -1288,7 +1304,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// SendVibrationValues(nn::applet::AppletResourceUserId, buffer<array<nn::hid::VibrationDeviceHandle>, type: 9>, buffer<array<nn::hid::VibrationValue>, type: 9>)
public ResultCode SendVibrationValues(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size];
@@ -1378,8 +1396,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId)
public ResultCode IsVibrationDeviceMounted(ServiceCtx context)
{
_ = context.RequestData.ReadInt32(); // VibrationDeviceHandle
_ = context.RequestData.ReadInt64(); // appletResourceUserId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int vibrationDeviceHandle = context.RequestData.ReadInt32();
long appletResourceUserId = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
// NOTE: Service use vibrationDeviceHandle to get the PlayerIndex.
// And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown)

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct BusHandle
{
public int AbstractedPadId;

View File

@@ -1,18 +1,20 @@
using Ryujinx.Common.Memory;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct RingLifo<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,22 +1,19 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TouchState
{
public ulong DeltaTime;
#pragma warning disable CS0649 // Field is never assigned to
public TouchAttribute Attribute;
#pragma warning restore CS0649
public uint FingerId;
public uint X;
public uint Y;
public uint DiameterX;
public uint DiameterY;
public uint RotationAngle;
#pragma warning disable CS0169, IDE0051 // Remove unused private member
private readonly uint _reserved;
#pragma warning restore CS0169, IDE0051
}
}

View File

@@ -129,8 +129,9 @@ namespace Ryujinx.HLE.HOS.Services
}
}
_ = context.RequestData.ReadInt64(); // sfci magic
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long sfciMagic = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
int commandId = (int)context.RequestData.ReadInt64();
bool serviceExists = service.CmifCommands.TryGetValue(commandId, out MethodInfo processRequest);

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, Socket.RemoteEndPoint);
_protocol.Read(ref _buffer, ref _bufferEnd, buffer, (int)offset, (int)size, this.Socket.RemoteEndPoint);
}
protected override void OnError(SocketError error)
@@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy
{
try
{
if (endPoint.Equals(Socket.RemoteEndPoint))
if (endPoint.Equals(this.Socket.RemoteEndPoint))
{
NodeInfo = info;
_protocol.InvokeAccept(this);

View File

@@ -1,3 +1,5 @@
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,7 +1,6 @@
using LibHac.Ncm;
using LibHac.Tools.FsSystem.NcaUtils;
using Ryujinx.HLE.FileSystem;
using System;
using System.Text;
using static Ryujinx.HLE.Utilities.StringUtils;
@@ -229,16 +228,12 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager
if (!string.IsNullOrWhiteSpace(contentPath))
{
ulong position = context.Request.RecvListBuff[0].Position;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong size = context.Request.RecvListBuff[0].Size;
#pragma warning restore IDE0059
byte[] contentPathBuffer = Encoding.UTF8.GetBytes(contentPath);
if ((ulong)contentPathBuffer.Length > size)
{
throw new InvalidOperationException("Content path buffer size is too small.");
}
context.Memory.Write(position, contentPathBuffer);
}
else
@@ -252,8 +247,9 @@ namespace Ryujinx.HLE.HOS.Services.Ncm.Lr.LocationResolverManager
private void DeleteContentPath(ServiceCtx context, ulong titleId, NcaContentType contentType)
{
ContentManager contentManager = context.Device.System.ContentManager;
//string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual);
#pragma warning disable IDE0059 // Remove unnecessary value assignment
string contentPath = contentManager.GetInstalledContentPath(titleId, _storageId, NcaContentType.Manual);
#pragma warning restore IDE0059
contentManager.ClearEntry(titleId, NcaContentType.Manual, _storageId);
}

View File

@@ -339,6 +339,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath());
public static DateTime DateTimeFromTag(ushort dateTimeTag)
{
try

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.");
data = new byte[540];
Array.Copy(dumpData, data, dumpData.Length);
dataMasterKey = dataKey;
tagMasterKey = tagKey;
this.data = new byte[540];
Array.Copy(dumpData, this.data, dumpData.Length);
this.dataMasterKey = dataKey;
this.tagMasterKey = tagKey;
this.isLocked = isLocked;
if (!isLocked)
@@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
// Append data based on magic size
int append = 16 - key.MagicSize;
byte[] extract = new byte[16];
Array.Copy(data, 0x011, extract, 0, 2); // Extract two bytes from user data section
Array.Copy(this.data, 0x011, extract, 0, 2); // Extract two bytes from user data section
for (int i = 2; i < 16; i++)
{
extract[i] = 0x00;
@@ -57,13 +57,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
// Extract the UID (UID is 8 bytes)
byte[] uid = new byte[8];
Array.Copy(data, 0x000, uid, 0, 8);
Array.Copy(this.data, 0x000, uid, 0, 8);
seed.AddRange(uid);
seed.AddRange(uid);
// Extract some tag data (pages 0x20 - 0x28)
byte[] user = new byte[32];
Array.Copy(data, 0x060, user, 0, 32);
Array.Copy(this.data, 0x060, user, 0, 32);
// XOR it with the key padding (XorPad)
byte[] paddedUser = new byte[32];
@@ -137,10 +137,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
private void DeriveKeysAndCipher()
{
// Derive HMAC Tag Key
hmacTagKey = DeriveKey(tagMasterKey, false, out _, out _);
this.hmacTagKey = DeriveKey(this.tagMasterKey, false, out _, out _);
// Derive HMAC Data Key and AES Key/IV
hmacDataKey = DeriveKey(dataMasterKey, true, out aesKey, out aesIv);
this.hmacDataKey = DeriveKey(this.dataMasterKey, true, out aesKey, out aesIv);
}
private void DecryptData()

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,8 +482,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
// Flush(bytes<8, 4>)
public ResultCode Flush(ServiceCtx context)
{
_ = (uint)context.RequestData.ReadUInt64(); // Device handle
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint deviceHandle = (uint)context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
if (context.Device.System.NfpDevices.Count == 0)
{
return ResultCode.DeviceNotFound;

View File

@@ -155,6 +155,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context)
{
ulong position = context.Request.PtrBuff[0].Position;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong size = context.Request.PtrBuff[0].Size;
#pragma warning restore IDE0059
int clientId = context.Memory.Read<int>(position);

View File

@@ -21,7 +21,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
private int _event0Handle;
private int _event1Handle;
#pragma warning disable IDE0052 // Remove unread private member
private readonly uint _version;
#pragma warning restore IDE0052
public IRequest(Horizon system, uint version)
{
@@ -116,7 +118,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
// GetAppletInfo(u32) -> (u32, u32, u32, buffer<bytes, 6>)
public ResultCode GetAppletInfo(ServiceCtx context)
{
_ = context.RequestData.ReadUInt32(); // Theme color
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint themeColor = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceNifm);

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct InternetConnectionStatus
{
public InternetConnectionType Type;

View File

@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct IpV4Address
{
public uint Address;

View File

@@ -44,6 +44,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// CountAddOnContent(pid) -> u32
public ResultCode CountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
return CountAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId);
@@ -53,6 +57,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer<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);
@@ -71,6 +79,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// GetAddOnContentBaseId(pid) -> u64
public ResultCode GetAddOnContentBaseId(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
return GetAddOnContentBaseIdImpl(context, context.Device.Processes.ActiveApplication.ProgramId);
@@ -89,6 +101,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// PrepareAddOnContent(u32 index, pid)
public ResultCode PrepareAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
return PrepareAddOnContentImpl(context, context.Device.Processes.ActiveApplication.ProgramId);
@@ -115,6 +131,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// GetAddOnContentListChangedEventWithProcessId(pid) -> handle<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.
@@ -132,6 +152,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// NotifyMountAddOnContent(pid, u64 title_id)
public ResultCode NotifyMountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
ulong aocTitleId = context.RequestData.ReadUInt64();
@@ -148,6 +172,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// NotifyUnmountAddOnContent(pid, u64 title_id)
public ResultCode NotifyUnmountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
ulong aocTitleId = context.RequestData.ReadUInt64();
@@ -161,6 +189,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// CheckAddOnContentMountStatus(pid)
public ResultCode CheckAddOnContentMountStatus(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
// Then it does some internal checks and returns InvalidBufferSize if they fail.

View File

@@ -12,9 +12,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
public ResultCode GetApplicationControlData(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // source
_ = context.RequestData.ReadUInt64(); // titleId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
byte source = (byte)context.RequestData.ReadInt64();
ulong titleId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
ulong position = context.Request.ReceiveBuff[0].Position;

View File

@@ -11,9 +11,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
public ResultCode GetApplicationControlData(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // source
_ = context.RequestData.ReadUInt64(); // titleId
#pragma warning disable IDE0059 // Remove unnecessary value assignment
byte source = (byte)context.RequestData.ReadInt64();
ulong titleId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
ulong position = context.Request.ReceiveBuff[0].Position;

View File

@@ -93,8 +93,9 @@ 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);
(_, ulong outputDataSize) = context.Request.GetBufferType0x22(0);
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong outputDataPosition, ulong outputDataSize) = context.Request.GetBufferType0x22(0);
#pragma warning restore IDE0059
NvIoctl.Direction ioctlDirection = ioctlCommand.DirectionValue;
uint ioctlSize = ioctlCommand.Size;
@@ -306,8 +307,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv
// Initialize(u32 transfer_memory_size, handle<copy, process> current_process, handle<copy, transfer_memory> transfer_memory) -> u32 error_code
public ResultCode Initialize(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // transfer memory size
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long transferMemSize = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
int transferMemHandle = context.Request.HandleDesc.ToCopy[1];
// TODO: When transfer memory will be implemented, this could be removed.
@@ -429,7 +431,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv
// SetClientPID(u64, pid) -> u32 error_code
public ResultCode SetClientPid(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long pid = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
context.ResponseData.Write(0);

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct AllocSpaceArguments
{
public uint Pages;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct BindChannelArguments
{
public int Fd;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct FreeSpaceArguments
{
public ulong Offset;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct VaRegion
{
public ulong Offset;
@@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
public ulong Pages;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GetVaRegionsArguments
{
public ulong Unused;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct InitializeExArguments
{
public uint Flags;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct MapBufferExArguments
{
public AddressSpaceFlags Flags;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct RemapArguments
{
public ushort Flags;

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,9 +19,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
private const uint MaxModuleSyncpoint = 16;
#pragma warning disable IDE0052 // Remove unread private member
private uint _timeout;
private uint _submitTimeout;
private uint _timeslice;
#pragma warning restore IDE0052
private readonly Switch _device;
@@ -145,10 +147,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
{
SubmitArguments submitHeader = GetSpanAndSkip<SubmitArguments>(ref arguments, 1)[0];
Span<CommandBuffer> commandBuffers = GetSpanAndSkip<CommandBuffer>(ref arguments, submitHeader.CmdBufsCount);
_ = GetSpanAndSkip<Reloc>(ref arguments, submitHeader.RelocsCount); // relocs
_ = GetSpanAndSkip<uint>(ref arguments, submitHeader.RelocsCount); // reloc shifts
#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
Span<SyncptIncr> syncptIncrs = GetSpanAndSkip<SyncptIncr>(ref arguments, submitHeader.SyncptIncrsCount);
Span<uint> fenceThresholds = GetSpanAndSkip<uint>(ref arguments, submitHeader.FencesCount);

View File

@@ -8,10 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
{
internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile
{
#pragma warning disable IDE0052 // Remove unread private member
private readonly KEvent _smExceptionBptIntReportEvent;
private readonly KEvent _smExceptionBptPauseReportEvent;
private readonly KEvent _errorNotifierEvent;
#pragma warning restore IDE0052
private int _smExceptionBptIntReportEventHandle;
private int _smExceptionBptPauseReportEventHandle;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct AllocGpfifoExArguments
{
public uint NumEntries;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct AllocObjCtxArguments
{
public uint ClassNumber;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GetParameterArguments
{
public uint Parameter;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct CommandBufferHandle
{
public int MapHandle;

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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct CommandBuffer
{
public int Mem;
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
public int WordsCount;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct Reloc
{
public int CmdbufMem;
@@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
public int TargetOffset;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct SyncptIncr
{
public uint Id;
@@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
public uint Reserved3;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct SubmitArguments
{
public int CmdBufsCount;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct SubmitGpfifoArguments
{
public long Address;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct ZcullBindArguments
{
public ulong GpuVirtualAddress;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct EventWaitArguments
{
public NvFence Fence;

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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GpuCharacteristics
{
public int Arch;
@@ -44,13 +44,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
struct CharacteristicsHeader
{
#pragma warning disable CS0649 // Field is never assigned to
public long BufferSize;
public long BufferAddress;
#pragma warning restore CS0649
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GetCharacteristicsArguments
{
public CharacteristicsHeader Header;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GetGpuTimeArguments
{
public ulong Timestamp;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct GetTpcMasksArguments
{
public int MaskBufferSize;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NumVsmsArguments
{
public uint NumVsms;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct VsmsMappingArguments
{
public byte Sm0GpcIndex;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct ZbcSetTableArguments
{
public Array4<uint> ColorDs;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct ZcullGetCtxSizeArguments
{
public int Size;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct ZcullGetInfoArguments
{
public int WidthAlignPixels;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapAlloc
{
public int Handle;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapCreate
{
public uint Size;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapFree
{
public int Handle;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapFromId
{
public int Id;

View File

@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapGetId
{
public int Id;

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, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvMapParam
{
public int Handle;

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Nv
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
struct NvIoctl
{
public const int NvHostCustomMagic = 0x00;

View File

@@ -11,6 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
private readonly int _permissionFlag;
private ulong _titleId;
private ParentalControlFlagValue _parentalControlFlag;
#pragma warning disable IDE0052, CS0414 // Remove unread private member
private int[] _ratingAge;
// TODO: Find where they are set.
@@ -19,6 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
private bool _freeCommunicationEnabled = false;
private readonly bool _stereoVisionRestrictionConfigurable = true;
private bool _stereoVisionRestriction = false;
#pragma warning restore IDE0052, CS0414
public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag)
{
@@ -176,6 +178,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
return ResultCode.PermissionDenied;
}
#pragma warning disable // Remove unnecessary value assignment
bool stereoVisionRestriction = false;
if (_stereoVisionRestrictionConfigurable)

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,7 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
// RequestLoad(u32)
public ResultCode RequestLoad(ServiceCtx context)
{
_ = (SharedFontType)context.RequestData.ReadInt32(); // font type
#pragma warning disable IDE0059 // Remove unnecessary value assignment
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
#pragma warning restore IDE0059
// We don't need to do anything here because we do lazy initialization
// on SharedFontManager (the font is loaded when necessary).
@@ -28,7 +30,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
// GetLoadState(u32) -> u32
public ResultCode GetLoadState(ServiceCtx context)
{
_ = (SharedFontType)context.RequestData.ReadInt32(); // font type
#pragma warning disable IDE0059 // Remove unnecessary value assignment
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
#pragma warning restore IDE0059
// 1 (true) indicates that the font is already loaded.
// All fonts are already loaded.
@@ -82,8 +86,9 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
// GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer<unknown, 6>, buffer<unknown, 6>, buffer<unknown, 6>)
public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context)
{
_ = context.RequestData.ReadInt64(); // language code
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long languageCode = context.RequestData.ReadInt64();
#pragma warning restore IDE0059
int loadedCount = 0;
for (SharedFontType type = 0; type < SharedFontType.Count; type++)

View File

@@ -377,8 +377,9 @@ namespace Ryujinx.HLE.HOS.Services
else if (request.Type is IpcMessageType.CmifControl or
IpcMessageType.CmifControlWithContext)
{
_ = (uint)_requestDataReader.ReadUInt64(); // magic
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint magic = (uint)_requestDataReader.ReadUInt64();
#pragma warning restore IDE0059
uint cmdId = (uint)_requestDataReader.ReadUInt64();
switch (cmdId)

View File

@@ -214,8 +214,10 @@ namespace Ryujinx.HLE.HOS.Services.Sm
context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin);
_ = (context.RequestData.ReadInt32() & 1) != 0; // is light
_ = context.RequestData.ReadInt32(); // max sessions
#pragma warning disable IDE0059 // Remove unnecessary value assignment
bool isLight = (context.RequestData.ReadInt32() & 1) != 0;
int maxSessions = context.RequestData.ReadInt32();
#pragma warning restore IDE0059
if (string.IsNullOrEmpty(name))
{

View File

@@ -353,8 +353,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
int timeout = context.RequestData.ReadInt32();
(ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21();
(ulong outputBufferPosition, _) = context.Request.GetBufferType0x22();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize)
{
@@ -602,8 +603,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32();
(ulong sendPosition, ulong sendSize) = context.Request.GetBufferType0x21(0);
(ulong bufferPosition, _) = context.Request.GetBufferType0x21(1);
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(1);
#pragma warning restore IDE0059
ReadOnlySpan<byte> sendBuffer = context.Memory.GetSpan(sendPosition, (int)sendSize);
@@ -632,7 +634,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
(ulong bufferPos, _) = context.Request.GetBufferType0x22();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -675,7 +679,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
(ulong bufferPosition, _) = context.Request.GetBufferType0x21();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -696,7 +702,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
(ulong bufferPosition, _) = context.Request.GetBufferType0x21();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -717,7 +725,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
(ulong bufferPosition, _) = context.Request.GetBufferType0x22();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -744,7 +754,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
(ulong bufferPos, _) = context.Request.GetBufferType0x22();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -816,8 +828,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32();
_ = context.RequestData.ReadInt32(); // buffer count
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int bufferCount = context.RequestData.ReadInt32();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@@ -829,7 +842,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
case BsdIoctl.AtMark:
errno = LinuxError.SUCCESS;
(ulong bufferPosition, _) = context.Request.GetBufferType0x22();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
// FIXME: OOB not implemented.
context.Memory.Write(bufferPosition, 0);
@@ -1021,8 +1036,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public ResultCode DuplicateSocket(ServiceCtx context)
{
int fd = context.RequestData.ReadInt32();
_ = context.RequestData.ReadUInt64(); // Padding, not used.
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong reserved = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
LinuxError errno = LinuxError.ENOENT;
int newSockFd = -1;
@@ -1049,9 +1065,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
int socketFd = context.RequestData.ReadInt32();
int vlen = context.RequestData.ReadInt32();
BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32();
_ = context.RequestData.ReadUInt32(); // Padding, not used.
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint reserved = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
TimeVal timeout = context.RequestData.ReadStruct<TimeVal>();
ulong receivePosition = context.Request.ReceiveBuff[0].Position;

View File

@@ -2,6 +2,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy;
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;

View File

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

View File

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

View File

@@ -1,3 +1,5 @@
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,6 +28,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
public ResultCode SetDnsAddressesPrivateRequest(ServiceCtx context)
{
uint cancelHandleRequest = context.RequestData.ReadUInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong bufferPosition = context.Request.SendBuff[0].Position;
ulong bufferSize = context.Request.SendBuff[0].Size;
#pragma warning restore IDE0059
// TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness.
Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest });
@@ -40,6 +44,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
public ResultCode GetDnsAddressPrivateRequest(ServiceCtx context)
{
uint cancelHandleRequest = context.RequestData.ReadUInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
#pragma warning restore IDE0059
// TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake of completeness.
Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest });
@@ -162,8 +170,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
// GetCancelHandleRequest(u64, pid) -> u32
public ResultCode GetCancelHandleRequest(ServiceCtx context)
{
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pidPlaceHolder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
uint cancelHandleRequest = 0;
context.ResponseData.Write(cancelHandleRequest);
@@ -178,8 +187,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
public ResultCode CancelRequest(ServiceCtx context)
{
uint cancelHandleRequest = context.RequestData.ReadUInt32();
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pidPlaceHolder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { cancelHandleRequest });
@@ -293,9 +303,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
// TODO: Use params.
bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0;
_ = context.RequestData.ReadInt32(); // Timeout
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int timeOut = context.RequestData.ReadInt32();
ulong pidPlaceholder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
if (withOptions)
{
@@ -392,10 +403,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
context.Memory.Read(inputBufferPosition, rawIp);
// TODO: Use params.
_ = context.RequestData.ReadUInt32(); // socket length
_ = context.RequestData.ReadUInt32(); // type
_ = context.RequestData.ReadInt32(); // timeout
_ = context.RequestData.ReadUInt64(); // pid placeholder
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint socketLength = context.RequestData.ReadUInt32();
uint type = context.RequestData.ReadUInt32();
int timeOut = context.RequestData.ReadInt32();
ulong pidPlaceholder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
if (withOptions)
{
@@ -493,8 +506,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
ulong optionsBufferSize)
{
bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0;
_ = context.RequestData.ReadUInt32(); // Cancel handle request
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint cancelHandle = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
string host = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[0].Position, (long)context.Request.SendBuff[0].Size);
string service = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[1].Position, (long)context.Request.SendBuff[1].Size);
@@ -509,15 +523,21 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
}
// NOTE: We ignore hints for now.
_ = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size); // hints
#pragma warning disable IDE0059 // Remove unnecessary value assignment
List<AddrInfoSerialized> hints = DeserializeAddrInfos(context.Memory, context.Request.SendBuff[2].Position, context.Request.SendBuff[2].Size);
#pragma warning restore IDE0059
if (withOptions)
{
// TODO: Find unknown, Parse and use options.
_ = context.RequestData.ReadUInt32(); // unknown
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint unknown = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
}
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pidPlaceHolder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
IPHostEntry hostEntry = null;
@@ -605,6 +625,13 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
private static int SerializeAddrInfos(ServiceCtx context, ulong responseBufferPosition, ulong responseBufferSize, IPHostEntry hostEntry, int port)
{
ulong originalBufferPosition = responseBufferPosition;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong bufferPosition = originalBufferPosition;
byte[] hostName = Encoding.ASCII.GetBytes(hostEntry.HostName + '\0');
#pragma warning restore IDE0059
using WritableRegion region = context.Memory.GetWritableRegion(responseBufferPosition, (int)responseBufferSize);
Span<byte> data = region.Memory.Span;

View File

@@ -1,3 +1,4 @@
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Services.Spl.Types;
@@ -60,6 +61,9 @@ namespace Ryujinx.HLE.HOS.Services.Spl
{
configValue = default;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
SystemVersion version = context.Device.System.ContentManager.GetCurrentFirmwareVersion();
#pragma warning restore IDE0059
MemorySize memorySize = context.Device.Configuration.MemoryConfiguration.ToKernelMemorySize();
switch (configItem)

View File

@@ -50,8 +50,10 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
{
private const uint ValidMagic = 0x546C7373;
#pragma warning disable CS0649 // Field is never assigned to
public uint Magic;
public uint EntriesCount;
#pragma warning restore CS0649
public readonly bool IsValid()
{
@@ -61,12 +63,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
private struct CertStoreFileEntry
{
#pragma warning disable CS0649 // Field is never assigned to
public CaCertificateId Id;
public TrustedCertStatus Status;
public uint DataSize;
public uint DataOffset;
#pragma warning restore CS0649
}
public class CertStoreEntry

View File

@@ -21,8 +21,9 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
public ResultCode CreateContext(ServiceCtx context)
{
SslVersion sslVersion = (SslVersion)context.RequestData.ReadUInt32();
_ = context.RequestData.ReadUInt64(); // pid
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pidPlaceholder = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
MakeObject(context, new ISslContext(context.Request.HandleDesc.PId, sslVersion));

View File

@@ -47,6 +47,11 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
{
CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong certificateDataPosition = context.Request.SendBuff[0].Position;
ulong certificateDataSize = context.Request.SendBuff[0].Size;
#pragma warning restore IDE0059
context.ResponseData.Write(_serverCertificateId++);
Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { certificateFormat });
@@ -58,6 +63,11 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
// ImportClientPki(buffer<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,6 +69,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
EndSslOperation();
}
// NOTE: We silence warnings about TLS 1.0 and 1.1 as games will likely use it.
#pragma warning disable SYSLIB0039
private SslProtocols TranslateSslVersion(SslVersion version)
{
return (version & SslVersion.VersionMask) switch
@@ -81,6 +83,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
_ => throw new NotImplementedException(version.ToString()),
};
}
#pragma warning restore SYSLIB0039
/// <summary>
/// Retrieve the hostname of the current remote in case the provided hostname is null or empty.

View File

@@ -15,7 +15,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
private readonly ITickSource _tickSource;
#pragma warning disable IDE0052 // Remove unread private member
private uint _stickyTransform;
#pragma warning restore IDE0052
private uint _nextCallbackTicket;
private uint _currentCallbackTicket;

View File

@@ -50,7 +50,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
public string ReadInterfaceToken()
{
// Ignore the policy flags
_ = ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int strictPolicy = ReadInt32();
#pragma warning restore IDE0059
return ReadString16();
}

View File

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

View File

@@ -2,6 +2,7 @@ using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Common.PreciseSleep;
using Ryujinx.Cpu;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;

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