I noticed when running FModBankParser.Demo to extract audio from the game UNBEATABLE, file Master.bank the tool reported exporting 126 audio files but only 54 were found in ExportedAudio/Master.bank. I traced this issue to
|
if (!overwrite && filePath.Exists) |
|
continue; |
|
|
|
File.WriteAllBytes(filePath.FullName, dataBytes); |
|
exportedFiles++; |
In
FModBankParser.Demo overwrite is set to the default value of
true, so when a track comes up that has the same name as a previous track, it overwrites it even if they were different. (when overwrite is set to false, it counts correctly but also fails to output the files)
Some of the duplicate names are in fact duplicate audio files (same content), I assume this is the reason that overwrite was set in the first place. But this isn't always the case, and that leads to missing audio files.
I fixed this by replacing
|
if (!overwrite && filePath.Exists) |
|
continue; |
with
int extraNumber = 1;
while (filePath.Exists)
{
filePath = new(Path.Combine(bankFolder.FullName, $"{sampleName}_({extraNumber}).{fileExtension}"));
extraNumber++;
}
which exports duplicates with a _(NUMBER) appended to the file name. This needs some more work, it ignores the overwrite config option (so if you run the tool more than once it would create duplicates for EVERYTHING) and probably needs some further changes. But if anyone having the same issue needs a quick fix, here it is.
- FModBankParser revision b7cfcfc
- Platform: NixOS with packages
mono msbuild dotnet-sdk_10
- Game: UNBEATABLE, bank
steamapps/common/UNBEATABLE/UNBEATABLE_Data/StreamingAssets/Master.bank
I noticed when running
FModBankParser.Demoto extract audio from the game UNBEATABLE, fileMaster.bankthe tool reported exporting 126 audio files but only 54 were found inExportedAudio/Master.bank. I traced this issue toFModBankParser/FModBankParser/FModBankParser.cs
Lines 134 to 138 in b7cfcfc
FModBankParser.Demooverwriteis set to the default value oftrue, so when a track comes up that has the same name as a previous track, it overwrites it even if they were different. (when overwrite is set to false, it counts correctly but also fails to output the files)Some of the duplicate names are in fact duplicate audio files (same content), I assume this is the reason that
overwritewas set in the first place. But this isn't always the case, and that leads to missing audio files.I fixed this by replacing
FModBankParser/FModBankParser/FModBankParser.cs
Lines 134 to 135 in b7cfcfc
which exports duplicates with a
_(NUMBER)appended to the file name. This needs some more work, it ignores theoverwriteconfig option (so if you run the tool more than once it would create duplicates for EVERYTHING) and probably needs some further changes. But if anyone having the same issue needs a quick fix, here it is.mono msbuild dotnet-sdk_10steamapps/common/UNBEATABLE/UNBEATABLE_Data/StreamingAssets/Master.bank