ALL: Fix compilation with disabled cloud but enabled libcurl

This commit is contained in:
Eugene Sandulenko 2016-10-17 18:45:12 +02:00
parent d3c173da7a
commit e8b70a4686
12 changed files with 46 additions and 39 deletions

View file

@ -19,6 +19,8 @@ MODULE_OBJS := \
saves/default/default-saves.o \ saves/default/default-saves.o \
timer/default/default-timer.o timer/default/default-timer.o
ifdef USE_CLOUD
ifdef USE_LIBCURL ifdef USE_LIBCURL
MODULE_OBJS += \ MODULE_OBJS += \
cloud/cloudicon.o \ cloud/cloudicon.o \
@ -52,7 +54,12 @@ MODULE_OBJS += \
cloud/onedrive/onedrivecreatedirectoryrequest.o \ cloud/onedrive/onedrivecreatedirectoryrequest.o \
cloud/onedrive/onedrivetokenrefresher.o \ cloud/onedrive/onedrivetokenrefresher.o \
cloud/onedrive/onedrivelistdirectoryrequest.o \ cloud/onedrive/onedrivelistdirectoryrequest.o \
cloud/onedrive/onedriveuploadrequest.o \ cloud/onedrive/onedriveuploadrequest.o
endif
endif
ifdef USE_LIBCURL
MODULE_OBJS += \
networking/curl/connectionmanager.o \ networking/curl/connectionmanager.o \
networking/curl/networkreadstream.o \ networking/curl/networkreadstream.o \
networking/curl/curlrequest.o \ networking/curl/curlrequest.o \

View file

@ -27,7 +27,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#include "common/file.h" #include "common/file.h"
#endif #endif
@ -47,7 +47,7 @@
#include <errno.h> // for removeSavefile() #include <errno.h> // for removeSavefile()
#endif #endif
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
const char *DefaultSaveFileManager::TIMESTAMPS_FILENAME = "timestamps"; const char *DefaultSaveFileManager::TIMESTAMPS_FILENAME = "timestamps";
#endif #endif
@ -147,7 +147,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
} }
} }
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
// Update file's timestamp // Update file's timestamp
Common::HashMap<Common::String, uint32> timestamps = loadTimestamps(); Common::HashMap<Common::String, uint32> timestamps = loadTimestamps();
timestamps[filename] = INVALID_TIMESTAMP; timestamps[filename] = INVALID_TIMESTAMP;
@ -182,7 +182,7 @@ bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
if (getError().getCode() != Common::kNoError) if (getError().getCode() != Common::kNoError)
return false; return false;
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
// Update file's timestamp // Update file's timestamp
Common::HashMap<Common::String, uint32> timestamps = loadTimestamps(); Common::HashMap<Common::String, uint32> timestamps = loadTimestamps();
Common::HashMap<Common::String, uint32>::iterator it = timestamps.find(filename); Common::HashMap<Common::String, uint32>::iterator it = timestamps.find(filename);
@ -247,7 +247,7 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) {
// Check that path exists and is usable. // Check that path exists and is usable.
checkPath(Common::FSNode(savePathName)); checkPath(Common::FSNode(savePathName));
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
if (!files.empty()) updateSavefilesList(files); //makes this cache invalid if (!files.empty()) updateSavefilesList(files); //makes this cache invalid
else _lockedFiles = files; else _lockedFiles = files;
@ -288,7 +288,7 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) {
_cachedDirectory = savePathName; _cachedDirectory = savePathName;
} }
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps() { Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps() {
Common::HashMap<Common::String, uint32> timestamps; Common::HashMap<Common::String, uint32> timestamps;

View file

@ -23,7 +23,7 @@
#include "common/util.h" #include "common/util.h"
#include "common/savefile.h" #include "common/savefile.h"
#include "common/str.h" #include "common/str.h"
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#endif #endif
@ -39,7 +39,7 @@ void OutSaveFile::clearErr() { _wrapped->clearErr(); }
void OutSaveFile::finalize() { void OutSaveFile::finalize() {
_wrapped->finalize(); _wrapped->finalize();
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
CloudMan.syncSaves(); CloudMan.syncSaves();
#endif #endif
} }

View file

@ -66,6 +66,7 @@
#endif #endif
#include "backends/keymapper/keymapper.h" #include "backends/keymapper/keymapper.h"
#ifdef USE_CLOUD
#ifdef USE_LIBCURL #ifdef USE_LIBCURL
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#include "backends/networking/curl/connectionmanager.h" #include "backends/networking/curl/connectionmanager.h"
@ -73,6 +74,7 @@
#ifdef USE_SDL_NET #ifdef USE_SDL_NET
#include "backends/networking/sdl_net/localwebserver.h" #include "backends/networking/sdl_net/localwebserver.h"
#endif #endif
#endif
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
#include "backends/platform/wince/CELauncherDialog.h" #include "backends/platform/wince/CELauncherDialog.h"
@ -485,7 +487,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
} }
#endif #endif
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
CloudMan.init(); CloudMan.init();
CloudMan.syncSaves(); CloudMan.syncSaves();
#endif #endif
@ -598,6 +600,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
launcherDialog(); launcherDialog();
} }
} }
#ifdef USE_CLOUD
#ifdef USE_SDL_NET #ifdef USE_SDL_NET
Networking::LocalWebserver::destroy(); Networking::LocalWebserver::destroy();
#endif #endif
@ -605,6 +608,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
Networking::ConnectionManager::destroy(); Networking::ConnectionManager::destroy();
//I think it's important to destroy it after ConnectionManager //I think it's important to destroy it after ConnectionManager
Cloud::CloudManager::destroy(); Cloud::CloudManager::destroy();
#endif
#endif #endif
PluginManager::instance().unloadAllPlugins(); PluginManager::instance().unloadAllPlugins();
PluginManager::destroy(); PluginManager::destroy();

