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
@@ -128,13 +128,13 @@ namespace Ryujinx.HLE.HOS.Applets.Cabinet
#region Structs
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TagInfo
public unsafe struct TagInfo
{
public fixed byte Data[0x58];
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct StartParamForAmiiboSettings
public unsafe struct StartParamForAmiiboSettings
{
public byte ZeroValue; // Left at zero by sdknso
public byte Type;
@@ -151,7 +151,7 @@ namespace Ryujinx.HLE.HOS.Applets.Cabinet
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ReturnValueForAmiiboSettings
public unsafe struct ReturnValueForAmiiboSettings
{
public byte AmiiboSettingsReturnFlag;
private byte Padding1;
@@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Applets
private SoftwareKeyboardState _foregroundState = SoftwareKeyboardState.Uninitialized;
private volatile InlineKeyboardState _backgroundState = InlineKeyboardState.Uninitialized;
private bool _isBackground;
private bool _isBackground = false;
private AppletSession _normalSession;
private AppletSession _interactiveSession;
@@ -53,14 +53,14 @@ namespace Ryujinx.HLE.HOS.Applets
private byte[] _transferMemory;
private string _textValue = "";
private int _cursorBegin;
private int _cursorBegin = 0;
private Encoding _encoding = Encoding.Unicode;
private KeyboardResult _lastResult = KeyboardResult.NotSet;
private IDynamicTextInputHandler _dynamicTextInputHandler;
private SoftwareKeyboardRenderer _keyboardRenderer;
private NpadReader _npads;
private bool _canAcceptController;
private IDynamicTextInputHandler _dynamicTextInputHandler = null;
private SoftwareKeyboardRenderer _keyboardRenderer = null;
private NpadReader _npads = null;
private bool _canAcceptController = false;
private KeyboardInputMode _inputMode = KeyboardInputMode.ControllerAndKeyboard;
private readonly Lock _lock = new();
@@ -23,15 +23,15 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
private readonly Lock _bufferLock = new();
private RenderingSurfaceInfo _surfaceInfo;
private RenderingSurfaceInfo _surfaceInfo = null;
private SKImageInfo _imageInfo;
private SKSurface _surface;
private byte[] _bufferData;
private SKSurface _surface = null;
private byte[] _bufferData = null;
private readonly SKBitmap _ryujinxLogo;
private readonly SKBitmap _padAcceptIcon;
private readonly SKBitmap _padCancelIcon;
private readonly SKBitmap _keyModeIcon;
private readonly SKBitmap _ryujinxLogo = null;
private readonly SKBitmap _padAcceptIcon = null;
private readonly SKBitmap _padCancelIcon = null;
private readonly SKBitmap _keyModeIcon = null;
private readonly float _textBoxOutlineWidth;
private readonly float _padPressedPenWidth;
@@ -25,8 +25,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
}
}
private TRef<bool> _cancelled;
private Thread _thread;
private TRef<bool> _cancelled = null;
private Thread _thread = null;
private readonly Lock _lock = new();
public bool IsRunning
@@ -3,7 +3,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
class SyscallHandler
partial class SyscallHandler
{
private readonly KernelContext _context;
@@ -6,7 +6,7 @@ using System.Threading;
namespace Ryujinx.HLE.HOS.Kernel.Threading
{
class KScheduler : IDisposable
partial class KScheduler : IDisposable
{
public const int PrioritiesCount = 64;
public static int CpuCoresCount;
@@ -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) { }
+1 -1
View File
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class Register : IOperand
{
private ulong _register;
private ulong _register = 0;
private readonly string _alias;
public Register(string alias)
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public ProcessState State => _process.State;
public bool TamperedCodeMemory { get; set; }
public bool TamperedCodeMemory { get; set; } = false;
public TamperedKProcess(KProcess process)
{
+2 -2
View File
@@ -16,9 +16,9 @@ namespace Ryujinx.HLE.HOS
// cheat and the re-execution of the first one.
private const int TamperMachineSleepMs = 1000 / 12;
private Thread _tamperThread;
private Thread _tamperThread = null;
private readonly ConcurrentQueue<ITamperProgram> _programs = new();
private long _pressedKeys;
private long _pressedKeys = 0;
private readonly Dictionary<string, ITamperProgram> _programDictionary = new();
private void Activate()