1 |
cycrow |
1 |
#ifndef __PACKAGES_H__
|
|
|
2 |
#define __PACKAGES_H__
|
|
|
3 |
|
|
|
4 |
#include "SpkFile.h"
|
|
|
5 |
#include "GameExe.h"
|
|
|
6 |
#include "XspFile.h"
|
|
|
7 |
#include "archive/unzip.h"
|
|
|
8 |
|
|
|
9 |
#include "MultiSpkFile.h"
|
|
|
10 |
#include "VirtualFileSystem.h"
|
|
|
11 |
|
93 |
cycrow |
12 |
#include "spkdefines.h"
|
1 |
cycrow |
13 |
|
|
|
14 |
class CFileIO;
|
|
|
15 |
|
93 |
cycrow |
16 |
namespace SPK {
|
|
|
17 |
class COriginalFiles;
|
|
|
18 |
}
|
1 |
cycrow |
19 |
|
93 |
cycrow |
20 |
using namespace SPK;
|
1 |
cycrow |
21 |
|
|
|
22 |
class SPKEXPORT CPackages
|
|
|
23 |
{
|
|
|
24 |
public:
|
220 |
cycrow |
25 |
static Utils::WString ConvertLanguage(int lang);
|
1 |
cycrow |
26 |
static SAvailablePackage *CreateAvailablePackageData(CBaseFile *package);
|
197 |
cycrow |
27 |
static Utils::WString FormatAvailablePackageData(CBaseFile *package);
|
|
|
28 |
static Utils::WString FormatAvailablePackageData(SAvailablePackage *package);
|
|
|
29 |
static Utils::WString CreateFromPackagerScript(CPackages *packages, const Utils::WString &filename);
|
|
|
30 |
static int GeneratePackageUpdateData(const Utils::WString &dir, bool includeSingle = true);
|
1 |
cycrow |
31 |
|
|
|
32 |
CPackages ();
|
|
|
33 |
~CPackages ();
|
|
|
34 |
|
212 |
cycrow |
35 |
bool isOldDir(const Utils::WString &dir);
|
197 |
cycrow |
36 |
bool read(const Utils::WString &dir, CProgressInfo *progress = NULL);
|
|
|
37 |
void startup(const Utils::WString &dir, const Utils::WString &tempDir, const Utils::WString &myDoc);
|
|
|
38 |
void startup(const Utils::WString &dir, const Utils::WString &tempDir, const Utils::WString &myDoc, const Utils::WString &mod);
|
1 |
cycrow |
39 |
|
221 |
cycrow |
40 |
bool extractAll(CBaseFile *baseFile, const Utils::WString &dir, int game, bool includedir = true, CProgressInfo *progress = NULL) const;
|
210 |
cycrow |
41 |
bool generatePackagerScript(CBaseFile *baseFile, bool wildcard, Utils::WStringList *list, int game, bool datafile = false) const;
|
197 |
cycrow |
42 |
CBaseFile *loadPackagerScript(const Utils::WString &filename, int compression, Utils::WString (*askFunc)(const Utils::WString &), Utils::WStringList *malformedLines = NULL, Utils::WStringList *unknownCommands = NULL, Utils::WStringList *variables = NULL, CProgressInfo *progress = NULL);
|
|
|
43 |
Utils::WStringList &getGlobals() { return _lGlobals; }
|
|
|
44 |
Utils::WStringList &getFakePatchOrder() { return _lFakePatchOrder; }
|
|
|
45 |
Utils::WString getCurrentDirectory() const;
|
|
|
46 |
static const Utils::WString &tempDirectory() { return m_sTempDir; }
|
|
|
47 |
const Utils::WString &myDocuments() { return m_sMyDoc; }
|
318 |
cycrow |
48 |
CGameExe* GetGameExe() { return &m_gameExe; }
|
|
|
49 |
const CGameExe* gameExe() const { return &m_gameExe; }
|
1 |
cycrow |
50 |
CLinkList<CBaseFile> *GetInstallPackageList() { return &m_lInstallList; }
|
|
|
51 |
|
|
|
52 |
// installing/uninstalling
|
197 |
cycrow |
53 |
bool installPackage(CBaseFile *package, Utils::WStringList *errors, CProgressInfo *progress = NULL, bool disabled = false);
|
318 |
cycrow |
54 |
CBaseFile *openPackage(const Utils::WString &file, int *error, CProgressInfo *progress = NULL, int readtype = SPKREAD_ALL, int flags = READFLAG_NONE) const;
|
197 |
cycrow |
55 |
CMultiSpkFile *openMultiPackage(const Utils::WString &file, int *error, CProgressInfo *progress = NULL);
|
|
|
56 |
bool openMultiPackage(const Utils::WString &file, CLinkList<CBaseFile> *packageList, int *error, CProgressInfo *progress = NULL );
|
1 |
cycrow |
57 |
int CheckInstallPackage(CBaseFile *package, int check = IC_ALL);
|
197 |
cycrow |
58 |
bool removeFile(C_File *file, Utils::WStringList *errors = NULL);
|
1 |
cycrow |
59 |
void PrepareUninstallPackage(CBaseFile *package);
|
197 |
cycrow |
60 |
bool uninstallPreparedPackages(Utils::WStringList *errors, CProgressInfo *progress, CLinkList<CBaseFile> *uninstalledPackages = NULL, CLinkList<CBaseFile> *disabledPackages = NULL);
|
318 |
cycrow |
61 |
void ConvertOldPackage(CBaseFile *p) const;
|
197 |
cycrow |
62 |
void purgeUninstallScripts(CBaseFile *package, Utils::WStringList *errors);
|
1 |
cycrow |
63 |
int PrepareInstallPackage(CBaseFile *package, bool disabled = false, bool force = false, int check = IC_ALL);
|
197 |
cycrow |
64 |
int installPreparedPackages(Utils::WStringList *errors, CProgressInfo *progress, CLinkList<CBaseFile> *errored, CLinkList<CBaseFile> *installedList = NULL);
|
1 |
cycrow |
65 |
void RemovePreparedInstall(CBaseFile *package);
|
|
|
66 |
int GetNumPackagesInQueue() { return m_lInstallList.size(); }
|
318 |
cycrow |
67 |
int checkOpenPackage(const Utils::WString &file, int* error) const;
|
133 |
cycrow |
68 |
bool findAllNeededDependacies(CBaseFile *p, const CLinkList<CBaseFile> &packages, CLinkList<CBaseFile> *foundPackages, bool onlyEnabled = false, bool includePrepared = false) const;
|
203 |
cycrow |
69 |
int getMissingDependacies(CBaseFile *p, Utils::WStringList *list, bool onlyEnabled = false, bool includePrepared = false);
|
170 |
cycrow |
70 |
size_t getDownloadableDependacies(CBaseFile* p, std::vector<const SAvailablePackage*>& list, bool onlyEnabled = false, bool includePrepared = false) const;
|
204 |
cycrow |
71 |
bool checkInstalledDependacy(const Utils::WString &name, const Utils::WString &author, const Utils::WString &version, bool onlyEnabled = false, bool includePerpered = false) const;
|
1 |
cycrow |
72 |
bool CheckEnabledDependacy(CBaseFile *p);
|
|
|
73 |
int GetDependacyList(CBaseFile *package, CLinkList<CBaseFile> *list);
|
221 |
cycrow |
74 |
int prepareMultiPackage(const Utils::WString &file, CLinkList<CBaseFile> *errorPackageList, int *error, CProgressInfo *progress = 0);
|
1 |
cycrow |
75 |
|
|
|
76 |
bool IsOldPluginManager() { return m_bOldPlugin; }
|
197 |
cycrow |
77 |
int findPackageFiles(CLinkList<CBaseFile> &packages, const Utils::WString &dir);
|
|
|
78 |
int findPackageDirectories(CLinkList<CBaseFile> &packages, const Utils::WString &dir);
|
|
|
79 |
int findAllPackages(CLinkList<CBaseFile> &packages, const Utils::WString &dir);
|
|
|
80 |
size_t updateFoundPackages(const Utils::WString& dir);
|
|
|
81 |
size_t addFoundPackages(const Utils::WString& dir);
|
1 |
cycrow |
82 |
|
|
|
83 |
// enable/disable
|
197 |
cycrow |
84 |
bool enablePackage(CBaseFile *package, Utils::WStringList *errors, CProgressInfo *progress = NULL );
|
|
|
85 |
bool disablePackage(CBaseFile *package, Utils::WStringList *errors, CProgressInfo *progress = NULL );
|
|
|
86 |
bool disablePreparedPackages(Utils::WStringList *errors, CProgressInfo *progress, CLinkList<CBaseFile> *disabledPackages = NULL );
|
|
|
87 |
bool enablePreparedPackages(Utils::WStringList* errors, CProgressInfo* progress, CLinkList<CBaseFile>* enabledPackages = NULL);
|
1 |
cycrow |
88 |
bool PrepareEnablePackage(CBaseFile *package);
|
|
|
89 |
bool PrepareDisablePackage(CBaseFile *package);
|
|
|
90 |
int GetNumPackagesInEnabledQueue() { return m_lEnableList.size(); }
|
|
|
91 |
int GetNumPackagesInDisabledQueue() { return m_lDisableList.size(); }
|
|
|
92 |
bool PrepareDisableForVanilla();
|
|
|
93 |
bool PrepareEnableLibrarys();
|
|
|
94 |
bool PrepareEnableFromVanilla();
|
|
|
95 |
|
|
|
96 |
void WriteData();
|
197 |
cycrow |
97 |
bool closeDir(Utils::WStringList *errors = 0, CProgressInfo *progress = NULL, bool removedir = false);
|
1 |
cycrow |
98 |
bool RestoreFakePatch();
|
|
|
99 |
bool ReadyFakePatch();
|
197 |
cycrow |
100 |
bool checkValidPluginManagerFile(const Utils::WString &filename) const;
|
|
|
101 |
bool checkIfPluginManagerFile(const Utils::WString &filename) const;
|
1 |
cycrow |
102 |
|
|
|
103 |
// package control
|
|
|
104 |
void UpdateUsedFiles(CLinkList<CBaseFile> *ignoreList = NULL, bool = true);
|
|
|
105 |
void UpdateSigned();
|
|
|
106 |
bool UpdatePackages(int doStatus = -1, bool individual = false);
|
217 |
cycrow |
107 |
CBaseFile *findXspPackage(const Utils::WString &id) const;
|
203 |
cycrow |
108 |
CBaseFile *findSpkPackage(const Utils::WString &name, const Utils::WString &author) const;
|
217 |
cycrow |
109 |
CArchiveFile *findArchivePackage(const Utils::WString &name) const;
|
197 |
cycrow |
110 |
CBaseFile* findPackage(const Utils::WString &name, const Utils::WString &author) const;
|
182 |
cycrow |
111 |
CBaseFile *findFirstPackageWithFile(C_File *f) const;
|
|
|
112 |
CBaseFile *findNextPackageWithFile(CBaseFile *p, C_File *f) const;
|
|
|
113 |
CBaseFile *findPackage(CBaseFile *package) const;
|
197 |
cycrow |
114 |
C_File *findFile(FileType filetype, const Utils::WString &filename, const Utils::WString &dir = Utils::WString::Null()) const;
|
1 |
cycrow |
115 |
CBaseFile *FirstPackage() { return m_lPackages.First(); }
|
|
|
116 |
CBaseFile *NextPackage() { return m_lPackages.Next(); }
|
|
|
117 |
CBaseFile *GetFirstPackage() { if ( m_lPackages.Front() ) return m_lPackages.Front()->Data(); return NULL; }
|
|
|
118 |
CBaseFile *GetNextPackage(CBaseFile *from)
|
|
|
119 |
{
|
|
|
120 |
bool found = false;
|
|
|
121 |
for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
|
|
|
122 |
{
|
|
|
123 |
if ( !node->Data() ) continue;
|
|
|
124 |
if ( node->Data() == from )
|
|
|
125 |
found = true;
|
|
|
126 |
else if ( found )
|
|
|
127 |
return node->Data();
|
|
|
128 |
}
|
|
|
129 |
return NULL;
|
|
|
130 |
}
|
|
|
131 |
void Reset();
|
|
|
132 |
CBaseFile *GetPackageAt(int i) { return m_lPackages[i]; }
|
197 |
cycrow |
133 |
Utils::WString selectedModName() const;
|
|
|
134 |
Utils::WString getModKey() const;
|
1 |
cycrow |
135 |
void SetupWares();
|
|
|
136 |
void SetupShips();
|
|
|
137 |
void PurgeGameObjects();
|
|
|
138 |
void PurgeWares();
|
|
|
139 |
void PurgeShips();
|
|
|
140 |
void StartPackage() { m_pPackageNode = m_lPackages.Front(); }
|
|
|
141 |
void UpdatePackage(CBaseFile *p);
|
|
|
142 |
CBaseFile *GetCurrentPackage() { return (m_pPackageNode) ? m_pPackageNode->Data() : NULL; }
|
|
|
143 |
bool RemoveCurrentDirectory();
|
|
|
144 |
void RemoveCreatedFiles();
|
|
|
145 |
bool AnyUnusedShared();
|
|
|
146 |
|
|
|
147 |
// util functions
|
197 |
cycrow |
148 |
void removeUnusedDirectories(const Utils::WStringList &dirs, Utils::WStringList* errors = NULL);
|
|
|
149 |
int removeUninstallScripts(Utils::WStringList *errors = 0, CProgressInfo *progress = NULL);
|
|
|
150 |
bool removeUninstallFile(C_File *file, Utils::WStringList *errors = 0);
|
|
|
151 |
int removeUnusedSharedFiles(Utils::WStringList *errors = 0, CProgressInfo *progress = NULL);
|
|
|
152 |
bool removeSharedFile(C_File *file, Utils::WStringList *errors = NULL);
|
|
|
153 |
void shufflePatchTo(C_File *file, int to, Utils::WStringList *errors);
|
|
|
154 |
void shuffleFakePatches(Utils::WStringList *errors);
|
|
|
155 |
void shuffleTextFiles(Utils::WStringList *errors);
|
|
|
156 |
int findNextFakePatch(int start = 0, const Utils::WString &dir = Utils::WString::Null()) const;
|
130 |
cycrow |
157 |
unsigned int findNextTextFile(unsigned int start = 4) const;
|
197 |
cycrow |
158 |
unsigned int findNextTextFile(const Utils::WString &dir, unsigned int start = 4) const;
|
|
|
159 |
int findLastFakePatch(int start = 99, const Utils::WString &dir = Utils::WString::Null()) const;
|
|
|
160 |
int findLastTextFile(int start = 9999, const Utils::WString &dir = Utils::WString::Null()) const;
|
1 |
cycrow |
161 |
int FindLowestFakePatchInstalled();
|
|
|
162 |
void ReadGameLanguage(bool force = true);
|
197 |
cycrow |
163 |
int removeAllPackages(Utils::WStringList *errors = NULL, CProgressInfo *progress = NULL);
|
1 |
cycrow |
164 |
void AssignPackageNumbers();
|
|
|
165 |
int GetChildPackages(CBaseFile *package, CLinkList<CBaseFile> *children, bool recursive = false);
|
|
|
166 |
int GetAllPackageFiles(CBaseFile *package, CLinkList<C_File> *fileList, bool includeChild);
|
|
|
167 |
int GetAllPackageFiles(CLinkList<CBaseFile> *list, CLinkList<C_File> *fileList, bool includeChild);
|
197 |
cycrow |
168 |
void addLogEntry(int type, const Utils::WString &args, Utils::WStringList* errors);
|
196 |
cycrow |
169 |
Utils::WString findDataDir(const Utils::WString &dir, const Utils::WString &file);
|
179 |
cycrow |
170 |
int countPackages(int type, bool onlyEnabled) const;
|
1 |
cycrow |
171 |
int CountBuiltInPackages(bool onlyEnabled);
|
197 |
cycrow |
172 |
bool isCurrentDir(const Utils::WString &dir) const;
|
1 |
cycrow |
173 |
bool CheckOtherPackage(CBaseFile *package);
|
|
|
174 |
int CheckPreparedInstallRequired(CLinkList<CBaseFile> *list);
|
197 |
cycrow |
175 |
static int ConvertWareType(wchar_t w);
|
|
|
176 |
static wchar_t ConvertWareTypeBack(int w);
|
|
|
177 |
Utils::WString logDirectory();
|
|
|
178 |
Utils::WString logDirectory(const Utils::WString &gameExe);
|
|
|
179 |
Utils::WString saveDirectory();
|
126 |
cycrow |
180 |
void backupSaves() { backupSaves(m_bVanilla); }
|
|
|
181 |
void backupSaves(bool vanilla);
|
|
|
182 |
void restoreSaves() { restoreSaves(m_bVanilla); }
|
|
|
183 |
void restoreSaves(bool vanilla);
|
197 |
cycrow |
184 |
bool unPackFile(const Utils::WString &filename, bool checkxml = true) const;
|
|
|
185 |
bool packFile(const Utils::WString &filename) const;
|
|
|
186 |
bool packFile(CFileIO* File, const Utils::WString &filename) const;
|
|
|
187 |
Utils::WString convertTextString(const Utils::WString &text);
|
1 |
cycrow |
188 |
void LoadVirtualFileSystem();
|
197 |
cycrow |
189 |
bool checkAccessRights(const Utils::WString &dir) const;
|
|
|
190 |
bool readTextPage(const Utils::WString &file, Utils::WStringList &list, bool search, int page) const;
|
217 |
cycrow |
191 |
size_t loadShipData(const Utils::WString& file, Utils::WStringList& list) const;
|
197 |
cycrow |
192 |
FileType adjustFileType(const Utils::WString &name, FileType filetype) const;
|
221 |
cycrow |
193 |
CXspFile *extractShip(const Utils::WString &sCatFile, const Utils::WString &sId, CProgressInfo *progress = NULL);
|
217 |
cycrow |
194 |
Utils::WString readShipData(const Utils::WString &file, const Utils::WString &entry) const;
|
182 |
cycrow |
195 |
bool isSamePackage(CBaseFile *p1, CBaseFile *p2) const;
|
203 |
cycrow |
196 |
void applyFakePatchOrder(const Utils::WStringList &list);
|
221 |
cycrow |
197 |
CBaseFile *createFromArchive(const Utils::WString &filename, bool toInstall = false) const;
|
182 |
cycrow |
198 |
void readArchiveData(const char *buf, size_t len, CBaseFile *archive) const;
|
221 |
cycrow |
199 |
void readArchiveData(const Utils::WString &filename, CBaseFile *archive) const;
|
197 |
cycrow |
200 |
size_t verifyInstalledFiles(Utils::WStringList *missingFiles = nullptr, bool getPackages = true) const;
|
|
|
201 |
Utils::WString empWaresForGame(size_t *maxsize = NULL);
|
88 |
cycrow |
202 |
void addEMPPriceOverride(int empId, int price);
|
|
|
203 |
void addEMPNotoOverride(int empId, int noto);
|
|
|
204 |
void addBuiltInWarePriceOverride(int empId, int price);
|
|
|
205 |
void addBuiltInWareNotoOverride(int empId, int noto);
|
197 |
cycrow |
206 |
void addCustomWarePriceOverride(const Utils::WString &id, int price);
|
|
|
207 |
void addCustomWareNotoOverride(const Utils::WString &id, int noto);
|
1 |
cycrow |
208 |
|
|
|
209 |
int GetCurrentGameFlags() { return m_iGameFlags; }
|
|
|
210 |
|
197 |
cycrow |
211 |
void setCurrentDir(const Utils::WString &dir);
|
1 |
cycrow |
212 |
|
|
|
213 |
// merge mods
|
197 |
cycrow |
214 |
void getMergedFiles(Utils::WStringList &list, CCatFile *cat1, CCatFile *cat2) const;
|
|
|
215 |
bool canWeMerge(const Utils::WString &file) const;
|
|
|
216 |
bool mergeMods(CCatFile *mod1, CCatFile *mod2, const Utils::WString &outFile, Utils::WStringList *cantMerge) const;
|
|
|
217 |
bool needToMerge(const Utils::WString &file) const;
|
|
|
218 |
bool getModCompatabilityList(C_File *file, Utils::WStringList *list = NULL) const;
|
|
|
219 |
bool checkCompatabilityBetweenModFiles(C_File *from, C_File *to, Utils::WStringList *list = NULL) const;
|
|
|
220 |
bool checkCompatabilityBetweenMods(CBaseFile *from, CBaseFile *to, Utils::WStringList *list = NULL) const;
|
|
|
221 |
int checkCompatabilityAgainstPackages(CBaseFile *newFile, Utils::WStringList *list = NULL, CLinkList<CBaseFile> *packages = NULL) const;
|
1 |
cycrow |
222 |
|
220 |
cycrow |
223 |
Utils::WString getLanguageName() const;
|
182 |
cycrow |
224 |
int getGameLanguage() const;
|
197 |
cycrow |
225 |
int getGameLanguage(const Utils::WString &dir) const;
|
|
|
226 |
int getGameAddons(Utils::WStringList &exes) const;
|
|
|
227 |
int getGameAddons(Utils::WStringList &exes, const Utils::WString &dir) const;
|
|
|
228 |
Utils::WString getGameName() const;
|
|
|
229 |
Utils::WString getGameName(const Utils::WString &dir) const;
|
|
|
230 |
Utils::WString getGameVersionFromType(int game, int version, const Utils::WString &sVersion) const;
|
|
|
231 |
Utils::WString getGameNameFromType(int game) const;
|
|
|
232 |
Utils::WString getGameTypesString(CBaseFile *package, bool includeVersion) const;
|
|
|
233 |
Utils::WString getGameVersionString(CBaseFile *package) const;
|
|
|
234 |
Utils::WString getGameRunExe(const Utils::WString &dir) const;
|
|
|
235 |
Utils::WString getGameRunExe() const;
|
|
|
236 |
Utils::WString getProperDir() const;
|
|
|
237 |
Utils::WString getProperDir(const Utils::WString &dir) const;
|
|
|
238 |
Utils::WString getAddonDir() const;
|
|
|
239 |
Utils::WString getAddonDir(const Utils::WString &dir) const;
|
1 |
cycrow |
240 |
|
|
|
241 |
// text files
|
197 |
cycrow |
242 |
void CreateLanguageTextFiles(Utils::WStringList *errors = 0);
|
|
|
243 |
bool renameTextFile(const Utils::WString &textid, int languageid, Utils::WStringList *errors);
|
|
|
244 |
void addTextFileToScripts(C_File *file, const Utils::WString &textid);
|
1 |
cycrow |
245 |
void CreatePluginManagerText();
|
87 |
cycrow |
246 |
void createPluginManagerOpenText();
|
1 |
cycrow |
247 |
|
|
|
248 |
// game control
|
221 |
cycrow |
249 |
void createEMPFile(const Utils::WString &progDir = Utils::WString::Null());
|
1 |
cycrow |
250 |
void CreateWareFiles();
|
197 |
cycrow |
251 |
int extractGameFile(const Utils::WString &aFilename, const Utils::WString &aTo, const Utils::WString &dir = Utils::WString::Null(), const Utils::WString &addon = Utils::WString::Null()) const;
|
1 |
cycrow |
252 |
void CreateDummies();
|
|
|
253 |
void CreateComponants();
|
|
|
254 |
void CreateCutData();
|
|
|
255 |
void CreateBodies();
|
|
|
256 |
void CreateGlobals();
|
|
|
257 |
void CreateAnimations();
|
|
|
258 |
void CreateTShips();
|
|
|
259 |
void CreateCustomStarts();
|
197 |
cycrow |
260 |
void addCreatedFile(const Utils::WString &file);
|
88 |
cycrow |
261 |
|
197 |
cycrow |
262 |
bool readGlobals(Utils::WStringList &globals) const;
|
89 |
cycrow |
263 |
bool readWares(int iLang, CLinkList<SWareEntry> &list);
|
|
|
264 |
bool readCommands(int iLang, CLinkList<SCommandSlot> &list);
|
|
|
265 |
bool readWingCommands(int iLang, CLinkList<SCommandSlot> &list);
|
88 |
cycrow |
266 |
int empOveridePrice(int id);
|
|
|
267 |
bool empOverideNoto(int id, int *noto);
|
|
|
268 |
int builtInWareOveridePrice(int id);
|
|
|
269 |
bool builtInWareOverideNoto(int id, int *noto);
|
197 |
cycrow |
270 |
int customWareOveridePrice(const Utils::WString &id);
|
|
|
271 |
bool customWareOverideNoto(const Utils::WString &id, int *noto);
|
88 |
cycrow |
272 |
void removeEmpOverride(int pos);
|
|
|
273 |
void removeBuiltinWareOverride(int pos);
|
197 |
cycrow |
274 |
void removeCustomWareOverride(const Utils::WString &id);
|
1 |
cycrow |
275 |
|
|
|
276 |
// install text
|
206 |
cycrow |
277 |
Utils::WString getInstallBeforeText(CBaseFile *package) const;
|
|
|
278 |
Utils::WString getInstallAfterText(CBaseFile *package) const;
|
|
|
279 |
Utils::WString getUninstallBeforeText(CBaseFile *package) const;
|
|
|
280 |
Utils::WString getUninstallAfterText(CBaseFile *package) const;
|
1 |
cycrow |
281 |
|
|
|
282 |
//setting functions
|
|
|
283 |
void SetRenameText(bool b) { m_bRenameText = b; }
|
|
|
284 |
void SetLanguage(int i) { m_iLanguage = i; }
|
|
|
285 |
void SetAutoEnable(bool b) { m_bAutoEnableChild = b; }
|
|
|
286 |
void SetForceModInstall(bool b) { m_bForceModInstall = b; }
|
197 |
cycrow |
287 |
void setTempDirectory(const Utils::WString &s) { m_sTempDir = s; }
|
|
|
288 |
void setMyDocuments(const Utils::WString &s) { m_sMyDoc = s; }
|
1 |
cycrow |
289 |
void SetForceEMP(bool b) { m_bForceEMP = b; }
|
|
|
290 |
void SetSurpressProtectedWarning(bool b) { m_bSurpressProtectedWarning = b; }
|
|
|
291 |
void SurpressProtectedWarning() { m_bSurpressProtectedWarning = true; }
|
|
|
292 |
bool IsSupressProtectedWarning() { return m_bSurpressProtectedWarning; }
|
|
|
293 |
|
331 |
cycrow |
294 |
int language() const { return m_iLanguage; }
|
1 |
cycrow |
295 |
int GetLanguage() { return m_iLanguage; }
|
|
|
296 |
int GetGame() { return m_iGame; }
|
|
|
297 |
bool IsLoaded() { return m_bLoaded; }
|
|
|
298 |
bool IsVanilla() { return m_bVanilla; }
|
|
|
299 |
void SetVanilla(bool b);
|
|
|
300 |
|
197 |
cycrow |
301 |
const Utils::WString &getMod() const { return m_sSetMod; }
|
|
|
302 |
void setMod(const Utils::WString& mod);
|
126 |
cycrow |
303 |
void setSaveGameManager(bool managed);
|
1 |
cycrow |
304 |
|
|
|
305 |
CBaseFile *GetEnabledMod() { return m_pEnabledMod; }
|
|
|
306 |
|
|
|
307 |
//errors
|
|
|
308 |
void ClearError() { m_iError = PKERR_NONE; }
|
|
|
309 |
int GetError() { return m_iError; }
|
|
|
310 |
|
164 |
cycrow |
311 |
CLinkList<CBaseFile>* PackageList() { return &m_lPackages; }
|
331 |
cycrow |
312 |
const CLinkList<CBaseFile>* packageList() const { return &m_lPackages; }
|
161 |
cycrow |
313 |
CLinkList<SAvailablePackage> *getAvailablePackageList() { return &m_lAvailablePackages; }
|
164 |
cycrow |
314 |
CLinkList<CBaseFile>* getFoundPackageList() { return &m_lFoundPackages; }
|
1 |
cycrow |
315 |
bool AnyAvailablePackages(int type = -1);
|
161 |
cycrow |
316 |
bool addAvailablePackage(SAvailablePackage *package);
|
166 |
cycrow |
317 |
void saveAvailablePackages();
|
|
|
318 |
void readAvailablePackages();
|
197 |
cycrow |
319 |
void parseAvailablePackage(const Utils::WString &str, const Utils::WString &webaddress = Utils::WString::Null());
|
|
|
320 |
const SAvailablePackage* findAvailablePackage(const Utils::WString& filename) const;
|
|
|
321 |
const SAvailablePackage* findAvailablePackage(const Utils::WString& name, const Utils::WString& author) const;
|
|
|
322 |
CBaseFile* findFoundPackage(const Utils::WString& name, const Utils::WString& author) const;
|
205 |
cycrow |
323 |
int findAllServers(Utils::WStringList *list) const;
|
1 |
cycrow |
324 |
|
221 |
cycrow |
325 |
CBaseFile *findScriptByAuthor(const Utils::WString &author, CBaseFile *prev = NULL);
|
1 |
cycrow |
326 |
void RemoveFailedFiles();
|
|
|
327 |
|
|
|
328 |
private:
|
248 |
cycrow |
329 |
void _processAddPackage(CBaseFile* p);
|
216 |
cycrow |
330 |
size_t _createCockpits(Utils::WStringList &list);
|
179 |
cycrow |
331 |
|
85 |
cycrow |
332 |
bool _checkForDisable(CBaseFile *package, bool disabled, CBaseFile *oldPackage);
|
221 |
cycrow |
333 |
CBaseFile *_archive_fromRar(const Utils::WString &filename, bool toInstall) const;
|
271 |
cycrow |
334 |
CBaseFile* _archive_fromZip(const Utils::WString& filename, bool toInstall) const;
|
|
|
335 |
bool _check_archive_fromZip(const Utils::WString& filename) const;
|
50 |
cycrow |
336 |
void _addToFakePatch(CBaseFile *pPackage);
|
56 |
cycrow |
337 |
int _gameTextNumber() const;
|
197 |
cycrow |
338 |
void _addWareOverride(enum WareTypes type, int pos, const Utils::WString &id, int value, bool noto);
|
|
|
339 |
int _warePriceOverride(enum WareTypes type, int pos, const Utils::WString &id);
|
|
|
340 |
bool _wareNotoOverride(enum WareTypes type, int pos, const Utils::WString &id, int *noto);
|
|
|
341 |
void _removeWareOverride(enum WareTypes type, int pos, const Utils::WString &id);
|
43 |
cycrow |
342 |
|
|
|
343 |
private:
|
197 |
cycrow |
344 |
Utils::WString m_sCurrentDir;
|
|
|
345 |
static Utils::WString m_sTempDir;
|
|
|
346 |
Utils::WString m_sMyDoc;
|
|
|
347 |
Utils::WString m_sSetMod;
|
|
|
348 |
Utils::WString _sSaveDir;
|
125 |
cycrow |
349 |
GameDirectory *_pCurrentDir;
|
1 |
cycrow |
350 |
|
|
|
351 |
// global files list
|
|
|
352 |
CLinkList<C_File> m_lFiles;
|
|
|
353 |
CLinkList<CBaseFile> m_lPackages;
|
|
|
354 |
CLinkList<C_File> m_lUninstallFiles;
|
|
|
355 |
CLinkList<SGameWare> m_lGameWares[WAREBUFFERS];
|
|
|
356 |
CLinkList<SGameShip> m_lGameShips;
|
88 |
cycrow |
357 |
CLinkList<SWarePriceOverride> m_lWarePrices;
|
164 |
cycrow |
358 |
CLinkList<CBaseFile> m_lFoundPackages;
|
93 |
cycrow |
359 |
COriginalFiles *_pOriginalFiles;
|
1 |
cycrow |
360 |
|
|
|
361 |
// prepared lists
|
|
|
362 |
CLinkList<CBaseFile> m_lInstallList; // install/uninstalling packages
|
|
|
363 |
CLinkList<CBaseFile> m_lEnableList; // enable packages
|
|
|
364 |
CLinkList<CBaseFile> m_lDisableList; // disable packages
|
|
|
365 |
|
197 |
cycrow |
366 |
Utils::WStringList _lCreatedFiles; // list of files we've created
|
|
|
367 |
Utils::WStringList _lNonRemovedFiles; // list of fiels that couldn't be removed for some reason
|
|
|
368 |
Utils::WStringList _lGlobals; // global settigns that we want changed
|
|
|
369 |
Utils::WStringList _lFakePatchOrder; // ordered fake patches
|
1 |
cycrow |
370 |
CLinkList<SAvailablePackage> m_lAvailablePackages; // list of available packages online
|
|
|
371 |
|
|
|
372 |
CVirtualFileSystem m_pGameVFS; // Games Virtual File System
|
|
|
373 |
|
|
|
374 |
CGameExe m_gameExe;
|
56 |
cycrow |
375 |
SGameExe *m_pCurrentGameExe;
|
1 |
cycrow |
376 |
CBaseFile *m_pEnabledMod;
|
|
|
377 |
|
|
|
378 |
// settings
|
|
|
379 |
bool m_bRenameText; // rename text files
|
|
|
380 |
bool m_bAutoEnableChild; // auto enable all children
|
|
|
381 |
bool m_bForceModInstall; // allowsm ultiple mods to be installed
|
|
|
382 |
bool m_bOldPlugin; // if its loading data from the old plugin manager
|
|
|
383 |
bool m_bLoadVFS; // if we should load the virtual filesystem
|
|
|
384 |
int m_iLanguage; // Language id to use
|
|
|
385 |
int m_iSaveGameManager; // Save game manager
|
|
|
386 |
bool m_bSurpressProtectedWarning; // prevent checking for protected directory
|
|
|
387 |
|
|
|
388 |
int m_iGame; // the game the directory is
|
|
|
389 |
int m_iGameVersion; // the version of the game (version position)
|
197 |
cycrow |
390 |
Utils::WString _sGameVersion; // the version of the game (full version)
|
1 |
cycrow |
391 |
int m_iGameFlags; // the flags for the game from SGameExe
|
|
|
392 |
int m_iMaxPatch; // the maximum patch for the game
|
|
|
393 |
|
|
|
394 |
int m_iSaveGame;
|
|
|
395 |
int m_iError;
|
|
|
396 |
int m_iLastUpdated;
|
|
|
397 |
int m_iFakePatch; // The current fake patch
|
|
|
398 |
|
|
|
399 |
bool m_bVanilla; // currently in vanilla mode, dont allow unsigned packages to be installed
|
|
|
400 |
|
|
|
401 |
bool m_bLoaded;
|
|
|
402 |
bool m_bRedo;
|
|
|
403 |
bool m_bUsedWare; // if we have used the ware files in the directory, not in a patch
|
|
|
404 |
bool m_bRemoveDir; // shall we remove direcotires;
|
|
|
405 |
|
|
|
406 |
int m_iWareBuffer[WAREBUFFERS]; //Ware Buffers
|
|
|
407 |
int m_iShipBuffer; //Ship Buffers
|
|
|
408 |
|
|
|
409 |
bool m_bDisableVanilla;
|
|
|
410 |
bool m_bForceEMP;
|
|
|
411 |
|
|
|
412 |
CListNode<CBaseFile> *m_pPackageNode;
|
|
|
413 |
};
|
|
|
414 |
|
|
|
415 |
#endif // __PACKAGES_H__
|