From f3a759cd367c3e3a848e541e323d3b14e53f35cc Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 28 Jul 2025 11:15:46 +0500 Subject: [PATCH 1/4] debug logs --- CompatBot/Program.cs | 19 +++++++++++++++++++ .../LogParserResultFormatter.cs | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CompatBot/Program.cs b/CompatBot/Program.cs index 557c4911..aa3876be 100644 --- a/CompatBot/Program.cs +++ b/CompatBot/Program.cs @@ -100,15 +100,24 @@ internal static class Program } } +#if DEBUG + Config.Log.Debug("Upgrading databases…"); +#endif if (!await DbImporter.UpgradeAsync(Config.Cts.Token).ConfigureAwait(false)) return; +#if DEBUG + Config.Log.Debug("Restoring configuration and stats…"); +#endif await SqlConfiguration.RestoreAsync().ConfigureAwait(false); Config.Log.Debug("Restored configuration variables from persistent storage"); await StatsStorage.RestoreAsync().ConfigureAwait(false); Config.Log.Debug("Restored stats from persistent storage"); +#if DEBUG + Config.Log.Debug("Starting background tasks…"); +#endif var backgroundTasks = Task.WhenAll( AmdDriverVersionProvider.RefreshAsync(), #if !DEBUG @@ -125,6 +134,9 @@ internal static class Program OcrProvider.InitializeAsync(Config.Cts.Token) ); +#if DEBUG + Config.Log.Debug("Checking IRD cache folder…"); +#endif try { if (!Directory.Exists(Config.IrdCachePath)) @@ -135,6 +147,9 @@ internal static class Program Config.Log.Warn(e, $"Failed to create new folder {Config.IrdCachePath}: {e.Message}"); } +#if DEBUG + Config.Log.Debug("Configuring Discord client…"); +#endif var clientInfoLogged = false; var mediaScreenshotMonitor = new MediaScreenshotMonitor(); var clientBuilder = DiscordClientBuilder @@ -308,6 +323,7 @@ internal static class Program try { + Config.Log.Debug("Connecting…"); await client.ConnectAsync().ConfigureAwait(false); } catch (Exception e) @@ -316,6 +332,9 @@ internal static class Program throw; } +#if DEBUG + Config.Log.Info("Checking restart state…"); +#endif ulong? channelId = null; string? restartMsg = null; await using (var wdb = await BotDb.OpenWriteAsync().ConfigureAwait(false)) diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs index c33fa38a..252f02e0 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs @@ -788,7 +788,7 @@ internal static partial class LogParserResult var link = updateInfo.X64?.LatestBuild.Windows?.Download ?? updateInfo.X64?.LatestBuild.Linux?.Download ?? updateInfo.X64?.LatestBuild.Mac?.Download - ??updateInfo.Arm?.LatestBuild.Windows?.Download + ?? updateInfo.Arm?.LatestBuild.Windows?.Download ?? updateInfo.Arm?.LatestBuild.Linux?.Download ?? updateInfo.Arm?.LatestBuild.Mac?.Download; if (updateInfo.ReturnCode is not StatusCode.UpdatesAvailable || link is null) From 3237cb2d11cbb012b3f410199eb5978d0a314893 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 28 Jul 2025 21:43:05 +0500 Subject: [PATCH 2/4] detect custom builds --- ...LogParserResultFormatter.CurrentSettingsSections.cs | 1 + .../LogParserResultFormatter.GeneralNotesSection.cs | 10 ++++++++++ .../Utils/ResultFormatters/LogParserResultFormatter.cs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.CurrentSettingsSections.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.CurrentSettingsSections.cs index 2bb60b50..6176c3a9 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.CurrentSettingsSections.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.CurrentSettingsSections.cs @@ -33,6 +33,7 @@ internal static partial class LogParserResult items["build_full_version"] = $"{items["build_version"]}.{items["build_number"]}"; items["build_commit"] = buildInfo.Groups["commit"].Value.Trim(); items["build_branch"] = buildInfo.Groups["branch"].Value.Trim(); + items["build_unknown"] = buildInfo.Groups["unknown"].Value.Trim(); var fwVersion = buildInfo.Groups["fw_version_installed"].Value; if (!string.IsNullOrEmpty(fwVersion)) items["fw_version_installed"] = fwVersion; diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index 5e7cac45..e0b595fe 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -438,6 +438,7 @@ internal static partial class LogParserResult var updateInfo = await CheckForUpdateAsync(items).ConfigureAwait(false); var buildBranch = items["build_branch"]?.ToLowerInvariant(); if (updateInfo is not null + && items["build_unknown"] is not {Length: >0} && (buildBranch is "master" or "head" or "spu_perf" || buildBranch is not {Length: >0} && (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null))) @@ -465,6 +466,15 @@ internal static partial class LogParserResult if (buildBranch == "spu_perf") notes.Add($"😱 `{buildBranch}` build is obsolete, current master build offers at least the same level of performance and includes many additional improvements"); } + else if (items["build_unknown"] is "local_build") + { + if (items["build_commit"] is { Length: > 0 } commit && commit.Contains("AUR")) + notes.Add("❌ Unofficial AUR builds are not supported"); + else if (items["build_number"] is "1" && items["os_type"] is "Linux") + notes.Add("❌ Flatpak builds are not supported"); + else + notes.Add("❌ Unofficial builds are not supported"); + } if (DesIds.Contains(serial)) notes.Add("ℹ️ If you experience infinite load screen, clear game cache via `File` → `All games` → `Remove Disk Cache`"); diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs index 252f02e0..dafce5fa 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs @@ -24,7 +24,7 @@ internal static partial class LogParserResult // RPCS3 v0.0.5-7104-a19113025 Alpha | HEAD // RPCS3 v0.0.5-42b4ce13a Alpha | minor // RPCS3 v0.0.18-local_build Alpha | local_build - [GeneratedRegex(@"RPCS3 v(?(?(\d|\.)+)(-(?\d+))?-(?[0-9a-z_]+|unknown))( (?\w+))?( \| (?[^|\r\n]+))?( \| Firmware version: (?[^|\r\n]+))?( \| (?.*))?\r?$", DefaultSingleLine)] + [GeneratedRegex(@"RPCS3 v(?(?(\d|\.)+)(-(?(\d|\.)+))?-(?([0-9a-z_]+|unknown)( \S+)??))( (?\w+))?( \| (?[^|\r\n]+))?( \| Firmware version: (?[^|\r\n]+))?( \| (?.*))?\r?$", DefaultSingleLine)] private static partial Regex BuildInfoInLog(); [GeneratedRegex(@"(\d{1,2}(th|rd|nd|st) Gen)?(?[^|@]+?)\s*(((CPU\s*)?@\s*(?.+)\s*GHz\s*)|((APU with|((with|w/) )?Radeon|R\d, \d+ Compute) [^|]+)|((\w+[\- ]Core )?Processor))?\s* \| (?\d+) Threads \| (?[0-9\.\,]+) GiB RAM( \| TSC: (?\S+))?( \| (?.*?))?\r?$", DefaultSingleLine)] private static partial Regex CpuInfoInLog(); From 64695cd88bc3810cccb703b6f34f21c4c944006a Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 28 Jul 2025 21:49:54 +0500 Subject: [PATCH 3/4] add corporate onedrive check --- .../LogParserResultFormatter.GeneralNotesSection.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index e0b595fe..9884e434 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -176,7 +176,11 @@ internal static partial class LogParserResult } var pathSegments = PathUtils.GetSegments(compatDbPath); - var syncFolder = pathSegments.FirstOrDefault(s => KnownSyncFolders.Contains(s) || s.EndsWith("sync", StringComparison.OrdinalIgnoreCase)); + var syncFolder = pathSegments.FirstOrDefault( + s => KnownSyncFolders.Contains(s) + || s.EndsWith("sync", StringComparison.OrdinalIgnoreCase) + || s.StartsWith("OneDrive - ") // corporate + ); if (!string.IsNullOrEmpty(syncFolder)) notes.Add($"⚠️ RPCS3 is installed in a file sync service folder `{syncFolder}`; may result in data loss or inconsistent state"); var rar = pathSegments.FirstOrDefault(s => s.StartsWith("Rar$")); From cfd9bc9312d47c39d8aeaf47f8f43f1a8b9da29a Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 28 Jul 2025 22:32:16 +0500 Subject: [PATCH 4/4] add more corrupted data checks --- .../LogParsing/LogParser.LogSections.cs | 5 +++ .../LogParsing/LogParser.RegexPatterns.cs | 6 +++ ...rserResultFormatter.GeneralNotesSection.cs | 44 +++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs b/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs index 91d8c0d6..f0b0ab33 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs @@ -239,6 +239,9 @@ internal partial class LogParser ["undub"] = UndubFlag(), ["Input: Pad"] = InputDeviceGamepad(), ["SDL: Found game controller"] = SdlControllerName(), + ["SYS: Failed to remove save data"] = FailedToRemoveSaveData(), + ["Trophy: Failed to remove"] = FailedToRemoveTrophy(), + ["Failed to install trophy"] = FailedToInstallTrophy(), }, OnSectionEnd = MarkAsCompleteAndReset, EndTrigger = ["Stopping emulator...", "All threads stopped...", "LDR: Booting from"], @@ -273,6 +276,8 @@ internal partial class LogParser "verification_error_hex", "verification_error", "tty_line", + "bad_save_data_path", + "bad_trophy_data_path", ]; private static readonly string[] CountValueItems = ["enqueue_buffer_error"]; diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs b/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs index d2951d85..88dd2720 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs @@ -353,4 +353,10 @@ internal partial class LogParser private static partial Regex InputDeviceGamepad(); [GeneratedRegex(@"Found game controller \d: .+ has_accel=(?.+?), has_gyro=(?[^\r\n]+?)\r?$", DefaultOptions)] private static partial Regex SdlControllerName(); + [GeneratedRegex(@"Failed to remove save data.+: .+(?/dev_hdd0/.+) \(.+\)\r?$", DefaultOptions)] + private static partial Regex FailedToRemoveSaveData(); + [GeneratedRegex(@"Failed to remove.+ '.+(?/dev_hdd0/.+)' \(.+\)\r?$", DefaultOptions)] + private static partial Regex FailedToRemoveTrophy(); + [GeneratedRegex(@"Failed to install .+ '.*(?/dev_hdd0/.+)' \(.+\)\r?$", DefaultOptions)] + private static partial Regex FailedToInstallTrophy(); } \ No newline at end of file diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index 9884e434..2dc00c92 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -646,6 +646,50 @@ internal static partial class LogParserResult notes.Add("⚠️ PPU desync detected, most likely cause is corrupted save data"); }*/ } + else + { + if (multiItems["bad_save_data_path"] is { Length: > 0 } badSavePaths) + { + if (badSavePaths is [string singlePath]) + notes.Add($"❌ Corrupted save data `{singlePath}`"); + else + { + var section = new StringBuilder("```"); + foreach (var path in badSavePaths) + section.AppendLine(path); + if (section.Length + 3 > EmbedPager.MaxFieldLength) + { + section.Length = EmbedPager.MaxFieldLength - 4; + section.Append("…```"); + } + builder.AddField( + $"Corrupted save data (x{badSavePaths.Length})", + section.ToString() + ); + } + } + if (multiItems["bad_trophy_data_path"] is { Length: > 0 } badTrophyPaths) + { + if (badTrophyPaths is [string singlePath]) + notes.Add($"❌ Corrupted trophy data `{singlePath}`"); + else + { + var section = new StringBuilder("```"); + foreach (var path in badTrophyPaths) + section.AppendLine(path); + if (section.Length + 3 > EmbedPager.MaxFieldLength) + { + section.Length = EmbedPager.MaxFieldLength - 4; + section.Append("…```"); + } + builder.AddField( + $"Corrupted trophy data (x{badTrophyPaths.Length})", + section.ToString() + ); + } + + } + } if (items["os_type"] == "Windows") foreach (var code in win32ErrorCodes) {