1 |
/***************************************************************************\ |
2 |
| Project: AE Installer | |
3 |
| By: Gumby & Iritscen | |
4 |
| File: Globals.h | |
5 |
| Function: Contains most of the includes needed by the source, and some | |
6 |
| defines, structs, and prototypes that help bridge certain | |
7 |
| source files that need to talk to each other. | |
8 |
| Created: 04/11/2009 21:05:00 | |
9 |
\***************************************************************************/ |
10 |
|
11 |
|
12 |
//#pragma mark INCLUDES |
13 |
#include <fstream> |
14 |
#include <string> |
15 |
#include <stdio.h> |
16 |
#include <iostream> |
17 |
#include <cctype> |
18 |
#include <vector> |
19 |
#include <errno.h> |
20 |
#include <sstream> |
21 |
#ifdef WIN32 |
22 |
#include <windows.h> |
23 |
#else // assume we're on Mac |
24 |
#include <stdlib.h> |
25 |
#include <dirent.h> |
26 |
#endif |
27 |
#include "wx/wxprec.h" |
28 |
#ifdef __BORLANDC__ |
29 |
#pragma hdrstop |
30 |
#endif |
31 |
#ifndef WX_PRECOMP |
32 |
#include "wx/wx.h" |
33 |
#endif |
34 |
#include "boost/thread.hpp" |
35 |
#include "boost/tokenizer.hpp" |
36 |
#include "boost/lexical_cast.hpp" // int -> string |
37 |
#include "boost/algorithm/string.hpp" |
38 |
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations |
39 |
using namespace boost::filesystem; |
40 |
using namespace std; |
41 |
|
42 |
#define UPDATE_LOG_READ_ERR -1 |
43 |
#define UPDATE_INST_REPL_ERR -2 |
44 |
#define UPDATE_MNTH_REQD_ERR -3 |
45 |
#define UPDATE_NO_UPD_AVAIL 0 |
46 |
#define UPDATE_SIMP_AVAIL 1 |
47 |
#define UPDATE_GLOB_AVAIL 2 |
48 |
#define UPDATE_INST_AVAIL 3 |
49 |
#define UPDATE_CONT_UPD 4 |
50 |
#define UPDATE_PKG_AVAIL 5 |
51 |
|
52 |
struct ModPackage |
53 |
{ |
54 |
bool isInstalled; // replace with function |
55 |
string installerVersion; |
56 |
string name; |
57 |
string modStringName; |
58 |
float modStringVersion; |
59 |
string platform; |
60 |
bool hasOnis; |
61 |
bool hasDeltas; |
62 |
bool hasBSL; |
63 |
bool hasAddon; |
64 |
bool hasDats; |
65 |
string category; |
66 |
string creator; |
67 |
bool isEngine; |
68 |
string readme; |
69 |
bool globalNeeded; |
70 |
ModPackage(); |
71 |
|
72 |
bool operator < (const ModPackage &fs) const |
73 |
{ return (name < fs.name);} |
74 |
|
75 |
bool operator > (const ModPackage &fs) const |
76 |
{ return (name > fs.name);} |
77 |
|
78 |
bool operator == (const ModPackage &fs) const |
79 |
{ return (name == fs.name);} |
80 |
}; |
81 |
|
82 |
struct Install_info_cfg |
83 |
{ |
84 |
string AEVersion, InstallerVersion, DaodanVersion, OniSplitVersion, WinGUIVersion, MacGUIVersion; |
85 |
bool patch, globalizationRequired; |
86 |
vector<string> deleteList; |
87 |
|
88 |
Install_info_cfg(); |
89 |
}; |
90 |
|
91 |
void recompileAll(vector<string>); |
92 |
int globalizeData(void); |
93 |
bool CheckForGlobalization(bool); |
94 |
int GetUpdateStatus(Install_info_cfg *, Install_info_cfg *, bool *); |
95 |
bool ProcessInstallerUpdate(Install_info_cfg *, Install_info_cfg *); |
96 |
bool ProcessAEUpdate(Install_info_cfg *, Install_info_cfg *, bool *); |
97 |
void ProcessPackageUpdates(string, string); |
98 |
void callRefreshMods(void); |
99 |
string escapePath(string input); |
100 |
void setStatusArea(string); |
101 |
void setProgressBar(int); |
102 |
void copy_directory(const path &from_dir_ph, const path &to_dir_ph); |
103 |
void copy(const path &from_file_ph, const path &to_file_ph); |
104 |
|
105 |
static string gInstallerVersion = "1.11"; // only place in source we need to change this |