mirror of
https://github.com/DrBeef/Quake2Quest.git
synced 2024-11-12 23:54:24 +00:00
Added option to choose refresh rate in video menu
This commit is contained in:
parent
f664a51977
commit
e2c6ee493a
3 changed files with 40 additions and 1 deletions
|
@ -115,6 +115,10 @@ cvar_t *vr_worldscale;
|
|||
cvar_t *vr_weaponscale;
|
||||
cvar_t *vr_weapon_stabilised;
|
||||
cvar_t *vr_comfort_mask;
|
||||
cvar_t *vr_turn_deadzone;
|
||||
cvar_t *vr_framerate;
|
||||
char **refresh_names;
|
||||
float *refresh_values;
|
||||
|
||||
enum control_scheme {
|
||||
RIGHT_HANDED_DEFAULT = 0,
|
||||
|
@ -1409,6 +1413,24 @@ void VR_Init()
|
|||
vr_weapon_stabilised = Cvar_Get( "vr_weapon_stabilised", "0.0", CVAR_LATCH);
|
||||
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_LATCH);
|
||||
vr_comfort_mask = Cvar_Get( "vr_comfort_mask", "0.0", CVAR_ARCHIVE);
|
||||
vr_turn_deadzone = Cvar_Get( "vr_turn_deadzone", "0.2", CVAR_ARCHIVE);
|
||||
vr_framerate = Cvar_Get( "vr_framerate", "0", CVAR_ARCHIVE);
|
||||
|
||||
//Acquire supported refresh rates to populate options in video menu where framerate is selected
|
||||
|
||||
int refresh_num = vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_NUM_SUPPORTED_DISPLAY_REFRESH_RATES );
|
||||
float refresh_arr[refresh_num];
|
||||
int total = vrapi_GetSystemPropertyFloatArray( &java, VRAPI_SYS_PROP_SUPPORTED_DISPLAY_REFRESH_RATES, refresh_arr, refresh_num );
|
||||
|
||||
refresh_names = malloc((total+1) * sizeof (char*));
|
||||
refresh_values = malloc((total) * sizeof (float));
|
||||
for (int i = 0; i < total; i++) {
|
||||
refresh_names[i] = malloc(5 * sizeof (char*));
|
||||
sprintf(refresh_names[i],"%.0fHz", refresh_arr[i]);
|
||||
refresh_values[i] = refresh_arr[i];
|
||||
}
|
||||
refresh_names[total] = malloc(5 * sizeof (int));
|
||||
refresh_names[total] = 0;
|
||||
|
||||
//The Engine (which is a derivative of Quake) uses a very specific unit size:
|
||||
//Wolfenstein 3D, DOOM and QUAKE use the same coordinate/unit system:
|
||||
|
@ -1697,6 +1719,10 @@ void * AppThreadFunction( void * parm )
|
|||
}
|
||||
|
||||
ovrSubmitFrameDescription2 frameDesc = { 0 };
|
||||
if(vr_framerate->modified){
|
||||
vrapi_SetDisplayRefreshRate(appState.Ovr, refresh_values[(int)vr_framerate->value]);
|
||||
vr_framerate->modified = false;
|
||||
}
|
||||
if (!useScreenLayer()) {
|
||||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
|
|
|
@ -8,3 +8,6 @@ extern cvar_t *vr_worldscale;
|
|||
extern cvar_t *vr_weaponscale;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
extern cvar_t *vr_comfort_mask;
|
||||
extern cvar_t *vr_framerate;
|
||||
extern char **refresh_names;
|
||||
extern float *refresh_values;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "../../client/header/client.h"
|
||||
#include "../../client/menu/header/qmenu.h"
|
||||
#include "header/qmenu.h"
|
||||
#include "../../../../Quake2VR/VrCvars.h"
|
||||
|
||||
extern void M_ForceMenuOff(void);
|
||||
|
@ -53,6 +52,7 @@ static menulist_s s_uiscale_list;
|
|||
static menuslider_s s_brightness_slider;
|
||||
static menuslider_s s_comfort_slider;
|
||||
static menulist_s s_fs_box;
|
||||
static menulist_s s_refresh_rate;
|
||||
static menulist_s s_vsync_list;
|
||||
static menulist_s s_af_list;
|
||||
static menulist_s s_msaa_list;
|
||||
|
@ -242,6 +242,8 @@ ApplyChanges(void *unused)
|
|||
}
|
||||
}
|
||||
|
||||
Cvar_SetValue("vr_framerate", (float)s_refresh_rate.curvalue);
|
||||
|
||||
if (restart)
|
||||
{
|
||||
Cbuf_AddText("vid_restart\n");
|
||||
|
@ -481,6 +483,13 @@ VID_MenuInit(void)
|
|||
s_fs_box.itemnames = fullscreen_names;
|
||||
s_fs_box.curvalue = (int)vid_fullscreen->value;
|
||||
|
||||
s_refresh_rate.generic.type = MTYPE_SPINCONTROL;
|
||||
s_refresh_rate.generic.name = "refresh rate";
|
||||
s_refresh_rate.generic.x = 0;
|
||||
s_refresh_rate.generic.y = (y += 10);
|
||||
s_refresh_rate.itemnames = (const char **) refresh_names;
|
||||
s_refresh_rate.curvalue = (int)vr_framerate->value;
|
||||
|
||||
s_vsync_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_vsync_list.generic.name = "vertical sync";
|
||||
s_vsync_list.generic.x = 0;
|
||||
|
@ -539,6 +548,7 @@ VID_MenuInit(void)
|
|||
Menu_AddItem(&s_opengl_menu, (void *)&s_comfort_slider);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_refresh_rate);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
|
||||
|
|
Loading…
Reference in a new issue