diff --git a/Core.cs b/Core.cs index 03ce741..8eccb0c 100644 --- a/Core.cs +++ b/Core.cs @@ -644,7 +644,6 @@ namespace UnbeatableSongHack public static void Postfix(ref ArcadeSongDatabase __instance) { var LoggerInstance = Core.GetLogger(); - LoggerInstance.Msg("HAIIIIIIII"); Traverse traverse = Traverse.Create(__instance); BeatmapIndex beatmapIndex = traverse.Field("_beatmapIndex").GetValue(); @@ -656,20 +655,20 @@ namespace UnbeatableSongHack //test song - Empty Diaryaaa string beatmap = File.ReadAllText(beatmapPath); - string songName = ""; + string songName = "audio.mp3"; using (var songNameReader = new StringReader(beatmap.Substring(beatmap.IndexOf("Title:") + 6).Trim())) { - songName = songNameReader.ReadLine(); + //songName = songNameReader.ReadLine(); } LoggerInstance.Msg(songName); string difficulty = beatmap.Substring(beatmap.IndexOf("Version:") + 8 /* adding 8, the length of the string "Version:" */ , beatmap.IndexOf(" ", beatmap.IndexOf("Version:")) - (beatmap.IndexOf("Version:") + 8)); LoggerInstance.Msg(difficulty); - string path = "__CUSTOM"+beatmapPath; + string path = songName+"/"+difficulty; BeatmapIndex.Song mapSong = new Song(songName); mapSong.stageScene = "TrainStationRhythm"; - TextAsset asset = new TextAsset(); + TextAsset asset = new TextAsset(beatmap); BeatmapInfo info = new BeatmapInfo(asset,difficulty); Beatmap map = ScriptableObject.CreateInstance(); map.metadata.title = songName; @@ -677,6 +676,7 @@ namespace UnbeatableSongHack map.metadata.artist = "Not You"; map.metadata.artistUnicode = "Not You"; map.metadata.tagData.Level = 10; + //map.metadata.tagData.SongLength = float.Parse(beatmap.Substring(beatmap.IndexOf("SongLength\":")+13,beatmap.IndexOf("}", beatmap.IndexOf("SongLength\":") + 13))); BeatmapItem item = new BeatmapItem(); item.Path = path; @@ -684,9 +684,16 @@ namespace UnbeatableSongHack item.Beatmap = map; item.Highscore = new HighScoreItem(path, 0, 0f, 0, cleared: false, new Dictionary(), Modifiers.None); item.Unlocked = true; + item.Song = mapSong; + LoggerInstance.Msg("about to parse beatmap"); + BeatmapParserEngine engine = new BeatmapParserEngine(); + engine.ReadBeatmap(info.text, ref map, BeatmapParserEngine.SectionTypes.Everything); + + songList.Add(item); songDatabase.TryAdd(songName, item); + LoggerInstance.Msg("added " + songName + " " + difficulty); /*public string Path;