aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-09-19 02:45:11 +0200
committerjduncanator <1518948+jduncanator@users.noreply.github.com>2019-09-19 10:45:11 +1000
commita0720b5681852f3d786d77bd3793b0359dea321c (patch)
tree9d8f61e540d1d1d827999902dad95e5c0c1e076e /Ryujinx.HLE/HOS/Services/Time
parent4af3101b22e6957d6aa48a2768566d658699f4ed (diff)
Refactoring HOS folder structure (#771)
* Refactoring HOS folder structure Refactoring HOS folder structure: - Added some subfolders when needed (Following structure decided in private). - Added some `Types` folders when needed. - Little cleanup here and there. - Add services placeholders for every HOS services (close #766 and #753). * Remove Types namespaces
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/ClockTypes.cs105
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/StandardSteadyClockCore.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs3
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/Types/ClockSnapshot.cs41
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs34
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs11
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs32
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/IAlarmService.cs8
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/IPowerStateRequestHandler.cs8
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/IStaticService.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs8
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs128
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs (renamed from Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs)2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/StaticService/ISystemClock.cs (renamed from Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs)2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneService.cs (renamed from Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs)2
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs12
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs10
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarAdditionalInfo.cs22
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarInfo.cs11
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarTime.cs15
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeTypeInfo.cs27
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeZoneRule.cs39
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TzifHeader.cs34
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Types/TimePermissions.cs (renamed from Ryujinx.HLE/HOS/Services/Time/TimePermissions.cs)0
25 files changed, 309 insertions, 251 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/ClockTypes.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/ClockTypes.cs
deleted file mode 100644
index c70819c0..00000000
--- a/Ryujinx.HLE/HOS/Services/Time/Clock/ClockTypes.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using Ryujinx.HLE.Utilities;
-using System;
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.HOS.Services.Time.Clock
-{
- [StructLayout(LayoutKind.Sequential)]
- struct TimeSpanType
- {
- private const long NanoSecondsPerSecond = 1000000000;
-
- public long NanoSeconds;
-
- public TimeSpanType(long nanoSeconds)
- {
- NanoSeconds = nanoSeconds;
- }
-
- public long ToSeconds()
- {
- return NanoSeconds / NanoSecondsPerSecond;
- }
-
- public static TimeSpanType FromSeconds(long seconds)
- {
- return new TimeSpanType(seconds * NanoSecondsPerSecond);
- }
-
- public static TimeSpanType FromTicks(ulong ticks, ulong frequency)
- {
- return FromSeconds((long)ticks / (long)frequency);
- }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- struct SteadyClockTimePoint
- {
- public long TimePoint;
- public UInt128 ClockSourceId;
-
- public ResultCode GetSpanBetween(SteadyClockTimePoint other, out long outSpan)
- {
- outSpan = 0;
-
- if (ClockSourceId == other.ClockSourceId)
- {
- try
- {
- outSpan = checked(other.TimePoint - TimePoint);
-
- return ResultCode.Success;
- }
- catch (OverflowException)
- {
- return ResultCode.Overflow;
- }
- }
-
- return ResultCode.Overflow;
- }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- struct SystemClockContext
- {
- public long Offset;
- public SteadyClockTimePoint SteadyTimePoint;
- }
-
- [StructLayout(LayoutKind.Sequential, Size = 0xD0)]
- struct ClockSnapshot
- {
- public SystemClockContext UserContext;
- public SystemClockContext NetworkContext;
- public long UserTime;
- public long NetworkTime;
- public CalendarTime UserCalendarTime;
- public CalendarTime NetworkCalendarTime;
- public CalendarAdditionalInfo UserCalendarAdditionalTime;
- public CalendarAdditionalInfo NetworkCalendarAdditionalTime;
- public SteadyClockTimePoint SteadyClockTimePoint;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x24)]
- public char[] LocationName;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool IsAutomaticCorrectionEnabled;
- public byte Type;
- public ushort Unknown;
-
- public static ResultCode GetCurrentTime(out long currentTime, SteadyClockTimePoint steadyClockTimePoint, SystemClockContext context)
- {
- currentTime = 0;
-
- if (steadyClockTimePoint.ClockSourceId == context.SteadyTimePoint.ClockSourceId)
- {
- currentTime = steadyClockTimePoint.TimePoint + context.Offset;
-
- return ResultCode.Success;
- }
-
- return ResultCode.TimeMismatch;
- }
- }
-}
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
index 5037fb60..cc21dd9a 100644
--- a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
class StandardNetworkSystemClockCore : SystemClockCore
{
- private TimeSpanType _standardNetworkClockSufficientAccuracy;
+ private TimeSpanType _standardNetworkClockSufficientAccuracy;
private static StandardNetworkSystemClockCore _instance;
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardSteadyClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardSteadyClockCore.cs
index 5b2d6c84..1bc5bee7 100644
--- a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardSteadyClockCore.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardSteadyClockCore.cs
@@ -1,5 +1,5 @@
using Ryujinx.HLE.HOS.Kernel.Threading;
-using Ryujinx.HLE.HOS.Services.Bpc;
+using Ryujinx.HLE.HOS.Services.Pcv.Bpc;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs
index 6cd4c80b..e5baba25 100644
--- a/Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs
@@ -1,5 +1,4 @@
-using Ryujinx.Common;
-using Ryujinx.HLE.HOS.Kernel.Threading;
+using Ryujinx.HLE.HOS.Kernel.Threading;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/ClockSnapshot.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/ClockSnapshot.cs
new file mode 100644
index 00000000..df1f151f
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/ClockSnapshot.cs
@@ -0,0 +1,41 @@
+using Ryujinx.HLE.HOS.Services.Time.TimeZone;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.Clock
+{
+ [StructLayout(LayoutKind.Sequential, Size = 0xD0)]
+ struct ClockSnapshot
+ {
+ public SystemClockContext UserContext;
+ public SystemClockContext NetworkContext;
+ public long UserTime;
+ public long NetworkTime;
+ public CalendarTime UserCalendarTime;
+ public CalendarTime NetworkCalendarTime;
+ public CalendarAdditionalInfo UserCalendarAdditionalTime;
+ public CalendarAdditionalInfo NetworkCalendarAdditionalTime;
+ public SteadyClockTimePoint SteadyClockTimePoint;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x24)]
+ public char[] LocationName;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsAutomaticCorrectionEnabled;
+ public byte Type;
+ public ushort Unknown;
+
+ public static ResultCode GetCurrentTime(out long currentTime, SteadyClockTimePoint steadyClockTimePoint, SystemClockContext context)
+ {
+ currentTime = 0;
+
+ if (steadyClockTimePoint.ClockSourceId == context.SteadyTimePoint.ClockSourceId)
+ {
+ currentTime = steadyClockTimePoint.TimePoint + context.Offset;
+
+ return ResultCode.Success;
+ }
+
+ return ResultCode.TimeMismatch;
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs
new file mode 100644
index 00000000..0055b5ea
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs
@@ -0,0 +1,34 @@
+using Ryujinx.HLE.Utilities;
+using System;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.Clock
+{
+ [StructLayout(LayoutKind.Sequential)]
+ struct SteadyClockTimePoint
+ {
+ public long TimePoint;
+ public UInt128 ClockSourceId;
+
+ public ResultCode GetSpanBetween(SteadyClockTimePoint other, out long outSpan)
+ {
+ outSpan = 0;
+
+ if (ClockSourceId == other.ClockSourceId)
+ {
+ try
+ {
+ outSpan = checked(other.TimePoint - TimePoint);
+
+ return ResultCode.Success;
+ }
+ catch (OverflowException)
+ {
+ return ResultCode.Overflow;
+ }
+ }
+
+ return ResultCode.Overflow;
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs
new file mode 100644
index 00000000..38e10480
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs
@@ -0,0 +1,11 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.Clock
+{
+ [StructLayout(LayoutKind.Sequential)]
+ struct SystemClockContext
+ {
+ public long Offset;
+ public SteadyClockTimePoint SteadyTimePoint;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs
new file mode 100644
index 00000000..93579709
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/TimeSpanType.cs
@@ -0,0 +1,32 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.Clock
+{
+ [StructLayout(LayoutKind.Sequential)]
+ struct TimeSpanType
+ {
+ private const long NanoSecondsPerSecond = 1000000000;
+
+ public long NanoSeconds;
+
+ public TimeSpanType(long nanoSeconds)
+ {
+ NanoSeconds = nanoSeconds;
+ }
+
+ public long ToSeconds()
+ {
+ return NanoSeconds / NanoSecondsPerSecond;
+ }
+
+ public static TimeSpanType FromSeconds(long seconds)
+ {
+ return new TimeSpanType(seconds * NanoSecondsPerSecond);
+ }
+
+ public static TimeSpanType FromTicks(ulong ticks, ulong frequency)
+ {
+ return FromSeconds((long)ticks / (long)frequency);
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/IAlarmService.cs b/Ryujinx.HLE/HOS/Services/Time/IAlarmService.cs
new file mode 100644
index 00000000..092fa8ce
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/IAlarmService.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.HLE.HOS.Services.Time
+{
+ [Service("time:al")] // 9.0.0+
+ class IAlarmService : IpcService
+ {
+ public IAlarmService(ServiceCtx context) { }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/IPowerStateRequestHandler.cs b/Ryujinx.HLE/HOS/Services/Time/IPowerStateRequestHandler.cs
new file mode 100644
index 00000000..cb10da47
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/IPowerStateRequestHandler.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.HLE.HOS.Services.Time
+{
+ [Service("time:m")] // 9.0.0+
+ class IPowerStateRequestHandler : IpcService
+ {
+ public IPowerStateRequestHandler(ServiceCtx context) { }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs
index d9c5b4f2..0cfdebcf 100644
--- a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs
@@ -3,6 +3,7 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Time.Clock;
+using Ryujinx.HLE.HOS.Services.Time.StaticService;
using Ryujinx.HLE.HOS.Services.Time.TimeZone;
using System;
using System.Diagnostics;
@@ -14,6 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
[Service("time:a", TimePermissions.Applet)]
[Service("time:s", TimePermissions.System)]
[Service("time:u", TimePermissions.User)]
+ [Service("time:p", TimePermissions.System)] // 9.0.0+ - TODO: Fix the permission.
class IStaticService : IpcService
{
private TimePermissions _permissions;
diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
new file mode 100644
index 00000000..514e901e
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.HLE.HOS.Services.Time
+{
+ [Service("time:su")] // 9.0.0+
+ class ITimeServiceManager : IpcService
+ {
+ public ITimeServiceManager(ServiceCtx context) { }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs
deleted file mode 100644
index 9a83b82b..00000000
--- a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.HOS.Services.Time
-{
- [StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
- struct TimeTypeInfo
- {
- public int GmtOffset;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool IsDaySavingTime;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- char[] Padding1;
-
- public int AbbreviationListIndex;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool IsStandardTimeDaylight;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool IsGMT;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
- char[] Padding2;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0x4000, CharSet = CharSet.Ansi)]
- struct TimeZoneRule
- {
- public const int TzMaxTypes = 128;
- public const int TzMaxChars = 50;
- public const int TzMaxLeaps = 50;
- public const int TzMaxTimes = 1000;
- public const int TzNameMax = 255;
- public const int TzCharsArraySize = 2 * (TzNameMax + 1);
-
- public int TimeCount;
- public int TypeCount;
- public int CharCount;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool GoBack;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool GoAhead;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTimes)]
- public long[] Ats;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTimes)]
- public byte[] Types;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTypes)]
- public TimeTypeInfo[] Ttis;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzCharsArraySize)]
- public char[] Chars;
-
- public int DefaultType;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x2C)]
- struct TzifHeader
- {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public char[] Magic;
-
- public char Version;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
- public byte[] Reserved;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] TtisGMTCount;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] TtisSTDCount;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] LeapCount;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] TimeCount;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] TypeCount;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
- public byte[] CharCount;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x8)]
- struct CalendarTime
- {
- public short Year;
- public sbyte Month;
- public sbyte Day;
- public sbyte Hour;
- public sbyte Minute;
- public sbyte Second;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x18, CharSet = CharSet.Ansi)]
- struct CalendarAdditionalInfo
- {
- public uint DayOfWeek;
- public uint DayOfYear;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
- public char[] TimezoneName;
-
- [MarshalAs(UnmanagedType.I1)]
- public bool IsDaySavingTime;
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- char[] Padding;
-
- public int GmtOffset;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x20, CharSet = CharSet.Ansi)]
- struct CalendarInfo
- {
- public CalendarTime Time;
- public CalendarAdditionalInfo AdditionalInfo;
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs
index 7e3edcef..31f119df 100644
--- a/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs
@@ -1,7 +1,7 @@
using Ryujinx.Common;
using Ryujinx.HLE.HOS.Services.Time.Clock;
-namespace Ryujinx.HLE.HOS.Services.Time
+namespace Ryujinx.HLE.HOS.Services.Time.StaticService
{
class ISteadyClock : IpcService
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISystemClock.cs
index d496dcdc..0d866177 100644
--- a/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISystemClock.cs
@@ -1,7 +1,7 @@
using Ryujinx.Common;
using Ryujinx.HLE.HOS.Services.Time.Clock;
-namespace Ryujinx.HLE.HOS.Services.Time
+namespace Ryujinx.HLE.HOS.Services.Time.StaticService
{
class ISystemClock : IpcService
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneService.cs
index b820de38..c65107df 100644
--- a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneService.cs
@@ -5,7 +5,7 @@ using Ryujinx.HLE.HOS.Services.Time.TimeZone;
using System;
using System.Text;
-namespace Ryujinx.HLE.HOS.Services.Time
+namespace Ryujinx.HLE.HOS.Services.Time.StaticService
{
class ITimeZoneService : IpcService
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs
index 4b482689..3a98013e 100644
--- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs
@@ -1,10 +1,11 @@
-using System;
+using Ryujinx.Common;
+using Ryujinx.HLE.Utilities;
+using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
-using Ryujinx.Common;
-using Ryujinx.HLE.Utilities;
-using static Ryujinx.HLE.HOS.Services.Time.TimeZoneRule;
+
+using static Ryujinx.HLE.HOS.Services.Time.TimeZone.TimeZoneRule;
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
{
@@ -238,9 +239,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
{
seconds = 0;
- int num;
- bool isValid = GetNum(name, ref namePosition, out num, 0, HoursPerDays * DaysPerWekk - 1);
+ bool isValid = GetNum(name, ref namePosition, out int num, 0, HoursPerDays * DaysPerWekk - 1);
if (!isValid)
{
return false;
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs
index cf27639b..2497f6a3 100644
--- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs
@@ -1,15 +1,15 @@
-using LibHac.Fs.NcaUtils;
+using LibHac.Fs;
+using LibHac.Fs.NcaUtils;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
-using LibHac.Fs;
using System.IO;
-using System.Collections.Generic;
-using TimeZoneConverter.Posix;
using TimeZoneConverter;
+using TimeZoneConverter.Posix;
-using static Ryujinx.HLE.HOS.Services.Time.TimeZoneRule;
+using static Ryujinx.HLE.HOS.Services.Time.TimeZone.TimeZoneRule;
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
{
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarAdditionalInfo.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarAdditionalInfo.cs
new file mode 100644
index 00000000..ef9b87e7
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarAdditionalInfo.cs
@@ -0,0 +1,22 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x18, CharSet = CharSet.Ansi)]
+ struct CalendarAdditionalInfo
+ {
+ public uint DayOfWeek;
+ public uint DayOfYear;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
+ public char[] TimezoneName;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsDaySavingTime;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+ public char[] Padding;
+
+ public int GmtOffset;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarInfo.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarInfo.cs
new file mode 100644
index 00000000..68e6245b
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarInfo.cs
@@ -0,0 +1,11 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x20, CharSet = CharSet.Ansi)]
+ struct CalendarInfo
+ {
+ public CalendarTime Time;
+ public CalendarAdditionalInfo AdditionalInfo;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarTime.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarTime.cs
new file mode 100644
index 00000000..d594223d
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/CalendarTime.cs
@@ -0,0 +1,15 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x8)]
+ struct CalendarTime
+ {
+ public short Year;
+ public sbyte Month;
+ public sbyte Day;
+ public sbyte Hour;
+ public sbyte Minute;
+ public sbyte Second;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeTypeInfo.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeTypeInfo.cs
new file mode 100644
index 00000000..399e0700
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeTypeInfo.cs
@@ -0,0 +1,27 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
+ struct TimeTypeInfo
+ {
+ public int GmtOffset;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsDaySavingTime;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+ public char[] Padding1;
+
+ public int AbbreviationListIndex;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsStandardTimeDaylight;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsGMT;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
+ public char[] Padding2;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeZoneRule.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeZoneRule.cs
new file mode 100644
index 00000000..1af7a81a
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TimeZoneRule.cs
@@ -0,0 +1,39 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0x4000, CharSet = CharSet.Ansi)]
+ struct TimeZoneRule
+ {
+ public const int TzMaxTypes = 128;
+ public const int TzMaxChars = 50;
+ public const int TzMaxLeaps = 50;
+ public const int TzMaxTimes = 1000;
+ public const int TzNameMax = 255;
+ public const int TzCharsArraySize = 2 * (TzNameMax + 1);
+
+ public int TimeCount;
+ public int TypeCount;
+ public int CharCount;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool GoBack;
+
+ [MarshalAs(UnmanagedType.I1)]
+ public bool GoAhead;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTimes)]
+ public long[] Ats;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTimes)]
+ public byte[] Types;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzMaxTypes)]
+ public TimeTypeInfo[] Ttis;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TzCharsArraySize)]
+ public char[] Chars;
+
+ public int DefaultType;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TzifHeader.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TzifHeader.cs
new file mode 100644
index 00000000..1a033c33
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/Types/TzifHeader.cs
@@ -0,0 +1,34 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x2C)]
+ struct TzifHeader
+ {
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public char[] Magic;
+
+ public char Version;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
+ public byte[] Reserved;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] TtisGMTCount;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] TtisSTDCount;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] LeapCount;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] TimeCount;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] TypeCount;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
+ public byte[] CharCount;
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Time/TimePermissions.cs b/Ryujinx.HLE/HOS/Services/Time/Types/TimePermissions.cs
index 823c8288..823c8288 100644
--- a/Ryujinx.HLE/HOS/Services/Time/TimePermissions.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/Types/TimePermissions.cs