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.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 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.
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), 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
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.
|Magic Number||4|| A fixed value indicating this is a valid RAF file. The value is |
|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 |
|Path List Offset||4||The offset from the start of the |
|File List||*||A list of all of file entries.|
|Path List||*||A list of all the path entries.|
|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.|
|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 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 |
Path List Entry
|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.|
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
- ↑ Riot Staff, League of Legends Official Forum, http://na.leagueoflegends.com/board/showthread.php?t=701772
- ↑ RFC 1950, ZLIB Compressed Data Format Specification version 3.3