Address comments
This commit is contained in:
parent
d3968e933e
commit
32d3fc8df5
2 changed files with 26 additions and 30 deletions
|
@ -412,12 +412,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
Chars = new char[TzCharsArraySize]
|
||||
};
|
||||
|
||||
int stdLen;
|
||||
|
||||
int namePosition = 0;
|
||||
|
||||
Span<char> stdName = name;
|
||||
int stdOffset = 0;
|
||||
int stdLen;
|
||||
Span<char> stdName = name;
|
||||
int namePosition = 0;
|
||||
int stdOffset = 0;
|
||||
|
||||
if (lastDitch)
|
||||
{
|
||||
|
@ -462,7 +460,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
}
|
||||
}
|
||||
|
||||
int charCount = (int)stdLen + 1;
|
||||
int charCount = stdLen + 1;
|
||||
int destLen = 0;
|
||||
int dstOffset = 0;
|
||||
|
||||
|
@ -572,10 +570,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
|
||||
outRules.DefaultType = 0;
|
||||
|
||||
int timeCount = 0;
|
||||
long janFirst = 0;
|
||||
int janOffset = 0;
|
||||
int yearBegining = EpochYear;
|
||||
int timeCount = 0;
|
||||
long janFirst = 0;
|
||||
int janOffset = 0;
|
||||
int yearBegining = EpochYear;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1079,29 +1077,29 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
}
|
||||
|
||||
long position = (p - workBufferPtrStart);
|
||||
long nread = streamLength - position;
|
||||
long nRead = streamLength - position;
|
||||
|
||||
if (nread < 0)
|
||||
if (nRead < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Nintendo abort in case of a TzIf file with a POSIX TZ Name too long to fit inside a TimeZoneRule.
|
||||
// As it's impossible in normal usage to achive this, we also force a crash.
|
||||
if (nread > (TzNameMax + 1))
|
||||
if (nRead > (TzNameMax + 1))
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
char[] tempName = new char[TzNameMax + 1];
|
||||
Array.Copy(workBuffer, position, tempName, 0, nread);
|
||||
Array.Copy(workBuffer, position, tempName, 0, nRead);
|
||||
|
||||
if (nread > 2 && tempName[0] == '\n' && tempName[nread - 1] == '\n' && outRules.TypeCount + 2 <= TzMaxTypes)
|
||||
if (nRead > 2 && tempName[0] == '\n' && tempName[nRead - 1] == '\n' && outRules.TypeCount + 2 <= TzMaxTypes)
|
||||
{
|
||||
tempName[nread - 1] = '\0';
|
||||
tempName[nRead - 1] = '\0';
|
||||
|
||||
char[] name = new char[TzNameMax];
|
||||
Array.Copy(tempName, 1, name, 0, nread - 1);
|
||||
Array.Copy(tempName, 1, name, 0, nRead - 1);
|
||||
|
||||
if (ParsePosixName(name, out TimeZoneRule tempRules, false))
|
||||
{
|
||||
|
@ -1381,7 +1379,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
TimezoneName = new char[8]
|
||||
};
|
||||
|
||||
int result = 0;
|
||||
int result;
|
||||
|
||||
if ((rules.GoAhead && time < rules.Ats[0]) || (rules.GoBack && time > rules.Ats[rules.TimeCount - 1]))
|
||||
{
|
||||
|
|
|
@ -22,15 +22,13 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
|
||||
private static object instanceLock = new object();
|
||||
|
||||
private Switch _device;
|
||||
private TimeZoneRule _myRules;
|
||||
private string _deviceLocationName;
|
||||
private string[] _locationNameCache;
|
||||
private Switch _device;
|
||||
private TimeZoneRule _myRules;
|
||||
private string _deviceLocationName;
|
||||
private string[] _locationNameCache;
|
||||
|
||||
TimeZoneManager()
|
||||
{
|
||||
_device = null;
|
||||
|
||||
// Empty rules (UTC)
|
||||
_myRules = new TimeZoneRule
|
||||
{
|
||||
|
@ -56,9 +54,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
{
|
||||
using (IStorage ncaFileStream = new LocalStorage(_device.FileSystem.SwitchPathToSystemPath(GetTimeZoneBinaryTitleContentPath()), FileAccess.Read, FileMode.Open))
|
||||
{
|
||||
Nca nca = new Nca(_device.System.KeySet, ncaFileStream);
|
||||
IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel);
|
||||
Stream binaryListStream = romfs.OpenFile("binaryList.txt", OpenMode.Read).AsStream();
|
||||
Nca nca = new Nca(_device.System.KeySet, ncaFileStream);
|
||||
IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel);
|
||||
Stream binaryListStream = romfs.OpenFile("binaryList.txt", OpenMode.Read).AsStream();
|
||||
|
||||
StreamReader reader = new StreamReader(binaryListStream);
|
||||
|
||||
|
@ -96,8 +94,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
|
||||
// As we aren't using the system archive, "UTC" might not exist on the host system.
|
||||
// Load from C# TimeZone APIs UTC id.
|
||||
string utcId = TimeZoneInfo.Utc.Id;
|
||||
bool utcNeedConversion = TZConvert.TryWindowsToIana(utcId, out string utcConvertedName);
|
||||
string utcId = TimeZoneInfo.Utc.Id;
|
||||
bool utcNeedConversion = TZConvert.TryWindowsToIana(utcId, out string utcConvertedName);
|
||||
if (utcNeedConversion)
|
||||
{
|
||||
utcId = utcConvertedName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue