libretro / libretro-common

Reusable coding blocks useful for libretro core and frontend development, written primarily in C. Permissively licensed.
140 stars 74 forks source link

Screen scaling proposal (RFC) #165

Open anyputer opened 4 years ago

anyputer commented 4 years ago

Proposal

It would be great if we had two new environment commands: RETRO_ENVIRONMENT_GET_RENDERED_HEIGHT and RETRO_ENVIRONMENT_GET_RENDERED_ASPECT_RATIO. These would allow hardware rendered cores like N64, PlayStation, Wii emulators to output at the window's resolution! Owners of ultrawide, ultra HD monitors get to use the aspect ratio and/or resolutions of their amazing screens. Standalone emulators have these features and they're missing in RetroArch.

RETRO_ENVIRONMENT_GET_RENDERED_HEIGHT - Gets the window height that can be overridden by the frontend RETRO_ENVIRONMENT_GET_RENDERED_ASPECT_RATIO - Gets the aspect ratio of the window that can be overridden by the frontend

Examples

ParaLLEl N64 can have a resolution option: "Auto" to render at the frontend-provided resolution. It would calculate the width based on the height and aspect ratio of the game. Dolphin has options to render at a custom aspect ratio and pixel height in the standalone emulator. In this case the core can have "Auto" core options for resolution and aspect ratio.

Proposed Definitions

#define RETRO_ENVIRONMENT_GET_RENDERED_HEIGHT (61 | RETRO_ENVIRONMENT_EXPERIMENTAL)
                                            /* unsigned * --
                                            * Integer value that lets us know the height of the window.
                                            *
                                            * The returned value can be used by cores to automatically
                                            * scale the resolution how it sees fit.
                                            *
                                            * The returned value can be NULL. In this case the core should
                                            * use a sane default (i.e. native resolution in an emulator).
                                            *
                                            * A frontend could override this if desired.
                                            */
#define RETRO_ENVIRONMENT_GET_RENDERED_ASPECT_RATIO (62 | RETRO_ENVIRONMENT_EXPERIMENTAL)
                                            /* float * --
                                            * Float value that lets us know the aspect ratio of the window.
                                            *
                                            * The returned value can be used by cores as a suggestion
                                            * for scaling.
                                            *
                                            * The returned value can be NULL.
                                            *
                                            * A frontend could override this if desired.
                                            */

Unresolved Questions

anyputer commented 4 years ago

...what happens when the window height is greater than the width this is flawed