mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
BACKENDS: Add initial code for DLC Manager
This commit is contained in:
parent
0fa82ea4ae
commit
6e8bdee909
54
backends/dlc/android/playstore.h
Normal file
54
backends/dlc/android/playstore.h
Normal file
@ -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
|
52
backends/dlc/dlcmanager.cpp
Normal file
52
backends/dlc/dlcmanager.cpp
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "backends/dlc/dlcmanager.h"
|
||||
#include "backends/dlc/android/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
|
71
backends/dlc/dlcmanager.h
Normal file
71
backends/dlc/dlcmanager.h
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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<DLCManager> {
|
||||
|
||||
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
|
49
backends/dlc/store.h
Normal file
49
backends/dlc/store.h
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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
|
@ -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 \
|
||||
|
@ -637,6 +637,7 @@ bool OSystem_Android::hasFeature(Feature f) {
|
||||
f == kFeatureTouchscreen) {
|
||||
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;
|
||||
|
@ -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();
|
||||
|
@ -569,6 +569,11 @@ public:
|
||||
*/
|
||||
kFeatureShaders,
|
||||
|
||||
/**
|
||||
* Support for downloading DLC packages.
|
||||
*/
|
||||
kFeatureDLC,
|
||||
|
||||
/**
|
||||
* Support for using the native system file browser dialog
|
||||
* through the DialogManager.
|
||||
|
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user