Support OpenKore:
Learn about
the Fund Pool

RGZ file format

Contents

Introduction

RGZ is the archive file format used by Ragnarok Online Patcher to distribute new files, like Music, etc.

Algorithms

RGZ files are files that are made by a RAT file compressed with zlib algorithm. The description below applies to RAT files, which are simply decompressed RGZ files. RGZ stands for RAT + GZip

Header

Every RGZ have the following header (After decompression, of course). For each file/directory inside RGZ, you have a new header.

struct RGZ_Entry {
    char type;
    int8 filenameLength;
    char filename[filenameLength];
    RGZ_File fileData;
};
type
Type of the next entry
d
Next entry is a directory
f
Next entry is a file
e
End of File.
filenameLength
Size of the next entry
filename[filenameLength]
Filename, terminating with a '\0' (NULL)
fileData
RGZ_File structure

RGZ_File Structure

Structure that hold the data an entry, inside a RGZ file.

struct RGZ_File {
    int32 length;
    char data[length];
}
length
Holds the entry size
data[length]
The entry data, itself.

Note: To finish the file, we have a "e" type on header, a "\x04" value on length and a "end\x00" on data