- RAF redirects here, for the reward program, see Refer-A-Friend.
Background[]
Many of the data files required to run League of Legends reside on the user's computer. Some of these can be changed such as skins, though skins changed in this manner will not be visible to other players. Some data such as champion data cannot be modified, but it can be viewed. Prior to summer 2011 all of this data was found in a file named HeroPak_client.zip
; since then the data has been moved into several .raf
and .raf.dat
files. These files are distributed throughout the subfolders in the following directory: <LoL Install Path>\RADS\projects\lol_game_client\filearchives\
Riot Games Inc. released the format in a post on the official forums[1] shortly after making the update. Note that the following is reasonably technical and is intended for those interested in writing their own RAF unpacker. The average player may want to consider a third-party application that has already been written.
Format description[]
Note that all values which are more than one byte are stored in little-endian format. Also note that the original document referred to paths as strings. There are two files, the .raf file and the .raf.dat file. The .raf.dat file contains data for files (many of which are compressed using ZLIB[2]), whereas the .raf contains the information about where to unpack the files. All offsets and sizes are in bytes. Values in a monospace font preceded by 0x
(e.g. 0x1a2b3c4d
) indicate a hexadecimal value.
Overview of .raf file[]
The .raf file contains two important lists: the file list and the path list. The file list details where to look up a particular file in the .raf.dat file, as well as where to look up that file's path in the path list. The path list tells one where the path string is in the .raf file.
Name | Bytes | Interpretation |
---|---|---|
Magic Number | 4 | A fixed value indicating this is a valid RAF file. The value is 0x18be0ef0 .
|
Version | 4 | The version of the RAF format used by this file. |
Manager Index | 4 | A value used internally by Riot. DO NOT MODIFY. |
File List Offset | 4 | The offset from the start of the .raf file to the File List.
|
Path List Offset | 4 | The offset from the start of the .raf file to the Path List.
|
File List | * | A list of all of file entries. |
Path List | * | A list of all the path entries. |
File List[]
Name | Bytes | Interpretation |
---|---|---|
Number of Entries | 4 | A count of file entries. |
File Entries | * | The file entries. The number of bytes this takes depends on the number of file entries. |
File Entry[]
Name | Bytes | Interpretation |
---|---|---|
Path Hash | 4 | A hash of this file's path. The hash function used is described later. |
Data Offset | 4 | The offset from the beginning of the associated .raf.dat file. |
Data Size | 4 | The size of the data stored in the associated .raf.dat file. |
Path List Index | 4 | The index into the path list. This value should be an integer between 0 and the path list count - 1 (inclusive). |
Path List[]
Name | Bytes | Interpretation |
---|---|---|
Path List Size | 4 | The number of bytes contained in the path list. |
Path List Count | 4 | The number of entries in the path list. |
Path List Entries | * | The entries in the path list detailing where the literal path's length and location. |
Path Strings | * | The literal ASCII-encoded path string. Note that all strings are null terminated (meaning the last byte of the string is 0x00 ).
|
Path List Entry[]
Name | Bytes | Interpretation |
---|---|---|
Path Offset | 4 | The number of bytes the path string is offset from the path list (not the beginning of the file) |
Path Length | 4 | The length of the path string in bytes. |
Hash Function[]
The hash function is described below in pseudo code. Note that strings here are ASCII-encoded, meaning each character is exactly one byte. The type uint32 represents a 32-bit unsigned integer. The ^ symbol is used to denote a 32-bit exclusive-or.
HashString(str:String):uint32 uint32 hash = 0 uint32 temp = 0 foreach(character in str): hash = (hash << 4) + character.toLowerCase temp = hash & 0xf0000000 if temp != 0 hash = hash ^ (temp >> 24) hash = hash ^ temp return hash
References[]
- ↑ Riot Staff, League of Legends Official Forum, https://web.archive.org/web/0/http://na.leagueoflegends.com/board/showthread.php?t=701772
- ↑ RFC 1950, ZLIB Compressed Data Format Specification version 3.3