TakoTako
TakoTako copied to clipboard
Converted folder is not generated.
I created a music folder in the custom songs folder and installed .tja and .ogg, but the converted folder is not generated in the same directory. The conversion.json is generated. The log generated by BepInEx is as follows
[Message: BepInEx] BepInEx 5.4.19.0 - Taiko no Tatsujin (2022/02/08 5:39:47)
[Info : BepInEx] Running under Unity v2020.3.19.6877495
[Info : BepInEx] CLR runtime version: 4.0.30319.42000
[Info : BepInEx] Supports SRE: True
[Info : BepInEx] System platform: Bits64, Windows
[Message: BepInEx] Preloader started
[Info : BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.19.0]
[Info : BepInEx] 1 patcher plugin loaded
[Info : BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Message: BepInEx] Preloader finished
[Message: BepInEx] Chainloader ready
[Message: BepInEx] Chainloader started
[Info : BepInEx] 2 plugins to load
[Info : BepInEx] Loading [com.fluto.takotako 2.1.0]
[Info :com.fluto.takotako] Plugin com.fluto.takotako is loaded!
[Info : BepInEx] Loading [TaikoModStuff 1.2.1]
[Info :TaikoModStuff] Plugin TaikoModStuff is loaded!
[Message: BepInEx] Chainloader startup complete
[Info :com.fluto.takotako] Injecting custom songs
[Info :com.fluto.takotako] Converting Courage(太鼓用)
[Error :com.fluto.takotako] Could not convert .\Courage(... [GENERATED]
[Info :com.fluto.takotako] No tracks found
[Info :com.fluto.takotako] Injecting custom song preview data
[Info :com.fluto.takotako] Injecting custom songs
[Info :com.fluto.takotako] Injecting custom song preview data
[Info :com.fluto.takotako] Patching sign in to force the user to be prompted to sign in
I'm not sure if this is due to the inclusion of Japanese? Or is it a misconfiguration of permissions?
I also have this issue. Tried converting Diggy Diggy Hole (which does not have Japanese writing) and it still failed to convert.
Update - I managed to fix it by uninstalling TDM and re-installing it, then re-following the steps.
I also reinstalled TDM and installed BepInEx (5.4.19.0), [TaikoModStuff 1.2.1] and [com.fluto.takotako 2.2.0] as per the instructions, but it did not solve the problem. The version of TakoTako is 2.1.0 in the log, but it is actually 2.2.0. I've thought of other possible causes, but I'm not sure if it's because the drive where the custom song is located is a different drive than TDM. However, installing the custom song from Config to the same drive as TDM did not change the result. I have no idea what is causing this, as the conversion.json seems to be generated and I have permission to create it... I have TDM installed on drive D, and from what I've seen from others who have installed it, it doesn't seem to be a problem.
Definitely very strange. I suppose one other thing I did before re-installing TDM and TakoTako was tell my anti-virus to ignore the BepInEx location. After that, I re-installed everything.
Not sure if that helped or not.
The security software was a blind spot. I tried temporarily disabling Security, such as Windows Security's Real Time Protection, but the result was the same. I tried deleting all but English from .tja, but that didn't change anything. The encoding of the .tja is UTF-8, right?
Note: The .Tja download I'm trying is made by a Japanese person, so there may be some differences from the overseas .Tja.
There was a setting in BepInEx's Config to output detailed log information. In order to output all the information, I set the channel to ALL and quit the game when it reached the title screen to output the log. Normally, the conversion would be done before the title screen, so there should be no problem. I looked at the logs myself, but could not find the cause. Probably because it only has the detailed information of BepInEx and leaves out the detailed log inside TakoTako.
[Message: BepInEx] BepInEx 5.4.19.0 - Taiko no Tatsujin (2022/02/15 3:06:28)
[Info : BepInEx] Running under Unity v2020.3.19.6877495
[Info : BepInEx] CLR runtime version: 4.0.30319.42000
[Info : BepInEx] Supports SRE: True
[Info : BepInEx] System platform: Bits64, Windows
[Message: BepInEx] Preloader started
[Info : BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.19.0]
[Info : BepInEx] 1 patcher plugin loaded
[Info : BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Message: BepInEx] Preloader finished
[Message: BepInEx] Chainloader ready
[Message: BepInEx] Chainloader started
[Info : BepInEx] 2 plugins to load
[Info : BepInEx] Loading [com.fluto.takotako 2.1.0]
[Info :com.fluto.takotako] Plugin com.fluto.takotako is loaded!
[Info : HarmonyX] ### Harmony id=com.fluto.takotako, version=2.9.0.0, location=C:\Program Files\WindowsApps\NAMCOBANDAIGamesInc.TTablet_1.2.2.0_x64__gdy2aq6ez762w\BepInEx\core\0Harmony.dll, env/clr=4.0.30319.42000, platform=Win32NT, ptrsize:runtime/env=8/Bits64, Windows
### Started from void TakoTako.Plugin::SetupHarmony(), location C:\Program Files\WindowsApps\NAMCOBANDAIGamesInc.TTablet_1.2.2.0_x64__gdy2aq6ez762w\BepInEx\plugins\com.fluto.takotako\com.fluto.takotako.dll
### At 2022-02-15 09.33.34
[Info : HarmonyX] Patching void BootManager::Start() with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.SkipSplashScreen::BootManager_Postfix(BootManager __instance)
[Info : HarmonyX] Running ILHook manipulator on void BootManager::Start()
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void Microsoft.Xbox.GdkHelpers::SignIn() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.SignInPatch::Prefix(Microsoft.Xbox.GdkHelpers __instance)
[Info : HarmonyX] Running ILHook manipulator on void Microsoft.Xbox.GdkHelpers::SignIn()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching float ControllerManager::GetAxis(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Axes axis) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.TaikoDrumSupport::GetAxis_Postfix(ControllerManager __instance, Single& __result, ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Axes axis)
[Info : HarmonyX] Running ILHook manipulator on float ControllerManager::GetAxis(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Axes axis)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching bool ControllerManager::GetButtonDown(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.TaikoDrumSupport::GetButtonDown_Postfix(ControllerManager __instance, Boolean& __result, ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Running ILHook manipulator on bool ControllerManager::GetButtonDown(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching bool ControllerManager::GetButton(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.TaikoDrumSupport::GetButton_Postfix(ControllerManager __instance, Boolean& __result, ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Running ILHook manipulator on bool ControllerManager::GetButton(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching bool ControllerManager::GetButtonUp(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.TaikoDrumSupport::GetButtonUp_Postfix(ControllerManager __instance, Boolean& __result, ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Running ILHook manipulator on bool ControllerManager::GetButtonUp(ControllerManager+ControllerPlayerNo controllerPlayerNo, ControllerManager+Buttons btn)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void MusicDataInterface::.ctor(string path) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.MusicPatch::MusicDataInterface_Postfix(MusicDataInterface __instance, string path)
[Info : HarmonyX] Running ILHook manipulator on void MusicDataInterface::.ctor(string path)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void SongDataInterface::.ctor(string path) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.MusicPatch::SongDataInterface_Postfix(SongDataInterface __instance, string path)
[Info : HarmonyX] Running ILHook manipulator on void SongDataInterface::.ctor(string path)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void WordDataInterface::.ctor(string path, string language) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.MusicPatch::WordDataInterface_Postfix(WordDataInterface __instance, string path, string language)
[Info : HarmonyX] Running ILHook manipulator on void WordDataInterface::.ctor(string path, string language)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void SongSelectManager::LoadSongList() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::LoadSongList_Prefix(SongSelectManager __instance)
[Info : HarmonyX] Running ILHook manipulator on void SongSelectManager::LoadSongList()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void SongSelectManager::SaveFavotiteSongs() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::SaveFavotiteSongs_Prefix(SongSelectManager __instance)
[Info : HarmonyX] Running ILHook manipulator on void SongSelectManager::SaveFavotiteSongs()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void CourseSelect::EnsoConfigSubmit() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::EnsoConfigSubmit_Prefix(CourseSelect __instance)
[Info : HarmonyX] Running ILHook manipulator on void CourseSelect::EnsoConfigSubmit()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void KpiListCommon+MusicKpiInfo::GetEnsoSettings() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::GetEnsoSettings_Prefix(KpiListCommon+MusicKpiInfo __instance)
[Info : HarmonyX] Running ILHook manipulator on void KpiListCommon+MusicKpiInfo::GetEnsoSettings()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void PlayDataManager::GetPlayerRecordInfo(int playerId, int uniqueId, EnsoData+EnsoLevelType levelType, EnsoRecordInfo& dst) with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::GetPlayerRecordInfo_Prefix(int playerId, int uniqueId, EnsoData+EnsoLevelType levelType, EnsoRecordInfo& dst, PlayDataManager __instance)
[Info : HarmonyX] Running ILHook manipulator on void PlayDataManager::GetPlayerRecordInfo(int playerId, int uniqueId, EnsoData+EnsoLevelType levelType, EnsoRecordInfo& dst)
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void PlayDataManager::UpdatePlayerScoreRecordInfo(int playerId, int charaIndex, int uniqueId, EnsoData+EnsoLevelType levelType, bool isSinuchi, DataConst+SpecialTypes spTypes, HiScoreRecordInfo record, DataConst+ResultType resultType, bool savemode, DataConst+CrownType crownType) with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::UpdatePlayerScoreRecordInfo(PlayDataManager __instance, int playerId, int charaIndex, int uniqueId, EnsoData+EnsoLevelType levelType, bool isSinuchi, DataConst+SpecialTypes spTypes, HiScoreRecordInfo record, DataConst+ResultType resultType, bool savemode, DataConst+CrownType crownType)
[Info : HarmonyX] Running ILHook manipulator on void PlayDataManager::UpdatePlayerScoreRecordInfo(int playerId, int charaIndex, int uniqueId, EnsoData+EnsoLevelType levelType, bool isSinuchi, DataConst+SpecialTypes spTypes, HiScoreRecordInfo record, DataConst+ResultType resultType, bool savemode, DataConst+CrownType crownType)
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching System.Collections.IEnumerator SongSelectManager::Start() with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.MusicPatch::Start_Postfix(SongSelectManager __instance)
[Info : HarmonyX] Running ILHook manipulator on System.Collections.IEnumerator SongSelectManager::Start()
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching bool EnsoMode::IsValid() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::IsValid_Prefix(Boolean& __result, EnsoMode __instance)
[Info : HarmonyX] Running ILHook manipulator on bool EnsoMode::IsValid()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching Void* FumenLoader::GetFumenData(int player) with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::GetFumenData_Prefix(int player, Void*& __result, FumenLoader __instance)
[Info : HarmonyX] Running ILHook manipulator on Void* FumenLoader::GetFumenData(int player)
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching System.Collections.IEnumerator CriPlayer::LoadAsync() with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TakoTako.MusicPatch::LoadAsync_Postfix(CriPlayer __instance)
[Info : HarmonyX] Running ILHook manipulator on System.Collections.IEnumerator CriPlayer::LoadAsync()
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching bool CriPlayer::Load() with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::Load_Prefix(Boolean& __result, CriPlayer __instance)
[Info : HarmonyX] Running ILHook manipulator on bool CriPlayer::Load()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching bool FumenLoader+PlayerData::Read(string filePath) with 1 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
1 prefixes:
* static bool TakoTako.MusicPatch::Read_Prefix(string filePath, Boolean& __result, object __instance)
[Info : HarmonyX] Running ILHook manipulator on bool FumenLoader+PlayerData::Read(string filePath)
[Info : HarmonyX] Writing prefixes
[Info : BepInEx] Loading [TaikoModStuff 1.2.1]
[Info : HarmonyX] ### Harmony id=TaikoModStuff, version=2.9.0.0, location=C:\Program Files\WindowsApps\NAMCOBANDAIGamesInc.TTablet_1.2.2.0_x64__gdy2aq6ez762w\BepInEx\core\0Harmony.dll, env/clr=4.0.30319.42000, platform=Win32NT, ptrsize:runtime/env=8/Bits64, Windows
### Started from void TaikoModStuff.Plugin::Awake(), location C:\Program Files\WindowsApps\NAMCOBANDAIGamesInc.TTablet_1.2.2.0_x64__gdy2aq6ez762w\BepInEx\plugins\TaikoModStuff.dll
### At 2022-02-15 09.33.34
[Info : HarmonyX] Patching int WordDataManager::GetFontType(string key) with 0 prefixes, 1 postfixes, 0 transpilers, 0 finalizers
1 postfixes:
* static void TaikoModStuff.FontChanger::GetFontType_Patched(Int32& __result)
[Info : HarmonyX] Running ILHook manipulator on int WordDataManager::GetFontType(string key)
[Info : HarmonyX] Writing postfixes
[Info : HarmonyX] Patching void FocusManager::OnApplicationFocus(bool focusStatus) with 2 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
2 prefixes:
* static bool TaikoModStuff.CustomResolution::PrefixFocus()
* static void TaikoModStuff.CustomResolution::setCustomFocus(bool focusStatus)
[Info : HarmonyX] Running ILHook manipulator on void FocusManager::OnApplicationFocus(bool focusStatus)
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void FocusManager::SetScreenType(int type) with 2 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
2 prefixes:
* static bool TaikoModStuff.CustomResolution::PrefixScreenType()
* static void TaikoModStuff.CustomResolution::setCustomResolution(int type)
[Info : HarmonyX] Running ILHook manipulator on void FocusManager::SetScreenType(int type)
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void ForceRenderRate::Start() with 2 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
2 prefixes:
* static bool TaikoModStuff.ForceFramerate::PrefixFocus()
* static void TaikoModStuff.ForceFramerate::customStart()
[Info : HarmonyX] Running ILHook manipulator on void ForceRenderRate::Start()
[Info : HarmonyX] Writing prefixes
[Info : HarmonyX] Patching void ForceRenderRate::Update() with 2 prefixes, 0 postfixes, 0 transpilers, 0 finalizers
2 prefixes:
* static bool TaikoModStuff.ForceFramerate::PrefixScreenType()
* static void TaikoModStuff.ForceFramerate::customUpdate()
[Info : HarmonyX] Running ILHook manipulator on void ForceRenderRate::Update()
[Info : HarmonyX] Writing prefixes
[Info :TaikoModStuff] Plugin TaikoModStuff is loaded!
[Message: BepInEx] Chainloader startup complete
[Info :com.fluto.takotako] Injecting custom songs
[Info :com.fluto.takotako] Converting IGNITE
[Error :com.fluto.takotako] Could not convert .\IGNITE [GENERATED]
[Info :com.fluto.takotako] No tracks found
[Info :com.fluto.takotako] Injecting custom song preview data
[Info :com.fluto.takotako] Injecting custom songs
[Info :com.fluto.takotako] Injecting custom song preview data
[Info :com.fluto.takotako] Patching sign in to force the user to be prompted to sign in
I don't think it's related, but it belongs to the Dev channel of the Windows 11 insider program.
Hey! I've had the same issue, and I've found that it has all to do with the generation of the Bin file itself, something in the TJA document may be incorrectly formatted, and it could be as small as misplacing a "," in the file or the amount of measures for each difficulty not being consistent.
My conversation technique uses an already existing tja2bin.exe that someone else made. Unfortunately it isn't perfect as the specifications of the TJA format isn't very strict so it fails a lot.
My solution tries it's best to convert any TJA file into one that .exe can read. It's very messy, I tested it against 1000+ different TJAs but some will fall through the cracks.
If a new conversion technique is released I can update my tool to leverage that, until then we're stuck with this existing method to make files compatible with the existing tja2bin.exe.
Leaving this open until a better solution is made
I took a look at this and I think I see why it doesn't work that well. Part of the problem is that some TJA's are Shift-JIS encoded which causes the converter to fail when looking for the song OGG in the WAVE field because the path doesn't match (seems like it defaults to whatever .net prefers - UTF-8). Part of the problem is that the user needs to retain the same codepage when extracting a zip with a TJA. The other part of the problem is that the encoding has to be determined and then the file needs to be opened with that encoding. I would PR this, but the test that I used where it works uses this https://github.com/khalidsalomao/SimpleHelpers.Net/blob/master/docs/fileencoding.md and may cause an issue with the licensing that I feel wouldn't be appropriate for me to determine.
Does this mean that if the .tja file is not garbled when opened in UTF-8, it will work?

Right. Here's the SHIFT-JIS encoded one I was able to convert.
I have tried two others though it fails due to not having made any fumens and I'm curious as to where that's failing. Prior to that however all three were failing due to the file encoding issue I mentioned.

Hmm, now that I have the motivation, I will test things once I install BepinEX 6 BE on the latest TDM. By the way, does TakoTako work with Bepin EX 6 BE? If it requires a build, that's a bit of a hassle... 😅
Yes it does, I posted a working DLL in the PR regarding fixing it. You'll have to use that one, or build it yourself from the PR. Edit: PR #18
You are the best! Thanks, I wasn't too familiar with your builds, so that helps!
I've not posted my modified tjaconvert yet. Though if you want to get it working, pull in simplehelpers.encoding that I linked earlier, and modify a line in TJAMetaData.cs to be
var encoding = FileEncoding.DetectFileEncoding(tjaPath);
var lines = File.ReadLines(tjaPath, encoding).ToList();
edit: The TJA's I've been using are from https://taikosanjiro-humenroom.net
Slightly off topic, but I was worried about whether my folder structure etc. was correct to begin with😅.
If you don't mind, I'd appreciate it if you could take a look to see if there's a problem, so we can make progress!

Here's the folder structure I'm using. I actually think the readme is a little misleading, you don't need to rename the ogg because it actually grab's the ogg's name from the TJA WAVE field.
EX: WAVE:HIBANA(太鼓用).ogg

Thank you! This is the information I wanted, this gives me peace of mind. I was wondering about adding song_ to the name to refer to the WAVE field.
I'm using Deepl translation, so don't mind if the language gets weird 😅.
No worries, the translation are solid. 👍 So looking further into this, ApplyGeneralFixes() is actually mangling the metadata that TJA2BIN uses. What this means is that there's a fix that is running when in reality it probably shouldn't.
Going to do an experiment. Going to compare a fixed TJA to the original.
That's good to hear!
And the conversion worked!
Thanks to you ❤️
Now i can play the songs i want to play!

Here's a "fixed" TJA. Looks to me like an encoding problem again.
Narrowed down further to an issue with balloons.

if (x.Trim().EndsWith(","))
x = Regex.Replace(x, "[^\\d,ABF]", "");
Looks like the issue is with this line
I used this procedure to fix tja.
Converting the TJA to the right encoding will definitely fix it. Though I'd like to improve this to where you can put a TJA of any encoding in that way it's easier to work with.
https://github.com/Fluto/TakoTako/issues/9#issuecomment-1372958859 Feel free to make PRs, if it has to do with me allowing other licensed libraries I don't mind at all.
If their license requires credit, feel free to edit the README.md and include it at the bottom. If their license requires ownership or payment, then best not to include it :P
It would certainly be easier and helpful if the plugin could solve the encoding problem, but I'm more of an end user and not likely to be able to help you... 😿
@Fluto I'll work on putting a PR together then. As for that regex. Could you explain to me what it's removing? Because it looks like it's mangling the BALLOON metadata EX: BALLOON:6,6,6,6, Becomes: BA6,6,6,6,
Which line are we talking about?
Under Apply GeneralFixes() Line 750ish in Program.cs My lines might not be accurate to yours as I've added a few writelines to try to track down the issue.
List<string> ApplyGeneralFixes(List<string> lines)
{
var noScoreInitRegex = new Regex("SCOREINIT:\\s*$", RegexOptions.CultureInvariant);
var noScoreDiffRegex = new Regex("SCOREDIFF:\\s*$", RegexOptions.CultureInvariant);
lines = lines
// get rid of comments
.Select(x =>
{
x = x.Trim();
var commentIndex = x.IndexOf("//", StringComparison.Ordinal);
if (commentIndex >= 0)
x = x.Substring(0, commentIndex);
// remove unwanted characters in tracks
if (x.Trim().EndsWith(","))
x = Regex.Replace(x, "[^\\d,ABF]", "");
// if there's no scores, give them an arbitrary score
if (noScoreInitRegex.IsMatch(x))
return "SCOREINIT:440";
if (noScoreDiffRegex.IsMatch(x))
return "SCOREDIFF:113";
// I saw a few typos in a bunch of tjas, so I added a fix for it here, lol
return x.Replace("##", "#").Replace("#SCROOL", "#SCROLL").Replace("#SCROLLL", "#SCROLL").Replace("#SRCOLL", "#SCROLL").Replace("#MEAUSRE", "#MEASURE").Trim();
})
// remove lyrics, sections and delays as they are not supported by tja2bin
.Where(x => !(
x.StartsWith("#LYRIC", StringComparison.InvariantCultureIgnoreCase)
|| x.StartsWith("#DELAY", StringComparison.InvariantCultureIgnoreCase)
|| x.StartsWith("#MAKER", StringComparison.InvariantCultureIgnoreCase)
|| x.StartsWith("#SECTION", StringComparison.InvariantCultureIgnoreCase)))
.ToList();
return lines;
}
Edit: for clarification it's under the remove unwanted characters in tracks comment.
I wish I commented in code the TJAs that had these issues so I could refer to them.
I assume you're referring to x = Regex.Replace(x, "[^\\d,ABF]", "");
So from memory, some measures would have letters in them A,B,F according to the TJA documentation (which the repo is now down, visit here for a snapshot). The TJA2Bin exe that im using doesn't support these. To detect what are measures, I simply looked at what ends with a ,, because that is the correct format.
But some people don't write TJAs according to the specs, so in this case the person who made that particular BALLOON tag ended with a ,, which is not specified as necessary in the TJA documentation.
So what you could do is say if the line doesn't begin with BALLOON or perhaps if it begins with a number, then you could remove unwanted characters.
Gotcha. That actually makes a lot more sense now.
I think what might actually be better is to not regex.replace anything that would be considered a field/metadata line. Instead let's regex replace anything that doesn't contain a : character