mirror of https://github.com/FWGS/xash3d-fwgs
platform/android_nosdl: fix build (ndk10, host clang15)
This commit is contained in:
parent
eed13cf9f2
commit
bb9775048b
|
@ -579,12 +579,12 @@ Platform_Init
|
||||||
Initialize android-related cvars
|
Initialize android-related cvars
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
void Platform_Init( void )
|
void Android_Init( void )
|
||||||
{
|
{
|
||||||
android_sleep = Cvar_Get( "android_sleep", "1", FCVAR_ARCHIVE, "Enable sleep in background" );
|
android_sleep = Cvar_Get( "android_sleep", "1", FCVAR_ARCHIVE, "Enable sleep in background" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Shutdown( void )
|
void Android_Shutdown( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ void Platform_Vibrate( float life, char flags )
|
||||||
Android_GetNativeObject
|
Android_GetNativeObject
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
void *Platform_GetNativeObject( const char *objName )
|
void *Android_GetNativeObject( const char *objName )
|
||||||
{
|
{
|
||||||
static const char *availObjects[] = { "JNIEnv", "ActivityClass", NULL };
|
static const char *availObjects[] = { "JNIEnv", "ActivityClass", NULL };
|
||||||
void *object = NULL;
|
void *object = NULL;
|
||||||
|
@ -750,7 +750,7 @@ Android_ShowMouse
|
||||||
*/
|
*/
|
||||||
void Android_ShowMouse( qboolean show )
|
void Android_ShowMouse( qboolean show )
|
||||||
{
|
{
|
||||||
if( m_ignore->value )
|
if( m_ignore.value )
|
||||||
show = true;
|
show = true;
|
||||||
(*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.showMouse, show );
|
(*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.showMouse, show );
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,6 @@ void Platform_RunEvents( void )
|
||||||
|
|
||||||
if( events.queue[i].arg == K_AUX31 || events.queue[i].arg == K_AUX29 )
|
if( events.queue[i].arg == K_AUX31 || events.queue[i].arg == K_AUX29 )
|
||||||
{
|
{
|
||||||
host.force_draw_version = true;
|
|
||||||
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -849,7 +848,6 @@ void Platform_RunEvents( void )
|
||||||
|
|
||||||
if( events.queue[i].arg == K_AUX31 || events.queue[i].arg == K_AUX29 )
|
if( events.queue[i].arg == K_AUX31 || events.queue[i].arg == K_AUX29 )
|
||||||
{
|
{
|
||||||
host.force_draw_version = true;
|
|
||||||
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -862,8 +860,7 @@ void Platform_RunEvents( void )
|
||||||
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 );
|
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 );
|
||||||
Android_UpdateSurface( true );
|
Android_UpdateSurface( true );
|
||||||
host.status = HOST_FRAME;
|
host.status = HOST_FRAME;
|
||||||
SetBits( gl_vsync->flags, FCVAR_CHANGED ); // set swap interval
|
SetBits( gl_vsync.flags, FCVAR_CHANGED ); // set swap interval
|
||||||
host.force_draw_version = true;
|
|
||||||
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,7 +880,7 @@ void Platform_RunEvents( void )
|
||||||
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 0 );
|
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 0 );
|
||||||
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 );
|
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 );
|
||||||
Android_UpdateSurface( true );
|
Android_UpdateSurface( true );
|
||||||
SetBits( gl_vsync->flags, FCVAR_CHANGED ); // set swap interval
|
SetBits( gl_vsync.flags, FCVAR_CHANGED ); // set swap interval
|
||||||
VID_SetMode();
|
VID_SetMode();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -945,11 +942,9 @@ void Platform_RunEvents( void )
|
||||||
// re-enable sound after onPause
|
// re-enable sound after onPause
|
||||||
// host.status = HOST_FRAME;
|
// host.status = HOST_FRAME;
|
||||||
SNDDMA_Activate( true );
|
SNDDMA_Activate( true );
|
||||||
host.force_draw_version = true;
|
|
||||||
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
break;
|
break;
|
||||||
case event_onfocuschange:
|
case event_onfocuschange:
|
||||||
host.force_draw_version = true;
|
|
||||||
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -963,7 +958,7 @@ void Platform_RunEvents( void )
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
// if engine does not use utf-8, we need to convert it to preferred encoding
|
// if engine does not use utf-8, we need to convert it to preferred encoding
|
||||||
if( !Q_stricmp( cl_charset->string, "utf-8" ) )
|
if( !Q_stricmp( cl_charset.string, "utf-8" ) )
|
||||||
ch = (unsigned char)events.inputtext[i];
|
ch = (unsigned char)events.inputtext[i];
|
||||||
else
|
else
|
||||||
ch = Con_UtfProcessCharForce( (unsigned char)events.inputtext[i] );
|
ch = Con_UtfProcessCharForce( (unsigned char)events.inputtext[i] );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#in !XASH_SDL
|
#if !XASH_SDL
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
@ -75,6 +75,7 @@ static dllfunc_t egl_funcs[] =
|
||||||
#undef EGL_FF
|
#undef EGL_FF
|
||||||
dll_info_t egl_info = { "libEGL.so", egl_funcs, false };
|
dll_info_t egl_info = { "libEGL.so", egl_funcs, false };
|
||||||
|
|
||||||
|
|
||||||
static struct nativeegl_s
|
static struct nativeegl_s
|
||||||
{
|
{
|
||||||
qboolean valid;
|
qboolean valid;
|
||||||
|
@ -88,6 +89,8 @@ static struct nativeegl_s
|
||||||
const char *extensions;
|
const char *extensions;
|
||||||
} negl;
|
} negl;
|
||||||
|
|
||||||
|
convar_t *cv_vid_scale;
|
||||||
|
convar_t *cv_vid_rotate;
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
Android_SwapInterval
|
Android_SwapInterval
|
||||||
|
@ -243,6 +246,8 @@ qboolean R_Init_Video( const int type )
|
||||||
{
|
{
|
||||||
char buf[MAX_VA_STRING];
|
char buf[MAX_VA_STRING];
|
||||||
qboolean retval;
|
qboolean retval;
|
||||||
|
cv_vid_scale = Cvar_FindVar( "vid_scale" );
|
||||||
|
cv_vid_rotate = Cvar_FindVar( "vid_rotate" );
|
||||||
|
|
||||||
switch( Android_GetSelectedPixelFormat() )
|
switch( Android_GetSelectedPixelFormat() )
|
||||||
{
|
{
|
||||||
|
@ -441,7 +446,7 @@ qboolean VID_SetMode( void )
|
||||||
|
|
||||||
if( vid_android.has_context )
|
if( vid_android.has_context )
|
||||||
{
|
{
|
||||||
R_ChangeDisplaySettings( 0, 0, false ); // width and height are ignored anyway
|
R_ChangeDisplaySettings( 0, 0, WINDOW_MODE_WINDOWED ); // width and height are ignored anyway
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +459,7 @@ qboolean VID_SetMode( void )
|
||||||
(*jni.env)->SetIntArrayRegion( jni.env, attribs, 0, s1, nAttribs );
|
(*jni.env)->SetIntArrayRegion( jni.env, attribs, 0, s1, nAttribs );
|
||||||
(*jni.env)->SetIntArrayRegion( jni.env, contextAttribs, 0, s2, nContextAttribs );
|
(*jni.env)->SetIntArrayRegion( jni.env, contextAttribs, 0, s2, nContextAttribs );
|
||||||
|
|
||||||
R_ChangeDisplaySettings( 0, 0, false ); // width and height are ignored anyway
|
R_ChangeDisplaySettings( 0, 0, WINDOW_MODE_WINDOWED ); // width and height are ignored anyway
|
||||||
|
|
||||||
if( glw_state.software )
|
if( glw_state.software )
|
||||||
return true;
|
return true;
|
||||||
|
@ -468,10 +473,10 @@ qboolean VID_SetMode( void )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen )
|
rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mode )
|
||||||
{
|
{
|
||||||
int render_w, render_h;
|
int render_w, render_h;
|
||||||
uint rotate = vid_rotate->value;
|
uint rotate = cv_vid_rotate->value;
|
||||||
|
|
||||||
Android_GetScreenRes(&width, &height);
|
Android_GetScreenRes(&width, &height);
|
||||||
|
|
||||||
|
@ -480,7 +485,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen )
|
||||||
|
|
||||||
Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height);
|
Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height);
|
||||||
|
|
||||||
if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, vid_scale->value, vid_scale->value ) )
|
if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, cv_vid_scale->value, cv_vid_scale->value ) )
|
||||||
{
|
{
|
||||||
if( rotate & 1 )
|
if( rotate & 1 )
|
||||||
{
|
{
|
||||||
|
@ -490,15 +495,15 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen )
|
||||||
render_h = swap;
|
render_h = swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
render_h /= vid_scale->value;
|
render_h /= cv_vid_scale->value;
|
||||||
render_w /= vid_scale->value;
|
render_w /= cv_vid_scale->value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_Printf( S_WARN "failed to setup screen transform\n" );
|
Con_Printf( S_WARN "failed to setup screen transform\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SaveVideoMode( width, height, render_w, render_h );
|
R_SaveVideoMode( width, height, render_w, render_h, true );
|
||||||
|
|
||||||
refState.wideScreen = true; // V_AdjustFov will check for widescreen
|
refState.wideScreen = true; // V_AdjustFov will check for widescreen
|
||||||
|
|
||||||
|
@ -596,12 +601,12 @@ void GL_UpdateSwapInterval( void )
|
||||||
if( cls.state < ca_active )
|
if( cls.state < ca_active )
|
||||||
{
|
{
|
||||||
Android_SwapInterval( 0 );
|
Android_SwapInterval( 0 );
|
||||||
SetBits( gl_vsync->flags, FCVAR_CHANGED );
|
SetBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
else if( FBitSet( gl_vsync->flags, FCVAR_CHANGED ))
|
else if( FBitSet( gl_vsync.flags, FCVAR_CHANGED ))
|
||||||
{
|
{
|
||||||
ClearBits( gl_vsync->flags, FCVAR_CHANGED );
|
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||||
Android_SwapInterval( gl_vsync->value );
|
Android_SwapInterval( gl_vsync.value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ def options(opt):
|
||||||
grp.add_option('--enable-engine-fuzz', action = 'store_true', dest = 'ENGINE_FUZZ', default = False,
|
grp.add_option('--enable-engine-fuzz', action = 'store_true', dest = 'ENGINE_FUZZ', default = False,
|
||||||
help = 'add LLVM libFuzzer [default: %default]' )
|
help = 'add LLVM libFuzzer [default: %default]' )
|
||||||
|
|
||||||
|
grp.add_option('--enable-android-legacy', action = 'store_true', dest = 'ANDROID_LEGACY', default = False,
|
||||||
|
help = 'allow build legacy android port without SDL (deprecated, need for renderers debug on ancient devices)')
|
||||||
|
|
||||||
opt.load('sdl2')
|
opt.load('sdl2')
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
|
@ -75,6 +78,8 @@ def configure(conf):
|
||||||
conf.define('XASH_SDL', 12)
|
conf.define('XASH_SDL', 12)
|
||||||
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL2' )
|
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL2' )
|
||||||
conf.env.HAVE_SDL2 = True
|
conf.env.HAVE_SDL2 = True
|
||||||
|
elif conf.options.ANDROID_LEGACY:
|
||||||
|
pass #just test if it can build
|
||||||
else:
|
else:
|
||||||
conf.load('sdl2')
|
conf.load('sdl2')
|
||||||
if not conf.env.HAVE_SDL2:
|
if not conf.env.HAVE_SDL2:
|
||||||
|
|
Loading…
Reference in New Issue