Skip to content

libretro: fix uwp version, fix wrong version returned in retroarch - #416

Merged
warmenhoven merged 49 commits into
libretro:masterfrom
cscd98:uwp-fix
Mar 15, 2026
Merged

libretro: fix uwp version, fix wrong version returned in retroarch#416
warmenhoven merged 49 commits into
libretro:masterfrom
cscd98:uwp-fix

Conversation

@cscd98

@cscd98 cscd98 commented Mar 14, 2026

Copy link
Copy Markdown
Collaborator

Tested on Xbox Series X (UWP) and Windows 11 (none UWP)

Borrowed some code from https://github.com/SternXD/dolphin/

Also adds: option to set aspect ratio
Fixes: wrong git scm revision reported in retroarch. I previously merged in tag/2603.. so these commits have been previously applied git just doesn't think that is the case.

jordan-woyak and others added 30 commits January 17, 2026 17:19
…the internal frame rate.

The patches rearrange some branching to insert a call to VIWaitForRetrace in the main game loop.
This allows ImmediateXFB to work properly so it is no longer forced off by the game ini.
Add vertical padding between the performance graph (when it's enabled)
and the FPS/VPS/Speed overlays.
Fix a bug causing the performance graph to not resize when the render
window changed size:
* When changing the render window size during emulation the performance
  graph wouldn't update its size until the next emulation session.
* When changing the render window size with no emulation active (by
  changing the Internal Resolution with Auto-Adjust Window Size enabled)
  the performance graph wouldn't update its size until the second
  emulation session after the change.

Before explaining why the bug happened, here are some details about Dear
ImGui (henceforth ImGui) for context:
* In order to allow programs to specify initial ImGui window sizes while
  also allowing the user to resize them, `SetNextWindowSize` takes a
  flag from the `ImGuiCond_` enum specifying under what circumstances
  that function should actually have any effect.
* ImGuiCond_FirstUseEver causes ImGui to only apply the command when the
  window doesn't have any saved size information for that session or in
  the ini file specified by `ImGui::GetIO().IniFilename`. Since we set
  that filename to `nullptr`, in practice the resize command is applied
  on the first frame of each ImGui/emulation session.
* Qt saves the most recent size of the render window across emulation
  (and even Dolphin) sessions, which is then used to set the initial
  value of `ImGui::GetIO().DisplaySize` in the next emulation session.
* It takes multiple frames for the size of the render window to update
  when changed by setting the internal resolution. This means that
  `ImGui::GetIO().DisplaySize` will have a stale value in the
  intervening frames, and specifically for the first few frames of
  emulation if the resolution was changed beforehand.

When changing the resolution during emulation the call to
`SetNextWindowSize` had no effect because of the
`ImGuiCond_FirstUseEver` flag. `DisplaySize` would be updated several
frames later, and then the next emulation session would update the graph
size on its first frame.

When changing the resolution outside emulation and then starting a game,
the call to SetNextWindowSize on the first frame took effect but used
the stale value of `DisplaySize`. `DisplaySize` would be updated a few
frames later, but the graph wouldn't be resized until the first frame of
the second emulation session.

This commit fixes the issue by using the `ImGuiCond_Always` flag in the
performance graph's call to `SetNextWindowSize` when the render window
size changes.
Add a minimum value for the automatic size of the performance metrics
graph. The graph can still be manually resized smaller than this limit.

This prevents the graph from automatically resizing itself to be too
small to contain the full graph and legend, which happened when using
native resolution with `Auto-Adjust Window Size` enabled.
I've gone through all relevant settings for Rogue Squadron II and III
and overhauled their game INI files. Each setting is explained with a
comment.

Some settings I chose not to include:

* EFB to RAM only seems to affect certain fadeouts in Rogue Squadron II.
  Without it, the affected fadeouts are replaced by a pure black screen.
  I don't think this is important enough to warrant the performance hit.
* As I was unable to find anything Rogue Squadron III needs EFB to RAM
  for, I also didn't find anything it needs DeferEFBCopies disabled for.
* I didn't find anything EFBEmulateFormatChanges was needed for in
  either game.
* Enabling EFB access makes the ship engine glow visible in Rogue
  Squadron III, but this effect is minor enough that you probably won't
  notice it's missing unless you know it's supposed to be there. Since
  this is Dolphin's heaviest game, let's give users the choice.
* I was considering forcing XFB to RAM for Rogue Squadron III to make
  fadeouts render properly instead of going from magenta to black, since
  enabling XFB to RAM doesn't really hurt performance when you're
  already enabling EFB to RAM. But then I was unable to find a reason
  why we should enable EFB to RAM for this game.

Tested in RS2 and RS3. The RS3 demo disc settings are copied from the
RS3 settings and haven't been tested by me.
This PR provides formatting updates to Sonic Mega Collection.

All regions:
* Formatting fixes.
* Updated to follow my code naming convention for Sega games.
Set suggested aspect ratio to 4:3 due to dolphin incorrectly setting it to 16:9 automatically.

Apply suggestion from @jordan-woyak

Co-authored-by: Jordan Woyak <jordan.woyak@gmail.com>
Set suggested aspect ratio to 4:3 due to dolphin incorrectly setting it to 16:9 automatically.
Ensure the 3rd track is written even if the 2nd track isn't.
Moved GetHexDump helper function to StringUtil.
Notable changes:
- CMake
  - Fixed a bug where SDL couldn't use a vendored libusb or libhidapi (see 29b3fcf)
- Fixed long startup times on Windows when some non-compliant input devices are present
- Controller support
  - Added support for the Razer Raiju V5 Pro
  - Improved Switch 2 controller support
  - Improved NVIDIA SHIELD controller support
  - Fixed various controllers showing up twice on macOS
  - Fixed handling GameCube adapters in PC mode on Linux and macOS
GameSettings: Update Rogue Squadron II and III
Metal Arms and PoP Two Thrones aspect ratio setting fix
Default values for settings need to be the same in Kotlin and C++,
otherwise settings that haven't been changed by the user will be shown
as having one value in the Android GUI but treated as having a different
value in the core.
This is a very small libary, and as I understand it, it was more or less
developed for Dolphin.

This moves the two relevant files from Externals to Common, changes the
namespace to Common, reformats the code, and adds Dolphin copyright
notices. The change in copyright notice and license was approved by
AdmiralCurtiss.
This makes JitBaseBlockCache::ErasePhysicalRange around 50% faster and
PPCAnalyzer::Analyze around 40% faster. Rogue Squadron 2's notoriously
laggy action of switching to and from cockpit view is made something
like 20-30% faster by this, though this is a very rough measurement.
MagneticCardReader: Minor fixup to writing card data.
GameINI: Formatting updates to Sonic Mega Collection
This had to be in the header back when it was templated, but 083faa8
made it not templated.
We often use game IDs in paths, so we should try to make sure path
traversal is impossible in game IDs. Admittedly, doing any kind of real
attack using the six bytes available in game IDs is unrealistic, but no
game ID should contain non-alphanumeric or non-ASCII characters anyway.

Might also fix https://bugs.dolphin-emu.org/issues/13982 by skipping
converting between encodings for game IDs.
…t-defaults

Android: Fix defaults for RetroAchievements settings
Mistakenly thought the change media call would close the current
game if the new media failed to hash. This wasn't the case so
instead I'll close the current game myself. This fixes an issue
where a default ISO would immediately load achievements when
starting up the Wii menu.
… Go Home and Rabbids Lab.

Thanks to mickle pickle and ruru for helping to port the the Rabbids Go Home patch for the European versions of the game.
DiscIO: Only allow alphanumeric ASCII in game IDs
…ements-wii-menu

RetroAchievements - Close game on switch to null hash
Users are reporting a crash at the point where WiimoteAndroid::IORead
tries to use m_java_wiimote_payload. This commit solves the problem by
making m_java_wiimote_payload a global reference.

The code for setting up m_java_wiimote_payload has also been moved to
the constructor just because that way it's impossible for it to run
twice. (If the code as written were to run a second time, the old global
reference would be leaked. ConnectInternal should only run once, so this
is just to be on the safe side.)

Fixes https://bugs.dolphin-emu.org/issues/13960.
Doesn't matter a lot, but we're supposed to do this to be nice citizens.
JMC47 and others added 15 commits February 28, 2026 16:16
…trics_fix_graph_size_and_spacing

PerformanceMetrics: Fix graph size and spacing
Don't set cached array bases to invalid pointers. If a game tries to set
an invalid base just keep the old one, which might cause game problems
but won't crash the emulator.
…anager_fix_crash_from_invalid_array_base

VertexLoaderManager: Fix crash caused by invalid array base
Fixes a macOS Metal crash when stopping immediately after boot starts.

m_upload_encoder and m_texture_upload_encoder could be dealloc'd during shutdown before endEncoding could be called, which causes a Metal assertion failure.

Co-authored-by: OatmealDome <julian@oatmealdome.me>
…op-shutdown

Metal: Always run endEncoding on command encoders
…hacks

GameSettings: Add patches to limit the internal frame rate in Rabbids Go Home and Rabbids Lab.
…t-racer

GameSettings: Add patch to limit framerate in Monster 4x4: Stunt Racer.
GameSettings: Add patches for Need for Speed: Hot Pursuit 2 to limit the internal frame rate.
If Dolphin crashes, changes that have been made to settings are often
lost. This has been a minor annoyance for me when developing, but it has
become a much bigger issue recently due to the problem where Dolphin
freezes on shutdown for ROG Ally users.

Instead of saving the config when certain arbitrary settings are
changed, let's save the config when the user closes the settings window.
…lose

DolphinQt: Save when closing settings window
@cscd98
cscd98 force-pushed the uwp-fix branch 5 times, most recently from 06fd230 to 39f89c7 Compare March 14, 2026 15:03
@cscd98 cscd98 changed the title libretro: fix uwp version libretro: fix uwp version, fix wrong version returned in retroarch Mar 14, 2026
@warmenhoven
warmenhoven merged commit ab0db89 into libretro:master Mar 15, 2026
6 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.