aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/TimeZone
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/TimeZone
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/TimeZone')
-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
8 files changed, 159 insertions, 11 deletions
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