Skip to content

Commit

Permalink
Rearrange the menu, clean up, and change some things
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithMDC committed Dec 1, 2024
1 parent f4bbd98 commit d3d6787
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 64 deletions.
132 changes: 70 additions & 62 deletions port/src/optionsmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,16 +741,16 @@ static MenuItemHandlerResult menuhandlerVsync(s32 operation, struct menuitem *it
static const char *opts[] = {
"Adaptive",
"Off",
"On (Sync Every Frame)",
"On (Sync Every 2 Frames)",
"On (Sync Every 3 Frames)",
"On (Sync Every 4 Frames)",
"On (Sync Every 5 Frames)",
"On (Sync Every 6 Frames)",
"On (Sync Every 7 Frames)",
"On (Sync Every 8 Frames)",
"On (Sync Every 9 Frames)",
"On (Sync Every 10 Frames)"
"On (Every Frame)",
"On (Every 2 Frames)",
"On (Every 3 Frames)",
"On (Every 4 Frames)",
"On (Every 5 Frames)",
"On (Every 6 Frames)",
"On (Every 7 Frames)",
"On (Every 8 Frames)",
"On (Every 9 Frames)",
"On (Every 10 Frames)"
};

switch (operation) {
Expand Down Expand Up @@ -781,10 +781,12 @@ static MenuItemHandlerResult menuhandlerFramerateLimit(s32 operation, struct men
videoSetFramerateLimit(data->slider.value);
break;
case MENUOP_GETSLIDERLABEL:
// NOTE: data->slider.label length must not exceed 15.
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;
Expand All @@ -795,10 +797,10 @@ static MenuItemHandlerResult menuhandlerMSAA(s32 operation, struct menuitem *ite
s32 msaa;
static const char *opts[] = {
"Off",
"2x",
"4x",
"8x",
"16x"
"2x (MSAA)",
"4x (MSAA)",
"8x (MSAA)",
"16x (MSAA)"
};

switch (operation) {
Expand Down Expand Up @@ -919,44 +921,26 @@ static MenuItemHandlerResult menuhandlerDisplayFPS(s32 operation, struct menuite
return videoGetDisplayFPS();
case MENUOP_SET:
videoSetDisplayFPS(data->checkbox.value);
break;
}

return 0;
}

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) {
case MENUOP_GETOPTIONCOUNT:
data->dropdown.value = ARRAYCOUNT(opts);
case MENUOP_GETSLIDER:
data->slider.value = videoGetDisplayFPSDivisor() - 1;
break;
case MENUOP_GETOPTIONTEXT:
return (intptr_t)opts[data->dropdown.value];
case MENUOP_SET:
videoSetDisplayFPSDivisor(1 << data->dropdown.value);
videoSetDisplayFPSDivisor(data->dropdown.value + 1);
break;
case MENUOP_GETSELECTEDINDEX:
divisor = videoGetDisplayFPSDivisor();
if (divisor < 2) {
data->dropdown.value = 0;
} else if (divisor < 4) {
data->dropdown.value = 1;
} else if (divisor < 8) {
data->dropdown.value = 2;
} else if (divisor < 16) {
data->dropdown.value = 3;
case MENUOP_GETSLIDERLABEL:
// NOTE: data->slider.label length must not exceed 15.
if (data->slider.value == 0) {
strcpy(data->slider.label, "1 Sec");
} else {
data->dropdown.value = 4;
sprintf(data->slider.label, "1/%d Secs", data->slider.value + 1);
}
}

Expand Down Expand Up @@ -1049,14 +1033,6 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0,
menuhandlerResolution,
},
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Texture Filtering",
0,
menuhandlerTexFilter,
},
{
MENUITEMTYPE_CHECKBOX,
0,
Expand All @@ -1073,6 +1049,22 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0,
menuhandlerCenterWindow,
},
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"HUD Centering",
0,
menuhandlerCenterHUD,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{
MENUITEMTYPE_DROPDOWN,
0,
Expand All @@ -1098,28 +1090,36 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
menuhandlerDisplayFPS,
},
{
MENUITEMTYPE_DROPDOWN,
MENUITEMTYPE_SLIDER,
0,
MENUITEMFLAG_LITERAL_TEXT,
MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_SLIDER_WIDE,
(uintptr_t)"Display FPS Interval",
0,
31,
menuhandlerDisplayFPSInterval,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Anti-aliasing (MSAA)",
(uintptr_t)"Anti-aliasing",
0,
menuhandlerMSAA,
},
{
MENUITEMTYPE_CHECKBOX,
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Detail Textures",
(uintptr_t)"Texture Filtering",
0,
menuhandlerTexDetail,
menuhandlerTexFilter,
},
{
MENUITEMTYPE_CHECKBOX,
Expand All @@ -1129,21 +1129,29 @@ struct menuitem g_ExtendedVideoMenuItems[] = {
0,
menuhandlerTexFilter2D,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"GE64-style Muzzle Flashes",
(uintptr_t)"Detail Textures",
0,
menuhandlerGeMuzzleFlashes,
menuhandlerTexDetail,
},
{
MENUITEMTYPE_DROPDOWN,
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"HUD Centering",
(uintptr_t)"GE64-style Muzzle Flashes",
0,
menuhandlerCenterHUD,
menuhandlerGeMuzzleFlashes,
},
{
MENUITEMTYPE_SLIDER,
Expand Down
4 changes: 2 additions & 2 deletions port/src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static s32 vidVsync = 1;
static s32 vidMSAA = 1;
static s32 vidFramerateLimit = 0;
static s32 vidDisplayFPS = 0;
static s32 vidDisplayFPSDivisor = 8;
static s32 vidDisplayFPSDivisor = 16;
static displaymode vidModeDefault;
static s32 vidNumModes = 1;
static displaymode *vidModes = &vidModeDefault;
Expand Down Expand Up @@ -529,7 +529,7 @@ PD_CONSTRUCTOR static void videoConfigInit(void)
configRegisterInt("Video.FramebufferEffects", &vidFramebuffers, 0, 1);
configRegisterInt("Video.FramerateLimit", &vidFramerateLimit, 0, VIDEO_MAX_FPS);
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.TextureFilter", &texFilter, 0, 2);
configRegisterInt("Video.TextureFilter2D", &texFilter2D, 0, 1);
Expand Down

0 comments on commit d3d6787

Please sign in to comment.