Fix missing system font error while installing for the first time

This commit is contained in:
Thog 2020-01-06 14:58:13 +01:00
commit e385136537
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
3 changed files with 13 additions and 11 deletions

View file

@ -56,7 +56,7 @@ namespace Ryujinx.HLE.FileSystem.Content
_device = device; _device = device;
} }
public void LoadEntries() public void LoadEntries(bool ignoreMissingFonts = false)
{ {
_contentDictionary = new SortedDictionary<(ulong, NcaContentType), string>(); _contentDictionary = new SortedDictionary<(ulong, NcaContentType), string>();
_locationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>(); _locationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>();
@ -154,7 +154,7 @@ namespace Ryujinx.HLE.FileSystem.Content
TimeManager.Instance.InitializeTimeZone(_device); TimeManager.Instance.InitializeTimeZone(_device);
_device.System.Font.Initialize(this); _device.System.Font.Initialize(this, ignoreMissingFonts);
} }
public void ClearEntry(long titleId, NcaContentType contentType, StorageId storageId) public void ClearEntry(long titleId, NcaContentType contentType, StorageId storageId)
@ -815,7 +815,7 @@ namespace Ryujinx.HLE.FileSystem.Content
public SystemVersion GetCurrentFirmwareVersion() public SystemVersion GetCurrentFirmwareVersion()
{ {
LoadEntries(); LoadEntries(true);
var locationEnties = _locationEntries[StorageId.NandSystem]; var locationEnties = _locationEntries[StorageId.NandSystem];

View file

@ -44,15 +44,15 @@ namespace Ryujinx.HLE.HOS.Font
_fontsPath = Path.Combine(device.FileSystem.GetSystemPath(), "fonts"); _fontsPath = Path.Combine(device.FileSystem.GetSystemPath(), "fonts");
} }
public void Initialize(ContentManager contentManager) public void Initialize(ContentManager contentManager, bool ignoreMissingFonts)
{ {
_fontData?.Clear(); _fontData?.Clear();
_fontData = null; _fontData = null;
EnsureInitialized(contentManager); EnsureInitialized(contentManager, ignoreMissingFonts);
} }
public void EnsureInitialized(ContentManager contentManager) public void EnsureInitialized(ContentManager contentManager, bool ignoreMissingFonts)
{ {
if (_fontData == null) if (_fontData == null)
{ {
@ -120,10 +120,12 @@ namespace Ryujinx.HLE.HOS.Font
return info; return info;
} }
else else if(!ignoreMissingFonts)
{ {
throw new InvalidSystemResourceException($"Font \"{name}.ttf\" not found. Please provide it in \"{_fontsPath}\"."); throw new InvalidSystemResourceException($"Font \"{name}.ttf\" not found. Please provide it in \"{_fontsPath}\".");
} }
return new FontInfo();
} }
_fontData = new Dictionary<SharedFontType, FontInfo> _fontData = new Dictionary<SharedFontType, FontInfo>
@ -136,7 +138,7 @@ namespace Ryujinx.HLE.HOS.Font
{ SharedFontType.NintendoEx, CreateFont("FontNintendoExtended") } { SharedFontType.NintendoEx, CreateFont("FontNintendoExtended") }
}; };
if (fontOffset > Horizon.FontSize) if (fontOffset > Horizon.FontSize && !ignoreMissingFonts)
{ {
throw new InvalidSystemResourceException( throw new InvalidSystemResourceException(
$"The sum of all fonts size exceed the shared memory size. " + $"The sum of all fonts size exceed the shared memory size. " +
@ -159,14 +161,14 @@ namespace Ryujinx.HLE.HOS.Font
public int GetFontSize(SharedFontType fontType) public int GetFontSize(SharedFontType fontType)
{ {
EnsureInitialized(_device.System.ContentManager); EnsureInitialized(_device.System.ContentManager, false);
return _fontData[fontType].Size; return _fontData[fontType].Size;
} }
public int GetSharedMemoryAddressOffset(SharedFontType fontType) public int GetSharedMemoryAddressOffset(SharedFontType fontType)
{ {
EnsureInitialized(_device.System.ContentManager); EnsureInitialized(_device.System.ContentManager, false);
return _fontData[fontType].Offset + 8; return _fontData[fontType].Offset + 8;
} }

View file

@ -61,7 +61,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
// GetSharedMemoryNativeHandle() -> handle<copy> // GetSharedMemoryNativeHandle() -> handle<copy>
public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context)
{ {
context.Device.System.Font.EnsureInitialized(context.Device.System.ContentManager); context.Device.System.Font.EnsureInitialized(context.Device.System.ContentManager, false);
if (context.Process.HandleTable.GenerateHandle(context.Device.System.FontSharedMem, out int handle) != KernelResult.Success) if (context.Process.HandleTable.GenerateHandle(context.Device.System.FontSharedMem, out int handle) != KernelResult.Success)
{ {