Logger and Configuration Refactoring (#573)
* Logging: Refactor log targets into Ryujinx.Common * Logger: Implement JSON Log Target * Logger: Optimize Console/File logging targets Implement a simple ObjectPool to pool up StringBuilders to avoid causing excessive GCing of gen1/2 items when large amounts of log entries are being generated. We can also pre-determine the async overflow action at initialization time, allowing for an easy optimization in the message enqueue function, avoiding a number of comparisons. * Logger: Implement LogFormatters * Config: Refactor configuration file and loading * Config: Rename to .jsonc to avoid highlighting issues in VSC and GitHub * Resolve style nits * Config: Resolve incorrect default key binding * Config: Also update key binding default in schema * Tidy up namespace imports * Config: Update CONFIG.md to reflect new Config file
This commit is contained in:
parent
a694420d11
commit
d306115750
31 changed files with 1844 additions and 691 deletions
|
@ -20,9 +20,8 @@ namespace Ryujinx
|
|||
|
||||
Switch device = new Switch(renderer, audioOut);
|
||||
|
||||
Config.Read(device);
|
||||
|
||||
Logger.Updated += Log.LogMessage;
|
||||
Configuration.Load("Config.jsonc");
|
||||
Configuration.Configure(device);
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||
|
@ -40,13 +39,13 @@ namespace Ryujinx
|
|||
|
||||
if (romFsFiles.Length > 0)
|
||||
{
|
||||
Console.WriteLine("Loading as cart with RomFS.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS.");
|
||||
|
||||
device.LoadCart(args[0], romFsFiles[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Loading as cart WITHOUT RomFS.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
|
||||
|
||||
device.LoadCart(args[0]);
|
||||
}
|
||||
|
@ -56,20 +55,20 @@ namespace Ryujinx
|
|||
switch (Path.GetExtension(args[0]).ToLowerInvariant())
|
||||
{
|
||||
case ".xci":
|
||||
Console.WriteLine("Loading as XCI.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as XCI.");
|
||||
device.LoadXci(args[0]);
|
||||
break;
|
||||
case ".nca":
|
||||
Console.WriteLine("Loading as NCA.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as NCA.");
|
||||
device.LoadNca(args[0]);
|
||||
break;
|
||||
case ".nsp":
|
||||
case ".pfs0":
|
||||
Console.WriteLine("Loading as NSP.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as NSP.");
|
||||
device.LoadNsp(args[0]);
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Loading as homebrew.");
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as homebrew.");
|
||||
device.LoadProgram(args[0]);
|
||||
break;
|
||||
}
|
||||
|
@ -77,7 +76,7 @@ namespace Ryujinx
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
|
||||
Logger.PrintInfo(LogClass.Application, "Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
|
||||
}
|
||||
|
||||
using (GlScreen screen = new GlScreen(device, renderer))
|
||||
|
@ -88,11 +87,13 @@ namespace Ryujinx
|
|||
}
|
||||
|
||||
audioOut.Dispose();
|
||||
|
||||
Logger.Shutdown();
|
||||
}
|
||||
|
||||
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
|
||||
{
|
||||
Log.Close();
|
||||
Logger.Shutdown();
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
|
@ -103,7 +104,7 @@ namespace Ryujinx
|
|||
|
||||
if (e.IsTerminating)
|
||||
{
|
||||
Log.Close();
|
||||
Logger.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue