(UWP) Add optional packages support and fix ARM builds #7860
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This took way more messing around with the configs than I expected. The documentation on the topic is severly lacking and there are literally no error messages telling you what are you doing wrong...
This pull request prepares everything to support loading cores as 'optional packages', which are just additional .appx files that you can install alongside the main one as DLCs to execute code from it. This should help resolve licensing issues related to bundling cores mentioned in #7834 (comment). For now I set it up so that the 'free' packages are bundled with the main download, and you have an additional 'non-free' package, but it's obviously possible to make as many of these packages as we want.
I also fixed the ARM builds and set everything up to properly handle building multi-architecture packages, which means both 32-bit PCs and ARM devices (smartphones maybe?) should work fine now, although I have not tested that since I don't have any ARM Windows devices.
Since getting this to properly build and work is not trivial, I'm attaching a step-by-step guide on how to generate the appx files. I have not figured out a way to automate all of this yet.
pkg/msvc-uwp/RetroArch-UWP/cores/{Win32, x64, ARM}/cores/
andpkg/msvc-uwp/RetroArch-UWP-cores-nonfree/cores/{Win32, x64, ARM}/cores/
pkg/msvc-uwp/RetroArch-UWP/cores/{Win32, x64, ARM}/
andpkg/msvc-uwp/RetroArch-UWP-cores-nonfree/cores/{Win32, x64, ARM}/
pkg/msvc-uwp/RetroArch-UWP.sln
. Don't worry that the DLLs you added won't appear in the file list - they are specified as wildcards, so Visual Studio can't show them, but everything will still work fine.RetroArch-UWP-cores-nonfree
project, selectStore > Create store packages...
(yes, this one HAS to be done first)pkg\msvc-uwp\AppPackages\RetroArch-UWP-cores-nonfree
. When it recommends running the store certification kit, closeBundle.Mapping.txt
file in the main project. Make sure the path matches what you just built (it can change if you change the version, built architectures etc.) - Visual Studio does have an option to just point to a project file and have it auto-detect, but it builds only package for one architecture for some reason so we have to deal with this for now. This file is used to link the packages into a 'related set' - this means that Windows will prevent you from mixing up versions, and unlock code loading from the package. Failing to do this properly results in a package that installs fine and has all content visible, but loading cores fails with a generic "module not found" message (!!!)pkg\msvc-uwp\AppPackages\RetroArch-UWP\RetroArch-UWP_1.0.0.0_Test
should contain everything you need to sideload the packages. The "Dependencies" directory contains any system libraries that may be needed to install the package (you have to specify them when sideloading on Xbox for sure). The "ExternalPackages" contains a copy of the non-free cores package built earlier - remove it for the 'free' download and distribute separetely. TheAdd-AppDevPackage.ps1
script adds the dev self-signed cert as trusted and installs the package - for release packages, you probably want to sign them with a proper code-signing certificate instead (@bparker06 mentioned you do have one), this will allow sideloading without having to mess with the certificates and make sideloading on Xbox through the Device Portal possible since there is no easy way to install the cert there (for testing, make sure you deployed from VS before at least once)Additional note: you can install the optional package while RetroArch is running and the new cores will immediately appear, but you do need to restart to get the Windows DLL loader to update its search path and will run into weird behavior if you don't. I tried to add a warning displayed after the package is installed, but it doesn't seem to be working...
Related Issues
#7235
discussion under #7834
Reviewers
@twinaphex
Also ping @bparker06 @fr500 @hizzlekizzle since you seem to be aware of possible licensing problems with distributing the packages