libretro / libretro/libretro-common

Screen scaling proposal (RFC)

Open
#165 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
180
Forks
98
Avg merge
7h 16m
Merged PRs (30d)
1

Description

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

  • Is rendered a good word for it? Maybe screen, window... the values can be overridden, and the doc comments should reflect that.
  • Would it be better to tackle #41 first? I don't think so.
  • Does this make the existing core options for resolution (and possibly aspect ratio) pointless? The frontend would be able to provide it, and emulators can set a core option for the native resolution if necessary.
  • Should we concern about rotation? I don't think so if the core needs to set it, and if RetroArch's Aspect Ratio override doesn't care either.
  • What settings would RetroArch have to override this? Can we use the Aspect Ratio setting, or do we need a new one? The setting for resolution could have values like Window Height (default), Window Height / 2, Core provided (would give NULL making it up to the core to figure it out, like by giving a native resolution).
  • Is the formatting in my proposed definitions correct? Does the explanation for the aspect ratio command suffice?
  • Do we need some sort of callback for when the window size changes? Or does it suffice to check if the current size is different from the previous... or something. Something convenient.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed RETRO_ENVIRONMENT_GET_RENDERED_HEIGHT and RETRO_ENVIRONMENT_GET_RENDERED_ASPECT_RATIO definitions in the issue. Resolve the naming, override semantics, rotation, window-size change handling, and interaction with existing resolution and aspect-ratio settings. Done means the API design and frontend/core responsibilities are agreed and the definitions are ready for implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.