Rearrange the menu, clean up, and change some things

This commit is contained in:
Matthew Coppola committed 2024-12-06 17:20:23 -05:00
1 parent b34bb01240
commit 0b8a333e2b
2 files changed
+80 -72

No files matched your search

+78 -70
View File
@@ -741,16 +741,16 @@ static MenuItemHandlerResult menuhandlerVsync(s32 operation, struct menuitem *it
static const char *opts[] = { static const char *opts[] = {
"Adaptive", "Adaptive",
"Off", "Off",
"On (Sync Every Frame)", "On (Every Frame)",
"On (Sync Every 2 Frames)", "On (Every 2 Frames)",
"On (Sync Every 3 Frames)", "On (Every 3 Frames)",
"On (Sync Every 4 Frames)", "On (Every 4 Frames)",
"On (Sync Every 5 Frames)", "On (Every 5 Frames)",
"On (Sync Every 6 Frames)", "On (Every 6 Frames)",
"On (Sync Every 7 Frames)", "On (Every 7 Frames)",
"On (Sync Every 8 Frames)", "On (Every 8 Frames)",
"On (Sync Every 9 Frames)", "On (Every 9 Frames)",
"On (Sync Every 10 Frames)" "On (Every 10 Frames)"
}; };
switch (operation) { switch (operation) {
@@ -781,10 +781,12 @@ static MenuItemHandlerResult menuhandlerFramerateLimit(s32 operation, struct men
videoSetFramerateLimit(data->slider.value); videoSetFramerateLimit(data->slider.value);
break; break;
case MENUOP_GETSLIDERLABEL: case MENUOP_GETSLIDERLABEL:
// NOTE: data->slider.label length must not exceed 15.
if (data->slider.value == 0) { if (data->slider.value == 0) {
sprintf(data->slider.label, "Off"); strcpy(data->slider.label, "Off");
} else {
sprintf(data->slider.label, "%d FPS", data->slider.value);
} }
break;
} }
return 0; return 0;
@@ -795,10 +797,10 @@ static MenuItemHandlerResult menuhandlerMSAA(s32 operation, struct menuitem *ite
s32 msaa; s32 msaa;
static const char *opts[] = { static const char *opts[] = {
"Off", "Off",
"2x", "2x (MSAA)",
"4x", "4x (MSAA)",
"8x", "8x (MSAA)",
"16x" "16x (MSAA)"
}; };
switch (operation) { switch (operation) {
@@ -919,7 +921,6 @@ static MenuItemHandlerResult menuhandlerDisplayFPS(s32 operation, struct menuite
return videoGetDisplayFPS(); return videoGetDisplayFPS();
case MENUOP_SET: case MENUOP_SET:
videoSetDisplayFPS(data->checkbox.value); videoSetDisplayFPS(data->checkbox.value);
break;
} }
return 0; return 0;
@@ -927,36 +928,19 @@ static MenuItemHandlerResult menuhandlerDisplayFPS(s32 operation, struct menuite
static MenuItemHandlerResult menuhandlerDisplayFPSInterval(s32 operation, struct menuitem *item, union handlerdata *data) static MenuItemHandlerResult menuhandlerDisplayFPSInterval(s32 operation, struct menuitem *item, union handlerdata *data)
{ {
s32 divisor;
static const char *opts[] = {
"1 Sec",
"1/2 Secs",
"1/4 Secs",
"1/8 Secs",
"1/16 Secs",
};
switch (operation) { switch (operation) {
case MENUOP_GETOPTIONCOUNT: case MENUOP_GETSLIDER:
data->dropdown.value = ARRAYCOUNT(opts); data->slider.value = videoGetDisplayFPSDivisor() - 1;
break; break;
case MENUOP_GETOPTIONTEXT:
return (intptr_t)opts[data->dropdown.value];
case MENUOP_SET: case MENUOP_SET:
videoSetDisplayFPSDivisor(1 << data->dropdown.value); videoSetDisplayFPSDivisor(data->dropdown.value + 1);
break; break;
case MENUOP_GETSELECTEDINDEX: case MENUOP_GETSLIDERLABEL:
divisor = videoGetDisplayFPSDivisor(); // NOTE: data->slider.label length must not exceed 15.
if (divisor < 2) { if (data->slider.value == 0) {
data->dropdown.value = 0; strcpy(data->slider.label, "1 Sec");
} else if (divisor < 4) {
data->dropdown.value = 1;
} else if (divisor < 8) {
data->dropdown.value = 2;
} else if (divisor < 16) {
data->dropdown.value = 3;
} else { } else {
data->dropdown.value = 4; sprintf(data->slider.label, "1/%d Secs", data->slider.value + 1);
} }
} }
@@ -1049,14 +1033,6 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0, 0,
menuhandlerResolution, menuhandlerResolution,
}, },
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Texture Filtering",
0,
menuhandlerTexFilter,
},
{ {
MENUITEMTYPE_CHECKBOX, MENUITEMTYPE_CHECKBOX,
0, 0,
@@ -1073,6 +1049,22 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0, 0,
menuhandlerCenterWindow, menuhandlerCenterWindow,
}, },
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"HUD Centering",
0,
menuhandlerCenterHUD,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{ {
MENUITEMTYPE_DROPDOWN, MENUITEMTYPE_DROPDOWN,
0, 0,
@@ -1098,21 +1090,53 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
menuhandlerDisplayFPS, menuhandlerDisplayFPS,
}, },
{ {
MENUITEMTYPE_DROPDOWN, MENUITEMTYPE_SLIDER,
0, 0,
MENUITEMFLAG_LITERAL_TEXT, MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_SLIDER_WIDE,
(uintptr_t)"Display FPS Interval", (uintptr_t)"Display FPS Interval",
0, 31,
menuhandlerDisplayFPSInterval, menuhandlerDisplayFPSInterval,
}, },
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{ {
MENUITEMTYPE_DROPDOWN, MENUITEMTYPE_DROPDOWN,
0, 0,
MENUITEMFLAG_LITERAL_TEXT, MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Anti-aliasing (MSAA)", (uintptr_t)"Anti-aliasing",
0, 0,
menuhandlerMSAA, menuhandlerMSAA,
}, },
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Texture Filtering",
0,
menuhandlerTexFilter,
},
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"GUI Texture Filtering",
0,
menuhandlerTexFilter2D,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{ {
MENUITEMTYPE_CHECKBOX, MENUITEMTYPE_CHECKBOX,
0, 0,
@@ -1121,14 +1145,6 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0, 0,
menuhandlerTexDetail, menuhandlerTexDetail,
}, },
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"GUI Texture Filtering",
0,
menuhandlerTexFilter2D,
},
{ {
MENUITEMTYPE_CHECKBOX, MENUITEMTYPE_CHECKBOX,
0, 0,
@@ -1137,14 +1153,6 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0, 0,
menuhandlerGeMuzzleFlashes, menuhandlerGeMuzzleFlashes,
}, },
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"HUD Centering",
0,
menuhandlerCenterHUD,
},
{ {
MENUITEMTYPE_SLIDER, MENUITEMTYPE_SLIDER,
0, 0,
+2 -2
View File
@@ -42,7 +42,7 @@ static s32 vidVsync = 1;
static s32 vidMSAA = 1; static s32 vidMSAA = 1;
static s32 vidFramerateLimit = 0; static s32 vidFramerateLimit = 0;
static s32 vidDisplayFPS = 0; static s32 vidDisplayFPS = 0;
static s32 vidDisplayFPSDivisor = 8; static s32 vidDisplayFPSDivisor = 16;
static displaymode vidModeDefault; static displaymode vidModeDefault;
static s32 vidNumModes = 1; static s32 vidNumModes = 1;
static displaymode *vidModes = &vidModeDefault; static displaymode *vidModes = &vidModeDefault;
@@ -529,7 +529,7 @@ PD_CONSTRUCTOR static void videoConfigInit(void)
configRegisterInt("Video.FramebufferEffects", &vidFramebuffers, 0, 1); configRegisterInt("Video.FramebufferEffects", &vidFramebuffers, 0, 1);
configRegisterInt("Video.FramerateLimit", &vidFramerateLimit, 0, VIDEO_MAX_FPS); configRegisterInt("Video.FramerateLimit", &vidFramerateLimit, 0, VIDEO_MAX_FPS);
configRegisterInt("Video.DisplayFPS", &vidDisplayFPS, 0, 1); configRegisterInt("Video.DisplayFPS", &vidDisplayFPS, 0, 1);
configRegisterInt("Video.DisplayFPSDivisor", &vidDisplayFPSDivisor, 1, 16); configRegisterInt("Video.DisplayFPSDivisor", &vidDisplayFPSDivisor, 1, 32);
configRegisterInt("Video.MSAA", &vidMSAA, 1, 16); configRegisterInt("Video.MSAA", &vidMSAA, 1, 16);
configRegisterInt("Video.TextureFilter", &texFilter, 0, 2); configRegisterInt("Video.TextureFilter", &texFilter, 0, 2);
configRegisterInt("Video.TextureFilter2D", &texFilter2D, 0, 1); configRegisterInt("Video.TextureFilter2D", &texFilter2D, 0, 1);