Better support for user accounts (#349)

* Better support for user accounts

* Nits

* Check for invalid ids
This commit is contained in:
gdkchan 2018-08-14 19:02:42 -03:00 committed by GitHub
parent 17f54b5d78
commit 9ac5583513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 314 additions and 136 deletions

View file

@ -11,13 +11,13 @@ namespace Ryujinx.HLE.OsHle.Utilities
{
InputString = InputString + "\0";
int ByteCount = Encoding.GetByteCount(InputString);
int BytesCount = Encoding.GetByteCount(InputString);
byte[] Output = new byte[Size];
if (ByteCount < Size)
if (BytesCount < Size)
{
Encoding.GetBytes(InputString, 0, InputString.Length, Output, Size - ByteCount);
Encoding.GetBytes(InputString, 0, InputString.Length, Output, 0);
}
else
{
@ -35,15 +35,14 @@ namespace Ryujinx.HLE.OsHle.Utilities
public static byte[] HexToBytes(string HexString)
{
//Ignore last charactor if HexLength % 2 != 0
//Ignore last charactor if HexLength % 2 != 0.
int BytesInHex = HexString.Length / 2;
byte[] Output = new byte[BytesInHex];
for (int Index = 0; Index < BytesInHex; Index++)
{
Output[Index] = byte.Parse(HexString.Substring(Index * 2, 2),
NumberStyles.HexNumber);
Output[Index] = byte.Parse(HexString.Substring(Index * 2, 2), NumberStyles.HexNumber);
}
return Output;