2006-12-13 21:11:24 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
#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>
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
#define PATH_SEP "\\"
|
2006-12-13 21:11:24 +00:00
|
|
|
#define PATH_SEP_CHR '\\'
|
2007-03-15 15:46:58 +00:00
|
|
|
#define EXE_NAME wxT("rbutil.exe")
|
2006-12-11 21:25:37 +00:00
|
|
|
#else
|
2007-03-15 15:46:58 +00:00
|
|
|
#define PATH_SEP wxT("/")
|
2006-12-13 21:11:24 +00:00
|
|
|
#define PATH_SEP_CHR '/'
|
2007-03-15 15:46:58 +00:00
|
|
|
#define EXE_NAME wxT("rbutil")
|
2006-12-11 21:25:37 +00:00
|
|
|
#endif
|
|
|
|
|
2007-03-15 15:46:58 +00:00
|
|
|
#define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
|
2006-12-11 21:25:37 +00:00
|
|
|
#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;
|
2006-12-13 21:11:24 +00:00
|
|
|
wxString UserConfigFile;
|
|
|
|
wxString GlobalConfigFile;
|
|
|
|
wxString AppDir;
|
|
|
|
wxString ResourceDir;
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
wxString* ErrStr;
|
|
|
|
wxStandardPaths* stdpaths;
|
|
|
|
wxArrayString plat_id;
|
|
|
|
wxArrayString plat_name;
|
|
|
|
wxArrayInt plat_released;
|
2007-02-21 20:27:14 +00:00
|
|
|
wxArrayInt plat_needsbootloader;
|
|
|
|
wxArrayString plat_bootloadermethod;
|
|
|
|
wxArrayString plat_bootloadername;
|
|
|
|
wxArrayInt plat_autodetect;
|
|
|
|
wxArrayString plat_combinedname;
|
2007-03-15 14:02:37 +00:00
|
|
|
wxArrayString plat_resolution;
|
2006-12-11 21:25:37 +00:00
|
|
|
wxString download_url;
|
|
|
|
wxString daily_url;
|
|
|
|
wxString bleeding_url;
|
|
|
|
wxString server_conf_url;
|
|
|
|
wxString font_url;
|
|
|
|
wxString last_release;
|
|
|
|
wxString prog_name;
|
2007-02-21 20:27:14 +00:00
|
|
|
wxString bootloader_url;
|
2007-03-15 14:02:37 +00:00
|
|
|
wxString themes_url;
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
// User configuration data.
|
2006-12-13 21:11:24 +00:00
|
|
|
wxString curplat;
|
|
|
|
unsigned int curplatnum;
|
|
|
|
wxString curdestdir;
|
|
|
|
unsigned int curbuild;
|
|
|
|
bool curisfull;
|
|
|
|
bool nocache;
|
|
|
|
bool portable;
|
2007-02-21 20:27:14 +00:00
|
|
|
wxString curbootloadermethod;
|
|
|
|
wxString curbootloader;
|
|
|
|
wxString curfirmware;
|
2007-03-15 14:02:37 +00:00
|
|
|
wxString curresolution;
|
|
|
|
wxArrayString themesToInstall;
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
// 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);
|
2006-12-13 21:11:24 +00:00
|
|
|
bool InstallRbutil(wxString dest);
|
2007-03-15 14:02:37 +00:00
|
|
|
bool InstallTheme(wxString src);
|
|
|
|
bool checkZip(wxString zipname);
|
2006-12-11 21:25:37 +00:00
|
|
|
wxString stream_err_str(int errnum);
|
|
|
|
bool rm_rf(wxString file);
|
|
|
|
|
2007-02-21 20:27:14 +00:00
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
#define ERR_DIALOG(msg, title) \
|
2007-03-15 15:27:56 +00:00
|
|
|
wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
#define WARN_DIALOG(msg, title) \
|
2007-03-15 15:27:56 +00:00
|
|
|
wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
#define MESG_DIALOG(msg) \
|
|
|
|
wxLogMessage(msg)
|
|
|
|
|
|
|
|
#define INFO_DIALOG(msg) \
|
|
|
|
wxLogInfo(msg)
|
|
|
|
|
|
|
|
#define BUILD_RELEASE 0
|
|
|
|
#define BUILD_DAILY 1
|
|
|
|
#define BUILD_BLEEDING 2
|
|
|
|
|
2007-02-21 20:27:14 +00:00
|
|
|
#define BOOTLOADER_ADD 0
|
|
|
|
#define BOOTLOADER_REM 1
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
#endif
|