Modding:Migrate to 64-bit on Windows

From Stardew Valley Wiki
Revision as of 14:14, 16 June 2021 by Pepoluan (talk | contribs) (→‎Download Linux version: Add link to my video on using DepotDownloader + patching + SMAPI installation)
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. Since the game is normally 32-bit, it shares the first ≈3GB of memory with every 32-bit app on your computer. In 64-bit mode, it has unlimited access to your computer's memory.

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

Download Linux version

First you'll need a separate Linux version of the game. To download it, follow the instructions for your game platform below.

From Steam
  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 downloaded game path is shown in the Steam console.

Alternatively, if you're comfortable with the command line, you can use the DepotDownloader open source tool. In this case, the downloaded folder will be under the depots folder, which itself will be created under whatever folder you were in when you run the tool. Here's a video explaining the steps.

From GOG
  1. Install Python through the Microsoft Store.
  2. From your GOG web library: click Stardew Valley, change the System dropdown to Linux, and download the installer file shown in the list.
  3. Download gogextract.py from Yepoleb/gogextract into the folder containing the above download.
  4. Open a command prompt in the same folder and run this command (correcting the .sh filename if needed):
    python gogextract.py stardew_valley_1_5_4_981587505_44377.sh stardew-valley-installer
  5. In the extracted folder, unzip data.zip.
  6. The downloaded game is in the extracted data/noarch/game folder.

Install guide

  1. Update all your mods to their latest versions (they might add 64-bit support).
  2. Download the Linux version if you haven't already.
    This is downloaded into a separate folder. Use the downloaded folder path 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 Windows 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

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.
"Unhandled exception: System.Reflection.TargetInvocationException: [...] Could not load file or assembly 'SMAPI.Toolkit[...]"
Make sure you run StardewModdingAPI.exe, not StardewValley.exe. The 64-bit version of the game won't work without SMAPI.
Help with other issues
See Modding:Help for the best places to ask.
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.