TrinityCore
System.cpp File Reference
#include "Banner.h"
#include "CascHandles.h"
#include "Common.h"
#include "DB2CascFileSource.h"
#include "DB2Meta.h"
#include "DBFilesClientList.h"
#include "ExtractorDB2LoadInfo.h"
#include "IteratorPair.h"
#include "Locales.h"
#include "MapDefines.h"
#include "StringFormat.h"
#include "Util.h"
#include "adt.h"
#include "wdt.h"
#include <CascLib.h>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <bitset>
#include <cstdio>
#include <deque>
#include <fstream>
#include <set>
#include <unordered_map>
#include <cstdlib>
#include <cstring>
#include <io.h>
+ Include dependency graph for System.cpp:

Go to the source code of this file.

Classes

struct  MapEntry
 
struct  LiquidMaterialEntry
 
struct  LiquidObjectEntry
 
struct  LiquidTypeEntry
 

Macros

#define CASC_LOCALES_COUNT   17
 

Enumerations

enum  Extract : uint8 {
  EXTRACT_MAP = 0x1 , EXTRACT_DBC = 0x2 , EXTRACT_CAMERA = 0x4 , EXTRACT_GT = 0x8 ,
  EXTRACT_ALL = EXTRACT_MAP | EXTRACT_DBC | EXTRACT_CAMERA | EXTRACT_GT
}
 

Functions

void CreateDir (boost::filesystem::path const &path)
 
void Usage (char const *prg)
 
void HandleArgs (int argc, char *arg[])
 
void TryLoadDB2 (char const *name, DB2CascFileSource *source, DB2FileLoader *db2, DB2FileLoadInfo const *loadInfo)
 
void ReadMapDBC ()
 
void ReadLiquidMaterialTable ()
 
void ReadLiquidObjectTable ()
 
void ReadLiquidTypeTable ()
 
bool ReadCinematicCameraDBC ()
 
float selectUInt8StepStore (float maxDiff)
 
float selectUInt16StepStore (float maxDiff)
 
bool TransformToHighRes (uint16 lowResHoles, uint8 hiResHoles[8])
 
bool ConvertADT (ChunkedFile &adt, std::string const &mapName, std::string const &outputPath, int gx, int gy, uint32 build, bool ignoreDeepWater)
 
bool ConvertADT (std::string const &fileName, std::string const &mapName, std::string const &outputPath, int gx, int gy, uint32 build, bool ignoreDeepWater)
 
bool ConvertADT (uint32 fileDataId, std::string const &mapName, std::string const &outputPath, int gx, int gy, uint32 build, bool ignoreDeepWater)
 
bool IsDeepWaterIgnored (uint32 mapId, uint32 x, uint32 y)
 
void ExtractMaps (uint32 build)
 
bool ExtractFile (CASC::File *fileInArchive, std::string const &filename)
 
bool ExtractDB2File (uint32 fileDataId, char const *cascFileName, int locale, boost::filesystem::path const &outputPath)
 
char const * GetCascFilenamePart (char const *cascPath)
 
void ExtractDBFilesClient (int l)
 
void ExtractCameraFiles ()
 
void ExtractGameTables ()
 
bool OpenCascStorage (int locale)
 
uint32 GetInstalledLocalesMask ()
 
static bool RetardCheck ()
 
int main (int argc, char *arg[])
 

Variables

std::shared_ptr< CASC::StorageCascStorage
 
std::vector< MapEntrymap_ids
 
std::unordered_map< uint32, LiquidMaterialEntryLiquidMaterials
 
std::unordered_map< uint32, LiquidObjectEntryLiquidObjects
 
std::unordered_map< uint32, LiquidTypeEntryLiquidTypes
 
std::set< uint32CameraFileDataIds
 
bool PrintProgress = true
 
boost::filesystem::path input_path
 
boost::filesystem::path output_path
 
int CONF_extract = EXTRACT_ALL
 
bool CONF_allow_height_limit = true
 
float CONF_use_minHeight = -2000.0f
 
bool CONF_allow_float_to_int = true
 
float CONF_float_to_int8_limit = 2.0f
 
float CONF_float_to_int16_limit = 2048.0f
 
float CONF_flat_height_delta_limit = 0.005f
 
float CONF_flat_liquid_delta_limit = 0.001f
 
uint32 CONF_Locale = 0
 
char const * CONF_Product = "wow"
 
char const * CONF_Region = "eu"
 
bool CONF_UseRemoteCasc = false
 
char const * CascLocaleNames [CASC_LOCALES_COUNT]
 
uint32 WowLocaleToCascLocaleFlags [12]
 
