time: Make TimeZoneRule blittable and avoid copies (#3361)
* time: Make TimeZoneRule blittable and avoid copies This drastically reduce overhead of using TimeZoneRule around the codebase. Effect on games is unknown * Add missing Box type * Ensure we clean the structure still This doesn't perform any copies * Address gdkchan's comments * Simplify Box
This commit is contained in:
parent
232b1012b0
commit
30ee70a9bc
10 changed files with 157 additions and 147 deletions
|
@ -2,7 +2,10 @@ using Ryujinx.Common.Logging;
|
|||
using Ryujinx.Cpu;
|
||||
using Ryujinx.HLE.HOS.Services.Time.TimeZone;
|
||||
using Ryujinx.HLE.Utilities;
|
||||
using Ryujinx.Memory;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
||||
|
@ -100,15 +103,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
|||
|
||||
string locationName = StringUtils.ReadInlinedAsciiString(context.RequestData, 0x24);
|
||||
|
||||
ResultCode resultCode = _timeZoneContentManager.LoadTimeZoneRule(out TimeZoneRule rules, locationName);
|
||||
|
||||
// Write TimeZoneRule if success
|
||||
if (resultCode == ResultCode.Success)
|
||||
using (WritableRegion region = context.Memory.GetWritableRegion(bufferPosition, Unsafe.SizeOf<TimeZoneRule>()))
|
||||
{
|
||||
MemoryHelper.Write(context.Memory, bufferPosition, rules);
|
||||
}
|
||||
ref TimeZoneRule rules = ref MemoryMarshal.Cast<byte, TimeZoneRule>(region.Memory.Span)[0];
|
||||
|
||||
return resultCode;
|
||||
return _timeZoneContentManager.LoadTimeZoneRule(ref rules, locationName);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandHipc(100)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue