RetroArch and refresh rates in identical resolutions

How does RetroArch decide which modeline it will use if a fullscreen resolution is specified in the config file, but the system has several refresh rates associated with that resolution? Is there any way to force a specific refresh rate?

To be more specific about my particular situation, I am currently using a CRT monitor with RetroArch on Windows 7 64-bit. I was using the Mupen64Plus core at 1280x960@60Hz, since that is what I was using on the desktop, and it worked great. However, I later on added a new 1280x960@70Hz modeline for use on general desktop stuff, since 60Hz is a bit tiring for browsing and such. The issue now is, when running RetroArch at 1280x960, if the monitor was running at 70Hz prior to running RetroArch, RetroArch will then run at 70Hz as well, which results in some judder in games. The video_refresh_rate setting in the config file does not seem to matter for this purpose. In order to make it work at 60Hz, prior to running RetroArch, I either have to lower the refresh rate manually to 60Hz, or switch to another resolution entirely. Otherwise it starts up at 70Hz.

Ideally, I’d like to be able to keep the monitor running at 1280x960@70Hz at all times, then have RetroArch automatically switch down to 60Hz.

AFAIK, RetroArch always tries to sync to your current refresh rate. I don’t know that there’s much to be done about that. Perhaps maister or Squarepusher can chime in if I’m mistaken.

KMS mode does try to match your video_refresh_setting (as long as you have specified a resolution). X11 and WGL do not try to do it atm. For X11, see get_video_mode and x11_enter_fullscreen in gfx/context/x11_common.c. Not quite sure how to do it on Windows. The WGL context driver uses ChangeDisplaySettingsEX().

I know this is an old thread, but I thought about this issue today so I did some research on how to make this work.

I was able to come up with this solution.

Turns out all that was needed was to pass a rounded video.refresh_rate value into devmode.dmDisplayFrequency and that appears to make it select the correct video mode.

I simply referred to this documentation for ChangeDisplaySettingsEx() https://msdn.microsoft.com/en-us/library/windows/desktop/dd183413(v=vs.85).aspx