Building Xenia Canary (UWP) from Source - Stern & SirMangler
This guide provides instructions for compiling the canary_experimental branch of Xenia, an Xbox 360 emulator, from source code, targeting a UWP (Universal Windows Platform) build suitable for deployment to an Xbox Series S/X in Developer Mode.
This process is based on information from SirMangler's Discord and may be subject to change. Success is not guaranteed.
Prerequisites
- Windows PC: A Windows PC with sufficient storage and processing power.
- Visual Studio 2022: Visual Studio 2022 (Community, Professional, or Enterprise) with the necessary UWP and C++ workloads and components installed. See the previous "Installing Visual Studio 2022" guide for detailed instructions. It is highly recommended that you install the "Desktop Development with C++" workload.
- Git: Git for Windows installed (see the previous Visual Studio guide).
- Xbox in Developer Mode: Your Xbox Series S/X must be in Developer Mode.
- Network Connection: Both your PC and Xbox should be on the same network.
Steps
-
Clone the Repository:
-
Choose a location on your PC to store the Xenia source code (e.g.,
C:\XeniaSource). Create this folder. -
Open Git Bash: Navigate to the chosen folder in File Explorer, right-click inside the folder, and select "Git Bash Here".
-
Run the following command in the Git Bash terminal:
git clone -b canary_experimental --recursive https://github.com/SirMangler/xenia.git-b canary_experimental: This clones thecanary_experimentalbranch, which is the actively developed UWP branch. This is crucial.--recursive: This ensures that all submodules (external libraries) are also downloaded. This is also crucial.https://github.com/SirMangler/xenia.git: This is the URL of SirMangler's fork of Xenia.
-
Change Directory: After the cloning is complete, use the following command in Git Bash to navigate into the newly created
xeniafolder:cd xeniaYou must be inside the
xeniafolder for the next steps.
-
-
Run Setup Commands:
-
In the same Git Bash terminal (now inside the
xeniafolder), run these two commands, one after the other:./xb devenv./xb premakeThese commands set up the development environment and generate project files. You may see output (possibly including warnings or errors) in the terminal. This is normal as long as the commands complete.
-
-
Open the Solution:
- Navigate to the
xeniafolder in File Explorer (e.g.,C:\XeniaSource\xenia). - Find the file named
xenia.sln(or similar, depending on your setup). Double-click this file to open the Xenia solution in Visual Studio 2022.
- Navigate to the
-
Add
xenia-canary-uwpto the Solution:- This project is not automatically included, so you have to add manually.
- In Visual Studio go to File -> Add -> Existing Project.
- Navigate to the folder where you cloned the repository. Select the project located in
xenia\src\xenia-canary-uwp.
-
Set Startup Project:
- In the Solution Explorer (usually on the right), find the project named
xenia-canary-uwp. - Right-click on
xenia-canary-uwpand select "Set as Startup Project".
- In the Solution Explorer (usually on the right), find the project named
-
Set Build Configuration:
- In the Visual Studio toolbar, change the build configuration from "Debug" to "Release".
- Also in the toolbar, change the architecture from "x86" (or whatever it's set to) to "x64". Xenia UWP requires x64.
-
(Potentially Optional) Compile the Entire Solution: The original guide suggests compiling the entire solution at this point. Try this first. If it doesn't work, skip to step 9 and then, try building the solution again.
-
Remove
file_picker.win.cc:- In the Solution Explorer, expand the
xenia-canary-uwpproject. - Find a file named
file_picker.win.cc. It's likely within a "Source Files" or similar filter. - Right-click on
file_picker.win.ccand select "Remove". Confirm the removal. This file is known to cause build issues.
- In the Solution Explorer, expand the
-
(Conditional)
zstdIssues (If Step 7 Fails): If you encounter build errors related tozstd(a compression library), follow these steps:- Remove
zstd: In the Solution Explorer, find thezstdproject (it's likely at the top level of the solution, not insidexenia-canary-uwp). Right-click onzstdand select "Remove". - Add Existing
zstdProject:- Right-click on the Solution ('Solution 'xenia'...') at the very top of the Solution Explorer and choose "Add" -> "Existing Project...".
- Navigate to:
third_party/zstd/build/VS2010/zstd/. - Select the file
zstd.vcxprojand click "Open".
- Retarget
zstd:- Right-click on the newly added
zstdproject in the Solution Explorer. - Select "Retarget Projects". This updates the project to use your currently installed Visual Studio version and SDK. A dialog may appear. Choose "OK".
- Right-click on the newly added
- Add
zstdReference tozarchive:- Find the
zarchiveproject in the Solution Explorer. - Right-click on
zarchiveand select "Add" -> "Reference...". - In the "Add Reference" dialog, check the box next to
zstdand click "OK".
- Find the
- Remove
zstd.rc: In the Solution Explorer, expand thezstdproject. Find the file namedzstd.rc(likely in "Resource Files"). Right-click onzstd.rcand select "Remove".
- Remove
-
Build the Project (or Create App Packages):
- Build: You can try building the project directly: Right-click on
xenia-canary-uwpin the Solution Explorer and select "Build". This is suitable for debugging. - Create App Packages (Recommended for Deployment): For deploying to your Xbox, it's recommended to create app packages:
- Right-click on
xenia-canary-uwpin the Solution Explorer. - Select "Publish" -> "Create App Packages...".
- Choose "Sideloading" (this is for Developer Mode).
- Follow the prompts. You'll likely need to create or select a signing certificate (similar to the Dolphin UWP build process).
- Select the x64 architecture.
- Choose a location to save the app packages.
- Click "Create".
- Right-click on
- Build: You can try building the project directly: Right-click on
-
Deploy to Xbox: If you created app packages, you can deploy them to your Xbox using the Device Portal (in your web browser) or through Visual Studio's "Remote Machine" deployment option (as described in the Dolphin UWP build guide). You would follow very similar steps as with Dolphin UWP to connect and deploy to the Xbox.
This guide provides the necessary steps, based on the provided information and best practices for UWP development.
If you encounter errors, carefully review the steps, paying close attention to:
- Correct Git commands (branch and submodules).
- Project setup (startup project, build configuration, architecture).
- File removals (
file_picker.win.cc, and potentiallyzstd.rc). zstdproject retargeting and referencing.- Creating app packages (if applicable).