mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-09-09 19:28:52 +00:00
feature: UI: LDN Games Viewer
This window can be accessed via "Help" menu in the title bar. This menu's data is synced with the in-app-list LDN game data, and that has been modified to hide unjoinable games (in-progress and/or private (needing a passphrase)). You can still see these games in the list.
This commit is contained in:
@@ -24316,6 +24316,606 @@
|
||||
"zh_CN": "在执行首条指令前挂起应用程序,这样就可以从最早的点开始调试。",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListOpen",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Open LDN Game List",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListTitle",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "LDN Game Browser - {0} games",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListSearchBoxWatermark",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Search {0} LDN games...",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListInfoButtonToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "What is LDN?",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListRefreshToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Refresh available games from the server at {0}",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPlayerSortDisable",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Player Count - Disable",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPlayerSortAscending",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Player Count - Ascending",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPlayerSortDescending",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Player Count - Descending",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListOnlyShowPublicGames",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Only show public games",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListOnlyShowJoinableGames",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Only show joinable games",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListConnectionTypeMasterServerProxy",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Master Server Proxy",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListConnectionTypeP2P",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "P2P",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListConnectionTypeMasterServerProxyToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Connects through the RyuLDN server (slower).",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListConnectionTypeP2PToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Connects via Peer-to-Peer via UPnP (faster).",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListCreatedAt",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Created: {0}",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPlayersAndPlayerCount",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Players ({0} out of {1}):",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListJoinable",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Joinable",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListJoinableToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Game is joinable if it is public or if you know the passphrase.",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListNotJoinable",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Not Joinable",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListNotJoinableToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Game is currently in progress.",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPublic",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Public",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPublicToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Anyone can join this game.",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPrivate",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Private",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "LdnGameListPrivateToolTip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "You can only join this game if you also have the same LDN Passphrase in your settings.",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -7,5 +7,13 @@ namespace Ryujinx.Common
|
||||
public const string DefaultLanPlayWebHost = DefaultLanPlayHost;
|
||||
|
||||
public const string AmiiboTagsUrl = "https://raw.githubusercontent.com/Ryubing/Nfc/refs/heads/main/tags.json";
|
||||
|
||||
public const string FaqWikiUrl = "https://git.ryujinx.app/ryubing/ryujinx/-/wikis/FAQ-&-Troubleshooting";
|
||||
|
||||
public const string SetupGuideWikiUrl =
|
||||
"https://git.ryujinx.app/ryubing/ryujinx/-/wikis/Setup-&-Configuration-Guide";
|
||||
|
||||
public const string MultiplayerWikiUrl =
|
||||
"https://git.ryujinx.app/ryubing/ryujinx/-/wikis/Multiplayer-(LDN-Local-Wireless)-Guide";
|
||||
}
|
||||
}
|
||||
|
@@ -47,8 +47,12 @@ namespace Ryujinx.Ava.Common.Locale
|
||||
|
||||
private void Load()
|
||||
{
|
||||
string localeLanguageCode = !string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value) ?
|
||||
ConfigurationState.Instance.UI.LanguageCode.Value : CultureInfo.CurrentCulture.Name.Replace('-', '_');
|
||||
string localeLanguageCode = CultureInfo.CurrentCulture.Name.Replace('-', '_');
|
||||
if (Program.PreviewerDetached && ConfigurationState.Instance.UI.LanguageCode.Value is { } lang)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(lang))
|
||||
localeLanguageCode = lang;
|
||||
}
|
||||
|
||||
LoadLanguage(localeLanguageCode);
|
||||
|
||||
@@ -63,6 +67,15 @@ namespace Ryujinx.Ava.Common.Locale
|
||||
|
||||
public static string GetUnformatted(LocaleKeys key) => Instance.Get(key);
|
||||
|
||||
public static string GetFormatted(LocaleKeys key, params object[] values)
|
||||
=> GetUnformatted(key).Format(values);
|
||||
|
||||
public static string FormatDynamicValue(LocaleKeys key, params object[] values)
|
||||
=> Instance.UpdateAndGetDynamicValue(key, values);
|
||||
|
||||
public static void Associate(LocaleKeys key, params object[] values)
|
||||
=> Instance.SetDynamicValues(key, values);
|
||||
|
||||
public string Get(LocaleKeys key) =>
|
||||
_localeStrings.TryGetValue(key, out string value)
|
||||
? value
|
||||
@@ -107,9 +120,6 @@ namespace Ryujinx.Ava.Common.Locale
|
||||
_ => false
|
||||
};
|
||||
|
||||
public static string FormatDynamicValue(LocaleKeys key, params object[] values)
|
||||
=> Instance.UpdateAndGetDynamicValue(key, values);
|
||||
|
||||
public void SetDynamicValues(LocaleKeys key, params object[] values)
|
||||
{
|
||||
_dynamicValues[key] = values;
|
||||
@@ -161,12 +171,14 @@ namespace Ryujinx.Ava.Common.Locale
|
||||
{
|
||||
if (locale.Translations.Count < _localeData.Value.Languages.Count)
|
||||
{
|
||||
throw new Exception($"Locale key {{{locale.ID}}} is missing languages! Has {locale.Translations.Count} translations, expected {_localeData.Value.Languages.Count}!");
|
||||
throw new Exception(
|
||||
$"Locale key {{{locale.ID}}} is missing languages! Has {locale.Translations.Count} translations, expected {_localeData.Value.Languages.Count}!");
|
||||
}
|
||||
|
||||
if (locale.Translations.Count > _localeData.Value.Languages.Count)
|
||||
{
|
||||
throw new Exception($"Locale key {{{locale.ID}}} has too many languages! Has {locale.Translations.Count} translations, expected {_localeData.Value.Languages.Count}!");
|
||||
throw new Exception(
|
||||
$"Locale key {{{locale.ID}}} has too many languages! Has {locale.Translations.Count} translations, expected {_localeData.Value.Languages.Count}!");
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<LocaleKeys>(locale.ID, out LocaleKeys localeKey))
|
||||
@@ -178,7 +190,8 @@ namespace Ryujinx.Ava.Common.Locale
|
||||
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
throw new Exception($"Locale key '{locale.ID}' has no valid translations for desired language {languageCode}! {DefaultLanguageCode} is an empty string or null");
|
||||
throw new Exception(
|
||||
$"Locale key '{locale.ID}' has no valid translations for desired language {languageCode}! {DefaultLanguageCode} is an empty string or null");
|
||||
}
|
||||
|
||||
localeStrings[localeKey] = str;
|
||||
|
@@ -1169,10 +1169,8 @@ namespace Ryujinx.Ava.Systems
|
||||
string frameTime = Device.Statistics.GetGameFrameTime().ToString("00.00");
|
||||
|
||||
return Device.TurboMode
|
||||
? LocaleManager.GetUnformatted(LocaleKeys.FpsTurboStatusBarText)
|
||||
.Format(frameRate, frameTime, Device.TickScalar)
|
||||
: LocaleManager.GetUnformatted(LocaleKeys.FpsStatusBarText)
|
||||
.Format(frameRate, frameTime);
|
||||
? LocaleManager.GetFormatted(LocaleKeys.FpsTurboStatusBarText, frameRate, frameTime, Device.TickScalar)
|
||||
: LocaleManager.GetFormatted(LocaleKeys.FpsStatusBarText, frameRate, frameTime);
|
||||
}
|
||||
|
||||
public async Task ShowExitPrompt()
|
||||
|
@@ -14,6 +14,7 @@ using LibHac.Tools.FsSystem.NcaUtils;
|
||||
using Ryujinx.Ava.Common.Models;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
@@ -29,7 +30,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
@@ -85,7 +85,6 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
private readonly SourceCache<(DownloadableContentModel Dlc, bool IsEnabled), DownloadableContentModel> _downloadableContents = new(it => it.Dlc);
|
||||
|
||||
private static readonly ApplicationJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
private static readonly LdnGameDataSerializerContext _ldnDataSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
public ApplicationLibrary(VirtualFileSystem virtualFileSystem, IntegrityCheckLevel checkLevel)
|
||||
{
|
||||
@@ -865,16 +864,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
{
|
||||
try
|
||||
{
|
||||
string ldnWebHost = ConfigurationState.Instance.Multiplayer.LdnServer;
|
||||
if (string.IsNullOrEmpty(ldnWebHost))
|
||||
{
|
||||
ldnWebHost = SharedConstants.DefaultLanPlayWebHost;
|
||||
}
|
||||
|
||||
using HttpClient httpClient = new();
|
||||
string ldnGameDataArrayString = await httpClient.GetStringAsync($"https://{ldnWebHost}/api/public_games");
|
||||
LdnGameData[] ldnGameDataArray = JsonHelper.Deserialize(ldnGameDataArrayString, _ldnDataSerializerContext.IEnumerableLdnGameData).ToArray();
|
||||
LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs(ldnGameDataArray));
|
||||
LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs(await LdnGameModel.GetAllAsync()));
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -1,49 +0,0 @@
|
||||
using Gommon;
|
||||
using LibHac.Ns;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
{
|
||||
public struct LdnGameData
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public int PlayerCount { get; set; }
|
||||
public int MaxPlayerCount { get; set; }
|
||||
public string GameName { get; set; }
|
||||
public string TitleId { get; set; }
|
||||
public string Mode { get; set; }
|
||||
public string Status { get; set; }
|
||||
public IEnumerable<string> Players { get; set; }
|
||||
|
||||
public static Array GetArrayForApp(
|
||||
LdnGameData[] receivedData, ref ApplicationControlProperty acp)
|
||||
{
|
||||
LibHac.Common.FixedArrays.Array8<ulong> communicationId = acp.LocalCommunicationId;
|
||||
|
||||
return new Array(receivedData.Where(game =>
|
||||
communicationId.AsReadOnlySpan().Contains(game.TitleId.ToULong())
|
||||
));
|
||||
}
|
||||
|
||||
public class Array
|
||||
{
|
||||
private readonly LdnGameData[] _ldnDatas;
|
||||
|
||||
internal Array(IEnumerable<LdnGameData> receivedData)
|
||||
{
|
||||
_ldnDatas = receivedData.ToArray();
|
||||
}
|
||||
|
||||
public int PlayerCount => _ldnDatas.Sum(it => it.PlayerCount);
|
||||
public int GameCount => _ldnDatas.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LdnGameDataHelper
|
||||
{
|
||||
public static LdnGameData.Array Where(this LdnGameData[] unfilteredDatas, ref ApplicationControlProperty acp)
|
||||
=> LdnGameData.GetArrayForApp(unfilteredDatas, ref acp);
|
||||
}
|
||||
}
|
@@ -1,4 +1,7 @@
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
{
|
||||
@@ -6,12 +9,17 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
{
|
||||
public static new readonly LdnGameDataReceivedEventArgs Empty = new(null);
|
||||
|
||||
public LdnGameDataReceivedEventArgs(LdnGameData[] ldnData)
|
||||
public LdnGameDataReceivedEventArgs(LdnGameModel[] ldnData)
|
||||
{
|
||||
LdnData = ldnData ?? [];
|
||||
}
|
||||
|
||||
public LdnGameDataReceivedEventArgs(IEnumerable<LdnGameModel> ldnData)
|
||||
{
|
||||
LdnData = ldnData?.ToArray() ?? [];
|
||||
}
|
||||
|
||||
|
||||
public LdnGameData[] LdnData { get; set; }
|
||||
public LdnGameModel[] LdnData { get; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
{
|
||||
[JsonSerializable(typeof(IEnumerable<LdnGameData>))]
|
||||
internal partial class LdnGameDataSerializerContext : JsonSerializerContext;
|
||||
}
|
@@ -11,6 +11,7 @@ using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||
@@ -689,6 +690,16 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
: ldnServer;
|
||||
}
|
||||
|
||||
public string GetLdnWebServer()
|
||||
{
|
||||
if (Environment.GetEnvironmentVariable("RYULDN_WEB_HOST") is not { } ldnWebServer)
|
||||
ldnWebServer = LdnServer;
|
||||
|
||||
return string.IsNullOrEmpty(ldnWebServer)
|
||||
? SharedConstants.DefaultLanPlayWebHost
|
||||
: ldnWebServer;
|
||||
}
|
||||
|
||||
public MultiplayerSection()
|
||||
{
|
||||
LanInterfaceId = new ReactiveObject<string>();
|
||||
|
@@ -1,11 +1,9 @@
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.Systems
|
||||
|
@@ -1,26 +1,5 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Platform.Storage;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Tools.FsSystem.NcaUtils;
|
||||
using Ryujinx.Ava.Common;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Common.Models;
|
||||
using Ryujinx.Ava.Systems.AppLibrary;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.UI.Views.Dialog;
|
||||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Controls
|
||||
{
|
||||
|
20
src/Ryujinx/UI/Helpers/Converters/LocaleKeyValueConverter.cs
Normal file
20
src/Ryujinx/UI/Helpers/Converters/LocaleKeyValueConverter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using CommandLine;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
public class LocaleKeyValueConverter : IValueConverter
|
||||
{
|
||||
private static readonly Lazy<LocaleKeyValueConverter> _shared = new(() => new());
|
||||
public static LocaleKeyValueConverter Shared => _shared.Value;
|
||||
|
||||
public object Convert(object value, Type _, object __, CultureInfo ___)
|
||||
=> LocaleManager.Instance[value.Cast<LocaleKeys>()];
|
||||
|
||||
public object ConvertBack(object value, Type _, object __, CultureInfo ___)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
}
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
@@ -2,7 +2,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
|
180
src/Ryujinx/UI/Models/LdnGameModel.cs
Normal file
180
src/Ryujinx/UI/Models/LdnGameModel.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using Gommon;
|
||||
using Humanizer;
|
||||
using LibHac.Ns;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Models
|
||||
{
|
||||
public record LdnGameModel
|
||||
{
|
||||
public string Id { get; private init; }
|
||||
public bool IsPublic { get; private init; }
|
||||
public short PlayerCount { get; private init; }
|
||||
public short MaxPlayerCount { get; private init; }
|
||||
public TitleTuple Title { get; private init; }
|
||||
public ConnectionType ConnectionType { get; private init; }
|
||||
public bool IsJoinable { get; private init; }
|
||||
public ushort SceneId { get; private init; }
|
||||
public string[] Players { get; private init; }
|
||||
|
||||
public string PlayersLabel =>
|
||||
LocaleManager.GetFormatted(LocaleKeys.LdnGameListPlayersAndPlayerCount, PlayerCount, MaxPlayerCount);
|
||||
|
||||
public string FormattedPlayers =>
|
||||
Players.Chunk(4)
|
||||
.Select(x => x.FormatCollection(s => s, prefix: " ", separator: ", "))
|
||||
.JoinToString("\n ");
|
||||
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
|
||||
public string FormattedCreatedAt
|
||||
=> LocaleManager.GetFormatted(LocaleKeys.LdnGameListCreatedAt, CreatedAt.Humanize());
|
||||
|
||||
public string CreatedAtToolTip => CreatedAt.DateTime.ToString(CultureInfo.CurrentUICulture);
|
||||
|
||||
public LocaleKeys ConnectionTypeLocaleKey => ConnectionType switch
|
||||
{
|
||||
ConnectionType.MasterServerProxy => LocaleKeys.LdnGameListConnectionTypeMasterServerProxy,
|
||||
ConnectionType.PeerToPeer => LocaleKeys.LdnGameListConnectionTypeP2P,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(ConnectionType),
|
||||
$"Expected either 'P2P' or 'Master Server Proxy' ConnectionType; got '{ConnectionType}'")
|
||||
};
|
||||
|
||||
public LocaleKeys ConnectionTypeToolTipLocaleKey => ConnectionType switch
|
||||
{
|
||||
ConnectionType.MasterServerProxy => LocaleKeys.LdnGameListConnectionTypeMasterServerProxyToolTip,
|
||||
ConnectionType.PeerToPeer => LocaleKeys.LdnGameListConnectionTypeP2PToolTip,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(ConnectionType),
|
||||
$"Expected either 'P2P' or 'Master Server Proxy' ConnectionType; got '{ConnectionType}'")
|
||||
};
|
||||
|
||||
public record struct TitleTuple
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
public required string Id { get; init; }
|
||||
public required string Version { get; init; }
|
||||
}
|
||||
|
||||
public static Array GetArrayForApp(
|
||||
LdnGameModel[] receivedData,
|
||||
ref ApplicationControlProperty acp,
|
||||
bool onlyJoinable = true,
|
||||
bool onlyPublic = true)
|
||||
{
|
||||
LibHac.Common.FixedArrays.Array8<ulong> communicationId = acp.LocalCommunicationId;
|
||||
|
||||
return new Array(receivedData.Where(game =>
|
||||
communicationId.AsReadOnlySpan().Contains(game.Title.Id.ToULong())
|
||||
), onlyJoinable, onlyPublic);
|
||||
}
|
||||
|
||||
public class Array : IEnumerable<LdnGameModel>
|
||||
{
|
||||
private readonly LdnGameModel[] _ldnDatas;
|
||||
|
||||
internal Array(IEnumerable<LdnGameModel> receivedData, bool onlyJoinable = false, bool onlyPublic = false)
|
||||
{
|
||||
if (onlyJoinable)
|
||||
receivedData = receivedData.Where(x => x.IsJoinable);
|
||||
|
||||
if (onlyPublic)
|
||||
receivedData = receivedData.Where(x => x.IsPublic);
|
||||
|
||||
_ldnDatas = receivedData.ToArray();
|
||||
}
|
||||
|
||||
public int PlayerCount => _ldnDatas.Sum(it => it.PlayerCount);
|
||||
public int GameCount => _ldnDatas.Length;
|
||||
|
||||
public IEnumerator<LdnGameModel> GetEnumerator() => (_ldnDatas as IEnumerable<LdnGameModel>).GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => _ldnDatas.GetEnumerator();
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<LdnGameModel>> GetAllAsync(HttpClient client = null)
|
||||
=> LdnGameJsonModel.ParseArray(await GetAllAsyncRequestImpl(client))
|
||||
.Select(FromJson);
|
||||
|
||||
private static async Task<string> GetAllAsyncRequestImpl(HttpClient client = null)
|
||||
{
|
||||
var ldnWebHost = ConfigurationState.Instance.Multiplayer.GetLdnWebServer();
|
||||
|
||||
LocaleManager.Associate(LocaleKeys.LdnGameListRefreshToolTip, ldnWebHost);
|
||||
|
||||
try
|
||||
{
|
||||
if (client != null)
|
||||
return await client.GetStringAsync($"https://{ldnWebHost}/api/public_games");
|
||||
|
||||
using HttpClient httpClient = new();
|
||||
return await httpClient.GetStringAsync($"https://{ldnWebHost}/api/public_games");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
|
||||
private static LdnGameModel FromJson(LdnGameJsonModel json) =>
|
||||
new()
|
||||
{
|
||||
Id = json.Id,
|
||||
IsPublic = json.IsPublic,
|
||||
PlayerCount = json.PlayerCount,
|
||||
MaxPlayerCount = json.MaxPlayerCount,
|
||||
Title = new TitleTuple { Name = json.TitleName, Id = json.TitleId, Version = json.TitleVersion },
|
||||
ConnectionType = json.ConnectionType switch
|
||||
{
|
||||
"P2P" => ConnectionType.PeerToPeer,
|
||||
"Master Server Proxy" => ConnectionType.MasterServerProxy,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(json),
|
||||
$"Expected either 'P2P' or 'Master Server Proxy' ConnectionType; got '{json.ConnectionType}'")
|
||||
},
|
||||
IsJoinable = json.Joinability is "Joinable",
|
||||
SceneId = json.SceneId,
|
||||
Players = json.Players,
|
||||
CreatedAt = DateTimeOffset.FromUnixTimeMilliseconds(json.CreatedAtUnixTimestamp).ToLocalTime()
|
||||
};
|
||||
}
|
||||
|
||||
public class LdnGameJsonModel
|
||||
{
|
||||
[JsonPropertyName("id")] public string Id { get; set; }
|
||||
[JsonPropertyName("is_public")] public bool IsPublic { get; set; }
|
||||
[JsonPropertyName("player_count")] public short PlayerCount { get; set; }
|
||||
[JsonPropertyName("max_player_count")] public short MaxPlayerCount { get; set; }
|
||||
[JsonPropertyName("game_name")] public string TitleName { get; set; }
|
||||
[JsonPropertyName("title_id")] public string TitleId { get; set; }
|
||||
[JsonPropertyName("title_version")] public string TitleVersion { get; set; }
|
||||
[JsonPropertyName("mode")] public string ConnectionType { get; set; }
|
||||
[JsonPropertyName("status")] public string Joinability { get; set; }
|
||||
[JsonPropertyName("scene_id")] public ushort SceneId { get; set; }
|
||||
[JsonPropertyName("players")] public string[] Players { get; set; }
|
||||
[JsonPropertyName("created_at")] public long CreatedAtUnixTimestamp { get; set; }
|
||||
|
||||
public static LdnGameJsonModel Parse(string value)
|
||||
=> JsonHelper.Deserialize(value, LdnGameJsonModelSerializerContext.Default.LdnGameJsonModel);
|
||||
|
||||
public static LdnGameJsonModel[] ParseArray(string value)
|
||||
=> JsonHelper.Deserialize(value, LdnGameJsonModelSerializerContext.Default.LdnGameJsonModelArray);
|
||||
}
|
||||
|
||||
public enum ConnectionType
|
||||
{
|
||||
PeerToPeer,
|
||||
MasterServerProxy
|
||||
}
|
||||
|
||||
[JsonSerializable(typeof(LdnGameJsonModel[]))]
|
||||
partial class LdnGameJsonModelSerializerContext : JsonSerializerContext;
|
||||
}
|
@@ -145,8 +145,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OnPropertyChanged();
|
||||
|
||||
OnPropertyChanged(nameof(CurrentEntries));
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Svg.Skia;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
|
207
src/Ryujinx/UI/ViewModels/LdnGamesListViewModel.cs
Normal file
207
src/Ryujinx/UI/ViewModels/LdnGamesListViewModel.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gommon;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ryujinx.Ava.Systems.AppLibrary;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using System.ComponentModel;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
public partial class LdnGamesListViewModel : BaseModel, IDisposable
|
||||
{
|
||||
public MainWindowViewModel Mwvm { get; }
|
||||
|
||||
private readonly HttpClient _refreshClient;
|
||||
|
||||
private (int PlayerCount, int Name) _sorting;
|
||||
|
||||
private IEnumerable<LdnGameModel> _visibleEntries;
|
||||
|
||||
private string[] _ownedGameTitleIds = [];
|
||||
|
||||
private Func<LdnGameModel, object> _sortKeySelector = x => x.Title.Name; // Default sort by Title name
|
||||
|
||||
public IEnumerable<LdnGameModel> VisibleEntries => ApplyFilters();
|
||||
|
||||
private IEnumerable<LdnGameModel> ApplyFilters()
|
||||
{
|
||||
if (_visibleEntries is null)
|
||||
{
|
||||
_visibleEntries = Mwvm.LdnModels;
|
||||
SortApply();
|
||||
}
|
||||
|
||||
var filtered = _visibleEntries;
|
||||
|
||||
if (OnlyShowForOwnedGames)
|
||||
filtered = filtered.Where(x => _ownedGameTitleIds.ContainsIgnoreCase(x.Title.Id));
|
||||
|
||||
if (OnlyShowPublicGames)
|
||||
filtered = filtered.Where(x => x.IsPublic);
|
||||
|
||||
if (OnlyShowJoinableGames)
|
||||
filtered = filtered.Where(x => x.IsJoinable);
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
public LdnGamesListViewModel()
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
Mwvm = RyujinxApp.MainWindow.ViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
private void AppCountUpdated(object _, ApplicationCountUpdatedEventArgs __)
|
||||
=> _ownedGameTitleIds = Mwvm.ApplicationLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray();
|
||||
|
||||
public LdnGamesListViewModel(MainWindowViewModel mwvm)
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
Mwvm = mwvm;
|
||||
_visibleEntries = Mwvm.LdnModels;
|
||||
_refreshClient = new HttpClient();
|
||||
AppCountUpdated(null, null);
|
||||
Mwvm.ApplicationLibrary.ApplicationCountUpdated += AppCountUpdated;
|
||||
Mwvm.PropertyChanged += Mwvm_OnPropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
_visibleEntries = null;
|
||||
_refreshClient.Dispose();
|
||||
Mwvm.ApplicationLibrary.ApplicationCountUpdated -= AppCountUpdated;
|
||||
Mwvm.PropertyChanged -= Mwvm_OnPropertyChanged;
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Mwvm_OnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName is nameof(MainWindowViewModel.LdnModels))
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
|
||||
[ObservableProperty] private bool _isRefreshing;
|
||||
private bool _onlyShowForOwnedGames;
|
||||
private bool _onlyShowPublicGames = true;
|
||||
private bool _onlyShowJoinableGames = true;
|
||||
|
||||
public async Task RefreshAsync()
|
||||
{
|
||||
IsRefreshing = true;
|
||||
|
||||
await Mwvm.ApplicationLibrary.RefreshLdn();
|
||||
|
||||
IsRefreshing = false;
|
||||
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
|
||||
public bool OnlyShowForOwnedGames
|
||||
{
|
||||
get => _onlyShowForOwnedGames;
|
||||
set
|
||||
{
|
||||
OnPropertyChanging();
|
||||
OnPropertyChanging(nameof(VisibleEntries));
|
||||
_onlyShowForOwnedGames = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnlyShowPublicGames
|
||||
{
|
||||
get => _onlyShowPublicGames;
|
||||
set
|
||||
{
|
||||
OnPropertyChanging();
|
||||
OnPropertyChanging(nameof(VisibleEntries));
|
||||
_onlyShowPublicGames = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnlyShowJoinableGames
|
||||
{
|
||||
get => _onlyShowJoinableGames;
|
||||
set
|
||||
{
|
||||
OnPropertyChanging();
|
||||
OnPropertyChanging(nameof(VisibleEntries));
|
||||
_onlyShowJoinableGames = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void NameSorting(int nameSort = 0)
|
||||
{
|
||||
_sorting.Name = nameSort;
|
||||
SortApply();
|
||||
}
|
||||
|
||||
public void StatusSorting(int statusSort = 0)
|
||||
{
|
||||
_sorting.PlayerCount = statusSort;
|
||||
SortApply();
|
||||
}
|
||||
|
||||
public void Search(string searchTerm)
|
||||
{
|
||||
if (string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
SetEntries(Mwvm.LdnModels);
|
||||
SortApply();
|
||||
return;
|
||||
}
|
||||
|
||||
SetEntries(Mwvm.LdnModels.Where(x =>
|
||||
x.Title.Name.ContainsIgnoreCase(searchTerm)
|
||||
|| x.Title.Id.ContainsIgnoreCase(searchTerm)));
|
||||
|
||||
SortApply();
|
||||
}
|
||||
|
||||
private void SetEntries(IEnumerable<LdnGameModel> entries)
|
||||
{
|
||||
_visibleEntries = entries.ToList();
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
|
||||
private void SortApply()
|
||||
{
|
||||
try
|
||||
{
|
||||
_visibleEntries = (_sorting switch
|
||||
{
|
||||
(0, 0) => _visibleEntries.OrderBy(x => _sortKeySelector(x) ?? string.Empty), // A - Z
|
||||
(0, 1) => _visibleEntries.OrderByDescending(x => _sortKeySelector(x) ?? string.Empty), // Z - A
|
||||
(1, 0) => _visibleEntries.OrderBy(x => x.PlayerCount).ThenBy(x => x.Title.Name, StringComparer.OrdinalIgnoreCase), // Player count low - high, then A - Z
|
||||
(1, 1) => _visibleEntries.OrderBy(x => x.PlayerCount).ThenByDescending(x => x.Title.Name, StringComparer.OrdinalIgnoreCase), // Player count high - low, then A - Z
|
||||
(2, 0) => _visibleEntries.OrderByDescending(x => x.PlayerCount).ThenBy(x => x.Title.Name, StringComparer.OrdinalIgnoreCase), // Player count low - high, then Z - A
|
||||
(2, 1) => _visibleEntries.OrderByDescending(x => x.PlayerCount).ThenByDescending(x => x.Title.Name, StringComparer.OrdinalIgnoreCase), // Player count high - low, then Z - A
|
||||
_ => _visibleEntries.OrderBy(x => x.PlayerCount)
|
||||
}).ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OnPropertyChanged(nameof(VisibleEntries));
|
||||
}
|
||||
}
|
||||
}
|
@@ -32,6 +32,7 @@ using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Multiplayer;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.UI;
|
||||
@@ -57,7 +58,6 @@ using Key = Ryujinx.Input.Key;
|
||||
using MissingKeyException = LibHac.Common.Keys.MissingKeyException;
|
||||
using Path = System.IO.Path;
|
||||
using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState;
|
||||
using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
@@ -111,6 +111,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
[ObservableProperty] private bool _isSubMenuOpen;
|
||||
[ObservableProperty] private ApplicationContextMenu _listAppContextMenu;
|
||||
[ObservableProperty] private ApplicationContextMenu _gridAppContextMenu;
|
||||
[ObservableProperty] private bool _isRyuLdnEnabled;
|
||||
[ObservableProperty] private bool _updateAvailable;
|
||||
|
||||
public static AsyncRelayCommand UpdateCommand { get; } = Commands.Create(async () =>
|
||||
@@ -142,7 +143,25 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private ApplicationData _gridSelectedApplication;
|
||||
|
||||
// Key is Title ID
|
||||
public SafeDictionary<string, LdnGameData.Array> LdnData = [];
|
||||
/// <summary>
|
||||
/// At any given time, this dictionary contains the filtered data from <see cref="_ldnModels"/>.
|
||||
/// Filtered in this case meaning installed games only.
|
||||
/// </summary>
|
||||
public SafeDictionary<string, LdnGameModel.Array> UsableLdnData = [];
|
||||
|
||||
private LdnGameModel[] _ldnModels;
|
||||
|
||||
public LdnGameModel[] LdnModels
|
||||
{
|
||||
get => _ldnModels;
|
||||
set
|
||||
{
|
||||
_ldnModels = value;
|
||||
LocaleManager.Associate(LocaleKeys.LdnGameListTitle, value.Length);
|
||||
LocaleManager.Associate(LocaleKeys.LdnGameListSearchBoxWatermark, value.Length);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow Window { get; init; }
|
||||
|
||||
@@ -165,11 +184,28 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
LoadConfigurableHotKeys();
|
||||
|
||||
IsRyuLdnEnabled = ConfigurationState.Instance.Multiplayer.Mode.Value is MultiplayerMode.LdnRyu;
|
||||
ConfigurationState.Instance.Multiplayer.Mode.Event += OnLdnModeChanged;
|
||||
|
||||
Volume = ConfigurationState.Instance.System.AudioVolume;
|
||||
CustomVSyncInterval = ConfigurationState.Instance.Graphics.CustomVSyncInterval.Value;
|
||||
}
|
||||
}
|
||||
|
||||
~MainWindowViewModel()
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
ConfigurationState.Instance.Multiplayer.Mode.Event -= OnLdnModeChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLdnModeChanged(object sender, ReactiveEventArgs<MultiplayerMode> e) =>
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
IsRyuLdnEnabled = e.NewValue is MultiplayerMode.LdnRyu;
|
||||
});
|
||||
|
||||
public void Initialize(
|
||||
ContentManager contentManager,
|
||||
IStorageProvider storageProvider,
|
||||
@@ -313,11 +349,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
if (ts.HasValue)
|
||||
{
|
||||
var formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
||||
LocaleManager.Instance.SetDynamicValues(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
||||
LocaleManager.Associate(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
||||
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ShowTotalTimePlayed = ts.HasValue;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,6 @@ using DynamicData.Binding;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
@@ -7,6 +7,7 @@
|
||||
mc:Ignorable="d"
|
||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||
xmlns:common="clr-namespace:Ryujinx.Common;assembly=Ryujinx.Common"
|
||||
x:DataType="viewModels:MainWindowViewModel"
|
||||
x:Class="Ryujinx.Ava.UI.Views.Main.MainMenuBarView">
|
||||
<Design.DataContext>
|
||||
@@ -250,25 +251,30 @@
|
||||
Name="CompatibilityListMenuItem"
|
||||
Header="{ext:Locale CompatibilityListOpen}"
|
||||
Icon="{ext:Icon fa-solid fa-database}"/>
|
||||
<MenuItem
|
||||
Name="LdnGameListMenuItem"
|
||||
Header="{ext:Locale LdnGameListOpen}"
|
||||
Icon="{ext:Icon fa-solid fa-people-group}"
|
||||
IsEnabled="{Binding IsRyuLdnEnabled}"/>
|
||||
<Separator />
|
||||
<MenuItem VerticalAlignment="Center" Header="{ext:Locale MenuBarHelpFaqAndGuides}" Icon="{ext:Icon fa-solid fa-question}" >
|
||||
<MenuItem
|
||||
Name="FaqMenuItem"
|
||||
Header="{ext:Locale MenuBarHelpFaq}"
|
||||
Icon="{ext:Icon fa-brands fa-gitlab}"
|
||||
CommandParameter="https://git.ryujinx.app/ryubing/ryujinx/-/wikis/FAQ-&-Troubleshooting"
|
||||
CommandParameter="{x:Static common:SharedConstants.FaqWikiUrl}"
|
||||
ToolTip.Tip="{ext:Locale MenuBarHelpFaqTooltip}" />
|
||||
<MenuItem
|
||||
Name="SetupGuideMenuItem"
|
||||
Header="{ext:Locale MenuBarHelpSetup}"
|
||||
Icon="{ext:Icon fa-brands fa-gitlab}"
|
||||
CommandParameter="https://git.ryujinx.app/ryubing/ryujinx/-/wikis/Setup-&-Configuration-Guide"
|
||||
CommandParameter="{x:Static common:SharedConstants.SetupGuideWikiUrl}"
|
||||
ToolTip.Tip="{ext:Locale MenuBarHelpSetupTooltip}" />
|
||||
<MenuItem
|
||||
Name="LdnGuideMenuItem"
|
||||
Header="{ext:Locale MenuBarHelpMultiplayer}"
|
||||
Icon="{ext:Icon fa-brands fa-gitlab}"
|
||||
CommandParameter="https://git.ryujinx.app/ryubing/ryujinx/-/wikis/Multiplayer-(LDN-Local-Wireless)-Guide"
|
||||
CommandParameter="{x:Static common:SharedConstants.MultiplayerWikiUrl}"
|
||||
ToolTip.Tip="{ext:Locale MenuBarHelpMultiplayerTooltip}" />
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
|
@@ -49,6 +49,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||
XciTrimmerMenuItem.Command = Commands.Create(XciTrimmerView.Show);
|
||||
AboutWindowMenuItem.Command = Commands.Create(AboutView.Show);
|
||||
CompatibilityListMenuItem.Command = Commands.Create(() => CompatibilityListWindow.Show());
|
||||
LdnGameListMenuItem.Command = Commands.Create(() => LdnGamesListWindow.Show());
|
||||
|
||||
UpdateMenuItem.Command = MainWindowViewModel.UpdateCommand;
|
||||
|
||||
|
@@ -148,12 +148,27 @@
|
||||
Text="{Binding FileExtension}"
|
||||
TextAlignment="Start"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Stretch"
|
||||
<Button
|
||||
HorizontalContentAlignment="Left"
|
||||
Click="LdnGames_OnClick"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{Binding HasLdnGames}"
|
||||
Text="{Binding Converter={x:Static helpers:MultiplayerInfoConverter.Instance}}"
|
||||
TextAlignment="Start"
|
||||
TextWrapping="Wrap"/>
|
||||
Background="{DynamicResource AppListBackgroundColor}"
|
||||
Padding="0">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Stretch"
|
||||
Tag="{Binding IdString}"
|
||||
Text="{Binding Converter={x:Static helpers:MultiplayerInfoConverter.Instance}}"
|
||||
TextAlignment="Start"
|
||||
TextWrapping="Wrap"/>
|
||||
<Button.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="MinWidth"
|
||||
Value="0" />
|
||||
<!-- avoids very wide buttons from the overall project avalonia style -->
|
||||
</Style>
|
||||
</Button.Styles>
|
||||
</Button>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding HasIndependentConfiguration}"
|
||||
|
@@ -38,6 +38,14 @@ namespace Ryujinx.Ava.UI.Views.Misc
|
||||
|
||||
await CompatibilityListWindow.Show((string)playabilityLabel.Tag);
|
||||
}
|
||||
|
||||
private async void LdnGames_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not Button { Content: TextBlock ldnGamesLabel })
|
||||
return;
|
||||
|
||||
await LdnGamesListWindow.Show((string)ldnGamesLabel.Tag);
|
||||
}
|
||||
|
||||
private async void IdString_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
@@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
if (DataContext is not CompatibilityViewModel cvm)
|
||||
return;
|
||||
|
||||
cvm.NameSorting(int.Parse(sortStrategy));
|
||||
cvm.NameSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,5 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
cvm.StatusSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
349
src/Ryujinx/UI/Windows/LdnGamesListWindow.axaml
Normal file
349
src/Ryujinx/UI/Windows/LdnGamesListWindow.axaml
Normal file
@@ -0,0 +1,349 @@
|
||||
<window:StyleableAppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ext="using:Ryujinx.Ava.Common.Markup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||
xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
|
||||
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
||||
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||
xmlns:facontrols="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||
CanResize="False"
|
||||
mc:Ignorable="d"
|
||||
MinWidth="800"
|
||||
MinHeight="745"
|
||||
x:Class="Ryujinx.Ava.UI.Windows.LdnGamesListWindow"
|
||||
x:DataType="viewModels:LdnGamesListViewModel">
|
||||
<window:StyleableAppWindow.DataContext>
|
||||
<viewModels:LdnGamesListViewModel />
|
||||
</window:StyleableAppWindow.DataContext>
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<!-- UI FlushControls -->
|
||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto" Name="FlushControls">
|
||||
<controls:RyujinxLogo
|
||||
Grid.Column="0"
|
||||
Margin="15, 0, 7, 0"
|
||||
ToolTip.Tip="{ext:WindowTitle LdnGameListTitle, False}"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Name="SearchBoxFlush"
|
||||
Margin="0, 5, 0, 5"
|
||||
HorizontalAlignment="Stretch"
|
||||
Watermark="{ext:Locale LdnGameListSearchBoxWatermark}"
|
||||
TextChanged="TextBox_OnTextChanged"/>
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Name="InfoFlush"
|
||||
Margin="10, 5, 0, 5"
|
||||
MinWidth="32"
|
||||
MinHeight="32"
|
||||
ClipToBounds="False"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{ext:Icon fa-solid fa-info}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListInfoButtonToolTip}"/>
|
||||
<Button
|
||||
Grid.Column="3"
|
||||
Name="RefreshFlush"
|
||||
Margin="10, 5, 0, 5"
|
||||
MinWidth="32"
|
||||
MinHeight="32"
|
||||
ClipToBounds="False"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsEnabled="{Binding !IsRefreshing}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListRefreshToolTip}">
|
||||
<facontrols:SymbolIcon Symbol="Refresh" />
|
||||
</Button>
|
||||
<StackPanel Grid.Column="4" Orientation="Horizontal" Margin="10, 5, 0, 5">
|
||||
<DropDownButton
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{ext:Locale CommonSort}"
|
||||
DockPanel.Dock="Right">
|
||||
<DropDownButton.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<StackPanel
|
||||
Margin="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Orientation="Vertical">
|
||||
<StackPanel>
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_Name_Checked"
|
||||
Content="{ext:Locale GameListSortStatusNameAscending}"
|
||||
GroupName="Sort"
|
||||
IsChecked="True"
|
||||
Tag="0" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_Name_Checked"
|
||||
Content="{ext:Locale GameListSortStatusNameDescending}"
|
||||
GroupName="Sort"
|
||||
Tag="1" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Width="60"
|
||||
Height="2"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
BorderBrush="White"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Separator Height="0" HorizontalAlignment="Stretch" />
|
||||
</Border>
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortDisable}"
|
||||
GroupName="Order"
|
||||
IsChecked="true"
|
||||
Tag="0" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortAscending}"
|
||||
GroupName="Order"
|
||||
Tag="1" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortDescending}"
|
||||
GroupName="Order"
|
||||
Tag="2" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
</StackPanel>
|
||||
<DropDownButton
|
||||
Grid.Column="5"
|
||||
Margin="10, 0, 148, 0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="Filters"
|
||||
DockPanel.Dock="Right">
|
||||
<DropDownButton.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<StackPanel>
|
||||
<CheckBox IsChecked="{Binding OnlyShowForOwnedGames}">
|
||||
<TextBlock Text="{ext:Locale CompatibilityListOnlyShowOwnedGames}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding OnlyShowPublicGames}">
|
||||
<TextBlock Text="{ext:Locale LdnGameListOnlyShowPublicGames}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding OnlyShowJoinableGames}">
|
||||
<TextBlock Text="{ext:Locale LdnGameListOnlyShowJoinableGames}" />
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
</Grid>
|
||||
|
||||
<!-- UI NormalControls -->
|
||||
<Grid Grid.Row="0" ColumnDefinitions="*,Auto,Auto,Auto,Auto,Auto" Name="NormalControls">
|
||||
<TextBox Name="SearchBoxNormal" Grid.Column="0" Margin="20, 5, 0, 5" HorizontalAlignment="Stretch"
|
||||
Watermark="{ext:Locale LdnGameListSearchBoxWatermark}" TextChanged="TextBox_OnTextChanged" />
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Name="InfoNormal"
|
||||
Margin="10, 5, 0, 5"
|
||||
MinWidth="32"
|
||||
MinHeight="32"
|
||||
ClipToBounds="False"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{ext:Icon fa-solid fa-info}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListInfoButtonToolTip}"/>
|
||||
<Button Grid.Column="2" Name="RefreshNormal" Margin="10, 5, 0, 5" MinWidth="32" MinHeight="32" ClipToBounds="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsEnabled="{Binding !IsRefreshing}">
|
||||
<facontrols:SymbolIcon Symbol="Refresh" />
|
||||
</Button>
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal" Margin="10, 5, 0, 5">
|
||||
<DropDownButton
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{ext:Locale CommonSort}"
|
||||
DockPanel.Dock="Right">
|
||||
<DropDownButton.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<StackPanel
|
||||
Margin="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Orientation="Vertical">
|
||||
<StackPanel>
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_Name_Checked"
|
||||
Content="{ext:Locale GameListSortStatusNameAscending}"
|
||||
GroupName="Sort"
|
||||
IsChecked="True"
|
||||
Tag="0" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_Name_Checked"
|
||||
Content="{ext:Locale GameListSortStatusNameDescending}"
|
||||
GroupName="Sort"
|
||||
Tag="1" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Width="60"
|
||||
Height="2"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
BorderBrush="White"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Separator Height="0" HorizontalAlignment="Stretch" />
|
||||
</Border>
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortDisable}"
|
||||
GroupName="Order"
|
||||
IsChecked="true"
|
||||
Tag="0" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortAscending}"
|
||||
GroupName="Order"
|
||||
Tag="1" />
|
||||
<RadioButton
|
||||
IsCheckedChanged="Sort_PlayerCount_Checked"
|
||||
Content="{ext:Locale LdnGameListPlayerSortDescending}"
|
||||
GroupName="Order"
|
||||
Tag="2" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
</StackPanel>
|
||||
<DropDownButton
|
||||
Grid.Column="4"
|
||||
Margin="10, 5, 20, 5"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="Filters"
|
||||
DockPanel.Dock="Right">
|
||||
<DropDownButton.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<StackPanel>
|
||||
<CheckBox IsChecked="{Binding OnlyShowForOwnedGames}">
|
||||
<TextBlock Text="{ext:Locale CompatibilityListOnlyShowOwnedGames}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding OnlyShowPublicGames}">
|
||||
<TextBlock Text="{ext:Locale LdnGameListOnlyShowPublicGames}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding OnlyShowJoinableGames}">
|
||||
<TextBlock Text="{ext:Locale LdnGameListOnlyShowJoinableGames}" />
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
</Grid>
|
||||
|
||||
<!-- List of open LDN games -->
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<ListBox Margin="12, 0, 13, 0"
|
||||
Background="Transparent"
|
||||
ItemsSource="{Binding VisibleEntries}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel
|
||||
ItemHeight="125"
|
||||
ItemWidth="450"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:LdnGameModel}">
|
||||
<Border
|
||||
Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="4"
|
||||
Background="Transparent">
|
||||
<Grid ColumnDefinitions="Auto,Auto,*" RowDefinitions="Auto,Auto,Auto,*" Width="420" Height="110" HorizontalAlignment="Center">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="{Binding Title.Name}"
|
||||
Margin="7, 0,0, 0"
|
||||
Width="250"
|
||||
ToolTip.Tip="{Binding Title.Id}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="{Binding Title.Version}"
|
||||
Margin="7, 0,0, 0"
|
||||
Width="250"
|
||||
ToolTip.Tip="{Binding Title.Id}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Left"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="{Binding FormattedCreatedAt}"
|
||||
ToolTip.Tip="{Binding CreatedAtToolTip}"
|
||||
Margin="7, 0,0, 0"
|
||||
Width="250"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Left" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="2"
|
||||
Margin="0, 0,7, 0"
|
||||
IsVisible="{Binding IsJoinable}"
|
||||
Text="{ext:Locale LdnGameListJoinable}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListJoinableToolTip}"
|
||||
Foreground="MediumSeaGreen"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Right" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="2"
|
||||
Margin="0, 0,7, 0"
|
||||
IsVisible="{Binding !IsJoinable}"
|
||||
Text="{ext:Locale LdnGameListNotJoinable}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListNotJoinableToolTip}"
|
||||
Foreground="IndianRed"
|
||||
TextDecorations="Underline"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="2"
|
||||
Margin="0, 0,7, 0"
|
||||
IsVisible="{Binding IsPublic}"
|
||||
Text="{ext:Locale LdnGameListPublic}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListPublicToolTip}"
|
||||
Foreground="LawnGreen"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="2"
|
||||
Margin="0, 0,7, 0"
|
||||
IsVisible="{Binding !IsPublic}"
|
||||
Text="{ext:Locale LdnGameListPrivate}"
|
||||
ToolTip.Tip="{ext:Locale LdnGameListPrivateToolTip}"
|
||||
Foreground="DarkRed"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Right" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="2"
|
||||
Margin="0, 0,7, 0"
|
||||
Text="{Binding ConnectionTypeLocaleKey, Converter={x:Static helpers:LocaleKeyValueConverter.Shared}}"
|
||||
ToolTip.Tip="{Binding ConnectionTypeToolTipLocaleKey, Converter={x:Static helpers:LocaleKeyValueConverter.Shared}}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
TextWrapping="NoWrap"
|
||||
ClipToBounds="False"
|
||||
TextAlignment="Right" />
|
||||
<StackPanel Margin="7, 0,0, 0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding PlayersLabel}" TextAlignment="Left" />
|
||||
<TextBlock Text="{Binding FormattedPlayers}" TextAlignment="Center" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</window:StyleableAppWindow>
|
79
src/Ryujinx/UI/Windows/LdnGamesListWindow.axaml.cs
Normal file
79
src/Ryujinx/UI/Windows/LdnGamesListWindow.axaml.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Helper;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
public partial class LdnGamesListWindow : StyleableAppWindow
|
||||
{
|
||||
public static async Task Show(string searchTerm = null)
|
||||
{
|
||||
using LdnGamesListViewModel ldnGamesListVm = new(RyujinxApp.MainWindow.ViewModel);
|
||||
|
||||
await ShowAsync(new LdnGamesListWindow
|
||||
{
|
||||
DataContext = ldnGamesListVm,
|
||||
SearchBoxFlush = { Text = searchTerm ?? string.Empty },
|
||||
SearchBoxNormal = { Text = searchTerm ?? string.Empty }
|
||||
});
|
||||
}
|
||||
|
||||
public LdnGamesListWindow() : base(useCustomTitleBar: true, 37)
|
||||
{
|
||||
Title = RyujinxApp.FormatTitle(LocaleKeys.LdnGameListTitle);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
FlushControls.IsVisible = !ConfigurationState.Instance.ShowOldUI;
|
||||
NormalControls.IsVisible = ConfigurationState.Instance.ShowOldUI;
|
||||
|
||||
RefreshFlush.Command = RefreshNormal.Command =
|
||||
Commands.Create(() => (DataContext as LdnGamesListViewModel)?.RefreshAsync().OrCompleted());
|
||||
|
||||
InfoFlush.Command = InfoNormal.Command =
|
||||
Commands.Create(() => OpenHelper.OpenUrl(SharedConstants.MultiplayerWikiUrl));
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
// its referenced in the axaml but rider keeps yelling at me that its unused so
|
||||
private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (DataContext is not LdnGamesListViewModel cvm)
|
||||
return;
|
||||
|
||||
if (sender is not TextBox searchBox)
|
||||
return;
|
||||
|
||||
cvm.Search(searchBox.Text);
|
||||
}
|
||||
|
||||
public void Sort_Name_Checked(object sender, RoutedEventArgs args)
|
||||
{
|
||||
if (sender is RadioButton { Tag: string sortStrategy })
|
||||
{
|
||||
if (DataContext is not LdnGamesListViewModel cvm)
|
||||
return;
|
||||
|
||||
cvm.NameSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
|
||||
public void Sort_PlayerCount_Checked(object sender, RoutedEventArgs args)
|
||||
{
|
||||
if (sender is RadioButton { Tag: string sortStrategy })
|
||||
{
|
||||
if (DataContext is not LdnGamesListViewModel cvm)
|
||||
return;
|
||||
|
||||
cvm.StatusSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,7 +8,6 @@ using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using Gommon;
|
||||
using LibHac.Ns;
|
||||
using Ryujinx.Ava.Common;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Input;
|
||||
@@ -18,6 +17,7 @@ using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.Systems.Configuration.UI;
|
||||
using Ryujinx.Ava.UI.Applet;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common;
|
||||
@@ -185,12 +185,11 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
ViewModel.LdnData.Clear();
|
||||
ViewModel.LdnModels = e.LdnData;
|
||||
ViewModel.UsableLdnData.Clear();
|
||||
foreach (ApplicationData application in ViewModel.Applications.Where(it => it.HasControlHolder))
|
||||
{
|
||||
ref ApplicationControlProperty controlHolder = ref application.ControlHolder.Value;
|
||||
|
||||
ViewModel.LdnData[application.IdString] = e.LdnData.Where(ref controlHolder);
|
||||
ViewModel.UsableLdnData[application.IdString] = LdnGameModel.GetArrayForApp(e.LdnData, ref application.ControlHolder.Value);
|
||||
|
||||
UpdateApplicationWithLdnData(application);
|
||||
}
|
||||
@@ -201,7 +200,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
private void UpdateApplicationWithLdnData(ApplicationData application)
|
||||
{
|
||||
if (application.HasControlHolder && ViewModel.LdnData.TryGetValue(application.IdString, out LdnGameData.Array ldnGameDatas))
|
||||
if (application.HasControlHolder && ViewModel.UsableLdnData.TryGetValue(application.IdString, out LdnGameModel.Array ldnGameDatas))
|
||||
{
|
||||
application.PlayerCount = ldnGameDatas.PlayerCount;
|
||||
application.GameCount = ldnGameDatas.GameCount;
|
||||
|
Reference in New Issue
Block a user