aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-12-12 00:06:20 -0300
committerGitHub <noreply@github.com>2020-12-12 14:06:20 +1100
commit74aa7b20be5ef924f3e8cbde699fcf4f8431f750 (patch)
tree173851ac0907333cf4b62467b1763fdbf9c8816a /Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
parent06057a99a653b83389447a9c56d926c463317b47 (diff)
Rewrite size for fixed size buffers (#1808)
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs17
1 files changed, 6 insertions, 11 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
index 8de3f726..dee3e476 100644
--- a/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
@@ -1,4 +1,5 @@
using Ryujinx.Common;
+using Ryujinx.Cpu;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
@@ -245,6 +246,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
{
byte type = context.RequestData.ReadByte();
+ context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(Marshal.SizeOf<ClockSnapshot>());
+
ResultCode result = _timeManager.StandardUserSystemClock.GetClockContext(context.Thread, out SystemClockContext userContext);
if (result == ResultCode.Success)
@@ -271,6 +274,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
{
byte type = context.RequestData.ReadByte();
+ context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(Marshal.SizeOf<ClockSnapshot>());
+
context.RequestData.BaseStream.Position += 7;
SystemClockContext userContext = context.RequestData.ReadStruct<SystemClockContext>();
@@ -413,17 +418,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
private void WriteClockSnapshotFromBuffer(ServiceCtx context, IpcRecvListBuffDesc ipcDesc, ClockSnapshot clockSnapshot)
{
- Debug.Assert(ipcDesc.Size == Marshal.SizeOf<ClockSnapshot>());
-
- MemoryStream memory = new MemoryStream((int)ipcDesc.Size);
-
- using (BinaryWriter bufferWriter = new BinaryWriter(memory))
- {
- bufferWriter.WriteStruct(clockSnapshot);
- }
-
- context.Memory.Write((ulong)ipcDesc.Position, memory.ToArray());
- memory.Dispose();
+ MemoryHelper.Write(context.Memory, ipcDesc.Position, clockSnapshot);
}
}
} \ No newline at end of file