Modding:Migrate to 64-bit on Windows

From Stardew Valley Wiki
Revision as of 18:41, 6 May 2021 by Pathoschild (talk | contribs) (→‎Enable 64-bit mode: + troubleshooting for screen tearing)
Jump to navigation Jump to search

Index

This page explains how to enable 64-bit Stardew Valley.

For players

What does 64-bit mean?

The game's bitness affects how much memory it can use: ≈3GB in the normal 32-bit mode, and unlimited in 64-bit mode. 32-bit is fine for most players, but those with a large number of mods (or large mods) can experience OutOfMemoryException crashes. Changing the game to 64-bit unlocks access to all available memory to avoid that (if the computer itself has enough memory available).

Do I need 64-bit?

You only need this if you play on Windows and experience OutOfMemoryException crashes. Otherwise you can just use the default versions, which are simpler and work fine.

Will SMAPI drop 32-bit support?

SMAPI will always support the official version of the game, which is currently 32-bit on Windows. The SMAPI installer automatically detects whether you have a 32-bit or 64-bit version of the game.

How do I enable 64-bit mode?

See enable 64-bit mode below.

For mod authors

See for players above for general info.

Is this the modapocalypse?

Nope. The vast majority of players will use the normal 32-bit version. This will only affect players who explicitly go through the process to make the game 64-bit, and most mods are already compatible with 64-bit mode.

How do I update mod code for 64-bit?

Most SMAPI mods will work in both 32-bit and 64-bit mode already, and content packs don't need to do anything (they're compatible if the SMAPI mod loading them is). For SMAPI mods, there are two main requirements for 64-bit compatibility:

Review TargetPlatform constants
Constants.TargetPlatform indicates whether the mod is running on Android, Linux, MacOS, or Windows. If you use this to distinguish between XNA Framework (on Windows) and MonoGame (on other platforms), you should use the new Constants.GameFramework instead.
Don't target x86
New mod projects target Any CPU by default. If you explicitly changed it to x86, you'll need to change it back to Any CPU to avoid errors for 64-bit players. To fix affected mods:
  1. In each mod's .csproj project file, remove these lines if present:
        <Platforms>x86</Platforms>
        <PlatformTarget>x86</PlatformTarget>
    

    If the mod uses the old project format (i.e. there's no <Project Sdk="Microsoft.NET.Sdk"> at the top), see How to: Configure projects to target platforms to set the platform to Any CPU.

  2. Fully exit Visual Studio.
  3. In the .sln solution file, replace all instances of x86 with Any CPU.

Enable 64-bit mode

Caveats

  • This requires Windows (the Linux/macOS versions are already 64-bit).
  • These instructions require the Steam version of the game. (The process will work with GOG too, but getting the Linux version from GOG isn't documented yet.)
  • 64-bit mode for Stardew Valley is unofficial. Don't report bugs to the game developers unless you can reproduce them with the normal game version.

Install guide

  1. Update all your mods to their latest versions. (Newer versions may add 64-bit support.)
  2. Download the Linux version of the game:
    1. Go to steam://nav/console in your browser to open the Steam console.
    2. Run this command: download_depot 413150 413153
    3. Wait for the download to finish.
      This may take a long time and won't show any download progress. Eventually the console will say "Depot download complete" and show the downloaded folder path.
    4. The Linux version is now downloaded into a separate folder. Use the folder path shown in the Steam console for the steps below, not the original game folder.
  3. Make Stardew Valley 64-bit:
    1. Download and unzip the latest Stardew64Installer release.
    2. Double-click the Stardew64Installer.exe file and follow the on-screen instructions.
  4. Install SMAPI 64-bit:
    1. Download and unzip SMAPI 3.10 or later.
    2. Run the SMAPI installer in the downloaded game folder.

That's it! Now run StardewModdingAPI.exe in the downloaded game folder, and the game should be 64-bit!

Troubleshooting

How do I fix screen tearing?
Some players report screen tearing in 64-bit mode. Common fixes:
  • Make sure VSync is enabled in the in-game options menu (in the Graphics section).
  • Play in windowed mode (not fullscreen, or windowed borderless). It's fine to resize the window to fit the screen.