defaults: refactoring, remove XASH_FBDEV macro, remove dead macros(DEFAULT_CON_MAXFRAC and DEFAULT_SV_FORCESIMULATING)

This commit is contained in:
Alibek Omarov 2019-11-24 03:01:43 +03:00
parent 755db4d56b
commit c613118199
2 changed files with 65 additions and 90 deletions

View File

@ -17,6 +17,7 @@ GNU General Public License for more details.
#define DEFAULTS_H #define DEFAULTS_H
#include "backends.h" #include "backends.h"
#include "build.h"
/* /*
=================================================================== ===================================================================
@ -26,109 +27,100 @@ SETUP BACKENDS DEFINITIONS
=================================================================== ===================================================================
*/ */
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
#if XASH_SDL
#if XASH_SDL == 2 // we are building using libSDL
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_SDL
#endif
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_SDL
#endif
#else
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_LINUX
#endif
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif
#endif
#ifdef XASH_SDL
// by default, use SDL subsystems
#ifndef XASH_VIDEO #ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_SDL #define XASH_VIDEO VIDEO_SDL
#endif // XASH_VIDEO #endif // XASH_VIDEO
#ifndef XASH_INPUT #ifndef XASH_INPUT
#define XASH_INPUT INPUT_SDL #define XASH_INPUT INPUT_SDL
#endif #endif // XASH_INPUT
#ifndef XASH_SOUND #ifndef XASH_SOUND
#define XASH_SOUND SOUND_SDL #define XASH_SOUND SOUND_SDL
#endif // XASH_SOUND
#if XASH_SDL == 2
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_SDL
#endif // XASH_TIMER
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_SDL
#endif // XASH_MESSAGEBOX
#endif #endif
#elif XASH_ANDROID
#endif //XASH_SDL // we are building for Android platform, use Android APIs
#if defined __ANDROID__ && !defined XASH_SDL
#ifndef XASH_VIDEO #ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_ANDROID #define XASH_VIDEO VIDEO_ANDROID
#endif #endif // XASH_VIDEO
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_LINUX
#endif
#ifndef XASH_INPUT #ifndef XASH_INPUT
#define XASH_INPUT INPUT_ANDROID #define XASH_INPUT INPUT_ANDROID
#endif #endif // XASH_INPUT
#ifndef XASH_SOUND #ifndef XASH_SOUND
#define XASH_SOUND SOUND_OPENSLES #define XASH_SOUND SOUND_OPENSLES
#endif #endif // XASH_SOUND
#ifndef XASH_MESSAGEBOX #ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_ANDROID #define XASH_MESSAGEBOX MSGBOX_ANDROID
#endif #endif // XASH_MESSAGEBOX
#endif // android case
#ifdef XASH_FBDEV #define XASH_USE_EVDEV
#elif XASH_LINUX
// we are building for Linux without SDL2, can draw only to framebuffer yet
#ifndef XASH_VIDEO #ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_FBDEV #define XASH_VIDEO VIDEO_FBDEV
#endif #endif // XASH_VIDEO
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_LINUX
#endif
#ifndef XASH_INPUT #ifndef XASH_INPUT
#define XASH_INPUT INPUT_EVDEV #define XASH_INPUT INPUT_EVDEV
#endif #endif // XASH_INPUT
#ifndef XASH_SOUND #ifndef XASH_SOUND
#define XASH_SOUND SOUND_ALSA #define XASH_SOUND SOUND_ALSA
#endif #endif // XASH_SOUND
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif
#define XASH_USE_EVDEV #define XASH_USE_EVDEV
#endif // android case #endif // XASH_LINUX
#endif // XASH_DEDICATED #endif // XASH_DEDICATED
//
// select messagebox implementation
//
#ifndef XASH_MESSAGEBOX
#if XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_WIN32
#else // !XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif // !XASH_WIN32
#endif // XASH_MESSAGEBOX
//
// select crashhandler based on defines // select crashhandler based on defines
//
#ifndef XASH_CRASHHANDLER #ifndef XASH_CRASHHANDLER
#ifdef _WIN32 #if XASH_WIN32 && defined(DBGHELP)
#ifdef DBGHELP #define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP #elif XASH_LINUX || XASH_BSD
#endif
#elif defined CRASHHANDLER
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT #define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
#else #else // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
#define XASH_CRASHHANDLER CRASHHANDLER_NULL #define XASH_CRASHHANDLER CRASHHANDLER_NULL
#endif #endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
#endif #endif
//
// no timer - no xash // no timer - no xash
//
#ifndef XASH_TIMER #ifndef XASH_TIMER
#ifdef _WIN32 #if XASH_WIN32
#define XASH_TIMER TIMER_WIN32 #define XASH_TIMER TIMER_WIN32
#else #else // !XASH_WIN32
#define XASH_TIMER TIMER_LINUX #define XASH_TIMER TIMER_LINUX
#endif #endif // !XASH_WIN32
#endif #endif
// //
@ -136,19 +128,15 @@ SETUP BACKENDS DEFINITIONS
// //
#ifndef XASH_VIDEO #ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_NULL #define XASH_VIDEO VIDEO_NULL
#endif #endif // XASH_VIDEO
#ifndef XASH_SOUND #ifndef XASH_SOUND
#define XASH_SOUND SOUND_NULL #define XASH_SOUND SOUND_NULL
#endif #endif // XASH_SOUND
#ifndef XASH_INPUT #ifndef XASH_INPUT
#define XASH_INPUT INPUT_NULL #define XASH_INPUT INPUT_NULL
#endif #endif // XASH_INPUT
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif
/* /*
========================================================================= =========================================================================
@ -158,53 +146,39 @@ Default build-depended cvar and constant values
========================================================================= =========================================================================
*/ */
#if defined __ANDROID__ || TARGET_OS_IPHONE #if XASH_MOBILE_PLATFORM
#define DEFAULT_TOUCH_ENABLE "1" #define DEFAULT_TOUCH_ENABLE "1"
#define DEFAULT_M_IGNORE "1" #define DEFAULT_M_IGNORE "1"
#else #else // !XASH_MOBILE_PLATFORM
#define DEFAULT_TOUCH_ENABLE "0" #define DEFAULT_TOUCH_ENABLE "0"
#define DEFAULT_M_IGNORE "0" #define DEFAULT_M_IGNORE "0"
#endif #endif // !XASH_MOBILE_PLATFORM
#if defined __ANDROID__ || TARGET_OS_IPHONE || defined __EMSCRIPTEN__ #if XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
#define XASH_INTERNAL_GAMELIBS #define XASH_INTERNAL_GAMELIBS
// this means that libraries are provided with engine, but not in game data // this means that libraries are provided with engine, but not in game data
// You need add library loading code to library.c when adding new platform // You need add library loading code to library.c when adding new platform
#endif #endif // XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
// Set ForceSimulating to 1 by default for dedicated, because AMXModX timers require this
// TODO: enable simulating for any server?
#ifdef XASH_DEDICATED
#define DEFAULT_SV_FORCESIMULATING "1"
#else
#define DEFAULT_SV_FORCESIMULATING "0"
#endif
// allow override for developer/debug builds // allow override for developer/debug builds
#ifndef DEFAULT_DEV #ifndef DEFAULT_DEV
#define DEFAULT_DEV 0 #define DEFAULT_DEV 0
#endif #endif // DEFAULT_DEV
#ifndef DEFAULT_FULLSCREEN #ifndef DEFAULT_FULLSCREEN
#define DEFAULT_FULLSCREEN 1 #define DEFAULT_FULLSCREEN 1
#endif #endif // DEFAULT_FULLSCREEN
#ifndef DEFAULT_ACCELERATED_RENDERER #ifndef DEFAULT_ACCELERATED_RENDERER
#ifdef __ANDROID__ #if XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gles1" #define DEFAULT_ACCELERATED_RENDERER "gles1"
#else #else // !XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gl" #define DEFAULT_ACCELERATED_RENDERER "gl"
#endif #endif // !XASH_MOBILE_PLATFORM
#endif // DEFAULT_ACCELERATED_RENDERER #endif // DEFAULT_ACCELERATED_RENDERER
#ifndef DEFAULT_SOFTWARE_RENDERER #ifndef DEFAULT_SOFTWARE_RENDERER
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft #define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
#endif // DEFAULT_SOFTWARE_RENDERER #endif // DEFAULT_SOFTWARE_RENDERER
#if TARGET_OS_IPHONE
#define DEFAULT_CON_MAXFRAC "0.5"
#else
#define DEFAULT_CON_MAXFRAC "1"
#endif
#endif // DEFAULTS_H #endif // DEFAULTS_H

View File

@ -37,7 +37,8 @@ def configure(conf):
for i in ['android', 'log', 'EGL']: for i in ['android', 'log', 'EGL']:
conf.check_cc(lib = i) conf.check_cc(lib = i)
elif conf.options.FBDEV_SW: elif conf.options.FBDEV_SW:
conf.define('XASH_FBDEV', 1) # unused, XASH_LINUX without XASH_SDL gives fbdev & alsa support
# conf.define('XASH_FBDEV', 1)
conf.check_cc( lib = 'asound' ) conf.check_cc( lib = 'asound' )
conf.check_cc( lib = 'rt' ) conf.check_cc( lib = 'rt' )
elif conf.options.SDL12: elif conf.options.SDL12: