Red Dead Redemption 2

1. Introduction

I played Red Dead Redemption 1 on the PS3, back in 2011, and absolutely loved it. Well, Red Dead Redemption 2 (RDR2) was released a few years ago now, but this time I decided to wait for its PC release. I never did wind up buying a PS4 and rumours online are that RDR2 runs pretty well on Linux, via Proton, so why not?

Well, after damn near 200 hours, I’ve finally beaten it. It was a really incredible game and I had at least as much fun as I had played the first one. With Proton, it worked just about perfectly. Well, “perfectly” by Rockstar standards!

2. Proton

I played this game via Steam, using Proton v.6.3-5, specifically. I first tried v.5.13-6, but the game wouldn’t even start. 🤷 With v.6.3-5, it ran excellently.

2.1. Graphics

I played this 2018 game with a “GeForce RTX 2080 Ti” and was able to run almost every graphic setting on “Ultra” and maintain 60 fps at 2560x1440. Here are the ones I had to turn down:

Water Physics
80%
MSAA
Off. This one nuked performance for me.
Soft Shadows
High
Grass Shadows
High
Parallax Occlusion Quality
High
Tree Tesselation
Off. Looks pretty rad, but this game is lousy with trees.

2.2. File Locations

Like most games run via Wine, it can be pretty tough to track down game files. Here are some that I found:

File-type File path Notes
Save Games and in-game “photos” ~/​.local/​share/​Steam/​steamapps/​compatdata/​1174180/​pfx/​drive_c/​users/​steamuser/​My Documents/​Rockstar Games/​Red Dead Redemption 2/​Profiles/​74C62863/ 1. The final directory, 74C62863, may be different on your system. I think it’s your Rockstar user ID. 2. The save-game filenames are pretty blah, but the in-game save menu lists each file’s modified-timestamp. If you’re looking to backup a particular save-file, matching them based on timestamp is easiest.
Steam Screenshots ~/​.local/​share/​Steam/​userdata/​YOUR_STEAM_ID/​760/​remote/​1174180/​screenshots/ If you don’t know YOUR_STEAM_ID, there are websites that well tell it to you, but unless you’re at a net-cafe, there’s probably just one folder in this directory.
Keyboard Config In the “Save Games” directory: KeyMappings This is a binary file, but it’s mostly ASCII XML. You can probably edit it by hand if you’re careful.

2.3. Encountered bugs

  • Every 10-15 hours of play, the game would simply freeze. I would need to switch back to Steam (or htop) and kill the process. This was rare enough not to bother me too much, but it did sometimes require me to replay the last 15 minutes of some mission.
  • There was exactly one mission that would crash every single time for me: Country Pursuits. After 3-4 attempts, I decided to try lowering the graphic settings to medium. With that, I was able to beat the mission. Afterwards, I set the graphics back to “almost-Ultra” and it was fine from then on.
  • This isn’t really a bug, but. I have hotkeys which jump the mouse cursor to my various screens. This is particularly useful for games that like to capture the mouse. However, when it loses focus, RDR2 remembers what modifier keys you had depressed. After pressing WIN+CTRL+2 to switch to my second monitor, upon returning to the game, CTRL would be “held-down” until I pressed it again.

3. Photo Mode

RDR2’s a really beautiful game, and it comes with an in-game photo-mode. It’s pretty rad, actually. You can pause the game, fly the camera around, monkey with the exposure and focal length, and snap some fun shots. COVID-19 absolutely destroyed my hobby as an amateur photographer, but I think this game’s photo-mode may have reignited my passion for it!

Unfortunately, it’s not actually very easy to access the photos you’ve taken in-game. They’re stored in the same directory as the save-game files, but each one is given an odd name with no file extension, like PRDR31455130003. They’re not any images that my system recognises though: they’re saved in some proprietary file format. The file command identifies them as “X11 SNF font data, MSB first.” That’s surely a goof though.

3.1. Convert in-game “photos” to JPEG

Fortunately, Reddit user “Elgghinnarisa” points out that if you rename these files with a .jpg extension, some apps can open them. This almost certainly means that these files are actual JPEG images, embedded in some kind of container along with Rockstar-metadata! If we write a script to find where the embedded JPEG starts and ends, we can yank it right out of there. With JPEGs, this is actually pretty easy.

A JPEG image consists of a sequence of segments, each beginning with a marker, each of which begins with a 0xFF byte, followed by a byte indicating what kind of marker it is.

Short name Bytes Name
SOI 0xFF 0xD8 Start Of Image
EOI 0xFF 0xD9 End Of Image

Wikipedia: JPEG

So all our script needs to do is:

  1. Skip every byte until we find 0xFFD8.
  2. Output those two bytes and every subsequent byte…
  3. Up to, and including 0xFFD9.

We actually don’t know the format of this proprietary Rockstar file, so it’s possible that 0xFFD8 appears somewhere in the file before the actual JPEG data starts, but I didn’t see that in my testing. If you hexdump one of these files, you’ll see the ASCII JPEG and JFIF mentioned early in the file. These aren’t magic numbers, so it’s possible that we can somehow extract the offset and length for the image data from around there. I didn’t dive into that though.

Here’s a simple script to extract these JPEGs. If this were an important app, C and Rust are typically better languages for iterating over a bunch of bytes, but we can knock out a simple ruby script in 10 minutes for a toy like this!

# Convert Red Dead Redemption 2 Photos to JPEG.
# Usage: ruby convert.rb < PRDR3834231157 > photo.jpg

prev_byte = 0x00
in_jpg = false

$stdin.each_byte do |byte|
  if in_jpg
    print byte.chr
    exit if byte == 0xD9 && prev_byte == 0xFF
  elsif byte == 0xD8 && prev_byte == 0xFF
    print "\xFF\xD8"
    in_jpg = true
  end
  prev_byte = byte
end

3.2. A better way to take photos

As great as the photo mode is, all the photos it captures are exported in 1080p. It doesn’t seem to matter what your in-game resolution is. Instead, setup your photo as you normally would, press the “Hide GUI” button, and use your OS to take the screenshot. If you use Steam, you can also pretty the F12 key to have Steam take the screenshot. See the table above for where you can find these Steam screenshots.

3.3. Some photos

rdr2-1.png
Figure 1: Some nerd enjoying a good book.
rdr2-2.jpg
Figure 2: This game has excellent lighting.
rdr2-3.jpg
Figure 3: An idyllic scene, undisturbed by the shootout at the adjacent fort.
rdr2-4.jpg
Figure 4: A carnival fire-breather showinng off more of the game’s lighting system.
rdr2-5.jpg
Figure 5: You can get some great shots if you adjust the exposure and contract settings.
rdr2-6.jpg
Figure 6: A valley.