-------------
A. Overview
-------------

The GWLP file server implements the Guild Wars file transfer protocol which is used officially for updating the game. This software is interoperable with the official Guild Wars game client. It can be used for placing custom files in the gw.dat, downgrading/upgrading a Guild Wars installation to a particular version, and modifying existing files. 

---------------------------------
B. Simple Update Server Tutorial
---------------------------------

The following will guide you in setting up a server that can upgrade clients to the live version of Guild Wars. This is merely a set up to get you started messing around.

1. Install the server software

2. Obtain a fully -image 'ed gw.dat file and store it somewhere accessible. Store the associated gw.exe as well.

3. Open the FsConfig.ini file in /Config

4. Change "IPAddress" to the address you want to run the server on. OR set "AutomaticIP" to true.

5. Set "ArchivePath" to either a relative or full path to the stored gw.dat

6. Set "UseArenaNet" to true, leave all other options at their default, and save and close.

Now you need to use a network sniffer or similar packet capturing program such as Wireshark or WPE to capture the first packet sent from the official file server. The packet you want is twenty-four bytes in size. It contains the unique file id's we need ("file hash" is what we refer to it as). 

Ex.

F102 1800 601F 0500 DB1F 0500 DF1F 0500 
E01F 0500 E11F 0500 

We don't care about the first four bytes. So...

601F 0500 DB1F 0500 DF1F 0500 
E01F 0500 E11F 0500

Then join each two byte pair. 1st joins the second. 3rd joins the 4th...

601F0500  DB1F0500  DF1F0500 
E01F0500  E11F0500

These are example hex values and are going to be used for the build version configuration. You should have a list as follows, minus the descriptions. You need to prefix each number with "0x" as I have done below.

0x601F0500   - unknown 
0xDB1F0500   - This is the dependency file hash
0xDF1F0500   - This is the executable file hash
0xE01F0500   - unknown
0xE11F0500   - unknown

7. Open "BuildVersion.ini" and change the values as follows. "Unknown1" should be set to the first number in the above list you made. "DepFileHash" is the second so set it to the second number and so on. Save and close the file.

8. Copy your stored gw.exe to the /Files directory.

9. Open "FileList.ini"

Each entry in this file should following the syntax:

<File hash> <Filename> <File decompressed size, 0 if the file is NOT compressed>

Continuing with the example we need to add the executable file hash. So we add the line that follows, minus the quotation marks. Note: Any file entries in this file override both archive and ArenaNet backends.

"0xDF1F0500 gw.exe 0"

10. Add your file entry line to "FileList.ini" similar to the example above.

11. Start "FileServer.exe"

If all is well you shouldn't see any errors or anything strange. Now that the server is ready for connections we need to redirect the Guild Wars client to our file server. To do this we need to edit the HOSTS file.

1. Open your "hosts" file. It can be found within your Windows installation. It is usually in,

C:\WINDOWS\system32\drivers\etc

2. Figure out the IP of the server. If you set automaticIP look in the server window for the "Server: <Ip Address>" text. It should say what IP address the server is listening on. You need to substitute "<ip>" for your server IP address in the text that follows.

<ip> file1.arenanetworks.com
<ip> file2.arenanetworks.com
<ip> file3.arenanetworks.com
<ip> file4.arenanetworks.com
<ip> file5.arenanetworks.com
<ip> file6.arenanetworks.com
<ip> file7.arenanetworks.com
<ip> file8.arenanetworks.com
<ip> file9.arenanetworks.com
<ip> file10.arenanetworks.com
<ip> file11.arenanetworks.com
<ip> file12.arenanetworks.com
<ip> file13.arenanetworks.com
<ip> file14.arenanetworks.com
<ip> file15.arenanetworks.com
<ip> file16.arenanetworks.com

Example: If I'm running a server on 127.0.0.1 I need to add the following on a new line of the hosts file.

127.0.0.1 file1.arenanetworks.com
127.0.0.1 file2.arenanetworks.com
127.0.0.1 file3.arenanetworks.com
127.0.0.1 file4.arenanetworks.com
127.0.0.1 file5.arenanetworks.com
127.0.0.1 file6.arenanetworks.com
127.0.0.1 file7.arenanetworks.com
127.0.0.1 file8.arenanetworks.com
127.0.0.1 file9.arenanetworks.com
127.0.0.1 file10.arenanetworks.com
127.0.0.1 file11.arenanetworks.com
127.0.0.1 file12.arenanetworks.com
127.0.0.1 file13.arenanetworks.com
127.0.0.1 file14.arenanetworks.com
127.0.0.1 file15.arenanetworks.com
127.0.0.1 file16.arenanetworks.com

3. Add this to your hosts file and save it.

4. Start Guild Wars. If you are running the right version it should say Connecting and then 100% The game will proceed to the login screen. Congratulations, you now have a working file server. Try deleting your Guild Wars installation's gw.dat (NOT the gw.dat you are using the server.) and running Guild Wars. It should connect and start downloading.

Note: To connect to the official files servers again, remove the lines added to your hosts file.

---------------
C. Limitations
---------------

The server cannot send FFNA files directly from the Guild Wars data archive. This is due to FFNA files received from the official file servers differ from the ones stored in the data archive. To cope with this limitation the server has the ability to connect to the official Guild Wars file servers to download a correct version of the requested file. This can be enabled by setting "UseArenaNet" in the configuration file. Be warned: Doing -image with this enabled will cause total connections to ArenaNet servers in excess of 90,000. However, once a file is downloaded it is stored for later use in Files/FileCache Please note, the files that are being stored are compressed.

To send FFNA's from the data archive anyway. You can disable "DisableArchiveFFNA" to enable sending FFNA's from the data archive. These files are invalid and cannot be used. But the game should still start. The Guild Wars client will write these as five byte FFNA files that are not compressed.

-------------------
D. Dependency File
-------------------

This file contains the hash of every file in the Guild Wars archive. You must edit it to update (modify) existing files or add new ones to a client archive. To force the client to download your dependency file you must give it a different hash than what the client is using. The official file servers always increase the value for each build. To update an individual file the file's hash needs to be changed. But further specifics have yet to be discovered.

---------------------
E. Possible Problems
---------------------

1. The download just stops but the client still says it is downloading. [Should be fixed]

This is caused by the client not requesting more data from the file server. The only thing that can be done is to restart the Guild Wars client.

2. The client was downloading and then it stopped and now says "Connecting to ArenaNet"  [Should be fixed]

This is caused by a file CRC check failing. It has been largely eliminated but can still occur. The client should try connecting again in a few minutes or you can restart the client. This also occurs if the client is getting data too fast. But this has been dealt with through the advanced configuration options.

3. I edited the dependency file and client crashes. 

You are on your own. xD But just change the hash and the client will download your corrected dependency file.

-----------
F. Credits
-----------

From GWLP: l3j & Saracen

Thanks to BoyC, BlackDragon, and Irina from Xentax for the archive info and code.

-----------
G. Contact 
-----------

If you encounter bugs or have questions please contact us by on the following means.

Email: gwlpdev@gmail.com
IRC: #gwlp @ irc.rizon.net
Web: gwlp.mgcorp.org