From fade746f374cc801870e68934f1dbb3e9c726198 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 11 May 2016 22:52:14 +0600 Subject: CLOUD: Add USE_CLOUD feature Adds USE_CLOUD in both configure and create_project. --- backends/module.mk | 14 ++++++-------- backends/platform/sdl/sdl.cpp | 5 ++--- base/main.cpp | 7 +++---- base/version.cpp | 21 +++++++++++++++++++++ common/module.mk | 5 ++--- common/system.h | 15 ++++++--------- configure | 22 ++++++++++++++++++++++ devtools/create_project/create_project.cpp | 11 +++++++---- 8 files changed, 69 insertions(+), 31 deletions(-) diff --git a/backends/module.mk b/backends/module.mk index a1e9c11a1d..aa9e976fc2 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -19,6 +19,12 @@ MODULE_OBJS := \ saves/default/default-saves.o \ timer/default/default-timer.o +ifdef USE_CLOUD +MODULE_OBJS += \ + cloud/manager.o \ + cloud/storage.o \ + cloud/dropbox/dropboxstorage.o +endif ifdef USE_ELF_LOADER MODULE_OBJS += \ @@ -249,13 +255,5 @@ MODULE_OBJS += \ saves/recorder/recorder-saves.o endif -# I don't have any define, so I'd just add my files without any -# ifndef USE_CLOUD ? -MODULE_OBJS += \ - cloud/manager.o \ - cloud/storage.o \ - cloud/dropbox/storage.o -# endif - # Include common rules include $(srcdir)/rules.mk diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index e743bdf829..f07f568828 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -159,11 +159,10 @@ void OSystem_SDL::init() { _taskbarManager = new Common::TaskbarManager(); #endif -//TODO: define USE_CLOUD -//#if defined(USE_CLOUD) +#if defined(USE_CLOUD) if (_cloudThread == 0) _cloudThread = new Cloud::Manager(); -//#endif +#endif } diff --git a/base/main.cpp b/base/main.cpp index 001d864355..ac24376e37 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -476,11 +476,10 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { dlg.runModal(); } #endif - - //TODO: define USE_CLOUD -//#ifdef USE_CLOUD + +#ifdef USE_CLOUD system.getCloudManager()->syncSaves(); -//#endif +#endif // Unless a game was specified, show the launcher dialog if (0 == ConfMan.getActiveDomain()) diff --git a/base/version.cpp b/base/version.cpp index 299e4ce325..b2a7111a87 100644 --- a/base/version.cpp +++ b/base/version.cpp @@ -153,5 +153,26 @@ const char *gScummVMFeatures = "" #ifdef ENABLE_VKEYBD "virtual keyboard " +#endif + +#ifdef USE_CLOUD + "cloud (" +#ifdef USE_LIBCURL + "servers" +#ifdef USE_SDL_NET + " " +#endif +#endif +#ifdef USE_SDL_NET + "local" +#endif + ") " +#else +#ifdef USE_LIBCURL + "libcurl " +#endif +#ifdef USE_SDL_NET + "SDL_net " +#endif #endif ; diff --git a/common/module.mk b/common/module.mk index 29def4b8aa..7118ea36ff 100644 --- a/common/module.mk +++ b/common/module.mk @@ -62,9 +62,8 @@ MODULE_OBJS += \ updates.o endif -#TODO define USE_CLOUD -#ifdef USE_CLOUD -#endif +ifdef USE_CLOUD +endif # Include common rules include $(srcdir)/rules.mk diff --git a/common/system.h b/common/system.h index b1c74cbc5b..b24bc0a875 100644 --- a/common/system.h +++ b/common/system.h @@ -56,10 +56,9 @@ class HardwareInputSet; class Keymap; class KeymapperDefaultBindings; #endif -//TODO: define USE_CLOUD -//#if defined(USE_CLOUD) +#if defined(USE_CLOUD) class CloudManager; -//#endif +#endif } class AudioCDManager; @@ -182,15 +181,14 @@ protected: Common::UpdateManager *_updateManager; #endif -//TODO: define USE_CLOUD -//#if defined(USE_CLOUD) +#if defined(USE_CLOUD) /** * No default value is provided for _cloudThread by OSystem. * * @note _cloudThread is deleted by the OSystem destructor. */ Common::CloudManager *_cloudThread; -//#endif +#endif /** * No default value is provided for _fsFactory by OSystem. @@ -1130,8 +1128,7 @@ public: } #endif -//TODO: define USE_CLOUD -//#if defined(USE_CLOUD) +#if defined(USE_CLOUD) /** * Returns the CloudManager, used to sync save games and * upload/download files from user's cloud storage. @@ -1141,7 +1138,7 @@ public: virtual Common::CloudManager *getCloudManager() { return _cloudThread; } -//#endif +#endif /** * Returns the FilesystemFactory object, depending on the current architecture. diff --git a/configure b/configure index 9c3da0a214..8b6068b44a 100755 --- a/configure +++ b/configure @@ -4190,6 +4190,28 @@ echo "$_libcurl" define_in_config_if_yes "$_libcurl" "USE_LIBCURL" +# +# Check whether to build cloud integration support +# +echo_n "Cloud integration" +if test "$_cloud" = "no"; then + echo "no" +else + if test "_sdl_net" = "yes" -or "_libcurl" = "yes"; then + _cloud=yes + if test "_sdl_net" = "yes"; then + echo "local" + fi + if test "_libcurl" = "yes"; then + echo "servers" + fi + else + _cloud=no + echo "no" + fi +fi +define_in_config_if_yes $_cloud 'USE_CLOUD' + # # Check is NSDockTilePlugIn protocol is supported # diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 70781ffb55..91690c2128 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -1000,10 +1000,12 @@ const Feature s_features[] = { { "png", "USE_PNG", "libpng16", true, "libpng support" }, { "faad", "USE_FAAD", "libfaad", false, "AAC support" }, { "mpeg2", "USE_MPEG2", "libmpeg2", false, "MPEG-2 support" }, - { "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" }, - { "freetype", "USE_FREETYPE2", "freetype", true, "FreeType support" }, - { "jpeg", "USE_JPEG", "jpeg-static", true, "libjpeg support" }, - {"fluidsynth", "USE_FLUIDSYNTH", "libfluidsynth", true, "FluidSynth support" }, + { "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" }, + { "freetype", "USE_FREETYPE2", "freetype", true, "FreeType support" }, + { "jpeg", "USE_JPEG", "jpeg-static", true, "libjpeg support" }, + {"fluidsynth", "USE_FLUIDSYNTH", "libfluidsynth", true, "FluidSynth support" }, + { "libcurl", "USE_LIBCURL", "libcurl", true, "libcurl support" }, + { "sdlnet", "USE_SDL_NET", "SDL_net", true, "SDL_net support" }, // Feature flags { "bink", "USE_BINK", "", true, "Bink video support" }, @@ -1015,6 +1017,7 @@ const Feature s_features[] = { { "opengl", "USE_OPENGL", "", true, "OpenGL support" }, { "opengles", "USE_GLES", "", true, "forced OpenGL ES mode" }, { "taskbar", "USE_TASKBAR", "", true, "Taskbar integration support" }, + { "cloud", "USE_CLOUD", "", true, "Cloud integration support" }, { "translation", "USE_TRANSLATION", "", true, "Translation support" }, { "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"}, { "keymapper", "ENABLE_KEYMAPPER", "", false, "Keymapper support"}, -- cgit v1.2.3