Skip to content

C++20#2275

Open
vkedwardli wants to merge 4 commits intoflyinghead:devfrom
vkedwardli:feat/c++20-winrt
Open

C++20#2275
vkedwardli wants to merge 4 commits intoflyinghead:devfrom
vkedwardli:feat/c++20-winrt

Conversation

@vkedwardli
Copy link
Collaborator

@vkedwardli vkedwardli commented Mar 20, 2026

  • Enabled C++20 for Flycast project, dependencies are still C++17
  • Added fmtlib to replace std::format (which is not supported on macOS < 13.3)
  • UWP: C++/WinRT migration
  • Added /WHOLEARCHIVE for SDL2 to fix metadata stripping in C++20 builds
  • Updated DreamPicoPort-API to fix C++20 template errors (will wait for upstream)

Following PR #1696, I thought I could use designated initializers since the project is now C++20, but MSVC is very strict with the feature set. This is another attempt to fix what PR #1868 missed.

Looking for feedback on these C++20 workarounds and would like to confirm if this strategy aligns with the project's direction.

I concern that with C++20 enabled, contributors will naturally use std::format, they might wait hours for a full build only discover the macOS CI to fail late in the process, so

  • Proposing fmtlib as the project-wide formatting standard
    • Uniform behavior across MSVC/GCC/Clang, supports older macOS (< 13.3) where std::to_chars is missing
    • better compile-time format checks (FMT_STRING)
    • better performance tuning options
  • Should we block std::format via Header Guards so whenever someone try to compile, so error pops up immediately? Or pre-commit hook with CMake script?
  • UWP / SDL2 / WHOLEARCHIVE: Since we are still using SDL2, unless we want to upgrade to SDL3

p.s. The UWP build can be run on a Windows 11 machine, can play games, not sure what actions are required to verify the UWP build since I don't have an Xbox

@vkedwardli vkedwardli force-pushed the feat/c++20-winrt branch 2 times, most recently from 29517d9 to a2b6e44 Compare March 20, 2026 20:00
@vkedwardli vkedwardli mentioned this pull request Mar 23, 2026
24 tasks
@vkedwardli
Copy link
Collaborator Author

  • Rebased to include the commit 6d2befc
  • Fixed the HiDPI + mouse hit-testing issue observed on Win11 UWP builds also

Smoke Test (Win11 UWP)

  • App launches successfully (no crash)
  • File picker works (load game)
  • Data persists across restart
  • Screenshots save correctly (multiple captures)
  • HTTP requests work (album art loads)
  • Keyboard input works (InputPane)
  • Game runs normally
  • HiDPI scaling correct on first launch
  • Mouse input works (hover + click alignment correct)

Before
Win11:

  • Always used 640×480 or saved size directly
  • DPI scale always 1.0
  • Result: blurry UI + broken mouse mapping (offset)

Xbox:

  • HDMI success -> OK
  • HDMI failure -> fallback to 640×480 (no recovery)

After
Win11:

  • Always uses OS DPI scale
  • Correct physical resolution every launch

Xbox:

  • HDMI success -> unchanged
  • HDMI failure -> fallback to OS scale instead of 640×480

@vkedwardli vkedwardli marked this pull request as ready for review March 25, 2026 06:30
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