Subversion Repositories spk

Rev

Rev 56 | Rev 121 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#ifndef __GAME_EXE_H__
2
#define __GAME_EXE_H__
3
 
4
#include "lists.h"
5
#include "File.h"
6
 
57 cycrow 7
enum {
8
	EXEFLAG_NONE			= 0,
9
	EXEFLAG_TCTEXT			= 1,
10
	EXEFLAG_MYDOCLOG		= 2,
11
	EXEFLAG_NOXOR			= 4,
12
	EXEFLAG_NOSAVESUBDIR	= 8,
13
	EXEFLAG_ADDON			= 16,
14
};
1 cycrow 15
 
16
#define EXE_VERSIONPOS			7
17
#define EXE_VERSION_NAMESTART	(EXE_VERSIONPOS + 2)
18
#define EXE_VERSION_SIZESTART	(EXE_VERSIONPOS + 1)
19
 
20
tstruct SGameExeVersion {
56 cycrow 21
	Utils::String	sName;
22
	int				iName;
23
	Utils::String	fVersion;
1 cycrow 24
	CLinkList<int> lSize;
25
} SGameExeVersion;
26
 
27
tstruct SGameExe {
56 cycrow 28
	Utils::String sExe;
29
	Utils::String sName;
30
	Utils::String sModKey;
1 cycrow 31
	int		 iFlags;
32
	int		 iMaxPatch;
33
	int		 iName;
56 cycrow 34
	Utils::String sMyDoc;
35
	Utils::String sAddon;
1 cycrow 36
	int		 iAddonTo;
56 cycrow 37
	int		 iTextNum;
1 cycrow 38
	CLinkList<SGameExeVersion> lVersions;
39
} SGameExe;
40
 
41
class SPKEXPORT CGameExe 
42
{
56 cycrow 43
private:
44
	CLinkList<SGameExe> m_lExe;
45
 
1 cycrow 46
public:
47
	void Reset();
48
 
56 cycrow 49
	void ParseExe(const Utils::String &line);
50
	int  ParseFlags(const Utils::String &flags);
51
	bool ReadFile(const Utils::String &file);
1 cycrow 52
 
56 cycrow 53
	int AddExe(const Utils::String &exe);
57 cycrow 54
	SGameExe *gameExe(const Utils::String &exe);
1 cycrow 55
 
56 cycrow 56
	int FindVersion(const Utils::String &exe, int size, Utils::String *fVersion);
1 cycrow 57
 
56 cycrow 58
	int GetGameType(const Utils::String &gameExe);
59
	int GetGameVersion(const Utils::String &gameExe, Utils::String *fVersion);
60
	bool GetGameVersionName(const Utils::String &gameExe, Utils::String *versionName);
61
	Utils::String ExtractGameName(const Utils::String &dir);
62
	Utils::String GetGameRunExe(const Utils::String &dir);
63
	Utils::String GetGameName(const Utils::String &gameExe);
64
	Utils::String GetGameNameFromType(int type);
65
	Utils::String GetGameVersionFromType(int game, int gameVersion, const Utils::String &fGameVersion);
66
	Utils::String GetGameDir(const Utils::String &dir);
67
	Utils::String GetProperDir(const Utils::String &dir);
68
	Utils::String GetAddonDir(const Utils::String &dir);
69
	int GetGameAddons(const Utils::String &dir, CyStringList &exe);
1 cycrow 70
	int GetGameFlags(int game);
71
	int GetMaxPatch(int game);
56 cycrow 72
	Utils::String GetModKey(int game);
1 cycrow 73
 
74
	int ConvertGameType(int gametype, int *version);
75
 
76
	int GetNumGames() { return m_lExe.size(); }
77
	SGameExe *GetGame(int game) { if ( game >= 0 && game < m_lExe.size() ) return m_lExe[game]; return NULL; }
78
 
79
private:
57 cycrow 80
	int _findExe(const Utils::String &exe) const;
81
	int _findVersion(int exe, int size, Utils::String *fVersion);
82
 
56 cycrow 83
	void _SetExeName(Utils::String *sName, int *iName, const Utils::String &n);
84
	Utils::String _textFileName(const Utils::String &sGameDir);
85
	Utils::String _readTextFile(const Utils::String &sGameDir);
86
	Utils::String _extractTextData(const Utils::String &sData, long iPage, long iID);
1 cycrow 87
};
88
 
89
 
90
#endif //__GAME_EXE_H__