Improved Logger (#1292)
* Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements
This commit is contained in:
parent
60db4c3530
commit
a33dc2f491
120 changed files with 800 additions and 809 deletions
|
@ -126,7 +126,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (titleModsPath == null)
|
||||
{
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Creating mods dir for Title {titleId.ToUpper()}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Creating mods dir for Title {titleId.ToUpper()}");
|
||||
titleModsPath = contentsDir.CreateSubdirectory(titleId);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace Ryujinx.HLE.HOS
|
|||
foreach (var modDir in patchDir.EnumerateDirectories())
|
||||
{
|
||||
patches.Add(new Mod<DirectoryInfo>(modDir.Name, modDir));
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Found {type} patch '{modDir.Name}'");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Found {type} patch '{modDir.Name}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
}
|
||||
|
||||
if (types.Length > 0) Logger.PrintInfo(LogClass.ModLoader, $"Found mod '{mod.Name}' [{types}]");
|
||||
if (types.Length > 0) Logger.Info?.Print(LogClass.ModLoader, $"Found mod '{mod.Name}' [{types}]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ namespace Ryujinx.HLE.HOS
|
|||
{
|
||||
if (!contentsDir.Exists) return;
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Searching mods for Title {titleId:X16}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Searching mods for Title {titleId:X16}");
|
||||
|
||||
var titleDir = FindTitleDir(contentsDir, $"{titleId:x16}");
|
||||
|
||||
|
@ -252,7 +252,7 @@ namespace Ryujinx.HLE.HOS
|
|||
var dir = new DirectoryInfo(path);
|
||||
if (!dir.Exists)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.ModLoader, $"Mod Search Dir '{dir.FullName}' doesn't exist");
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Mod Search Dir '{dir.FullName}' doesn't exist");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ namespace Ryujinx.HLE.HOS
|
|||
var builder = new RomFsBuilder();
|
||||
int count = 0;
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Applying RomFS mods for Title {titleId:X16}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Applying RomFS mods for Title {titleId:X16}");
|
||||
|
||||
// Prioritize loose files first
|
||||
foreach (var mod in mods.RomfsDirs)
|
||||
|
@ -305,7 +305,7 @@ namespace Ryujinx.HLE.HOS
|
|||
// Then files inside images
|
||||
foreach (var mod in mods.RomfsContainers)
|
||||
{
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Found 'romfs.bin' for Title {titleId:X16}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Found 'romfs.bin' for Title {titleId:X16}");
|
||||
using (IFileSystem fs = new RomFsFileSystem(mod.Path.OpenRead().AsStorage()))
|
||||
{
|
||||
AddFiles(fs, mod.Name, fileSet, builder);
|
||||
|
@ -315,12 +315,12 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (fileSet.Count == 0)
|
||||
{
|
||||
Logger.PrintInfo(LogClass.ModLoader, "No files found. Using base RomFS");
|
||||
Logger.Info?.Print(LogClass.ModLoader, "No files found. Using base RomFS");
|
||||
|
||||
return baseStorage;
|
||||
}
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Replaced {fileSet.Count} file(s) over {count} mod(s). Processing base storage...");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Replaced {fileSet.Count} file(s) over {count} mod(s). Processing base storage...");
|
||||
|
||||
// And finally, the base romfs
|
||||
var baseRom = new RomFsFileSystem(baseStorage);
|
||||
|
@ -332,9 +332,9 @@ namespace Ryujinx.HLE.HOS
|
|||
builder.AddFile(entry.FullPath, file);
|
||||
}
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, "Building new RomFS...");
|
||||
Logger.Info?.Print(LogClass.ModLoader, "Building new RomFS...");
|
||||
IStorage newStorage = builder.Build();
|
||||
Logger.PrintInfo(LogClass.ModLoader, "Using modded RomFS");
|
||||
Logger.Info?.Print(LogClass.ModLoader, "Using modded RomFS");
|
||||
|
||||
return newStorage;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
else
|
||||
{
|
||||
Logger.PrintWarning(LogClass.ModLoader, $" Skipped duplicate file '{entry.FullPath}' from '{modName}'", "ApplyRomFsMods");
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $" Skipped duplicate file '{entry.FullPath}' from '{modName}'", "ApplyRomFsMods");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,10 +366,10 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (mods.ExefsContainers.Count > 1)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.ModLoader, "Multiple ExeFS partition replacements detected");
|
||||
Logger.Warning?.Print(LogClass.ModLoader, "Multiple ExeFS partition replacements detected");
|
||||
}
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Using replacement ExeFS partition");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Using replacement ExeFS partition");
|
||||
|
||||
exefs = new PartitionFileSystem(mods.ExefsContainers[0].Path.OpenRead().AsStorage());
|
||||
|
||||
|
@ -407,14 +407,14 @@ namespace Ryujinx.HLE.HOS
|
|||
{
|
||||
if (repls[1 << i])
|
||||
{
|
||||
Logger.PrintWarning(LogClass.ModLoader, $"Multiple replacements to '{nsoName}'");
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Multiple replacements to '{nsoName}'");
|
||||
continue;
|
||||
}
|
||||
|
||||
repls[1 << i] = true;
|
||||
|
||||
nsos[i] = new NsoExecutable(nsoFile.OpenRead().AsStorage(), nsoName);
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"NSO '{nsoName}' replaced");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"NSO '{nsoName}' replaced");
|
||||
|
||||
replaced = true;
|
||||
|
||||
|
@ -429,7 +429,7 @@ namespace Ryujinx.HLE.HOS
|
|||
{
|
||||
if (stubs[1 << i] && !repls[1 << i]) // Prioritizes replacements over stubs
|
||||
{
|
||||
Logger.PrintInfo(LogClass.ModLoader, $" NSO '{nsos[i].Name}' stubbed");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $" NSO '{nsos[i].Name}' stubbed");
|
||||
nsos.RemoveAt(i);
|
||||
replaced = true;
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ namespace Ryujinx.HLE.HOS
|
|||
continue;
|
||||
}
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Matching IPS patch '{patchFile.Name}' in '{mod.Name}' bid={buildId}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Matching IPS patch '{patchFile.Name}' in '{mod.Name}' bid={buildId}");
|
||||
|
||||
using var fs = patchFile.OpenRead();
|
||||
using var reader = new BinaryReader(fs);
|
||||
|
@ -521,7 +521,7 @@ namespace Ryujinx.HLE.HOS
|
|||
continue;
|
||||
}
|
||||
|
||||
Logger.PrintInfo(LogClass.ModLoader, $"Matching IPSwitch patch '{patchFile.Name}' in '{mod.Name}' bid={patcher.BuildId}");
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Matching IPSwitch patch '{patchFile.Name}' in '{mod.Name}' bid={patcher.BuildId}");
|
||||
|
||||
patcher.AddPatches(patches[index]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue