Merge pull request #526 from 13xforever/vnext

Update fatal error handling with the new multivalue system
This commit is contained in:
Ilya 2020-03-02 18:05:26 +05:00 committed by GitHub
commit a35488cb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 33 deletions

View File

@ -58,15 +58,15 @@ namespace CompatBot.Database.Providers
int funcs = 0, links = 0;
using (var db = new ThumbnailDb())
{
var funcsToFix = new List<SyscallInfo>(0);
var funcsToRemove = new List<SyscallInfo>(0);
try
{
funcsToFix = await db.SyscallInfo.Where(sci => sci.Function.Contains('(')).ToListAsync().ConfigureAwait(false);
funcs = funcsToFix.Count;
funcsToRemove = await db.SyscallInfo.Where(sci => sci.Function.Contains('(') || sci.Function.StartsWith('“')).ToListAsync().ConfigureAwait(false);
funcs = funcsToRemove.Count;
if (funcs == 0)
return (0, 0);
foreach (var sci in funcsToFix)
foreach (var sci in funcsToRemove.Where(sci => sci.Function.Contains('(')))
{
var productIds = await db.SyscallToProductMap.AsNoTracking().Where(m => m.SyscallInfoId == sci.Id).Select(m => m.Product.ProductCode).Distinct().ToListAsync().ConfigureAwait(false);
links += productIds.Count;
@ -90,7 +90,7 @@ namespace CompatBot.Database.Providers
{
try
{
db.SyscallInfo.RemoveRange(funcsToFix);
db.SyscallInfo.RemoveRange(funcsToRemove);
await db.SaveChangesAsync().ConfigureAwait(false);
}
catch (Exception e)

View File

@ -212,7 +212,7 @@ namespace CompatBot.EventHandlers.LogParsing
["Unimplemented syscall"] = new Regex(@"U \d+:\d+:\d+\.\d+ ({(?<unimplemented_syscall_context>.+?)} )?.*Unimplemented syscall (?<unimplemented_syscall>.*)\r?$", DefaultOptions),
["Could not enqueue"] = new Regex(@"cellAudio: Could not enqueue buffer onto audio backend(?<enqueue_buffer_error>.).*\r?$", DefaultOptions),
["Failed to bind device"] = new Regex(@"Failed to bind device (?<failed_pad>.+) to handler (?<failed_pad_handler>.+).*\r?$", DefaultOptions),
["{PPU["] = new Regex(@"{PPU\[.+\]} (?<syscall_module>[^ :]+)( TODO)?: (?<syscall_name>[^ :]+?)\(.*\r?$", DefaultOptions),
["{PPU["] = new Regex(@"{PPU\[.+\]} (?<syscall_module>[^ :]+)( TODO)?: (?!\xE2\x80\x9C)(?<syscall_name>[^ :]+?)\(.*\r?$", DefaultOptions),
["undub"] = new Regex(@"(\b|_)(?<game_mod>undub)(\b|_)", DefaultOptions | RegexOptions.IgnoreCase),
},
OnNewLineAsync = LimitedPiracyCheckAsync,
@ -223,6 +223,8 @@ namespace CompatBot.EventHandlers.LogParsing
public static readonly HashSet<string> MultiValueItems = new HashSet<string>
{
"fatal_error_context",
"fatal_error",
"rap_file",
"vulkan_found_device",
"vulkan_compatible_device_name",

View File

@ -27,40 +27,60 @@ namespace CompatBot.Utils.ResultFormatters
var isEboot = !string.IsNullOrEmpty(elfBootPath) && elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase);
var isElf = !string.IsNullOrEmpty(elfBootPath) && !elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase);
var serial = items["serial"] ?? "";
if (items["fatal_error"] is string fatalError)
if (multiItems["fatal_error"] is UniqueList<string> fatalErrors && fatalErrors.Any())
{
var context = items["fatal_error_context"] ?? "";
builder.AddField("Fatal Error", $"```\n{fatalError.Trim(1020)}\n```");
if (fatalError.Contains("psf.cpp", StringComparison.InvariantCultureIgnoreCase)
|| fatalError.Contains("invalid map<K, T>", StringComparison.InvariantCultureIgnoreCase)
|| context.Contains("SaveData", StringComparison.InvariantCultureIgnoreCase))
notes.Add("❌ Game save data is corrupted");
else if (fatalError.Contains("Could not bind OpenGL context"))
notes.Add("❌ GPU or installed GPU drivers do not support OpenGL 4.3");
else if (fatalError.Contains("file is null"))
var contexts = multiItems["fatal_error_context"];
foreach (var fatalError in fatalErrors)
{
if (context.StartsWith("RSX", StringComparison.InvariantCultureIgnoreCase) || fatalError.StartsWith("RSX:"))
notes.Add("❌ Shader cache might be corrupted; right-click on the game, then `Remove` → `Shader Cache`");
if (context.StartsWith("SPU", StringComparison.InvariantCultureIgnoreCase))
notes.Add("❌ SPU cache might be corrupted; right-click on the game, then `Remove` → `SPU Cache`");
if (context.StartsWith("PPU", StringComparison.InvariantCultureIgnoreCase))
notes.Add("❌ PPU cache might be corrupted; right-click on the game, then `Remove` → `PPU Cache`");
}
else if (fatalError.Contains("(e=0x17): file::read"))
{
// on windows this is ERROR_CRC
notes.Add("❌ Storage device communication error; check your cables");
}
else if (fatalError.Contains("Unknown primitive type"))
{
notes.Add("⚠ RSX desync detected, it's probably random");
var knownFatal = false;
if (fatalError.Contains("psf.cpp", StringComparison.InvariantCultureIgnoreCase)
|| fatalError.Contains("invalid map<K, T>", StringComparison.InvariantCultureIgnoreCase)
|| contexts.Any(c => c.Contains("SaveData", StringComparison.InvariantCultureIgnoreCase)))
{
knownFatal = true;
notes.Add("❌ Game save data is corrupted");
}
else if (fatalError.Contains("Could not bind OpenGL context"))
{
knownFatal = true;
notes.Add("❌ GPU or installed GPU drivers do not support OpenGL 4.3");
}
else if (fatalError.Contains("file is null"))
{
if (contexts.Any(c => c.StartsWith("RSX", StringComparison.InvariantCultureIgnoreCase)))
{
knownFatal = true;
notes.Add("❌ Shader cache might be corrupted; right-click on the game, then `Remove` → `Shader Cache`");
}
if (contexts.Any(c => c.StartsWith("SPU", StringComparison.InvariantCultureIgnoreCase)))
{
knownFatal = true;
notes.Add("❌ SPU cache might be corrupted; right-click on the game, then `Remove` → `SPU Cache`");
}
if (contexts.Any(c => c.StartsWith("PPU", StringComparison.InvariantCultureIgnoreCase)))
{
knownFatal = true;
notes.Add("❌ PPU cache might be corrupted; right-click on the game, then `Remove` → `PPU Cache`");
}
}
else if (fatalError.Contains("(e=0x17): file::read"))
{
// on windows this is ERROR_CRC
notes.Add("❌ Storage device communication error; check your cables");
}
else if (fatalError.Contains("Unknown primitive type"))
{
notes.Add("⚠ RSX desync detected, it's probably random");
}
if (!knownFatal)
builder.AddField("Fatal Error", $"```\n{fatalError.Trim(1020)}\n```");
}
}
else if (items["unimplemented_syscall"] is string unimplementedSyscall)
{
if (unimplementedSyscall.Contains("syscall_988"))
{
fatalError = "Unimplemented syscall " + unimplementedSyscall;
var fatalError = "Unimplemented syscall " + unimplementedSyscall;
builder.AddField("Fatal Error", $"```{fatalError.Trim(1022)}```");
if (items["ppu_decoder"] is string ppuDecoder && ppuDecoder.Contains("Recompiler") && !Config.Colors.CompatStatusPlayable.Equals(builder.Color.Value))
notes.Add("⚠ PPU desync detected; check your save data for corruption and/or try PPU Interpreter");

View File

@ -365,7 +365,7 @@ namespace CompatBot.Utils.ResultFormatters
if (items["mtrsx"] is string mtrsx && mtrsx == EnabledMark)
{
if (items["fatal_error"] is string fatal && fatal.Contains("VK_ERROR_OUT_OF_POOL_MEMORY_KHR"))
if (multiItems["fatal_error"].Any(f => f.Contains("VK_ERROR_OUT_OF_POOL_MEMORY_KHR")))
notes.Add("⚠ `Multithreaded RSX` is enabled, please disable for this game");
else if (items["write_color_buffers"] == EnabledMark)
notes.Add("⚠ `Multithreaded RSX` is enabled along with `Write Color Buffers` which may cause crashes");