Difference between revisions of "Retail Patcher and Login"
(→Version Check) |
|||
Line 7: | Line 7: | ||
===Version Check=== | ===Version Check=== | ||
− | The first thing ffxivboot does after initialization is perform a version check for both ffxivboot and ffxivgame programs. A GET HTTP request is made to ver01.ffxiv.com first for the boot program, followed by the game program. Both requests and responses have the same format. | + | The first thing ffxivboot does after initialization is perform a version check for both ffxivboot and ffxivgame programs. A GET HTTP request is made to <code>ver01.ffxiv.com</code> first for the boot program, followed by the game program. Both requests and responses have the same format. |
<code>/vercheck/ffxiv/win32/release/<game or boot>/<patchnumber></code> | <code>/vercheck/ffxiv/win32/release/<game or boot>/<patchnumber></code> |
Revision as of 17:16, 24 May 2019
Originally the retail version of the game used a built in patcher and login program to both update and start the game. The patcher consists of two programs ffxivboot.exe and ffxivupdater.exe. The login program is ffxivlogin.exe. Finally the actual game is ffxivgame.exe.
FFXIVBoot
This is the main application that is start when a user clicks on the "Final Fantasy XIV" shortcut. It facilitates version checking as well as patch downloading and verification. The patch downloader is a modified Bittorrent client, which causes problems with using non-ffxivboot clients. Interestingly ffxivboot was built on top of the Rapture engine and contains the same various RTTI info and referenced strings as the main ffxivgame executable. This was most likely to reuse the logic for rendering the Silverlight based UI, access game files, and to play the SCD music.
Version Check
The first thing ffxivboot does after initialization is perform a version check for both ffxivboot and ffxivgame programs. A GET HTTP request is made to ver01.ffxiv.com
first for the boot program, followed by the game program. Both requests and responses have the same format.
/vercheck/ffxiv/win32/release/<game or boot>/<patchnumber>
If the version requested is up to date, the following is responded back:
header("HTTP/1.0 204 No Content"); header("Content-Location: ffxiv/2d2a390f/vercheck.dat"); header("X-Repository: ffxiv/win32/release/boot"); header("X-Patch-Module: ZiPatch"); header("X-Protocol: torrent"); header("X-Info-Url: http://www.example.com"); header("X-Latest-Version: 2012.09.19.0000");
If the version requested is out of date and an update is needed, the following is responded back:
header("HTTP/1.0 200 OK"); header("Content-Location: ffxiv/48eca647/vercheck.dat"); header("Content-Type: multipart/mixed; boundary=477D80B1_38BC_41d4_8B48_5273ADB89CAC"); header("X-Repository: ffxiv/win32/release/boot"); header("X-Patch-Module: ZiPatch"); header("X-Protocol: torrent"); header("X-Info-Url: http://example.com"); header("X-Latest-Version: 2012.05.20.0000.0001"); header("Connection: keep-alive") --477D80B1_38BC_41d4_8B48_5273ADB89CAC Content-Type: application/octet-stream Content-Location: ffxiv/48eca647/metainfo/D2012.05.20.0000.0001.torrent X-Patch-Length: 20874726 X-Signature: jqxmt9WQH1aXptNju6CmCdztFdaKbyOAVjdGw_DJvRiBJhnQL6UlDUcqxg2DeiIKhVzkjUm3hFXOVUFjygxCoPUmCwnbCaryNqVk_oTk_aZE4HGWNOEcAdBwf0Gb2SzwAtk69zs_5dLAtZ0mPpMuxWJiaNSvWjEmQ925BFwd7Vk= [TORRENT FILE HERE] --477D80B1_38BC_41d4_8B48_5273ADB89CAC--
Both responses contain the same HTTP headers:
- Content-Location: Defines the location on the user's computer (in
My Documents/My Games/Final Fantasy XIV/
) where the patch file is stored. - X-Respository: Either
ffxiv/win32/release/boot
orffxiv/win32/release/game
depending on what's being version checked. - X-Patch-Module: Defines what format the patch file is in. FFXIV used ZiPatch.
- X-Protocol: Defines how the patch will be downloaded. While the client makes reference to http (and FFXIV ARR uses that), ffxivboot does not have code to download by http.
- X-Info-Url: Unknown but always set to http://example.com.
- X-Latest-Version: The latest version of that program.
When the program is out of date the body of the HTTP response contains more information as well as the torrent file to get the patch. Of note is Content-Location
which like the head, stores the torrent file under the same location. Next is X-Patch-Length
which is the size of the torrent file, as well as the X-Signature
used for source verification. The ffxivboot program will use OpenSSL's rsa_verify
function to verify that the sent patch is from Square Enix. We can patch out the returned value from rsa_verify
to always return true (valid). Interestingly this verification was removed in FFXIV ARR. Finally after the signature is a single line followed by the full .torrent file.
If the version was up to date, ffxivboot will then continue and launch ffxivlogin to handle session login. Otherwise the patch downloader is started.
Patch Downloader
Once downloaded the necessary files will be stored like this:
-
<FFXIV Games Folder>/<program hash>/vercheck.dat
- This is just the response returned above, stored in a file. -
<FFXIV Games Folder>/<program hash>/metainfo/D2012.05.20.0000.0001.torrent
- The torrent file. -
<FFXIV Games Folder>/<program hash>/patch/D2012.05.20.0000.0001.patch
- The actual patch file that is being downloaded.
For all intents and purposes the FFXIV patch downloader is an off-the-shelf Bittorrent client, which the peer handshake functionality modified. A standard Bittorrent handshake looks likes this:
SE modifies the protocol name as well as Blowfish encrypts like so.
FFXIVUpdater
Once the patch file has been downloaded ffxivboot copies the ffxivupdater program to the FFXIV documents folder and executes it.
The patcher does two things: iterator over every entry, verifying both the old file and new file SHA1 signatures and then executes and operation on them. Once all blocks are iterated over the program is patched and ffxivboot is rebooted to start the process all over again.