* stuffextract is now officially cross-platform as far as linux is concerned
* libbz2 is required to successfully compile stuffextract * the compiled executable has to be renamed because it creates a folder named stuffextract ;)
This commit is contained in:
parent
0b7511bf27
commit
860b1ef7cd
@ -65,6 +65,9 @@ AC_CHECK_FUNCS([floor ftime ftruncate getcwd gethostbyaddr gethostbyname gethost
|
||||
# src/dep/src/irrlicht/libpng])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
src/tools/Makefile
|
||||
src/tools/stuffextract/Makefile
|
||||
src/tools/stuffextract/StormLib/Makefile
|
||||
src/shared/Makefile
|
||||
src/shared/Auth/Makefile
|
||||
src/shared/Network/Makefile
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
## Makefile.am - process this file with automake
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall
|
||||
SUBDIRS = shared Client
|
||||
SUBDIRS = shared Client tools
|
||||
## End Makefile.am
|
||||
|
||||
4
src/tools/Makefile.am
Normal file
4
src/tools/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
||||
## Makefile.am - process this file with automake
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall
|
||||
SUBDIRS = stuffextract
|
||||
## End Makefile.am
|
||||
@ -4,4 +4,4 @@
|
||||
char *GetLocale(void);
|
||||
void SetLocale(char*);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -17,4 +17,4 @@ private:
|
||||
std::list<std::string> _patches;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
8
src/tools/stuffextract/Makefile.am
Normal file
8
src/tools/stuffextract/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
SUBDIRS = StormLib
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall
|
||||
## Build pseuwow
|
||||
bin_PROGRAMS = stuffextract
|
||||
stuffextract_SOURCES = dbcfile.cpp Locale.cpp MPQFile.cpp MPQHelper.cpp StuffExtract.cpp
|
||||
|
||||
stuffextract_LDADD = StormLib/libstormlib.a ../../shared/Auth/libauth.a ../../shared/libshared.a -lbz2
|
||||
11
src/tools/stuffextract/StormLib/Makefile.am
Normal file
11
src/tools/stuffextract/StormLib/Makefile.am
Normal file
@ -0,0 +1,11 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall -D__SYS_ZLIB
|
||||
AM_CFLAGS = -fPIC
|
||||
## Build pseuwow
|
||||
noinst_LIBRARIES = libstormlib.a
|
||||
libstormlib_a_SOURCES =huffman/huff.cpp\
|
||||
wave/wave.cpp\
|
||||
StormPortLinux.cpp\
|
||||
SFileReadFile.cpp SCommon.cpp SCompression.cpp SFileCompactArchive.cpp SFileCreateArchiveEx.cpp SFileExtractFile.cpp SFileFindFile.cpp SFileOpenArchive.cpp\
|
||||
SFileOpenFileEx.cpp SListFile.cpp\
|
||||
pklib/crc32_pk.c pklib/explode.c pklib/implode.c
|
||||
@ -114,7 +114,11 @@
|
||||
typedef long LONG_PTR;
|
||||
typedef long long LONGLONG;
|
||||
#ifndef __OBJC__
|
||||
#ifdef __cplusplus
|
||||
#define BOOL bool
|
||||
#else
|
||||
#define BOOL int
|
||||
#endif
|
||||
#endif
|
||||
typedef void * HANDLE;
|
||||
typedef void * LPOVERLAPPED; // Unsupported on Linux
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "DBCFieldData.h"
|
||||
#include "Locale.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "../../Client/Gui/CM2MeshFileLoader.h"
|
||||
#include "../../Client/GUI/CM2MeshFileLoader.h"
|
||||
|
||||
int replaceSpaces (int i) { return i==(int)' ' ? (int)'_' : i; }
|
||||
|
||||
@ -42,7 +42,7 @@ int main(int argc, char *argv[])
|
||||
fgets(input,sizeof(input),stdin);
|
||||
char loc[5];
|
||||
input[strlen(input)-1] = 0;
|
||||
memcpy(loc,input,4); loc[4]=0;
|
||||
memcpy(loc,input,4); loc[4]=0;
|
||||
SetLocale(loc);
|
||||
}
|
||||
if(GetLocale() && FileExists(std::string("Data/")+GetLocale()+"/locale-"+GetLocale()+".MPQ"))
|
||||
@ -105,7 +105,7 @@ void ProcessCmdArgs(int argc, char *argv[])
|
||||
{
|
||||
if(!stricmp(what+7,"auto"))
|
||||
SetLocale(NULL);
|
||||
else
|
||||
else
|
||||
SetLocale(what+7);
|
||||
}
|
||||
else if(!stricmp(what,"?") || !stricmp(what,"help"))
|
||||
@ -248,7 +248,7 @@ void OutMD5(char *path, MD5FileMap& fm)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool ConvertDBC(void)
|
||||
@ -293,7 +293,7 @@ bool ConvertDBC(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("emotes..");
|
||||
for(DBCFile::Iterator it = EmotesText.begin(); it != EmotesText.end(); ++it)
|
||||
{
|
||||
@ -319,7 +319,7 @@ bool ConvertDBC(void)
|
||||
std::string tx = (*ix).getString(stringpos);
|
||||
uint32 fpos=0;
|
||||
// the following block replaces %x$s (where x is a number) with %s
|
||||
do
|
||||
do
|
||||
{
|
||||
if(fpos+4 < tx.length() && tx[fpos]=='%' && tx[fpos+2]=='$' && tx[fpos+3]=='s' && isdigit(tx[fpos+1]))
|
||||
{
|
||||
@ -455,7 +455,7 @@ bool ConvertDBC(void)
|
||||
{
|
||||
std::string value = AutoGetDataString(it,CreatureDisplayInfoFormat,field);
|
||||
if(value.size()) // only store if not null
|
||||
{
|
||||
{
|
||||
if(doTextures && field >= CREATUREDISPLAYINFO_NAME1 && field <= CREATUREDISPLAYINFO_NAME3)
|
||||
{
|
||||
// lookup for model path
|
||||
@ -491,7 +491,7 @@ bool ConvertDBC(void)
|
||||
{
|
||||
std::string value = AutoGetDataString(it,GameObjectDisplayInfoFormat,field);
|
||||
if(value.size()) // only store if not null
|
||||
{
|
||||
{
|
||||
// TODO: add check for wmo model files ?
|
||||
if(doModels)
|
||||
modelNames.insert(NameAndAlt(value)); // we need to extract model later, store it
|
||||
@ -569,7 +569,7 @@ bool ConvertDBC(void)
|
||||
|
||||
CreateDir("stuffextract/data/scp");
|
||||
|
||||
printf("Writing SCP files:\n");
|
||||
printf("Writing SCP files:\n");
|
||||
printf("emote.."); OutSCP(SCPDIR "/emote.scp",EmoteDataStorage, "emote");
|
||||
printf("race.."); OutSCP(SCPDIR "/race.scp",RaceDataStorage, "race");
|
||||
printf("sound.."); OutSCP(SCPDIR "/sound.scp",SoundDataStorage, "sound");
|
||||
@ -605,7 +605,7 @@ void ExtractMaps(void)
|
||||
char wdt_name[300], wdt_out[300];
|
||||
sprintf(wdt_name,"World\\Maps\\%s\\%s.wdt",it->second.c_str(),it->second.c_str());
|
||||
sprintf(wdt_out,MAPSDIR"/%u.wdt",it->first);
|
||||
ByteBuffer& wdt_bb = mpq.ExtractFile(wdt_name);
|
||||
const ByteBuffer& wdt_bb = mpq.ExtractFile(wdt_name);
|
||||
std::fstream wdt_fh;
|
||||
wdt_fh.open(wdt_out, std::ios_base::out|std::ios_base::binary);
|
||||
if(!wdt_fh.is_open())
|
||||
@ -631,7 +631,7 @@ void ExtractMaps(void)
|
||||
sprintf(outbuf,MAPSDIR"/%u_%u_%u.adt",it->first,x,y);
|
||||
if(mpq.FileExists(namebuf))
|
||||
{
|
||||
ByteBuffer& bb = mpq.ExtractFile(namebuf);
|
||||
const ByteBuffer& bb = mpq.ExtractFile(namebuf);
|
||||
if(bb.size())
|
||||
{
|
||||
std::fstream fh;
|
||||
@ -648,8 +648,8 @@ void ExtractMaps(void)
|
||||
olddeps = texNames.size() + modelNames.size() + wmoNames.size();
|
||||
|
||||
if(doTextures) ADT_FillTextureData(bb.contents(),texNames);
|
||||
if(doModels) ADT_FillModelData(bb.contents(),modelNames);
|
||||
if(doWmos) ADT_FillWMOData(bb.contents(),wmoNames);
|
||||
if(doModels) ADT_FillModelData(bb.contents(),modelNames);
|
||||
if(doWmos) ADT_FillWMOData(bb.contents(),wmoNames);
|
||||
|
||||
depdiff = texNames.size() + modelNames.size() + wmoNames.size() - olddeps;
|
||||
if(doMd5)
|
||||
@ -726,7 +726,7 @@ void ExtractMapDependencies(void)
|
||||
fh.open(realfn.c_str(),std::ios_base::out | std::ios_base::binary);
|
||||
if(fh.is_open())
|
||||
{
|
||||
ByteBuffer& bb = mpqmodel.ExtractFile((char*)mpqfn.c_str());
|
||||
ByteBuffer bb = mpqmodel.ExtractFile((char*)mpqfn.c_str());
|
||||
fh.write((const char*)bb.contents(),bb.size());
|
||||
if (doTextures)
|
||||
FetchTexturesFromModel(bb);
|
||||
@ -770,7 +770,7 @@ void ExtractMapDependencies(void)
|
||||
std::string copy = NormalizeFilename(mpqfn);
|
||||
if (copy.find_first_of("/") != std::string::npos)
|
||||
{
|
||||
std::string copy2 = copy;
|
||||
std::string copy2 = copy.c_str();
|
||||
char* tok = strtok((char*)copy2.c_str(),"/");
|
||||
std::string fullpath = pathtex;
|
||||
while (tok && !strstr(tok, ".blp"))
|
||||
@ -787,7 +787,7 @@ void ExtractMapDependencies(void)
|
||||
fh.open(realfn.c_str(),std::ios_base::out | std::ios_base::binary);
|
||||
if(fh.is_open())
|
||||
{
|
||||
ByteBuffer& bb = mpqtex.ExtractFile((char*)mpqfn.c_str());
|
||||
const ByteBuffer& bb = mpqtex.ExtractFile((char*)mpqfn.c_str());
|
||||
fh.write((const char*)bb.contents(),bb.size());
|
||||
if(doMd5)
|
||||
{
|
||||
@ -828,7 +828,7 @@ void ExtractMapDependencies(void)
|
||||
fh.open(realfn.c_str(),std::ios_base::out | std::ios_base::binary);
|
||||
if(fh.is_open())
|
||||
{
|
||||
ByteBuffer& bb = mpqwmo.ExtractFile((char*)mpqfn.c_str());
|
||||
const ByteBuffer& bb = mpqwmo.ExtractFile((char*)mpqfn.c_str());
|
||||
fh.write((const char*)bb.contents(),bb.size());
|
||||
if(doMd5)
|
||||
{
|
||||
@ -877,7 +877,7 @@ void ExtractSoundFiles(void)
|
||||
fh.open(outfn.c_str(), std::ios_base::out | std::ios_base::binary);
|
||||
if(fh.is_open())
|
||||
{
|
||||
ByteBuffer& bb = smpq.ExtractFile((char*)i->name.c_str());
|
||||
const ByteBuffer& bb = smpq.ExtractFile((char*)i->name.c_str());
|
||||
if(bb.size())
|
||||
{
|
||||
fh.write((const char*)bb.contents(),bb.size());
|
||||
@ -943,7 +943,7 @@ void ADT_FillModelData(const uint8* data,std::set<NameAndAlt>& st)
|
||||
ADT_ExportStringSetByOffset(data,OFFSET_MODELS,st,"DIMM");
|
||||
}
|
||||
|
||||
void FetchTexturesFromModel(ByteBuffer& bb)
|
||||
void FetchTexturesFromModel(ByteBuffer bb)
|
||||
{
|
||||
bb.rpos(0);
|
||||
irr::scene::ModelHeader header;
|
||||
|
||||
@ -39,11 +39,11 @@ void ExtractMaps(void);
|
||||
void ExtractMapDependencies(void);
|
||||
void ExtractSoundFiles(void);
|
||||
|
||||
void FetchTexturesFromModel(ByteBuffer&);
|
||||
void FetchTexturesFromModel(ByteBuffer);
|
||||
|
||||
void ADT_ExportStringSetByOffset(const uint8*, uint32, std::set<NameAndAlt>&, char*);
|
||||
void ADT_FillTextureData(const uint8*,std::set<NameAndAlt>&);
|
||||
void ADT_FillWMOData(const uint8*,std::set<NameAndAlt>&);
|
||||
void ADT_FillModelData(const uint8*,std::set<NameAndAlt>&);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user