1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* Module: rbutil
* File: rbutil.h
*
* Copyright (C) 2005 Christi Alice Scarborough
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#ifndef __rbutil_HPP_
#define __rbutil_HPP_
#include <wx/config.h>
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <wx/stdpaths.h>
#include <wx/wfstream.h>
#include <wx/filesys.h>
#include <wx/fs_inet.h>
#include <wx/fs_zip.h>
#include <wx/progdlg.h>
#include <wx/protocol/http.h>
#include <wx/string.h>
#include <wx/url.h>
#include <wx/ptr_scpd.h>
#include <wx/zipstrm.h>
#include <wx/dir.h>
#include <wx/filefn.h>
#include <wx/sstream.h>
#include <wx/msgdlg.h>
#include <wx/log.h>
#include <wx/file.h>
#include <wx/wizard.h>
#include <wx/event.h>
#include <wx/statline.h>
#include <wx/valgen.h>
#include <wx/thread.h>
#include <wx/regex.h>
#include <wx/tokenzr.h>
#include <wx/notebook.h>
#include <wx/html/htmlwin.h>
#include <wx/hyperlink.h>
#include <wx/mstream.h>
#ifdef __WXMSW__
#define PATH_SEP "\\"
#define PATH_SEP_CHR '\\'
#define EXE_NAME wxT("rbutil.exe")
#else
#define PATH_SEP wxT("/")
#define PATH_SEP_CHR '/'
#define EXE_NAME wxT("rbutil")
#endif
#define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
#define MAX_PLATFORMS 50
#define SYSTEM_CONFIG rbutil.ini
#define FILE_BUFFER_SIZE 1024
//WX_DEFINE_OBJARRAY(bool, wxArrayBool);
class GlobalVars
{
public:
// Program configuration data (rbutil.ini and environment)
wxFileConfig* GlobalConfig;
wxFileConfig* UserConfig;
wxString UserConfigFile;
wxString GlobalConfigFile;
wxString AppDir;
wxString ResourceDir;
wxString* ErrStr;
wxStandardPaths* stdpaths;
wxArrayString plat_id;
wxArrayString plat_name;
wxArrayInt plat_released;
wxArrayInt plat_needsbootloader;
wxArrayString plat_bootloadermethod;
wxArrayString plat_bootloadername;
wxArrayString plat_resolution;
wxString download_url;
wxString daily_url;
wxString bleeding_url;
wxString server_conf_url;
wxString font_url;
wxString last_release;
wxString prog_name;
wxString bootloader_url;
wxString themes_url;
wxString manual_url;
wxString doom_url;
wxString proxy_url;
// User configuration data.
wxString curplat;
// unsigned int curplatnum;
wxString curdestdir;
wxString curfirmware;
unsigned int curbuild;
bool curisfull;
bool nocache;
bool portable;
wxString curresolution;
wxArrayString themesToInstall;
// Global system variables
wxFFile* logfile;
wxLogStderr* logstderr;
wxLogChain* logchain;
wxLogGui* loggui;
};
extern GlobalVars* gv;
wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
const wxString& appVariableName);
int DownloadURL(wxString src, wxString dest);
int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
int Uninstall(const wxString dir, bool isFullUninstall = false);
bool InstallRbutil(wxString dest);
bool InstallTheme(wxString src);
bool checkZip(wxString zipname);
wxString stream_err_str(int errnum);
bool rm_rf(wxString file);
wxBitmap wxGetBitmapFromMemory(const unsigned char *data,int length);
#define ERR_DIALOG(msg, title) \
wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
#define WARN_DIALOG(msg, title) \
wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
#define MESG_DIALOG(msg) \
wxLogMessage(msg)
#define INFO_DIALOG(msg) \
wxLogInfo(msg)
#define BUILD_RELEASE 0
#define BUILD_DAILY 1
#define BUILD_BLEEDING 2
#define BOOTLOADER_ADD 0
#define BOOTLOADER_REM 1
#endif
|