aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/StaticService
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-04-24 12:16:01 +0200
committerGitHub <noreply@github.com>2021-04-24 12:16:01 +0200
commit305f06eb71a7832e6b0081a67015b66ced8a23cd (patch)
tree98bcb3ed465332a04af449cb5c74bdca7855a141 /Ryujinx.HLE/HOS/Services/Time/StaticService
parentc46f6879ff9171a1e024965618242e8bad373b6b (diff)
HLE: Fix integer sign inconcistency accross the codebase (#2222)
* Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time/StaticService')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs14
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs40
2 files changed, 27 insertions, 27 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs
index 5f35412d..da806ab6 100644
--- a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs
@@ -51,9 +51,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
// LoadLocationNameList(u32 index) -> (u32 outCount, buffer<nn::time::LocationName, 6>)
public ResultCode LoadLocationNameList(ServiceCtx context)
{
- uint index = context.RequestData.ReadUInt32();
- long bufferPosition = context.Request.ReceiveBuff[0].Position;
- long bufferSize = context.Request.ReceiveBuff[0].Size;
+ uint index = context.RequestData.ReadUInt32();
+ ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
+ ulong bufferSize = context.Request.ReceiveBuff[0].Size;
ResultCode errorCode = _timeZoneContentManager.LoadLocationNameList(index, out string[] locationNameArray, (uint)bufferSize / 0x24);
@@ -70,8 +70,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
return ResultCode.LocationNameTooLong;
}
- context.Memory.Write((ulong)bufferPosition + offset, Encoding.ASCII.GetBytes(locationName));
- MemoryHelper.FillWithZeros(context.Memory, bufferPosition + offset + locationName.Length, padding);
+ context.Memory.Write(bufferPosition + offset, Encoding.ASCII.GetBytes(locationName));
+ MemoryHelper.FillWithZeros(context.Memory, bufferPosition + offset + (ulong)locationName.Length, padding);
offset += 0x24;
}
@@ -86,8 +86,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
// LoadTimeZoneRule(nn::time::LocationName locationName) -> buffer<nn::time::TimeZoneRule, 0x16>
public ResultCode LoadTimeZoneRule(ServiceCtx context)
{
- long bufferPosition = context.Request.ReceiveBuff[0].Position;
- long bufferSize = context.Request.ReceiveBuff[0].Size;
+ ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
+ ulong bufferSize = context.Request.ReceiveBuff[0].Size;
if (bufferSize != 0x4000)
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
index 659e1331..d0ed9379 100644
--- a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForPsc.cs
@@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
return ResultCode.PermissionDenied;
}
- (long bufferPosition, long bufferSize) = context.Request.GetBufferType0x21();
+ (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
string locationName = Encoding.ASCII.GetString(context.RequestData.ReadBytes(0x24)).TrimEnd('\0');
@@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
byte[] temp = new byte[bufferSize];
- context.Memory.Read((ulong)bufferPosition, temp);
+ context.Memory.Read(bufferPosition, temp);
using (MemoryStream timeZoneBinaryStream = new MemoryStream(temp))
{
@@ -145,10 +145,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
// ParseTimeZoneBinary(buffer<nn::time::TimeZoneBinary, 0x21> timeZoneBinary) -> buffer<nn::time::TimeZoneRule, 0x16>
public ResultCode ParseTimeZoneBinary(ServiceCtx context)
{
- (long bufferPosition, long bufferSize) = context.Request.GetBufferType0x21();
+ (ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
- long timeZoneRuleBufferPosition = context.Request.ReceiveBuff[0].Position;
- long timeZoneRuleBufferSize = context.Request.ReceiveBuff[0].Size;
+ ulong timeZoneRuleBufferPosition = context.Request.ReceiveBuff[0].Position;
+ ulong timeZoneRuleBufferSize = context.Request.ReceiveBuff[0].Size;
if (timeZoneRuleBufferSize != 0x4000)
{
@@ -162,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
byte[] temp = new byte[bufferSize];
- context.Memory.Read((ulong)bufferPosition, temp);
+ context.Memory.Read(bufferPosition, temp);
using (MemoryStream timeZoneBinaryStream = new MemoryStream(temp))
{
@@ -188,9 +188,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 bufferPosition = context.Request.SendBuff[0].Position;
- long bufferSize = context.Request.SendBuff[0].Size;
+ long posixTime = context.RequestData.ReadInt64();
+ ulong bufferPosition = context.Request.SendBuff[0].Position;
+ ulong bufferSize = context.Request.SendBuff[0].Size;
if (bufferSize != 0x4000)
{
@@ -220,7 +220,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
ResultCode resultCode = _timeZoneManager.ToCalendarTimeWithMyRules(posixTime, out CalendarInfo calendar);
- if (resultCode == 0)
+ if (resultCode == ResultCode.Success)
{
context.ResponseData.WriteStruct(calendar);
}
@@ -232,8 +232,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
// ToPosixTime(nn::time::CalendarTime calendarTime, buffer<nn::time::TimeZoneRule, 0x15> rules) -> (u32 outCount, buffer<nn::time::PosixTime, 0xa>)
public ResultCode ToPosixTime(ServiceCtx context)
{
- long inBufferPosition = context.Request.SendBuff[0].Position;
- long inBufferSize = context.Request.SendBuff[0].Size;
+ ulong inBufferPosition = context.Request.SendBuff[0].Position;
+ ulong inBufferSize = context.Request.SendBuff[0].Size;
CalendarTime calendarTime = context.RequestData.ReadStruct<CalendarTime>();
@@ -249,12 +249,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
ResultCode resultCode = _timeZoneManager.ToPosixTime(rules, calendarTime, out long posixTime);
- if (resultCode == 0)
+ if (resultCode == ResultCode.Success)
{
- long outBufferPosition = context.Request.RecvListBuff[0].Position;
- long outBufferSize = context.Request.RecvListBuff[0].Size;
+ ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
+ ulong outBufferSize = context.Request.RecvListBuff[0].Size;
- context.Memory.Write((ulong)outBufferPosition, posixTime);
+ context.Memory.Write(outBufferPosition, posixTime);
context.ResponseData.Write(1);
}
@@ -269,12 +269,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
ResultCode resultCode = _timeZoneManager.ToPosixTimeWithMyRules(calendarTime, out long posixTime);
- if (resultCode == 0)
+ if (resultCode == ResultCode.Success)
{
- long outBufferPosition = context.Request.RecvListBuff[0].Position;
- long outBufferSize = context.Request.RecvListBuff[0].Size;
+ ulong outBufferPosition = context.Request.RecvListBuff[0].Position;
+ ulong outBufferSize = context.Request.RecvListBuff[0].Size;
- context.Memory.Write((ulong)outBufferPosition, posixTime);
+ context.Memory.Write(outBufferPosition, posixTime);
// There could be only one result on one calendar as leap seconds aren't supported.
context.ResponseData.Write(1);