misc: chore: rewrite PlayReports.Analyzer creation to use Lazy and create the value alongside DiscordIntegrationModule init
This commit is contained in:
parent
45ee8cd0e8
commit
f92d09711b
@ -56,6 +56,7 @@ namespace Ryujinx.Ava
|
|||||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||||
TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue);
|
TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue);
|
||||||
HorizonStatic.PlayReport += HandlePlayReport;
|
HorizonStatic.PlayReport += HandlePlayReport;
|
||||||
|
PlayReports.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Update(object sender, ReactiveEventArgs<bool> evnt)
|
private static void Update(object sender, ReactiveEventArgs<bool> evnt)
|
||||||
|
@ -1,67 +1,81 @@
|
|||||||
namespace Ryujinx.Ava.Utilities.PlayReport
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.Utilities.PlayReport
|
||||||
{
|
{
|
||||||
public static partial class PlayReports
|
public static partial class PlayReports
|
||||||
{
|
{
|
||||||
public static Analyzer Analyzer { get; } = new Analyzer()
|
public static void Initialize()
|
||||||
.AddSpec(
|
{
|
||||||
"01007ef00011e000",
|
// init lazy value
|
||||||
spec => spec
|
_ = Analyzer;
|
||||||
.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
}
|
||||||
// reset to normal status when switching between normal & master mode in title screen
|
|
||||||
.AddValueFormatter("AoCVer", FormattedValue.SingleAlwaysResets)
|
public static Analyzer Analyzer => _analyzerLazy.Value;
|
||||||
)
|
|
||||||
.AddSpec(
|
private static readonly Lazy<Analyzer> _analyzerLazy = new(() =>
|
||||||
"0100f2c0115b6000",
|
new Analyzer()
|
||||||
spec => spec
|
.AddSpec(
|
||||||
.AddValueFormatter("PlayerPosY", TearsOfTheKingdom_CurrentField))
|
"01007ef00011e000",
|
||||||
.AddSpec(
|
spec => spec
|
||||||
"0100000000010000",
|
.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
||||||
spec =>
|
// reset to normal status when switching between normal & master mode in title screen
|
||||||
spec.AddValueFormatter("is_kids_mode", SuperMarioOdyssey_AssistMode)
|
.AddValueFormatter("AoCVer", FormattedValue.SingleAlwaysResets)
|
||||||
)
|
)
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
"010075000ecbe000",
|
"0100f2c0115b6000",
|
||||||
spec =>
|
spec => spec
|
||||||
spec.AddValueFormatter("is_kids_mode", SuperMarioOdysseyChina_AssistMode)
|
.AddValueFormatter("PlayerPosY", TearsOfTheKingdom_CurrentField))
|
||||||
)
|
.AddSpec(
|
||||||
.AddSpec(
|
"0100000000010000",
|
||||||
"010028600ebda000",
|
spec =>
|
||||||
spec => spec.AddValueFormatter("mode", SuperMario3DWorldOrBowsersFury)
|
spec.AddValueFormatter("is_kids_mode", SuperMarioOdyssey_AssistMode)
|
||||||
)
|
)
|
||||||
.AddSpec( // Global & China IDs
|
.AddSpec(
|
||||||
["0100152000022000", "010075100e8ec000"],
|
"010075000ecbe000",
|
||||||
spec => spec.AddValueFormatter("To", MarioKart8Deluxe_Mode)
|
spec =>
|
||||||
)
|
spec.AddValueFormatter("is_kids_mode", SuperMarioOdysseyChina_AssistMode)
|
||||||
.AddSpec(
|
)
|
||||||
["0100a3d008c5c000", "01008f6008c5e000"],
|
.AddSpec(
|
||||||
spec => spec
|
"010028600ebda000",
|
||||||
.AddValueFormatter("area_no", PokemonSVArea)
|
spec => spec.AddValueFormatter("mode", SuperMario3DWorldOrBowsersFury)
|
||||||
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
)
|
||||||
)
|
.AddSpec( // Global & China IDs
|
||||||
.AddSpec(
|
["0100152000022000", "010075100e8ec000"],
|
||||||
"01006a800016e000",
|
spec => spec.AddValueFormatter("To", MarioKart8Deluxe_Mode)
|
||||||
spec => spec
|
)
|
||||||
.AddSparseMultiValueFormatter(
|
.AddSpec(
|
||||||
[
|
["0100a3d008c5c000", "01008f6008c5e000"],
|
||||||
// Metadata to figure out what PlayReport we have.
|
spec => spec
|
||||||
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
.AddValueFormatter("area_no", PokemonSVArea)
|
||||||
"adv_slot",
|
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
||||||
// List of Fighters
|
)
|
||||||
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
.AddSpec(
|
||||||
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
"01006a800016e000",
|
||||||
// List of rankings/placements
|
spec => spec
|
||||||
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
.AddSparseMultiValueFormatter(
|
||||||
"player_6_rank", "player_7_rank", "player_8_rank"
|
[
|
||||||
],
|
// Metadata to figure out what PlayReport we have.
|
||||||
SuperSmashBrosUltimate_Mode
|
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
||||||
)
|
"adv_slot",
|
||||||
)
|
// List of Fighters
|
||||||
.AddSpec(
|
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
||||||
[
|
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
||||||
"0100c9a00ece6000", "01008d300c50c000", "0100d870045b6000",
|
// List of rankings/placements
|
||||||
"010012f017576000", "0100c62011050000", "0100b3c014bda000"],
|
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
||||||
spec => spec.AddValueFormatter("launch_title_id", NsoEmulator_LaunchedGame)
|
"player_6_rank", "player_7_rank", "player_8_rank"
|
||||||
);
|
],
|
||||||
|
SuperSmashBrosUltimate_Mode
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.AddSpec(
|
||||||
|
[
|
||||||
|
"0100c9a00ece6000", "01008d300c50c000", "0100d870045b6000",
|
||||||
|
"010012f017576000", "0100c62011050000", "0100b3c014bda000"
|
||||||
|
],
|
||||||
|
spec => spec.AddValueFormatter("launch_title_id", NsoEmulator_LaunchedGame)
|
||||||
|
)
|
||||||
|
.AddSpec("01002da013484000", spec => spec.AddValueFormatter("rupees", SkywardSwordHD_Rupees))
|
||||||
|
);
|
||||||
|
|
||||||
private static string Playing(string game) => $"Playing {game}";
|
private static string Playing(string game) => $"Playing {game}";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user