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

@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Applets
{
#pragma warning disable CS0649 // Field is never assigned to
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ControllerSupportArgHeader
{
@ -14,5 +14,4 @@ namespace Ryujinx.HLE.HOS.Applets
public byte EnableSingleMode;
public byte EnableIdentificationColor;
}
#pragma warning restore CS0649
}

View file

@ -1,6 +1,6 @@
namespace Ryujinx.HLE.HOS.Applets
{
#pragma warning disable CS0649 // Field is never assigned to
struct ControllerSupportArgPrivate
{
public uint PrivateSize;
@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets
public uint NpadStyleSet;
public uint NpadJoyHoldType;
}
#pragma warning restore CS0649
}

View file

@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Applets
{
#pragma warning disable CS0649 // Field is never assigned to
// (8.0.0+ version)
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ControllerSupportArgV7
@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81);
}
}
#pragma warning restore CS0649
}

View file

@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Applets
{
#pragma warning disable CS0649 // Field is never assigned to
// (1.0.0+ version)
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ControllerSupportArgVPre7
@ -22,5 +22,4 @@ namespace Ryujinx.HLE.HOS.Applets
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81);
}
}
#pragma warning restore CS0649
}

View file

@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Applets
{
#pragma warning disable CS0649 // Field is never assigned to
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ControllerSupportResultInfo
{
@ -12,5 +12,4 @@ namespace Ryujinx.HLE.HOS.Applets
public uint SelectedId;
public uint Result;
}
#pragma warning restore CS0649
}

View file

