#2673·Provenance

[EPIC] Screen Scaling and Aspect Ratio Standardization Across All Cores

Author: github-actions[bot]Created Mar 7, 2026Updated Apr 3, 2026
Labelsenhancementcheats

[EPIC] Screen Scaling & Aspect Ratio Standardization Across All Cores

Overview

This epic tracks the work needed to audit, standardize, and properly expose screen scaling and aspect ratio settings across all emulator cores in Provenance. Currently, the implementation is inconsistent: some cores have per-core options, others rely on global settings, and some have hardcoded behavior.

Relates to: #1917


Current State Audit

Global Settings (PVSettings)

  • nativeScaleEnabled — toggles native vs. window-fit scaling (both GL and Metal renderers)
  • integerScaleEnabled — toggles integer/pixel-perfect scaling (both GL and Metal renderers)
  • imageSmoothing — bilinear smoothing toggle

These are applied in PVGLViewController and PVMetalViewController and affect all cores uniformly.

Per-Core Implementations Found

Core Per-Core Option Notes
PPSSPP stretchDisplayOption (bool), texture upscale (1x-5x) Has its own stretch toggle
Dolphin aspectRatioOption (Auto/4:3/16:9/Stretch) Full aspect ratio enum
Flycast widescreen_cheats, widescreen_hack RetroArch-style options
Gearcoleco aspect_ratio (1:1 PAR / 4:3 DAR / 16:9 DAR) RetroArch-style options
Mupen64Plus Uses integerScaleEnabled global + per-core logic Partial integration
Mupen64Plus-NX Uses integerScaleEnabled global Partial integration
DuckStation Has gpu_widescreen_hack — commented out Widescreen not exposed
Genesis Plus GX Hardcoded aspect sizes (292x224, 256x192, etc.) No user control
Reicast/Dreamcast Returns raw videoWidth x videoHeight as aspect No 16:9 option exposed
Mednafen Has options file but no widescreen/aspect option Needs audit
melonDS Has options file Needs audit (dual-screen layout)
emuThree (3DS) Has options file Needs audit
Azahar (3DS/Citra) Has options file Needs audit
mGBA No per-core aspect option Relies on global
FCEU (NES) No per-core aspect option Relies on global
Stella (Atari 2600) No per-core aspect option Relies on global

Renderer Behavior (PVGLViewController / PVMetalViewController)

  • Native Scale: renders at emulator's aspectSize, no upscaling
  • Integer Scale: snaps to nearest integer multiple of the emulator's output dimensions
  • Default (neither): scales to fill the view while maintaining aspect ratio
  • No "stretch to fill" (ignore aspect ratio) option at the global level

Problems to Solve

  1. No global stretch/fill option — Users cannot globally choose to stretch all cores to fill the screen (some want this for handheld games on iPad)
  2. Inconsistent per-core aspect options — Some cores expose widescreen hacks (Flycast, Dolphin, PPSSPP), others have commented-out code (DuckStation), others have no option at all
  3. Global settings not respected by all cores — Mupen64Plus partially uses global scale settings but handles them inconsistently; other cores ignore them entirely
  4. No standardized aspectRatioMode model — Each core that has an option invents its own enum/bool, making it impossible to apply consistent behavior across the board
  5. ScreenType protocol commented out — EmulatorCoreIOInterface has screenType commented out, suggesting an incomplete previous attempt at standardization
  6. No per-system overrides — Users cannot say "always stretch SNES" while keeping "native scale for GBA"

Proposed Solution

Phase 1 — Global Scaling Mode Enum

Replace the pair of booleans (nativeScaleEnabled + integerScaleEnabled) with a single ScalingMode enum:

swift
public enum ScalingMode: String, CaseIterable {
    case aspectFit        // Current default: fit within bounds, maintain AR
    case aspectFill       // Stretch to fill, maintain AR (may crop)
    case stretch          // Stretch to fill completely, ignore AR
    case nativeResolution // Display at emulator's native pixel resolution
    case integerScale     // Nearest integer multiple of native resolution
}

Keep the existing booleans as computed shims for backwards compatibility.

Phase 2 — Standardized AspectRatioOverride Per Core

Add an optional AspectRatioOverride to the core options protocol so each core can declare what overrides it supports:

swift
public enum AspectRatioOverride: String, CaseIterable {
    case auto       // Core decides
    case ratio_4_3  // Force 4:3
    case ratio_16_9 // Force 16:9 (widescreen)
    case ratio_1_1  // Pixel-perfect square pixels
    case stretch    // Stretch to fill
}

Phase 3 — Core-by-Core Audit & Implementation

For each core, audit and implement:

  • Expose widescreen/aspect options where the emulator supports it
  • Wire global ScalingMode into the renderer for cores that rely on the renderer
  • Remove hardcoded aspect sizes where inappropriate
  • Un-comment or properly implement disabled widescreen hacks (DuckStation, etc.)

Phase 4 — Per-System Settings Override

Allow users to override the global scaling mode per system (stored in PVSystem or UserDefaults keyed by system identifier).

Phase 5 — UI/UX

  • Expose the new ScalingMode picker in global video settings
  • Expose per-core aspect ratio options in the core options UI
  • Show per-system scaling override in system settings

Sub-Tasks

  • #A — Design and implement ScalingMode enum to replace nativeScale+integerScale booleans (PVSettings, PVGLViewController, PVMetalViewController)
  • #B — Audit and fix Reicast/Flycast widescreen: expose flycast_widescreen_hack properly through CoreOptions UI
  • #C — Audit and fix DuckStation: un-comment and expose gpu_widescreen_hack via CoreOptions
  • #D — Audit and fix Mednafen: add aspect ratio options for PSX, PCE, SNES, etc.
  • #E — Audit Genesis Plus GX: make hardcoded aspect sizes configurable
  • #F — Standardize Mupen64Plus / Mupen64Plus-NX global scale integration
  • #G — Audit melonDS, emuThree, Azahar for dual-screen layout and aspect options
  • #H — Add per-system scaling override to PVLibrary/PVSettings
  • #I — UI: expose ScalingMode picker and per-system override in settings views

Acceptance Criteria

  • All cores correctly respect the global ScalingMode setting via the renderer
  • Cores that support widescreen/aspect hacks expose them as discoverable CoreOptions
  • No core hardcodes aspect ratio without justification
  • A user can choose between Aspect Fit, Integer Scale, Native Resolution, and Stretch globally
  • A user can override scaling mode per system
  • Existing user preferences are migrated without data loss

Labels

epic enhancement video scaling aspect-ratio

Source: Provenance-Emu/Provenance