TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RootHandler.h
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* RootHandler.h Copyright (c) Ladislav Zezula 2015 */
3 /*---------------------------------------------------------------------------*/
4 /* Interface for root handlers */
5 /*---------------------------------------------------------------------------*/
6 /* Date Ver Who Comment */
7 /* -------- ---- --- ------- */
8 /* 09.03.15 1.00 Lad Created */
9 /*****************************************************************************/
10 
11 #ifndef __ROOT_HANDLER_H__
12 #define __ROOT_HANDLER_H__
13 
14 //-----------------------------------------------------------------------------
15 // Defines
16 
17 #define CASC_MNDX_ROOT_SIGNATURE 0x58444E4D // 'MNDX'
18 #define CASC_DIABLO3_ROOT_SIGNATURE 0x8007D0C4
19 #define CASC_OVERWATCH_ROOT_SIGNATURE 0x35444D23 // '#MD5'
20 
21 #define ROOT_FLAG_HAS_NAMES 0x00000001 // The root file contains file names
22 
23 #define DUMP_LEVEL_ROOT_FILE 1 // Dump root file
24 #define DUMP_LEVEL_ENCODING_FILE 2 // Dump root file + encoding file
25 #define DUMP_LEVEL_INDEX_ENTRIES 3 // Dump root file + encoding file + index entries
26 
27 //-----------------------------------------------------------------------------
28 // Root file function prototypes
29 
30 typedef int (*ROOT_INSERT)(
31  struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
32  const char * szFileName, // Pointer to the file name
33  LPBYTE pbEncodingKey // Pointer to the encoding key of the file name
34  );
35 
36 typedef LPBYTE (*ROOT_SEARCH)(
37  struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
38  struct _TCascSearch * pSearch, // Pointer to the initialized search structure
39  PDWORD PtrFileSize, // Pointer to receive file size (optional)
40  PDWORD PtrLocaleFlags // Pointer to receive locale flags (optional)
41  );
42 
43 typedef void (*ROOT_ENDSEARCH)(
44  struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
45  struct _TCascSearch * pSearch // Pointer to the initialized search structure
46  );
47 
48 typedef LPBYTE (*ROOT_GETKEY)(
49  struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
50  const char * szFileName // Pointer to the name of a file
51  );
52 
53 typedef void (*ROOT_DUMP)(
54  struct _TCascStorage * hs, // Pointer to the open storage
55  TDumpContext * dc, // Opened dump context
56  LPBYTE pbRootHandler, // Pointer to the loaded ROOT file
57  DWORD cbRootHandler, // Length of the loaded ROOT file
58  const TCHAR * szListFile,
59  int nDumpLevel
60  );
61 
62 typedef void (*ROOT_CLOSE)(
63  struct TRootHandler * pRootHandler // Pointer to an initialized root handler
64  );
65 
67 {
68  ROOT_INSERT Insert; // Inserts an existing file name
69  ROOT_SEARCH Search; // Performs the root file search
70  ROOT_ENDSEARCH EndSearch; // Performs cleanup after searching
71  ROOT_GETKEY GetKey; // Retrieves encoding key for a file name
73  ROOT_CLOSE Close; // Closing the root file
74 
75  DWORD dwRootFlags; // Root flags - see the ROOT_FLAG_XXX
76 };
77 
78 //-----------------------------------------------------------------------------
79 // Public functions
80 
81 int RootHandler_Insert(TRootHandler * pRootHandler, const char * szFileName, LPBYTE pbEncodingKey);
82 LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags);
83 void RootHandler_EndSearch(TRootHandler * pRootHandler, struct _TCascSearch * pSearch);
84 LPBYTE RootHandler_GetKey(TRootHandler * pRootHandler, const char * szFileName);
85 void RootHandler_Dump(struct _TCascStorage * hs, LPBYTE pbRootHandler, DWORD cbRootHandler, const TCHAR * szNameFormat, const TCHAR * szListFile, int nDumpLevel);
86 void RootHandler_Close(TRootHandler * pRootHandler);
87 
88 #endif // __ROOT_HANDLER_H__
LPBYTE RootHandler_GetKey(TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.cpp:44
DWORD * PDWORD
Definition: CascPort.h:151
LPBYTE(* ROOT_SEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.h:36
DWORD dwRootFlags
Definition: RootHandler.h:75
Definition: RootHandler.h:66
ROOT_GETKEY GetKey
Definition: RootHandler.h:71
ROOT_DUMP Dump
Definition: RootHandler.h:72
ROOT_INSERT Insert
Definition: RootHandler.h:68
void(* ROOT_ENDSEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.h:43
char TCHAR
Definition: CascPort.h:148
LPBYTE(* ROOT_GETKEY)(struct TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.h:48
BYTE * LPBYTE
Definition: CascPort.h:152
Definition: DumpContext.h:21
void RootHandler_Dump(struct _TCascStorage *hs, LPBYTE pbRootHandler, DWORD cbRootHandler, const TCHAR *szNameFormat, const TCHAR *szListFile, int nDumpLevel)
Definition: RootHandler.cpp:53
Definition: CascCommon.h:186
void RootHandler_Close(TRootHandler *pRootHandler)
Definition: RootHandler.cpp:71
ROOT_SEARCH Search
Definition: RootHandler.h:69
Definition: CascCommon.h:261
ROOT_ENDSEARCH EndSearch
Definition: RootHandler.h:70
unsigned int DWORD
Definition: CascPort.h:139
int(* ROOT_INSERT)(struct TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.h:30
LPBYTE RootHandler_Search(TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.cpp:26
void(* ROOT_CLOSE)(struct TRootHandler *pRootHandler)
Definition: RootHandler.h:62
void(* ROOT_DUMP)(struct _TCascStorage *hs, TDumpContext *dc, LPBYTE pbRootHandler, DWORD cbRootHandler, const TCHAR *szListFile, int nDumpLevel)
Definition: RootHandler.h:53
ROOT_CLOSE Close
Definition: RootHandler.h:73
int RootHandler_Insert(TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.cpp:18
void RootHandler_EndSearch(TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.cpp:35