diff --git a/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp b/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp index 09b50ea..87f490f 100644 --- a/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp +++ b/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp @@ -39,7 +39,9 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved. #include "VrApi_Input.h" #include "VrApi_Types.h" -#include +extern "C" { +#include "src/gl/loader.h" +} //#include //#include @@ -1250,7 +1252,9 @@ void Android_MessageBox(const char *title, const char *text) ALOGE("%s %s", title, text); } +extern "C" { void initialize_gl4es(); +} void JKVR_ResyncClientYawWithGameYaw() { @@ -1766,7 +1770,6 @@ void JKVR_submitFrame() JKVR_incrementFrameIndex(); - JKVR_HapticEndFrame(); } static void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject, jclass activityClass ) diff --git a/Projects/Android/jni/OpenJK/Android_client.mk b/Projects/Android/jni/OpenJK/Android_client.mk index f35fcbd..deacce6 100644 --- a/Projects/Android/jni/OpenJK/Android_client.mk +++ b/Projects/Android/jni/OpenJK/Android_client.mk @@ -9,21 +9,21 @@ LOCAL_MODULE := openjk_sp LOCAL_CFLAGS := $(JK3_BASE_CFLAGS) -LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DBOTLIB -D_JK2EXE -DSP_GAME -DUSE_OPENAL +LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DBOTLIB -D_JK2EXE LOCAL_LDLIBS := $(JK3_BASE_LDLIBS) -LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -llog -lz +LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -llog -lz -lOpenSLES #Needed so lib can be loaded (_exit error) LOCAL_LDLIBS += -fuse-ld=bfd LOCAL_STATIC_LIBRARIES := sigc libzip libpng libminizip -LOCAL_SHARED_LIBRARIES := openal vrapi gl4es +LOCAL_SHARED_LIBRARIES := vrapi gl4es -LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PATH)/include $(SUPPORT_LIBS)/openal/include $(SUPPORT_LIBS)/minizip/include $(SPDir)/rd-vanilla $(SPDir)/rd-common +LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PATH)/include $(SUPPORT_LIBS)/minizip/include $(SPDir)/rd-vanilla $(SPDir)/rd-common ############################################################################# @@ -36,6 +36,8 @@ LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PAT JK3_SRC = \ ${SPDir}/android/in_android.cpp \ ${SPDir}/android/android_main.cpp \ + ${SPDir}/android/android_snd.cpp \ + ${SPDir}/android/android_window.cpp \ \ ${SPDir}/client/cl_cgame.cpp \ ${SPDir}/client/cl_cin.cpp \ diff --git a/Projects/Android/jni/OpenJK/Android_gles.mk b/Projects/Android/jni/OpenJK/Android_gles.mk index b644c34..f1ce5c1 100644 --- a/Projects/Android/jni/OpenJK/Android_gles.mk +++ b/Projects/Android/jni/OpenJK/Android_gles.mk @@ -15,8 +15,8 @@ LOCAL_LDLIBS := $(JK3_BASE_LDLIBS) LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -ldl -llog -LOCAL_STATIC_LIBRARIES := libpng libjpeg gl4es -#LOCAL_SHARED_LIBRARIES := +LOCAL_STATIC_LIBRARIES := libpng libjpeg +LOCAL_SHARED_LIBRARIES := gl4es LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(SUPPORT_LIBS)/libpng $(TOP_DIR) $(SPDir)/rd-vanilla $(SPDir)/rd-common diff --git a/Projects/Android/jni/OpenJK/code/android/android_glimp.cpp b/Projects/Android/jni/OpenJK/code/android/android_glimp.cpp deleted file mode 100644 index 52d0074..0000000 --- a/Projects/Android/jni/OpenJK/code/android/android_glimp.cpp +++ /dev/null @@ -1,736 +0,0 @@ -/* -=========================================================================== - -Return to Castle Wolfenstein single player GPL Source Code -Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - -This file is part of the Return to Castle Wolfenstein single player GPL Source Code (“RTCW SP Source Code”). - -RTCW SP Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -RTCW SP Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with RTCW SP Source Code. If not, see . - -In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== - */ - -/* - ** GLW_IMP.C - ** - ** This file contains ALL Linux specific stuff having to do with the - ** OpenGL refresh. When a port is being made the following functions - ** must be implemented by the port: - ** - ** GLimp_EndFrame - ** GLimp_Init - ** GLimp_Shutdown - ** GLimp_SwitchFullscreen - ** GLimp_SetGamma - ** - */ - -#include -#include -#ifdef __linux__ -#include -#include -#endif -#include -#include -#include -#include -#include - -// bk001204 -#include - -// bk001206 - from my Heretic2 by way of Ryan's Fakk2 -// Needed for the new X11_PendingInput() function. -#include -#include -#include - -#include "../renderer/tr_local.h" -#include "../client/client.h" -#include "android_local.h" // bk001130 -#include "EGL/egl.h" - -#define WINDOW_CLASS_NAME "Return to Castle Wolfenstein" - -typedef enum -{ - RSERR_OK, - - RSERR_INVALID_FULLSCREEN, - RSERR_INVALID_MODE, - - RSERR_UNKNOWN -} rserr_t; - - - -void myglMultiTexCoord2f( GLenum texture, GLfloat s, GLfloat t ) -{ - glMultiTexCoord4f(texture, s, t, 0, 1); -} - - - -static cvar_t *in_mouse; -static cvar_t *in_dgamouse; - -// bk001130 - from cvs1.17 (mkv), but not static -cvar_t *in_joystick = NULL; -cvar_t *in_joystickDebug = NULL; -cvar_t *joy_threshold = NULL; - -cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software -cvar_t *r_previousglDriver; - -//static int default_dotclock_vidmode; // bk001204 - unused -static int num_vidmodes; -static qboolean vidmode_active = qfalse; - - -/* - * Find the first occurrence of find in s. - */ -// bk001130 - from cvs1.17 (mkv), const -// bk001130 - made first argument const -static const char *Q_stristr( const char *s, const char *find ) { - register char c, sc; - register size_t len; - - if ( ( c = *find++ ) != 0 ) { - if ( c >= 'a' && c <= 'z' ) { - c -= ( 'a' - 'A' ); - } - len = strlen( find ); - do - { - do - { - if ( ( sc = *s++ ) == 0 ) { - return NULL; - } - if ( sc >= 'a' && sc <= 'z' ) { - sc -= ( 'a' - 'A' ); - } - } while ( sc != c ); - } while ( Q_stricmpn( s, find, len ) != 0 ); - s--; - } - return s; -} - - - -void IN_ActivateMouse( void ) { - -} - -void IN_DeactivateMouse( void ) { - -} -/*****************************************************************************/ - -static qboolean signalcaught = qfalse;; - -void Sys_Exit( int ); // bk010104 - abstraction - -static void signal_handler( int sig ) { // bk010104 - replace this... (NOTE TTimo huh?) - if ( signalcaught ) { - printf( "DOUBLE SIGNAL FAULT: Received signal %d, exiting...\n", sig ); - Sys_Exit( 1 ); // bk010104 - abstraction - } - - signalcaught = qtrue; - printf( "Received signal %d, exiting...\n", sig ); - GLimp_Shutdown(); // bk010104 - shouldn't this be CL_Shutdown - Sys_Exit( 0 ); // bk010104 - abstraction NOTE TTimo send a 0 to avoid DOUBLE SIGNAL FAULT -} - -static void InitSig( void ) { - - return; - - - signal( SIGHUP, signal_handler ); - signal( SIGQUIT, signal_handler ); - signal( SIGILL, signal_handler ); - signal( SIGTRAP, signal_handler ); - signal( SIGIOT, signal_handler ); - signal( SIGBUS, signal_handler ); - signal( SIGFPE, signal_handler ); - signal( SIGSEGV, signal_handler ); - signal( SIGTERM, signal_handler ); -} - -/* - ** GLimp_SetGamma - ** - ** This routine should only be called if glConfig.deviceSupportsGamma is TRUE - */ -void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] ) { - -} - -/* - ** GLimp_Shutdown - ** - ** This routine does all OS specific shutdown procedures for the OpenGL - ** subsystem. Under OpenGL this means NULLing out the current DC and - ** HGLRC, deleting the rendering context, and releasing the DC acquired - ** for the window. The state structure is also nulled out. - ** - */ -void GLimp_Shutdown( void ) { - - memset( &glConfig, 0, sizeof( glConfig ) ); - memset( &glState, 0, sizeof( glState ) ); - - QGL_Shutdown(); -} - -/* - ** GLimp_LogComment - */ -void GLimp_LogComment( char *comment ) { - -} - -/* - ** GLW_StartDriverAndSetMode - */ -// bk001204 - prototype needed -int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen ); -static qboolean GLW_StartDriverAndSetMode( const char *drivername, - int mode, - qboolean fullscreen ) { - rserr_t err; - - // don't ever bother going into fullscreen with a voodoo card -#if 1 // JDC: I reenabled this - if ( Q_stristr( drivername, "Voodoo" ) ) { - ri.Cvar_Set( "r_fullscreen", "0" ); - r_fullscreen->modified = qfalse; - fullscreen = qfalse; - } -#endif - - err = GLW_SetMode( drivername, mode, fullscreen ); - - switch ( err ) - { - case RSERR_INVALID_FULLSCREEN: - ri.Printf( PRINT_ALL, "...WARNING: fullscreen unavailable in this mode\n" ); - return qfalse; - case RSERR_INVALID_MODE: - ri.Printf( PRINT_ALL, "...WARNING: could not set the given mode (%d)\n", mode ); - return qfalse; - default: - break; - } - return qtrue; -} - - -void JKVR_GetScreenRes(int *width, int *height); - -/* - ** GLW_InitExtensions - */ -static void GLW_InitExtensions( void ) { - if ( !r_allowExtensions->integer ) { - ri.Printf( PRINT_ALL, "*** IGNORING OPENGL EXTENSIONS ***\n" ); - return; - } - - ri.Printf( PRINT_ALL, "Initializing OpenGL extensions\n" ); - -#ifndef HAVE_GLES - // GL_S3_s3tc - if ( Q_stristr( glConfig.extensions_string, "GL_S3_s3tc" ) ) { - if ( r_ext_compressed_textures->value ) { - glConfig.textureCompression = TC_S3TC; - ri.Printf( PRINT_ALL, "...using GL_S3_s3tc\n" ); - } else - { - glConfig.textureCompression = TC_NONE; - ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" ); - } - } else -#endif - { - glConfig.textureCompression = TC_NONE; - ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" ); - } - - // GL_EXT_texture_env_add -#ifdef HAVE_GLES - glConfig.textureEnvAddAvailable = qtrue; - ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" ); -#else - glConfig.textureEnvAddAvailable = qfalse; - if ( Q_stristr( glConfig.extensions_string, "EXT_texture_env_add" ) ) { - if ( r_ext_texture_env_add->integer ) { - glConfig.textureEnvAddAvailable = qtrue; - ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" ); - } else - { - glConfig.textureEnvAddAvailable = qfalse; - ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_env_add\n" ); - } - } else - { - ri.Printf( PRINT_ALL, "...GL_EXT_texture_env_add not found\n" ); - } -#endif - - // GL_ARB_multitexture - qglMultiTexCoord2fARB = NULL; - qglActiveTextureARB = NULL; - qglClientActiveTextureARB = NULL; -#ifdef HAVE_GLES - qglGetIntegerv( GL_MAX_TEXTURE_UNITS, &glConfig.maxActiveTextures ); - //ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, %i texture units\n", glConfig.maxActiveTextures ); - //glConfig.maxActiveTextures=4; - qglMultiTexCoord2fARB = myglMultiTexCoord2f; - qglActiveTextureARB = glActiveTexture; - qglClientActiveTextureARB = glClientActiveTexture; - if ( glConfig.maxActiveTextures > 1 ) - { - ri.Printf( PRINT_ALL, "...using GL_ARB_multitexture (%i texture units)\n", glConfig.maxActiveTextures ); - } - else - { - qglMultiTexCoord2fARB = NULL; - qglActiveTextureARB = NULL; - qglClientActiveTextureARB = NULL; - ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" ); - } -#else - if ( Q_stristr( glConfig.extensions_string, "GL_ARB_multitexture" ) ) { - if ( r_ext_multitexture->value ) { - qglMultiTexCoord2fARB = ( PFNGLMULTITEXCOORD2FARBPROC ) dlsym( glw_state.OpenGLLib, "glMultiTexCoord2fARB" ); - qglActiveTextureARB = ( PFNGLACTIVETEXTUREARBPROC ) dlsym( glw_state.OpenGLLib, "glActiveTextureARB" ); - qglClientActiveTextureARB = ( PFNGLCLIENTACTIVETEXTUREARBPROC ) dlsym( glw_state.OpenGLLib, "glClientActiveTextureARB" ); - - if ( qglActiveTextureARB ) { - qglGetIntegerv( GL_MAX_ACTIVE_TEXTURES_ARB, &glConfig.maxActiveTextures ); - - if ( glConfig.maxActiveTextures > 1 ) { - ri.Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" ); - } else - { - qglMultiTexCoord2fARB = NULL; - qglActiveTextureARB = NULL; - qglClientActiveTextureARB = NULL; - ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" ); - } - } - } else - { - ri.Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" ); - } - } else - { - ri.Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" ); - } -#endif - - // GL_EXT_compiled_vertex_array -#ifndef HAVE_GLES - if ( Q_stristr( glConfig.extensions_string, "GL_EXT_compiled_vertex_array" ) ) { - if ( r_ext_compiled_vertex_array->value ) { - ri.Printf( PRINT_ALL, "...using GL_EXT_compiled_vertex_array\n" ); - qglLockArraysEXT = ( void ( APIENTRY * )( int, int ) )dlsym( glw_state.OpenGLLib, "glLockArraysEXT" ); - qglUnlockArraysEXT = ( void ( APIENTRY * )( void ) )dlsym( glw_state.OpenGLLib, "glUnlockArraysEXT" ); - if ( !qglLockArraysEXT || !qglUnlockArraysEXT ) { - ri.Error( ERR_FATAL, "bad getprocaddress" ); - } - } else - { - ri.Printf( PRINT_ALL, "...ignoring GL_EXT_compiled_vertex_array\n" ); - } - } else -#endif - { - ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" ); - } - - // GL_NV_fog_distance -#ifndef HAVE_GLES - if ( Q_stristr( glConfig.extensions_string, "GL_NV_fog_distance" ) ) { - if ( r_ext_NV_fog_dist->integer ) { - glConfig.NVFogAvailable = qtrue; - ri.Printf( PRINT_ALL, "...using GL_NV_fog_distance\n" ); - } else { - ri.Printf( PRINT_ALL, "...ignoring GL_NV_fog_distance\n" ); - ri.Cvar_Set( "r_ext_NV_fog_dist", "0" ); - } - } else -#endif - { - ri.Printf( PRINT_ALL, "...GL_NV_fog_distance not found\n" ); - ri.Cvar_Set( "r_ext_NV_fog_dist", "0" ); - } - -} - -static void GLW_InitGamma() { - - glConfig.deviceSupportsGamma = qfalse; - -} - -/* - ** GLW_LoadOpenGL - ** - ** GLimp_win.c internal function that that attempts to load and use - ** a specific OpenGL DLL. - */ -static qboolean GLW_LoadOpenGL( const char *name ) { - qboolean fullscreen; - - ri.Printf( PRINT_ALL, "...loading %s: ", name ); - -#ifndef HAVE_GLES - // disable the 3Dfx splash screen and set gamma - // we do this all the time, but it shouldn't hurt anything - // on non-3Dfx stuff - putenv( "FX_GLIDE_NO_SPLASH=0" ); - - // Mesa VooDoo hacks - putenv( "MESA_GLX_FX=fullscreen\n" ); -#endif - // load the QGL layer - if ( QGL_Init( name ) ) { -#ifdef PANDORA - fullscreen = 1; -#else - fullscreen = r_fullscreen->integer; -#endif - - // create the window and set up the context - if ( !GLW_StartDriverAndSetMode( name, r_mode->integer, fullscreen ) ) { - if ( r_mode->integer != 3 ) { - if ( !GLW_StartDriverAndSetMode( name, 3, fullscreen ) ) { - goto fail; - } - } else { - goto fail; - } - } - - return qtrue; - } else - { - ri.Printf( PRINT_ALL, "failed\n" ); - } - fail: - - QGL_Shutdown(); - - return qfalse; -} - - - -/* - ** GLimp_Init - ** - ** This routine is responsible for initializing the OS specific portions - ** of OpenGL. - */ -void GLimp_Init( void ) { - qboolean attemptedlibGL = qfalse; - qboolean attempted3Dfx = qfalse; - qboolean success = qfalse; - char buf[1024]; - cvar_t *lastValidRenderer = ri.Cvar_Get( "r_lastValidRenderer", "(uninitialized)", CVAR_ARCHIVE ); - // cvar_t *cv; // bk001204 - unused - - r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH ); - - r_previousglDriver = ri.Cvar_Get( "r_previousglDriver", "", CVAR_ROM ); - - InitSig(); - - // Hack here so that if the UI - if ( *r_previousglDriver->string ) { - // The UI changed it on us, hack it back - // This means the renderer can't be changed on the fly - ri.Cvar_Set( "r_glDriver", r_previousglDriver->string ); - } - - int android_screen_width; - int android_screen_height; - JKVR_GetScreenRes(&android_screen_width, &android_screen_height); - glConfig.vidWidth = android_screen_width; - glConfig.vidHeight = android_screen_height; - glConfig.colorBits = 32; - glConfig.depthBits = 16; - glConfig.stencilBits = 8; - - - - // Save it in case the UI stomps it - ri.Cvar_Set( "r_previousglDriver", r_glDriver->string ); - - // This values force the UI to disable driver selection - glConfig.driverType = GLDRV_ICD; - glConfig.hardwareType = GLHW_GENERIC; - - // get our config strings - Q_strncpyz( glConfig.vendor_string, qglGetString( GL_VENDOR ), sizeof( glConfig.vendor_string ) ); - Q_strncpyz( glConfig.renderer_string, qglGetString( GL_RENDERER ), sizeof( glConfig.renderer_string ) ); - if ( *glConfig.renderer_string && glConfig.renderer_string[strlen( glConfig.renderer_string ) - 1] == '\n' ) { - glConfig.renderer_string[strlen( glConfig.renderer_string ) - 1] = 0; - } - Q_strncpyz( glConfig.version_string, qglGetString( GL_VERSION ), sizeof( glConfig.version_string ) ); - Q_strncpyz( glConfig.extensions_string, qglGetString( GL_EXTENSIONS ), sizeof( glConfig.extensions_string ) ); - - // - // chipset specific configuration - // - strcpy( buf, glConfig.renderer_string ); - strlwr( buf ); - - // - // NOTE: if changing cvars, do it within this block. This allows them - // to be overridden when testing driver fixes, etc. but only sets - // them to their default state when the hardware is first installed/run. - // - /*if ( Q_stricmp( lastValidRenderer->string, glConfig.renderer_string ) ) { - glConfig.hardwareType = GLHW_GENERIC; - - ri.Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" ); - - // VOODOO GRAPHICS w/ 2MB - if ( Q_stristr( buf, "voodoo graphics/1 tmu/2 mb" ) ) { - ri.Cvar_Set( "r_picmip", "2" ); - ri.Cvar_Get( "r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH ); - } else - { - ri.Cvar_Set( "r_picmip", "1" ); - - if ( Q_stristr( buf, "rage 128" ) || Q_stristr( buf, "rage128" ) ) { - ri.Cvar_Set( "r_finish", "0" ); - } - // Savage3D and Savage4 should always have trilinear enabled - else if ( Q_stristr( buf, "savage3d" ) || Q_stristr( buf, "s3 savage4" ) ) { - ri.Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" ); - } - } - }*/ - - // - // this is where hardware specific workarounds that should be - // detected/initialized every startup should go. - // - if ( Q_stristr( buf, "banshee" ) || Q_stristr( buf, "Voodoo_Graphics" ) ) { - glConfig.hardwareType = GLHW_3DFX_2D3D; - } else if ( Q_stristr( buf, "rage pro" ) || Q_stristr( buf, "RagePro" ) ) { - glConfig.hardwareType = GLHW_RAGEPRO; - } else if ( Q_stristr( buf, "permedia2" ) ) { - glConfig.hardwareType = GLHW_PERMEDIA2; - } else if ( Q_stristr( buf, "riva 128" ) ) { - glConfig.hardwareType = GLHW_RIVA128; - } else if ( Q_stristr( buf, "riva tnt " ) ) { - } - - ri.Cvar_Set( "r_lastValidRenderer", glConfig.renderer_string ); - - //TEST!!! - //ri.Cvar_Set( "r_picmip", "0" ); - //ri.Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" ); - //!!!! - - - // initialize extensions - GLW_InitExtensions(); - GLW_InitGamma(); - - InitSig(); - - return; -} - -void RTCWVR_submitFrame(); - -//int androidSwapped = 1; //If loading, then draw frame does not return, so detect this -/* - ** GLimp_EndFrame - ** - ** Responsible for doing a swapbuffers and possibly for other stuff - ** as yet to be determined. Probably better not to make this a GLimp - ** function and instead do a call to GLimp_SwapBuffers. - */ -void GLimp_EndFrame( void ) { - - // check logging - //QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value -// if (!androidSwapped) -// eglSwapBuffers( eglGetCurrentDisplay(), eglGetCurrentSurface( EGL_DRAW ) ); - - //androidSwapped = 0; - RTCWVR_submitFrame(); -} - -#ifdef SMP -/* -=========================================================== - -SMP acceleration - -=========================================================== - */ - -sem_t renderCommandsEvent; -sem_t renderCompletedEvent; -sem_t renderActiveEvent; - -void ( *glimpRenderThread )( void ); - -void *GLimp_RenderThreadWrapper( void *stub ) { - glimpRenderThread(); - return NULL; -} - - -/* -======================= -GLimp_SpawnRenderThread -======================= - */ -pthread_t renderThreadHandle; -qboolean GLimp_SpawnRenderThread( void ( *function )( void ) ) { - - sem_init( &renderCommandsEvent, 0, 0 ); - sem_init( &renderCompletedEvent, 0, 0 ); - sem_init( &renderActiveEvent, 0, 0 ); - - glimpRenderThread = function; - - if ( pthread_create( &renderThreadHandle, NULL, - GLimp_RenderThreadWrapper, NULL ) ) { - return qfalse; - } - - return qtrue; -} - -static void *smpData; -//static int glXErrors; // bk001204 - unused - -void *GLimp_RendererSleep( void ) { - void *data; - - // after this, the front end can exit GLimp_FrontEndSleep - sem_post( &renderCompletedEvent ); - - sem_wait( &renderCommandsEvent ); - - data = smpData; - - // after this, the main thread can exit GLimp_WakeRenderer - sem_post( &renderActiveEvent ); - - return data; -} - - -void GLimp_FrontEndSleep( void ) { - sem_wait( &renderCompletedEvent ); -} - - -void GLimp_WakeRenderer( void *data ) { - smpData = data; - - // after this, the renderer can continue through GLimp_RendererSleep - sem_post( &renderCommandsEvent ); - - sem_wait( &renderActiveEvent ); -} - -#else - -void GLimp_RenderThreadWrapper( void *stub ) {} -qboolean GLimp_SpawnRenderThread( void ( *function )( void ) ) { - return qfalse; -} -void *GLimp_RendererSleep( void ) { - return NULL; -} -void GLimp_FrontEndSleep( void ) {} -void GLimp_WakeRenderer( void *data ) {} - -#endif - -/*****************************************************************************/ -/* MOUSE */ -/*****************************************************************************/ - -void IN_Init( void ) { - // mouse variables - in_mouse = Cvar_Get( "in_mouse", "1", CVAR_ARCHIVE ); - in_dgamouse = Cvar_Get( "in_dgamouse", "1", CVAR_ARCHIVE ); - -} - -void IN_Shutdown( void ) { - -} -/* -void IN_Frame( void ) { - - - if ( cls.keyCatchers & KEYCATCH_CONSOLE ) { - // temporarily deactivate if not in the game and - // running on the desktop - // voodoo always counts as full screen - if ( Cvar_VariableValue( "r_fullscreen" ) == 0 - && strcmp( Cvar_VariableString( "r_glDriver" ), _3DFX_DRIVER_NAME ) ) { - IN_DeactivateMouse(); - return; - } - } - - IN_ActivateMouse(); -} - */ - -void IN_Activate( void ) { -} - -// bk001130 - cvs1.17 joystick code (mkv) was here, no linux_joystick.c - -void Sys_SendKeyEvents( void ) { - // XEvent event; // bk001204 - unused - - - //HandleEvents(); -} - - -// bk010216 - added stubs for non-Linux UNIXes here -// FIXME - use NO_JOYSTICK or something else generic - -#if defined( __FreeBSD__ ) // rb010123 -void IN_StartupJoystick( void ) {} -void IN_JoyMove( void ) {} -#endif diff --git a/Projects/Android/jni/OpenJK/code/android/android_main.cpp b/Projects/Android/jni/OpenJK/code/android/android_main.cpp index fe8e633..e9a2e40 100644 --- a/Projects/Android/jni/OpenJK/code/android/android_main.cpp +++ b/Projects/Android/jni/OpenJK/code/android/android_main.cpp @@ -20,6 +20,12 @@ static char binaryPath[ MAX_OSPATH ] = { 0 }; static char installPath[ MAX_OSPATH ] = { 0 }; +cvar_t *com_minimized; +cvar_t *com_unfocused; +cvar_t *com_maxfps; +cvar_t *com_maxfpsMinimized; +cvar_t *com_maxfpsUnfocused; + char *Sys_Cwd( void ) { static char cwd[MAX_OSPATH]; @@ -29,6 +35,19 @@ char *Sys_Cwd( void ) { return cwd; } +/* +================= +Sys_ConsoleInput + +Handle new console input +================= +*/ +char *CON_Input( void ); +char *Sys_ConsoleInput(void) +{ + return CON_Input( ); +} + #if defined( DO_LOADDLL_WRAP ) void *Sys_LoadDll_Wrapped( const char *name, int( **entryPoint ) ( int, ... ), @@ -345,11 +364,90 @@ void Sys_UnloadDll( void *dllHandle ) //Sys_UnloadLibrary(dllHandle); } - - -extern "C" +enum SearchPathFlag { -extern const char * getLibPath(); + SEARCH_PATH_MOD = 1 << 0, + SEARCH_PATH_BASE = 1 << 1, + SEARCH_PATH_OPENJK = 1 << 2, + SEARCH_PATH_ROOT = 1 << 3 +}; + + +static void *Sys_LoadDllFromPaths( const char *filename, const char *gamedir, const char **searchPaths, + size_t numPaths, uint32_t searchFlags, const char *callerName ) +{ + char *fn; + void *libHandle; + + if ( searchFlags & SEARCH_PATH_MOD ) + { + for ( size_t i = 0; i < numPaths; i++ ) + { + const char *libDir = searchPaths[i]; + if ( !libDir[0] ) + continue; + + fn = FS_BuildOSPath( libDir, gamedir, filename ); + libHandle = Sys_LoadLibrary( fn ); + if ( libHandle ) + return libHandle; + + Com_Printf( "%s(%s) failed: \"%s\"\n", callerName, fn, Sys_LibraryError() ); + } + } + + if ( searchFlags & SEARCH_PATH_BASE ) + { + for ( size_t i = 0; i < numPaths; i++ ) + { + const char *libDir = searchPaths[i]; + if ( !libDir[0] ) + continue; + + fn = FS_BuildOSPath( libDir, BASEGAME, filename ); + libHandle = Sys_LoadLibrary( fn ); + if ( libHandle ) + return libHandle; + + Com_Printf( "%s(%s) failed: \"%s\"\n", callerName, fn, Sys_LibraryError() ); + } + } + + if ( searchFlags & SEARCH_PATH_OPENJK ) + { + for ( size_t i = 0; i < numPaths; i++ ) + { + const char *libDir = searchPaths[i]; + if ( !libDir[0] ) + continue; + + fn = FS_BuildOSPath( libDir, OPENJKGAME, filename ); + libHandle = Sys_LoadLibrary( fn ); + if ( libHandle ) + return libHandle; + + Com_Printf( "%s(%s) failed: \"%s\"\n", callerName, fn, Sys_LibraryError() ); + } + } + + if ( searchFlags & SEARCH_PATH_ROOT ) + { + for ( size_t i = 0; i < numPaths; i++ ) + { + const char *libDir = searchPaths[i]; + if ( !libDir[0] ) + continue; + + fn = va( "%s%c%s", libDir, PATH_SEP, filename ); + libHandle = Sys_LoadLibrary( fn ); + if ( libHandle ) + return libHandle; + + Com_Printf( "%s(%s) failed: \"%s\"\n", callerName, fn, Sys_LibraryError() ); + } + } + + return NULL; } /* @@ -651,8 +749,8 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) ) char lib_path[512]; - sprintf(lib_path,"%s/lib%s", getLibPath(),filename); - //LOGI("Trying to load Android lib: %s",lib_path); + char *libdir = (char*)getenv("JK_GAMELIBDIR"); + sprintf(lib_path,"%s/lib%s", libdir,filename); libHandle = dlopen (lib_path, RTLD_LAZY ); @@ -744,6 +842,57 @@ void *Sys_LoadGameDll( const char *name, void *(QDECL **moduleAPI)(int, ...) ) return libHandle; } +void *Sys_LoadSPGameDll( const char *name, GetGameAPIProc **GetGameAPI ) +{ + void *libHandle = NULL; + char filename[MAX_OSPATH]; + + assert( GetGameAPI ); + + Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name); + +#if defined(MACOS_X) && !defined(_JK2EXE) + //First, look for the old-style mac .bundle that's inside a pk3 + //It's actually zipped, and the zipfile has the same name as 'name' + libHandle = Sys_LoadMachOBundle( filename ); +#endif + + if (!libHandle) { + char *basepath = Cvar_VariableString( "fs_basepath" ); + char *homepath = Cvar_VariableString( "fs_homepath" ); + char *cdpath = Cvar_VariableString( "fs_cdpath" ); + char *gamedir = Cvar_VariableString( "fs_game" ); +#ifdef MACOS_X + char *apppath = Cvar_VariableString( "fs_apppath" ); +#endif + + const char *searchPaths[] = { + homepath, +#ifdef MACOS_X + apppath, +#endif + basepath, + cdpath, + }; + size_t numPaths = ARRAY_LEN( searchPaths ); + + libHandle = Sys_LoadDllFromPaths( filename, gamedir, searchPaths, numPaths, + SEARCH_PATH_BASE | SEARCH_PATH_MOD | SEARCH_PATH_OPENJK | SEARCH_PATH_ROOT, + __FUNCTION__ ); + if ( !libHandle ) + return NULL; + } + + *GetGameAPI = (GetGameAPIProc *)Sys_LoadFunction( libHandle, "GetGameAPI" ); + if ( !*GetGameAPI ) { + Com_DPrintf ( "%s(%s) failed to find GetGameAPI function:\n...%s!\n", __FUNCTION__, name, Sys_LibraryError() ); + Sys_UnloadLibrary( libHandle ); + return NULL; + } + + return libHandle; +} + void Sys_ConfigureFPU() { // bk001213 - divide by zero #ifdef __linux2__ #ifdef __i386 @@ -804,6 +953,53 @@ char *Sys_StripAppBundle( char *dir ) # endif #endif +#include "../client/client.h" + +void JKVR_Init(); +qboolean shutdown; +int VR_main( int argc, char* argv[] ) { + // int oldtime, newtime; // bk001204 - unused + int len, i; + char *cmdline; + + // merge the command line, this is kinda silly + for ( len = 1, i = 1; i < argc; i++ ) + len += strlen( argv[i] ) + 1; + cmdline = (char*)malloc( len ); + *cmdline = 0; + for ( i = 1; i < argc; i++ ) + { + if ( i > 1 ) { + strcat( cmdline, " " ); + } + strcat( cmdline, argv[i] ); + } + + // bk000306 - clear queues + //memset( &eventQue[0], 0, MAX_QUED_EVENTS * sizeof( sysEvent_t ) ); + //memset( &sys_packetReceived[0], 0, MAX_MSGLEN * sizeof( byte ) ); + + Com_Init( cmdline ); + NET_Init(); + JKVR_Init(); + + //Sys_ConsoleInputInit(); + + +// fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY ); + + shutdown = qfalse; + while ( !shutdown ) + { +#ifdef __linux__ + Sys_ConfigureFPU(); +#endif + Com_Frame(); + } + + CL_ShutdownUI(); +} + int main ( int argc, char* argv[] ) { int i; diff --git a/Projects/Android/jni/OpenJK/code/android/android_snd.c b/Projects/Android/jni/OpenJK/code/android/android_snd.cpp similarity index 84% rename from Projects/Android/jni/OpenJK/code/android/android_snd.c rename to Projects/Android/jni/OpenJK/code/android/android_snd.cpp index 0378ac5..3066ff9 100644 --- a/Projects/Android/jni/OpenJK/code/android/android_snd.c +++ b/Projects/Android/jni/OpenJK/code/android/android_snd.cpp @@ -1,30 +1,23 @@ /* =========================================================================== +Copyright (C) 2005 - 2015, ioquake3 contributors +Copyright (C) 2013 - 2015, OpenJK contributors -Return to Castle Wolfenstein single player GPL Source Code -Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. +This file is part of the OpenJK source code. -This file is part of the Return to Castle Wolfenstein single player GPL Source Code (“RTCW SP Source Code”). +OpenJK is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License version 2 as +published by the Free Software Foundation. -RTCW SP Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -RTCW SP Source Code is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with RTCW SP Source Code. If not, see . - -In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - +along with this program; if not, see . =========================================================================== - */ +*/ #include #include @@ -42,8 +35,8 @@ If you have questions concerning this license or the applicable additional terms #endif #include -#include "../game/q_shared.h" -#include "../client/snd_local.h" +#include "qcommon/q_shared.h" +#include "client/snd_local.h" //Updated by Emile Belanger for OpenSL @@ -64,11 +57,7 @@ static SLObjectItf outputMixObject = NULL; // buffer queue player interfaces static SLObjectItf bqPlayerObject = NULL; static SLPlayItf bqPlayerPlay; -#ifdef ANDROID_NDK static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; -#else -static SLBufferQueueItf bqPlayerBufferQueue; -#endif static SLEffectSendItf bqPlayerEffectSend; static SLMuteSoloItf bqPlayerMuteSolo; @@ -173,7 +162,7 @@ void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) // TEST pthread_mutex_unlock(&dma_mutex); } -qboolean SNDDMA_Init( void ) { +int SNDDMA_Init( int sampleFrequencyInKHz ) { int rc; int fmt; int tmp; @@ -196,7 +185,7 @@ qboolean SNDDMA_Init( void ) { dma.speed = 44100; dma.speed = 22050; dmasize = (dma.samples * (dma.samplebits/8)); - dma.buffer = calloc(1, dmasize); + dma.buffer = (byte*)calloc(1, dmasize); SLresult result; @@ -290,7 +279,7 @@ int SNDDMA_GetDMAPos( void ) { } void SNDDMA_Shutdown( void ) { - LOGI("shutdown Sound"); + //LOGI("shutdown Sound"); bqPause(1); (*bqPlayerObject)->Destroy(bqPlayerObject); (*outputMixObject)->Destroy(outputMixObject); diff --git a/Projects/Android/jni/OpenJK/code/android/android_window.cpp b/Projects/Android/jni/OpenJK/code/android/android_window.cpp new file mode 100644 index 0000000..c839430 --- /dev/null +++ b/Projects/Android/jni/OpenJK/code/android/android_window.cpp @@ -0,0 +1,247 @@ +/* +=========================================================================== +Copyright (C) 2005 - 2015, ioquake3 contributors +Copyright (C) 2013 - 2015, OpenJK contributors + +This file is part of the OpenJK source code. + +OpenJK is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License version 2 as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see . +=========================================================================== +*/ + +#include "qcommon/qcommon.h" +#include "rd-common/tr_types.h" +#include "sys/sys_local.h" +#include "qgl.h" + +enum rserr_t +{ + RSERR_OK, + + RSERR_INVALID_FULLSCREEN, + RSERR_INVALID_MODE, + + RSERR_UNKNOWN +}; + +static float displayAspect; + +cvar_t *r_sdlDriver; +cvar_t *r_allowSoftwareGL; + +// Window cvars +cvar_t *r_fullscreen = 0; +cvar_t *r_noborder; +cvar_t *r_centerWindow; +cvar_t *r_customwidth; +cvar_t *r_customheight; +cvar_t *r_swapInterval; +cvar_t *r_stereo; +cvar_t *r_mode; +cvar_t *r_displayRefresh; + +// Window surface cvars +cvar_t *r_stencilbits; +cvar_t *r_depthbits; +cvar_t *r_colorbits; +cvar_t *r_ignorehwgamma; +cvar_t *r_ext_multisample; + +void JKVR_GetScreenRes(int *width, int *height); + + +/* +** R_GetModeInfo +*/ +typedef struct vidmode_s +{ + const char *description; + int width, height; +} vidmode_t; + +const vidmode_t r_vidModes[] = { + { "Mode 0: 320x240", 320, 240 }, + { "Mode 1: 400x300", 400, 300 }, + { "Mode 2: 512x384", 512, 384 }, + { "Mode 3: 640x480", 640, 480 }, + { "Mode 4: 800x600", 800, 600 }, + { "Mode 5: 960x720", 960, 720 }, + { "Mode 6: 1024x768", 1024, 768 }, + { "Mode 7: 1152x864", 1152, 864 }, + { "Mode 8: 1280x1024", 1280, 1024 }, + { "Mode 9: 1600x1200", 1600, 1200 }, + { "Mode 10: 2048x1536", 2048, 1536 }, + { "Mode 11: 856x480 (wide)", 856, 480 }, + { "Mode 12: 2400x600(surround)",2400,600 } +}; +static const int s_numVidModes = ARRAY_LEN( r_vidModes ); + +#define R_MODE_FALLBACK (4) // 640x480 + +qboolean R_GetModeInfo( int *width, int *height, int mode ) { + const vidmode_t *vm; + + if ( mode < -1 ) { + return qfalse; + } + if ( mode >= s_numVidModes ) { + return qfalse; + } + + if ( mode == -1 ) { + *width = r_customwidth->integer; + *height = r_customheight->integer; + return qtrue; + } + + vm = &r_vidModes[mode]; + + *width = vm->width; + *height = vm->height; + + return qtrue; +} + +/* +** R_ModeList_f +*/ +static void R_ModeList_f( void ) +{ + int i; + + Com_Printf( "\n" ); + Com_Printf( "Mode -2: Use desktop resolution\n" ); + Com_Printf( "Mode -1: Use r_customWidth and r_customHeight variables\n" ); + for ( i = 0; i < s_numVidModes; i++ ) + { + Com_Printf( "%s\n", r_vidModes[i].description ); + } + Com_Printf( "\n" ); +} + +/* +=============== +GLimp_Minimize + +Minimize the game so that user is back at the desktop +=============== +*/ +void GLimp_Minimize(void) +{ + +} + +void JKVR_submitFrame(); + +void WIN_Present( window_t *window ) +{ + JKVR_submitFrame(); +} + + + +window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig ) +{ + Cmd_AddCommand("modelist", R_ModeList_f); + Cmd_AddCommand("minimize", GLimp_Minimize); + + r_sdlDriver = Cvar_Get( "r_sdlDriver", "", CVAR_ROM ); + r_allowSoftwareGL = Cvar_Get( "r_allowSoftwareGL", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + + // Window cvars + r_fullscreen = Cvar_Get( "r_fullscreen", "0", CVAR_ARCHIVE|CVAR_LATCH ); + r_noborder = Cvar_Get( "r_noborder", "0", CVAR_ARCHIVE|CVAR_LATCH ); + r_centerWindow = Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE|CVAR_LATCH ); + r_customwidth = Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE|CVAR_LATCH ); + r_customheight = Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE|CVAR_LATCH ); + r_swapInterval = Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE_ND ); + r_stereo = Cvar_Get( "r_stereo", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + r_mode = Cvar_Get( "r_mode", "4", CVAR_ARCHIVE|CVAR_LATCH ); + r_displayRefresh = Cvar_Get( "r_displayRefresh", "0", CVAR_LATCH ); + Cvar_CheckRange( r_displayRefresh, 0, 240, qtrue ); + + // Window render surface cvars + r_stencilbits = Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND|CVAR_LATCH ); + r_depthbits = Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + r_colorbits = Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + r_ignorehwgamma = Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + r_ext_multisample = Cvar_Get( "r_ext_multisample", "0", CVAR_ARCHIVE_ND|CVAR_LATCH ); + Cvar_Get( "r_availableModes", "", CVAR_ROM ); + + + glConfig->deviceSupportsGamma = + (qboolean)(!r_ignorehwgamma->integer); + + // This depends on SDL_INIT_VIDEO, hence having it here + //IN_Init( screen ); + + // window_t is only really useful for Windows if the renderer wants to create a D3D context. + window_t window = {}; + + window.api = windowDesc->api; + +#if defined(_WIN32) + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + + if ( SDL_GetWindowWMInfo(screen, &info) ) + { + switch(info.subsystem) { + case SDL_SYSWM_WINDOWS: + window.handle = info.info.win.window; + break; + + default: + break; + } + } +#endif + + return window; +} + +/* +=============== +GLimp_Shutdown +=============== +*/ +void WIN_Shutdown( void ) +{ + Cmd_RemoveCommand("modelist"); + Cmd_RemoveCommand("minimize"); + + //IN_Shutdown(); +} + +void GLimp_EnableLogging( qboolean enable ) +{ +} + +void GLimp_LogComment( char *comment ) +{ +} + +void WIN_SetGamma( glconfig_t *glConfig, byte red[256], byte green[256], byte blue[256] ) +{ + +} + +void *WIN_GL_GetProcAddress( const char *proc ) +{ + return NULL;//SDL_GL_GetProcAddress( proc ); +} + +qboolean WIN_GL_ExtensionSupported( const char *extension ) +{ + return ((Q_stristr( (const char *)glGetString (GL_EXTENSIONS), extension) ) != NULL) ? qtrue : qfalse; +} diff --git a/Projects/Android/jni/OpenJK/code/android/in_android.h b/Projects/Android/jni/OpenJK/code/android/in_android.h index 20dd4ad..98ffaad 100644 --- a/Projects/Android/jni/OpenJK/code/android/in_android.h +++ b/Projects/Android/jni/OpenJK/code/android/in_android.h @@ -2,10 +2,6 @@ -#ifdef __cplusplus -extern "C" -{ -#endif int PortableKeyEvent(int state, int code ,int unitcode); void PortableAction(int state, int action); @@ -28,6 +24,3 @@ int PortableShowKeyboard(void); int PortableInAutomap(void); -#ifdef __cplusplus -} -#endif diff --git a/Projects/Android/jni/OpenJK/code/client/cl_input.cpp b/Projects/Android/jni/OpenJK/code/client/cl_input.cpp index 9405176..5707644 100644 --- a/Projects/Android/jni/OpenJK/code/client/cl_input.cpp +++ b/Projects/Android/jni/OpenJK/code/client/cl_input.cpp @@ -477,10 +477,10 @@ CL_JoystickMove void CL_JoystickMove( usercmd_t *cmd ) { float anglespeed; - if ( !in_joystick->integer ) +/* if ( !in_joystick->integer ) { return; - } + }*/ if ( !(in_speed.active ^ cl_run->integer) ) { cmd->buttons |= BUTTON_WALKING; diff --git a/Projects/Android/jni/OpenJK/code/client/snd_dma.cpp b/Projects/Android/jni/OpenJK/code/client/snd_dma.cpp index bb539e4..05ef671 100644 --- a/Projects/Android/jni/OpenJK/code/client/snd_dma.cpp +++ b/Projects/Android/jni/OpenJK/code/client/snd_dma.cpp @@ -618,7 +618,7 @@ void S_Init( void ) { else { #endif - r = SNDDMA_Init(s_khz->integer); + r = static_cast(SNDDMA_Init(s_khz->integer)); if ( r ) { s_soundStarted = 1; diff --git a/Projects/Android/jni/OpenJK/shared/sdl/sdl_sound.h b/Projects/Android/jni/OpenJK/shared/sdl/sdl_sound.h index b91447f..22fab6e 100644 --- a/Projects/Android/jni/OpenJK/shared/sdl/sdl_sound.h +++ b/Projects/Android/jni/OpenJK/shared/sdl/sdl_sound.h @@ -21,8 +21,9 @@ along with this program; if not, see . #include "qcommon/q_shared.h" + // initializes cycling through a DMA buffer and returns information on it -qboolean SNDDMA_Init(int sampleFrequencyInKHz); +int SNDDMA_Init(int sampleFrequencyInKHz); // gets the current DMA position int SNDDMA_GetDMAPos(void); diff --git a/Projects/Android/jni/OpenJK/shared/sys/sys_unix.cpp b/Projects/Android/jni/OpenJK/shared/sys/sys_unix.cpp index 424dbfc..2c4a265 100644 --- a/Projects/Android/jni/OpenJK/shared/sys/sys_unix.cpp +++ b/Projects/Android/jni/OpenJK/shared/sys/sys_unix.cpp @@ -44,7 +44,7 @@ static char homePath[ MAX_OSPATH ] = { 0 }; void Sys_PlatformInit( void ) { - const char* term = getenv( "TERM" ); +/* const char* term = getenv( "TERM" ); signal( SIGHUP, Sys_SigHandler ); signal( SIGQUIT, Sys_SigHandler ); @@ -56,6 +56,7 @@ void Sys_PlatformInit( void ) stdinIsATTY = qtrue; else stdinIsATTY = qfalse; +*/ } void Sys_PlatformExit( void ) diff --git a/java/com/drbeef/jkquest/GLES3JNIActivity.java b/java/com/drbeef/jkquest/GLES3JNIActivity.java index a98b6da..c253f4a 100644 --- a/java/com/drbeef/jkquest/GLES3JNIActivity.java +++ b/java/com/drbeef/jkquest/GLES3JNIActivity.java @@ -171,22 +171,22 @@ import static android.system.Os.setenv; copy_asset("/sdcard/JKQuest", "commandline.txt", false); //Copy the weapon adjustment config - copy_asset("/sdcard/JKQuest/Main", "weapons_vr.cfg", false); +// copy_asset("/sdcard/JKQuest/Main", "weapons_vr.cfg", false); //and the demo version - if required - copy_asset("/sdcard/JKQuest/Main", "pak0.pk3", false); +// copy_asset("/sdcard/JKQuest/Main", "pak0.pk3", false); //and the vr weapons - copy_asset("/sdcard/JKQuest/Main", "z_zvr_weapons.pk3", true); +// copy_asset("/sdcard/JKQuest/Main", "z_zvr_weapons.pk3", true); //and the vr menu pk3 - copy_asset("/sdcard/JKQuest/Main", "z_jkquest_vrmenu.pk3", true); +// copy_asset("/sdcard/JKQuest/Main", "z_jkquest_vrmenu.pk3", true); //and the venom scripting improvements pak (thank-you _HELLBARON_ !!) - copy_asset("/sdcard/JKQuest/Main", "sp_vpak8.pk3", false); +// copy_asset("/sdcard/JKQuest/Main", "sp_vpak8.pk3", false); //Read these from a file and pass through - commandLineParams = new String("jk2"); + commandLineParams = new String("jk3"); //See if user is trying to use command line params if (new File("/sdcard/JKQuest/commandline.txt").exists()) // should exist!