1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
11 * Copyright (C) 2005 Christi Alice Scarborough
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
19 ****************************************************************************/
21 #include <wx/wxprec.h>
32 #include <wx/config.h>
33 #include <wx/confbase.h>
34 #include <wx/fileconf.h>
35 #include <wx/stdpaths.h>
36 #include <wx/wfstream.h>
37 #include <wx/filesys.h>
38 #include <wx/fs_inet.h>
39 #include <wx/fs_zip.h>
40 #include <wx/progdlg.h>
41 #include <wx/protocol/http.h>
42 #include <wx/string.h>
44 #include <wx/ptr_scpd.h>
45 #include <wx/zipstrm.h>
47 #include <wx/filefn.h>
48 #include <wx/sstream.h>
49 #include <wx/msgdlg.h>
52 #include <wx/wizard.h>
54 #include <wx/statline.h>
55 #include <wx/valgen.h>
56 #include <wx/thread.h>
58 #include <wx/tokenzr.h>
59 #include <wx/notebook.h>
60 #include <wx/html/htmlwin.h>
61 #include <wx/hyperlink.h>
65 #define PATH_SEP_CHR '\\'
66 #define EXE_NAME wxT("rbutil.exe")
68 #define PATH_SEP wxT("/")
69 #define PATH_SEP_CHR '/'
70 #define EXE_NAME wxT("rbutil")
73 #define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
74 #define MAX_PLATFORMS 50
75 #define SYSTEM_CONFIG rbutil.ini
76 #define FILE_BUFFER_SIZE 1024
78 //WX_DEFINE_OBJARRAY(bool, wxArrayBool);
83 // Program configuration data (rbutil.ini and environment)
84 wxFileConfig
* GlobalConfig
;
85 wxFileConfig
* UserConfig
;
86 wxString UserConfigFile
;
87 wxString GlobalConfigFile
;
92 wxStandardPaths
* stdpaths
;
93 wxArrayString plat_id
;
94 wxArrayString plat_name
;
95 wxArrayInt plat_released
;
96 wxArrayInt plat_needsbootloader
;
97 wxArrayString plat_bootloadermethod
;
98 wxArrayString plat_bootloadername
;
99 wxArrayString plat_resolution
;
100 wxString download_url
;
102 wxString bleeding_url
;
103 wxString server_conf_url
;
105 wxString last_release
;
107 wxString bootloader_url
;
114 // User configuration data.
116 // unsigned int curplatnum;
118 wxString curfirmware
;
119 unsigned int curbuild
;
123 wxString curresolution
;
124 wxArrayString themesToInstall
;
126 // Global system variables
128 wxLogStderr
* logstderr
;
129 wxLogChain
* logchain
;
133 extern GlobalVars
* gv
;
135 wxString
wxFindAppPath(const wxString
& argv0
, const wxString
& cwd
,
136 const wxString
& appVariableName
);
137 int DownloadURL(wxString src
, wxString dest
);
138 int UnzipFile(wxString src
, wxString destdir
, bool isInstall
= false);
139 int Uninstall(const wxString dir
, bool isFullUninstall
= false);
140 bool InstallRbutil(wxString dest
);
141 bool InstallTheme(wxString src
);
142 bool checkZip(wxString zipname
);
143 wxString
stream_err_str(int errnum
);
144 bool rm_rf(wxString file
);
147 #define ERR_DIALOG(msg, title) \
148 wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
150 #define WARN_DIALOG(msg, title) \
151 wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
153 #define MESG_DIALOG(msg) \
156 #define INFO_DIALOG(msg) \
159 #define BUILD_RELEASE 0
160 #define BUILD_DAILY 1
161 #define BUILD_BLEEDING 2
163 #define BOOTLOADER_ADD 0
164 #define BOOTLOADER_REM 1