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