8
configure vendored
View file

@ -3349,14 +3349,6 @@ case $_backend in
esac esac
append_var MODULES "backends/platform/$_backend" append_var MODULES "backends/platform/$_backend"
#
# Disasble use of SDL_net and libcurl is cloud is disabled
#
if test "$_cloud" = no ; then
_sdlnet=no;
_libcurl=no;
fi
# #
# Setup SDL specifics for SDL based backends # Setup SDL specifics for SDL based backends
# #

View file

@ -38,7 +38,7 @@
#include "gui/widgets/tab.h" #include "gui/widgets/tab.h"
#include "gui/widgets/popup.h" #include "gui/widgets/popup.h"
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#endif #endif
@ -506,7 +506,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// User made his choice... // User made his choice...
Common::FSNode dir(browser.getResult()); Common::FSNode dir(browser.getResult());
_savePathWidget->setLabel(dir.getPath()); _savePathWidget->setLabel(dir.getPath());
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
MessageDialog warningMessage(_("Saved games sync feature doesn't work with non-default directories. If you want your saved games to sync, use default directory.")); MessageDialog warningMessage(_("Saved games sync feature doesn't work with non-default directories. If you want your saved games to sync, use default directory."));
warningMessage.runModal(); warningMessage.runModal();
#endif #endif

View file

