From 26b55ba5f0eb6adf667aa75e35fd0cbf2780e36d Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Wed, 30 Oct 2019 01:17:16 -0400 Subject: [PATCH] rbutil: extend game file installation RbUtil will now install freely distributable data files for Duke Nukem 3D, Quake, SGT-Puzzles (fonts), Wolfenstein 3-D, and Another World. Currently the urls point to my personal server, pending upload to the main download server. Change-Id: I2806fd1ad7e9bb0fcb7aee5444840708e6e63032 --- rbutil/rbutilqt/base/systeminfo.cpp | 5 +++ rbutil/rbutilqt/base/systeminfo.h | 5 +++ .../rbutilqt/gui/selectiveinstallwidget.cpp | 42 +++++++++++++++---- rbutil/rbutilqt/rbutil.ini | 5 +++ 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp index d75b90c22d..25ef4a1a42 100644 --- a/rbutil/rbutilqt/base/systeminfo.cpp +++ b/rbutil/rbutilqt/base/systeminfo.cpp @@ -42,6 +42,11 @@ const static struct { { SystemInfo::DailyVoiceUrl, "daily_voice_url", "" }, { SystemInfo::ReleaseVoiceUrl, "release_voice_url", "" }, { SystemInfo::DoomUrl, "doom_url", "" }, + { SystemInfo::Duke3DUrl, "duke3d_url", "" }, + { SystemInfo::PuzzFontsUrl, "puzzfonts_url", "" }, + { SystemInfo::QuakeUrl, "quake_url", "" }, + { SystemInfo::Wolf3DUrl, "wolf3d_url", "" }, + { SystemInfo::XWorldUrl, "xworld_url", "" }, { SystemInfo::ReleaseUrl, "release_url", "" }, { SystemInfo::DailyUrl, "daily_url", "" }, { SystemInfo::BuildInfoUrl, "build_info_url", "" }, diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h index 5e75f36a08..fad2c7e48b 100644 --- a/rbutil/rbutilqt/base/systeminfo.h +++ b/rbutil/rbutilqt/base/systeminfo.h @@ -44,6 +44,11 @@ class SystemInfo : public QObject DailyFontUrl, DailyVoiceUrl, DoomUrl, + Duke3DUrl, + QuakeUrl, + PuzzFontsUrl, + Wolf3DUrl, + XWorldUrl, ReleaseUrl, ReleaseVoiceUrl, ReleaseFontUrl, diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp index 843fa63cad..ffc5d98d72 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp @@ -483,22 +483,51 @@ void SelectiveInstallWidget::installThemes(void) } } +static const struct { + const char *name; + const char *pluginpath; + SystemInfo::SystemInfos zipurl; // add new games to SystemInfo +} GamesList[] = { + { "Doom", "/.rockbox/rocks/games/doom.rock", SystemInfo::DoomUrl }, + { "Duke3D", "/.rockbox/rocks/games/duke3d.rock", SystemInfo::Duke3DUrl }, + { "Quake", "/.rockbox/rocks/games/quake.rock", SystemInfo::QuakeUrl }, + { "Puzzles fonts", "/.rockbox/rocks/games/sgt-blackbox.rock", SystemInfo::PuzzFontsUrl }, + { "Wolf3D", "/.rockbox/rocks/games/wolf3d.rock", SystemInfo::Wolf3DUrl }, + { "XWorld", "/.rockbox/rocks/games/xworld.rock", SystemInfo::XWorldUrl }, +}; void SelectiveInstallWidget::installGamefiles(void) { if(ui.gamefileCheckbox->isChecked()) { - // check if installed Rockbox has doom plugin. If not disable doom. - if(!QFileInfo(m_mountpoint + "/.rockbox/rocks/games/doom.rock").exists()) { - m_logger->addItem(tr("Your installation doesn't require game files, skipping."), LOGINFO); - emit installSkipped(false); + // build a list of zip urls that we need, then install + QStringList gameUrls; + QStringList gameNames; + + for(unsigned int i = 0; i < sizeof(GamesList) / sizeof(GamesList[0]); i++) + { + // check if installed Rockbox has this plugin. + if(QFileInfo(m_mountpoint + GamesList[i].pluginpath).exists()) { + gameNames.append(GamesList[i].name); + gameUrls.append(SystemInfo::value(GamesList[i].zipurl).toString()); + LOG_INFO() << gameUrls.at(gameUrls.size() - 1); + } } + + if(gameUrls.size() == 0) + { + m_logger->addItem(tr("Your installation doesn't require any game files, skipping."), LOGINFO); + emit installSkipped(false); + return; + } + LOG_INFO() << "installing gamefiles"; + // create new zip installer if(m_zipinstaller != NULL) m_zipinstaller->deleteLater(); m_zipinstaller = new ZipInstaller(this); - m_zipinstaller->setUrl(SystemInfo::value(SystemInfo::DoomUrl).toString()); - m_zipinstaller->setLogSection("Game Addons"); + m_zipinstaller->setUrl(gameUrls); + m_zipinstaller->setLogSection(gameNames); m_zipinstaller->setLogVersion(); m_zipinstaller->setMountPoint(m_mountpoint); if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) @@ -523,4 +552,3 @@ void SelectiveInstallWidget::changeEvent(QEvent *e) QWidget::changeEvent(e); } } - diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index bcfd67ee77..a41ca87df5 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini @@ -25,6 +25,11 @@ daily_font_url=http://download.rockbox.org/daily/fonts/rockbox-fonts.zip ; other manual_url=http://download.rockbox.org/manual/%MANUALBASENAME%.%EXTENSION% doom_url=http://download.rockbox.org/useful/rockdoom.zip +duke3d_url=http://www.fwei.tk/pub/rockboxgames/duke3d.zip +quake_url=http://www.fwei.tk/pub/rockboxgames/quake.zip +puzzfonts_url=http://www.fwei.tk/pub/rockboxgames/sgt-fonts.zip +wolf3d_url=http://www.fwei.tk/pub/rockboxgames/wolf3d.zip +xworld_url=http://www.fwei.tk/pub/rockboxgames/xworld.zip rbutil_url=http://download.rockbox.org/rbutil/ ; [platforms] is used to determine the order in the device tree.