From 07aa9595c0fa0bfd183d5929b9424cf5b4435b14 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 19 Sep 2019 17:08:16 +0300 Subject: [PATCH] engine: android: allow building dedicated on Android --- engine/common/sys_con.c | 2 +- engine/platform/android/android.c | 4 ++-- engine/platform/android/dlsym-weak.h | 1 + engine/platform/android/lib_android.c | 15 +++++++-------- engine/platform/android/lib_android.h | 2 -- engine/platform/android/vid_android.c | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/engine/common/sys_con.c b/engine/common/sys_con.c index c772545d..7541729b 100644 --- a/engine/common/sys_con.c +++ b/engine/common/sys_con.c @@ -162,7 +162,7 @@ void Sys_PrintLog( const char *pMsg ) time( &crt_time ); crt_tm = localtime( &crt_time ); -#ifdef __ANDROID__ +#if XASH_ANDROID && !XASH_DEDICATED __android_log_print( ANDROID_LOG_DEBUG, "Xash", "%s", pMsg ); #endif diff --git a/engine/platform/android/android.c b/engine/platform/android/android.c index c762aa74..2e80c7b9 100644 --- a/engine/platform/android/android.c +++ b/engine/platform/android/android.c @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include "platform/platform.h" -#if defined __ANDROID__ || 1 +#if !defined(XASH_DEDICATED) #include "input.h" #include "client.h" #include "sound.h" @@ -973,4 +973,4 @@ void Platform_RunEvents() pthread_mutex_lock( &events.framemutex ); } -#endif // __ANDROID__ +#endif // XASH_DEDICATED diff --git a/engine/platform/android/dlsym-weak.h b/engine/platform/android/dlsym-weak.h index b7f031c8..0652f1f1 100644 --- a/engine/platform/android/dlsym-weak.h +++ b/engine/platform/android/dlsym-weak.h @@ -12,6 +12,7 @@ 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. */ +#pragma once #ifndef DLSYM_WEAH_H #define DLSYM_WEAK_H diff --git a/engine/platform/android/lib_android.c b/engine/platform/android/lib_android.c index 72cfadb2..d7c8255b 100644 --- a/engine/platform/android/lib_android.c +++ b/engine/platform/android/lib_android.c @@ -12,8 +12,6 @@ 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. */ -#ifdef __ANDROID__ - #include "common.h" #include "library.h" #include "filesystem.h" @@ -54,11 +52,12 @@ void *ANDROID_LoadLibrary( const char *dllname ) void *ANDROID_GetProcAddress( void *hInstance, const char *name ) { void *p = dlsym( hInstance, name ); - + +#ifndef XASH_64BIT if( p ) return p; - - return dlsym_weak( hInstance, name ); + + p = dlsym_weak( hInstance, name ); +#endif // XASH_64BIT + + return p; } - - -#endif // __ANDROID__ diff --git a/engine/platform/android/lib_android.h b/engine/platform/android/lib_android.h index bf56affd..a88218ec 100644 --- a/engine/platform/android/lib_android.h +++ b/engine/platform/android/lib_android.h @@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #pragma once -#ifdef __ANDROID__ #ifndef ANDROID_LIB_H #define ANDROID_LIB_H @@ -21,4 +20,3 @@ void *ANDROID_LoadLibrary( const char *dllname ); void *ANDROID_GetProcAddress( void *hInstance, const char *name ); #endif // ANDROID_LIB_H -#endif // __ANDROID__ diff --git a/engine/platform/android/vid_android.c b/engine/platform/android/vid_android.c index 14d3e878..4b7c0d3f 100644 --- a/engine/platform/android/vid_android.c +++ b/engine/platform/android/vid_android.c @@ -1,5 +1,5 @@ #include "platform/platform.h" -#if defined XASH_VIDEO == VIDEO_ANDROID || 1 +#if defined XASH_VIDEO == VIDEO_ANDROID #include "input.h" #include "client.h" #include "filesystem.h"