Subversion Repositories spk

Rev

Rev 158 | Rev 161 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 158 Rev 160
Line 26... Line 26...
26
	static Utils::String ConvertLanguage(int lang);
26
	static Utils::String ConvertLanguage(int lang);
27
	static SAvailablePackage *CreateAvailablePackageData(CBaseFile *package);
27
	static SAvailablePackage *CreateAvailablePackageData(CBaseFile *package);
28
	static Utils::String FormatAvailablePackageData(CBaseFile *package);
28
	static Utils::String FormatAvailablePackageData(CBaseFile *package);
29
	static Utils::String FormatAvailablePackageData(SAvailablePackage *package);
29
	static Utils::String FormatAvailablePackageData(SAvailablePackage *package);
30
	static Utils::String CreateFromPackagerScript(CPackages *packages, const Utils::String &filename);
30
	static Utils::String CreateFromPackagerScript(CPackages *packages, const Utils::String &filename);
31
	static int GeneratePackageUpdateData(CyString dir, bool includeSingle = true);
31
	static int GeneratePackageUpdateData(const Utils::String &dir, bool includeSingle = true);
32
 
32
 
33
	CPackages ();
33
	CPackages ();
34
	~CPackages ();
34
	~CPackages ();
35
 
35
 
36
	bool isOldDir(const Utils::String &dir);
36
	bool isOldDir(const Utils::String &dir);
Line 40... Line 40...
40
	void startup(const Utils::String &dir, const Utils::String &tempDir, const Utils::String &myDoc, const Utils::String &mod);
40
	void startup(const Utils::String &dir, const Utils::String &tempDir, const Utils::String &myDoc, const Utils::String &mod);
41
 
41
 
42
	bool extractAll(CBaseFile *baseFile, const Utils::String &dir, int game, bool includedir = true, CProgressInfo *progress = NULL) const;
42
	bool extractAll(CBaseFile *baseFile, const Utils::String &dir, int game, bool includedir = true, CProgressInfo *progress = NULL) const;
43
	bool generatePackagerScript(CBaseFile *baseFile, bool wildcard, Utils::CStringList *list, int game, bool datafile = false) const;
43
	bool generatePackagerScript(CBaseFile *baseFile, bool wildcard, Utils::CStringList *list, int game, bool datafile = false) const;
44
	CBaseFile *LoadPackagerScript(const Utils::String &filename, int compression, Utils::String (*askFunc)(const Utils::String &), Utils::CStringList *malformedLines = NULL, Utils::CStringList *unknownCommands = NULL, Utils::CStringList *variables = NULL, CProgressInfo *progress = NULL);
44
	CBaseFile *LoadPackagerScript(const Utils::String &filename, int compression, Utils::String (*askFunc)(const Utils::String &), Utils::CStringList *malformedLines = NULL, Utils::CStringList *unknownCommands = NULL, Utils::CStringList *variables = NULL, CProgressInfo *progress = NULL);
45
	CyStringList *GetGlobals() { return &m_lGlobals; }
45
	Utils::CStringList &GetGlobals() { return m_lGlobals; }
46
	CyStringList *GetFakePatchOrder() { return &m_lFakePatchOrder; }
46
	Utils::CStringList &GetFakePatchOrder() { return m_lFakePatchOrder; }
47
	Utils::String getCurrentDirectory() const;
47
	Utils::String getCurrentDirectory() const;
48
	//static CyString GetTempDirectory() { return m_sTempDir; }
-
 
49
	static const Utils::String &tempDirectory() { return m_sTempDir; }
48
	static const Utils::String &tempDirectory() { return m_sTempDir; }
50
	CyString GetMyDocuments() { return m_sMyDoc; }
-
 
51
	const Utils::String &myDocuments() { return m_sMyDoc; }
49
	const Utils::String &myDocuments() { return m_sMyDoc; }
52
	CGameExe *GetGameExe() { return &m_gameExe; }
50
	CGameExe *GetGameExe() { return &m_gameExe; }
53
	CLinkList<CBaseFile> *GetInstallPackageList() { return &m_lInstallList; }
51
	CLinkList<CBaseFile> *GetInstallPackageList() { return &m_lInstallList; }
54
 
52
 
55
	// installing/uninstalling
53
	// installing/uninstalling
Line 107... Line 105...
107
	bool UpdatePackages(int doStatus = -1, bool individual = false);
105
	bool UpdatePackages(int doStatus = -1, bool individual = false);
108
	CBaseFile *FindXspPackage(CyString id);
106
	CBaseFile *FindXspPackage(CyString id);
109
	CBaseFile *FindSpkPackage(CyString name, CyString author);
107
	CBaseFile *FindSpkPackage(CyString name, CyString author);
110
	CBaseFile *findSpkPackage(const Utils::String &name, const Utils::String &author) const;
108
	CBaseFile *findSpkPackage(const Utils::String &name, const Utils::String &author) const;
111
	CArchiveFile *FindArchivePackage(CyString name);
109
	CArchiveFile *FindArchivePackage(CyString name);
112
	CBaseFile *FindPackage(CyString name, CyString author);
110
	CBaseFile* FindPackage(CyString name, CyString author);
-
 
111
	CBaseFile* findPackage(const Utils::String &name, const Utils::String &author) const;
113
	CBaseFile *FindFirstPackageWithFile(C_File *f);
112
	CBaseFile *FindFirstPackageWithFile(C_File *f);
114
	CBaseFile *FindNextPackageWithFile(CBaseFile *p, C_File *f);
113
	CBaseFile *FindNextPackageWithFile(CBaseFile *p, C_File *f);
115
	CBaseFile *FindPackage(CBaseFile *package);
114
	CBaseFile *FindPackage(CBaseFile *package);
116
	C_File *FindFile(int filetype, CyString filename, CyString dir = NullString);
115
	C_File *FindFile(int filetype, CyString filename, CyString dir = NullString);
117
	CBaseFile *FirstPackage() { return m_lPackages.First(); }
116
	CBaseFile *FirstPackage() { return m_lPackages.First(); }
Line 130... Line 129...
130
		}
129
		}
131
		return NULL; 
130
		return NULL; 
132
	}
131
	}
133
	void Reset();
132
	void Reset();
134
	CBaseFile *GetPackageAt(int i) { return m_lPackages[i]; }
133
	CBaseFile *GetPackageAt(int i) { return m_lPackages[i]; }
135
	CyString GetSelectedModName();
134
	Utils::String selectedModName() const;
136
	CyString GetModKey();
135
	CyString GetModKey();
137
	void SetupWares();
136
	void SetupWares();
138
	void SetupShips();
137
	void SetupShips();
139
	void PurgeGameObjects();
138
	void PurgeGameObjects();
140
	void PurgeWares();
139
	void PurgeWares();
Line 145... Line 144...
145
	bool RemoveCurrentDirectory();
144
	bool RemoveCurrentDirectory();
146
	void RemoveCreatedFiles();
145
	void RemoveCreatedFiles();
147
	bool AnyUnusedShared();
146
	bool AnyUnusedShared();
148
 
147
 
149
	// util functions
148
	// util functions
150
	void RemoveUnusedDirectories(CyStringList &dirs, CyStringList *errors = NULL);
149
	void RemoveUnusedDirectories(CyStringList& dirs, CyStringList* errors = NULL);
-
 
150
	void removeUnusedDirectories(const Utils::CStringList &dirs, Utils::CStringList* errors = NULL);
151
	int  RemoveUninstallScripts(CyStringList *errors = 0, CProgressInfo *progress = NULL);
151
	int  RemoveUninstallScripts(CyStringList *errors = 0, CProgressInfo *progress = NULL);
152
	bool RemoveUninstallFile(C_File *file, CyStringList *errors = 0);
152
	bool RemoveUninstallFile(C_File *file, CyStringList *errors = 0);
153
	int  RemoveUnusedSharedFiles(CyStringList *errors = 0, CProgressInfo *progress = NULL);
153
	int  RemoveUnusedSharedFiles(CyStringList *errors = 0, CProgressInfo *progress = NULL);
154
	bool RemoveSharedFile(C_File *file, CyStringList *errors = NULL);
154
	bool RemoveSharedFile(C_File *file, CyStringList *errors = NULL);
155
	void ShufflePatchTo(C_File *file, int to, CyStringList *errors);
155
	void ShufflePatchTo(C_File *file, int to, CyStringList *errors);
Line 165... Line 165...
165
	int	 RemoveAllPackages(CyStringList *errors = NULL, CProgressInfo *progress = NULL);
165
	int	 RemoveAllPackages(CyStringList *errors = NULL, CProgressInfo *progress = NULL);
166
	void AssignPackageNumbers();
166
	void AssignPackageNumbers();
167
	int  GetChildPackages(CBaseFile *package, CLinkList<CBaseFile> *children, bool recursive = false);
167
	int  GetChildPackages(CBaseFile *package, CLinkList<CBaseFile> *children, bool recursive = false);
168
	int  GetAllPackageFiles(CBaseFile *package, CLinkList<C_File> *fileList, bool includeChild);
168
	int  GetAllPackageFiles(CBaseFile *package, CLinkList<C_File> *fileList, bool includeChild);
169
	int	 GetAllPackageFiles(CLinkList<CBaseFile> *list, CLinkList<C_File> *fileList, bool includeChild);
169
	int	 GetAllPackageFiles(CLinkList<CBaseFile> *list, CLinkList<C_File> *fileList, bool includeChild);
