Modding:Migrate to 64-bit on Windows

From Stardew Valley Wiki
Revision as of 01:41, 24 April 2021 by Pathoschild (talk | contribs) (→‎What does 64-bit mean?: copyedit for readability)
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, which avoids OutOfMemoryException errors (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 which 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

The following describes the upcoming SMAPI 3.10, and may change before release.

Caveats

  • SMAPI 64-bit isn't released yet, so you can't complete these instructions.
  • This requires Windows. (The game runs in 64-bit mode already on Linux/macOS.)
  • 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

Follow these instructions closely! You need a special version of the game.

  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 will download the Linux version of the game into a new folder. 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. For the rest of the instructions, "depot folder" means this downloaded 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.9.6 or later.
      Note: 64-bit SMAPI is not released yet.
    2. Run the SMAPI installer on the depot folder.
      Tip: if it chooses a different game folder, rename the detected folder temporarily and try it again; the installer should then ask for the game path.

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