Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanvb committed Jun 16, 2024
1 parent 01eab85 commit 190600e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
5 changes: 3 additions & 2 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,8 +1214,9 @@ bool video_display_server_has_refresh_rate(float hz)

for (i = 0; i < size && !rate_exists; i++)
{
if ( (video_list[i].width == video_driver_width)
&& (video_list[i].height == video_driver_height)
/* Float difference added to recognize 49.95Hz modelines for PAL */
if ( (video_list[i].width == video_driver_width)
&& (video_list[i].height == video_driver_height)
&& ((video_list[i].refreshrate == floor(hz)) ||
(video_list[i].refreshrate_float - hz < 0.06f)))
rate_exists = true;
Expand Down
9 changes: 5 additions & 4 deletions menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#include <math.h>
#include <compat/strl.h>
#include <array/rbuf.h>
#include <file/file_path.h>
Expand Down Expand Up @@ -6960,7 +6961,7 @@ int action_cb_push_dropdown_item_resolution(const char *path,
char *pch = NULL;
unsigned width = 0;
unsigned height = 0;
unsigned refreshrate = 0;
float refreshrate = 0.0f;

strlcpy(str, path, sizeof(str));
pch = strtok(str, "x");
Expand All @@ -6971,10 +6972,10 @@ int action_cb_push_dropdown_item_resolution(const char *path,
height = (unsigned)strtoul(pch, NULL, 0);
pch = strtok(NULL, "(");
if (pch)
refreshrate = (unsigned)strtoul(pch, NULL, 0);
refreshrate = (float)strtod(pch, NULL);

if (video_display_server_set_resolution(width, height,
refreshrate, (float)refreshrate, 0, 0, 0, 0))
floor(refreshrate), refreshrate, 0, 0, 0, 0))
{
settings_t *settings = config_get_ptr();
#ifdef _MSC_VER
Expand All @@ -6984,7 +6985,7 @@ int action_cb_push_dropdown_item_resolution(const char *path,
unsigned refresh_mod = (unsigned)lroundf((float)(refreshrate / 60.0f));
#endif
float refresh_exact = refreshrate;

/* TODO: what is going on here */
/* 59 Hz is an inaccurate representation of the real value (59.94).
* And since we at this point only have the integer to work with,
* the exact float needs to be calculated for 'video_refresh_rate' */
Expand Down
14 changes: 7 additions & 7 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -8351,18 +8351,18 @@ unsigned menu_displaylist_build_list(
{
char val_d[256], str[256];
if (video_list[i].refreshrate_float > 0.0f)
snprintf(str, sizeof(str), "%dx%d%s%s (%.2f Hz)",
snprintf(str, sizeof(str), "%dx%d (%.3f Hz)%s%s",
video_list[i].width,
video_list[i].height,
video_list[i].interlaced ? "i":"",
video_list[i].dblscan ? "d":"",
video_list[i].refreshrate_float);
video_list[i].refreshrate_float,
video_list[i].interlaced ? "[i]":"",
video_list[i].dblscan ? "[d]":"");
else
snprintf(str, sizeof(str), "%dx%d%s (%d Hz)",
snprintf(str, sizeof(str), "%dx%d (%d Hz)%s",
video_list[i].width,
video_list[i].height,
video_list[i].interlaced ? "i":"",
video_list[i].refreshrate);
video_list[i].refreshrate,
video_list[i].interlaced ? "[i]":"");
snprintf(val_d, sizeof(val_d), "%d", i);
if (menu_entries_append(list,
str,
Expand Down

0 comments on commit 190600e

Please sign in to comment.