1 |
cycrow |
1 |
#pragma once
|
|
|
2 |
|
|
|
3 |
#include "File.h"
|
197 |
cycrow |
4 |
#include "Utils/WString.h"
|
1 |
cycrow |
5 |
#include <map>
|
|
|
6 |
|
35 |
cycrow |
7 |
class CBaseFile;
|
|
|
8 |
class CXspFile;
|
|
|
9 |
|
94 |
cycrow |
10 |
namespace Utils {
|
197 |
cycrow |
11 |
class WStringList;
|
94 |
cycrow |
12 |
}
|
35 |
cycrow |
13 |
namespace SPK {
|
94 |
cycrow |
14 |
class CTextDB;
|
35 |
cycrow |
15 |
|
1 |
cycrow |
16 |
tclass CVirtualFileSystem
|
|
|
17 |
{
|
|
|
18 |
public:
|
285 |
cycrow |
19 |
typedef std::map<std::wstring, Utils::WString> FileList;
|
|
|
20 |
typedef std::map<std::wstring, Utils::WString>::iterator FileListItr;
|
35 |
cycrow |
21 |
|
|
|
22 |
private:
|
274 |
cycrow |
23 |
Utils::WStringList *_lAddons;
|
197 |
cycrow |
24 |
Utils::WString m_sAddon;
|
|
|
25 |
Utils::WString m_sDir;
|
35 |
cycrow |
26 |
bool m_bLoaded;
|
|
|
27 |
|
|
|
28 |
FileList *m_pModMap;
|
|
|
29 |
FileList *m_pMap;
|
|
|
30 |
|
|
|
31 |
CTextDB *m_pTexts;
|
|
|
32 |
CTextDB *m_pModTexts;
|
|
|
33 |
|
197 |
cycrow |
34 |
Utils::WStringList *_lShips;
|
|
|
35 |
Utils::WStringList *_lShields;
|
|
|
36 |
Utils::WStringList *_lLasers;
|
|
|
37 |
Utils::WStringList *_lMissiles;
|
|
|
38 |
Utils::WStringList *_lCockpits;
|
|
|
39 |
Utils::WStringList *_lComponentSections;
|
|
|
40 |
Utils::WStringList *_lDummySections;
|
|
|
41 |
Utils::WStringList *_lBodiesSections;
|
94 |
cycrow |
42 |
|
35 |
cycrow |
43 |
int m_iLang;
|
|
|
44 |
|
|
|
45 |
public:
|
1 |
cycrow |
46 |
CVirtualFileSystem(void);
|
|
|
47 |
~CVirtualFileSystem(void);
|
|
|
48 |
|
101 |
cycrow |
49 |
// setters
|
197 |
cycrow |
50 |
void setAddon(const Utils::WString &addon);
|
101 |
cycrow |
51 |
void setLanguage(int iLang);
|
1 |
cycrow |
52 |
|
101 |
cycrow |
53 |
// extractions
|
35 |
cycrow |
54 |
void extractTexts(CXspFile *pPackage, int textId);
|
197 |
cycrow |
55 |
C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::WString &sFile, FileType iFileType, const Utils::WString &sTo);
|
|
|
56 |
C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::WString &sFile, FileType iFileType);
|
|
|
57 |
Utils::WString extractGameFile(const Utils::WString &file, const Utils::WString &to);
|
101 |
cycrow |
58 |
|
|
|
59 |
// loading
|
197 |
cycrow |
60 |
bool LoadFilesystem(const Utils::WString &dir, int maxPatch = 0);
|
|
|
61 |
bool LoadFilesystem(const Utils::WString &dir, const Utils::WString &mod, int maxPatch = 0);
|
|
|
62 |
bool loadMod(const Utils::WString &mod);
|
|
|
63 |
bool addMod(const Utils::WString &mod);
|
101 |
cycrow |
64 |
|
|
|
65 |
// getters
|
197 |
cycrow |
66 |
const Utils::WString &directory() const;
|
|
|
67 |
bool isFileAvailable(const Utils::WString &file) const;
|
|
|
68 |
Utils::WString getTShipsEntry(const Utils::WString &sId);
|
|
|
69 |
Utils::WString findText(int iLang, int iPage, int iID) const;
|
101 |
cycrow |
70 |
bool textExists(int iLang, int iPage, int iID) const;
|
|
|
71 |
bool isTextUpdated() const;
|
35 |
cycrow |
72 |
|
101 |
cycrow |
73 |
// Updates
|
35 |
cycrow |
74 |
void updateModTexts(int iPage);
|
|
|
75 |
void updateModTexts(int iFromPage, int iToPage);
|
|
|
76 |
void updateTexts(int iPage);
|
|
|
77 |
void updateTexts(int iFromPage, int iToPage);
|
|
|
78 |
|
78 |
cycrow |
79 |
void clearMods(bool bIncludeStandard = false);
|
35 |
cycrow |
80 |
|
101 |
cycrow |
81 |
// Iterators
|
197 |
cycrow |
82 |
Utils::WStringList *getTShipsEntries();
|
|
|
83 |
Utils::WString firstShield();
|
|
|
84 |
Utils::WString nextShield();
|
|
|
85 |
Utils::WString firstComponentSection();
|
|
|
86 |
Utils::WString nextComponentSection();
|
|
|
87 |
Utils::WString firstDummySection();
|
|
|
88 |
Utils::WString nextDummySection();
|
|
|
89 |
Utils::WString firstBodiesSection();
|
|
|
90 |
Utils::WString nextBodiesSection();
|
|
|
91 |
std::pair<Utils::WString, Utils::WString> firstLaser();
|
|
|
92 |
std::pair<Utils::WString, Utils::WString> nextLaser();
|
|
|
93 |
std::pair<Utils::WString, Utils::WString> firstMissile();
|
|
|
94 |
std::pair<Utils::WString, Utils::WString> nextMissile();
|
|
|
95 |
Utils::WString firstCockpit();
|
|
|
96 |
Utils::WString nextCockpit();
|
94 |
cycrow |
97 |
|
114 |
cycrow |
98 |
///////////////////////////////////////////////////////////////
|
|
|
99 |
// Debug Functions
|
197 |
cycrow |
100 |
void DEBUG_LogContents(const Utils::WString &sFile);
|
114 |
cycrow |
101 |
|
1 |
cycrow |
102 |
private:
|
35 |
cycrow |
103 |
void _updateTexts(int iFromPage, int iToPage, FileList *pFileList, CTextDB *pTextList);
|
197 |
cycrow |
104 |
Utils::WString _convertExtension(const Utils::WString &sFile) const;
|
35 |
cycrow |
105 |
void _clear();
|
197 |
cycrow |
106 |
void _addFile(const Utils::WString &sFile, const Utils::WString &sDest, FileList *pList);
|
|
|
107 |
void _addModFile(const Utils::WString &sFile, const Utils::WString &sMod, FileList *pList);
|
|
|
108 |
Utils::WString _findFile(const Utils::WString &file) const;
|
|
|
109 |
void _addDir(const Utils::WString &sStart, const Utils::WString &sDir);
|
|
|
110 |
Utils::WString _extractFromCat(const Utils::WString &sCat, const Utils::WString &sFile, const Utils::WString &sTo);
|
|
|
111 |
Utils::WString _extract(const Utils::WString &sFile, const Utils::WString &sTo);
|
94 |
cycrow |
112 |
|
197 |
cycrow |
113 |
Utils::WStringList *_updateList(const Utils::WString &typesFile, int iTextPos);
|
94 |
cycrow |
114 |
void _updateShields();
|
|
|
115 |
void _updateLasers();
|
|
|
116 |
void _updateMissiles();
|
|
|
117 |
void _updateCockpits();
|
|
|
118 |
void _updateComponentSections();
|
|
|
119 |
void _updateDummySections();
|
|
|
120 |
void _updateBodiesSections();
|
101 |
cycrow |
121 |
void _updateShips();
|
94 |
cycrow |
122 |
|
197 |
cycrow |
123 |
Utils::WString _returnText(Utils::WStringNode *s);
|
|
|
124 |
Utils::WString _returnID(Utils::WStringNode *s);
|
|
|
125 |
Utils::WString _returnLine(Utils::WStringNode *s);
|
|
|
126 |
std::pair<Utils::WString, Utils::WString> _returnPair(Utils::WStringNode *s);
|
|
|
127 |
Utils::WStringList *_updateSectionList(const Utils::WString &sFile, bool singleEntry);
|
114 |
cycrow |
128 |
|
197 |
cycrow |
129 |
void _removeSameFile(const Utils::WString &sFile, const Utils::WString &sDest, const Utils::WString &ext, FileList *pList);
|
114 |
cycrow |
130 |
|
35 |
cycrow |
131 |
};
|
1 |
cycrow |
132 |
|
35 |
cycrow |
133 |
}
|