Skip to content

Commit

Permalink
detect more cases of disc games installed as a pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
13xforever committed Jan 14, 2019
1 parent 3205a49 commit 8d0cfd5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AppveyorClient/Client.cs
Expand Up @@ -147,7 +147,7 @@ public async Task<BuildInfo> GetBuildInfoAsync(string buildUrl, CancellationToke
await response.Content.LoadIntoBufferAsync().ConfigureAwait(false);
var result = await response.Content.ReadAsAsync<BuildInfo>(formatters, cancellationToken).ConfigureAwait(false);
ResponseCache.Set(buildUrl, result, CacheTime);
ApiConfig.Log.Debug($"Cached {nameof(BuildInfo)} for {buildUrl} for {CacheTime}");
//ApiConfig.Log.Debug($"Cached {nameof(BuildInfo)} for {buildUrl} for {CacheTime}");
return result;
}
catch (Exception e)
Expand Down
6 changes: 4 additions & 2 deletions CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs
Expand Up @@ -114,7 +114,9 @@ internal partial class LogParser
{
Extractors = new Dictionary<string, Regex>
{
["Disc path:"] = new Regex(@"Disc path: .*(?<hdd_game_path>/dev_hdd0/game/.*?)\r?$", DefaultOptions),
["LDR: Game:"] = new Regex(@"Game: .*(?<ldr_game>/dev_hdd0/game/(?<ldr_game_serial>[^/]+).*?)\r?$", DefaultOptions),
["LDR: Disc"] = new Regex(@"Disc( path)?: .*(?<ldr_disc>/dev_hdd0/game/(?<ldr_disc_serial>[^/]+).*?)\r?$", DefaultOptions),
["LDR: Path:"] = new Regex(@"Path: .*(?<ldr_path>/dev_hdd0/game/(?<ldr_path_serial>[^/]+).*?)\r?$", DefaultOptions),
["Elf path:"] = new Regex(@"Elf path: (?<host_root_in_boot>/host_root/)?(?<elf_boot_path>.*?)\r?$", DefaultOptions),
["Invalid or unsupported file format:"] = new Regex(@"Invalid or unsupported file format: (?<failed_to_boot>.*?)\r?$", DefaultOptions),
["SELF:"] = new Regex(@"(?<failed_to_decrypt>Failed to decrypt)? SELF: (?<failed_to_decrypt>Failed to (decrypt|load SELF))?.*\r?$", DefaultOptions),
Expand All @@ -138,7 +140,7 @@ internal partial class LogParser
["Loaded SPU image:"] = new Regex(@"Loaded SPU image: SPU-(?<spu_hash>\w+) \(<-\s*(?<spu_hash_patch>(?!0)\d+)\).*?\r?$", DefaultOptions),
["'sys_fs_open' failed"] = new Regex(@"'sys_fs_open' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_filename>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions),
["'sys_fs_opendir' failed"] = new Regex(@"'sys_fs_opendir' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_directory>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions),
["EDAT: "] = new Regex(@"EDAT: Block at offset (?<edat_block_offset>0x[0-9a-f]+) has invalid hash!.*?\r?$", DefaultOptions),
["LDR: EDAT: "] = new Regex(@"EDAT: Block at offset (?<edat_block_offset>0x[0-9a-f]+) has invalid hash!.*?\r?$", DefaultOptions),
},
OnSectionEnd = MarkAsCompleteAndReset,
EndTrigger = "All threads stopped...",
Expand Down
26 changes: 20 additions & 6 deletions CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs
Expand Up @@ -73,7 +73,7 @@ public static async Task<DiscordEmbed> AsEmbedAsync(this LogParseState state, Di
var colB = BuildGpuSection(collection);
BuildSettingsSections(builder, collection, colA, colB);
BuildLibsSection(builder, collection);
await BuildNotesSectionAsync(builder, state, collection).ConfigureAwait(false);
await BuildNotesSectionAsync(builder, state, collection, client).ConfigureAwait(false);
}
}
else
Expand Down Expand Up @@ -367,7 +367,7 @@ private static async Task<bool> HasBrokenFilesAsync(NameValueCollection items)
return missingDirs.Any(knownDirs.Contains);
}

private static async Task BuildNotesSectionAsync(DiscordEmbedBuilder builder, LogParseState state, NameValueCollection items)
private static async Task BuildNotesSectionAsync(DiscordEmbedBuilder builder, LogParseState state, NameValueCollection items, DiscordClient discordClient)
{
BuildWeirdSettingsSection(builder, items);
BuildMissingLicensesSection(builder, items);
Expand Down Expand Up @@ -415,10 +415,24 @@ private static async Task BuildNotesSectionAsync(DiscordEmbedBuilder builder, Lo
}
if (!string.IsNullOrEmpty(items["ppu_hash_patch"]) || !string.IsNullOrEmpty(items["spu_hash_patch"]))
notes.AppendLine("Game-specific patches were applied");
if (!string.IsNullOrEmpty(items["hdd_game_path"]) && !(items["serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false))
notes.AppendLine($"Disc game inside `{items["hdd_game_path"]}`");
if ((items["game_category"] == "HG") && !(items["serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false))
notes.AppendLine("Disc game installed as a PKG 🔨; please follow the quickstart guide");

bool discInsideGame = false;
bool discAsPkg = false;
if (items["game_category"] == "DG")
{
discInsideGame |= !string.IsNullOrEmpty(items["ldr_disc"]) && !(items["serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false);
discAsPkg |= items["serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false;
discAsPkg |= items["ldr_game_serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false;
}
discAsPkg |= items["game_category"] == "HG" && !(items["serial"]?.StartsWith("NP", StringComparison.InvariantCultureIgnoreCase) ?? false);
if (discInsideGame)
notes.AppendLine($"Disc game inside `{items["ldr_disc"]}`");
if (discAsPkg)
{
var emoji = discordClient.GetEmoji(":piratethink:", DiscordEmoji.FromUnicode("🔨"));
notes.Append("Disc game installed as a PKG ").AppendLine(emoji);
}

if (!string.IsNullOrEmpty(items["native_ui_input"]))
notes.AppendLine("Pad initialization problem detected; try disabling `Native UI`");
if (!string.IsNullOrEmpty(items["xaudio_init_error"]))
Expand Down

0 comments on commit 8d0cfd5

Please sign in to comment.