-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can now access the *entire* play report data in any given value formatter. The input types have been restructured and, notably, not every instance of Value has an ApplicationMetadata on it. It's now on the container type that also contains the matched values and the entire play report.
- Loading branch information
Showing
9 changed files
with
192 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using MsgPack; | ||
using Ryujinx.Horizon.Sdk.Account; | ||
using Ryujinx.Horizon.Sdk.Ncm; | ||
|
||
namespace Ryujinx.Horizon.Prepo.Types | ||
{ | ||
public struct PlayReport | ||
{ | ||
public PlayReportKind Kind { get; init; } | ||
public string Room { get; init; } | ||
public MessagePackObject ReportData { get; init; } | ||
|
||
public ApplicationId? AppId; | ||
public ulong? Pid; | ||
public uint Version; | ||
public Uid? UserId; | ||
} | ||
|
||
public enum PlayReportKind | ||
{ | ||
Normal, | ||
System, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using MsgPack; | ||
using Ryujinx.Ava.Utilities.AppLibrary; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Ryujinx.Ava.Utilities.PlayReport | ||
{ | ||
public abstract class MatchedValue<T> | ||
{ | ||
public MatchedValue(T matched) | ||
{ | ||
Matched = matched; | ||
} | ||
|
||
/// <summary> | ||
/// The currently running application's <see cref="ApplicationMetadata"/>. | ||
/// </summary> | ||
public ApplicationMetadata Application { get; init; } | ||
|
||
/// <summary> | ||
/// The entire play report. | ||
/// </summary> | ||
public Horizon.Prepo.Types.PlayReport PlayReport { get; init; } | ||
|
||
/// <summary> | ||
/// The matched value from the Play Report. | ||
/// </summary> | ||
public T Matched { get; init; } | ||
} | ||
|
||
/// <summary> | ||
/// The input data to a <see cref="ValueFormatter"/>, | ||
/// containing the currently running application's <see cref="ApplicationMetadata"/>, | ||
/// and the matched <see cref="MessagePackObject"/> from the Play Report. | ||
/// </summary> | ||
public class SingleValue : MatchedValue<Value> | ||
{ | ||
public SingleValue(Value matched) : base(matched) | ||
{ | ||
} | ||
|
||
public static implicit operator SingleValue(MessagePackObject mpo) => new(mpo); | ||
} | ||
|
||
/// <summary> | ||
/// The input data to a <see cref="MultiValueFormatter"/>, | ||
/// containing the currently running application's <see cref="ApplicationMetadata"/>, | ||
/// and the matched <see cref="MessagePackObject"/>s from the Play Report. | ||
/// </summary> | ||
public class MultiValue : MatchedValue<Value[]> | ||
{ | ||
public MultiValue(Value[] matched) : base(matched) | ||
{ | ||
} | ||
|
||
public MultiValue(IEnumerable<MessagePackObject> matched) : base(Value.ConvertPackedObjects(matched)) | ||
{ | ||
} | ||
|
||
public static implicit operator MultiValue(List<MessagePackObject> matched) | ||
=> new(matched.Select(x => new Value(x)).ToArray()); | ||
} | ||
|
||
/// <summary> | ||
/// The input data to a <see cref="SparseMultiValueFormatter"/>, | ||
/// containing the currently running application's <see cref="ApplicationMetadata"/>, | ||
/// and the matched <see cref="MessagePackObject"/>s from the Play Report. | ||
/// </summary> | ||
public class SparseMultiValue : MatchedValue<Dictionary<string, Value>> | ||
{ | ||
public SparseMultiValue(Dictionary<string, Value> matched) : base(matched) | ||
{ | ||
} | ||
|
||
public SparseMultiValue(Dictionary<string, MessagePackObject> matched) : base(Value.ConvertPackedObjectMap(matched)) | ||
{ | ||
} | ||
|
||
public static implicit operator SparseMultiValue(Dictionary<string, MessagePackObject> matched) | ||
=> new(matched | ||
.ToDictionary( | ||
x => x.Key, | ||
x => new Value(x.Value) | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.