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>
62 #include <wx/mstream.h>
66 #define PATH_SEP_CHR '\\'
67 #define EXE_NAME wxT("rbutil.exe")
69 #define PATH_SEP wxT("/")
70 #define PATH_SEP_CHR '/'
71 #define EXE_NAME wxT("rbutil")
74 #define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
75 #define MAX_PLATFORMS 50
76 #define SYSTEM_CONFIG rbutil.ini
77 #define FILE_BUFFER_SIZE 1024
79 //WX_DEFINE_OBJARRAY(bool, wxArrayBool);
84 // Program configuration data (rbutil.ini and environment)
85 wxFileConfig
* GlobalConfig
;
86 wxFileConfig
* UserConfig
;
87 wxString UserConfigFile
;
88 wxString GlobalConfigFile
;
93 wxStandardPaths
* stdpaths
;
94 wxArrayString plat_id
;
95 wxArrayString plat_name
;
96 wxArrayInt plat_released
;
97 wxArrayInt plat_needsbootloader
;
98 wxArrayString plat_bootloadermethod
;
99 wxArrayString plat_bootloadername
;
100 wxArrayString plat_resolution
;
101 wxArrayString plat_manualname
;
102 wxString download_url
;
104 wxString bleeding_url
;
105 wxString server_conf_url
;
107 wxString last_release
;
109 wxString bootloader_url
;
116 // User configuration data.
118 // unsigned int curplatnum;
120 wxString curfirmware
;
121 unsigned int curbuild
;
125 wxString curresolution
;
126 wxArrayString themesToInstall
;
132 // Global system variables
134 wxLogStderr
* logstderr
;
135 wxLogChain
* logchain
;
139 extern GlobalVars
* gv
;
142 wxString
wxFindAppPath(const wxString
& argv0
, const wxString
& cwd
,
143 const wxString
& appVariableName
);
144 int DownloadURL(wxString src
, wxString dest
);
145 int UnzipFile(wxString src
, wxString destdir
, bool isInstall
= false);
146 int Uninstall(const wxString dir
, bool isFullUninstall
= false);
147 bool InstallRbutil(wxString dest
);
148 bool InstallTheme(wxString src
);
149 bool checkZip(wxString zipname
);
150 wxString
stream_err_str(int errnum
);
151 bool rm_rf(wxString file
);
153 wxBitmap
wxGetBitmapFromMemory(const unsigned char *data
,int length
);
156 #define ERR_DIALOG(msg, title) \
157 wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
159 #define WARN_DIALOG(msg, title) \
160 wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
162 #define MESG_DIALOG(msg) \
165 #define INFO_DIALOG(msg) \
168 #define BUILD_RELEASE 0
169 #define BUILD_DAILY 1
170 #define BUILD_BLEEDING 2
172 #define BOOTLOADER_ADD 0
173 #define BOOTLOADER_REM 1