Remedy Archive System
From Just Solve the File Format Problem
Revision as of 15:30, 21 November 2025 by RavuAlHemio (Talk | contribs)
Remedy Archive System is used to store game data for Remedy Entertainment games such as Max Payne and Max Payne 2. The metadata (central directory) following the header is encrypted.
Contents |
Identification
Files begin with signature bytes 52 41 53 00.
Format details
The file's header has the following structure:
struct RASHeader {
uint8_t magic[4]; // "RAS\0"
uint32_t encryptionKey;
};
The next section of the header must be decrypted first:
// decrypted structure
struct RASMetadata {
};
Encryption
Depending on the generation of the RAS file format, different encryption schemes are used.
RAS1 (Max Payne)
function decrypt(data: byte[], key: uint32):
if key == 0:
key := 1
for i from 0 to data.length-1:
a := data[i]
b := i mod 5 -- such that 0 ≤ b < 5
c := rotateByteLeft(a by b)
d := key / 177
e := d * 30269
f := key * 171
key := f - e
g := i mod 256
h := g + 3
k := h * 6
m := k bitwiseXor data[i]
p := key mod 256 -- such that 0 ≤ p < 256
q := m + p
data[i] := q mod 256
If your programming language doesn't support the rotateLeft operation, it can be emulated using:
function rotateByteLeft(i by n): return (i bitShiftLeft n) bitwiseOr (i bitShiftRight (8 - n))