aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
index 3c9ac71f..b3a87b8a 100644
--- a/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
@@ -14,8 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
{
class ITimeZoneServiceForPsc : IpcService
{
- private TimeZoneManager _timeZoneManager;
- private bool _writePermission;
+ private readonly TimeZoneManager _timeZoneManager;
+ private readonly bool _writePermission;
public ITimeZoneServiceForPsc(TimeZoneManager timeZoneManager, bool writePermission)
{
@@ -134,10 +134,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
context.Memory.Read(bufferPosition, temp);
- using (MemoryStream timeZoneBinaryStream = new MemoryStream(temp))
- {
- result = _timeZoneManager.SetDeviceLocationNameWithTimeZoneRule(locationName, timeZoneBinaryStream);
- }
+ using MemoryStream timeZoneBinaryStream = new(temp);
+ result = _timeZoneManager.SetDeviceLocationNameWithTimeZoneRule(locationName, timeZoneBinaryStream);
return result;
}
@@ -149,7 +147,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
ulong timeZoneRuleBufferPosition = context.Request.ReceiveBuff[0].Position;
- ulong timeZoneRuleBufferSize = context.Request.ReceiveBuff[0].Size;
+ ulong timeZoneRuleBufferSize = context.Request.ReceiveBuff[0].Size;
if (timeZoneRuleBufferSize != 0x4000)
{
@@ -165,15 +163,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
context.Memory.Read(bufferPosition, temp);
- using (MemoryStream timeZoneBinaryStream = new MemoryStream(temp))
- {
- using (WritableRegion region = context.Memory.GetWritableRegion(timeZoneRuleBufferPosition, Unsafe.SizeOf<TimeZoneRule>()))
- {
- ref TimeZoneRule rule = ref MemoryMarshal.Cast<byte, TimeZoneRule>(region.Memory.Span)[0];
+ using MemoryStream timeZoneBinaryStream = new(temp);
+ using WritableRegion region = context.Memory.GetWritableRegion(timeZoneRuleBufferPosition, Unsafe.SizeOf<TimeZoneRule>());
- result = _timeZoneManager.ParseTimeZoneRuleBinary(ref rule, timeZoneBinaryStream);
- }
- }
+ ref TimeZoneRule rule = ref MemoryMarshal.Cast<byte, TimeZoneRule>(region.Memory.Span)[0];
+
+ result = _timeZoneManager.ParseTimeZoneRuleBinary(ref rule, timeZoneBinaryStream);
return result;
}
@@ -189,9 +184,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
// ToCalendarTime(nn::time::PosixTime time, buffer<nn::time::TimeZoneRule, 0x15> rules) -> (nn::time::CalendarTime, nn::time::sf::CalendarAdditionalInfo)
public ResultCode ToCalendarTime(ServiceCtx context)
{
- long posixTime = context.RequestData.ReadInt64();
+ long posixTime = context.RequestData.ReadInt64();
ulong bufferPosition = context.Request.SendBuff[0].Position;
- ulong bufferSize = context.Request.SendBuff[0].Size;
+ ulong bufferSize = context.Request.SendBuff[0].Size;
if (bufferSize != 0x4000)
{
@@ -234,7 +229,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
public ResultCode ToPosixTime(ServiceCtx context)
{
ulong inBufferPosition = context.Request.SendBuff[0].Position;
- ulong inBufferSize = context.Request.SendBuff[0].Size;
+ ulong inBufferSize = context.Request.SendBuff[0].Size;
CalendarTime calendarTime = context.RequestData.ReadStruct<CalendarTime>();
@@ -253,7 +248,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
if (resultCode == ResultCode.Success)
{
ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
- ulong outBufferSize = context.Request.RecvListBuff[0].Size;
+#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);
@@ -273,7 +270,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
if (resultCode == ResultCode.Success)
{
ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
- ulong outBufferSize = context.Request.RecvListBuff[0].Size;
+#pragma warning disable IDE0059 // Remove unnecessary value assignment
+ ulong outBufferSize = context.Request.RecvListBuff[0].Size;
+#pragma warning restore IDE0059
context.Memory.Write(outBufferPosition, posixTime);