32 if (fname.length() < 4)
35 std::string extension = fname.substr(fname.length() - 4, 4);
36 if (extension ==
".mdx" || extension ==
".MDX" || extension ==
".mdl" || extension ==
".MDL")
38 fname.erase(fname.length() - 2, 2);
42 std::string originalName = fname;
54 Model mdl(originalName);
66 std::unique_ptr<CASC::File> file(
CascStorage->OpenFile(fileName.c_str(), CASC_LOCALE_ALL_WOW));
71 if (!file->ReadFile(magic, 4, &bytesRead) || bytesRead != 4)
79 printf(
"Extracting GameObject models...\n");
87 catch (std::exception
const& e)
89 printf(
"Fatal error: Invalid GameObjectDisplayInfo.db2 file format!\n%s\n", e.what());
96 std::string modelListPath = basepath +
"temp_gameobject_models";
97 FILE*
model_list = fopen(modelListPath.c_str(),
"wb");
100 printf(
"Fatal error: Could not open file %s\n", modelListPath.c_str());
122 if (!memcmp(&header,
"REVM", 4))
124 else if (!memcmp(&header,
"MD20", 4) || !memcmp(&header,
"MD21", 4))
127 ABORT_MSG(
"%s header: %d - %c%c%c%c", fileName.c_str(), header, (header >> 24) & 0xFF, (header >> 16) & 0xFF, (header >> 8) & 0xFF, header & 0xFF);
132 uint32 path_length = fileName.length();
135 fwrite(fileName.c_str(),
sizeof(
char), path_length,
model_list);
char const * GetPlainName(char const *FileName)
void NormalizeFileName(char *name, size_t len)
void Load(DB2FileSource *source, DB2FileLoadInfo const *loadInfo)
DB2Record GetRecord(uint32 recordNumber) const
uint32 GetRecordCount() const
uint32 GetUInt32(uint32 field, uint32 arrayIndex) const
bool ConvertToVMAPModel(char const *outfilename)
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
const char RAW_VMAP_MAGIC[]
static constexpr DB2LoadInfo Instance
bool FileExists(char const *file)
char const * szWorkDirWmo
bool ExtractSingleWmo(std::string &fname)