diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/RCTExtractor.sln b/RCTExtractor.sln new file mode 100644 index 0000000..e408698 --- /dev/null +++ b/RCTExtractor.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCTExtractor", "RCTExtractor\RCTExtractor.csproj", "{85DC5D8A-E279-496E-B58C-A863A8AF94F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {85DC5D8A-E279-496E-B58C-A863A8AF94F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85DC5D8A-E279-496E-B58C-A863A8AF94F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85DC5D8A-E279-496E-B58C-A863A8AF94F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85DC5D8A-E279-496E-B58C-A863A8AF94F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/RCTExtractor/App.config b/RCTExtractor/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/RCTExtractor/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/RCTExtractor/Program.cs b/RCTExtractor/Program.cs new file mode 100644 index 0000000..87f445d --- /dev/null +++ b/RCTExtractor/Program.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace RCTExtractor +{ + class Program + { + static void Main(string[] args) + { + if (Directory.Exists("sounds")) + Directory.Delete("sounds", true); + + Directory.CreateDirectory("sounds"); + + using (var fs = File.OpenRead(@"D:\SteamLibrary\steamapps\common\RollerCoaster Tycoon Deluxe\Data\Css1.dat")) + using (var br = new BinaryReader(fs)) + { + var positions = new uint[br.ReadUInt32()]; + + Console.WriteLine("{0} sounds", positions.Length); + + for (int i = 0; i < positions.Length; i++) + { + positions[i] = br.ReadUInt32(); + Console.WriteLine("sound {0} at offset {1} {2}", i, positions[i], i > 0 ? "+" + (positions[i] - positions[i - 1]) : ""); + } + + var names = new string[] { "lift 1", "straight running", "lift 2", "scream 1", + "click 1", "click 2", "place item", "scream 2", "scream 3", "scream 4", + "scream 5", "scream 6", "lift 3", "cash sound", "crash", "laying out water", + "water 1", "water 2", "train whistle", "train chugging", "water splash", + "hammering", "ride launch 1", "ride launch 2", "cough 1", "cough 2", + "cough 3", "cough 4", "rain 1", "thunder 1", "thunder 2", "rain 2", "rain 3", + "tink 1", "tink 2", "scream 7", "toilet flush", "click 3", "quack", + "message sound", "dialog box sound", "person 1", "person 2", "person 3", + "clapping", "haunted house 1", "haunted house 2", "haunted house 3" }; + + for (int i = 0; i < positions.Length; i++) + { + fs.Position = positions[i]; + + var size = br.ReadUInt32(); + + var wFormatTag = br.ReadUInt16(); + var wChannels = br.ReadUInt16(); + var dwSamplesPerSec = br.ReadUInt32(); + var dwAvgBytesPerSec = br.ReadUInt32(); + var wBlockAlign = br.ReadUInt16(); + var wBitsPerSample = br.ReadUInt16(); + + Console.WriteLine("Exporting sound {0} (size: {1})", i, size); + Console.WriteLine(" wFormatTag {0}", wFormatTag); + Console.WriteLine(" wChannels {0}", wChannels); + Console.WriteLine(" dwSamplesPerSec {0}", dwSamplesPerSec); + Console.WriteLine(" dwAvgBytesPerSec {0}", dwAvgBytesPerSec); + Console.WriteLine(" wBlockAlign {0}", wBlockAlign); + Console.WriteLine(" wBitsPerSample {0}", wBitsPerSample); + + using (var sfs = File.OpenWrite(Path.Combine("sounds", names[i] + ".wav"))) + using (var bw = new BinaryWriter(sfs)) + { + bw.Write(new byte[] { (byte)'R', (byte)'I', (byte)'F', (byte)'F' }); + bw.Write(4 + 4 + 4 + 4 + 4 + size); + bw.Write(new byte[] { (byte)'W', (byte)'A', (byte)'V', (byte)'E' }); + bw.Write(new byte[] { (byte)'f', (byte)'m', (byte)'t', (byte)' ' }); + bw.Write((uint)(2 + 2 + 4 + 4 + 2 + 2)); + bw.Write(wFormatTag); + bw.Write(wChannels); + bw.Write(dwSamplesPerSec); + bw.Write(dwAvgBytesPerSec); + bw.Write(wBlockAlign); + bw.Write(wBitsPerSample); + bw.Write(new byte[] { (byte)'d', (byte)'a', (byte)'t', (byte)'a' }); + bw.Write(size - 2 - 2 - 4 - 4 - 2 - 2); + bw.Write(br.ReadBytes((int)(size - 2 - 2 - 4 - 4 - 2 - 2))); + } + } + } + } + } +} diff --git a/RCTExtractor/Properties/AssemblyInfo.cs b/RCTExtractor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6144074 --- /dev/null +++ b/RCTExtractor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("RCTExtractor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RCTExtractor")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("85dc5d8a-e279-496e-b58c-a863a8af94f5")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RCTExtractor/RCTExtractor.csproj b/RCTExtractor/RCTExtractor.csproj new file mode 100644 index 0000000..42a7a88 --- /dev/null +++ b/RCTExtractor/RCTExtractor.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {85DC5D8A-E279-496E-B58C-A863A8AF94F5} + Exe + Properties + RCTExtractor + RCTExtractor + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file