Initial commit.

This commit is contained in:
Jim Gray
2013-04-04 14:32:05 -07:00
parent ba5c81da32
commit d71d53e8ec
2180 changed files with 1393544 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_soundbank", "create_soundbank.vcproj", "{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}.Debug.ActiveCfg = Debug|Win32
{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}.Debug.Build.0 = Debug|Win32
{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}.Release.ActiveCfg = Release|Win32
{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,196 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="create_soundbank"
ProjectGUID="{8DB8FCA9-8B91-4AE7-BE32-24435E6CFCE4}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/create_soundbank.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/create_soundbank.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/create_soundbank.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="main.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<Filter
Name="zlib"
Filter="">
<File
RelativePath="..\..\code\zlib\adler32.c">
</File>
<File
RelativePath="..\..\code\zlib\compress.c">
</File>
<File
RelativePath="..\..\code\zlib\crc32.c">
</File>
<File
RelativePath="..\..\code\zlib\deflate.c">
</File>
<File
RelativePath="..\..\code\zlib\deflate.h">
</File>
<File
RelativePath="..\..\code\zlib\infblock.c">
</File>
<File
RelativePath="..\..\code\zlib\infblock.h">
</File>
<File
RelativePath="..\..\code\zlib\infcodes.c">
</File>
<File
RelativePath="..\..\code\zlib\infcodes.h">
</File>
<File
RelativePath="..\..\code\zlib\inffast.c">
</File>
<File
RelativePath="..\..\code\zlib\inffast.h">
</File>
<File
RelativePath="..\..\code\zlib\inffixed.h">
</File>
<File
RelativePath="..\..\code\zlib\inflate.c">
</File>
<File
RelativePath="..\..\code\zlib\inftrees.c">
</File>
<File
RelativePath="..\..\code\zlib\inftrees.h">
</File>
<File
RelativePath="..\..\code\zlib\infutil.c">
</File>
<File
RelativePath="..\..\code\zlib\infutil.h">
</File>
<File
RelativePath="..\..\code\zlib\trees.c">
</File>
<File
RelativePath="..\..\code\zlib\trees.h">
</File>
<File
RelativePath="..\..\code\zlib\uncompr.c">
</File>
<File
RelativePath="..\..\code\zlib\zconf.h">
</File>
<File
RelativePath="..\..\code\zlib\zlib.h">
</File>
<File
RelativePath="..\..\code\zlib\zutil.c">
</File>
<File
RelativePath="..\..\code\zlib\zutil.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,171 @@
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <direct.h>
#include <io.h>
#include <windows.h>
#include "../../code/zlib/zlib.h"
static int count = 0;
static int basesize = 0;
//Changing this? It needs to be synced with the snd_local_console.h.
enum SoundFilenameFlags
{
SFF_WEAPONS_ATST,
SFF_SAND_CREATURE,
SFF_HOWLER,
SFF_ALTCHARGE,
SFF_FALLING,
SFF_TIEEXPLODE
//Can't have more than 8.
};
//Changing this? It needs to be synced with the snd_local_console.h.
FILE* out;
FILE* out2;
FILE* out3;
void processfile( const char* path, const char* filename)
{
FILE* in;
char name[256];
// open the file and write it to the massive bank
strcpy(name, path);
strcat(name,"\\");
strcat(name, filename);
in = fopen(name, "rb");
if(!in)
{
printf("Error, could not open file, %s, for reading.\n", name);
return;
}
fseek(in, 0, SEEK_END);
int len = ftell(in);
fseek(in, 0, SEEK_SET);
void* crap = malloc(len);
fread(crap, len, 1, in);
fclose(in);
unsigned int offset = ftell(out);
//fwrite(&len, sizeof(len), 1, out);
fwrite(crap, len, 1, out);
free(crap);
char osname[256];
strcpy(osname, "d:\\base");
strcat(osname, name + basesize);
unsigned int filecode = crc32(0, (const byte *)osname, strlen(osname));
char qname[64];
strcpy(qname, name + basesize + 1);
fwrite(&filecode, sizeof(filecode), 1, out2);
fwrite(&offset, sizeof(offset), 1, out2);
fwrite(&len, sizeof(len), 1, out2);
unsigned char flags = 0;
if(strstr(qname, "weapons\\atst")) {
flags |= (1 << SFF_WEAPONS_ATST);
}
if(strstr(qname, "sand_creature")) {
flags |= (1 << SFF_SAND_CREATURE);
}
if(strstr(qname, "howler")) {
flags |= (1 << SFF_HOWLER);
}
if(strstr(qname, "altcharge")) {
flags |= (1 << SFF_ALTCHARGE);
}
if(strstr(qname, "falling")) {
flags |= (1 << SFF_FALLING);
}
if(strstr(qname, "tieexplode")) {
flags |= (1 << SFF_TIEEXPLODE);
}
fwrite(&flags, sizeof(flags), 1, out2);
fprintf(out3, "%u\t\t%s\n", filecode, qname);
}
void process( const char* path)
{
char spec[256];
strcpy(spec, path);
strcat(spec, "\\*.*");
_finddata_t data;
int h = _findfirst(spec, &data);
while( h != -1)
{
if(data.attrib & _A_SUBDIR && strcmp(data.name,".") && strcmp(data.name,"..") )
{
char sub[256];
strcpy(sub,path);
strcat(sub,"\\");
strcat(sub,data.name);
process(sub);
}
else if(strstr(data.name,".wxb"))
{
processfile(path, data.name);
count++;
}
if (_findnext(h, &data)) break;
}
_findclose(h);
}
int main(int argc, const char** argv)
{
// open a file to become the massive soundbank
out = fopen("sound.bnk", "wb");
out2 = fopen("sound.tbl", "wb");
out3 = fopen("crclookup.txt", "w");
if(!out)
{
printf("Error, could not open sound.bnk for writing.\n");
exit(0);
}
if(!out2)
{
printf("Error, could not open sound.tbl for writing.\n");
exit(0);
}
if(!out3)
{
printf("Error, could not open crclookup.txt for writing.\n");
exit(0);
}
basesize = strlen(argv[1]);
// find all WXP files in the path
printf("Processing...\n");
process(argv[1]);
fclose(out);
fclose(out2);
fclose(out3);
printf("%d files processed.\n", count);
return 1;
}