170
	void AddLogEntry(int type, CyString args, CyStringList *errors);
170
	void AddLogEntry(int type, CyString args, CyStringList* errors);
-
 
171
	void addLogEntry(int type, const Utils::String &args, Utils::CStringList* errors);
171
	Utils::String findDataDir(const Utils::String &dir, const Utils::String &file);
172
	Utils::String findDataDir(const Utils::String &dir, const Utils::String &file);
172
	int  CountPackages(int type, bool onlyEnabled);
173
	int  CountPackages(int type, bool onlyEnabled);
173
	int  CountBuiltInPackages(bool onlyEnabled);
174
	int  CountBuiltInPackages(bool onlyEnabled);
174
	bool isCurrentDir(const Utils::String &dir) const;
175
	bool isCurrentDir(const Utils::String &dir) const;
175
	bool CheckOtherPackage(CBaseFile *package);
176
	bool CheckOtherPackage(CBaseFile *package);
Line 196... Line 197...
196
	CyStringList *ReadTextPage(CyString file, bool search, int page);
197
	CyStringList *ReadTextPage(CyString file, bool search, int page);
197
	int AdjustFileType(CyString name, int filetype);
198
	int AdjustFileType(CyString name, int filetype);
198
	CXspFile *extractShip(const Utils::String &sCatFile, const Utils::String &sId, CProgressInfo *progress = NULL);
199
	CXspFile *extractShip(const Utils::String &sCatFile, const Utils::String &sId, CProgressInfo *progress = NULL);
199
	CyString ReadShipData(CyString file, CyString entry);
200
	CyString ReadShipData(CyString file, CyString entry);
200
	bool IsSamePackage(CBaseFile *p1, CBaseFile *p2);
201
	bool IsSamePackage(CBaseFile *p1, CBaseFile *p2);
201
	void ApplyFakePatchOrder(CyStringList *list);
202
	void ApplyFakePatchOrder(Utils::CStringList *list);
202
	CBaseFile *CreateFromArchive(CyString filename, bool toInstall = false );
203
	CBaseFile *CreateFromArchive(CyString filename, bool toInstall = false );
203
	void ReadArchiveData(const char *buf, size_t len, CBaseFile *archive);
204
	void ReadArchiveData(const char *buf, size_t len, CBaseFile *archive);
204
	void ReadArchiveData(CyString filename, CBaseFile *archive);
205
	void ReadArchiveData(CyString filename, CBaseFile *archive);
205
	int VerifyInstalledFiles(CyStringList *missingFiles = NULL, bool getPackages = true);
206
	int VerifyInstalledFiles(CyStringList *missingFiles = NULL, bool getPackages = true);
206
	Utils::String empWaresForGame(int *maxsize = NULL);
207
	Utils::String empWaresForGame(size_t *maxsize = NULL);
207
	void addEMPPriceOverride(int empId, int price);
208
	void addEMPPriceOverride(int empId, int price);
208
	void addEMPNotoOverride(int empId, int noto);
209
	void addEMPNotoOverride(int empId, int noto);
209
	void addBuiltInWarePriceOverride(int empId, int price);
210
	void addBuiltInWarePriceOverride(int empId, int price);
210
	void addBuiltInWareNotoOverride(int empId, int noto);
211
	void addBuiltInWareNotoOverride(int empId, int noto);
211
	void addCustomWarePriceOverride(const Utils::String &id, int price);
212
	void addCustomWarePriceOverride(const Utils::String &id, int price);
Line 247... Line 248...
247
	Utils::String getProperDir(const Utils::String &dir) const;
248
	Utils::String getProperDir(const Utils::String &dir) const;
248
	Utils::String getAddonDir() const;
249
	Utils::String getAddonDir() const;
249
	Utils::String getAddonDir(const Utils::String &dir) const;
250
	Utils::String getAddonDir(const Utils::String &dir) const;
250
 
251
 
251
	// text files
252
	// text files
252
	void CreateLanguageTextFiles(CyStringList *errors = 0);
253
	void CreateLanguageTextFiles(Utils::CStringList *errors = 0);
253
	bool RenameTextFile(CyString textid, int languageid, CyStringList *errors);
254
	bool RenameTextFile(const Utils::String &textid, int languageid, Utils::CStringList *errors);
254
	void AddTextFileToScripts(C_File *file, CyString textid);
255
	void AddTextFileToScripts(C_File *file, CyString textid);
255
	void CreatePluginManagerText();
256
	void CreatePluginManagerText();
256
	void createPluginManagerOpenText();
257
	void createPluginManagerOpenText();
257
 
258
 
258
	// game control
259
	// game control
Line 306... Line 307...
306
	int GetGame() { return m_iGame; }
307
	int GetGame() { return m_iGame; }
307
	bool IsLoaded() { return m_bLoaded; }