@ -52,7 +52,7 @@
#include "gui/ThemeEval.h" #include "gui/ThemeEval.h"
#include "graphics/cursorman.h" #include "graphics/cursorman.h"
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#endif #endif
@ -328,7 +328,7 @@ void LauncherDialog::addGame() {
if (_browser->runModal() > 0) { if (_browser->runModal() > 0) {
// User made his choice... // User made his choice...
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
String selectedDirectory = _browser->getResult().getPath(); String selectedDirectory = _browser->getResult().getPath();
String bannedDirectory = CloudMan.getDownloadLocalDirectory(); String bannedDirectory = CloudMan.getDownloadLocalDirectory();
if (selectedDirectory.size() && selectedDirectory.lastChar() != '/' && selectedDirectory.lastChar() != '\\') if (selectedDirectory.size() && selectedDirectory.lastChar() != '/' && selectedDirectory.lastChar() != '\\')

View file

@ -58,12 +58,14 @@ MODULE_OBJS += \
endif endif
endif endif
ifdef USE_CLOUD
ifdef USE_LIBCURL ifdef USE_LIBCURL
MODULE_OBJS += \ MODULE_OBJS += \
downloaddialog.o \ downloaddialog.o \
remotebrowser.o \ remotebrowser.o \
storagewizarddialog.o storagewizarddialog.o
endif endif
endif
ifdef ENABLE_EVENTRECORDER ifdef ENABLE_EVENTRECORDER
MODULE_OBJS += \ MODULE_OBJS += \

View file

@ -45,6 +45,7 @@
#include "widgets/scrollcontainer.h" #include "widgets/scrollcontainer.h"
#include "widgets/edittext.h" #include "widgets/edittext.h"
#ifdef USE_CLOUD
#ifdef USE_LIBCURL #ifdef USE_LIBCURL
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#include "gui/downloaddialog.h" #include "gui/downloaddialog.h"
@ -54,6 +55,7 @@
#ifdef USE_SDL_NET #ifdef USE_SDL_NET
#include "backends/networking/sdl_net/localwebserver.h" #include "backends/networking/sdl_net/localwebserver.h"
#endif #endif
#endif
namespace GUI { namespace GUI {
@ -412,7 +414,7 @@ void OptionsDialog::close() {
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain)); g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain));
if (ConfMan.hasKey("filtering")) if (ConfMan.hasKey("filtering"))
g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering", _domain)); g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering", _domain));
OSystem::TransactionError gfxError = g_system->endGFXTransaction(); OSystem::TransactionError gfxError = g_system->endGFXTransaction();
// Since this might change the screen resolution we need to give // Since this might change the screen resolution we need to give
@ -455,7 +457,7 @@ void OptionsDialog::close() {
message += "\n"; message += "\n";
message += _("the fullscreen setting could not be changed"); message += _("the fullscreen setting could not be changed");
} }
if (gfxError & OSystem::kTransactionFilteringFailed) { if (gfxError & OSystem::kTransactionFilteringFailed) {
ConfMan.setBool("filtering", g_system->getFeatureState(OSystem::kFeatureFilteringMode), _domain); ConfMan.setBool("filtering", g_system->getFeatureState(OSystem::kFeatureFilteringMode), _domain);
message += "\n"; message += "\n";
@ -806,7 +808,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
// Fullscreen checkbox // Fullscreen checkbox
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode")); _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
// Filtering checkbox // Filtering checkbox
_filteringCheckbox = new CheckboxWidget(boss, prefix + "grFilteringCheckbox", _("Filter graphics"), _("Use linear filtering when scaling graphics")); _filteringCheckbox = new CheckboxWidget(boss, prefix + "grFilteringCheckbox", _("Filter graphics"), _("Use linear filtering when scaling graphics"));
@ -1310,7 +1312,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", kCloudTabContainerReflowCmd); ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", kCloudTabContainerReflowCmd);
container->setTarget(this); container->setTarget(this);
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
_selectedStorageIndex = CloudMan.getStorageIndex(); _selectedStorageIndex = CloudMan.getStorageIndex();
#else #else
_selectedStorageIndex = 0; _selectedStorageIndex = 0;
@ -1318,7 +1320,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
_storagePopUpDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StoragePopupDesc", _("Storage:"), _("Active cloud storage")); _storagePopUpDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StoragePopupDesc", _("Storage:"), _("Active cloud storage"));
_storagePopUp = new PopUpWidget(container, "GlobalOptions_Cloud_Container.StoragePopup"); _storagePopUp = new PopUpWidget(container, "GlobalOptions_Cloud_Container.StoragePopup");
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
Common::StringArray list = CloudMan.listStorages(); Common::StringArray list = CloudMan.listStorages();
for (uint32 i = 0; i < list.size(); ++i) for (uint32 i = 0; i < list.size(); ++i)
_storagePopUp->appendEntry(list[i], i); _storagePopUp->appendEntry(list[i], i);

View file

