Skip to content

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

Open
Gitez-Spaghetti wants to merge 7 commits into
patchzyy:mainfrom
Gitez-Spaghetti:main
Open

Gitez-Spaghetti wants to merge 7 commits into
patchzyy:mainfrom
Gitez-Spaghetti:main

Conversation

@Gitez-Spaghetti

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

Copy link
Copy Markdown

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 advertised aspect ratio: 16:9 or 4:3.
    • Added a separate “Force aspect ratio” toggle, allowing the selected ratio to be applied to the display.
    • Updated window sizing and display scaling to reflect the selected aspect ratio and force 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: 9759eba6-2356-44c4-86af-a33a43f324bf
📥 Commits

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

📒 Files selected for processing: 7
  • 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

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

📝 Walkthrough

The change separates the advertised aspect ratio from forced aspect behavior. It updates configuration, dynamic aspect calculations and policy, runtime setup, the HLE aspect query, and graphics settings.

Changes: Aspect ratio behavior

Layer / File(s) Summary
Aspect configuration contracts and persistence
runtime/include/aurora_events.h, runtime/include/runtime_config.h
Configuration now stores and parses advertised_aspect_ratio and force_aspect. The dynamic-aspect API and force-aspect accessors use general names.
Reference-based aspect calculations
runtime/src/hle/gx/gx_dynamic_aspect.h, runtime/src/dynamic_aspect.cpp
Aspect calculation overloads use a supplied reference aspect. Egg screen records use that reference for width and vertical expansion.
Dynamic aspect policy and runtime integration
runtime/src/dynamic_aspect.cpp, runtime/src/main.cpp, runtime/src/hle/sc.cpp
Dynamic aspect handling applies forced 4:3 or 16:9 policy. Runtime setup and the HLE aspect query use the advertised ratio and force-aspect setting.
Graphics settings controls
runtime/src/settings_overlay.cpp
The graphics settings provide a persisted 16:9 or 4:3 advertised-ratio choice and a separate force-aspect toggle.

Priority: ➖ Normal

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant SettingsOverlay
  participant RuntimeConfigFile
  participant DynamicAspect
  participant ViewportAndVI
  SettingsOverlay->>RuntimeConfigFile: Persist force-aspect setting
  SettingsOverlay->>DynamicAspect: SetMkwForceAspect
  DynamicAspect->>ViewportAndVI: Apply viewport and VI policy
Loading

Suggested reviewers: patchzyy

Merge Risk: ⚪ Minimal · up to d3153

No actionable merge-blocking issue remains. The identified diagnostic discrepancy does not affect the displayed aspect ratio.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 29.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 7 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 "[Feature] Add aspect ratio selector for non-widescreen monitors" matches the main change in the objectives. PR #339 adds an F10 menu selector for choosing 16:9 or 4:3 on non-widescreen moni…
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.
Full details: Title check

Explanation

The title "[Feature] Add aspect ratio selector for non-widescreen monitors" matches the main change in the objectives. PR #339 adds an F10 menu selector for choosing 16:9 or 4:3 on non-widescreen monitors, applied on the next launch. The raw summary shows the supporting changes: the advertised aspect ratio setting in runtime_config.h, the new Graphics settings control in settings_overlay.cpp, and the related dynamic aspect and window sizing updates. The title omits the force_16_9 to force_aspect rename and the removal of the older force-16:9 path. Those are secondary to the title's main point.

✨ 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
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
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
Author

Current implementation with widescreen off (black bars):
image

Current implementation with widescreen on:
image

pr2.mp4

What my PR achieves:
image

pr.mp4

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