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);
|
121 |
cycrow |
54 |
SGameExe *gameExe(const Utils::String &exe) const;
|
1 |
cycrow |
55 |
|
56 |
cycrow |
56 |
int FindVersion(const Utils::String &exe, int size, Utils::String *fVersion);
|
1 |
cycrow |
57 |
|
121 |
cycrow |
58 |
int GetGameType(const Utils::String &gameExe) const;
|
|
|
59 |
int GetGameVersion(const Utils::String &gameExe, Utils::String *fVersion) const;
|
|
|
60 |
bool GetGameVersionName(const Utils::String &gameExe, Utils::String *versionName) const;
|
|
|
61 |
Utils::String ExtractGameName(const Utils::String &dir) const;
|
|
|
62 |
Utils::String GetGameRunExe(const Utils::String &dir) const;
|
|
|
63 |
Utils::String GetGameName(const Utils::String &gameExe) const;
|
|
|
64 |
Utils::String GetGameNameFromType(int type) const;
|
|
|
65 |
Utils::String GetGameVersionFromType(int game, int gameVersion, const Utils::String &fGameVersion) const;
|
|
|
66 |
Utils::String GetGameDir(const Utils::String &dir) const;
|
|
|
67 |
Utils::String GetProperDir(const Utils::String &dir) const;
|
|
|
68 |
Utils::String GetAddonDir(const Utils::String &dir) const;
|
|
|
69 |
bool isAddon(const Utils::String &ext) const;
|
|
|
70 |
int getTextID(const Utils::String &dir) const;
|
|
|
71 |
int GetGameAddons(const Utils::String &dir, Utils::CStringList &exe);
|
1 |
cycrow |
72 |
int GetGameFlags(int game);
|
|
|
73 |
int GetMaxPatch(int game);
|
56 |
cycrow |
74 |
Utils::String GetModKey(int game);
|
1 |
cycrow |
75 |
|
|
|
76 |
int ConvertGameType(int gametype, int *version);
|
|
|
77 |
|
|
|
78 |
int GetNumGames() { return m_lExe.size(); }
|
|
|
79 |
SGameExe *GetGame(int game) { if ( game >= 0 && game < m_lExe.size() ) return m_lExe[game]; return NULL; }
|
|
|
80 |
|
|
|
81 |
private:
|
57 |
cycrow |
82 |
int _findExe(const Utils::String &exe) const;
|
121 |
cycrow |
83 |
int _findVersion(int exe, int size, Utils::String *fVersion) const;
|
57 |
cycrow |
84 |
|
56 |
cycrow |
85 |
void _SetExeName(Utils::String *sName, int *iName, const Utils::String &n);
|
121 |
cycrow |
86 |
Utils::String _textFileName(const Utils::String &sGameDir) const;
|
|
|
87 |
Utils::String _readTextFile(const Utils::String &sGameDir) const;
|
|
|
88 |
Utils::String _extractTextData(const Utils::String &sData, long iPage, long iID, int iGameID) const;
|
1 |
cycrow |
89 |
};
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
#endif //__GAME_EXE_H__
|