diff --git a/engine/client/input.c b/engine/client/input.c index f6e7779aad..f1e13dc673 100644 --- a/engine/client/input.c +++ b/engine/client/input.c @@ -173,12 +173,6 @@ void IN_ToggleClientMouse( int newstate, int oldstate ) if( newstate == oldstate ) return; - if( m_ignore.value ) - { - host.mouse_visible = newstate == key_menu || newstate == key_console; - return; - } - // since SetCursorType controls cursor visibility // execute it first, and then check mouse grab state if( newstate == key_menu || newstate == key_console ) @@ -198,6 +192,10 @@ void IN_ToggleClientMouse( int newstate, int oldstate ) #endif } + // don't leave the user without cursor if they enabled m_ignore + if( m_ignore.value ) + return; + if( oldstate == key_game ) { IN_DeactivateMouse(); diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index ee6de193f5..9c690071fe 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -569,6 +569,9 @@ static void R_CollectRendererNames( void ) #if XASH_REF_GL4ES_ENABLED "gl4es", #endif +#if XASH_REF_GLES3COMPAT_ENABLED + "gles3compat", +#endif #if XASH_REF_SOFT_ENABLED "soft", #endif @@ -589,6 +592,9 @@ static void R_CollectRendererNames( void ) #if XASH_REF_GL4ES_ENABLED "GL4ES", #endif +#if XASH_REF_GLES3COMPAT_ENABLED + "GLES3 (gl2_shim)" +#endif #if XASH_REF_SOFT_ENABLED "Software", #endif diff --git a/engine/common/host.c b/engine/common/host.c index fa29fde2ed..82dd16b43b 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -139,6 +139,9 @@ void Sys_PrintUsage( void ) O("-sdl_joy_old_api ","use SDL legacy joystick API") O("-sdl_renderer ","use alternative SDL_Renderer for software") #endif // XASH_SDL +#if XASH_ANDROID && !XASH_SDL + O("-nativeegl ","use native egl implementation. Use if screen does not update or black") +#endif // XASH_ANDROID #if XASH_DOS O("-novesa ","disable vesa") #endif // XASH_DOS diff --git a/filesystem/android.c b/filesystem/android.c index f7f0910df8..88c2f303bc 100644 --- a/filesystem/android.c +++ b/filesystem/android.c @@ -42,13 +42,6 @@ struct android_assets_s AAssetDir *dir; }; -/* -struct android_saf_s -{ - -}; -*/ - struct jni_methods_s { JNIEnv *env; @@ -57,15 +50,14 @@ struct jni_methods_s jmethodID getPackageName; jmethodID getCallingPackage; jmethodID getAssetsList; + jmethodID getAssets; } jni; static void Android_GetAssetManager( android_assets_t *assets ) { - jmethodID getAssets; jobject assetManager; - getAssets = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssets", "(Z)Landroid/content/res/AssetManager;" ); - assetManager = (*jni.env)->CallObjectMethod( jni.env, jni.activity, getAssets, assets->engine ); + assetManager = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAssets, assets->engine ); if( assetManager ) assets->asset_manager = AAssetManager_fromJava( jni.env, assetManager ); @@ -117,8 +109,7 @@ static void FS_CloseAndroidAssets( android_assets_t *assets ) static android_assets_t *FS_LoadAndroidAssets( qboolean engine ) { - android_assets_t *assets = (android_assets_t *)Mem_Calloc( fs_mempool, sizeof( android_assets_t )); - memset( assets, 0, sizeof( android_assets_t )); + android_assets_t *assets = Mem_Calloc( fs_mempool, sizeof( *assets )); assets->engine = engine; @@ -229,7 +220,7 @@ static void FS_Search_AndroidAssets( searchpath_t *search, stringlist_t *list, c static file_t *FS_OpenFile_AndroidAssets( searchpath_t *search, const char *filename, const char *mode, int pack_ind ) { - file_t *file = (file_t *)Mem_Calloc( fs_mempool, sizeof( file_t )); + file_t *file = Mem_Calloc( fs_mempool, sizeof( *file )); AAsset *assets = AAssetManager_open( search->assets->asset_manager, filename, AASSET_MODE_RANDOM ); file->handle = AAsset_openFileDescriptor( assets, &file->offset, &file->real_length ); @@ -279,29 +270,28 @@ searchpath_t *FS_AddAndroidAssets_Fullpath( const char *path, int flags ) android_assets_t *assets = NULL; qboolean engine = true; - if(( flags & FS_STATIC_PATH ) || ( flags & FS_CUSTOM_PATH )) + if( FBitSet( flags, FS_STATIC_PATH | FS_CUSTOM_PATH )) return NULL; - if(( flags & FS_GAMEDIR_PATH ) && Q_stricmp( GI->basedir, GI->gamefolder )) + if( FBitSet( flags, FS_GAMEDIR_PATH ) && Q_stricmp( GI->basedir, GI->gamefolder )) engine = false; assets = FS_LoadAndroidAssets( engine ); if( !assets ) { - Con_Reportf( S_ERROR "%s: unable to load Android assets \"%s\"\n", __FUNCTION__, Android_GetPackageName( engine ) ); + Con_Reportf( S_ERROR "%s: unable to load Android assets \"%s\"\n", __FUNCTION__, Android_GetPackageName( engine )); return NULL; } Q_strncpy( assets->package_name, Android_GetPackageName( engine ), sizeof( assets->package_name )); - search = (searchpath_t *)Mem_Calloc( fs_mempool, sizeof( searchpath_t )); - memset( search, 0, sizeof( searchpath_t )); + search = Mem_Calloc( fs_mempool, sizeof( *search )); Q_strncpy( search->filename, assets->package_name, sizeof( search->filename )); search->assets = assets; search->type = SEARCHPATH_ANDROID_ASSETS; - search->flags = FS_NOWRITE_PATH | FS_CUSTOM_PATH; + SetBits( search->flags, FS_NOWRITE_PATH | FS_CUSTOM_PATH ); search->pfnPrintInfo = FS_PrintInfo_AndroidAssets; search->pfnClose = FS_Close_AndroidAssets; @@ -329,6 +319,7 @@ void FS_InitAndroid( void ) jni.getPackageName = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getPackageName", "()Ljava/lang/String;" ); jni.getCallingPackage = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getCallingPackage", "()Ljava/lang/String;" ); jni.getAssetsList = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssetsList", "(ZLjava/lang/String;)[Ljava/lang/String;" ); + jni.getAssets = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssets", "(Z)Landroid/content/res/AssetManager;" ); } #endif // XASH_ANDROID diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index bb9174e0d8..a43a8f8fc0 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -156,7 +156,7 @@ void stringlistfreecontents( stringlist_t *list ) list->strings = NULL; } -void stringlistappend( stringlist_t *list, char *text ) +void stringlistappend( stringlist_t *list, const char *text ) { size_t textlen; diff --git a/filesystem/filesystem_internal.h b/filesystem/filesystem_internal.h index fbd8d9582a..266890e9e0 100644 --- a/filesystem/filesystem_internal.h +++ b/filesystem/filesystem_internal.h @@ -191,7 +191,7 @@ qboolean MD5_HashFile( byte digest[16], const char *pszFileName, uint seed[4] ); // stringlist ops void stringlistinit( stringlist_t *list ); void stringlistfreecontents( stringlist_t *list ); -void stringlistappend( stringlist_t *list, char *text ); +void stringlistappend( stringlist_t *list, const char *text ); void stringlistsort( stringlist_t *list ); void listdirectory( stringlist_t *list, const char *path ); diff --git a/filesystem/wscript b/filesystem/wscript index 896b6c3e11..daedf03f3f 100644 --- a/filesystem/wscript +++ b/filesystem/wscript @@ -12,22 +12,17 @@ def configure(conf): if conf.env.DEST_OS == 'android': conf.check_cc(lib='android') - - if conf.env.DEST_OS != 'android': - if conf.env.cxxshlib_PATTERN.startswith('lib'): - conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:] + elif conf.env.cxxshlib_PATTERN.startswith('lib'): # remove lib prefix for other systems than Android + conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:] def build(bld): bld(name = 'filesystem_includes', export_includes = '.') - libs = [ 'filesystem_includes' ] + libs = [ 'filesystem_includes', 'sdk_includes' ] + # on PSVita do not link any libraries that are already in the main executable, but add the includes target - if bld.env.DEST_OS == 'psvita': - libs += [ 'sdk_includes' ] - elif bld.env.DEST_OS == 'android': + if bld.env.DEST_OS != 'psvita': libs += [ 'public', 'ANDROID' ] - else: - libs += [ 'public' ] bld.shlib(target = 'filesystem_stdio', features = 'cxx seq', diff --git a/scripts/waifulib/compiler_optimizations.py b/scripts/waifulib/compiler_optimizations.py index 64f1e62312..f65e7aeb11 100644 --- a/scripts/waifulib/compiler_optimizations.py +++ b/scripts/waifulib/compiler_optimizations.py @@ -30,7 +30,7 @@ } ''' -VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'sanitize', 'msan', 'none'] +VALID_BUILD_TYPES = ['fastnative', 'fast', 'humanrights', 'debug', 'sanitize', 'msan', 'none'] LINKFLAGS = { 'common': { @@ -75,7 +75,7 @@ 'clang': ['-Ofast', '-march=native'], 'default': ['-O3'] }, - 'release': { + 'humanrights': { 'msvc': ['/O2', '/Zi'], 'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'], 'gcc': ['-O3', '-fno-semantic-interposition'], @@ -119,7 +119,7 @@ def options(opt): grp = opt.add_option_group('Compiler optimization options') - grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default='release', + grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default='humanrights', help = 'build type: debug, release or none(custom flags)') grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False, @@ -131,6 +131,11 @@ def options(opt): def configure(conf): conf.start_msg('Build type') + # legacy naming for default release build + # https://chaos.social/@karolherbst/111340511652012860 + if conf.options.BUILD_TYPE == 'release': + conf.options.BUILD_TYPE = 'humanrights' + if not conf.options.BUILD_TYPE in VALID_BUILD_TYPES: conf.end_msg(conf.options.BUILD_TYPE, color='RED') conf.fatal('Invalid build type. Valid are: %s' % ', '.join(VALID_BUILD_TYPES)) diff --git a/wscript b/wscript index 359c87f6ec..07ee954779 100644 --- a/wscript +++ b/wscript @@ -196,12 +196,13 @@ def configure(conf): # modify options dictionary early if conf.env.DEST_OS == 'android': - conf.options.NO_VGUI = True # skip vgui - conf.options.NANOGL = True - conf.options.GLWES = True - conf.options.GL4ES = True - conf.options.GL = False - conf.options.SINGLE_BINARY = True + conf.options.NO_VGUI = True # skip vgui + conf.options.NANOGL = True + conf.options.GLWES = True + conf.options.GL4ES = True + conf.options.GLES3COMPAT = True + conf.options.GL = False + conf.options.SINGLE_BINARY = True conf.define('XASH_SDLMAIN', 1) elif conf.env.MAGX: conf.options.SDL12 = True