mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
51fa1b2cb0
* timezone: Make timezone implementation safe * hle: Do not use TrimEnd to parse ASCII strings This adds an util that handle reading an ASCII string in a safe way. Previously it was possible to read malformed data that could cause various undefined behaviours in multiple services. * hid: Remove an useless unsafe modifier on keyboard update * Address gdkchan's comment * Address gdkchan's comment
41 lines
No EOL
1.4 KiB
C#
41 lines
No EOL
1.4 KiB
C#
using Ryujinx.HLE.Utilities;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace Ryujinx.HLE.FileSystem.Content
|
|
{
|
|
public class SystemVersion
|
|
{
|
|
public byte Major { get; }
|
|
public byte Minor { get; }
|
|
public byte Micro { get; }
|
|
public byte RevisionMajor { get; }
|
|
public byte RevisionMinor { get; }
|
|
public string PlatformString { get; }
|
|
public string Hex { get; }
|
|
public string VersionString { get; }
|
|
public string VersionTitle { get; }
|
|
|
|
public SystemVersion(Stream systemVersionFile)
|
|
{
|
|
using (BinaryReader reader = new BinaryReader(systemVersionFile))
|
|
{
|
|
Major = reader.ReadByte();
|
|
Minor = reader.ReadByte();
|
|
Micro = reader.ReadByte();
|
|
|
|
reader.ReadByte(); // Padding
|
|
|
|
RevisionMajor = reader.ReadByte();
|
|
RevisionMinor = reader.ReadByte();
|
|
|
|
reader.ReadBytes(2); // Padding
|
|
|
|
PlatformString = StringUtils.ReadInlinedAsciiString(reader, 0x20);
|
|
Hex = StringUtils.ReadInlinedAsciiString(reader, 0x40);
|
|
VersionString = StringUtils.ReadInlinedAsciiString(reader, 0x18);
|
|
VersionTitle = StringUtils.ReadInlinedAsciiString(reader, 0x80);
|
|
}
|
|
}
|
|
}
|
|
} |