Multiple small changes:

- Menu option to use motion to reignite saber
- Show error dialog if app can't start due to no headset detected
- Cvar to allow people to configure custom distance for weapon scopes to engage from HMD
- Use faster buffer blit for desktop window
This commit is contained in:
Simon 2023-09-17 08:46:21 +01:00
parent 572b6c5f8a
commit 8a09007ad0
14 changed files with 201 additions and 23 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jkxr" package="com.drbeef.jkxr"
android:versionCode="64" android:versionCode="64"
android:versionName="1.1.17" android:installLocation="auto" > android:versionName="1.1.18" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030002" android:required="true"/> <uses-feature android:glEsVersion="0x00030002" android:required="true"/>

View file

@ -10,6 +10,7 @@ extern cvar_t *vr_switch_sticks;
extern cvar_t *vr_immersive_cinematics; extern cvar_t *vr_immersive_cinematics;
extern cvar_t *vr_screen_dist; extern cvar_t *vr_screen_dist;
extern cvar_t *vr_weapon_velocity_trigger; extern cvar_t *vr_weapon_velocity_trigger;
extern cvar_t *vr_scope_engage_distance;
extern cvar_t *vr_force_velocity_trigger; extern cvar_t *vr_force_velocity_trigger;
extern cvar_t *vr_force_distance_trigger; extern cvar_t *vr_force_distance_trigger;
extern cvar_t *vr_two_handed_weapons; extern cvar_t *vr_two_handed_weapons;

View file

@ -23,6 +23,7 @@ cvar_t *vr_switch_sticks;
cvar_t *vr_immersive_cinematics; cvar_t *vr_immersive_cinematics;
cvar_t *vr_screen_dist; cvar_t *vr_screen_dist;
cvar_t *vr_weapon_velocity_trigger; cvar_t *vr_weapon_velocity_trigger;
cvar_t * vr_scope_engage_distance;
cvar_t *vr_force_velocity_trigger; cvar_t *vr_force_velocity_trigger;
cvar_t *vr_force_distance_trigger; cvar_t *vr_force_distance_trigger;
cvar_t *vr_two_handed_weapons; cvar_t *vr_two_handed_weapons;

View file

@ -628,7 +628,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
cl.frame.ps.stats[STAT_HEALTH] > 0) cl.frame.ps.stats[STAT_HEALTH] > 0)
{ {
if (vr.weapon_stabilised && if (vr.weapon_stabilised &&
VectorLength(vr.weaponoffset) < 0.24f && VectorLength(vr.weaponoffset) < vr_scope_engage_distance->value &&
vr.cgzoommode == 0) { vr.cgzoommode == 0) {
sendButtonAction("enterscope", true); sendButtonAction("enterscope", true);
} else if ((VectorLength(vr.weaponoffset) > 0.26f || !vr.weapon_stabilised) && } else if ((VectorLength(vr.weaponoffset) > 0.26f || !vr.weapon_stabilised) &&

View file

@ -251,6 +251,7 @@ void VR_Init()
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "1", CVAR_ARCHIVE); vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "1", CVAR_ARCHIVE);
vr_screen_dist = Cvar_Get( "vr_screen_dist", "3.5", CVAR_ARCHIVE); vr_screen_dist = Cvar_Get( "vr_screen_dist", "3.5", CVAR_ARCHIVE);
vr_weapon_velocity_trigger = Cvar_Get( "vr_weapon_velocity_trigger", "2.0", CVAR_ARCHIVE); vr_weapon_velocity_trigger = Cvar_Get( "vr_weapon_velocity_trigger", "2.0", CVAR_ARCHIVE);
vr_scope_engage_distance = Cvar_Get( "vr_scope_engage_distance", "0.25", CVAR_ARCHIVE);
vr_force_velocity_trigger = Cvar_Get( "vr_force_velocity_trigger", "2.09", CVAR_ARCHIVE); vr_force_velocity_trigger = Cvar_Get( "vr_force_velocity_trigger", "2.09", CVAR_ARCHIVE);
vr_force_distance_trigger = Cvar_Get( "vr_force_distance_trigger", "0.15", CVAR_ARCHIVE); vr_force_distance_trigger = Cvar_Get( "vr_force_distance_trigger", "0.15", CVAR_ARCHIVE);
vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE); vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE);

