mirror of https://github.com/snes9xgit/snes9x.git
Sanity check automatic input rate for deviations > 5%.
This commit is contained in:
parent
0f41b70324
commit
692c8f58b7
|
@ -1620,7 +1620,14 @@ Snes9xWindow::get_refresh_rate (void)
|
|||
int
|
||||
Snes9xWindow::get_auto_input_rate (void)
|
||||
{
|
||||
return (int) (get_refresh_rate () * 32040.0 / 60.09881389744051 + 0.5);
|
||||
double new_input_rate = get_refresh_rate () * 32040.0 / 60.09881389744051 + 0.5;
|
||||
|
||||
if (new_input_rate > 32040.0 * 1.05)
|
||||
new_input_rate = 32040.0;
|
||||
if (new_input_rate < 32040.0 * 0.95)
|
||||
new_input_rate = 32040.0 * 0.95;
|
||||
|
||||
return new_input_rate;
|
||||
}
|
||||
|
||||
static void set_bypass_compositor (Display *dpy, Window window, unsigned char bypass)
|
||||
|
|
|
@ -752,7 +752,14 @@ double WinGetRefreshRate(void)
|
|||
|
||||
int WinGetAutomaticInputRate(void)
|
||||
{
|
||||
return (int)(WinGetRefreshRate() * 32040.0 / 60.09881389744051 + 0.5);
|
||||
double newInputRate = WinGetRefreshRate() * 32040.0 / 60.09881389744051 + 0.5;
|
||||
|
||||
if (newInputRate > 32040.0 * 1.05)
|
||||
newInputRate = 32040.0;
|
||||
if (newInputRate < 32040.0 * 0.95)
|
||||
newInputRate = 32040.0 * 0.95;
|
||||
|
||||
return newInputRate;
|
||||
}
|
||||
|
||||
/* Depth conversion functions begin */
|
||||
|
|
Loading…
Reference in New Issue