Reduce requirements for running homebrew (#1053)
* Reduce requirements for running homebrews This commit change the following behaviours: - TimeZoneBinary system archive isn't required until guest code call LoadTimeZoneRule. - Fonts system archives aren't requred until a "pl:u" IPC call is made. - Custom font support was dropped. - TimeZoneBinary missing message is now an error and not a warning. * Address comments
This commit is contained in:
parent
f9c859c8ba
commit
8f21db810d
3 changed files with 32 additions and 31 deletions
|
@ -2,9 +2,11 @@ using LibHac.Common;
|
|||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.HLE.FileSystem.Content;
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -19,8 +21,6 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
|
||||
private long _physicalAddress;
|
||||
|
||||
private string _fontsPath;
|
||||
|
||||
private struct FontInfo
|
||||
{
|
||||
public int Offset;
|
||||
|
@ -38,10 +38,7 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
public SharedFontManager(Switch device, long physicalAddress)
|
||||
{
|
||||
_physicalAddress = physicalAddress;
|
||||
|
||||
_device = device;
|
||||
|
||||
_fontsPath = Path.Combine(device.FileSystem.GetSystemPath(), "fonts");
|
||||
_device = device;
|
||||
}
|
||||
|
||||
public void Initialize(ContentManager contentManager)
|
||||
|
@ -49,7 +46,6 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
_fontData?.Clear();
|
||||
_fontData = null;
|
||||
|
||||
EnsureInitialized(contentManager);
|
||||
}
|
||||
|
||||
public void EnsureInitialized(ContentManager contentManager)
|
||||
|
@ -97,32 +93,19 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
string fontFilePath = Path.Combine(_fontsPath, name + ".ttf");
|
||||
|
||||
if (File.Exists(fontFilePath))
|
||||
{
|
||||
byte[] data = File.ReadAllBytes(fontFilePath);
|
||||
|
||||
FontInfo info = new FontInfo((int)fontOffset, data.Length);
|
||||
|
||||
WriteMagicAndSize(_physicalAddress + fontOffset, data.Length);
|
||||
|
||||
fontOffset += 8;
|
||||
|
||||
uint start = fontOffset;
|
||||
|
||||
for (; fontOffset - start < data.Length; fontOffset++)
|
||||
else
|
||||
{
|
||||
_device.Memory.WriteByte(_physicalAddress + fontOffset, data[fontOffset - start]);
|
||||
}
|
||||
if (!contentManager.TryGetSystemTitlesName(fontTitle, out string titleName))
|
||||
{
|
||||
titleName = "Unknown";
|
||||
}
|
||||
|
||||
return info;
|
||||
throw new InvalidSystemResourceException($"{titleName} ({fontTitle:x8}) system title not found! This font will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx#requirements for more information)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidSystemResourceException($"Font \"{name}.ttf\" not found. Please provide it in \"{_fontsPath}\".");
|
||||
throw new ArgumentException($"Unknown font \"{name}\"!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue