mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-14 14:28:49 +00:00
Merge pull request #509 from 13xforever/vnext
Indicate built-in emulator compatibility for classics in log parser
This commit is contained in:
commit
2069dacfc9
@ -106,7 +106,7 @@ namespace CompatBot.EventHandlers
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static async Task<DiscordEmbedBuilder> LookupGameInfoAsync(this DiscordClient client, string code, string gameTitle = null, bool forLog = false)
|
||||
public static async Task<DiscordEmbedBuilder> LookupGameInfoAsync(this DiscordClient client, string code, string gameTitle = null, bool forLog = false, string category = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
return TitleInfo.Unknown.AsEmbed(code, gameTitle, forLog);
|
||||
@ -121,12 +121,34 @@ namespace CompatBot.EventHandlers
|
||||
return TitleInfo.CommunicationError.AsEmbed(null);
|
||||
|
||||
var thumbnailUrl = await client.GetThumbnailUrlAsync(code).ConfigureAwait(false);
|
||||
if (result?.Results == null)
|
||||
return TitleInfo.Unknown.AsEmbed(code, gameTitle, forLog, thumbnailUrl);
|
||||
|
||||
if (result.Results.TryGetValue(code, out var info))
|
||||
if (result != null && result.Results.TryGetValue(code, out var info))
|
||||
return info.AsEmbed(code, gameTitle, forLog, thumbnailUrl);
|
||||
|
||||
if (category == "1P")
|
||||
{
|
||||
var ti = new TitleInfo
|
||||
{
|
||||
Commit = "8b449ce76c91d5ff7a2829b233befe7d6df4b24f",
|
||||
Date = "2018-06-23",
|
||||
Pr = 4802,
|
||||
Status = "playable",
|
||||
};
|
||||
return ti.AsEmbed(code, gameTitle, forLog, thumbnailUrl);
|
||||
}
|
||||
if (category == "2P"
|
||||
|| category == "2G"
|
||||
|| category == "2D"
|
||||
|| category == "PP"
|
||||
|| category == "PE"
|
||||
|| category == "MN")
|
||||
{
|
||||
var ti = new TitleInfo
|
||||
{
|
||||
Status = "nothing"
|
||||
};
|
||||
return ti.AsEmbed(code, gameTitle, forLog, thumbnailUrl);
|
||||
}
|
||||
return TitleInfo.Unknown.AsEmbed(code, gameTitle, forLog, thumbnailUrl);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -175,13 +175,13 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
if (vsync && items["frame_limit"] is string frameLimitStr)
|
||||
{
|
||||
if (frameLimitStr == "Auto")
|
||||
notes.Add("ℹ Frame rate might be limited to 30 fps");
|
||||
notes.Add("ℹ Frame rate might be limited to 30 fps due to enabled VSync");
|
||||
else if (double.TryParse(frameLimitStr, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out var frameLimit))
|
||||
{
|
||||
if (frameLimit > 30 && frameLimit < 60)
|
||||
notes.Add("⚠ Frame rate might be limited to 30 fps");
|
||||
notes.Add("ℹ Frame rate might be limited to 30 fps due to enabled VSync");
|
||||
else if (frameLimit < 30)
|
||||
notes.Add("⚠ Frame rate might be limited to 15 fps");
|
||||
notes.Add("ℹ Frame rate might be limited to 15 fps due to enabled VSync");
|
||||
else
|
||||
notes.Add("ℹ Frame pacing might be affected due to VSync and Frame Limiter enabled at the same time");
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
else if (items["game_title"] == "vsh.self")
|
||||
CheckVshSettings(items, notes, generalNotes);
|
||||
if (items["game_category"] == "1P")
|
||||
CheckPs1ClassicsSettings(items, notes);
|
||||
CheckPs1ClassicsSettings(items, notes, generalNotes);
|
||||
|
||||
if (items["hook_static_functions"] is string hookStaticFunctions && hookStaticFunctions == EnabledMark)
|
||||
notes.Add("⚠ `Hook Static Functions` is enabled, please disable");
|
||||
@ -1079,13 +1079,14 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
notes.Add("ℹ `Force CPU Blit` should be enabled for proper visuals");
|
||||
}
|
||||
|
||||
private static void CheckPs1ClassicsSettings(NameValueCollection items, List<string> notes)
|
||||
private static void CheckPs1ClassicsSettings(NameValueCollection items, List<string> notes, List<string> generalNotes)
|
||||
{
|
||||
if (items["spu_decoder"] is string spuDecoder
|
||||
&& !spuDecoder.Contains("ASMJIT"))
|
||||
notes.Add("ℹ Please set `SPU Decoder` to use `Recompiler (ASMJIT)`");
|
||||
notes.Add("⚠ Please set `SPU Decoder` to use `Recompiler (ASMJIT)`");
|
||||
if (items["cpu_blit"] == EnabledMark)
|
||||
notes.Add("⚠ Please disable `Force CPU Blit` for PS1 Classics");
|
||||
notes.Add("ℹ Please disable `Force CPU Blit` for PS1 Classics");
|
||||
generalNotes.Add("ℹ PS1 Classics compatibility is subject to [official Sony emulator accuracy](https://www.psdevwiki.com/ps3/PS1_Classics_Emulator_Compatibility_List)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
collection["game_category"] = "HG";
|
||||
}
|
||||
var titleUpdateInfoTask = psnClient.GetTitleUpdatesAsync(collection["serial"], Config.Cts.Token);
|
||||
var gameInfo = await client.LookupGameInfoAsync(collection["serial"], collection["game_title"], true).ConfigureAwait(false);
|
||||
var gameInfo = await client.LookupGameInfoAsync(collection["serial"], collection["game_title"], true, category: collection["game_category"]).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
var titleUpdateInfo = await titleUpdateInfoTask.ConfigureAwait(false);
|
||||
|
@ -64,13 +64,13 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
var productCodePart = string.IsNullOrWhiteSpace(titleId) ? "" : $"[{titleId}] ";
|
||||
var onlineOnlypart = info.Network == true ? " 🌐" : "";
|
||||
var pr = info.ToPrString(null, true);
|
||||
var desc = $"{info.Status} since {info.ToUpdated()}";
|
||||
if (pr is string _)
|
||||
var desc = $"{info.Status} since {info.ToUpdated() ?? "forever"}";
|
||||
if (pr != null)
|
||||
desc += $" (PR {pr})";
|
||||
if (!forLog && !string.IsNullOrEmpty(info.AlternativeTitle))
|
||||
desc = info.AlternativeTitle + Environment.NewLine + desc;
|
||||
if (!string.IsNullOrEmpty(info.WikiTitle))
|
||||
desc += $"{(forLog ? ", " : Environment.NewLine)}[Wiki Page](https://wiki.rpcs3.net/index.php?title={info.WikiTitle})";
|
||||
desc += $"{(forLog ? ", " : Environment.NewLine)}[Wiki Page](https://wiki.rpcs3.net/index.php?title={info.WikiTitle})";
|
||||
var cacheTitle = info.Title ?? gameTitle;
|
||||
if (!string.IsNullOrEmpty(cacheTitle))
|
||||
{
|
||||
@ -78,13 +78,13 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
StatsStorage.GameStatCache.Set(cacheTitle, ++stat, StatsStorage.CacheTime);
|
||||
}
|
||||
return new DiscordEmbedBuilder
|
||||
{
|
||||
Title = $"{productCodePart}{cacheTitle.Trim(200)}{onlineOnlypart}",
|
||||
Url = $"https://forums.rpcs3.net/thread-{info.Thread}.html",
|
||||
Description = desc,
|
||||
Color = color,
|
||||
ThumbnailUrl = thumbnailUrl
|
||||
};
|
||||
{
|
||||
Title = $"{productCodePart}{cacheTitle.Trim(200)}{onlineOnlypart}",
|
||||
Url = info.Thread > 0 ? $"https://forums.rpcs3.net/thread-{info.Thread}.html" : null,
|
||||
Description = desc,
|
||||
Color = color,
|
||||
ThumbnailUrl = thumbnailUrl
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user