From 3f79287af5a83e62bf2db994693f43797fb6345c Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 4 Sep 2022 23:21:31 +0100 Subject: [PATCH] 64-bit --- Projects/Android/AndroidManifest.xml | 2 +- Projects/Android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 6 +- .../Android/jni/Quake2VR/Q2VR_SurfaceView.c | 159 +++++++++++------- Projects/Android/jni/Quake2VR/VrCommon.h | 30 ++-- Projects/Android/jni/Quake2VR/VrCvars.h | 20 +-- Projects/Android/jni/Quake2VR/VrInput.h | 30 ++-- Projects/Android/jni/Quake2VR/VrInputCommon.c | 44 +++++ .../jni/SupportLibs/gl4es/src/gl/fpe_shader.h | 2 +- .../SupportLibs/gl4es/src/gl/string_utils.h | 2 +- Projects/Android/jni/quake2/Android.mk | 4 +- .../jni/quake2/src/client/vid/glimp_android.c | 18 +- .../drbeef/quake2quest/GLES3JNIActivity.java | 2 +- 13 files changed, 203 insertions(+), 120 deletions(-) diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 0340896..5c71318 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -16,7 +16,7 @@ - + diff --git a/Projects/Android/build.gradle b/Projects/Android/build.gradle index 6b1b697..3be6541 100644 --- a/Projects/Android/build.gradle +++ b/Projects/Android/build.gradle @@ -17,10 +17,10 @@ android { // override app plugin abiFilters for both 32 and 64-bit support externalNativeBuild { ndk { - abiFilters 'armeabi-v7a' + abiFilters 'arm64-v8a' } ndkBuild { - abiFilters 'armeabi-v7a' + abiFilters 'arm64-v8a' } } minSdkVersion 24 diff --git a/Projects/Android/gradle/wrapper/gradle-wrapper.properties b/Projects/Android/gradle/wrapper/gradle-wrapper.properties index 7048f9c..f54e88c 100644 --- a/Projects/Android/gradle/wrapper/gradle-wrapper.properties +++ b/Projects/Android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Dec 10 20:38:41 GMT 2020 +#Sun Sep 04 22:16:08 BST 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c b/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c index 10b2350..fb34189 100644 --- a/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c +++ b/Projects/Android/jni/Quake2VR/Q2VR_SurfaceView.c @@ -31,6 +31,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved. #include #include #include +#include #include "VrApi.h" @@ -77,8 +78,8 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; //Let's go to the maximum! int CPU_LEVEL = 4; int GPU_LEVEL = 4; -int NUM_MULTI_SAMPLES = 1; -float SS_MULTIPLIER = 1.2f; +int NUM_MULTI_SAMPLES = 2; +float SS_MULTIPLIER = 1.1f; vec2_t cylinderSize = {1280, 720}; @@ -104,6 +105,17 @@ int argc=0; extern cvar_t *r_lefthand; extern cvar_t *cl_paused; +cvar_t *vr_snapturn_angle; +cvar_t *vr_walkdirection; +cvar_t *vr_weapon_pitchadjust; +cvar_t *vr_lasersight; +cvar_t *vr_control_scheme; +cvar_t *vr_height_adjust; +cvar_t *vr_worldscale; +cvar_t *vr_weaponscale; +cvar_t *vr_weapon_stabilised; +cvar_t *vr_comfort_mask; + enum control_scheme { RIGHT_HANDED_DEFAULT = 0, LEFT_HANDED_DEFAULT = 10, @@ -492,16 +504,16 @@ static void ovrFramebuffer_Clear( ovrFramebuffer * frameBuffer ) static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum colorFormat, const int width, const int height, const int multisamples ) { - LOAD_GLES2(glBindTexture); - LOAD_GLES2(glTexParameteri); - LOAD_GLES2(glGenRenderbuffers); - LOAD_GLES2(glBindRenderbuffer); - LOAD_GLES2(glRenderbufferStorage); - LOAD_GLES2(glGenFramebuffers); - LOAD_GLES2(glBindFramebuffer); - LOAD_GLES2(glFramebufferRenderbuffer); - LOAD_GLES2(glFramebufferTexture2D); - LOAD_GLES2(glCheckFramebufferStatus); + //LOAD_GLES2(glBindTexture); + //LOAD_GLES2(glTexParameteri); + //LOAD_GLES2(glGenRenderbuffers); + //LOAD_GLES2(glBindRenderbuffer); + //LOAD_GLES2(glRenderbufferStorage); + //LOAD_GLES2(glGenFramebuffers); + //LOAD_GLES2(glBindFramebuffer); + //LOAD_GLES2(glFramebufferRenderbuffer); + //LOAD_GLES2(glFramebufferTexture2D); + //LOAD_GLES2(glCheckFramebufferStatus); frameBuffer->Width = width; frameBuffer->Height = height; @@ -512,36 +524,64 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co frameBuffer->DepthBuffers = (GLuint *)malloc( frameBuffer->TextureSwapChainLength * sizeof( GLuint ) ); frameBuffer->FrameBuffers = (GLuint *)malloc( frameBuffer->TextureSwapChainLength * sizeof( GLuint ) ); + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT = + (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)eglGetProcAddress("glRenderbufferStorageMultisampleEXT"); + PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT = + (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); + for ( int i = 0; i < frameBuffer->TextureSwapChainLength; i++ ) { // Create the color buffer texture. const GLuint colorTexture = vrapi_GetTextureSwapChainHandle( frameBuffer->ColorTextureSwapChain, i ); GLenum colorTextureTarget = GL_TEXTURE_2D; - GL( gles_glBindTexture( colorTextureTarget, colorTexture ) ); + GL( glBindTexture( colorTextureTarget, colorTexture ) ); // Just clamp to edge. However, this requires manually clearing the border // around the layer to clear the edge texels. - GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ) ); - GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ) ); + GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ) ); + GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ) ); - GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) ); - GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) ); - GL( gles_glBindTexture( colorTextureTarget, 0 ) ); + GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) ); + GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) ); + GL( glBindTexture( colorTextureTarget, 0 ) ); + if (multisamples > 1 && glRenderbufferStorageMultisampleEXT != NULL && glFramebufferTexture2DMultisampleEXT != NULL) + { + + // Create multisampled depth buffer. + GL(glGenRenderbuffers(1, &frameBuffer->DepthBuffers[i])); + GL(glBindRenderbuffer(GL_RENDERBUFFER, frameBuffer->DepthBuffers[i])); + GL(glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, multisamples, GL_DEPTH_COMPONENT24, width, height)); + GL(glBindRenderbuffer(GL_RENDERBUFFER, 0)); + + // Create the frame buffer. + GL(glGenFramebuffers(1, &frameBuffer->FrameBuffers[i])); + GL(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer->FrameBuffers[i])); + GL(glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0, multisamples)); + GL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i])); + GL(GLenum renderFramebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER)); + GL(glBindFramebuffer(GL_FRAMEBUFFER, 0)); + if (renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE) + { + ALOGE("OVRHelper::Incomplete frame buffer object: %s", GlFrameBufferStatusString(renderFramebufferStatus)); + return false; + } + } + else { { // Create depth buffer. - GL( gles_glGenRenderbuffers( 1, &frameBuffer->DepthBuffers[i] ) ); - GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) ); - GL( gles_glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, frameBuffer->Width, frameBuffer->Height ) ); - GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, 0 ) ); + GL( glGenRenderbuffers( 1, &frameBuffer->DepthBuffers[i] ) ); + GL( glBindRenderbuffer( GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) ); + GL( glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, frameBuffer->Width, frameBuffer->Height ) ); + GL( glBindRenderbuffer( GL_RENDERBUFFER, 0 ) ); // Create the frame buffer. - GL( gles_glGenFramebuffers( 1, &frameBuffer->FrameBuffers[i] ) ); - GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[i] ) ); - GL( gles_glFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) ); - GL( gles_glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0 ) ); - GL( GLenum renderFramebufferStatus = gles_glCheckFramebufferStatus( GL_DRAW_FRAMEBUFFER ) ); - GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) ); + GL( glGenFramebuffers( 1, &frameBuffer->FrameBuffers[i] ) ); + GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[i] ) ); + GL( glFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) ); + GL( glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0 ) ); + GL( GLenum renderFramebufferStatus = glCheckFramebufferStatus( GL_DRAW_FRAMEBUFFER ) ); + GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) ); if ( renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE ) { ALOGE( "Incomplete frame buffer object: %s", GlFrameBufferStatusString( renderFramebufferStatus ) ); @@ -556,11 +596,11 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co void ovrFramebuffer_Destroy( ovrFramebuffer * frameBuffer ) { - LOAD_GLES2(glDeleteFramebuffers); - LOAD_GLES2(glDeleteRenderbuffers); + //LOAD_GLES2(glDeleteFramebuffers); + //LOAD_GLES2(glDeleteRenderbuffers); - GL( gles_glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) ); - GL( gles_glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) ); + GL( glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) ); + GL( glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) ); vrapi_DestroyTextureSwapChain( frameBuffer->ColorTextureSwapChain ); @@ -572,14 +612,14 @@ void ovrFramebuffer_Destroy( ovrFramebuffer * frameBuffer ) void ovrFramebuffer_SetCurrent( ovrFramebuffer * frameBuffer ) { - LOAD_GLES2(glBindFramebuffer); - GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->TextureSwapChainIndex] ) ); + //LOAD_GLES2(glBindFramebuffer); + GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->TextureSwapChainIndex] ) ); } void ovrFramebuffer_SetNone() { - LOAD_GLES2(glBindFramebuffer); - GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) ); + //LOAD_GLES2(glBindFramebuffer); + GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) ); } void ovrFramebuffer_Resolve( ovrFramebuffer * frameBuffer ) @@ -601,19 +641,19 @@ void ovrFramebuffer_Advance( ovrFramebuffer * frameBuffer ) void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer ) { - LOAD_GLES2(glEnable); - LOAD_GLES2(glDisable); - LOAD_GLES2(glViewport); - LOAD_GLES2(glScissor); - LOAD_GLES2(glClearColor); - LOAD_GLES2(glClear); + //LOAD_GLES2(glEnable); + //LOAD_GLES2(glDisable); + //LOAD_GLES2(glViewport); + //LOAD_GLES2(glScissor); + //LOAD_GLES2(glClearColor); + //LOAD_GLES2(glClear); - GL( gles_glEnable( GL_SCISSOR_TEST ) ); - GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) ); + GL( glEnable( GL_SCISSOR_TEST ) ); + GL( glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) ); // Explicitly clear the border texels to black because OpenGL-ES does not support GL_CLAMP_TO_BORDER. // Clear to fully opaque black. - GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) ); + GL( glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) ); //Glide comfort mask in and out static float currentVLevel = 0.0f; @@ -633,21 +673,21 @@ void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer ) float height = useMask ? (frameBuffer->Height / 2.0f) * currentVLevel : 1; // bottom - GL( gles_glScissor( 0, 0, frameBuffer->Width, width ) ); - GL( gles_glClear( GL_COLOR_BUFFER_BIT ) ); + GL( glScissor( 0, 0, frameBuffer->Width, width ) ); + GL( glClear( GL_COLOR_BUFFER_BIT ) ); // top - GL( gles_glScissor( 0, frameBuffer->Height - height, frameBuffer->Width, height ) ); - GL( gles_glClear( GL_COLOR_BUFFER_BIT ) ); + GL( glScissor( 0, frameBuffer->Height - height, frameBuffer->Width, height ) ); + GL( glClear( GL_COLOR_BUFFER_BIT ) ); // left - GL( gles_glScissor( 0, 0, width, frameBuffer->Height ) ); - GL( gles_glClear( GL_COLOR_BUFFER_BIT ) ); + GL( glScissor( 0, 0, width, frameBuffer->Height ) ); + GL( glClear( GL_COLOR_BUFFER_BIT ) ); // right - GL( gles_glScissor( frameBuffer->Width - width, 0, width, frameBuffer->Height ) ); - GL( gles_glClear( GL_COLOR_BUFFER_BIT ) ); + GL( glScissor( frameBuffer->Width - width, 0, width, frameBuffer->Height ) ); + GL( glClear( GL_COLOR_BUFFER_BIT ) ); - GL( gles_glScissor( 0, 0, 0, 0 ) ); - GL( gles_glDisable( GL_SCISSOR_TEST ) ); + GL( glScissor( 0, 0, 0, 0 ) ); + GL( glDisable( GL_SCISSOR_TEST ) ); } @@ -1074,6 +1114,10 @@ static void ovrApp_HandleVrModeChanges( ovrApp * app ) vrapi_SetPerfThread( app->Ovr, VRAPI_PERF_THREAD_TYPE_RENDERER, app->RenderThreadTid ); ALOGV( " vrapi_SetPerfThread( RENDERER, %d )", app->RenderThreadTid ); + + vrapi_SetExtraLatencyMode(app->Ovr, VRAPI_EXTRA_LATENCY_MODE_ON); + + ALOGV( " vrapi_SetExtraLatencyMode( %d )", VRAPI_EXTRA_LATENCY_MODE_ON ); } } } @@ -1582,11 +1626,6 @@ void * AppThreadFunction( void * parm ) } #endif - //Set 90hz mode for Quest 2 - if (hmdType == VRAPI_DEVICE_TYPE_OCULUSQUEST2) { - vrapi_SetDisplayRefreshRate(appState.Ovr, 90); - } - // Get the HMD pose, predicted for the middle of the time period during which // the new eye images will be displayed. The number of frames predicted ahead // depends on the pipeline depth of the engine and the synthesis rate. diff --git a/Projects/Android/jni/Quake2VR/VrCommon.h b/Projects/Android/jni/Quake2VR/VrCommon.h index 24805a2..0ab8deb 100644 --- a/Projects/Android/jni/Quake2VR/VrCommon.h +++ b/Projects/Android/jni/Quake2VR/VrCommon.h @@ -22,33 +22,33 @@ #define ALOGV(...) #endif -bool quake2_initialised; +extern bool quake2_initialised; -long long global_time; +extern long long global_time; -float playerHeight; -float playerYaw; +extern float playerHeight; +extern float playerYaw; -bool showingScreenLayer; +extern bool showingScreenLayer; -vec3_t worldPosition; +extern vec3_t worldPosition; -vec3_t hmdPosition; -vec3_t hmdorientation; -vec3_t positionDeltaThisFrame; +extern vec3_t hmdPosition; +extern vec3_t hmdorientation; +extern vec3_t positionDeltaThisFrame; -vec3_t weaponangles; -vec3_t weaponoffset; +extern vec3_t weaponangles; +extern vec3_t weaponoffset; -vec3_t flashlightangles; -vec3_t flashlightoffset; +extern vec3_t flashlightangles; +extern vec3_t flashlightoffset; #define DUCK_NOTDUCKED 0 #define DUCK_BUTTON 1 #define DUCK_CROUCHED 2 -int ducked; +extern int ducked; -bool player_moving; +extern bool player_moving; float radians(float deg); diff --git a/Projects/Android/jni/Quake2VR/VrCvars.h b/Projects/Android/jni/Quake2VR/VrCvars.h index f0a1ebd..9145ee1 100644 --- a/Projects/Android/jni/Quake2VR/VrCvars.h +++ b/Projects/Android/jni/Quake2VR/VrCvars.h @@ -1,10 +1,10 @@ -cvar_t *vr_snapturn_angle; -cvar_t *vr_walkdirection; -cvar_t *vr_weapon_pitchadjust; -cvar_t *vr_lasersight; -cvar_t *vr_control_scheme; -cvar_t *vr_height_adjust; -cvar_t *vr_worldscale; -cvar_t *vr_weaponscale; -cvar_t *vr_weapon_stabilised; -cvar_t *vr_comfort_mask; +extern cvar_t *vr_snapturn_angle; +extern cvar_t *vr_walkdirection; +extern cvar_t *vr_weapon_pitchadjust; +extern cvar_t *vr_lasersight; +extern cvar_t *vr_control_scheme; +extern cvar_t *vr_height_adjust; +extern cvar_t *vr_worldscale; +extern cvar_t *vr_weaponscale; +extern cvar_t *vr_weapon_stabilised; +extern cvar_t *vr_comfort_mask; diff --git a/Projects/Android/jni/Quake2VR/VrInput.h b/Projects/Android/jni/Quake2VR/VrInput.h index 063578e..d6e9bf1 100644 --- a/Projects/Android/jni/Quake2VR/VrInput.h +++ b/Projects/Android/jni/Quake2VR/VrInput.h @@ -5,26 +5,26 @@ #include "VrCommon.h" //New control scheme definitions to be defined L1VR_SurfaceView.c enumeration -enum control_scheme; +extern enum control_scheme; -ovrInputStateTrackedRemote leftTrackedRemoteState_old; -ovrInputStateTrackedRemote leftTrackedRemoteState_new; -ovrTracking leftRemoteTracking_new; +extern ovrInputStateTrackedRemote leftTrackedRemoteState_old; +extern ovrInputStateTrackedRemote leftTrackedRemoteState_new; +extern ovrTracking leftRemoteTracking_new; -ovrInputStateTrackedRemote rightTrackedRemoteState_old; -ovrInputStateTrackedRemote rightTrackedRemoteState_new; -ovrTracking rightRemoteTracking_new; +extern ovrInputStateTrackedRemote rightTrackedRemoteState_old; +extern ovrInputStateTrackedRemote rightTrackedRemoteState_new; +extern ovrTracking rightRemoteTracking_new; -ovrDeviceID controllerIDs[2]; +extern ovrDeviceID controllerIDs[2]; -int hmdType; +extern int hmdType; -float remote_movementSideways; -float remote_movementForward; -float remote_movementUp; -float positional_movementSideways; -float positional_movementForward; -float snapTurn; +extern float remote_movementSideways; +extern float remote_movementForward; +extern float remote_movementUp; +extern float positional_movementSideways; +extern float positional_movementForward; +extern float snapTurn; void sendButtonAction(const char* action, long buttonDown); void sendButtonActionSimple(const char* action); diff --git a/Projects/Android/jni/Quake2VR/VrInputCommon.c b/Projects/Android/jni/Quake2VR/VrInputCommon.c index 48a0665..baf3e29 100644 --- a/Projects/Android/jni/Quake2VR/VrInputCommon.c +++ b/Projects/Android/jni/Quake2VR/VrInputCommon.c @@ -17,6 +17,50 @@ Authors : Simon Brown //keys.h void Key_Event (int key, qboolean down, unsigned time); +bool quake2_initialised; + +long long global_time; + +enum control_scheme; + +ovrInputStateTrackedRemote leftTrackedRemoteState_old; +ovrInputStateTrackedRemote leftTrackedRemoteState_new; +ovrTracking leftRemoteTracking_new; + +ovrInputStateTrackedRemote rightTrackedRemoteState_old; +ovrInputStateTrackedRemote rightTrackedRemoteState_new; +ovrTracking rightRemoteTracking_new; + +ovrDeviceID controllerIDs[2]; + +int hmdType; + +float remote_movementSideways; +float remote_movementForward; +float remote_movementUp; +float positional_movementSideways; +float positional_movementForward; +float snapTurn; + +float playerHeight; +float playerYaw; + +bool showingScreenLayer; + +vec3_t worldPosition; + +vec3_t hmdPosition; +vec3_t hmdorientation; +vec3_t positionDeltaThisFrame; + +vec3_t weaponangles; +vec3_t weaponoffset; + +vec3_t flashlightangles; +vec3_t flashlightoffset; +int ducked; + +bool player_moving; void handleTrackedControllerButton(u_int32_t buttonsNew, u_int32_t buttonsOld, uint32_t button, int key) { diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/fpe_shader.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/fpe_shader.h index 2b32b24..69a8db2 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/fpe_shader.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/fpe_shader.h @@ -3,7 +3,7 @@ #include "fpe.h" -const char* fpeshader_signature; +extern const char* fpeshader_signature; const char* const* fpe_VertexShader(fpe_state_t *state); const char* const* fpe_FragmentShader(fpe_state_t *state); diff --git a/Projects/Android/jni/SupportLibs/gl4es/src/gl/string_utils.h b/Projects/Android/jni/SupportLibs/gl4es/src/gl/string_utils.h index 467b17e..f8d5d4d 100644 --- a/Projects/Android/jni/SupportLibs/gl4es/src/gl/string_utils.h +++ b/Projects/Android/jni/SupportLibs/gl4es/src/gl/string_utils.h @@ -1,7 +1,7 @@ #ifndef _GL4ES_STRING_UTILS_H_ #define _GL4ES_STRING_UTILS_H_ -const char* AllSeparators; +extern const char* AllSeparators; int CountString(char* pBuffer, const char* S); char* ResizeIfNeeded(char* pBuffer, int *size, int addsize); diff --git a/Projects/Android/jni/quake2/Android.mk b/Projects/Android/jni/quake2/Android.mk index a7e6413..ed6a2de 100644 --- a/Projects/Android/jni/quake2/Android.mk +++ b/Projects/Android/jni/quake2/Android.mk @@ -103,8 +103,8 @@ LOCAL_SRC_FILES := $(CLIENT_OBJS_:.o=.c) \ LOCAL_LDLIBS := -lEGL -ldl -llog -landroid -lOpenSLES -lz -LOCAL_STATIC_LIBRARIES := gl4es sigc libzip libpng libjpeg -LOCAL_SHARED_LIBRARIES := openal vrapi +LOCAL_STATIC_LIBRARIES := sigc libzip libpng libjpeg +LOCAL_SHARED_LIBRARIES := gl4es openal vrapi LOCAL_LDLIBS += -lGLESv3 include $(BUILD_SHARED_LIBRARY) diff --git a/Projects/Android/jni/quake2/src/client/vid/glimp_android.c b/Projects/Android/jni/quake2/src/client/vid/glimp_android.c index 3de97b5..a3b2a41 100644 --- a/Projects/Android/jni/quake2/src/client/vid/glimp_android.c +++ b/Projects/Android/jni/quake2/src/client/vid/glimp_android.c @@ -33,15 +33,15 @@ int sys_frame_time; qboolean joy_altselector_pressed = false; // Console Variables -cvar_t *vid_fullscreen; -cvar_t *freelook; -cvar_t *lookstrafe; -cvar_t *m_forward; -cvar_t *m_pitch; -cvar_t *m_side; -cvar_t *m_up; -cvar_t *m_yaw; -cvar_t *sensitivity; +extern cvar_t *vid_fullscreen; +extern cvar_t *freelook; +extern cvar_t *lookstrafe; +extern cvar_t *m_forward; +extern cvar_t *m_pitch; +extern cvar_t *m_side; +extern cvar_t *m_up; +extern cvar_t *m_yaw; +extern cvar_t *sensitivity; void Quest_GetScreenRes(int *width, int *height); int Quest_GetRefresh(); diff --git a/java/com/drbeef/quake2quest/GLES3JNIActivity.java b/java/com/drbeef/quake2quest/GLES3JNIActivity.java index ec1f39c..94d4948 100644 --- a/java/com/drbeef/quake2quest/GLES3JNIActivity.java +++ b/java/com/drbeef/quake2quest/GLES3JNIActivity.java @@ -204,7 +204,7 @@ import static android.system.Os.setenv; } try { - setenv("YQUAKE2_GAMELIBDIR", getFilesDir().getParentFile().getPath() + "/lib", true); + setenv("YQUAKE2_GAMELIBDIR", getApplicationInfo().nativeLibraryDir, true); } catch (Exception e) {