* added: sound files extraction with stuffextract
* fixed vc71 irrlicht project file
This commit is contained in:
parent
7afbc29da0
commit
81d50f7c04
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="7.10"
|
||||
Name="Irrlicht"
|
||||
ProjectGUID="{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
||||
RootNamespace="Irrlicht"
|
||||
@ -2160,6 +2160,85 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="io impl"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\CAttributeImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CAttributes.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CAttributes.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CFileList.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CFileList.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CFileSystem.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CFileSystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CLimitReadFile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CLimitReadFile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMemoryReadFile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMemoryReadFile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CPakReader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CPakReader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CReadFile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CReadFile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CWriteFile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CWriteFile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CXMLReader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CXMLReader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CXMLReaderImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CXMLWriter.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CXMLWriter.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CZipReader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CZipReader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\irrXML.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="io impl"
|
||||
|
||||
@ -15,6 +15,7 @@ std::map<uint32,std::string> mapNames;
|
||||
std::set<std::string> texNames;
|
||||
std::set<std::string> modelNames;
|
||||
std::set<std::string> wmoNames;
|
||||
std::set<std::string> soundFileSet;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -35,6 +36,7 @@ int main(int argc, char *argv[])
|
||||
ConvertDBC();
|
||||
ExtractMaps();
|
||||
ExtractMapDependencies();
|
||||
ExtractSoundFiles();
|
||||
//...
|
||||
printf("\n -- finished, press enter to exit --\n");
|
||||
}
|
||||
@ -197,6 +199,8 @@ bool ConvertDBC(void)
|
||||
printf("sound entries..");
|
||||
for(DBCFile::Iterator it = SoundEntries.begin(); it != SoundEntries.end(); ++it)
|
||||
{
|
||||
std::string path = (*it).getString(SOUNDENTRY_PATH); // required to fill up the filename storage
|
||||
path += "\\"; // use backslash because mpq uses backslash too
|
||||
uint32 id = (*it).getUInt(SOUNDENTRY_SOUNDID);
|
||||
for(uint32 field=SOUNDENTRY_SOUNDID; field < SOUNDENTRY_END; field++)
|
||||
{
|
||||
@ -204,7 +208,13 @@ bool ConvertDBC(void)
|
||||
{
|
||||
std::string value = AutoGetDataString(it,SoundEntriesFormat,field);
|
||||
if(value.size()) // only store if a file exists in that field
|
||||
{
|
||||
SoundDataStorage[id].push_back(std::string(SoundEntriesFieldNames[field]) + "=" + value);
|
||||
|
||||
// fill up file storage
|
||||
if(field >= SOUNDENTRY_FILE_1 && field <= SOUNDENTRY_FILE_10)
|
||||
soundFileSet.insert(path + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -448,4 +458,40 @@ void ExtractMapDependencies(void)
|
||||
|
||||
}
|
||||
|
||||
void ExtractSoundFiles(void)
|
||||
{
|
||||
uint32 done = 0;
|
||||
printf("\nExtracting game audio files, %u total...\n",soundFileSet.size());
|
||||
CreateDir(SOUNDDIR);
|
||||
MPQHelper smpq("sound");
|
||||
std::string outfn;
|
||||
for(std::set<std::string>::iterator i = soundFileSet.begin(); i != soundFileSet.end(); i++)
|
||||
{
|
||||
if(!smpq.FileExists((char*)(*i).c_str()))
|
||||
continue;
|
||||
|
||||
outfn = std::string(SOUNDDIR) + "/" + _PathToFileName(*i);
|
||||
std::fstream fh;
|
||||
fh.open(outfn.c_str(), std::ios_base::out | std::ios_base::binary);
|
||||
if(fh.is_open())
|
||||
{
|
||||
ByteBuffer& bb = smpq.ExtractFile((char*)(*i).c_str());
|
||||
if(bb.size())
|
||||
{
|
||||
fh.write((const char*)bb.contents(),bb.size());
|
||||
done++;
|
||||
printf("- %u files done.\r",done);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Could not write sound file '%s'\n",outfn.c_str());
|
||||
}
|
||||
fh.close();
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#define OUTDIR "stuffextract"
|
||||
#define SCPDIR OUTDIR "/data/scp"
|
||||
#define MAPSDIR OUTDIR "/data/maps"
|
||||
#define SOUNDDIR OUTDIR "/data/sound"
|
||||
|
||||
typedef std::map< uint32,std::list<std::string> > SCPStorageMap;
|
||||
|
||||
@ -17,5 +18,6 @@ void OutSCP(char*, SCPStorageMap&);
|
||||
bool ConvertDBC(void);
|
||||
void ExtractMaps(void);
|
||||
void ExtractMapDependencies(void);
|
||||
void ExtractSoundFiles(void);
|
||||
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user