Compare commits

...

9 Commits

11 changed files with 68 additions and 35 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
custom: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/donate.md

View File

@@ -164,10 +164,6 @@ 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"

View File

@@ -1713,7 +1713,8 @@ pfnCvar_RegisterVariable
static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
{
// a1ba: try to mitigate outdated client.dll vulnerabilities
if( !Q_stricmp( szName, "motdfile" ))
if( !Q_stricmp( szName, "motdfile" )
|| !Q_stricmp( szName, "sensitivity" ))
flags |= FCVAR_PRIVILEGED;
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));

View File

@@ -1125,7 +1125,7 @@ Con_ClearField
*/
static void Con_ClearField( field_t *edit )
{
memset( edit->buffer, 0, MAX_STRING );
memset( edit->buffer, 0, sizeof( edit->buffer ));
edit->cursor = 0;
edit->scroll = 0;
}
@@ -1444,36 +1444,49 @@ static void Con_HistoryAppend( con_history_t *self, field_t *from )
static void Con_LoadHistory( con_history_t *self )
{
const byte *aFile = FS_LoadFile( "console_history.txt", NULL, true );
const char *pLine, *pFile;
int i, len;
field_t *f;
file_t *fd;
int i;
if( !aFile )
fd = FS_Open( "console_history.txt", "rb", true );
if( !fd )
return;
for( pFile = pLine = (char *)aFile; *pFile; pFile++ )
while( !FS_Eof( fd ))
{
if( *pFile != '\n' )
f = &self->lines[self->next % CON_HISTORY];
Con_ClearField( f );
f->widthInChars = con.linewidth;
FS_Gets( fd, f->buffer, sizeof( f->buffer ));
f->cursor = Q_strlen( f->buffer );
// skip empty lines
if( f->cursor == 0 )
continue;
Con_ClearField( &self->lines[self->next] );
len = Q_min( pFile - pLine + 1, sizeof( f->buffer ));
f = &self->lines[self->next % CON_HISTORY];
f->widthInChars = con.linewidth;
f->cursor = len - 1;
Q_strncpy( f->buffer, pLine, len);
// skip repeating lines
if( self->next > 0 )
{
field_t *prev;
prev = &self->lines[(self->next - 1) % CON_HISTORY];
if( !Q_stricmp( prev->buffer, f->buffer ))
continue;
}
self->next++;
pLine = pFile + 1;
}
FS_Close( fd );
for( i = self->next; i < CON_HISTORY; i++ )
{
Con_ClearField( &self->lines[i] );
self->lines[i].widthInChars = con.linewidth;
f = &self->lines[i];
Con_ClearField( f );
f->widthInChars = con.linewidth;
}
self->line = self->next;
@@ -1491,7 +1504,7 @@ static void Con_SaveHistory( con_history_t *self )
if( historyStart < 0 )
historyStart = 0;
f = FS_Open( "console_history.txt", "w", true );
f = FS_Open( "console_history.txt", "wb", true );
for( i = historyStart; i < self->next; i++ )
FS_Printf( f, "%s\n", self->lines[i % CON_HISTORY].buffer );

View File

@@ -565,7 +565,7 @@ static void R_CollectRendererNames( void )
"GL4ES",
#endif
#if XASH_REF_GLES3COMPAT_ENABLED
"GLES3 (gl2_shim)"
"GLES3 (gl2_shim)",
#endif
#if XASH_REF_SOFT_ENABLED
"Software",

View File

@@ -949,7 +949,7 @@ static void Cmd_Else_f( void )
static qboolean Cmd_ShouldAllowCommand( cmd_t *cmd, qboolean isPrivileged )
{
const char *prefixes[] = { "cl_", "gl_", "r_", "m_", "hud_" };
const char *prefixes[] = { "cl_", "gl_", "r_", "m_", "hud_", "joy_" };
int i;
// always allow local commands

View File

@@ -953,7 +953,7 @@ static void Cvar_SetGL( const char *name, const char *value )
static qboolean Cvar_ShouldSetCvar( convar_t *v, qboolean isPrivileged )
{
const char *prefixes[] = { "cl_", "gl_", "m_", "r_", "hud_" };
const char *prefixes[] = { "cl_", "gl_", "m_", "r_", "hud_", "joy_" };
int i;
if( isPrivileged )

View File

@@ -404,7 +404,7 @@ void Sys_Warn( const char *format, ... )
Msg( "Sys_Warn: %s\n", text );
if( !Host_IsDedicated() ) // dedicated server should not hang on messagebox
Platform_MessageBox( "Xash Warning", text, false );
Platform_MessageBox( "Xash Warning", text, true );
}
/*
@@ -449,7 +449,7 @@ void Sys_Error( const char *error, ... )
Wcon_ShowConsole( false );
#endif
Sys_Print( text );
Platform_MessageBox( "Xash Error", text, false );
Platform_MessageBox( "Xash Error", text, true );
}
else
{

View File

@@ -15,7 +15,7 @@ GNU General Public License for more details.
#include "port.h"
#if XASH_ANDROID_ASSETS
#if XASH_ANDROID
#include <sys/types.h>
#include <sys/stat.h>
@@ -276,6 +276,9 @@ searchpath_t *FS_AddAndroidAssets_Fullpath( const char *path, int flags )
android_assets_t *assets = NULL;
qboolean engine = true;
if( !jni.getPackageName || !jni.getCallingPackage || !jni.getAssetsList || !jni.getAssets )
return NULL;
if( FBitSet( flags, FS_STATIC_PATH | FS_CUSTOM_PATH ))
return NULL;
@@ -286,7 +289,7 @@ searchpath_t *FS_AddAndroidAssets_Fullpath( const char *path, int flags )
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", __func__, Android_GetPackageName( engine ));
return NULL;
}
@@ -326,6 +329,9 @@ void FS_InitAndroid( void )
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;" );
if( !jni.getPackageName || !jni.getCallingPackage || !jni.getAssetsList || !jni.getAssets )
Con_Reportf( S_WARN "%s: unable to find required JNI interface to load Android assets\n", __func__ );
}
#endif // XASH_ANDROID_ASSETS
#endif // XASH_ANDROID

View File

@@ -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 };
#if XASH_ANDROID_ASSETS
#if XASH_ANDROID
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 );
#if XASH_ANDROID_ASSETS
#if XASH_ANDROID
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();
#if XASH_ANDROID_ASSETS
#if XASH_ANDROID
FS_InitAndroid();
#endif

View File

@@ -1471,6 +1471,22 @@ static void GL_DeleteTexture( gl_texture_t *tex )
prev = &cur->nextHash;
}
// invalidate texture units state cache
for( int i = 0; i < MAX_TEXTURE_UNITS; i++ )
{
if( glState.currentTextures[i] == tex->texnum )
{
if( glState.currentTextureTargets[i] != GL_NONE )
{
GL_SelectTexture( i );
pglDisable( glState.currentTextureTargets[i] );
}
glState.currentTextureTargets[i] = GL_NONE;
glState.currentTextures[i] = -1;
glState.currentTexturesIndex[i] = 0;
}
}
// release source
if( tex->original )
gEngfuncs.FS_FreeImage( tex->original );