@ -22,7 +22,7 @@
#include "gui/saveload-dialog.h" #include "gui/saveload-dialog.h"
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
#include "backends/cloud/cloudmanager.h" #include "backends/cloud/cloudmanager.h"
#include "backends/cloud/savessyncrequest.h" #include "backends/cloud/savessyncrequest.h"
#include "backends/networking/curl/connectionmanager.h" #include "backends/networking/curl/connectionmanager.h"
@ -41,7 +41,7 @@
namespace GUI { namespace GUI {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
enum { enum {
kCancelSyncCmd = 'PDCS', kCancelSyncCmd = 'PDCS',
@ -157,7 +157,7 @@ SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const b
} }
SaveLoadChooserDialog::~SaveLoadChooserDialog() { SaveLoadChooserDialog::~SaveLoadChooserDialog() {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
CloudMan.setSyncTarget(nullptr); //not that dialog, at least CloudMan.setSyncTarget(nullptr); //not that dialog, at least
#endif #endif
} }
@ -173,7 +173,7 @@ void SaveLoadChooserDialog::open() {
} }
void SaveLoadChooserDialog::close() { void SaveLoadChooserDialog::close() {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
CloudMan.setSyncTarget(nullptr); //not that dialog, at least CloudMan.setSyncTarget(nullptr); //not that dialog, at least
#endif #endif
Dialog::close(); Dialog::close();
@ -215,7 +215,7 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin
} }
#endif // !DISABLE_SAVELOADCHOOSER_GRID #endif // !DISABLE_SAVELOADCHOOSER_GRID
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
if (cmd == kSavesSyncProgressCmd || cmd == kSavesSyncEndedCmd) { if (cmd == kSavesSyncProgressCmd || cmd == kSavesSyncEndedCmd) {
//this dialog only gets these commands if the progress dialog was shown and user clicked "run in background" //this dialog only gets these commands if the progress dialog was shown and user clicked "run in background"
return updateSaveList(); return updateSaveList();
@ -225,7 +225,7 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin
return Dialog::handleCommand(sender, cmd, data); return Dialog::handleCommand(sender, cmd, data);
} }
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) { void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) {
if (!CloudMan.isSyncing()) { if (!CloudMan.isSyncing()) {
if (hasSavepathOverride) { if (hasSavepathOverride) {
@ -240,7 +240,7 @@ void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) {
#endif #endif
void SaveLoadChooserDialog::handleTickle() { void SaveLoadChooserDialog::handleTickle() {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
if (!_dialogWasShown && CloudMan.isSyncing()) { if (!_dialogWasShown && CloudMan.isSyncing()) {
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); Common::Array<Common::String> files = CloudMan.getSyncingFiles();
if (!files.empty()) { if (!files.empty()) {
@ -280,7 +280,7 @@ void SaveLoadChooserDialog::reflowLayout() {
} }
void SaveLoadChooserDialog::updateSaveList() { void SaveLoadChooserDialog::updateSaveList() {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
g_system->getSavefileManager()->updateSavefilesList(files); g_system->getSavefileManager()->updateSavefilesList(files);
#endif #endif
@ -291,7 +291,7 @@ void SaveLoadChooserDialog::listSaves() {
if (!_metaEngine) return; //very strange if (!_metaEngine) return; //very strange
_saveList = _metaEngine->listSaves(_target.c_str()); _saveList = _metaEngine->listSaves(_target.c_str());
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
//if there is Cloud support, add currently synced files as "locked" saves in the list //if there is Cloud support, add currently synced files as "locked" saves in the list
if (_metaEngine->hasFeature(MetaEngine::kSimpleSavesNames)) { if (_metaEngine->hasFeature(MetaEngine::kSimpleSavesNames)) {
Common::String pattern = _target + ".###"; Common::String pattern = _target + ".###";

View file

@ -30,7 +30,7 @@
namespace GUI { namespace GUI {
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
enum SaveLoadCloudSyncProgress { enum SaveLoadCloudSyncProgress {
kSavesSyncProgressCmd = 'SSPR', kSavesSyncProgressCmd = 'SSPR',
kSavesSyncEndedCmd = 'SSEN' kSavesSyncEndedCmd = 'SSEN'
@ -81,7 +81,7 @@ public:
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
virtual void runSaveSync(bool hasSavepathOverride); virtual void runSaveSync(bool hasSavepathOverride);
#endif #endif

View file

@ -87,7 +87,7 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con
if (!_impl) if (!_impl)
return -1; return -1;
#ifdef USE_LIBCURL #if defined(USE_CLOUD) && defined(USE_LIBCURL)
_impl->runSaveSync(ConfMan.hasKey("savepath", target)); _impl->runSaveSync(ConfMan.hasKey("savepath", target));
#endif #endif