From cbeb1600205b0e882f45fea56dc7fbe033a5755a Mon Sep 17 00:00:00 2001 From: Awesomeangotti Date: Mon, 27 Apr 2026 16:05:29 -0400 Subject: [PATCH] Checkpoint: Convert prefabulated list picking to JSON file. Language support pending. --- assets/Splashes/Splashes.json | 28 ++++++------- src/Ryujinx/Common/SplashTextHelper.cs | 55 ++++++++++++++++---------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/assets/Splashes/Splashes.json b/assets/Splashes/Splashes.json index b197abaa3..07958cce1 100644 --- a/assets/Splashes/Splashes.json +++ b/assets/Splashes/Splashes.json @@ -1,29 +1,29 @@ { "Locales": [ { - "ID": "MenuBarActionsOpenMiiEditor", "Translations": { "ar_SA": "", "de_DE": "", "el_GR": "", - "en_US": "Mii Editor", - "es_ES": "Editor de Mii", - "fr_FR": "Éditeur de Mii", + "en_US": "JOKE!", + "es_ES": "", + "fr_FR": "", "he_IL": "", - "it_IT": "Editor di Mii", + "it_IT": "", "ja_JP": "", - "ko_KR": "Mii 편집기", - "no_NO": "Mii-redigerer", - "pl_PL": "Edytor Mii", - "pt_BR": "Editor de Mii", - "ru_RU": "Редактор Mii", - "sv_SE": "Mii-redigerare", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", "th_TH": "", "tr_TR": "", - "uk_UA": "Редактор Mii", - "zh_CN": "Mii 编辑器", - "zh_TW": "Mii 編輯器" + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" } + } ] } \ No newline at end of file diff --git a/src/Ryujinx/Common/SplashTextHelper.cs b/src/Ryujinx/Common/SplashTextHelper.cs index 4e37bea04..e3eeaf32e 100644 --- a/src/Ryujinx/Common/SplashTextHelper.cs +++ b/src/Ryujinx/Common/SplashTextHelper.cs @@ -1,13 +1,9 @@ using System.Collections.Generic; using Ryujinx.Common.Logging; using Gommon; -/* For use when working on json stuff using Ryujinx.Ava.Common.Locale; -using Ryujinx.Common.Utilities; using System; -using System.IO; -using System.Text.Json.Serialization; -*/ +using System.Text.Json; namespace Ryujinx.Common { @@ -16,11 +12,11 @@ namespace Ryujinx.Common { public static void PrintSplash() { - Logger.Notice.Print(LogClass.Application, " ___ __ _ "); + Logger.Notice.Print(LogClass.Application, " ___ __ _ "); Logger.Notice.Print(LogClass.Application, @" / _ \ __ __ __ __ / / (_) ___ ___ _"); Logger.Notice.Print(LogClass.Application, @" / , _/ / // // // / / _ \ / / / _ \ / _ `/"); Logger.Notice.Print(LogClass.Application, @"/_/|_| \_, / \_,_/ /_.__//_/ /_//_/ \_, / "); - Logger.Notice.Print(LogClass.Application, " /___/ /___/ "); + Logger.Notice.Print(LogClass.Application, " /___/ /___/ "); Logger.Notice.Print(LogClass.Application, ""); Logger.Notice.Print(LogClass.Application, GetSplash()); @@ -33,13 +29,39 @@ namespace Ryujinx.Common { if (string.IsNullOrEmpty(_Final_Splash)) { - _Final_Splash = _Main_Splashes.GetRandomElement(); + _Final_Splash = _Get_Lang_Json(); } return $"{_Final_Splash}"; } + + private static SplashLocalesJson _Splash_Json; - // This list contains all splashes. Additions are welcome to this list : ) - Awesomeangotti + private static string _Get_Lang_Json() + { + foreach (string uri in EmbeddedResources.GetAllAvailableResources("Ryujinx/Assets/Splashes", ".json")) + { + string data; + string path = uri[..^".json".Length]; + path = path.Replace('.', '/'); + path = path.Append(".json"); + data = EmbeddedResources.ReadAllText(path); + _Splash_Json = JsonSerializer.Deserialize(data); // There will theoretically only ever be one splashes.json + } + return _Splash_Json.Locales.GetRandomElement().Translations["en_US"]; // Just need to get locale selection now + } + + public struct SplashLocalesJson + { + public List Locales { get; set; } + } + + public struct SplashLocalesEntry + { + public Dictionary Translations { get; set; } + } + + // Original splash list. Held here for temporary reasons private static List _Main_Splashes = new() { "Ryubing is my middle name", @@ -98,23 +120,16 @@ namespace Ryujinx.Common "Async shader compilation would destroy my soul", "Trans rights are human rights!", ":3", + ":3", "Please connect a controller!", "Never gonna give you up!", "The game was rigged from the start", "Ganon is watching you!", - }; // My working codes stops here. The rest is experimental + "Now with 100% less JSON in the splash code!", + "With every splash I get closer to insanity!", - // Saving my place for now. This commented out code below here is my piss poor attempt at json parsing or deserializing or whatever it is. - - /* - private static List _Json_List; + }; - // Please free me from this JSON prison. - private static void _Make_Splash_List() - { - _Json_List = JsonHelper.DeserializeFromFile("Ryujinx/Assets/Splashes/Splash.json", JsonHelper.JsonSerializerContext); - } - */ } }