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

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
[StructLayout(LayoutKind.Sequential)]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TimeSpanType
{
private const long NanoSecondsPerSecond = 1000000000;

View File

@@ -83,9 +83,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
return ResultCode.PermissionDenied;
}
#pragma warning disable IDE0059 // Remove unnecessary value assignment
TimeSpanType internalOffset = context.RequestData.ReadStruct<TimeSpanType>();
#pragma warning restore IDE0059
_ = context.RequestData.ReadStruct<TimeSpanType>(); // internalOffset
// TODO: set:sys SetExternalSteadyClockInternalOffset(internalOffset.ToSeconds())

View File

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

View File

@@ -248,9 +248,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
if (resultCode == ResultCode.Success)
{
ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong outBufferSize = context.Request.RecvListBuff[0].Size;
#pragma warning restore IDE0059
context.Memory.Write(outBufferPosition, posixTime);
context.ResponseData.Write(1);
@@ -270,9 +267,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
if (resultCode == ResultCode.Success)
{
ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong outBufferSize = context.Request.RecvListBuff[0].Size;
#pragma warning restore IDE0059
context.Memory.Write(outBufferPosition, posixTime);

View File

@@ -14,9 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
private Switch _device;
private KSharedMemory _sharedMemory;
private SharedMemoryStorage _timeSharedMemoryStorage;
#pragma warning disable IDE0052 // Remove unread private member
private int _timeSharedMemorySize;
#pragma warning restore IDE0052
private const uint SteadyClockContextOffset = 0x00;
private const uint LocalSystemClockContextOffset = 0x38;

View File

@@ -649,22 +649,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
}
}
long theirDstOffset;
for (int i = 0; i < outRules.TimeCount; i++)
{
int j = outRules.Types[i];
if (outRules.Ttis[j].IsDaySavingTime)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
theirDstOffset = -outRules.Ttis[j].GmtOffset;
#pragma warning restore IDE0059
}
}
bool isDaySavingTime = false;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
long theirOffset = theirStdOffset;
#pragma warning restore IDE0059
for (int i = 0; i < outRules.TimeCount; i++)
{
int j = outRules.Types[i];
@@ -681,16 +667,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
}
}
theirOffset = -outRules.Ttis[j].GmtOffset;
if (outRules.Ttis[j].IsDaySavingTime)
if (!outRules.Ttis[j].IsDaySavingTime)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
theirDstOffset = theirOffset;
#pragma warning restore IDE0059
}
else
{
theirStdOffset = theirOffset;
theirStdOffset = -outRules.Ttis[j].GmtOffset;
}
}