View file

@ -212,35 +212,21 @@ void ovrFramebuffer_SetNone() {
GL(glBindFramebuffer(GL_FRAMEBUFFER, 0)); GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
} }
PFNGLBLITNAMEDFRAMEBUFFERPROC glBlitNamedFramebuffer = NULL;
extern cvar_t* r_mode; extern cvar_t* r_mode;
qboolean R_GetModeInfo(int* width, int* height, int mode); qboolean R_GetModeInfo(int* width, int* height, int mode);
void ovrFramebuffer_Resolve(ovrFramebuffer* frameBuffer) { void ovrFramebuffer_Resolve(ovrFramebuffer* frameBuffer) {
if (glBlitNamedFramebuffer == NULL)
{
glBlitNamedFramebuffer = (PFNGLBLITNAMEDFRAMEBUFFERPROC)SDL_GL_GetProcAddress("glBlitNamedFramebuffer");
}
const GLuint colorTexture = frameBuffer->ColorSwapChainImage[frameBuffer->TextureSwapChainIndex].image; const GLuint colorTexture = frameBuffer->ColorSwapChainImage[frameBuffer->TextureSwapChainIndex].image;
int width, height; int width, height;
R_GetModeInfo(&width, &height, r_mode->integer); R_GetModeInfo(&width, &height, r_mode->integer);
glBlitNamedFramebuffer((GLuint)colorTexture, // readFramebuffer glBindFramebuffer(GL_READ_FRAMEBUFFER, colorTexture);
(GLuint)0, // backbuffer // drawFramebuffer glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
(GLint)0, // srcX0 glBlitFramebuffer(0, 0, gAppState.Width, gAppState.Height,
(GLint)0, // srcY0 0, 0, width, height,
(GLint)gAppState.Width, // srcX1 GL_COLOR_BUFFER_BIT, GL_NEAREST);
(GLint)gAppState.Height, // srcY1
(GLint)0, // dstX0
(GLint)0, // dstY0
(GLint)width, // dstX1
(GLint)height, // dstY1
(GLbitfield)GL_COLOR_BUFFER_BIT, // mask
(GLenum)GL_LINEAR); // filter
} }
void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) { void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) {
@ -906,7 +892,10 @@ void TBXR_InitialiseOpenXR()
OXR(initResult = xrGetSystem(gAppState.Instance, &systemGetInfo, &gAppState.SystemId)); OXR(initResult = xrGetSystem(gAppState.Instance, &systemGetInfo, &gAppState.SystemId));
if (initResult != XR_SUCCESS) { if (initResult != XR_SUCCESS) {
ALOGE("Failed to get system."); if (initResult != XR_SUCCESS) {
Sys_Dialog(DT_ERROR, "Unable to create OpenXR System - Please ensure you headset is connected and powered on.", "No VR Headset Detected");
exit(1);
}
exit(1); exit(1);
} }

View file

@ -37,6 +37,12 @@ char *Sys_Cwd( void ) {
return cwd; return cwd;
} }
//No support for this on Android atm
dialogResult_t Sys_Dialog(dialogType_t type, const char* message, const char* title)
{
return DR_OK;
}
/* /*
================= =================
Sys_ConsoleInput Sys_ConsoleInput

View file

@ -66,6 +66,25 @@ void *MSG_GetSpace (msg_t *buf, int length);
void MSG_WriteData (msg_t *buf, const void *data, int length); void MSG_WriteData (msg_t *buf, const void *data, int length);
typedef enum
{
DR_YES = 0,
DR_NO = 1,
DR_OK = 0,
DR_CANCEL = 1
} dialogResult_t;
typedef enum
{
DT_INFO,
DT_WARNING,
DT_ERROR,
DT_YES_NO,
DT_OK_CANCEL
} dialogType_t;
dialogResult_t Sys_Dialog(dialogType_t type, const char* message, const char* title);
struct usercmd_s; struct usercmd_s;
struct entityState_s; struct entityState_s;

View file

@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
// Current version of the single player game // Current version of the single player game
#include "../win32/AutoVersion.h" #include "../win32/AutoVersion.h"
#define JKXR_VERSION "1.1.17-ea" #define JKXR_VERSION "1.1.18-ea"
#ifdef _DEBUG #ifdef _DEBUG
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION #define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION

View file

@ -34,6 +34,40 @@ static char homePath[ MAX_OSPATH ] = { 0 };
static UINT timerResolution = 0; static UINT timerResolution = 0;
/*
==============
Sys_Dialog
Display a win32 dialog box
==============
*/
dialogResult_t Sys_Dialog(dialogType_t type, const char* message, const char* title)
{
UINT uType;
switch (type)
{
default:
case DT_INFO: uType = MB_ICONINFORMATION | MB_OK; break;
case DT_WARNING: uType = MB_ICONWARNING | MB_OK; break;
case DT_ERROR: uType = MB_ICONERROR | MB_OK; break;
case DT_YES_NO: uType = MB_ICONQUESTION | MB_YESNO; break;
case DT_OK_CANCEL: uType = MB_ICONWARNING | MB_OKCANCEL; break;
}
switch (MessageBox(NULL, message, title, uType))
{
default:
case IDOK: return DR_OK;
case IDCANCEL: return DR_CANCEL;
case IDYES: return DR_YES;
case IDNO: return DR_NO;
}
}
/* /*
============== ==============
Sys_Basename Sys_Basename

View file

@ -1025,6 +1025,38 @@
} }
} }
itemDef
{
name none
group commoncontrols
type ITEM_TYPE_YESNO
text "Motion Ignite Saber:"
cvar "vr_motion_enable_saber"
rect 260 380 340 14
textalign ITEM_ALIGN_RIGHT
textalignx 174
textaligny 0
font 4
textscale 1
forecolor 1 1 1 0.0
visible 0
descText "Turn disabled saber back on when motion triggered"
action
{
play sound/interface/button1
}
mouseenter
{
show button_glow
setitemrect button_glow 260 380 340 20
}
mouseexit
{
hide button_glow
}
}
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
// //
// WEAPON MENU // WEAPON MENU

View file

@ -1208,6 +1208,37 @@
} }
} }
itemDef
{
name none
group commoncontrols
type ITEM_TYPE_YESNO
text "Motion Ignite Saber:"
cvar "vr_motion_enable_saber"
rect 260 380 340 14
textalign ITEM_ALIGN_RIGHT
textalignx 174
textaligny 0
font 4
textscale 1
forecolor .615 .615 .956 0.0
visible 0
descText "Turn disabled saber back on when motion triggered"
action
{
play sound/interface/button1
}
mouseenter
{
show highlight10
}
mouseexit
{
hide highlight10
}
}
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
// //
// WEAPON MENU // WEAPON MENU

View file

@ -1515,6 +1515,38 @@
} }
} }
itemDef
{
name none
group commoncontrols
type ITEM_TYPE_YESNO
text "Motion Ignite Saber:"
cvar "vr_motion_enable_saber"
rect 305 371 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 3
descText "Turn disabled saber back on when motion triggered"
action
{
play sound/interface/button1
}
mouseenter
{
show highlight11
}
mouseexit
{
hide highlight11
}
}
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------

View file

@ -1514,6 +1514,38 @@
} }
} }
itemDef
{
name none
group commoncontrols
type ITEM_TYPE_YESNO
text "Motion Ignite Saber:"
cvar "vr_motion_enable_saber"
rect 305 371 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 3
descText "Turn disabled saber back on when motion triggered"
action
{
play sound/interface/button1
}
mouseenter
{
show highlight10
}
mouseexit
{
hide highlight10
}
}
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------