This post is part of a series about the Halo Infinite Web API.
You can read more about the authentication process to get started with the API endpoints right away.
You can also explore the .NET wrapper for the API that makes endpoint interaction a bit easier.
If you’ve been following some of my recent work, you might’ve caught my latest blog post on enabling hidden game modes and maps in Halo Infinite. Well, clearly my curiosity got the best of me, because this post is very much a continuation of that story.
The gist of my realization at the time was that you can actually enable the content that is available in the build (or even not in the build, but you need to know the magic GUID combinations) by bookmarking or copying it into your file browser. The process that I came up with boiled down to creating a Microsoft Bond envelope that mimics the API requests issued by the game, with GUIDs being substituted for the desired content.
The process would be very tedious if you’d ever want to, let’s say, enable literally everything that is declared in the build manifest. There are about 256 game variants and 95 map variations enabled in the latest production build. That’s a lot of one-off envelope re-creation and
POST-ing to the “Save A Copy” API endpoint. What if I could automate this process?
And automate this process I did! I decided to write a PowerShell script for several reasons:
- Code is easy to modify without programming tools installed.
- Code is easy to understand at a glance.
- No need to deal with compilation and binaries.
- I can still wrap all the .NET niceties for Bond serialization.
- User get to avoid the need to download and run binaries from random people on the Internet (myself).
The script is very simple in that it only does a few things:
- Reads your Spartan V4 token as an argument. The easiest way to get the token (I did not write the authentication flow into the script) that is by looking at the Halo Waypoint site through the lens of your browser’s Network Inspector and copying the value of the
x-343-authorization-spartanheader. That way you don’t have to deal with Fiddler or other tools to inspect game traffic (although you can if you want to).
- Reads your Xbox User ID (XUID) as an argument. Your XUID is effectively a string identifier in the format of
xuid(NUMERIC_ID)that represents your account on the Xbox Live network. There are tools online that allow you to convert your gamertag into a XUID, and there are also Xbox Live APIs for this purpose, that I will dive into in another post (it’s a lengthy process to describe).
- Reads the build ID as an argument. The build ID is shown in the game when you launch it (it’s in the right corner). Skip the trailing
.0when using it with the script.
- For each game variant (in
UgcGameVariantLinks) and map (in
MapLinks) stores a copy in your files. You will see your in-game file browser populate with all the game modes and maps that are available for the build.
Now, do keep in mind that there is a lot of test and unfinished content that is likely not stable or doesn’t work as well as you’d expect. The entire point of this is to make exploration easier at the expense of occasionally running into some glitch. Like this one, with bots following me aimlessly:
So, what’s the script? You can copy and paste the snippet below into a file and run on your Windows machine (you can also find the same script on GitHub Gist). Use script arguments in the following format:
I call the script
halobuff.ps1 because it enables the hidden “buffs” to experiment with in the content, but you can cal the file whatever you really want - it makes no difference when it executes. Anyway, here is the code:
This script is a horrific implementation for anyone that is familiar with PowerShell and/or C#. I am clearly Frankenstein-ing the code here by mixing in C# pieces that are dealing with Bond serialization and attributes (I haven’t gotten an elegant solution for that in PowerShell) with .NET-style instantiation and management of entities. But, as hacky of a piece it is - it works. Broken down step-by-step, the script:
- Downloads NuGet.exe from the official NuGet website so that I can install the right packages for Bond data handling.
- Install the
Bond.Core.CSharppackage that enables me to handle Bond data.
- Get the paths for Dynamic Links Libraries (DLLs) included in the aforementioned package.
- Load the libraries in the script context.
- Translate my C# entity code into PowerShell-managed classes.
- Get the build metadata through the Halo API.
- Parse the build metadata to get the available maps and game variants.
- For each available game variant, create a Bond-formatted envelope and send it to the “Save A Copy” Halo API endpoint.
- For each available map, create a Bond-formatted envelope and send it to the “Save A Copy” Halo API endpoint.
That’s about it! Once the script execution completes, you should see all the maps and modes available when you go to Community and then My Files.
I am not sure how useful this actually is to the broader community per-se, but it at least enables me and friends to play Vampire Oddball and try to launch Forge (despite Forge assets not being in the current build).