TrinityCore
Loading...
Searching...
No Matches
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 "MapUtils.h"
#include "Memory.h"
#include "StringFormat.h"
#include "Util.h"
#include "adt.h"
#include "wdt.h"
#include "advstd.h"
#include <CascLib.h>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <bitset>
#include <set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <io.h>
#include "WheatyExceptionReport.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
 

Typedefs

template<typename T , std::size_t N>
using Array2D = T[N][N]
 

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])
 
template<typename T , std::size_t N>
static void WriteArray2D (Array2D< T, N > const &data, FILE *f)
 
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[])
 
 INIT_CRASH_HANDLER ()
 

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]
 

Macro Definition Documentation

◆ CASC_LOCALES_COUNT

#define CASC_LOCALES_COUNT   17

Definition at line 120 of file System.cpp.

Typedef Documentation

◆ Array2D

template<typename T , std::size_t N>
using Array2D = T[N][N]

Definition at line 465 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 90 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 473 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 1036 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 1046 of file System.cpp.

+ Here is the call graph for this function:

◆ CreateDir()

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

Definition at line 151 of file System.cpp.

+ Here is the caller graph for this function:

◆ ExtractCameraFiles()

void ExtractCameraFiles ( )

Definition at line 1303 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 1190 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 1278 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 1147 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 1336 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 1083 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 1270 of file System.cpp.

◆ GetInstalledLocalesMask()

uint32 GetInstalledLocalesMask ( )

Definition at line 1420 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 179 of file System.cpp.

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

◆ INIT_CRASH_HANDLER()

INIT_CRASH_HANDLER ( )

◆ IsDeepWaterIgnored()

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

Definition at line 1056 of file System.cpp.

+ Here is the caller graph for this function:

◆ main()

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

Definition at line 1481 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 1389 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 394 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 320 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 345 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 369 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 275 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 1449 of file System.cpp.

+ Here is the caller graph for this function:

◆ selectUInt16StepStore()

float selectUInt16StepStore ( float  maxDiff)

Definition at line 425 of file System.cpp.

+ Here is the caller graph for this function:

◆ selectUInt8StepStore()

float selectUInt8StepStore ( float  maxDiff)

Definition at line 420 of file System.cpp.

+ Here is the caller graph for this function:

◆ TransformToHighRes()

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

Definition at line 449 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 262 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 162 of file System.cpp.

+ Here is the caller graph for this function:

◆ WriteArray2D()

template<typename T , std::size_t N>
static void WriteArray2D ( Array2D< T, N > const &  data,
FILE *  f 
)
inlinestatic

Definition at line 468 of file System.cpp.

+ Here is the caller graph for this function:

Variable Documentation

◆ CameraFileDataIds

std::set<uint32> CameraFileDataIds

Definition at line 82 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 122 of file System.cpp.

◆ CascStorage

std::shared_ptr<CASC::Storage> CascStorage

Definition at line 51 of file System.cpp.

◆ CONF_allow_float_to_int

bool CONF_allow_float_to_int = true

Definition at line 108 of file System.cpp.

◆ CONF_allow_height_limit

bool CONF_allow_height_limit = true

Definition at line 104 of file System.cpp.

◆ CONF_extract

int CONF_extract = EXTRACT_ALL

Definition at line 101 of file System.cpp.

◆ CONF_flat_height_delta_limit

float CONF_flat_height_delta_limit = 0.005f

Definition at line 111 of file System.cpp.

◆ CONF_flat_liquid_delta_limit

float CONF_flat_liquid_delta_limit = 0.001f

Definition at line 112 of file System.cpp.

◆ CONF_float_to_int16_limit

float CONF_float_to_int16_limit = 2048.0f

Definition at line 110 of file System.cpp.

◆ CONF_float_to_int8_limit

float CONF_float_to_int8_limit = 2.0f

Definition at line 109 of file System.cpp.

◆ CONF_Locale

uint32 CONF_Locale = 0

Definition at line 114 of file System.cpp.

◆ CONF_Product

char const* CONF_Product = "wow"

Definition at line 116 of file System.cpp.

◆ CONF_Region

char const* CONF_Region = "eu"

Definition at line 117 of file System.cpp.

◆ CONF_use_minHeight

float CONF_use_minHeight = -2000.0f

Definition at line 105 of file System.cpp.

◆ CONF_UseRemoteCasc

bool CONF_UseRemoteCasc = false

Definition at line 118 of file System.cpp.

◆ input_path

boost::filesystem::path input_path

Definition at line 84 of file System.cpp.

◆ LiquidMaterials

std::unordered_map<uint32, LiquidMaterialEntry> LiquidMaterials

Definition at line 79 of file System.cpp.

◆ LiquidObjects

std::unordered_map<uint32, LiquidObjectEntry> LiquidObjects

Definition at line 80 of file System.cpp.

◆ LiquidTypes

std::unordered_map<uint32, LiquidTypeEntry> LiquidTypes

Definition at line 81 of file System.cpp.

◆ map_ids

std::vector<MapEntry> map_ids

Definition at line 78 of file System.cpp.

◆ output_path

boost::filesystem::path output_path

Definition at line 85 of file System.cpp.

◆ PrintProgress

bool PrintProgress = true

Definition at line 83 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 135 of file System.cpp.