UWP: Migrate from C++/CX to C++/WinRT#18558
Conversation
|
whoops let me fix the CI :/ |
- Replace ref class with winrt::implements<> - Convert Platform::String^ to winrt::hstring - Update event handlers to C++/WinRT delegates - Add PackageReference for auto NuGet restore - Add specific Xbox model CPU detection via Gaming Device Info API Signed-off-by: SternXD <[email protected]>
|
Is this also more backwards compatible? |
No change same minimum Windows/UWP targets. This is about future-proofing and maintainability, not expanding backwards compatibility. And more partially because I find C++/CX disgusting to work with |
|
Alright, let's take a gamble on this |
|
@LibretroAdmin still going to reply to that message you deleted this is what I was going to say For the most part yes, but with a clarification: C++/CX isn’t CLR-based (that would be C++/CLI), though it does add a compiler-generated projection layer. Moving to C++/WinRT removes that layer and uses a header-only, standard C++17 projection. That usually means less "glue" code, better inlining, and lower overhead at WinRT boundaries, Though in practice the performance gains are modest and mostly show up in hot paths that frequently cross WinRT boundaries. The main benefits are cleaner semantics, smaller binaries, and long-term maintainability rather than large raw speedups. |
Sounds great to me. I am also not a fan of having to go through the CLR. The more we can avoid it the better |
Description
Migrates the UWP code from C++/CX to C++/WinRT.
C++/CX is a deprecated, non-standard language extension. C++/WinRT is the replacement, giving us better compatibility and support. I have smoke tested this for a few hours with no regressions I could find.
EDIT here's what Microsoft says about it:
Changes:
ref classwithwinrt::implements<>Platform::String^towinrt::hstringref newwithwinrt::make<>IAsyncOperationand exception handlingXbox One/Series CPUin the system info to actually show what console the user is on)Click to see Console Screenshot
Click to see Desktop Screenshot
Reviewers
@LibretroAdmin