diff --git a/Assets/Scenes/MenuScene.unity b/Assets/Scenes/MenuScene.unity index d66028b19..79800c329 100644 --- a/Assets/Scenes/MenuScene.unity +++ b/Assets/Scenes/MenuScene.unity @@ -8026,6 +8026,7 @@ RectTransform: - {fileID: 976689291} - {fileID: 474114361} - {fileID: 411323886} + - {fileID: 1090956611} m_Father: {fileID: 874813133} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -8741,6 +8742,7 @@ MonoBehaviour: settingsContainer: {fileID: 1006802517} songFolderManager: {fileID: 1458216463} loadingScreen: {fileID: 784751310} + loadingStatus: {fileID: 1090956613} progressBar: {fileID: 1649890904} --- !u!1 &882788346 GameObject: @@ -10503,6 +10505,142 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075810277} m_CullTransparentMesh: 1 +--- !u!1 &1090956610 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1090956611} + - component: {fileID: 1090956612} + - component: {fileID: 1090956613} + m_Layer: 5 + m_Name: Current Status + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1090956611 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090956610} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 784751311} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: -55} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1090956612 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090956610} + m_CullTransparentMesh: 1 +--- !u!114 &1090956613 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090956610} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: ae170e91fd29a90479e906ddffb1d8ee, type: 2} + m_sharedMaterial: {fileID: -5480317595949376055, guid: ae170e91fd29a90479e906ddffb1d8ee, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 16 + m_fontSizeBase: 16 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &1126244163 GameObject: m_ObjectHideFlags: 0 @@ -15875,6 +16013,7 @@ MonoBehaviour: settingSpacePrefab: {fileID: 495506203781168666, guid: 94f7a64a42ac51e4eb6af891f99dc193, type: 3} settingsContainer: {fileID: 4596674} + inGame: 0 --- !u!1 &1696839234 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Script/Data/SongInfo.cs b/Assets/Script/Data/SongInfo.cs index 70e6c3c9f..6f356f2f2 100644 --- a/Assets/Script/Data/SongInfo.cs +++ b/Assets/Script/Data/SongInfo.cs @@ -26,6 +26,180 @@ public enum DrumType { {"harmVocals", -1}, }; + private static readonly Dictionary DEFAULT_SOURCES = new() { + {"gh1", "Guitar Hero"}, + {"gh", "Guitar Hero"}, + {"gh2", "Guitar Hero II"}, + {"gh2dlc", "Guitar Hero II DLC"}, + {"gh80s", "Guitar Hero Encore: Rocks the 80s"}, + {"gh3", "Guitar Hero III: Legends of Rock"}, + {"ghot", "Guitar Hero: On Tour"}, + {"gha", "Guitar Hero: Aerosmith"}, + {"ghwt", "Guitar Hero: World Tour"}, + {"ghm", "Guitar Hero: Metallica"}, + {"ghwor", "Guitar Hero: Warriors of Rock"}, + {"ghvh", "Guitar Hero: Van Halen"}, + {"gh2dx", "Guitar Hero II Deluxe"}, + {"gh2dxdlc", "Guitar Hero Rocks the 360"}, + {"gh80sdx", "Guitar Hero Encore Deluxe"}, + {"gh3dlc", "Guitar Hero III DLC"}, + {"ghwtdlc", "Guitar Hero: World Tour DLC"}, + {"ghmdlc", "Death Magnetic DLC"}, + {"djhero", "DJ Hero"}, + {"ghsh", "Guitar Hero: Smash Hits"}, + {"ghwordlc", "Guitar Hero: Warriors of Rock DLC"}, + {"gh5", "Guitar Hero 5"}, + {"gh5dlc", "Guitar Hero 5 DLC"}, + {"ghotd", "Guitar Hero On Tour: Decades"}, + {"ghotmh", "Guitar Hero On Tour: Modern Hits"}, + {"bandhero", "Band Hero"}, + {"bh", "Band Hero"}, + {"bhds", "Band Hero DS"}, + {"ghl", "Guitar Hero Live"}, + {"ghtv", "Guitar Hero TV"}, + + {"rb1", "Rock Band 1"}, + {"rb2", "Rock Band 2"}, + {"rb3", "Rock Band 3"}, + {"rb4", "Rock Band 4"}, + {"tbrb", "The Beatles Rock Band"}, + {"beatles", "The Beatles Rock Band"}, + {"tbrbdlc", "The Beatles: Rock Band DLC"}, + {"tbrbcdlc", "The Beatles: Rock Band Custom DLC Project"}, + {"rbacdc", "AC/DC Live: Rock Band Track Pack"}, + {"lrb", "Lego Rock Band"}, + {"rbn", "Rock Band Network"}, + {"ugc", "Rock Band Network 1.0"}, + {"ugc_plus", "Rock Band Network 2.0"}, + {"ugc1", "Rock Band Network 1.0"}, + {"ugc2", "Rock Band Network 2.0"}, + {"ugc_lost", "Lost Rock Band Network"}, + {"rb1dlc", "Rock Band 1 DLC"}, + {"rb2dlc", "Rock Band 2 DLC"}, + {"rb3dlc", "Rock Band 3 DLC"}, + {"rb4dlc", "Rock Band 4 DLC"}, + {"rb4_dlc", "Rock Band 4 DLC"}, + {"rb4_rivals", "Rock Band Rivals"}, + {"rbtp_acdc", "Rock Band Track Pack: AC/DC Live"}, + {"rbtp_classic_rock", "Rock Band Track Pack: Classic Rock"}, + {"rbtp_country_1", "Rock Band Track Pack: Country 1"}, + {"rbtp_country_2", "Rock Band Track Pack: Country 2"}, + {"rbtp_metal", "Rock Band Track Pack: Metal"}, + {"rbtp_vol_1", "Rock Band Track Pack: Volume 1"}, + {"rbtp_vol_2", "Rock Band Track Pack: Volume 2"}, + {"rb_blitz", "Rock Band Blitz"}, + {"pearljam", "Pearl Jam: Rock Band"}, + {"greenday", "Green Day: Rock Band"}, + {"gdrb", "Green Day: Rock Band"}, + {"rbvr", "Rock Band VR"}, + + {"311hero", "311 Hero"}, + {"a2z", "A-Z Pack"}, + {"ah1", "Angevil Hero"}, + {"ah2", "Angevil Hero 2"}, + {"ah3", "Angevil Hero 3"}, + {"ah4", "Angevil Hero 4"}, + {"antihero", "Anti Hero"}, + {"ahbe", "Anti Hero - Beach Episode"}, + {"antihero2", "Anti Hero 2"}, + {"a7xmegapack", "Avenged Sevenfold Mega Pack"}, + {"bitcrusher", "BITCRUSHER"}, + {"bitcrusherdlc", "BITCRUSHER DLC"}, + {"blackhole", "Black Hole"}, + {"bs", "Blanket Statement"}, + {"bleepbloops", "Bleep Bloops"}, + {"bleepbloopuc", "Bleep Bloop Undercharts"}, + {"ugc_c3", "C3 Customs"}, + {"c3customs", "C3 Customs"}, + {"c3legacy", "C3 Legacy"}, + {"cth1", "Carpal Tunnel Hero"}, + {"cth1r", "Carpal Tunnel Hero 1: Remastered"}, + {"cth2", "Carpal Tunnel Hero 2"}, + {"cth3", "Carpal Tunnel Hero 3"}, + {"cth3dlc", "Carpal Tunnel Hero 3 DLC"}, + {"charts", "CHARTS"}, + {"charts2", "CHARTS 2"}, + {"chelhero", "Chel Hero"}, + {"cb", "Circuit Breaker"}, + {"ch", "Clone Hero"}, + {"codered", "Code Red"}, + {"comtpi", "Community Track Pack I"}, + {"comtpii", "Community Track Pack II"}, + {"comtpiii", "Community Track Pack III"}, + {"comtpiv", "Community Track Pack IV"}, + {"comtp45", "Community Track Pack 4.5"}, + {"comtpv", "Community Track Pack V"}, + {"cowhero", "Cow Hero"}, + {"cowherodlc1", "Cow Hero DLC 1 - Bull Conqueror"}, + {"cowherodlc2", "Cow Hero DLC 2 - Bovine Champion"}, + {"cowherodlc3", "Cow Hero DLC 3 - Cattle Guardian"}, + {"creativech", "Creative Commons Hero"}, + {"csc", "Custom Songs Central"}, + {"customs", "Custom Songs"}, + {"digi", "Digitizer"}, + {"dissonancehero", "Dissonance Hero"}, + {"djenthero", "Djent Hero"}, + {"dhc", "Djent Hero Collection"}, + {"djentherodlc", "Djent Hero DLC"}, + {"facelift", "Facelift"}, + {"tfoth", "The Fall of Troy Hero"}, + {"fp", "Focal Point"}, + {"fp2", "Focal Point 2"}, + {"fp3", "Focal Point 3"}, + {"fof", "Frets on Fire"}, + {"fuse", "Fuse Box"}, + {"gd", "GITADORA"}, + {"gf1", "GuitarFreaks"}, + {"gf2dm1", "GuitarFreaks 2ndMIX & DrumMania"}, + {"addygh", "Guitar Hero II: Addy's Disc"}, + {"ghxsetlist", "Guitar Hero X"}, + {"ghx2setlist", "Guitar Hero X-II"}, + {"praise", "Guitar Praise"}, + {"praisedlc", "Guitar Praise: Expansion Pack 1"}, + {"stryper", "Guitar Praise: Stryper"}, + {"guitarzero2", "Guitar Zero 2"}, + {"guitarherodlc", "Guitar Zero 2 DLC"}, + {"harmonyhero", "Harmony Hero"}, + {"imetal", "Instru-Metal"}, + {"kh", "Koreaboo Hero"}, + {"kh2", "Koreaboo Hero 2"}, + {"marathon", "Marathon Hero"}, + {"marathonhero2", "Marathon Hero 2"}, + {"ma", "Max Altitude"}, + {"meme", "Meme Songs"}, + {"milohax", "MiloHax Customs"}, + {"miscellaneous", "Miscellaneous Packs"}, + {"paradigm", "Paradigm"}, + {"paramoremegapack", "Paramore Mega Pack"}, + {"phaseshift", "Phase Shift"}, + {"psgp4", "Phase Shift Guitar Project 4"}, + {"psh", "Plastic Shred Hero: Legends of Apahetic Charting"}, + {"psh2", "Plastic Shred Hero 2"}, + {"pg", "PowerGig: Rise of the SixString"}, + {"pgdlc", "PowerGig: Rise of the SixString DLC"}, + {"ph1", "Puppetz Hero I"}, + {"ph2", "Puppetz Hero II"}, + {"ph3", "Puppetz Hero III"}, + {"ph4", "Puppetz Hero IV"}, + {"ragequit", "Rage Quit"}, + {"ra", "Redemption Arc"}, + {"revolved", "REVOLVED"}, + {"rr", "Rock Revolution"}, + {"rrdlc", "Rock Revolution DLC"}, + {"scorespy", "ScoreSpy"}, + {"s_hero", "S Hero"}, + {"solomedley", "Solo Medleys"}, + {"finnish", "Suomibiisit"}, + {"se", "Symphonic Effect"}, + {"sxdisc", "Symphony X Discography Setlist"}, + {"synergy", "Synergy"}, + {"vortex_hero", "Vortex Hero"}, + {"wcc", "World Charts Community"}, + {"zancharted", "Zancharted"}, + {"zerogravity", "Zero Gravity"}, + {"zgsb", "Zero Gravity - Space Battle"}, + }; + public bool fetched; [JsonProperty] @@ -93,6 +267,7 @@ public Dictionary JsonDiffs { [JsonProperty] public string source; + public string SourceFriendlyName => SourceToGameName(source); [JsonProperty] public float songLength; [JsonProperty] @@ -145,5 +320,20 @@ public SongInfo(DirectoryInfo folder, string rootFolder) { public SongInfo Duplicate() { return (SongInfo) MemberwiseClone(); } + + /// + /// The converted short name (gh1) into the game name (Guitar Hero 1). + /// + private static string SourceToGameName(string source) { + if (SongLibrary.SourceNames != null && SongLibrary.SourceNames.TryGetValue(source, out string name)) { + return name; + } + + if (DEFAULT_SOURCES.TryGetValue(source, out name)) { + return name; + } + + return "Unknown Source"; + } } } \ No newline at end of file diff --git a/Assets/Script/SongLibrary.cs b/Assets/Script/SongLibrary.cs index 1147fa4a5..6d38530bd 100644 --- a/Assets/Script/SongLibrary.cs +++ b/Assets/Script/SongLibrary.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; using System.Security.Cryptography; using System.Threading; using Newtonsoft.Json; @@ -20,6 +21,8 @@ private class SongCacheJson { public List songs; } + public static string currentTaskDescription = ""; + public static bool currentlyLoading = false; public static float loadPercent = 0f; /// @@ -35,9 +38,19 @@ public static string[] SongFolders { /// public static string CacheFolder => Path.Combine(GameManager.PersistentDataPath, "caches"); + /// + /// The location of the local sources file. + /// + public static string SourcesFile => Path.Combine(GameManager.PersistentDataPath, "sources.txt"); + + /// + /// The URL of the Clone Hero sources list. + /// + public const string SourcesUrl = "https://sources.clonehero.net/sources.txt"; + /// /// A list of all of the playable songs.
- /// You must call first. + /// You must call first. ///
public static Dictionary.ValueCollection Songs => SongsByHash.Values; @@ -46,17 +59,87 @@ public static string[] SongFolders { /// /// A list of all of the playable songs, where keys are hashes.
- /// You must call first. + /// You must call first. ///
public static Dictionary SongsByHash { get; private set; } = null; + /// + /// A list of all of the playable songs, where keys are hashes.
+ /// You must call first. + ///
+ public static Dictionary SourceNames { + get; + private set; + } = null; + + public static void FetchEverything() { + ThreadPool.QueueUserWorkItem(_ => { + currentlyLoading = true; + loadPercent = 0f; + try { + LoadSongs(); + } catch (Exception e) { + Debug.LogError($"Error while loading songs: {e}"); + } + + loadPercent = 0f; + try { + FetchSources(); + loadPercent = 0.9f; + ReadSources(); + } catch (Exception e) { + Debug.LogError($"Error while fetching sources: {e}"); + } + + loadPercent = 1f; + currentlyLoading = false; + }); + } + /// /// Should be called before you access . /// public static void FetchAllSongs() { + ThreadPool.QueueUserWorkItem(_ => { + currentlyLoading = true; + loadPercent = 0f; + + try { + LoadSongs(); + } catch (Exception e) { + Debug.LogError($"Error while loading songs: {e}"); + } + + loadPercent = 1f; + currentlyLoading = false; + }); + } + + /// + /// Should be called before you access . + /// + public static void FetchSongSources() { + ThreadPool.QueueUserWorkItem(_ => { + currentlyLoading = true; + loadPercent = 0f; + + try { + FetchSources(); + loadPercent = 0.9f; + ReadSources(); + } catch (Exception e) { + Debug.LogError($"Error while fetching sources: {e}"); + } + + loadPercent = 1f; + currentlyLoading = false; + }); + } + + private static void LoadSongs() { if (!Directory.Exists(CacheFolder)) { Directory.CreateDirectory(CacheFolder); } @@ -69,45 +152,42 @@ public static void FetchAllSongs() { return; } - ThreadPool.QueueUserWorkItem(_ => { - while (songFoldersToLoad.Count > 0) { - string folderPath = songFoldersToLoad.Dequeue(); + while (songFoldersToLoad.Count > 0) { + string folderPath = songFoldersToLoad.Dequeue(); - Debug.Log($"Fetching songs from: `{folderPath}`."); + currentTaskDescription = $"Fetching songs from: `{folderPath}`."; + Debug.Log(currentTaskDescription); - string folderHash = Utils.Hash(folderPath); - string cachePath = Path.Combine(CacheFolder, folderHash + ".json"); + string folderHash = Utils.Hash(folderPath); + string cachePath = Path.Combine(CacheFolder, folderHash + ".json"); - if (File.Exists(cachePath)) { - var success = ReadCache(cachePath); - if (success) { - continue; - } + if (File.Exists(cachePath)) { + var success = ReadCache(cachePath); + if (success) { + continue; } + } - try { - songsTemp = new(); + try { + songsTemp = new(); - // Find songs - loadPercent = 0f; - CreateSongInfoFromFiles(folderPath, new(folderPath)); + // Find songs + loadPercent = 0f; + CreateSongInfoFromFiles(folderPath, new(folderPath)); - // Read song.ini and hashes - loadPercent = 0.1f; - ReadSongIni(); - GetSongHashes(); + // Read song.ini and hashes + loadPercent = 0.1f; + ReadSongIni(); + GetSongHashes(); - // Populate SongsByHash, and create cache - loadPercent = 0.9f; - PopulateSongByHashes(); - CreateCache(folderPath, cachePath); - } catch (Exception e) { - Debug.LogException(e); - } + // Populate SongsByHash, and create cache + loadPercent = 0.9f; + PopulateSongByHashes(); + CreateCache(folderPath, cachePath); + } catch (Exception e) { + Debug.LogException(e); } - - loadPercent = 1f; - }); + } } /// @@ -259,6 +339,59 @@ private static bool ReadCache(string cacheFile) { return true; } + private static bool FetchSources() { + currentTaskDescription = "Fetching list of sources."; + Debug.Log(currentTaskDescription); + + try { + // Retrieve sources file + var request = WebRequest.Create(SourcesUrl); + request.UseDefaultCredentials = true; + request.Timeout = 10000; + using var response = request.GetResponse(); + using var responseReader = new StreamReader(response.GetResponseStream()); + + // Store sources locally and load them + string text = responseReader.ReadToEnd(); + File.WriteAllText(SourcesFile, text); + } catch (Exception e) { + Debug.LogException(e); + return false; + } + + return true; + } + + /// + /// Reads the locally-cached sources file.
+ /// Populates + ///
+ private static bool ReadSources() { + if (!File.Exists(SourcesFile)) { + return false; + } + + SourceNames ??= new(); + SourceNames.Clear(); + var sources = File.ReadAllText(SourcesFile).Split("\n"); + foreach (string source in sources) { + if (string.IsNullOrWhiteSpace(source)) { + continue; + } + + // The sources are formatted as follows: + // iconName '=' Display Name + var pair = source.Split("'='", 2); + if (pair.Length < 2) { + Debug.LogWarning($"Invalid source entry when reading sources: {source}"); + continue; + } + SourceNames.Add(pair[0].Trim(), pair[1].Trim()); + } + + return true; + } + /// /// Force reset songs. This makes the game re-scan if needed. /// diff --git a/Assets/Script/UI/MainMenu.cs b/Assets/Script/UI/MainMenu.cs index 67394b5bd..d23e0e070 100644 --- a/Assets/Script/UI/MainMenu.cs +++ b/Assets/Script/UI/MainMenu.cs @@ -1,4 +1,5 @@ using System.IO; +using TMPro; using UnityEngine; using UnityEngine.UI; using YARG.Data; @@ -41,6 +42,8 @@ public static MainMenu Instance { [SerializeField] private GameObject loadingScreen; [SerializeField] + private TextMeshProUGUI loadingStatus; + [SerializeField] private Image progressBar; private void Start() { @@ -78,9 +81,10 @@ private void Update() { // Update progress if loading if (loadingScreen.activeSelf) { progressBar.fillAmount = SongLibrary.loadPercent; + loadingStatus.text = SongLibrary.currentTaskDescription; // Finish loading - if (SongLibrary.loadPercent >= 1f) { + if (!SongLibrary.currentlyLoading) { loadingScreen.SetActive(false); SongLibrary.loadPercent = 0f; } @@ -200,7 +204,7 @@ public void RefreshSongLibrary() { SongLibrary.Reset(); ScoreManager.Reset(); - SongLibrary.FetchAllSongs(); + SongLibrary.FetchEverything(); loadingScreen.SetActive(true); ScoreManager.FetchScores(); diff --git a/Assets/Script/UI/SelectedSongView.cs b/Assets/Script/UI/SelectedSongView.cs index 2fd3465c8..7e56ade3f 100644 --- a/Assets/Script/UI/SelectedSongView.cs +++ b/Assets/Script/UI/SelectedSongView.cs @@ -67,7 +67,7 @@ public void UpdateSongView(SongInfo songInfo) { lengthText.text = $"{minutes}:{seconds:00}"; // Source - supportText.text = Utils.SourceToGameName(songInfo.source); + supportText.text = songInfo.SourceFriendlyName; // Album cover albumCover.texture = null; diff --git a/Assets/Script/Util/Utils.cs b/Assets/Script/Util/Utils.cs index 40acfaaf9..6c42b534c 100644 --- a/Assets/Script/Util/Utils.cs +++ b/Assets/Script/Util/Utils.cs @@ -11,185 +11,6 @@ public static string Hash(string a) { return Hash128.Compute(a).ToString(); } - /// - /// The converted short name (gh1) into the game name (Guitar Hero 1). - /// - public static string SourceToGameName(string source) { -#pragma warning disable format - return source switch { - "gh1" or "gh" => "Guitar Hero", - "gh2" => "Guitar Hero II", - "gh2dlc" => "Guitar Hero II DLC", - "gh80s" => "Guitar Hero Encore: Rocks the 80s", - "gh3" => "Guitar Hero III: Legends of Rock", - "ghot" => "Guitar Hero: On Tour", - "gha" => "Guitar Hero: Aerosmith", - "ghwt" => "Guitar Hero: World Tour", - "ghm" => "Guitar Hero: Metallica", - "ghwor" => "Guitar Hero: Warriors of Rock", - "ghvh" => "Guitar Hero: Van Halen", - "gh2dx" => "Guitar Hero II Deluxe", - "gh2dxdlc" => "Guitar Hero Rocks the 360", - "gh80sdx" => "Guitar Hero Encore Deluxe", - "gh3dlc" => "Guitar Hero III DLC", - "ghwtdlc" => "Guitar Hero: World Tour DLC", - "ghmdlc" => "Death Magnetic DLC", - "djhero" => "DJ Hero", - "ghsh" => "Guitar Hero: Smash Hits", - "ghwordlc" => "Guitar Hero: Warriors of Rock DLC", - "gh5" => "Guitar Hero 5", - "gh5dlc" => "Guitar Hero 5 DLC", - "ghotd" => "Guitar Hero On Tour: Decades", - "ghotmh" => "Guitar Hero On Tour: Modern Hits", - "bandhero" or "bh" => "Band Hero", - "bhds" => "Band Hero DS", - "ghl" => "Guitar Hero Live", - "ghtv" => "Guitar Hero TV", - - "rb1" => "Rock Band 1", - "rb2" => "Rock Band 2", - "rb3" => "Rock Band 3", - "rb4" => "Rock Band 4", - "tbrb" or "beatles" => "The Beatles Rock Band", - "tbrbdlc" => "The Beatles: Rock Band DLC", - "tbrbcdlc" => "The Beatles: Rock Band Custom DLC Project", - "rbacdc" => "AC/DC Live: Rock Band Track Pack", - "gdrb" => "Green Day Rock Band", - "lrb" => "Lego Rock Band", - "rbn" => "Rock Band Network", - "ugc" => "Rock Band Network 1.0", - "ugc_plus" => "Rock Band Network 2.0", - "ugc1" => "Rock Band Network 1.0", - "ugc2" => "Rock Band Network 2.0", - "ugc_lost" => "Lost Rock Band Network", - "rb1dlc" => "Rock Band 1 DLC", - "rb2dlc" => "Rock Band 2 DLC", - "rb3dlc" => "Rock Band 3 DLC", - "rb4dlc" or "rb4_dlc" => "Rock Band 4 DLC", - "rb4_rivals" => "Rock Band Rivals", - "rbtp_acdc" => "Rock Band Track Pack: AC/DC Live", - "rbtp_classic_rock" => "Rock Band Track Pack: Classic Rock", - "rbtp_country_1" => "Rock Band Track Pack: Country 1", - "rbtp_country_2" => "Rock Band Track Pack: Country 2", - "rbtp_metal" => "Rock Band Track Pack: Metal", - "rbtp_vol_1" => "Rock Band Track Pack: Volume 1", - "rbtp_vol_2" => "Rock Band Track Pack: Volume 2", - "rb_blitz" => "Rock Band Blitz", - "pearljam" => "Pearl Jam: Rock Band", - "greenday" or "gdrb" => "Green Day: Rock Band", - "rbvr" => "Rock Band VR", - - "311hero" => "311 Hero", - "a2z" => "A-Z Pack", - "ah1" => "Angevil Hero", - "ah2" => "Angevil Hero 2", - "ah3" => "Angevil Hero 3", - "ah4" => "Angevil Hero 4", - "antihero" => "Anti Hero", - "ahbe" => "Anti Hero - Beach Episode", - "antihero2" => "Anti Hero 2", - "a7xmegapack" => "Avenged Sevenfold Mega Pack", - "bitcrusher" => "BITCRUSHER", - "bitcrusherdlc" => "BITCRUSHER DLC", - "blackhole" => "Black Hole", - "bs" => "Blanket Statement", - "bleepbloops" => "Bleep Bloops", - "bleepbloopuc" => "Bleep Bloop Undercharts", - "ugc_c3" => "C3 Customs", - "c3customs" => "C3 Customs", - "c3legacy" => "C3 Legacy", - "cth1" => "Carpal Tunnel Hero", - "cth1r" => "Carpal Tunnel Hero 1: Remastered", - "cth2" => "Carpal Tunnel Hero 2", - "cth3" => "Carpal Tunnel Hero 3", - "cth3dlc" => "Carpal Tunnel Hero 3 DLC", - "charts" => "CHARTS", - "charts2" => "CHARTS 2", - "chelhero" => "Chel Hero", - "cb" => "Circuit Breaker", - "ch" => "Clone Hero", - "codered" => "Code Red", - "comtpi" => "Community Track Pack I", - "comtpii" => "Community Track Pack II", - "comtpiii" => "Community Track Pack III", - "comtpiv" => "Community Track Pack IV", - "comtp45" => "Community Track Pack 4.5", - "comtpv" => "Community Track Pack V", - "cowhero" => "Cow Hero", - "cowherodlc1" => "Cow Hero DLC 1 - Bull Conqueror", - "cowherodlc2" => "Cow Hero DLC 2 - Bovine Champion", - "cowherodlc3" => "Cow Hero DLC 3 - Cattle Guardian", - "creativech" => "Creative Commons Hero", - "csc" => "Custom Songs Central", - "customs" => "Custom Songs", - "digi" => "Digitizer", - "dissonancehero" => "Dissonance Hero", - "djenthero" => "Djent Hero", - "dhc" => "Djent Hero Collection", - "djentherodlc" => "Djent Hero DLC", - "facelift" => "Facelift", - "tfoth" => "The Fall of Troy Hero", - "fp" => "Focal Point", - "fp2" => "Focal Point 2", - "fp3" => "Focal Point 3", - "fof" => "Frets on Fire", - "fuse" => "Fuse Box", - "gd" => "GITADORA", - "gf1" => "GuitarFreaks", - "gf2dm1" => "GuitarFreaks 2ndMIX & DrumMania", - "addygh" => "Guitar Hero II: Addy's Disc", - "ghxsetlist" => "Guitar Hero X", - "ghx2setlist" => "Guitar Hero X-II", - "praise" => "Guitar Praise", - "praisedlc" => "Guitar Praise: Expansion Pack 1", - "stryper" => "Guitar Praise: Stryper", - "guitarzero2" => "Guitar Zero 2", - "guitarherodlc" => "Guitar Zero 2 DLC", - "harmonyhero" => "Harmony Hero", - "imetal" => "Instru-Metal", - "kh" => "Koreaboo Hero", - "kh2" => "Koreaboo Hero 2", - "marathon" => "Marathon Hero", - "marathonhero2" => "Marathon Hero 2", - "ma" => "Max Altitude", - "meme" => "Meme Songs", - "milohax" => "MiloHax Customs", - "miscellaneous" => "Miscellaneous Packs", - "paradigm" => "Paradigm", - "paramoremegapack" => "Paramore Mega Pack", - "phaseshift" => "Phase Shift", - "psgp4" => "Phase Shift Guitar Project 4", - "psh" => "Plastic Shred Hero: Legends of Apahetic Charting", - "psh2" => "Plastic Shred Hero 2", - "pg" => "PowerGig: Rise of the SixString", - "pgdlc" => "PowerGig: Rise of the SixString DLC", - "ph1" => "Puppetz Hero I", - "ph2" => "Puppetz Hero II", - "ph3" => "Puppetz Hero III", - "ph4" => "Puppetz Hero IV", - "ragequit" => "Rage Quit", - "ra" => "Redemption Arc", - "revolved" => "REVOLVED", - "rr" => "Rock Revolution", - "rrdlc" => "Rock Revolution DLC", - "scorespy" => "ScoreSpy", - "s_hero" => "S Hero", - "solomedley" => "Solo Medleys", - "finnish" => "Suomibiisit", - "se" => "Symphonic Effect", - "sxdisc" => "Symphony X Discography Setlist", - "synergy" => "Synergy", - "vortex_hero" => "Vortex Hero", - "wcc" => "World Charts Community", - "zancharted" => "Zancharted", - "zerogravity" => "Zero Gravity", - "zgsb" => "Zero Gravity - Space Battle", - - _ => "Unknown Source" - }; -#pragma warning restore format - } - /// /// Checks if the path is equal to the path .
/// Platform specific case sensitivity is taken into account.