Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(UWP) Add optional packages support and fix ARM builds #7860

Merged
merged 2 commits into from Jan 1, 2019

Conversation

krzys-h
Copy link
Contributor

@krzys-h krzys-h commented Jan 1, 2019

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.

  1. Take the DLLs for the cores you want to package for every architecture and drop them in pkg/msvc-uwp/RetroArch-UWP/cores/{Win32, x64, ARM}/cores/ and pkg/msvc-uwp/RetroArch-UWP-cores-nonfree/cores/{Win32, x64, ARM}/cores/
  2. Take any dependency DLLs these cores need, and drop them in pkg/msvc-uwp/RetroArch-UWP/cores/{Win32, x64, ARM}/ and pkg/msvc-uwp/RetroArch-UWP-cores-nonfree/cores/{Win32, x64, ARM}/
  3. Open Visual Studio and load the solution at 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.
  4. Right-click the RetroArch-UWP-cores-nonfree project, select Store > Create store packages... (yes, this one HAS to be done first)
  5. Select the sideloading packages option, click Next, disable automatic versioning, set it to generate bundle ALWAYS (this is important: the optional package links don't work correctly in flat appx packages), enable x86, x64 and ARM and set them all to Release (ARM64 is not really commonly used afaik so I don't think we should even bother)
  6. At this point, the non-free cores bundle will build in pkg\msvc-uwp\AppPackages\RetroArch-UWP-cores-nonfree. When it recommends running the store certification kit, close
  7. Open the Bundle.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 (!!!)
  8. Repeat steps 4-6 for the main project
  9. At this point, 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. The Add-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

@inactive123 inactive123 merged commit e64f713 into libretro:master Jan 1, 2019
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.

None yet

2 participants