Skip to content

[Feature] Add aspect ratio selector for non-widescreen monitors - #339

Merged
patchzyy merged 10 commits into
patchzyy:mainfrom
Gitez-Spaghetti:main
Oct 26, 2026
Merged

patchzyy merged 10 commits into
patchzyy:mainfrom
Gitez-Spaghetti:main

Conversation

@Gitez-Spaghetti

@Gitez-Spaghetti Gitez-Spaghetti commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Currently, the game doesn’t display properly on 4:3 or 5:4 monitors, since it is always rendered at 16:9.

This PR adds an aspect ratio selector to the F10 menu, which is applied on the next launch.

I also renamed the force_16_9 option to force_aspect, since it now forces the currently selected aspect ratio rather than 16:9.

Feedback is more than welcome!

Summary by CodeRabbit

  • New Features
    • Added a graphics setting to choose the preferred aspect ratio: 16:9 or 4:3.
    • Added a separate “Force aspect ratio” toggle to preserve the selected ratio, using black bars when needed.
    • Updated window sizing and display scaling to reflect the selected ratio and force setting.
  • Bug Fixes
    • Preserved existing force-16:9 settings when loading older configurations and migrated them to the updated setting.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f5098707-290b-4ace-81a3-0fb9beb46b48
Commits

Reviewing files that changed from the base of the PR and between d31531a and e443414.

Files selected for processing: 8
  • runtime/include/aurora_events.h
  • runtime/include/runtime_config.h
  • runtime/src/dynamic_aspect.cpp
  • runtime/src/hle/gx/gx_dynamic_aspect.h
  • runtime/src/hle/sc.cpp
  • runtime/src/main.cpp
  • runtime/src/settings_overlay.cpp
  • runtime/tests/runtime_config_tests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

The change separates the widescreen preference from forced aspect behavior. It updates configuration and legacy migration, aspect calculations and runtime policy, the HLE aspect query, and graphics settings.

Changes: Aspect ratio behavior

Layer / File(s) Summary
Aspect configuration and graphics settings
runtime/include/runtime_config.h, runtime/include/aurora_events.h, runtime/src/settings_overlay.cpp, runtime/tests/runtime_config_tests.cpp
Configuration reads force_aspect and falls back to force_16_9 when the new key is absent. The graphics settings provide a 16:9 or 4:3 selector and a separate force-aspect control. Tests cover legacy-key parsing.
Reference-based aspect calculations
runtime/src/hle/gx/gx_dynamic_aspect.h, runtime/src/dynamic_aspect.cpp
Aspect calculations accept a reference aspect. Egg screen records use the selected reference aspect to calculate widths and vertical expansion.
Dynamic policy and runtime integration
runtime/src/dynamic_aspect.cpp, runtime/src/main.cpp, runtime/src/hle/sc.cpp
Runtime setup migrates the legacy setting and passes the force-aspect value to dynamic aspect configuration. Dynamic aspect handling applies forced 4:3 or 16:9 policy. The HLE aspect query reflects the widescreen setting.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant RuntimeMain
  participant DynamicAspect
  participant ViewportAndVI
  RuntimeMain->>DynamicAspect: Configure widescreen and force-aspect values
  DynamicAspect->>ViewportAndVI: Apply viewport and VI policy
Loading

Suggested reviewers: patchzyy

Merge Risk: Minimal · up to e4434

No issue identified here prevents merging the aspect-ratio selector after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding an aspect ratio selector for non-widescreen monitors.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@patchzyy

Copy link
Copy Markdown
Owner

This pr seems unneeded
in config.toml set:

[video]
widescreen = false
force_16_9 = false

And your game will launch in 4:3 mode + will widen up for 5:4 monitors
let me know if im missing something but this should be enough to give you what you want already

@Gitez-Spaghetti

Copy link
Copy Markdown
Contributor Author

Can't believed I missed the widescreen setting, despite being at the top of the RuntimeUserConfig struct... that's embarrassing...

After trying your provided settings, the viewport stays 4:3 and doesn't widen up. (see the black bars at the top and bottom of the frame on my 5:4 display)

image

On top of that, if force 16:9 is enabled while widescreen is off, the screen get squished.

While I should probably rework this and clean things up (again), I still think that this pr is relevant. Not only does it allows the player to easily choose the aspect ratio, this version scales the viewport properly regardless of the aspect ratio, while still allowing the user to lock the viewport size if they want.

Maybe I'm missing something too, please let me know if this is the case.

@patchzyy

Copy link
Copy Markdown
Owner

I would much rather have the 4:3 option to also dynamically scale similarly to the 16:9 option, would be significanly less code, and also less options for the users which would be better in this case to make playing the game easier, having an aspect ratio selector would be useless if the game auto-scales to any resolution anyways

@Gitez-Spaghetti

Copy link
Copy Markdown
Contributor Author

This is exactly what this PR is about.

Unless something is wrong with my config, the current implementation only dynamically scale when widescreen is ON. When playing in 4:3 the game doesn't dynamically scale to the window's size.

My implementation allows the screen to fit the window regardless of the aspect ratio (exactly what you're asking) with an easy way to switch between 16:9 and 4:3.

When widescreen is on (but playing on a 5:4 monitor) the viewport does expand vertically, but the UI can be a bit tiny (on top of looking a bit odd).

About my messy code, I tried making other changes (like making the game switch aspect ratio on the fly) and failed, but the fondations are here for people who want to try implementing features on top of it.

When I'll get home I will take a few screenshots to demonstrate what I mean.

@Gitez-Spaghetti

Copy link
Copy Markdown
Contributor Author

Current implementation with widescreen off (black bars):
image

Current implementation with widescreen on:
image

pr2.mp4

What my PR achieves:
image

pr.mp4

@patchzyy
patchzyy merged commit af5a45e into patchzyy:main Oct 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants