Skip to content

Commit 22ae198

Browse files
Wave Bank Bug Fixes
* Wave Banks can now extract to paths with spaces in them. * Renamed track list and track list file.
1 parent 40030f2 commit 22ae198

File tree

3 files changed

+50
-50
lines changed

3 files changed

+50
-50
lines changed

TConvert/Extract/Ffmpeg.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
using TConvert.Util;
3434

3535
namespace TConvert.Extract {
36-
public static class Ffmpeg {
36+
public static class FFmpeg {
3737
private static readonly string cmd = Path.Combine(
3838
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
3939
"ffmpeg.exe"
4040
);
4141

42-
static Ffmpeg() {
42+
static FFmpeg() {
4343
cmd = EmbeddedApps.ExtractEmbeddedExe("ffmpeg.exe", Resources.ffmpeg);
4444
}
4545

@@ -62,13 +62,13 @@ public static void Convert(string input, string output) {
6262
List<string> command = new List<string>();
6363
string arguments =
6464
"-i" + " " +
65-
Path.GetFullPath(input) + " " +
65+
"\"" + Path.GetFullPath(input) + "\" " +
6666
"-acodec" + " " +
6767
"pcm_s16le" + " " +
6868
"-nostdin" + " " +
6969
"-ab" + " " +
7070
"128k" + " " +
71-
Path.GetFullPath(output);
71+
"\"" + Path.GetFullPath(output) + "\"";
7272

7373
ProcessStartInfo start = new ProcessStartInfo();
7474
start.FileName = cmd;

TConvert/Extract/XactExtractor.cs

+45-45
Original file line numberDiff line numberDiff line change
@@ -53,51 +53,51 @@ public static class XactExtractor {
5353
Label_RIFF.Length + 4 + Label_WAVE.Length + Label_fmt.Length +
5454
4 + 2 + 2 + 4 + 4 + 2 + 2 + Label_data.Length + 4;
5555

56-
private const string WaveBankList = "WaveBank.txt";
56+
private const string WaveBankList = "TrackList.txt";
5757

5858
/** Mapping of music wave bank indexes to their names */
5959
private static string[] TrackNames = {
60-
"01_OverworldNight",
61-
"02_Eerie",
62-
"03_OverworldDay",
63-
"04_Boss1",
64-
"05_TitleScreen",
65-
"06_Jungle",
66-
"07_Corruption",
67-
"08_Hallow",
68-
"09_UndergroundCorruption",
69-
"10_UndergroundHallow",
70-
"11_Boss2",
71-
"12_Underground",
72-
"13_Boss3",
73-
"14_Snow",
74-
"15_Space",
75-
"16_Crimson",
76-
"17_Golem",
77-
"18_AlternateDay",
78-
"19_Rain",
79-
"20_UndergroundSnow",
80-
"21_Desert",
81-
"22_Ocean",
82-
"23_Dungeon",
83-
"24_Plantera",
84-
"25_QueenBee",
85-
"26_Lizhard",
86-
"27_Eclipse",
87-
"28_RainAmbience",
88-
"29_Mushrooms",
89-
"30_PumpkinMoon",
90-
"31_AlternateUnderground",
91-
"32_FrostMoon",
92-
"33_UndergroundCrimson",
93-
"34_LunarBoss",
94-
"35_PirateInvasion",
95-
"36_Underworld",
96-
"37_MartianMadness",
97-
"38_MoonLord",
98-
"39_GoblinArmy",
99-
"40_Sandstorm",
100-
"41_OldOnesArmy"
60+
"01 Overworld Night",
61+
"02 Eerie",
62+
"03 Overworld Day",
63+
"04 Boss 1",
64+
"05 Title Screen",
65+
"06 Jungle",
66+
"07 Corruption",
67+
"08 Hallow",
68+
"09 Underground Corruption",
69+
"10 Underground Hallow",
70+
"11 Boss 2",
71+
"12 Underground",
72+
"13 Boss 3",
73+
"14 Snow",
74+
"15 Space",
75+
"16 Crimson",
76+
"17 Boss 4",
77+
"18 Alt Overworld Day",
78+
"19 Rain",
79+
"20 Underground Snow",
80+
"21 Desert",
81+
"22 Ocean",
82+
"23 Dungeon",
83+
"24 Plantera",
84+
"25 Boss 5",
85+
"26 Temple",
86+
"27 Eclipse",
87+
"28 Rain Ambience",
88+
"29 Mushrooms",
89+
"30 Pumpkin Moon",
90+
"31 Alt Underground",
91+
"32 Frost Moon",
92+
"33 Underground Crimson",
93+
"34 Lunar Event",
94+
"35 Pirate Invasion",
95+
"36 Hell",
96+
"37 Martian Madness",
97+
"38 Moon Lord",
98+
"39 Goblin Invasion",
99+
"40 Sandstorm",
100+
"41 Old One's Army"
101101
};
102102

103103
static XactExtractor() {
@@ -212,7 +212,7 @@ public static bool Extract(string inputFile, string outputDirectory) {
212212
// Skip terraria's wave bank's name. "Wave Bank".
213213
reader.BaseStream.Position += 64;
214214

215-
int EntryMetaDataElementSize = reader.ReadInt32();
215+
int EntryMetaDataElementSize = reader.ReadInt32();
216216
reader.ReadInt32(); // EntryNameElementSize
217217
reader.ReadInt32(); // Alignment
218218
wavebank_offset = segmentOffsets[1];
@@ -223,7 +223,7 @@ public static bool Extract(string inputFile, string outputDirectory) {
223223

224224
int playregion_offset = segmentOffsets[4];
225225
for (int current_entry = 0; current_entry<EntryCount; current_entry++) {
226-
String track = current_entry < TrackNames.Length ? TrackNames[current_entry] : (current_entry + 1) + "_Unknown";
226+
String track = current_entry < TrackNames.Length ? TrackNames[current_entry] : (current_entry + 1) + " Unknown";
227227

228228
Status("Extracting " + track);
229229
Percentage(0.1f + (0.9f / EntryCount) * current_entry);
@@ -361,7 +361,7 @@ public static bool Extract(string inputFile, string outputDirectory) {
361361
// output.position(pos);
362362
writer.Close();
363363

364-
Ffmpeg.Convert(wmaPath, path);
364+
FFmpeg.Convert(wmaPath, path);
365365

366366
File.Delete(wmaPath);
367367
} else if (codec == MiniFormatTag_ADPCM) {

TConvert/TConvert.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
<Compile Include="Convert\WavConverter.cs" />
155155
<Compile Include="Convert\XCompress.cs" />
156156
<Compile Include="Extract\ADPCMConverter.cs" />
157-
<Compile Include="Extract\Ffmpeg.cs" />
157+
<Compile Include="Extract\FFmpeg.cs" />
158158
<Compile Include="Extract\XactExtractor.cs" />
159159
<Compile Include="Extract\HuffTable.cs" />
160160
<Compile Include="Extract\LzxBuffer.cs" />

0 commit comments

Comments
 (0)