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 | #include "boost/thread.hpp"
|
---|
22 | #include "boost/tokenizer.hpp"
|
---|
23 | #include "boost/lexical_cast.hpp" // int -> string
|
---|
24 | #include "boost/algorithm/string.hpp"
|
---|
25 | #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
|
---|
26 | using namespace boost::filesystem;
|
---|
27 | using namespace std;
|
---|
28 | #ifdef WIN32
|
---|
29 | #include <windows.h>
|
---|
30 | #else // assume we're on Mac
|
---|
31 | #include <stdlib.h>
|
---|
32 | #include <dirent.h>
|
---|
33 | #endif
|
---|
34 | #include "wx/wxprec.h"
|
---|
35 | #ifdef __BORLANDC__
|
---|
36 | #pragma hdrstop
|
---|
37 | #endif
|
---|
38 | #ifndef WX_PRECOMP
|
---|
39 | #include "wx/wx.h"
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #pragma mark DEFINES
|
---|
43 | #define INSTALLER_VERSION "1.2" // only place we need to change this
|
---|
44 | #define UPDATE_LOG_READ_ERR -1
|
---|
45 | #define UPDATE_INST_REPL_ERR -2
|
---|
46 | #define UPDATE_MNTH_REQD_ERR -3
|
---|
47 | #define UPDATE_NO_UPD_AVAIL 0
|
---|
48 | #define UPDATE_SIMP_AVAIL 1
|
---|
49 | #define UPDATE_GLOB_AVAIL 2
|
---|
50 | #define UPDATE_INST_AVAIL 3
|
---|
51 | #define UPDATE_CONT_UPD 4
|
---|
52 |
|
---|
53 | #pragma mark STRUCTS
|
---|
54 | struct ModPackage
|
---|
55 | {
|
---|
56 | bool isInstalled; // replace with function
|
---|
57 | string installerVersion;
|
---|
58 | string name;
|
---|
59 | string modStringName;
|
---|
60 | int modStringVersion;
|
---|
61 | string platform;
|
---|
62 | bool hasOnis;
|
---|
63 | bool hasDeltas;
|
---|
64 | bool hasBSL;
|
---|
65 | bool hasAddon;
|
---|
66 | bool hasDats;
|
---|
67 | string category;
|
---|
68 | string creator;
|
---|
69 | bool isEngine;
|
---|
70 | string readme;
|
---|
71 | bool globalNeeded;
|
---|
72 | ModPackage();
|
---|
73 |
|
---|
74 | bool operator < (const ModPackage &fs) const
|
---|
75 | { return (name < fs.name);}
|
---|
76 |
|
---|
77 | bool operator > (const ModPackage &fs) const
|
---|
78 | { return (name > fs.name);}
|
---|
79 |
|
---|
80 | bool operator == (const ModPackage &fs) const
|
---|
81 | { return (name == fs.name);}
|
---|
82 | };
|
---|
83 |
|
---|
84 | struct Install_info_cfg
|
---|
85 | {
|
---|
86 | string AEVersion, InstallerVersion, DaodanVersion, OniSplitVersion, WinGUIVersion, MacGUIVersion;
|
---|
87 | bool patch, globalizationRequired;
|
---|
88 | vector<string> deleteList;
|
---|
89 |
|
---|
90 | Install_info_cfg();
|
---|
91 | };
|
---|
92 |
|
---|
93 |
|
---|
94 | #pragma mark PROTOTYPES
|
---|
95 | void recompileAll(vector<string>);
|
---|
96 | int globalizeData(void);
|
---|
97 | bool CheckForGlobalization(bool);
|
---|
98 | int GetUpdateStatus(Install_info_cfg *, Install_info_cfg *, bool *);
|
---|
99 | bool ProcessInstallerUpdate(Install_info_cfg *, Install_info_cfg *);
|
---|
100 | bool ProcessAEUpdate(Install_info_cfg *, Install_info_cfg *, bool *);
|
---|
101 | void callRefreshMods(void);
|
---|
102 | string escapePath(string input);
|
---|
103 | void setStatusArea(string);
|
---|
104 | void setProgressBar(int);
|
---|
105 | void copy_directory(const path &from_dir_ph, const path &to_dir_ph);
|
---|
106 | void copy(const path &from_file_ph, const path &to_file_ph);
|
---|