Subversion Repositories spk

Rev

Rev 125 | Rev 127 | 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
 
125 cycrow 41
tstruct GameDirectory
42
{
43
	Utils::String dir;
44
	Utils::String name;
45
	Utils::String version;
46
	int			  id;
47
	int			  langid;
48
	Utils::String langname;
49
	Utils::String logdir;
50
	Utils::String addon;
51
	Utils::String exe;
52
	Utils::String basename;
53
} GameDirectory;
54
 
1 cycrow 55
class SPKEXPORT CGameExe 
56
{
56 cycrow 57
private:
58
	CLinkList<SGameExe> m_lExe;
59
 
1 cycrow 60
public:
61
	void Reset();
62
 
56 cycrow 63
	void ParseExe(const Utils::String &line);
64
	int  ParseFlags(const Utils::String &flags);
65
	bool ReadFile(const Utils::String &file);
1 cycrow 66
 
56 cycrow 67
	int AddExe(const Utils::String &exe);
121 cycrow 68
	SGameExe *gameExe(const Utils::String &exe) const;
1 cycrow 69
 
56 cycrow 70
	int FindVersion(const Utils::String &exe, int size, Utils::String *fVersion);
1 cycrow 71
 
126 cycrow 72
	int findAddonType(const Utils::String &gameExe) const;
121 cycrow 73
	int GetGameType(const Utils::String &gameExe) const;
74
	int GetGameVersion(const Utils::String &gameExe, Utils::String *fVersion) const;
75
	bool GetGameVersionName(const Utils::String &gameExe, Utils::String *versionName) const;
76
	Utils::String ExtractGameName(const Utils::String &dir) const;
77
	Utils::String GetGameRunExe(const Utils::String &dir) const;
78
	Utils::String GetGameName(const Utils::String &gameExe) const;
125 cycrow 79
	Utils::String GetGameBaseName(const Utils::String &gameExe) const;
121 cycrow 80
	Utils::String GetGameNameFromType(int type) const;
81
	Utils::String GetGameVersionFromType(int game, int gameVersion, const Utils::String &fGameVersion) const;
82
	Utils::String GetGameDir(const Utils::String &dir) const;
83
	Utils::String GetProperDir(const Utils::String &dir) const;
84
	Utils::String GetAddonDir(const Utils::String &dir) const;
85
	bool isAddon(const Utils::String &ext) const;
86
	int getTextID(const Utils::String &dir) const;
87
	int GetGameAddons(const Utils::String &dir, Utils::CStringList &exe);
1 cycrow 88
	int GetGameFlags(int game);
89
	int GetMaxPatch(int game);
56 cycrow 90
	Utils::String GetModKey(int game);
125 cycrow 91
	void GetDirectoryData(GameDirectory *gameDir) const;
1 cycrow 92
 
93
	int ConvertGameType(int gametype, int *version);
94
 
95
	int GetNumGames() { return m_lExe.size(); }
126 cycrow 96
	SGameExe *GetGame(int game) const;
1 cycrow 97
 
98
private:
57 cycrow 99
	int _findExe(const Utils::String &exe) const;
121 cycrow 100
	int _findVersion(int exe, int size, Utils::String *fVersion) const;
57 cycrow 101
 
56 cycrow 102
	void _SetExeName(Utils::String *sName, int *iName, const Utils::String &n);
121 cycrow 103
	Utils::String _textFileName(const Utils::String &sGameDir) const;
104
	Utils::String _readTextFile(const Utils::String &sGameDir) const;
105
	Utils::String _extractTextData(const Utils::String &sData, long iPage, long iID, int iGameID) const;
1 cycrow 106
};
107
 
108
 
109
#endif //__GAME_EXE_H__