From ae662cad8a43c2700832fe4fd4e0129962d610b7 Mon Sep 17 00:00:00 2001 From: Villermen Date: Mon, 8 Dec 2014 18:18:20 +0100 Subject: [PATCH] Using temporary fix for indices changing --- Program.cs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/Program.cs b/Program.cs index 73176ec..9f07620 100644 --- a/Program.cs +++ b/Program.cs @@ -401,10 +401,11 @@ namespace RSCacheTool //combine the files with sox Console.WriteLine("Running SoX to concatenate ogg audio chunks."); - Process soxProcess = new Process(); - soxProcess.StartInfo.FileName = "sox.exe"; + Process soxProcess = new Process + { + StartInfo = {FileName = "sox.exe", Arguments = "--combine concatenate ~index.ogg"} + }; - soxProcess.StartInfo.Arguments = "--combine concatenate ~index.ogg"; chunkFiles.ForEach((str) => { soxProcess.StartInfo.Arguments += " " + str; @@ -458,20 +459,27 @@ namespace RSCacheTool Dictionary trackIdNames = new Dictionary(); Dictionary fileIdTracks = new Dictionary(); - byte[] magicNumber = { + //locate start of names and file ids + byte[] namesMagicNumber = { 0x00, - 0x01, - 0x69, - 0x02 + 0x66, + 0x24, + 0x07 }; - //locate start of the music names (8th magic number) and file ids (12th) - long namesStartPos = resolveFile.IndexOf(magicNumber, 8); - long filesStartPos = resolveFile.IndexOf(magicNumber, 12); + byte[] filesMagicNumber = { + 0x00, + 0x66, + 0x0b, + 0x08 + }; + + long namesStartPos = resolveFile.IndexOf(namesMagicNumber); + long filesStartPos = resolveFile.IndexOf(filesMagicNumber); if (namesStartPos != -1 && filesStartPos != -1) { - resolveFile.Position = namesStartPos + 8; + resolveFile.Position = namesStartPos + 6; uint musicCount = resolveFile.ReadBytes(2); //construct trackIdNames @@ -490,7 +498,7 @@ namespace RSCacheTool } //construct fileIdTracks - resolveFile.Position = filesStartPos + 8; + resolveFile.Position = filesStartPos + 6; uint fileCount = resolveFile.ReadBytes(2); for (int i = 0; i < fileCount; i++) {