uint16 area_ids [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
 
float V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
float V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint16 uint16_V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
uint16 uint16_V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint8 uint8_V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
uint8 uint8_V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint16 liquid_entry [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
 
map_liquidHeaderTypeFlags liquid_flags [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
 
bool liquid_show [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
float liquid_height [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint8 holes [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID][8]
 
int16 flight_box_max [3][3]
 
int16 flight_box_min [3][3]
 

Macro Definition Documentation

◆ CASC_LOCALES_COUNT

#define CASC_LOCALES_COUNT   17

Definition at line 117 of file System.cpp.

Enumeration Type Documentation

◆ Extract

enum Extract : uint8
Enumerator
EXTRACT_MAP 
EXTRACT_DBC 
EXTRACT_CAMERA 
EXTRACT_GT 
EXTRACT_ALL 

Definition at line 87 of file System.cpp.

Function Documentation

◆ ConvertADT() [1/3]

bool ConvertADT ( ChunkedFile adt,
std::string const &  mapName,
std::string const &  outputPath,
int  gx,
int  gy,
uint32  build,
bool  ignoreDeepWater 
)

Definition at line 478 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertADT() [2/3]

bool ConvertADT ( std::string const &  fileName,
std::string const &  mapName,
std::string const &  outputPath,
int  gx,
int  gy,
uint32  build,
bool  ignoreDeepWater 
)

Definition at line 1024 of file System.cpp.

+ Here is the call graph for this function:

◆ ConvertADT() [3/3]

bool ConvertADT ( uint32  fileDataId,
std::string const &  mapName,
std::string const &  outputPath,
int  gx,
int  gy,
uint32  build,
bool  ignoreDeepWater 
)

Definition at line 1034 of file System.cpp.

+ Here is the call graph for this function:

◆ CreateDir()

void CreateDir ( boost::filesystem::path const &  path)

Definition at line 148 of file System.cpp.

+ Here is the caller graph for this function:

◆ ExtractCameraFiles()

void ExtractCameraFiles ( )

Definition at line 1294 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractDB2File()

bool ExtractDB2File ( uint32  fileDataId,
char const *  cascFileName,
int  locale,
boost::filesystem::path const &  outputPath 
)

Definition at line 1180 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractDBFilesClient()

void ExtractDBFilesClient ( int  l)

Definition at line 1269 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractFile()

bool ExtractFile ( CASC::File fileInArchive,
std::string const &  filename 
)

Definition at line 1136 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractGameTables()

void ExtractGameTables ( )

Definition at line 1327 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractMaps()

void ExtractMaps ( uint32  build)

Definition at line 1071 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCascFilenamePart()

char const * GetCascFilenamePart ( char const *  cascPath)

Definition at line 1261 of file System.cpp.

◆ GetInstalledLocalesMask()

uint32 GetInstalledLocalesMask ( )

Definition at line 1411 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleArgs()

void HandleArgs ( int  argc,
char *  arg[] 
)

Definition at line 176 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDeepWaterIgnored()

bool IsDeepWaterIgnored ( uint32  mapId,
uint32  x,
uint32  y 
)

Definition at line 1044 of file System.cpp.

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  arg[] 
)

Definition at line 1472 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpenCascStorage()

bool OpenCascStorage ( int  locale)

Definition at line 1380 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadCinematicCameraDBC()

bool ReadCinematicCameraDBC ( )

Definition at line 390 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadLiquidMaterialTable()

void ReadLiquidMaterialTable ( )

Definition at line 317 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadLiquidObjectTable()

void ReadLiquidObjectTable ( )

Definition at line 341 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadLiquidTypeTable()

void ReadLiquidTypeTable ( )

Definition at line 365 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadMapDBC()

void ReadMapDBC ( )

Definition at line 272 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RetardCheck()

static bool RetardCheck ( )
static

Definition at line 1440 of file System.cpp.

+ Here is the caller graph for this function:

◆ selectUInt16StepStore()

float selectUInt16StepStore ( float  maxDiff)

Definition at line 421 of file System.cpp.

+ Here is the caller graph for this function:

◆ selectUInt8StepStore()

float selectUInt8StepStore ( float  maxDiff)

Definition at line 416 of file System.cpp.

+ Here is the caller graph for this function:

◆ TransformToHighRes()

bool TransformToHighRes ( uint16  lowResHoles,
uint8  hiResHoles[8] 
)

Definition at line 463 of file System.cpp.

+ Here is the caller graph for this function:

◆ TryLoadDB2()

void TryLoadDB2 ( char const *  name,
DB2CascFileSource source,
DB2FileLoader db2,
DB2FileLoadInfo const *  loadInfo 
)

Definition at line 259 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Usage()

void Usage ( char const *  prg)

Definition at line 159 of file System.cpp.

+ Here is the caller graph for this function:

Variable Documentation

◆ area_ids

Definition at line 426 of file System.cpp.

◆ CameraFileDataIds

std::set<uint32> CameraFileDataIds

Definition at line 79 of file System.cpp.

◆ CascLocaleNames

char const* CascLocaleNames[CASC_LOCALES_COUNT]
Initial value:
=
{
"none", "enUS",
"koKR", "unknown",
"frFR", "deDE",
"zhCN", "esES",
"zhTW", "enGB",
"enCN", "enTW",
"esMX", "ruRU",
"ptBR", "itIT",
"ptPT"
}

Definition at line 119 of file System.cpp.

◆ CascStorage

std::shared_ptr<CASC::Storage> CascStorage

Definition at line 49 of file System.cpp.

◆ CONF_allow_float_to_int

bool CONF_allow_float_to_int = true

Definition at line 105 of file System.cpp.

◆ CONF_allow_height_limit

bool CONF_allow_height_limit = true

Definition at line 101 of file System.cpp.

◆ CONF_extract

int CONF_extract = EXTRACT_ALL

Definition at line 98 of file System.cpp.

◆ CONF_flat_height_delta_limit

float CONF_flat_height_delta_limit = 0.005f

Definition at line 108 of file System.cpp.

◆ CONF_flat_liquid_delta_limit

float CONF_flat_liquid_delta_limit = 0.001f

Definition at line 109 of file System.cpp.

◆ CONF_float_to_int16_limit

float CONF_float_to_int16_limit = 2048.0f

Definition at line 107 of file System.cpp.

◆ CONF_float_to_int8_limit

float CONF_float_to_int8_limit = 2.0f

Definition at line 106 of file System.cpp.

◆ CONF_Locale

uint32 CONF_Locale = 0

Definition at line 111 of file System.cpp.

◆ CONF_Product

char const* CONF_Product = "wow"

Definition at line 113 of file System.cpp.

◆ CONF_Region

char const* CONF_Region = "eu"

Definition at line 114 of file System.cpp.

◆ CONF_use_minHeight

float CONF_use_minHeight = -2000.0f

Definition at line 102 of file System.cpp.

◆ CONF_UseRemoteCasc

bool CONF_UseRemoteCasc = false

Definition at line 115 of file System.cpp.

◆ flight_box_max

int16 flight_box_max[3][3]

Definition at line 441 of file System.cpp.

◆ flight_box_min

int16 flight_box_min[3][3]

Definition at line 442 of file System.cpp.

◆ holes

Definition at line 439 of file System.cpp.

◆ input_path

boost::filesystem::path input_path

Definition at line 81 of file System.cpp.

◆ liquid_entry

Definition at line 435 of file System.cpp.

◆ liquid_flags

◆ liquid_height

float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]

Definition at line 438 of file System.cpp.

◆ liquid_show

bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]

Definition at line 437 of file System.cpp.

◆ LiquidMaterials

std::unordered_map<uint32, LiquidMaterialEntry> LiquidMaterials

Definition at line 76 of file System.cpp.

◆ LiquidObjects

std::unordered_map<uint32, LiquidObjectEntry> LiquidObjects

Definition at line 77 of file System.cpp.

◆ LiquidTypes

std::unordered_map<uint32, LiquidTypeEntry> LiquidTypes

Definition at line 78 of file System.cpp.

◆ map_ids

std::vector<MapEntry> map_ids

Definition at line 75 of file System.cpp.

◆ output_path

boost::filesystem::path output_path

Definition at line 82 of file System.cpp.

◆ PrintProgress

bool PrintProgress = true

Definition at line 80 of file System.cpp.

◆ uint16_V8

Definition at line 430 of file System.cpp.

◆ uint16_V9

Definition at line 431 of file System.cpp.

◆ uint8_V8

Definition at line 432 of file System.cpp.

◆ uint8_V9

Definition at line 433 of file System.cpp.

◆ V8

Definition at line 428 of file System.cpp.

◆ V9

float V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]

Definition at line 429 of file System.cpp.

◆ WowLocaleToCascLocaleFlags

uint32 WowLocaleToCascLocaleFlags[12]
Initial value:
=
{
CASC_LOCALE_ENUS | CASC_LOCALE_ENGB,
CASC_LOCALE_KOKR,
CASC_LOCALE_FRFR,
CASC_LOCALE_DEDE,
CASC_LOCALE_ZHCN,
CASC_LOCALE_ZHTW,
CASC_LOCALE_ESES,
CASC_LOCALE_ESMX,
CASC_LOCALE_RURU,
0,
CASC_LOCALE_PTBR | CASC_LOCALE_PTPT,
CASC_LOCALE_ITIT,
}

Definition at line 132 of file System.cpp.