various fixes and log notes

This commit is contained in:
13xforever 2018-10-08 22:04:43 +05:00 committed by Roberto Anić Banić
parent 91038fd7f7
commit 6e37e9920f
6 changed files with 27 additions and 6 deletions

View File

@ -25,7 +25,7 @@ namespace CompatBot.Commands
await ctx.TriggerTypingAsync().ConfigureAwait(false);
if (string.IsNullOrEmpty(term))
{
await ctx.RespondAsync($"You may want to look at available terms by using `{Config.CommandPrefix}explain list` in any spam channel or bot's DMs").ConfigureAwait(false);
await ctx.RespondAsync($"You may want to look at available terms by using `{Config.CommandPrefix}explain list` in a bot spam channel or bot DMs").ConfigureAwait(false);
return;
}
@ -66,7 +66,7 @@ namespace CompatBot.Commands
}
}
await ctx.RespondAsync($"Unknown term `{term.Sanitize()}`. Use `!explain list` to look at defined terms").ConfigureAwait(false);
await ctx.RespondAsync($"Unknown term `{term.Sanitize()}`. Use `!explain list` to look at defined terms in a bot spam channel or bot DMs").ConfigureAwait(false);
}
[Command("add"), RequiresBotModRole]

View File

@ -64,7 +64,8 @@ namespace CompatBot.EventHandlers.LogParsing
["Accurate xfloat:"] = new Regex("Accurate xfloat: (?<accurate_xfloat>.*?)\r?$", DefaultOptions),
["Lib Loader:"] = new Regex("[Ll]oader: (?<lib_loader>.*?)\r?$", DefaultOptions),
["Hook static functions:"] = new Regex("Hook static functions: (?<hook_static_functions>.*?)\r?$", DefaultOptions),
["Load libraries:"] = new Regex("libraries:(?<library_list>.*?)$", DefaultSingleLineOptions),
["Load libraries:"] = new Regex(@"libraries:\r?\n(?<library_list>(.*?(- .*?|\[\])\r?\n)+)", DefaultOptions),
["HLE lwmutex:"] = new Regex(@"HLE lwmutex: (?<hle_lwmutex>.*?)\r?$", DefaultOptions),
},
EndTrigger = "VFS:",
},
@ -91,6 +92,7 @@ namespace CompatBot.EventHandlers.LogParsing
["Resolution Scale:"] = new Regex("Resolution Scale: (?<resolution_scale>.*?)\r?$", DefaultOptions),
["Anisotropic Filter"] = new Regex("Anisotropic Filter Override: (?<af_override>.*?)\r?$", DefaultOptions),
["Scalable Dimension:"] = new Regex("Minimum Scalable Dimension: (?<texture_scale_threshold>.*?)\r?$", DefaultOptions),
["Driver Recovery Timeout:"] = new Regex("Driver Recovery Timeout: (?<driver_recovery_timeout>.*?)\r?$", DefaultOptions),
["12:"] = new Regex(@"(D3D12|DirectX 12):\s*\r?\n\s*Adapter: (?<d3d_gpu>.*?)\r?$", DefaultOptions),
["Vulkan:"] = new Regex(@"Vulkan:\s*\r?\n\s*Adapter: (?<vulkan_gpu>.*?)\r?$", DefaultOptions),
},

View File

@ -18,7 +18,7 @@ namespace CompatBot.EventHandlers
internal static class ProductCodeLookup
{
// see http://www.psdevwiki.com/ps3/Productcode
public static readonly Regex ProductCode = new Regex(@"(?<letters>(?:[BPSUVX][CL]|P[ETU]|NP)[AEHJKPUIX][ABSM])[ \-]?(?<numbers>\d{5})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static readonly Regex ProductCode = new Regex(@"(?<letters>(?:[BPSUVX][CL]|P[ETU]|NP)[AEHJKPUIX][ABSM]|MRTC)[ \-]?(?<numbers>\d{5})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Client compatClient = new Client();
public static async Task OnMessageCreated(MessageCreateEventArgs args)

View File

@ -8,7 +8,6 @@ using System.Threading.Tasks;
using CompatBot.Database;
using CompatBot.Database.Providers;
using CompatBot.EventHandlers;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using PsnClient.POCOs;
using PsnClient.Utils;

View File

@ -95,7 +95,7 @@ namespace CompatBot.Utils
return first + last;
if (first == last)
return first;
return first.Substring(0, 1);
if (last.StartsWith(first))
return $"{first} - {last}";

View File

@ -268,6 +268,17 @@ namespace CompatBot.Utils.ResultFormatters
notes.AppendLine("`Force CPU Blit` is enabled, but `Write Color Buffers` is disabled");
if (items["zcull"] is string zcull && zcull == TrueMark)
notes.AppendLine("`ZCull Occlusion Queries` are disabled, can result in visual artifacts");
if (items["driver_recovery_timeout"] is string driverRecoveryTimeout && int.TryParse(driverRecoveryTimeout, out var drtValue) && drtValue != 1000000)
{
if (drtValue == 0)
notes.AppendLine("`Driver Recovery Timeout` is set to 0 (infinite), please use default value of 1000000");
else if (drtValue < 10_000)
notes.AppendLine($"`Driver Recovery Timeout` is set too low: {GetTimeFormat(drtValue)} (1 frame @ {(1_000_000.0 / drtValue):0.##} fps)");
else if (drtValue > 10_000_000)
notes.AppendLine($"`Driver Recovery Timeout` is set too high: {GetTimeFormat(drtValue)}");
}
if (items["hle_lwmutex"] is string hleLwmutex && hleLwmutex == TrueMark)
notes.AppendLine("`HLE lwmutex` is enabled, might affect compatibility");
if (items["spu_block_size"] is string spuBlockSize && spuBlockSize == "Giga")
notes.AppendLine("`Giga` mode for `SPU Block Size` is strongly not recommended to use");
@ -445,5 +456,14 @@ namespace CompatBot.Utils.ResultFormatters
return $"{major}.{minor}.{patch}";
}
}
private static string GetTimeFormat(long microseconds)
{
if (microseconds < 1000)
return $"{microseconds} µs";
if (microseconds < 1_000_000)
return $"{microseconds / 1000.0:0.##} ms";
return $"{microseconds / 1_000_000.0:0.##} s";
}
}
}