mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-02-23 21:54:37 +01:00
misc: chore: Rewrite play report checker to use a simple loop instead of Gommon Optionals
(I love how a class that's supposed to guard against null values entering your code still allows them thats so cool)
This commit is contained in:
parent
37af8c70aa
commit
ea2287af03
@ -132,18 +132,18 @@ namespace Ryujinx.Ava
|
|||||||
if (_discordPresencePlaying is null) return;
|
if (_discordPresencePlaying is null) return;
|
||||||
if (!playReport.IsDictionary) return;
|
if (!playReport.IsDictionary) return;
|
||||||
|
|
||||||
_playReportValues
|
foreach ((string titleId, (string reportKey, Func<object, string> formatter)) in _playReportValues)
|
||||||
.FindFirst(x => x.Key.EqualsIgnoreCase(TitleIDs.CurrentApplication.Value))
|
|
||||||
.Convert(x => x.Value)
|
|
||||||
.IfPresent(x =>
|
|
||||||
{
|
{
|
||||||
if (!playReport.AsDictionary().TryGetValue(x.ReportKey, out MessagePackObject valuePackObject))
|
if (!TitleIDs.CurrentApplication.Value.Value.EqualsIgnoreCase(titleId))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!playReport.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_discordPresencePlaying.Details = x.Formatter(valuePackObject.ToObject());
|
_discordPresencePlaying.Details = formatter(valuePackObject.ToObject());
|
||||||
UpdatePlayingState();
|
UpdatePlayingState();
|
||||||
Logger.Info?.Print(LogClass.UI, "Updated Discord RPC based on a supported play report.");
|
Logger.Info?.Print(LogClass.UI, "Updated Discord RPC based on a supported play report.");
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// title ID -> Play Report key & value formatter
|
// title ID -> Play Report key & value formatter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user