@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
{
return systemLanguage switch
{
#pragma warning disable IDE0055 // Disable formatting
#pragma warning disable IDE0055 // Disable formatting
SystemLanguage.Japanese => "ja",
SystemLanguage.AmericanEnglish => "en-US",
SystemLanguage.French => "fr",

View file

@ -12,9 +12,8 @@ namespace Ryujinx.HLE.HOS.Applets
private readonly Horizon _system;
private AppletSession _normalSession;
#pragma warning disable IDE0052 // Remove unread private member
private AppletSession _interactiveSession;
#pragma warning restore IDE0052
public event EventHandler AppletStateChanged;

View file

@ -43,11 +43,11 @@ namespace Ryujinx.HLE.HOS.Applets
private SoftwareKeyboardConfig _keyboardForegroundConfig;
// Configuration for background (inline) mode.
#pragma warning disable IDE0052 // Remove unread private member
private SoftwareKeyboardInitialize _keyboardBackgroundInitialize;
private SoftwareKeyboardCustomizeDic _keyboardBackgroundDic;
private SoftwareKeyboardDictSet _keyboardBackgroundDictSet;
#pragma warning restore IDE0052
private SoftwareKeyboardUserWord[] _keyboardBackgroundUserWords;
private byte[] _transferMemory;

View file

@ -6,9 +6,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
// TODO: Compute inside the Demangler
public BaseNode Reference;
#pragma warning disable IDE0052 // Remove unread private member
private readonly int _index;
#pragma warning restore IDE0052
public ForwardTemplateReference(int index) : base(NodeType.ForwardTemplateReference)
{

View file

@ -36,11 +36,10 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager;
namespace Ryujinx.HLE.HOS
{
using TimeServiceManager = Services.Time.TimeManager;
public class Horizon : IDisposable
{
internal const int HidSize = 0x40000;

View file

@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
class KLightClientSession : KAutoObject
{
#pragma warning disable IDE0052 // Remove unread private member
private readonly KLightSession _parent;
#pragma warning restore IDE0052
public KLightClientSession(KernelContext context, KLightSession parent) : base(context)
{

View file

@ -4,9 +4,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
class KLightServerSession : KAutoObject
{
#pragma warning disable IDE0052 // Remove unread private member
private readonly KLightSession _parent;
#pragma warning restore IDE0052
public KLightServerSession(KernelContext context, KLightSession parent) : base(context)
{

View file

@ -8,9 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
public KServerPort ServerPort { get; }
public KClientPort ClientPort { get; }
#pragma warning disable IDE0052 // Remove unread private member
private readonly string _name;
#pragma warning restore IDE0052
private readonly ChannelState _state;

View file

@ -86,11 +86,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30];
#pragma warning disable IDE0052 // Remove unread private member
private readonly ulong _heapAddress;
private readonly ulong _heapSize;
private ulong _usedSize;
#pragma warning restore IDE0052
private readonly int _blocksCount;
private readonly Block[] _blocks;

View file

@ -1,5 +1,4 @@
using System;
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.HLE.HOS.Kernel.Process
{

View file

@ -1,7 +1,9 @@
using Ryujinx.HLE.HOS.Kernel.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct MemoryInfo
{
public ulong Address;
@ -11,9 +13,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
public KMemoryPermission Permission;
public int IpcRefCount;
public int DeviceRefCount;
#pragma warning disable CS0414, IDE0052 // Remove unread private member
private readonly int _padding;
#pragma warning restore CS0414, IDE0052
public MemoryInfo(
ulong address,

View file

@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x5f)]
public Result FlushProcessDataCache(int processHandle, ulong address, ulong size)
public static Result FlushProcessDataCache(int processHandle, ulong address, ulong size)
{
// FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0.
// As we don't support (and don't actually need) to flush the cache, this is stubbed.
@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x22)]
public Result SendSyncRequestWithUserBuffer(
public static Result SendSyncRequestWithUserBuffer(
[PointerSized] ulong messagePtr,
[PointerSized] ulong messageSize,
int handle)
@ -901,7 +901,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(2)]
public Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
public static Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
{
if (!PageAligned(address))
{
@ -934,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(3)]
public Result SetMemoryAttribute(
public static Result SetMemoryAttribute(
[PointerSized] ulong address,
[PointerSized] ulong size,
MemoryAttribute attributeMask,
@ -983,7 +983,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(4)]
public Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size)
public static Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size)
{
if (!PageAligned(src | dst))
{
@ -1020,7 +1020,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(5)]
public Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size)
public static Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size)
{
if (!PageAligned(src | dst))
{
@ -1057,7 +1057,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(6)]
public Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address)
public static Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address)
{
Result result = QueryMemory(out MemoryInfo info, out pageInfo, address);
@ -1092,7 +1092,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x13)]
public Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
public static Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
{
if (!PageAligned(address))
{
@ -1139,7 +1139,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x14)]
public Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size)
public static Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size)
{
if (!PageAligned(address))
{
@ -1244,7 +1244,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x51)]
public Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
public static Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission)
{
if (!PageAligned(address))
{
@ -1291,7 +1291,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x52)]
public Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size)
public static Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size)
{
if (!PageAligned(address))
{
@ -1332,7 +1332,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x2c)]
public Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size)
public static Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size)
{
if (!PageAligned(address))
{
@ -1368,7 +1368,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x2d)]
public Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size)
public static Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size)
{
if (!PageAligned(address))
{
@ -1445,7 +1445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x4c)]
public Result ControlCodeMemory(
public static Result ControlCodeMemory(
int handle,
CodeMemoryOperation op,
ulong address,
@ -1524,7 +1524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x73)]
public Result SetProcessMemoryPermission(
public static Result SetProcessMemoryPermission(
int handle,
ulong src,
ulong size,
@ -1566,7 +1566,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x74)]
public Result MapProcessMemory(
public static Result MapProcessMemory(
[PointerSized] ulong dst,
int handle,
ulong src,
@ -1623,7 +1623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x75)]
public Result UnmapProcessMemory(
public static Result UnmapProcessMemory(
[PointerSized] ulong dst,
int handle,
ulong src,
@ -1669,7 +1669,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x77)]
public Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size)
public static Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size)
{
if (!PageAligned(dst) || !PageAligned(src))
{
@ -1707,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x78)]
public Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size)
public static Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size)
{
if (!PageAligned(dst) || !PageAligned(src))
{
@ -1752,7 +1752,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
// System
[Svc(0x7b)]
public Result TerminateProcess(int handle)
public static Result TerminateProcess(int handle)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -1782,7 +1782,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(7)]
public void ExitProcess()
public static void ExitProcess()
{
KernelStatic.GetCurrentProcess().TerminateCurrentProcess();
}
@ -1878,7 +1878,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x26)]
public void Break(ulong reason)
public static void Break(ulong reason)
{
KThread currentThread = KernelStatic.GetCurrentThread();
@ -1905,7 +1905,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x27)]
public void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size)
public static void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2371,7 +2371,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x30)]
public Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource)
public static Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource)
{
limitValue = 0;
@ -2393,7 +2393,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x31)]
public Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource)
public static Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource)
{
limitValue = 0;
@ -2415,7 +2415,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x37)]
public Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource)
public static Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource)
{
peak = 0;
@ -2447,7 +2447,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x7e)]
public Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue)
public static Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue)
{
if (resource >= LimitableResource.Count)
{
@ -2542,7 +2542,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(9)]
public Result StartThread(int handle)
public static Result StartThread(int handle)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2570,7 +2570,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0xa)]
public void ExitThread()
public static void ExitThread()
{
KThread currentThread = KernelStatic.GetCurrentThread();
@ -2602,7 +2602,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0xc)]
public Result GetThreadPriority(out int priority, int handle)
public static Result GetThreadPriority(out int priority, int handle)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2623,7 +2623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0xd)]
public Result SetThreadPriority(int handle, int priority)
public static Result SetThreadPriority(int handle, int priority)
{
// TODO: NPDM check.
@ -2642,7 +2642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0xe)]
public Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle)
public static Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2665,7 +2665,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0xf)]
public Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask)
public static Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask)
{
KProcess currentProcess = KernelStatic.GetCurrentProcess();
@ -2714,13 +2714,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x10)]
public int GetCurrentProcessorNumber()
public static int GetCurrentProcessorNumber()
{
return KernelStatic.GetCurrentThread().CurrentCore;
}
[Svc(0x25)]
public Result GetThreadId(out ulong threadUid, int handle)
public static Result GetThreadId(out ulong threadUid, int handle)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2741,7 +2741,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x32)]
public Result SetThreadActivity(int handle, bool pause)
public static Result SetThreadActivity(int handle, bool pause)
{
KProcess process = KernelStatic.GetCurrentProcess();
@ -2766,7 +2766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x33)]
public Result GetThreadContext3([PointerSized] ulong address, int handle)
public static Result GetThreadContext3([PointerSized] ulong address, int handle)
{
KProcess currentProcess = KernelStatic.GetCurrentProcess();
KThread currentThread = KernelStatic.GetCurrentThread();
@ -2931,7 +2931,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x1a)]
public Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle)
public static Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle)
{
if (IsPointingInsideKernel(mutexAddress))
{
@ -2949,7 +2949,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x1b)]
public Result ArbitrateUnlock([PointerSized] ulong mutexAddress)
public static Result ArbitrateUnlock([PointerSized] ulong mutexAddress)
{
if (IsPointingInsideKernel(mutexAddress))
{
@ -2967,7 +2967,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x1c)]
public Result WaitProcessWideKeyAtomic(
public static Result WaitProcessWideKeyAtomic(
[PointerSized] ulong mutexAddress,
[PointerSized] ulong condVarAddress,
int handle,
@ -2998,7 +2998,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x1d)]
public Result SignalProcessWideKey([PointerSized] ulong address, int count)
public static Result SignalProcessWideKey([PointerSized] ulong address, int count)
{
KProcess currentProcess = KernelStatic.GetCurrentProcess();
@ -3008,7 +3008,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x34)]
public Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout)
public static Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout)
{
if (IsPointingInsideKernel(address))
{
@ -3040,7 +3040,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x35)]
public Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count)
public static Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count)
{
if (IsPointingInsideKernel(address))
{
@ -3067,7 +3067,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
[Svc(0x36)]
public Result SynchronizePreemptionState()
public static Result SynchronizePreemptionState()
{
KernelStatic.GetCurrentThread().SynchronizePreemptionState();

View file

@ -1,8 +1,10 @@
using ARMeilleure.State;
using Ryujinx.Common.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ThreadContext
{
public Array29<ulong> Registers;
@ -11,9 +13,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
public ulong Sp;
public ulong Pc;
public uint Pstate;
#pragma warning disable CS0169, IDE0051 // Remove unused private member
private readonly uint _padding;
#pragma warning restore CS0169, IDE0051
public Array32<V128> FpuRegisters;
public uint Fpcr;
public uint Fpsr;

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

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