platform/android_nosdl: remove dynamic cvars

This commit is contained in:
mittorn
2023-12-16 22:28:42 +03:00
committed by Alibek Omarov
parent be9dda2a56
commit d6cfc65ac0
2 changed files with 7 additions and 29 deletions

View File

@@ -33,7 +33,7 @@ GNU General Public License for more details.
#define JNIEXPORT
#endif
convar_t *android_sleep;
static CVAR_DEFINE_AUTO( android_sleep, "1", FCVAR_ARCHIVE, "Enable sleep in background" );
static const int s_android_scantokey[] =
{
@@ -346,7 +346,7 @@ DECLARE_JNI_INTERFACE( void, nativeSetPause, jint pause )
// if pause enabled, hold engine by locking frame mutex.
// Engine will stop after event reading and will not continue untill unlock
if( android_sleep && android_sleep->value )
if( android_sleep.value )
{
if( pause )
pthread_mutex_lock( &events.framemutex );
@@ -358,7 +358,7 @@ DECLARE_JNI_INTERFACE( void, nativeSetPause, jint pause )
DECLARE_JNI_INTERFACE( void, nativeUnPause )
{
// UnPause engine before sending critical events
if( android_sleep && android_sleep->value )
if( android_sleep.value )
pthread_mutex_unlock( &events.framemutex );
}
@@ -625,7 +625,7 @@ Initialize android-related cvars
*/
void Android_Init( void )
{
android_sleep = Cvar_Get( "android_sleep", "1", FCVAR_ARCHIVE, "Enable sleep in background" );
Cvar_RegisterVariable( &android_sleep );
}
void Android_Shutdown( void )
@@ -921,7 +921,7 @@ static void Android_ProcessEvents( void )
if( events.queue[i].arg )
{
SNDDMA_Activate( false );
Android_UpdateSurface( !android_sleep->value ? surface_dummy : surface_pause );
Android_UpdateSurface( !android_sleep.value ? surface_dummy : surface_pause );
// (*jni.env)->CallStaticVoidMethod( jni.env, jni.bindcls, jni.toggleEGL, 0 );
}
(*jni.env)->CallStaticVoidMethod( jni.env, jni.bindcls, jni.notify );
@@ -1054,7 +1054,7 @@ void Platform_RunEvents( void )
Android_ProcessEvents();
// do not allow running frames while android_sleep is 1, but surface/context not restored
while( android_sleep->value && host.status == HOST_SLEEP )
while( android_sleep.value && host.status == HOST_SLEEP )
{
usleep( 20000 );
Android_ProcessEvents();

View File

@@ -47,9 +47,6 @@ static dllfunc_t android_funcs[] =
#undef NW_FF
dll_info_t android_info = { "libandroid.so", android_funcs, false };
convar_t *cv_vid_scale;
convar_t *cv_vid_rotate;
/*
========================
Android_SwapInterval
@@ -204,8 +201,6 @@ qboolean R_Init_Video( const int type )
{
char buf[MAX_VA_STRING];
qboolean retval;
cv_vid_scale = Cvar_FindVar( "vid_scale" );
cv_vid_rotate = Cvar_FindVar( "vid_rotate" );
if( FS_FileExists( GI->iconpath, true ) )
{
@@ -361,7 +356,6 @@ qboolean VID_SetMode( void )
rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mode )
{
int render_w, render_h;
uint rotate = cv_vid_rotate->value;
Android_GetScreenRes(&width, &height);
@@ -370,23 +364,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_m
Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height);
if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, cv_vid_scale->value, cv_vid_scale->value ) )
{
if( rotate & 1 )
{
int swap = render_w;
render_w = render_h;
render_h = swap;
}
render_h /= cv_vid_scale->value;
render_w /= cv_vid_scale->value;
}
else
{
Con_Printf( S_WARN "failed to setup screen transform\n" );
}
VID_SetDisplayTransform( &render_w, &render_h );
R_SaveVideoMode( width, height, render_w, render_h, true );