diff --git a/backends/dlc/dlcmanager.cpp b/backends/dlc/dlcmanager.cpp new file mode 100644 index 000000000000..bb1de062e30a --- /dev/null +++ b/backends/dlc/dlcmanager.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + + +#include "backends/dlc/dlcmanager.h" +#include "backends/dlc/playstore/playstore.h" + +namespace Common { + +DECLARE_SINGLETON(DLC::DLCManager); + +} + +namespace DLC { + +DLCManager::DLCManager() { + // if --playstore flag + _store = new DLC::PlayStore::PlayStore(); +} + +void DLCManager::init() { + +} + +void DLCManager::initDownload() { + _store->requestDownload(); + // handle errors +} + +bool DLCManager::getFeatureState(DLC::Feature f) { + return false; +} + +} // End of namespace DLC diff --git a/backends/dlc/dlcmanager.h b/backends/dlc/dlcmanager.h new file mode 100644 index 000000000000..2b3e06fe2a95 --- /dev/null +++ b/backends/dlc/dlcmanager.h @@ -0,0 +1,71 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef DLC_DLCMANAGER_H +#define DLC_DLCMANAGER_H + +#include "common/str.h" +#include "common/singleton.h" +#include "backends/dlc/store.h" + +namespace DLC { + +enum Feature { + kInProgress +}; + +class DLCManager : public Common::Singleton { + + struct DLCDesc { + Common::String name; + Common::String description; + uint32 size; + uint32 game_id; + }; + + Store* _store; + +public: + DLCManager(); + virtual ~DLCManager() {} + + void init(); + + DLCDesc getDLCList(); + + void initDownload(); + + void cancelDownload(); + + bool getFeatureState(DLC::Feature f); + void setFeatureState(DLC::Feature f, bool enable); + + void getPercentDownloaded(); + + uint32 getInProgressGame(); +}; + +#define DLCMan DLC::DLCManager::instance() + +} // End of namespace DLC + + +#endif diff --git a/backends/dlc/playstore/playstore.h b/backends/dlc/playstore/playstore.h new file mode 100644 index 000000000000..afba125aad75 --- /dev/null +++ b/backends/dlc/playstore/playstore.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +#ifndef BACKENDS_DLC_PLAYSTORE_PLAYSTORE_H +#define BACKENDS_DLC_PLAYSTORE_PLAYSTORE_H + +#include "backends/dlc/store.h" +#include "common/callback.h" + +namespace DLC { +namespace PlayStore { + +class PlayStore: public DLC::Store { + +public: + PlayStore() {} + virtual ~PlayStore() {} + + virtual void init() override {} + + virtual void requestInfo() override {} + + virtual void getDownloadState() override {} + + virtual void requestDownload() override {} + + virtual void getBytesDownloaded() override {} + + virtual void cancelDownload() override {} +}; + +} // End of namespace PlayStore +} // End of namespace DLC + +#endif \ No newline at end of file diff --git a/backends/dlc/store.h b/backends/dlc/store.h new file mode 100644 index 000000000000..ec70bed4cef7 --- /dev/null +++ b/backends/dlc/store.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef DLC_STORE_H +#define DLC_STORE_H + +namespace DLC { + +class Store { + +public: + Store() {} + virtual ~Store() {} + + virtual void init() = 0; + + virtual void requestInfo() = 0; + + virtual void getDownloadState() = 0; + + virtual void requestDownload() = 0; + + virtual void getBytesDownloaded() = 0; + + virtual void cancelDownload() = 0; +}; + +} // End of namespace DLC + + +#endif diff --git a/backends/module.mk b/backends/module.mk index b6885089340c..8f58db7606c1 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ modular-backend.o \ audiocd/audiocd-stream.o \ audiocd/default/default-audiocd.o \ + dlc/dlcmanager.o \ events/default/default-events.o \ fs/abstract-fs.o \ fs/stdiostream.o \ diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index abfa957af7fa..11c955d83699 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -632,6 +632,7 @@ bool OSystem_Android::hasFeature(Feature f) { f == kFeatureJoystickDeadzone) { return true; } + if (f == kFeatureDLC) return true; /* Even if we are using the 2D graphics manager, * we are at one initGraphics3d call of supporting GLES2 */ if (f == kFeatureOpenGLForGame) return true; diff --git a/base/main.cpp b/base/main.cpp index 44098d82e024..6f3afde422d2 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -71,6 +71,7 @@ #include "backends/keymapper/action.h" #include "backends/keymapper/keymap.h" #include "backends/keymapper/keymapper.h" +#include "backends/dlc/dlcmanager.h" #ifdef USE_CLOUD #ifdef USE_LIBCURL @@ -699,6 +700,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { CloudMan.syncSaves(); #endif + DLCMan.init(); + // Unless a game was specified, show the launcher dialog if (nullptr == ConfMan.getActiveDomain()) launcherDialog(); @@ -848,6 +851,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { Cloud::CloudManager::destroy(); #endif #endif + DLC::DLCManager::destroy(); PluginManager::instance().unloadDetectionPlugin(); PluginManager::instance().unloadAllPlugins(); PluginManager::destroy(); diff --git a/common/system.h b/common/system.h index c7cc886d5814..6128c291a187 100644 --- a/common/system.h +++ b/common/system.h @@ -542,6 +542,11 @@ class OSystem : Common::NonCopyable { */ kFeatureShaders, + /** + * Support for downloading DLC packages. + */ + kFeatureDLC, + /** * Support for using the native system file browser dialog * through the DialogManager. diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 6fc6222aab0b..3aac8b46ca45 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -256,8 +256,11 @@ void LauncherDialog::build() { new ButtonWidget(this, _title + ".AboutButton", _("A~b~out"), _("About ScummVM"), kAboutCmd); // I18N: Button caption. O is the shortcut, Ctrl+O, put it in parens for non-latin (~O~) new ButtonWidget(this, _title + ".OptionsButton", _("Global ~O~ptions..."), _("Change global ScummVM options"), kOptionsCmd, 0, _c("Global ~O~pts...", "lowres")); - // I18N: Button download games button. - new ButtonWidget(this, _title + ".DownloadGamesButton", _("Download Games"), _("Download freeware games for ScummVM"), kDownloadGameCmd); + + if (g_system->hasFeature(OSystem::kFeatureDLC)) { + // I18N: Button browse downloadable games (DLC) + new ButtonWidget(this, _title + ".DownloadGamesButton", _("Download Games"), _("Download freeware games for ScummVM"), kDownloadGameCmd); + } // Above the lowest button rows: two more buttons (directly below the list box) DropdownButtonWidget *addButton =