Keep the GUI alive when closing a game (#888)
* Keep the GUI alive when closing a game Make HLE.Switch init when starting a game and dispose it when closing the GlScreen. This also make HLE in charge of disposing the audio and gpu backend. * Address Ac_k's comments * Make sure to dispose the Discord module and use GTK quit method Also update Discord Precense when closing a game. * Make sure to dispose MainWindow * Address gdk's comments
This commit is contained in:
parent
b4b2b8b162
commit
d6b9babe1d
16 changed files with 284 additions and 215 deletions
|
@ -44,15 +44,15 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
_fontsPath = Path.Combine(device.FileSystem.GetSystemPath(), "fonts");
|
||||
}
|
||||
|
||||
public void Initialize(ContentManager contentManager, bool ignoreMissingFonts)
|
||||
public void Initialize(ContentManager contentManager)
|
||||
{
|
||||
_fontData?.Clear();
|
||||
_fontData = null;
|
||||
|
||||
EnsureInitialized(contentManager, ignoreMissingFonts);
|
||||
EnsureInitialized(contentManager);
|
||||
}
|
||||
|
||||
public void EnsureInitialized(ContentManager contentManager, bool ignoreMissingFonts)
|
||||
public void EnsureInitialized(ContentManager contentManager)
|
||||
{
|
||||
if (_fontData == null)
|
||||
{
|
||||
|
@ -120,12 +120,10 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
|
||||
return info;
|
||||
}
|
||||
else if (!ignoreMissingFonts)
|
||||
else
|
||||
{
|
||||
throw new InvalidSystemResourceException($"Font \"{name}.ttf\" not found. Please provide it in \"{_fontsPath}\".");
|
||||
}
|
||||
|
||||
return new FontInfo();
|
||||
}
|
||||
|
||||
_fontData = new Dictionary<SharedFontType, FontInfo>
|
||||
|
@ -138,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
{ SharedFontType.NintendoEx, CreateFont("FontNintendoExtended") }
|
||||
};
|
||||
|
||||
if (fontOffset > Horizon.FontSize && !ignoreMissingFonts)
|
||||
if (fontOffset > Horizon.FontSize)
|
||||
{
|
||||
throw new InvalidSystemResourceException(
|
||||
$"The sum of all fonts size exceed the shared memory size. " +
|
||||
|
@ -161,14 +159,14 @@ namespace Ryujinx.HLE.HOS.Font
|
|||
|
||||
public int GetFontSize(SharedFontType fontType)
|
||||
{
|
||||
EnsureInitialized(_device.System.ContentManager, false);
|
||||
EnsureInitialized(_device.System.ContentManager);
|
||||
|
||||
return _fontData[fontType].Size;
|
||||
}
|
||||
|
||||
public int GetSharedMemoryAddressOffset(SharedFontType fontType)
|
||||
{
|
||||
EnsureInitialized(_device.System.ContentManager, false);
|
||||
EnsureInitialized(_device.System.ContentManager);
|
||||
|
||||
return _fontData[fontType].Offset + 8;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue