Expand the list of options available for the framerate limiter, and add a separate option that controls an offset added to the limiter. This should allow the menu to cover all of the important use cases involving G-SYNC, FreeSync, and "Fast Sync".

git-svn-id: https://svn.eduke32.com/eduke32@7287 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-12-15 01:40:14 +00:00
parent 33b9dafe8f
commit 9a23ea148e
4 changed files with 20 additions and 8 deletions

View file

@ -116,6 +116,7 @@ int32_t hud_showmapname = 1;
int32_t g_levelTextTime = 0; int32_t g_levelTextTime = 0;
int32_t r_maxfps = 60; int32_t r_maxfps = 60;
int32_t r_maxfpsoffset = 0;
uint64_t g_frameDelay = 17; uint64_t g_frameDelay = 17;
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) #if defined(RENDERTYPEWIN) && defined(USE_OPENGL)

View file

@ -324,6 +324,7 @@ extern int32_t g_restorePalette;
extern int32_t hud_glowingquotes; extern int32_t hud_glowingquotes;
extern int32_t hud_showmapname; extern int32_t hud_showmapname;
extern int32_t r_maxfps; extern int32_t r_maxfps;
extern int32_t r_maxfpsoffset;
extern int32_t tempwallptr; extern int32_t tempwallptr;
extern int32_t ticrandomseed; extern int32_t ticrandomseed;
extern int32_t vote_map; extern int32_t vote_map;

View file

@ -522,12 +522,14 @@ static MenuOptionSet_t MEOS_VIDEOSETUP_VSYNC = MAKE_MENUOPTIONSET(MEOSN_VIDEOSET
static MenuOption_t MEO_VIDEOSETUP_VSYNC = MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_VSYNC, &newvsync); static MenuOption_t MEO_VIDEOSETUP_VSYNC = MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_VSYNC, &newvsync);
static MenuEntry_t ME_VIDEOSETUP_VSYNC = MAKE_MENUENTRY("VSync:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_VSYNC, Option); static MenuEntry_t ME_VIDEOSETUP_VSYNC = MAKE_MENUENTRY("VSync:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_VSYNC, Option);
static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] = { "None", "30 fps", "60 fps", "120 fps", }; static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] = { "None", "30 fps", "60 fps", "120 fps", "144 fps", "165 fps", "240 fps" };
static int32_t MEOSV_VIDEOSETUP_FRAMELIMIT [] = { 0, 30, 60, 120 }; static int32_t MEOSV_VIDEOSETUP_FRAMELIMIT [] = { 0, 30, 60, 120, 144, 165, 240 };
static MenuOptionSet_t MEOS_VIDEOSETUP_FRAMELIMIT = MAKE_MENUOPTIONSET(MEOSN_VIDEOSETUP_FRAMELIMIT, MEOSV_VIDEOSETUP_FRAMELIMIT, 0x2); static MenuOptionSet_t MEOS_VIDEOSETUP_FRAMELIMIT = MAKE_MENUOPTIONSET(MEOSN_VIDEOSETUP_FRAMELIMIT, MEOSV_VIDEOSETUP_FRAMELIMIT, 0x0);
static MenuOption_t MEO_VIDEOSETUP_FRAMELIMIT= MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_FRAMELIMIT, &r_maxfps); static MenuOption_t MEO_VIDEOSETUP_FRAMELIMIT= MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_FRAMELIMIT, &r_maxfps);
static MenuEntry_t ME_VIDEOSETUP_FRAMELIMIT = MAKE_MENUENTRY("Framerate limit:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMIT, Option); static MenuEntry_t ME_VIDEOSETUP_FRAMELIMIT = MAKE_MENUENTRY("Framerate limit:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMIT, Option);
static MenuRangeInt32_t MEO_VIDEOSETUP_FRAMELIMITOFFSET = MAKE_MENURANGE( &r_maxfpsoffset, &MF_Redfont, -10, 10, 0, 21, 1 );
static MenuEntry_t ME_VIDEOSETUP_FRAMELIMITOFFSET = MAKE_MENUENTRY( "FPS offset:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMITOFFSET, RangeInt32 );
static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY( "Apply Changes", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_NULL, Link ); static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY( "Apply Changes", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_NULL, Link );
@ -536,8 +538,8 @@ static MenuLink_t MEO_DISPLAYSETUP_COLORCORR = { MENU_COLCORR, MA_Advance, };
static MenuEntry_t ME_DISPLAYSETUP_COLORCORR = MAKE_MENUENTRY( "Color Correction", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_COLORCORR, Link ); static MenuEntry_t ME_DISPLAYSETUP_COLORCORR = MAKE_MENUENTRY( "Color Correction", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_COLORCORR, Link );
static char const *MEOSN_DISPLAYSETUP_UPSCALING[] = { "None", "2x", "4x" }; static char const *MEOSN_DISPLAYSETUP_UPSCALING[] = { "None", "2x" };
static int32_t MEOSV_DISPLAYSETUP_UPSCALING[] = { 1, 2, 4 }; static int32_t MEOSV_DISPLAYSETUP_UPSCALING[] = { 1, 2 };
static MenuOptionSet_t MEOS_DISPLAYSETUP_UPSCALING = MAKE_MENUOPTIONSET( MEOSN_DISPLAYSETUP_UPSCALING, MEOSV_DISPLAYSETUP_UPSCALING, 0x0 ); static MenuOptionSet_t MEOS_DISPLAYSETUP_UPSCALING = MAKE_MENUOPTIONSET( MEOSN_DISPLAYSETUP_UPSCALING, MEOSV_DISPLAYSETUP_UPSCALING, 0x0 );
static MenuOption_t MEO_DISPLAYSETUP_UPSCALING = MAKE_MENUOPTION( &MF_Redfont, &MEOS_DISPLAYSETUP_UPSCALING, &ud.detail ); static MenuOption_t MEO_DISPLAYSETUP_UPSCALING = MAKE_MENUOPTION( &MF_Redfont, &MEOS_DISPLAYSETUP_UPSCALING, &ud.detail );
static MenuEntry_t ME_DISPLAYSETUP_UPSCALING = MAKE_MENUENTRY( "Upscaling:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_UPSCALING, Option ); static MenuEntry_t ME_DISPLAYSETUP_UPSCALING = MAKE_MENUENTRY( "Upscaling:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_UPSCALING, Option );
@ -711,6 +713,7 @@ static MenuEntry_t *MEL_VIDEOSETUP[] = {
&ME_VIDEOSETUP_FULLSCREEN, &ME_VIDEOSETUP_FULLSCREEN,
&ME_VIDEOSETUP_VSYNC, &ME_VIDEOSETUP_VSYNC,
&ME_VIDEOSETUP_FRAMELIMIT, &ME_VIDEOSETUP_FRAMELIMIT,
&ME_VIDEOSETUP_FRAMELIMITOFFSET,
&ME_Space6_Redfont, &ME_Space6_Redfont,
&ME_VIDEOSETUP_APPLY, &ME_VIDEOSETUP_APPLY,
}; };
@ -1989,6 +1992,8 @@ static void Menu_Pre(MenuID_t cm)
&& vsync == newvsync && vsync == newvsync
) )
|| (newrendermode != REND_CLASSIC && resolution[nr].bppmax <= 8)); || (newrendermode != REND_CLASSIC && resolution[nr].bppmax <= 8));
MenuEntry_DisableOnCondition(&ME_VIDEOSETUP_FRAMELIMITOFFSET, !r_maxfps);
break; break;
} }
@ -3216,7 +3221,11 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
} }
else if (entry == &ME_VIDEOSETUP_FRAMELIMIT) else if (entry == &ME_VIDEOSETUP_FRAMELIMIT)
{ {
g_frameDelay = newOption ? (timerGetFreqU64()/newOption) : 0; g_frameDelay = newOption ? (timerGetFreqU64()/(newOption + r_maxfpsoffset)) : 0;
}
else if (entry == &ME_VIDEOSETUP_FRAMELIMITOFFSET)
{
g_frameDelay = r_maxfps ? (timerGetFreqU64()/(r_maxfps + newOption)) : 0;
} }
switch (g_currentMenu) switch (g_currentMenu)

View file

@ -1390,10 +1390,10 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
ud.statusbarmode = (ud.screen_size < 8); ud.statusbarmode = (ud.screen_size < 8);
G_UpdateScreenArea(); G_UpdateScreenArea();
} }
else if (!Bstrcasecmp(parm->name, "r_maxfps")) else if (!Bstrcasecmp(parm->name, "r_maxfps") || !Bstrcasecmp(parm->name, "r_maxfpsoffset"))
{ {
if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000); if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000);
g_frameDelay = r_maxfps ? (timerGetFreqU64()/r_maxfps) : 0; g_frameDelay = r_maxfps ? (timerGetFreqU64()/(r_maxfps + r_maxfpsoffset)) : 0;
} }
else if (!Bstrcasecmp(parm->name, "r_ambientlight")) else if (!Bstrcasecmp(parm->name, "r_ambientlight"))
{ {
@ -1642,6 +1642,7 @@ int32_t registerosdcommands(void)
{ "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
{ "r_maxfps", "limit the frame rate",(void *)&r_maxfps, CVAR_INT|CVAR_FUNCPTR, 0, 1000 }, { "r_maxfps", "limit the frame rate",(void *)&r_maxfps, CVAR_INT|CVAR_FUNCPTR, 0, 1000 },
{ "r_maxfpsoffset", "menu-controlled offset for r_maxfps",(void *)&r_maxfpsoffset, CVAR_INT|CVAR_FUNCPTR, -10, 10 },
{ "sensitivity","changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 }, { "sensitivity","changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 },