libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.34k stars 1.84k forks source link

Request: SwitchRes "integration" #692

Closed hunterk closed 9 years ago

hunterk commented 10 years ago

Background: There's a request on the forum to integrate the SwitchRes utility (available here: http://forum.arcadecontrols.com/index.php/topic,106405.1280.html ; the sourceforge repo is years out of date, apparently) into RetroArch. It is generally used with MAME (see: GroovyMAME) and, as such, has a lot of MAME-isms baked in, which aren't really appropriate for RetroArch. However, it also has a standalone utility that creates modelines (and adds them to xorg.conf) and EDIDs, which one should then be able to utilize with the video_fullscreen_x/y cfg options you added last month to manually adjust a CRT monitor's actual resolution to match the native resolution of a core.

Request: It would be nice to have this occur automatically on content load--perhaps with a CLI switch--particularly for arcade games, which need different resolutions per-game rather than per-core.

So, it would work like this: you would launch with --switchres (or whatever) and then loading content from RGUI would try to set the fullscreen resolution to match the content's self-reported native res.

Conversely, SwitchRes seems able to leverage xrandr (and powerstrip on Windows) to change resolutions on its own, so perhaps another option would be to just feed the content's native res out to the utility and let it do the heavy lifting.

Thoughts?

Themaister commented 10 years ago

I'm not going to bake in a lot of code like this. If it can be cleanly called as an external process, it might be feasible. Can you really change xorg.conf on the fly while Xorg is running?

hunterk commented 10 years ago

Yeah, I didn't think baking-in would be feasible/desirable, unless at most it was the 'calculate' bit and whatever comes along with that, but I don't really see even that as necessary, since the SwitchRes utility seems perfectly capable of doing that itself. AFAICT, the modeline stuff gets added to xorg.conf once and then it's there for future use (after restarting the service, etc.).

So, in my mockup example, a user would have already used switchres standalone to add all of the potential resolutions to xorg.conf and then RA would just try to set the fullscreen res to match the game. If the appropriate modeline is present (or one close, i guess), the res should switch to match. That would work for KMS, at least, I think, though in X you would presumably need to invoke xrandr (either directly or through SwitchRes itself) to do the on-the-fly switching.

Themaister commented 10 years ago

This is not a feature I really care about, nor am I able to test it, but I can look at proof-of-concepts for X at least. Doesn't have to be pretty. gfx/context/glx_ctx.c is probably where to do it.

hunterk commented 10 years ago

K, sounds good. I'll see what I can come up with.