From d97d4d6c42f4c089ee1899bf5e8490809fcade21 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sat, 16 Dec 2023 23:31:00 +0300 Subject: [PATCH] filesystem: add XASH_ANDROID_ASSETS macro for aassets switch --- common/defaults.h | 4 ++++ filesystem/android.c | 4 ++-- filesystem/filesystem.c | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/defaults.h b/common/defaults.h index 3267a950..cbcbd13e 100644 --- a/common/defaults.h +++ b/common/defaults.h @@ -164,6 +164,10 @@ Default build-depended cvar and constant values #define XASH_INTERNAL_GAMELIBS #endif // XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN +#if XASH_ANDROID && XASH_SDL +#define XASH_ANDROID_ASSETS 1 +#endif + // Defaults #ifndef DEFAULT_TOUCH_ENABLE #define DEFAULT_TOUCH_ENABLE "0" diff --git a/filesystem/android.c b/filesystem/android.c index 62c4eca3..fa587715 100644 --- a/filesystem/android.c +++ b/filesystem/android.c @@ -15,7 +15,7 @@ GNU General Public License for more details. #include "port.h" -#if XASH_ANDROID +#if XASH_ANDROID_ASSETS #include #include @@ -328,4 +328,4 @@ void FS_InitAndroid( void ) jni.getAssets = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssets", "(Z)Landroid/content/res/AssetManager;" ); } -#endif // XASH_ANDROID +#endif // XASH_ANDROID_ASSETS diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 5da9bc51..5c05939f 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -72,7 +72,7 @@ const fs_archive_t g_archives[] = static const fs_archive_t g_directory_archive = { NULL, SEARCHPATH_PLAIN, FS_AddDir_Fullpath, false }; -#ifdef XASH_ANDROID +#if XASH_ANDROID_ASSETS static const fs_archive_t g_android_archive = { NULL, SEARCHPATH_ANDROID_ASSETS, FS_AddAndroidAssets_Fullpath, false }; #endif @@ -406,7 +406,7 @@ void FS_AddGameDirectory( const char *dir, uint flags ) stringlistfreecontents( &list ); -#ifdef XASH_ANDROID +#if XASH_ANDROID_ASSETS FS_AddArchive_Fullpath( &g_android_archive, dir, flags ); #endif @@ -1461,7 +1461,7 @@ qboolean FS_InitStdio( qboolean unused_set_to_true, const char *rootdir, const c FS_InitMemory(); -#ifdef XASH_ANDROID +#if XASH_ANDROID_ASSETS FS_InitAndroid(); #endif