mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 09:53:35 +01:00
Because of that PR, TimeZoneRule was bigger than 0x4000 thanks to a misuse of a constant. This commit address this issue and add a new unit test to ensure the size of TimeZoneRule is 0x4000 bytes. Also address suggestions that were lost on the original PR.
This commit is contained in:
parent
30ee70a9bc
commit
2382717600
4 changed files with 26 additions and 7 deletions
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = Size, Pack = 4)]
|
||||||
struct TimeTypeInfo
|
public struct TimeTypeInfo
|
||||||
{
|
{
|
||||||
public const int Size = 0x10;
|
public const int Size = 0x10;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0x4000, CharSet = CharSet.Ansi)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0x4000, CharSet = CharSet.Ansi)]
|
||||||
struct TimeZoneRule
|
public struct TimeZoneRule
|
||||||
{
|
{
|
||||||
public const int TzMaxTypes = 128;
|
public const int TzMaxTypes = 128;
|
||||||
public const int TzMaxChars = 50;
|
public const int TzMaxChars = 50;
|
||||||
|
@ -36,9 +36,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
|
|
||||||
private TypesStorageStruct _types;
|
private TypesStorageStruct _types;
|
||||||
|
|
||||||
public Span<byte> Types => SpanHelpers.AsByteSpan<TypesStorageStruct>(ref _types);
|
public Span<byte> Types => SpanHelpers.AsByteSpan(ref _types);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Size = TimeTypeInfo.Size * TzMaxTimes)]
|
[StructLayout(LayoutKind.Sequential, Size = TimeTypeInfo.Size * TzMaxTypes)]
|
||||||
private struct TimeTypeInfoStorageStruct { }
|
private struct TimeTypeInfoStorageStruct { }
|
||||||
|
|
||||||
private TimeTypeInfoStorageStruct _ttis;
|
private TimeTypeInfoStorageStruct _ttis;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
|
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Cpu\Ryujinx.Cpu.csproj" />
|
<ProjectReference Include="..\Ryujinx.Cpu\Ryujinx.Cpu.csproj" />
|
||||||
|
<ProjectReference Include="..\Ryujinx.HLE\Ryujinx.HLE.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Memory\Ryujinx.Memory.csproj" />
|
<ProjectReference Include="..\Ryujinx.Memory\Ryujinx.Memory.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Tests.Unicorn\Ryujinx.Tests.Unicorn.csproj" />
|
<ProjectReference Include="..\Ryujinx.Tests.Unicorn\Ryujinx.Tests.Unicorn.csproj" />
|
||||||
<ProjectReference Include="..\ARMeilleure\ARMeilleure.csproj" />
|
<ProjectReference Include="..\ARMeilleure\ARMeilleure.csproj" />
|
||||||
|
|
18
Ryujinx.Tests/Time/TimeZoneRuleTests.cs
Normal file
18
Ryujinx.Tests/Time/TimeZoneRuleTests.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Time.TimeZone;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Tests.Time
|
||||||
|
{
|
||||||
|
internal class TimeZoneRuleTests
|
||||||
|
{
|
||||||
|
class EffectInfoParameterTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void EnsureTypeSize()
|
||||||
|
{
|
||||||
|
Assert.AreEqual(0x4000, Unsafe.SizeOf<TimeZoneRule>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue