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: ```bash sudo npm install -g typescript tslint sudo apt-get install xdelta3 ``` Transpile the TypeScript files to JavaScript by running: ```bash npm start ``` # Usage Either directly run whatever script you need: ```bash 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: ```js 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 products ```assets_swtor_main``` and ```assets_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, release ```264``` in product ```assets_swtor_main``` refers to Game Update 5.2.0. However, not every release can be mapped to a “patch” (or Game Update); sometimes there are multiple releases between two actual “patches”, e.g. because of built errors or because they need to add another hotfix before releasing the “patch”. A release is always an integer starting at ```0```. - __```patch```__: In a 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 release ```263``` to release ```264```. The first number is called ```from``` while the second number is ```to```. If the ```from``` number is ```-1```, e.g. in patch ```-1to0```, the patch does not store the differences but the full file contents to allow a fresh install. Otherwise, you must already have the ```from``` release installed in order to apply the patch. - __```environment```__: An environment consists of multiple products. For example, the ```live``` environment has products like ```assets_swtor_main``` while the ```pts``` environment has ```assets_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 file. Check the [.zip specification](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) 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 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` # Appendix ## 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 by ```patcher2017```. - __```patcher2017```__: Current version of the launcher, used to download and install patches. - __```retailclient_liveqatest```__: The current client used by QA the day before a maintenance to log into a private server and check that the upcoming patch is correct. - __```retailclient_publictest```__: The current client used to play the game on the PTS. - __```retailclient_swtor```__: The current client used to play the game in the live environment. In addition, there are a few private products which are only reachable through BioWare’s VPN and are not publicly accessible: - ```biomon_cstraining```, ```biomon_liveeptest```, ```biomon_liveqatest```, ```biomon_publictest```, ```biomon_swtor```: The ```Biomongoose``` tool, possibly to monitor performance like CPU and memory usage. - ```byftools_cstraining```, ```byftools_liveeptest```, ```byftools_liveqatest```, ```byftools_publictest```, ```byftools_swtor```: Unknown tools ```ByfTools``` and ```iPen```. - ```heroblade_cstraining```, ```heroblade_liveeptest```, ```heroblade_liveqatest```, ```heroblade_publictest```, ```heroblade_swtor```: The IDE used for editing the game, either by placing new objects into the game world or editing scripts. - ```morpheme_cstraining```, ```morpheme_liveqatest```: Morpheme is a middleware used for character animations. - ```patcher```: The old launcher before the 2014 revamp. No longer in use. - ```playerclient_cstraining```, ```playerclient_liveeptest```, ```playerclient_liveqatest```, ```playerclient_publictest```, ```playerclient_swtor```: A client to play the game, used by the devs instead of ```retailclient```. Has a console and integrates with HeroBlade. - ```repositoryassistant_cstraining```, ```repositoryassistant_liveeptest```, ```repositoryassistant_liveqatest```, ```repositoryassistant_publictest```, ```repositoryassistant_swtor```: unknown - ```repositorybrowser_cstraining```, ```repositorybrowser_liveeptest```, ```repositorybrowser_liveqatest```, ```repositorybrowser_publictest```, ```repositorybrowser_swtor```: The repository browser interfaces with HeroBlade to load 3D models, textures and other assets. - ```toolshub_cstraining```, ```toolshub_liveeptest```, ```toolshub_liveqatest```, ```toolshub_publictest```, ```toolshub_swtor```: Used to launch more tools; most likely SpeedTree, WWise and other middleware. - ```visualizer_cstraining```, ```visualizer_liveeptest```, ```visualizer_liveqatest```, ```visualizer_publictest```, ```visualizer_swtor```: Also known as ```VANViewer```; possibly the tool mentioned by Georg Zoeller in his 2011 GDC talk. The following products are deprecated and no longer used. - ```retailclient_betatest```: The client used during the closed beta (2011 and earlier) to play the game. - ```retailclient_cstraining```: No longer used. - ```retailclient_liveeptest```: No longer used. - ```retailclient_squadron157```: The client used during the closed beta by the Squadron157 testing group to play the game.