League of Legends Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!
You can even turn off ads in your preferences.

Come join the LoL Wiki community Discord server!

READ MORE

League of Legends Wiki
Register
No edit summary
(20 intermediate revisions by 10 users not shown)
Line 1: Line 1:
  +
: '''''RAF''' redirects here, for the reward program, see [[Refer-A-Friend]].''
  +
{{Tocright}}
  +
 
==Background==
 
==Background==
The game data that was previously found in HeroPak_client.zip has been moved into several .raf and .raf.dat files. These files are distributed throughout the subfolders in the following directory:
+
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 [[Champion skin|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 <code>HeroPak_client.zip</code>; since then the data has been moved into several <code>.raf</code> and <code>.raf.dat</code> files. These files are distributed throughout the subfolders in the following directory: <code><LoL Install Path>\RADS\projects\lol_game_client\filearchives\</code>
<LoL Install Path>/RADS/projects/lol_game_client/filearchives/
 
Riot released the format in a post on the official forums <ref>Riot Staff, League of Legends Official Forum, http://na.leagueoflegends.com/board/showthread.php?t=701772</ref> shortly after making the update.
 
   
 
[[Riot Games Inc.]] released the format in a post on the official forums<ref>Riot Staff, League of Legends Official Forum, http://na.leagueoflegends.com/board/showthread.php?t=701772</ref> 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 [http://en.wikipedia.org/wiki/Endianness 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<ref>RFC 1950, ZLIB Compressed Data Format Specification version 3.3</ref>), whereas the .raf contains the information about where to unpack the files. All [http://en.wikipedia.org/wiki/Offset_%28computer_science%29 offsets] and sizes are in bytes. Note values prefixed by "0x" indicate hexidecimal (base 16) notation.
 
 
== Format description ==
===<span style="font-weight: bold;">Overview of .raf file</span>===
 
 
Note that all values which are more than one byte are stored in [http://en.wikipedia.org/wiki/Endianness 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<ref>RFC 1950, ZLIB Compressed Data Format Specification version 3.3</ref>), whereas the .raf contains the information about where to unpack the files. All [http://en.wikipedia.org/wiki/Offset_%28computer_science%29 offsets] and sizes are in bytes. Values in a monospace font preceded by <code>0x</code> (e.g. <code>0x1a2b3c4d</code>) 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.
 
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.
  +
 
{| class="wikitable" style="width: 600px;"
 
{| class="wikitable" style="width: 600px;"
 
|-
 
|-
Line 16: Line 21:
 
| Magic Number
 
| Magic Number
 
| 4
 
| 4
| A fixed value indicating this is a valid RAF file. The value is (in Big Endian) 0x18be0ef0.
+
| A fixed value indicating this is a valid RAF file. The value is <code>0x18be0ef0</code>.
 
|-
 
|-
 
| Version
 
| Version
Line 28: Line 33:
 
| File List Offset
 
| File List Offset
 
| 4
 
| 4
| The offset from the start of the .raf file to the File List.
+
| The offset from the start of the <code>.raf</code> file to the File List.
 
|-
 
|-
 
| Path List Offset
 
| Path List Offset
 
|4
 
|4
|The offset from the start of the .raf file to the Path List.
+
|The offset from the start of the <code>.raf</code> file to the Path List.
 
|-
 
|-
 
| File List
 
| File List
Line 43: Line 48:
 
|}
 
|}
   
==='''File List'''===
+
=== File List ===
   
 
{| class="wikitable" style="width: 600px;"
 
{| class="wikitable" style="width: 600px;"
Line 60: Line 65:
 
|}
 
|}
   
==='''File Entry'''===
+
=== File Entry ===
 
{| class="wikitable" style="width: 600px;"
 
{| class="wikitable" style="width: 600px;"
 
|-
 
|-
Line 84: Line 89:
 
|}
 
|}
   
==='''Path List'''===
+
=== Path List ===
 
{| class="wikitable" style="width: 600px;"
 
{| class="wikitable" style="width: 600px;"
 
|-
 
|-
Line 105: Line 110:
 
| Path Strings
 
| Path Strings
 
| *
 
| *
| The literal ASCII-encoded path string. Note that all strings are null terminated (meaning the last byte of the string is 0x00).
+
| The literal ASCII-encoded path string. Note that all strings are null terminated (meaning the last byte of the string is <code>0x00</code>).
 
|}
 
|}
   
==='''Path List Entry'''===
+
=== Path List Entry ===
 
{| class="wikitable" style="width: 600px;"
 
{| class="wikitable" style="width: 600px;"
 
|-
 
|-
Line 124: Line 129:
 
|}
 
|}
   
==Hash Function==
+
== Hash Function ==
The hash function is described below in psuedo code. Note that strings here are ASCII-encoded, meaning each character is exactly one byte. The type uint32 represents a 32-bit [http://en.wikipedia.org/wiki/Signed_number_representations unsigned] integer. The ^ symbol is used to denote a 32-bit [http://en.wikipedia.org/wiki/Exclusive_or exclusive-or].
+
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 [http://en.wikipedia.org/wiki/Signed_number_representations unsigned] integer. The ^ symbol is used to denote a 32-bit [http://en.wikipedia.org/wiki/Exclusive_or exclusive-or].
   
 
<pre>
 
<pre>
Line 140: Line 145:
 
</pre>
 
</pre>
   
  +
== References ==
 
  +
{{Reflist}}
<references/>
 
[[Category:raf]]
+
[[Category:League of Legends]]
[[Category:game data]]
 

Revision as of 15:25, 1 February 2018

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

  1. Riot Staff, League of Legends Official Forum, http://na.leagueoflegends.com/board/showthread.php?t=701772
  2. RFC 1950, ZLIB Compressed Data Format Specification version 3.3