diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 72b20786fc03..276ec7acb054 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -50,7 +50,7 @@ #include "audio/softsynth/emumidi.h" #include "gui/message.h" #include "backends/fs/fs-factory.h" -#ifdef __ANDROID__ +#ifdef ANDROID_BACKEND #include "backends/fs/android/android-fs-factory.h" #endif @@ -340,7 +340,7 @@ int MidiDriver_FluidSynth::open() { return MERR_DEVICE_NOT_AVAILABLE; } -#if defined(__ANDROID__) && defined(FS_HAS_STREAM_SUPPORT) +#if defined(ANDROID_BACKEND) && defined(FS_HAS_STREAM_SUPPORT) // In Android, when using SAF we need to wrap IO to make it work // We can only do this with FluidSynth 2.0 if (!isUsingInMemorySoundFontData && diff --git a/backends/fs/android/android-fs-factory.cpp b/backends/fs/android/android-fs-factory.cpp index af3dcab94161..0c260f98f088 100644 --- a/backends/fs/android/android-fs-factory.cpp +++ b/backends/fs/android/android-fs-factory.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - #include "backends/platform/android/jni-android.h" #include "backends/fs/android/android-fs-factory.h" @@ -131,5 +129,3 @@ bool AndroidFilesystemFactory::Config::isDrive(const Common::String &path) const } return false; } - -#endif diff --git a/backends/fs/android/android-posix-fs.cpp b/backends/fs/android/android-posix-fs.cpp index a03e7f66a3d3..7b8d89c41d3d 100644 --- a/backends/fs/android/android-posix-fs.cpp +++ b/backends/fs/android/android-posix-fs.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - // For remove() #include @@ -43,5 +41,3 @@ bool AndroidPOSIXFilesystemNode::remove() { setFlags(); return true; } - -#endif diff --git a/backends/fs/android/android-saf-fs.cpp b/backends/fs/android/android-saf-fs.cpp index c577229325ef..a3963fefed8f 100644 --- a/backends/fs/android/android-saf-fs.cpp +++ b/backends/fs/android/android-saf-fs.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - // Allow use of stuff in and abort() #define FORBIDDEN_SYMBOL_EXCEPTION_time_h #define FORBIDDEN_SYMBOL_EXCEPTION_abort @@ -816,5 +814,3 @@ void AddSAFFakeNode::makeProxySAF() const { _proxied = AndroidSAFFilesystemNode::makeFromTree(saftree); } - -#endif diff --git a/backends/mutex/pthread/pthread-mutex.cpp b/backends/mutex/pthread/pthread-mutex.cpp index 89170cce2314..aae20977d754 100644 --- a/backends/mutex/pthread/pthread-mutex.cpp +++ b/backends/mutex/pthread/pthread-mutex.cpp @@ -21,10 +21,6 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_time_h -#include "common/scummsys.h" - -#if defined(__ANDROID__) || defined(IPHONE) - #include "backends/mutex/pthread/pthread-mutex.h" #include @@ -82,5 +78,3 @@ bool PthreadMutexInternal::unlock() { Common::MutexInternal *createPthreadMutexInternal() { return new PthreadMutexInternal(); } - -#endif diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp index 203d92e8f99c..d77affbfd881 100644 --- a/backends/networking/curl/connectionmanager.cpp +++ b/backends/networking/curl/connectionmanager.cpp @@ -29,7 +29,7 @@ #include "common/system.h" #include "common/timer.h" -#if defined(__ANDROID__) +#if defined(ANDROID_BACKEND) #include "backends/platform/android/jni-android.h" #endif @@ -121,7 +121,7 @@ uint32 ConnectionManager::getCloudRequestsPeriodInMicroseconds() { } Common::String ConnectionManager::getCaCertPath() { -#if defined(__ANDROID__) +#if defined(ANDROID_BACKEND) // cacert path must exist on filesystem and be reachable by standard open syscall // Lets use ScummVM internal directory Common::String basePath = JNI::getScummVMBasePath(); diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 2dd3259e690a..ac0a612f2e8d 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - #define FORBIDDEN_SYMBOL_EXCEPTION_getenv(a) // Allow use of stuff in @@ -1160,5 +1158,3 @@ _s( const char * const *OSystem_Android::buildHelpDialogData() { return helpTabs; } - -#endif diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 530842ed304b..3942f0647ed0 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -22,8 +22,6 @@ #ifndef _ANDROID_H_ #define _ANDROID_H_ -#if defined(__ANDROID__) - #include "backends/platform/android/portdefs.h" #include "common/fs.h" #include "common/archive.h" @@ -279,4 +277,3 @@ class OSystem_Android : public ModularGraphicsBackend, Common::EventSource { }; #endif -#endif diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp index e7b929ecd0f4..b9a4cf264117 100644 --- a/backends/platform/android/asset-archive.cpp +++ b/backends/platform/android/asset-archive.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - #include #include @@ -162,5 +160,3 @@ Common::SeekableReadStream *AndroidAssetArchive::createReadStreamForMember(const } return new AssetInputStream(_am, path); } - -#endif diff --git a/backends/platform/android/asset-archive.h b/backends/platform/android/asset-archive.h index 2aedeb5dad89..625af4f11c3c 100644 --- a/backends/platform/android/asset-archive.h +++ b/backends/platform/android/asset-archive.h @@ -22,8 +22,6 @@ #ifndef _ANDROID_ASSET_H_ #define _ANDROID_ASSET_H_ -#if defined(__ANDROID__) - #include #include "common/str.h" @@ -50,4 +48,3 @@ class AndroidAssetArchive : public Common::Archive { }; #endif -#endif diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 4918b331d1e1..77886f7a05ba 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - // Allow use of stuff in #define FORBIDDEN_SYMBOL_EXCEPTION_time_h @@ -1551,5 +1549,3 @@ void OSystem_Android::setupTouchMode(int oldValue, int newValue) { _touch_pt_scroll.y = -1; } } - -#endif diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp index 7a01ddbcb55d..af0c104250e2 100644 --- a/backends/platform/android/jni-android.cpp +++ b/backends/platform/android/jni-android.cpp @@ -19,8 +19,6 @@ * */ -#if defined(__ANDROID__) - // Allow use of stuff in and abort() #define FORBIDDEN_SYMBOL_EXCEPTION_time_h #define FORBIDDEN_SYMBOL_EXCEPTION_abort @@ -1127,5 +1125,3 @@ jobject JNI::findSAFTree(const Common::String &name) { return tree; } - -#endif diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h index 8c6d721bad64..8b50dab0371d 100644 --- a/backends/platform/android/jni-android.h +++ b/backends/platform/android/jni-android.h @@ -22,8 +22,6 @@ #ifndef _ANDROID_JNI_H_ #define _ANDROID_JNI_H_ -#if defined(__ANDROID__) - #include #include #include @@ -227,4 +225,3 @@ inline int JNI::writeAudio(JNIEnv *env, jbyteArray &data, int offset, int size) } #endif -#endif diff --git a/backends/platform/android/snprintf.cpp b/backends/platform/android/snprintf.cpp index 907f2b706a6d..5b1ddcca52c6 100644 --- a/backends/platform/android/snprintf.cpp +++ b/backends/platform/android/snprintf.cpp @@ -183,8 +183,6 @@ * */ -#if defined(__ANDROID__) - // Allow use of stuff in #define FORBIDDEN_SYMBOL_EXCEPTION_time_h @@ -1318,5 +1316,4 @@ static LDOUBLE mypow10(int exponent) { } return result; } -#endif // defined(__ANDROID__) /* vim: set joinspaces noexpandtab textwidth=80 cinoptions=(4,u0: */ diff --git a/backends/platform/libretro/jni/Android.mk b/backends/platform/libretro/jni/Android.mk index 9d63b87bef03..f901a7fdb102 100644 --- a/backends/platform/libretro/jni/Android.mk +++ b/backends/platform/libretro/jni/Android.mk @@ -15,8 +15,7 @@ include $(ROOT_PATH)/Makefile.common include $(addprefix $(SCUMMVM_PATH)/, $(addsuffix /module.mk,$(MODULES))) -OBJS_MODULES := $(addprefix $(SCUMMVM_PATH)/, $(foreach MODULE,$(MODULES),$(MODULE_OBJS-$(MODULE)))) \ - $(CORE_PATH)/android-fs-factory.o +OBJS_MODULES := $(addprefix $(SCUMMVM_PATH)/, $(foreach MODULE,$(MODULES),$(MODULE_OBJS-$(MODULE)))) #TODO: # -O2 or higher causes segmentation fault with some engines (e.g. hopkins) diff --git a/backends/platform/libretro/src/android-fs-factory.cpp b/backends/platform/libretro/src/android-fs-factory.cpp deleted file mode 100644 index ae8cd3c15e63..000000000000 --- a/backends/platform/libretro/src/android-fs-factory.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 . - * - */ - -#if defined(__ANDROID__) - -/* TODO: Only purpose of this file is to return false to the call to - * AndroidFilesystemFactory::instance().hasSAF() in base/main.cpp used - * to show the SAF system popup, which would need android backend enabled. - * Cleaner fix to be found. - */ - -#define FORBIDDEN_SYMBOL_ALLOW_ALL - -#include "backends/fs/android/android-fs-factory.h" -#include "libretro-fs.h" - -namespace Common { -DECLARE_SINGLETON(AndroidFilesystemFactory); -} - -AndroidFilesystemFactory::AndroidFilesystemFactory() : _withSAF(false), _config(this) { -} - -void AndroidFilesystemFactory::initSAF() { - _withSAF = false; -} - -AbstractFSNode *AndroidFilesystemFactory::makeRootFileNode() const { - return new LibRetroFilesystemNode("/"); -} - -AbstractFSNode *AndroidFilesystemFactory::makeCurrentDirectoryFileNode() const { - return new LibRetroFilesystemNode("/"); -} - -AbstractFSNode *AndroidFilesystemFactory::makeFileNodePath(const Common::String &path) const { - assert(!path.empty()); - return new LibRetroFilesystemNode(path); -} - -AndroidFilesystemFactory::Config::Config(const AndroidFilesystemFactory *factory) { -} - -void AndroidFilesystemFactory::getSAFTrees(AbstractFSList &list, bool allowSAFadd) const { - return; -} - -bool AndroidFilesystemFactory::Config::getDrives(AbstractFSList &list, bool hidden) const { - return false; -} - -bool AndroidFilesystemFactory::Config::isDrive(const Common::String &path) const { - return false; -} - -#endif diff --git a/base/main.cpp b/base/main.cpp index 04cc2a02d9c5..ca4ab8904e76 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -92,7 +92,7 @@ #include "gui/updates-dialog.h" #endif -#ifdef __ANDROID__ +#ifdef ANDROID_BACKEND #include "backends/fs/android/android-fs-factory.h" #endif @@ -618,7 +618,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } #endif -#ifdef __ANDROID__ +#ifdef ANDROID_BACKEND // This early popup message for Android, informing the users about important // changes to file access, needs to be *after* language for the GUI has been selected. // Hence, we instantiate GUI Manager here, to take care of this. diff --git a/configure b/configure index fdaff113501f..1399f2d63095 100755 --- a/configure +++ b/configure @@ -4040,6 +4040,7 @@ case $_backend in android) append_var DEFINES "-DREDUCE_MEMORY_USAGE" append_var DEFINES "-DNONSTANDARD_PORT" + append_var DEFINES "-DANDROID_BACKEND" append_var INCLUDES '-I$(srcdir)/backends/platform/'$_backend append_var CXXFLAGS "-Wa,--noexecstack" append_var LDFLAGS "-Wl,-z,noexecstack" diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 04458ba93092..c4b9075ff1df 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -660,7 +660,7 @@ bool LauncherDialog::doGameDetection(const Common::Path &path) { Common::FSList files; if (!dir.getChildren(files, Common::FSNode::kListAll)) { Common::U32String msg(_("ScummVM couldn't open the specified directory!")); -#ifdef __ANDROID__ +#ifdef ANDROID_BACKEND msg += Common::U32String("\n\n"); msg += _("Did you add this directory to the SAF? Press the help button [?] on the top for detailed instructions"); #endif @@ -684,7 +684,7 @@ bool LauncherDialog::doGameDetection(const Common::Path &path) { if (candidates.empty()) { // No game was found in the specified directory Common::U32String msg(_("ScummVM could not find any game in the specified directory!")); -#ifdef __ANDROID__ +#ifdef ANDROID_BACKEND msg += Common::U32String("\n\n"); msg += _("Did you add this directory to the SAF? Press the help button [?] on the top for detailed instructions"); #endif