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