Revert "misc: chore: Remove redundant code"

This reverts commit 05a88ccc94.
This commit is contained in:
KeatonTheBot
2025-03-15 20:00:22 -05:00
parent 7960ea643f
commit efd5a104b6
109 changed files with 412 additions and 271 deletions
@@ -4,6 +4,7 @@ using Ryujinx.Common.Utilities;
using Ryujinx.HLE.HOS.Services.Account.Acc.Types;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
@@ -26,21 +26,21 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// TODO: Determine where those fields are used.
#pragma warning disable IDE0052 // Remove unread private member
private bool _screenShotPermission;
private bool _operationModeChangedNotification;
private bool _performanceModeChangedNotification;
private bool _restartMessageEnabled;
private bool _outOfFocusSuspendingEnabled;
private bool _handlesRequestToDisplay;
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;
private bool _autoSleepDisabled = false;
#pragma warning disable IDE0052 // Remove unread private member
private bool _albumImageTakenNotificationEnabled;
private bool _recordVolumeMuted;
private bool _albumImageTakenNotificationEnabled = false;
private bool _recordVolumeMuted = false;
private uint _screenShotImageOrientation;
private uint _screenShotImageOrientation = 0;
#pragma warning restore IDE0052
private uint _idleTimeDetectionExtension;
private uint _idleTimeDetectionExtension = 0;
public ISelfController(ServiceCtx context, ulong pid)
{
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
[Service("irs")]
class IIrSensorServer : IpcService
{
private int _irsensorSharedMemoryHandle;
private int _irsensorSharedMemoryHandle = 0;
public IIrSensorServer(ServiceCtx context) { }
@@ -10,8 +10,8 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Lp2p
{
private readonly KEvent _stateChangeEvent;
private readonly KEvent _jointEvent;
private int _stateChangeEventHandle;
private int _jointEventHandle;
private int _stateChangeEventHandle = 0;
private int _jointEventHandle = 0;
public ISfServiceMonitor(ServiceCtx context)
{
@@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
{
public bool NeedsRealId => true;
private static InitializeMessage InitializeMemory;
private static InitializeMessage InitializeMemory = new InitializeMessage();
private const int InactiveTimeout = 6000;
private const int FailureTimeout = 4000;
@@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
private readonly int _headerSize = Marshal.SizeOf<LdnHeader>();
private readonly byte[] _buffer = new byte[MaxPacketSize];
private int _bufferEnd;
private int _bufferEnd = 0;
// Client Packets.
public event Action<LdnHeader, InitializeMessage> Initialize;
@@ -312,6 +312,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
break;
}
default:
break;
}
}
@@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii
class MiiDatabaseManager
{
private readonly bool _isTestModeEnabled = false;
private uint _mountCounter;
private uint _mountCounter = 0;
private const ulong DatabaseTestSaveDataId = 0x8000000000000031;
private const ulong DatabaseSaveDataId = 0x8000000000000030;
@@ -7,6 +7,7 @@ using Ryujinx.HLE.HOS.Services.Mii.Types;
using Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption;
using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -13,9 +13,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{
private readonly GeneralServiceDetail _generalServiceDetail;
private IPInterfaceProperties _targetPropertiesCache;
private UnicastIPAddressInformation _targetAddressInfoCache;
private string _cacheChosenInterface;
private IPInterfaceProperties _targetPropertiesCache = null;
private UnicastIPAddressInformation _targetAddressInfoCache = null;
private string _cacheChosenInterface = null;
public IGeneralService()
{
@@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
private IVirtualMemoryManager _clientMemory;
private ulong _owner;
private bool _transferMemInitialized;
private bool _transferMemInitialized = false;
// TODO: This should call set:sys::GetDebugModeFlag
private readonly bool _debugModeEnabled = false;
@@ -17,9 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
// TODO: Find where they are set.
private readonly bool _restrictionEnabled = false;
private readonly bool _featuresRestriction = false;
private bool _freeCommunicationEnabled;
private bool _freeCommunicationEnabled = false;
private readonly bool _stereoVisionRestrictionConfigurable = true;
private bool _stereoVisionRestriction;
private bool _stereoVisionRestriction = false;
#pragma warning restore IDE0052, CS0414
public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag)
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst
[Service("clkrst:i")] // 8.0.0+
class IClkrstManager : IpcService
{
private int _moduleStateTableEventHandle;
private int _moduleStateTableEventHandle = 0;
public IClkrstManager(ServiceCtx context) { }
+2 -2
View File
@@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services
private KProcess _selfProcess;
private KThread _selfThread;
private KEvent _wakeEvent;
private int _wakeHandle;
private int _wakeHandle = 0;
private readonly ReaderWriterLockSlim _handleLock = new();
private readonly Dictionary<int, IpcService> _sessions = new();
@@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services
private readonly MemoryStream _responseDataStream;
private readonly BinaryWriter _responseDataWriter;
private int _isDisposed;
private int _isDisposed = 0;
public ManualResetEvent InitDone { get; }
public string Name { get; }
@@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
[Service("bsd:s", true)]
[Service("bsd:u", false)]
class IClient(ServiceCtx context, bool isPrivileged) : IpcService(context.Device.System.BsdServer)
class IClient : IpcService
{
private static readonly List<IPollManager> _pollManagers =
[
@@ -23,6 +23,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
];
private BsdContext _context;
private readonly bool _isPrivileged;
public IClient(ServiceCtx context, bool isPrivileged) : base(context.Device.System.BsdServer)
{
_isPrivileged = isPrivileged;
}
private ResultCode WriteBsdResult(ServiceCtx context, int result, LinuxError errorCode = LinuxError.SUCCESS)
{
@@ -73,7 +79,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
return WriteBsdResult(context, -1, LinuxError.EPROTONOSUPPORT);
}
else if ((type == BsdSocketType.Seqpacket || type == BsdSocketType.Raw) && !isPrivileged)
else if ((type == BsdSocketType.Seqpacket || type == BsdSocketType.Raw) && !_isPrivileged)
{
if (domain != BsdAddressFamily.InterNetwork || type != BsdSocketType.Raw || protocol != ProtocolType.Icmp)
{
@@ -1034,7 +1040,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
LinuxError errno = LinuxError.ENOENT;
int newSockFd = -1;
if (isPrivileged)
if (_isPrivileged)
{
errno = LinuxError.SUCCESS;
@@ -1,5 +1,6 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy;
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
private readonly FqdnResolver _fqdnResolver;
#pragma warning restore IDE0052
private readonly bool _isInitialized;
private readonly bool _isInitialized = false;
public IManager(ServiceCtx context)
{
@@ -44,6 +44,8 @@ namespace Ryujinx.HLE.HOS.Services.Spl
configValue = (ulong)HardwareState.Development;
result = SmcResult.Success;
break;
default:
break;
}
}
@@ -792,6 +792,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
freeSlot = slot;
}
break;
default:
break;
}
}
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
private static readonly Dictionary<int, IBinder> _registeredBinderObjects = new();
private static int _lastBinderId;
private static int _lastBinderId = 0;
private static readonly Lock _lock = new();
@@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
private readonly TimeManager _timeManager;
private readonly TimePermissions _permissions;
private int _timeSharedMemoryNativeHandle;
private int _timeSharedMemoryNativeHandle = 0;
public IStaticServiceForPsc(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) { }