Compare commits
3 Commits
Canary-1.2
...
Canary-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11bc32d98e | ||
|
|
063430ea16 | ||
|
|
65f08caaa3 |
@@ -135,20 +135,20 @@ namespace Ryujinx.Ava
|
|||||||
if (!TitleIDs.CurrentApplication.Value.HasValue) return;
|
if (!TitleIDs.CurrentApplication.Value.HasValue) return;
|
||||||
if (_discordPresencePlaying is null) return;
|
if (_discordPresencePlaying is null) return;
|
||||||
|
|
||||||
PlayReportAnalyzer.FormattedValue value = PlayReport.Analyzer.FormatPlayReportValue(TitleIDs.CurrentApplication.Value, _currentApp, playReport);
|
PlayReport.Analyzer.FormatPlayReportValue(TitleIDs.CurrentApplication.Value, _currentApp, playReport)
|
||||||
|
.Match(out bool handled,
|
||||||
if (!value.Handled) return;
|
() =>
|
||||||
|
|
||||||
if (value.Reset)
|
|
||||||
{
|
{
|
||||||
_discordPresencePlaying.Details = $"Playing {_currentApp.Title}";
|
_discordPresencePlaying.Details = $"Playing {_currentApp.Title}";
|
||||||
Logger.Info?.Print(LogClass.UI, "Reset Discord RPC based on a supported play report value formatter.");
|
Logger.Info?.Print(LogClass.UI, "Reset Discord RPC based on a supported play report value formatter.");
|
||||||
}
|
},
|
||||||
else
|
formattedString =>
|
||||||
{
|
{
|
||||||
_discordPresencePlaying.Details = value.FormattedString;
|
_discordPresencePlaying.Details = formattedString;
|
||||||
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.");
|
||||||
}
|
});
|
||||||
|
|
||||||
|
if (handled)
|
||||||
UpdatePlayingState();
|
UpdatePlayingState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
public static PlayReportAnalyzer Analyzer { get; } = new PlayReportAnalyzer()
|
public static PlayReportAnalyzer Analyzer { get; } = new PlayReportAnalyzer()
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
"01007ef00011e000",
|
"01007ef00011e000",
|
||||||
spec => spec.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
spec => spec
|
||||||
|
.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
||||||
|
// reset to normal status when switching between normal & master mode in title screen
|
||||||
|
.AddValueFormatter("AoCVer", PlayReportFormattedValue.AlwaysResets)
|
||||||
)
|
)
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
"0100f2c0115b6000",
|
"0100f2c0115b6000",
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A potential formatted value returned by a <see cref="PlayReportValueFormatter"/>.
|
/// A potential formatted value returned by a <see cref="PlayReportValueFormatter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct FormattedValue
|
public readonly struct FormattedValue
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Was any handler able to match anything in the Play Report?
|
/// Was any handler able to match anything in the Play Report?
|
||||||
@@ -132,6 +132,23 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string FormattedString { get; private init; }
|
public string FormattedString { get; private init; }
|
||||||
|
|
||||||
|
public void Match(out bool wasHandled, Action onReset, Action<string> onSuccess)
|
||||||
|
{
|
||||||
|
if (!Handled)
|
||||||
|
{
|
||||||
|
wasHandled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Reset)
|
||||||
|
onReset();
|
||||||
|
else
|
||||||
|
onSuccess(FormattedString);
|
||||||
|
|
||||||
|
wasHandled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The intended path of execution for having a string to return: simply return the string.
|
/// The intended path of execution for having a string to return: simply return the string.
|
||||||
/// This implicit conversion will make the struct for you.<br/><br/>
|
/// This implicit conversion will make the struct for you.<br/><br/>
|
||||||
|
|||||||
Reference in New Issue
Block a user