src | ||
.editorconfig | ||
.gitignore | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json |
This tool is used for fetching releases from SWTOR’s patch server CDN and installing them.
Installation
For this tool to work, tsc
, tslint
and xdelta3
must be globally available, e.g. by running:
sudo npm install -g typescript tslint
sudo apt-get install xdelta3
Transpile the TypeScript files to JavaScript by running:
npm start
Usage
Either directly run whatever script you need:
node dist/getManifest.js assets_swtor_main
node dist/getSolidPkg.js assets_swtor_main 126 127
node dist/getSolidPkgZip.js assets_swtor_main 126 127
node dist/installPatch.js assets_swtor_main 126 127
Or import the functions into your Node.js application:
import * as ssn from './dist';
(async function() {
const manifestContents = await ssn.getManifest('assets_swtor_main');
console.log(manifestContents);
const solidpkgContents = await ssn.getSolidpkg('assets_swtor_main', 126, 127);
console.log(solidpkgContents);
}())
Introduction
SWTOR’s patcher is licensed from Solid State Networks, so it is mostly using code from SSN. However, SWTOR does not use the original software by SSN; instead they wrote their own patch deploy pipeline which interfaces with the SSN command line tools.
Also, SWTOR does not use all features offered by SSN. Notably, for public-facing products they do not use the peer-to-peer download of patches; instead all patches are downloaded from a CDN. In addition, they do not use the upcoming
feature where you can preload an upcoming patch before it is released.
In addition to the SSN patcher, the live game (but not the PTS) can also be installed via BitRaider. We do not cover BitRaider since understanding SSN is enough to install all patches.
Terminology
SSN uses the following terms; make sure you are familiar with them since we use them as well in documentation and in code.
product
: SWTOR is split into multiple products. That way, you can choose to only install part of SWTOR. For example, if you install the productsassets_swtor_main
andassets_swtor_en_us
, you only have the English-language live client files and no other languages and no PTS.release
: Colloquially, this is known as a “patch” or “Game Update”. For example, release264
in productassets_swtor_main
refers to Game Update 5.2.0. However, not every release can be mapped to a “patch”; sometimes there are multiple releases between two actual “patches”, e.g. because of build errors or because they need to add a hotfix via another release before the “patch” can be pushed to the live servers. A release is always an integer starting at0
.patch
: In the SSN sense, a patch refers to the difference between two releases. For example,263to264
is a patch that can be used to update a product from release263
to release264
. The first number is calledfrom
while the second number isto
. In order to install a patch, the release given in thefrom
number must already be installed on your disk, with one exception: If thefrom
number is-1
, e.g. in patch-1to0
, the patch does not store the differences but it has full file contents to allow for a fresh install.environment
: An environment consists of multiple products. For example, the live environment (swtor
) has products likeassets_swtor_main
while the PTS environment (publictest
) hasassets_swtor_test_main
.manifest
: Each product has a manifest, a single file that lists all releases and all patches, and specifies which release is the current release (that the launcher must install).
SSN file format and encryption
All files used by SSN are password-protected .zip files with a .exe header. The files are stored in the .zip section, while the .exe header (and the signatures at the end) are used to verify the integrity of the file. We are not interested in checking the integrity, so we only look at the .zip sections. Check the .zip specification for more information on the .zip format.
For each file, the extra field contains the following information:
- For password protected files, the password needed to decrypt the file. The password itself is encoded and even if you have decoded it, it is usually in binary. Most .zip software only accepts textual passwords, so I recommend writing a custom .zip reader.
- Whether this file is stored in full, or whether only the differences are stored in vcdiff/xdelta3 encoding. Also flags whether a file was deleted, and it includes the hashes of both the old and the new file.
Manifests (.patchmanifest
)
A .patchmanifest SSN file contains a single file manifest.xml
which includes a list of releases and patches, and specifies which manifest is the current one.
Patches (.solidpkg
)
A .solidpkg file contains a single file metafile.solid
, which is in Bencode format (similar to .torrent files) and includes the names, sizes and hashes of all files with the patch data (.zip, .z01, .z02 etc.).
Version files (.version
)
Once a patch is installed, you can look into the .version file to figure out which release it is, and use the hashes to verify that the installation is correct.
File download and CDN
Manifests are hosted on manifest.swtor.com, while patches are hosted on cdn-patch.swtor.com. They can only be downloaded via HTTP (port 80) but the lack of HTTPS is not an issue since the files are integrity-checked via their included signatures.
Manifests can be downloaded as follows: http://manifest.swtor.com/patch/${product}.patchmanifest
Then knowing which patch you need, you can get the patch as follows: http://cdn-patch.swtor.com/patch/${product}/${product}_${from}to${to}.solidpkg
In cases where the environment is part of the product name, the URL is slightly different since there is a folder for the environment: http://cdn-patch.swtor.com/patch/${environment}/${product}/${product}_${from}to${to}.solidpkg
Appendix
Environments used by SWTOR
Currently, the following three environments are used:
swtor
: The live game, including the European and North American servers. Open to all players and the default environment when logging into the launcher.publictest
: The Public Test Server to allow players to test upcoming content. Open to players most of the time, unless the testing under NDA, in which case only accounts invited to the test have access.liveqatest
: The environment where QA can test upcoming patches before they are deployed to the live servers. Not accessible to players.
Previously, the following environments were also used:
betatest
: The client used during the closed beta (2011 and earlier) to play the game.cstraining
: No longer used.liveeptest
: No longer used.squadron157
: The client used during the early closed beta by the Squadron157 testing group to play the game.
Products used by SWTOR
SWTOR uses the following products:
assets_swtor_de_de
: German language files for the live environment.assets_swtor_fr_fr
: English language files for the live environment.assets_swtor_en_us
: French language files for the live environment.assets_swtor_main
: Main game data for the live environment.assets_swtor_test_de_de
: German language files for the PTS environment.assets_swtor_test_en_us
: English language files for the PTS environment.assets_swtor_test_fr_fr
: French language files for the PTS environment.assets_swtor_test_main
: Main game data for the PTS environment.eualas
: End user access and license agreement, and other legal documents you need to accept in the launcher before you can play the game.movies_de_de
: Intro movies by Blur in German language.movies_en_us
: Intro movies by Blur in English language.movies_fr_fr
: Intro movies by Blur in French language.patcher2014
: The old launcher, now replaced bypatcher2017
but still available for download.patcher2017
: Current version of the launcher, used to download and install patches.retailclient_{environment}
: The client used to play the game, e.g.retailclient_swtor
orretailclient_publictest
.
In addition, there are a few private products which are only reachable through BioWare’s VPN and are not publicly accessible:
biomon_{environment}
: TheBiomongoose
tool, possibly to monitor performance like CPU and memory usage.byftools_{environment}
: Unknown toolsByfTools
andiPen
, might be related to Photoshop or other designer tools.heroblade_{environment}
: The IDE used for editing the game, either by placing new objects into the game world or editing scripts.morpheme_{environment}
: Morpheme is a middleware used for character animations. Only available in thecstraining
andliveqatest
environments.patcher
: The old launcher before the 2014 revamp. No longer in use.playerclient_{environment}
: A client to play the game, used by the devs instead ofretailclient
. Has a console and integrates with HeroBlade.repositoryassistant_{environment}
: unknownrepositorybrowser_{environment}
: The repository browser interfaces with HeroBlade to load 3D models, textures and other assets.toolshub_{environment}
: Used to launch more tools; most likely SpeedTree, WWise and other middleware.visualizer_{environment}
: Also known asVANViewer
; possibly the tool mentioned by Georg Zoeller in his 2011 GDC talk.