diff --git a/.idea/.idea.TaikoMods.dir/.idea/projectSettingsUpdater.xml b/.idea/.idea.TaikoMods.dir/.idea/projectSettingsUpdater.xml deleted file mode 100644 index 4bb9f4d..0000000 --- a/.idea/.idea.TaikoMods.dir/.idea/projectSettingsUpdater.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/.idea.TaikoMods.dir/.idea/workspace.xml b/.idea/.idea.TaikoMods.dir/.idea/workspace.xml deleted file mode 100644 index 7d16c69..0000000 --- a/.idea/.idea.TaikoMods.dir/.idea/workspace.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1643955770420 - - - - - - - - - - \ No newline at end of file diff --git a/Folder.DotSettings.user b/Folder.DotSettings.user deleted file mode 100644 index 806e514..0000000 --- a/Folder.DotSettings.user +++ /dev/null @@ -1,5 +0,0 @@ - - True - <AssemblyExplorer> - <Assembly Path="C:\git\public-git\taiko-mods\Taiko-Mod\bin\Debug\net48\Assembly-CSharp-firstpass.dll" /> -</AssemblyExplorer> \ No newline at end of file diff --git a/TakoTakoScripts/TJAConvert/Files.cs b/TJAConvert/Files.cs similarity index 100% rename from TakoTakoScripts/TJAConvert/Files.cs rename to TJAConvert/Files.cs diff --git a/TakoTakoScripts/TJAConvert/FodyWeavers.xml b/TJAConvert/FodyWeavers.xml similarity index 100% rename from TakoTakoScripts/TJAConvert/FodyWeavers.xml rename to TJAConvert/FodyWeavers.xml diff --git a/TakoTakoScripts/TJAConvert/Program.cs b/TJAConvert/Program.cs similarity index 86% rename from TakoTakoScripts/TJAConvert/Program.cs rename to TJAConvert/Program.cs index 46a349a..c84193b 100644 --- a/TakoTakoScripts/TJAConvert/Program.cs +++ b/TJAConvert/Program.cs @@ -22,6 +22,9 @@ namespace TJAConvert { public static class Program { + public const int PaddedSongTime = 2 * 1000; // in ms + public const float TjaOffsetForPaddingSong = -1.0f; // in ms + public static async Task Main(string[] args) { if (args.Length != 1) @@ -100,7 +103,7 @@ namespace TJAConvert Directory.CreateDirectory(tempOutDirectory); var originalTjaData = File.ReadAllBytes(tjaPath); - var tjaHash = (int)(MurmurHash2.Hash(originalTjaData) & 0xFFFF_FFF); + var tjaHash = (int) (MurmurHash2.Hash(originalTjaData) & 0xFFFF_FFF); var passed = await TJAToFumens(metadata, tjaPath, tjaHash, tempOutDirectory); if (passed >= 0) passed = CreateMusicFile(metadata, tjaHash, tempOutDirectory) ? 0 : -1; @@ -108,14 +111,16 @@ namespace TJAConvert var copyFilePath = Path.Combine(newDirectory, Path.GetFileName(originalAudioPath)); File.Copy(originalAudioPath, copyFilePath); + int millisecondsAddedSilence = metadata.Offset > TjaOffsetForPaddingSong ? PaddedSongTime : 0; + var audioExtension = Path.GetExtension(copyFilePath).TrimStart('.'); switch (audioExtension.ToLowerInvariant()) { case "wav": - if (passed >= 0) passed = WavToACB(copyFilePath, tempOutDirectory, tjaHash) ? 0 : -1; + if (passed >= 0) passed = WavToACB(copyFilePath, tempOutDirectory, tjaHash, millisecondsAddedSilence: millisecondsAddedSilence) ? 0 : -1; break; case "ogg": - if (passed >= 0) passed = OGGToACB(copyFilePath, tempOutDirectory, tjaHash) ? 0 : -1; + if (passed >= 0) passed = OGGToACB(copyFilePath, tempOutDirectory, tjaHash, millisecondsAddedSilence) ? 0 : -1; break; default: Console.WriteLine($"Do not support {audioExtension} audio files"); @@ -202,6 +207,7 @@ namespace TJAConvert { try { + var addedTime = metadata.Offset > TjaOffsetForPaddingSong ? PaddedSongTime : 0; var musicInfo = new CustomSong { id = tjaHash.ToString(), @@ -212,8 +218,8 @@ namespace TJAConvert branchHard = false, branchMania = false, branchUra = false, - previewPos = (int) (metadata.PreviewTime * 1000), - fumenOffsetPos = (int) (metadata.Offset * 10), + previewPos = (int) (metadata.PreviewTime * 1000) + addedTime, + fumenOffsetPos = (int) (metadata.Offset * 10) + (addedTime), tjaFileHash = tjaHash, songName = new TextEntry() { @@ -264,49 +270,91 @@ namespace TJAConvert foreach (var course in metadata.Courses) { + var isDouble = course.PlayStyle == TJAMetadata.PlayStyle.Double; + var shinuti = EstimateScoreBasedOnNotes(course); + //todo figure out the best score? switch (course.CourseType) { case CourseType.Easy: musicInfo.starEasy = course.Level; - musicInfo.shinutiEasy = 10170; - musicInfo.shinutiEasyDuet = 10170; - musicInfo.scoreEasy = 360090; - musicInfo.branchEasy = course.IsBranching; + musicInfo.scoreEasy = 1000000; + musicInfo.branchEasy = musicInfo.branchEasy || course.IsBranching; + if (isDouble) + musicInfo.shinutiEasyDuet = shinuti; + else + musicInfo.shinutiEasy = shinuti; break; case CourseType.Normal: musicInfo.starNormal = course.Level; - musicInfo.shinutiNormal = 6010; - musicInfo.shinutiNormalDuet = 6010; - musicInfo.scoreNormal = 650150; - musicInfo.branchNormal = course.IsBranching; + musicInfo.scoreNormal = 1000000; + musicInfo.branchNormal = musicInfo.branchNormal || course.IsBranching; + if (isDouble) + musicInfo.shinutiNormalDuet = shinuti; + else + musicInfo.shinutiNormal = shinuti; break; case CourseType.Hard: musicInfo.starHard = course.Level; - musicInfo.shinutiHard = 3010; - musicInfo.shinutiHardDuet = 3010; - musicInfo.scoreHard = 800210; - musicInfo.branchHard = course.IsBranching; + musicInfo.scoreHard = 1000000; + musicInfo.branchHard = musicInfo.branchHard || course.IsBranching; + if (isDouble) + musicInfo.shinutiHardDuet = shinuti; + else + musicInfo.shinutiHard = shinuti; break; case CourseType.Oni: musicInfo.starMania = course.Level; - musicInfo.shinutiMania = 1000; - musicInfo.shinutiManiaDuet = 1000; - musicInfo.scoreMania = 10000; - musicInfo.branchMania = course.IsBranching; + musicInfo.scoreMania = 1000000; + musicInfo.branchMania = musicInfo.branchMania || course.IsBranching; + if (isDouble) + musicInfo.shinutiManiaDuet = shinuti; + else + musicInfo.shinutiMania = shinuti; break; case CourseType.UraOni: musicInfo.starUra = course.Level; - musicInfo.shinutiUra = 1000; - musicInfo.shinutiUraDuet = 1000; - musicInfo.scoreUra = 10000; - musicInfo.branchUra = course.IsBranching; + musicInfo.scoreUra = 1000000; + musicInfo.branchUra = musicInfo.branchUra || course.IsBranching; + if (isDouble) + musicInfo.shinutiUraDuet = shinuti; + else + musicInfo.shinutiUra = shinuti; break; default: throw new ArgumentOutOfRangeException(); } } + + // make sure each course as a score + if (musicInfo.shinutiEasy == 0) + musicInfo.shinutiEasy = musicInfo.shinutiEasyDuet != 0 ? musicInfo.shinutiEasyDuet : 7352; + if (musicInfo.shinutiNormal == 0) + musicInfo.shinutiNormal = musicInfo.shinutiNormalDuet != 0 ? musicInfo.shinutiNormalDuet : 4830; + if (musicInfo.shinutiHard == 0) + musicInfo.shinutiHard = musicInfo.shinutiHardDuet != 0 ? musicInfo.shinutiHardDuet : 3144; + if (musicInfo.shinutiMania == 0) + musicInfo.shinutiMania = musicInfo.shinutiManiaDuet != 0 ? musicInfo.shinutiManiaDuet : 2169; + if (musicInfo.shinutiUra == 0) + musicInfo.shinutiUra = musicInfo.shinutiUraDuet != 0 ? musicInfo.shinutiUraDuet : 1420; + + if (musicInfo.shinutiEasyDuet == 0) + musicInfo.shinutiEasyDuet = musicInfo.shinutiEasy; + if (musicInfo.shinutiNormalDuet == 0) + musicInfo.shinutiNormalDuet = musicInfo.shinutiNormal; + if (musicInfo.shinutiHardDuet == 0) + musicInfo.shinutiHardDuet = musicInfo.shinutiHard; + if (musicInfo.shinutiManiaDuet == 0) + musicInfo.shinutiManiaDuet = musicInfo.shinutiMania; + if (musicInfo.shinutiUraDuet == 0) + musicInfo.shinutiUraDuet = musicInfo.shinutiUra; + + int EstimateScoreBasedOnNotes(TJAMetadata.Course course) + { + return Math.Max(1, 1000000 / course.EstimatedNotes); + } + var json = JsonConvert.SerializeObject(musicInfo, Formatting.Indented); File.WriteAllText($"{outputPath}/data.json", json); return true; @@ -637,7 +685,7 @@ namespace TJAConvert attempts--; // todo: Not sure how to solve this, so ignore it for now - if (result.Contains("branches must have same measure count") || result.Contains("invalid #BRANCHSTART")) + if (result.Contains("branches must have same measure count")) return -2; async Task RunProcess() @@ -816,10 +864,40 @@ namespace TJAConvert return true; } + if (result.Contains("invalid #BRANCHSTART")) + { + var currentLines = File.ReadLines(newPath).ToList(); + for (var i = 0; i < currentLines.Count; i++) + { + var line = currentLines[i]; + if (!line.StartsWith("#BRANCHSTART p,", StringComparison.InvariantCultureIgnoreCase)) + continue; + + var arguments = line.Substring("#BRANCHSTART ".Length).Split(','); + // This invalid branch start error needs to be manually resolved + if (arguments.Length != 3) + return false; + + float number1; + float number2; + if (!float.TryParse(arguments[1], out var test)) + return false; + + number1 = test; + if (!float.TryParse(arguments[2], out test)) + return false; + + number2 = test; + currentLines[i] = $"#BRANCHSTART p,{(int) Math.Ceiling(number1)},{(int) Math.Ceiling(number2)}"; + } + + File.WriteAllLines(newPath, currentLines); + return true; + } + if (result.Contains("#E must be after the #N branch") || result.Contains("#M must be after the #E branch")) { var currentLines = File.ReadLines(newPath).ToList(); - // var problematicCourse = GetCourseWithProblems(); string currentBranch = ""; int startOfBranch = -1; @@ -988,7 +1066,7 @@ namespace TJAConvert } } - private static bool OGGToACB(string oggPath, string outDirectory, int tjaHash) + private static bool OGGToACB(string oggPath, string outDirectory, int tjaHash, int millisecondsAddedSilence = 0) { try { @@ -1001,7 +1079,7 @@ namespace TJAConvert using (FileStream compressedFileStream = File.Create($"{acbPath}.acb")) decompressor.CopyTo(compressedFileStream); - var hca = OggToHca(oggPath); + var hca = OggToHca(oggPath, millisecondsAddedSilence); if (hca == null) return false; @@ -1021,7 +1099,7 @@ namespace TJAConvert } } - private static bool WavToACB(string wavPath, string outDirectory, int tjaHash, bool deleteWav = false) + private static bool WavToACB(string wavPath, string outDirectory, int tjaHash, bool deleteWav = false, int millisecondsAddedSilence = 0) { try { @@ -1034,7 +1112,7 @@ namespace TJAConvert using (FileStream compressedFileStream = File.Create($"{acbPath}.acb")) decompressor.CopyTo(compressedFileStream); - var hca = WavToHca(wavPath); + var hca = WavToHca(wavPath, millisecondsAddedSilence); File.WriteAllBytes($"{acbPath}/00000.hca", hca); Pack(acbPath); if (File.Exists($"{outDirectory}/song_{tjaHash}.bin")) @@ -1054,22 +1132,53 @@ namespace TJAConvert } } - private static byte[] WavToHca(string path) + private static byte[] WavToHca(string path, int millisecondSilence = 0) { + var wavReader = new WaveReader(); var hcaWriter = new HcaWriter(); - var waveReader = new WaveReader(); - var audioData = waveReader.Read(File.ReadAllBytes(path)); - return hcaWriter.GetFile(audioData); + + if (millisecondSilence > 0) + { + WaveFileReader reader = new WaveFileReader(path); + var memoryStream = new MemoryStream(); + + var trimmed = new OffsetSampleProvider(reader.ToSampleProvider()) + { + DelayBy = TimeSpan.FromMilliseconds(millisecondSilence) + }; + WaveFileWriter.WriteWavFileToStream(memoryStream, trimmed.ToWaveProvider16()); + + var audioData = wavReader.Read(memoryStream.ToArray()); + return hcaWriter.GetFile(audioData); + } + else + { + var audioData = wavReader.Read(File.ReadAllBytes(path)); + return hcaWriter.GetFile(audioData); + } } - private static byte[] OggToHca(string inPath) + private static byte[] OggToHca(string inPath, int millisecondSilence = 0) { try { using FileStream fileIn = new FileStream(inPath, FileMode.Open); var vorbis = new VorbisWaveReader(fileIn); + var wavProvider = new SampleToWaveProvider16(vorbis); var memoryStream = new MemoryStream(); - WaveFileWriter.WriteWavFileToStream(memoryStream, new SampleToWaveProvider16(vorbis)); + + if (millisecondSilence > 0) + { + var trimmed = new OffsetSampleProvider(wavProvider.ToSampleProvider()) + { + DelayBy = TimeSpan.FromMilliseconds(millisecondSilence) + }; + WaveFileWriter.WriteWavFileToStream(memoryStream, trimmed.ToWaveProvider16()); + } + else + { + WaveFileWriter.WriteWavFileToStream(memoryStream, wavProvider); + } var hcaWriter = new HcaWriter(); var waveReader = new WaveReader(); @@ -1138,4 +1247,4 @@ namespace TJAConvert return 3; } } -} \ No newline at end of file +} diff --git a/TakoTakoScripts/TJAConvert/References/SonicAudioLib.dll b/TJAConvert/References/SonicAudioLib.dll similarity index 100% rename from TakoTakoScripts/TJAConvert/References/SonicAudioLib.dll rename to TJAConvert/References/SonicAudioLib.dll diff --git a/TakoTakoScripts/TJAConvert/TJAConvert.csproj b/TJAConvert/TJAConvert.csproj similarity index 88% rename from TakoTakoScripts/TJAConvert/TJAConvert.csproj rename to TJAConvert/TJAConvert.csproj index b0e8ce9..4b2fc3c 100644 --- a/TakoTakoScripts/TJAConvert/TJAConvert.csproj +++ b/TJAConvert/TJAConvert.csproj @@ -39,6 +39,7 @@ - + + - \ No newline at end of file + diff --git a/TakoTakoScripts/TJAConvert/TJAMetaData.cs b/TJAConvert/TJAMetaData.cs similarity index 88% rename from TakoTakoScripts/TJAConvert/TJAMetaData.cs rename to TJAConvert/TJAMetaData.cs index 6825afc..b5d775d 100644 --- a/TakoTakoScripts/TJAConvert/TJAMetaData.cs +++ b/TJAConvert/TJAMetaData.cs @@ -160,9 +160,7 @@ internal class TJAMetadata currentCourse.SongDataIndexEnd = courseStartIndex; - if (newContent) - Courses.Add(currentCourse); - + // is this branching? for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; i++) { var line = lines[i]; @@ -173,6 +171,52 @@ internal class TJAMetadata } } + // calculate roughly the amount of song notes in this course + int noteCount = 0; + int branchNoteCount = 0; + int branches = 0; + bool inBranch = false; + for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; i++) + { + var line = lines[i].Trim(); + + if (line.Equals("#N", StringComparison.InvariantCultureIgnoreCase) + || line.Equals("#E", StringComparison.InvariantCultureIgnoreCase) + || line.Equals("#M", StringComparison.InvariantCultureIgnoreCase)) + branches++; + + var branchStart = line.StartsWith("#BRANCHSTART", StringComparison.InvariantCultureIgnoreCase); + if (inBranch && (branchStart || line.StartsWith("#BRANCHEND", StringComparison.InvariantCultureIgnoreCase))) + { + noteCount += branchNoteCount / Math.Max(1, branches); + inBranch = false; + } + + if (!inBranch && branchStart) + { + inBranch = true; + branchNoteCount = 0; + branches = 0; + } + + if (!line.EndsWith(",")) + continue; + + var notes = line.Count(x => x is '1' or '2' or '3' or '4'); + if (inBranch) + branchNoteCount += notes; + else + noteCount += notes; + } + + if (currentCourse.PlayStyle == PlayStyle.Double) + currentCourse.EstimatedNotes = noteCount / 2; + else + currentCourse.EstimatedNotes = noteCount; + + if (newContent) + Courses.Add(currentCourse); + // duplicate the existing course currentCourse = new Course(currentCourse); // find the next start @@ -241,8 +285,6 @@ internal class TJAMetadata return CourseType.UraOni; } - - } public const string TJAFieldRegexTemplate = "^{0}:\\s*(?.*?)\\s*$"; @@ -290,6 +332,8 @@ internal class TJAMetadata public int SongDataIndexStart; public int SongDataIndexEnd; + public int EstimatedNotes = 0; + public Course() { } diff --git a/TakoTakoScripts/TakoTako.Common/CustomSong.cs b/TakoTako.Common/CustomSong.cs similarity index 99% rename from TakoTakoScripts/TakoTako.Common/CustomSong.cs rename to TakoTako.Common/CustomSong.cs index 142adab..d62e3cc 100644 --- a/TakoTakoScripts/TakoTako.Common/CustomSong.cs +++ b/TakoTako.Common/CustomSong.cs @@ -203,4 +203,4 @@ namespace TakoTako.Common [JsonProperty(NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] public int krFont; } -} \ No newline at end of file +} diff --git a/TakoTakoScripts/TakoTako.Common/MurmurHash2.cs b/TakoTako.Common/MurmurHash2.cs similarity index 100% rename from TakoTakoScripts/TakoTako.Common/MurmurHash2.cs rename to TakoTako.Common/MurmurHash2.cs diff --git a/TakoTakoScripts/TakoTako.Common/TakoTako.Common.csproj b/TakoTako.Common/TakoTako.Common.csproj similarity index 85% rename from TakoTakoScripts/TakoTako.Common/TakoTako.Common.csproj rename to TakoTako.Common/TakoTako.Common.csproj index 93116fc..86b9c71 100644 --- a/TakoTakoScripts/TakoTako.Common/TakoTako.Common.csproj +++ b/TakoTako.Common/TakoTako.Common.csproj @@ -9,7 +9,7 @@ - ..\..\TakoTako\References\Newtonsoft.Json.dll + ..\TakoTako\References\Newtonsoft.Json.dll diff --git a/TakoTako.sln b/TakoTako.sln index 37b8c77..96f2f2d 100644 --- a/TakoTako.sln +++ b/TakoTako.sln @@ -1,10 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TakoTako.Common", "TakoTakoScripts\TakoTako.Common\TakoTako.Common.csproj", "{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TakoTako.Common", "TakoTako.Common\TakoTako.Common.csproj", "{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TJAConvert", "TakoTakoScripts\TJAConvert\TJAConvert.csproj", "{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TJAConvert", "TJAConvert\TJAConvert.csproj", "{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TakoTako", "TakoTako\TakoTako.csproj", "{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}" + ProjectSection(ProjectDependencies) = postProject + {9ED2476B-FB39-4BE9-8661-21311AD9A3E8} = {9ED2476B-FB39-4BE9-8661-21311AD9A3E8} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/TakoTakoScripts/TakoTakoScripts.sln.DotSettings b/TakoTako.sln.DotSettings similarity index 57% rename from TakoTakoScripts/TakoTakoScripts.sln.DotSettings rename to TakoTako.sln.DotSettings index 0b1fe32..fd2fec2 100644 --- a/TakoTakoScripts/TakoTakoScripts.sln.DotSettings +++ b/TakoTako.sln.DotSettings @@ -1,7 +1,7 @@  - ACB - OGG - TJA + True + True True True - True \ No newline at end of file + True + \ No newline at end of file diff --git a/TakoTako/MusicPatch.cs b/TakoTako/MusicPatch.cs index 255afc0..26c9850 100644 --- a/TakoTako/MusicPatch.cs +++ b/TakoTako/MusicPatch.cs @@ -192,7 +192,7 @@ public class MusicPatch { if (IsTjaConverted(musicDirectory, out var conversionStatus) && conversionStatus != null) { - foreach (var item in conversionStatus.Items.Where(item => item.Successful)) + foreach (var item in conversionStatus.Items.Where(item => item.Successful && item.Version == ConversionStatus.ConversionItem.CurrentVersion)) SubmitDirectory(Path.Combine(musicDirectory, item.FolderName), true); return; } @@ -239,14 +239,14 @@ public class MusicPatch if (!match.Success) continue; - var resultInt = int.Parse(match.Groups["ID"].Value); + var resultCode = int.Parse(match.Groups["ID"].Value); var folderPath = match.Groups["PATH"].Value; folderPath = Path.GetFullPath(folderPath).Replace(Path.GetFullPath(musicDirectory), "."); var existingEntry = conversionStatus.Items.FirstOrDefault(x => x.FolderName == folderPath); var asciiFolderPath = Regex.Replace(folderPath, @"[^\u0000-\u007F]+", string.Empty); - if (resultInt >= 0) + if (resultCode >= 0) Log.LogInfo($"Converted {asciiFolderPath} successfully"); else Log.LogError($"Could not convert {asciiFolderPath}"); @@ -257,13 +257,17 @@ public class MusicPatch { Attempts = 1, FolderName = folderPath, - Successful = resultInt >= 0, + Successful = resultCode >= 0, + ResultCode = resultCode, + Version = ConversionStatus.ConversionItem.CurrentVersion, }); } else { existingEntry.Attempts++; - existingEntry.Successful = resultInt >= 0; + existingEntry.Successful = resultCode >= 0; + existingEntry.ResultCode = resultCode; + existingEntry.Version = ConversionStatus.ConversionItem.CurrentVersion; } } @@ -422,7 +426,7 @@ public class MusicPatch if (conversionStatus == null) return false; - return conversionStatus.Items.Count != 0 && conversionStatus.Items.All(x => x.Successful); + return conversionStatus.Items.Count != 0 && conversionStatus.Items.All(x => x.Successful && x.Version == ConversionStatus.ConversionItem.CurrentVersion); } catch { @@ -625,7 +629,7 @@ public class MusicPatch void Add(string key, TextEntry textEntry) { - var (text, font) = GetValuesTextEntry(textEntry); + var (text, font) = GetValuesTextEntry(textEntry, languageValue); musicInfoAccessors.Add(new WordDataInterface.WordListInfoAccesser(key, text, font)); } } @@ -684,11 +688,11 @@ public class MusicPatch return (text, font); } - (string text, int font) GetValuesTextEntry(TextEntry textEntry) + (string text, int font) GetValuesTextEntry(TextEntry textEntry, string selectedLanguage) { string text; int font; - switch (languageValue) + switch (selectedLanguage) { case "Japanese": text = textEntry.jpText; @@ -735,7 +739,31 @@ public class MusicPatch break; } - if (!string.IsNullOrEmpty(text)) return (text, font); + // if this text is default, and we're not English / Japanese default to one of them + if (string.IsNullOrEmpty(text) && selectedLanguage != "Japanese" && selectedLanguage != "English") + { + string fallbackLanguage; + switch (selectedLanguage) + { + case "Chinese": + case "ChineseT": + case "ChineseTraditional": + case "ChineseSimplified": + case "ChineseS": + case "Korean": + fallbackLanguage = "Japanese"; + break; + default: + fallbackLanguage = "English"; + break; + } + + return GetValuesTextEntry(textEntry, fallbackLanguage); + } + + if (!string.IsNullOrEmpty(text)) + return (text, font); + text = textEntry.text; font = textEntry.font; @@ -1881,13 +1909,14 @@ public class MusicPatch public class ConversionItem { - [JsonIgnore] public const int CurrentVersion = 1; + [JsonIgnore] public const int CurrentVersion = 2; [JsonIgnore] public const int MaxAttempts = 3; [JsonProperty("f")] public string FolderName; [JsonProperty("a")] public int Attempts; [JsonProperty("s")] public bool Successful; - [JsonProperty("v")] public int Version = CurrentVersion; + [JsonProperty("v")] public int Version; + [JsonProperty("e")] public int ResultCode; public override string ToString() { @@ -1902,4 +1931,4 @@ public class MusicPatch public string SongName; public int UniqueId; } -} \ No newline at end of file +} diff --git a/TakoTako/TakoTako.csproj b/TakoTako/TakoTako.csproj index 9457ba4..9c8f67c 100644 --- a/TakoTako/TakoTako.csproj +++ b/TakoTako/TakoTako.csproj @@ -4,12 +4,12 @@ net48 com.fluto.takotako Fixes Taiko issues and allows custom songs - 2.0.0 + 2.1.0 true latest TakoTako com.fluto.takotako - 2.0.0 + 2.1.0 @@ -55,7 +55,7 @@ - + @@ -63,4 +63,4 @@ - \ No newline at end of file + diff --git a/TakoTakoScripts/.gitignore b/TakoTakoScripts/.gitignore deleted file mode 100644 index 9d3e8b0..0000000 --- a/TakoTakoScripts/.gitignore +++ /dev/null @@ -1,35 +0,0 @@ -# Common IntelliJ Platform excludes - -# User specific -**/.idea/**/workspace.xml -**/.idea/**/tasks.xml -**/.idea/shelf/* -**/.idea/dictionaries -**/.idea/httpRequests/ - -# Sensitive or high-churn files -**/.idea/**/dataSources/ -**/.idea/**/dataSources.ids -**/.idea/**/dataSources.xml -**/.idea/**/dataSources.local.xml -**/.idea/**/sqlDataSources.xml -**/.idea/**/dynamic.xml - -# Rider -# Rider auto-generates .iml files, and contentModel.xml -**/.idea/**/*.iml -**/.idea/**/contentModel.xml -**/.idea/**/modules.xml - -*.suo -*.user -.vs/ -[Bb]in/ -[Oo]bj/ -_UpgradeReport_Files/ -[Pp]ackages/ - -Thumbs.db -Desktop.ini -.DS_Store -ShortcutFolder.lnk diff --git a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/.gitignore b/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/.gitignore deleted file mode 100644 index bd4c181..0000000 --- a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/modules.xml -/.idea.TakoTakoScripts.iml -/projectSettingsUpdater.xml -/contentModel.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/encodings.xml b/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/indexLayout.xml b/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/vcs.xml b/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/TakoTakoScripts/.idea/.idea.TakoTakoScripts/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/TakoTakoScripts/TJAConvert/FodyWeavers.xsd b/TakoTakoScripts/TJAConvert/FodyWeavers.xsd deleted file mode 100644 index 05e92c1..0000000 --- a/TakoTakoScripts/TJAConvert/FodyWeavers.xsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - - - A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with line breaks. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with line breaks. - - - - - The order of preloaded assemblies, delimited with line breaks. - - - - - - This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. - - - - - Controls if .pdbs for reference assemblies are also embedded. - - - - - Controls if runtime assemblies are also embedded. - - - - - Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. - - - - - Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. - - - - - As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. - - - - - Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. - - - - - Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - - - A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with |. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with |. - - - - - The order of preloaded assemblies, delimited with |. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/TakoTakoScripts/TakoTakoScripts.Common/TakoTakoScripts.Common.csproj b/TakoTakoScripts/TakoTakoScripts.Common/TakoTakoScripts.Common.csproj deleted file mode 100644 index 93116fc..0000000 --- a/TakoTakoScripts/TakoTakoScripts.Common/TakoTakoScripts.Common.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net48 - TakoTako.Common - TakoTako.Common - latest - - - - - ..\..\TakoTako\References\Newtonsoft.Json.dll - - - - diff --git a/TakoTakoScripts/global.json b/TakoTakoScripts/global.json deleted file mode 100644 index e5674e1..0000000 --- a/TakoTakoScripts/global.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sdk": { - "version": "5.0.0", - "rollForward": "latestMinor", - "allowPrerelease": false - } -} \ No newline at end of file