308
	bool IsLoaded() { return m_bLoaded; }
308
	bool IsVanilla() { return m_bVanilla; }
309
	bool IsVanilla() { return m_bVanilla; }
309
	void SetVanilla(bool b);
310
	void SetVanilla(bool b);
310
 
311
 
311
	CyString GetSetMod() { return m_sSetMod; }
312
	const Utils::String &getMod() const { return m_sSetMod; }
312
	void SetMod(CyString mod) { 
313
	void setMod(const Utils::String& mod);
313
		if ( mod != "PluginManager" )
-
 
314
			m_sSetMod = mod; 
-
 
315
	}
-
 
316
	void setSaveGameManager(bool managed);
314
	void setSaveGameManager(bool managed);
317
 
315
 
318
	CBaseFile *GetEnabledMod() { return m_pEnabledMod; }
316
	CBaseFile *GetEnabledMod() { return m_pEnabledMod; }
319
 
317
 
320
	//errors
318
	//errors
Line 345... Line 343...
345
 
343
 
346
private:
344
private:
347
	Utils::String	m_sCurrentDir;
345
	Utils::String	m_sCurrentDir;
348
	static Utils::String	m_sTempDir;
346
	static Utils::String	m_sTempDir;
349
	Utils::String			m_sMyDoc;
347
	Utils::String			m_sMyDoc;
350
	CyString	m_sSetMod;
348
	Utils::String			m_sSetMod;
351
	Utils::String _sSaveDir;
349
	Utils::String			_sSaveDir;
352
	GameDirectory *_pCurrentDir;
350
	GameDirectory *_pCurrentDir;
353
 
351
 
354
	// global files list
352
	// global files list
355
	CLinkList<C_File>		m_lFiles;
353
	CLinkList<C_File>		m_lFiles;
356
	CLinkList<CBaseFile>	m_lPackages;
354
	CLinkList<CBaseFile>	m_lPackages;
Line 363... Line 361...
363
	// prepared lists
361
	// prepared lists
364
	CLinkList<CBaseFile>	m_lInstallList; // install/uninstalling packages
362
	CLinkList<CBaseFile>	m_lInstallList; // install/uninstalling packages
365
	CLinkList<CBaseFile>	m_lEnableList;  // enable packages
363
	CLinkList<CBaseFile>	m_lEnableList;  // enable packages
366
	CLinkList<CBaseFile>	m_lDisableList; // disable packages
364
	CLinkList<CBaseFile>	m_lDisableList; // disable packages
367
 
365
 
368
	CyStringList			m_lCreatedFiles; // list of files we've created
366
	Utils::CStringList		m_lCreatedFiles; // list of files we've created
369
	CyStringList			m_lNonRemovedFiles; // list of fiels that couldn't be removed for some reason
367
	Utils::CStringList		m_lNonRemovedFiles; // list of fiels that couldn't be removed for some reason
370
	CyStringList			m_lGlobals; // global settigns that we want changed
368
	Utils::CStringList		m_lGlobals; // global settigns that we want changed
371
	CyStringList			m_lFakePatchOrder; // ordered fake patches
369
	Utils::CStringList		m_lFakePatchOrder; // ordered fake patches
372
	CLinkList<SAvailablePackage> m_lAvailablePackages; // list of available packages online
370
	CLinkList<SAvailablePackage> m_lAvailablePackages; // list of available packages online
373
 
371
 
374
	CVirtualFileSystem		m_pGameVFS; // Games Virtual File System
372
	CVirtualFileSystem		m_pGameVFS; // Games Virtual File System
375
 
373
 
376
	CGameExe				m_gameExe;
374
	CGameExe				m_gameExe;
Line 387... Line 385...
387
	int			m_iSaveGameManager; // Save game manager
385
	int			m_iSaveGameManager; // Save game manager
388
	bool		m_bSurpressProtectedWarning; // prevent checking for protected directory
386
	bool		m_bSurpressProtectedWarning; // prevent checking for protected directory
389
 
387
 
390
	int			m_iGame;		// the game the directory is
388
	int			m_iGame;		// the game the directory is
391
	int			m_iGameVersion; // the version of the game (version position)
389
	int			m_iGameVersion; // the version of the game (version position)
392
	CyString	m_sGameVersion; // the version of the game (full version)
390
	Utils::String	m_sGameVersion; // the version of the game (full version)
393
	int			m_iGameFlags;	// the flags for the game from SGameExe
391
	int			m_iGameFlags;	// the flags for the game from SGameExe
394
	int			m_iMaxPatch;	// the maximum patch for the game
392
	int			m_iMaxPatch;	// the maximum patch for the game
395
 
393
 
396
	int			m_iSaveGame;
394
	int			m_iSaveGame;
397
	int			m_iError;
395
	int			m_iError;