Difference between revisions of "Modding:Migrate to 64-bit on Windows"

From Stardew Valley Wiki
Jump to navigation Jump to search
(→‎Download Linux version: Add link to my video on using DepotDownloader + patching + SMAPI installation)
(→‎Enable 64-bit mode: keep old instructions for historical interest)
 
(8 intermediate revisions by 5 users not shown)
Line 7: Line 7:
 
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.
 
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 <tt>OutOfMemoryException</tt> crashes. Changing the game to 64-bit unlocks access to all available memory to avoid that (if the computer itself has enough memory available).
+
32-bit is fine for most players, but those with a large number of mods (or large mods) can experience <samp>OutOfMemoryException</samp> 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?===
 
===Do I need 64-bit?===
You only need this if you play on Windows and experience <tt>OutOfMemoryException</tt> crashes. Otherwise you can just use the default versions, which are simpler and work fine.
+
You only need this if you play on Windows and experience <samp>OutOfMemoryException</samp> crashes. Otherwise you can just use the default versions, which are simpler and work fine.
  
 
===Will SMAPI drop 32-bit support?===
 
===Will SMAPI drop 32-bit support?===
Line 28: Line 28:
  
 
<dl>
 
<dl>
<dt>Review <tt>TargetPlatform</tt> constants</dt>
+
<dt>Review <samp>TargetPlatform</samp> constants</dt>
<dd>[[Modding:Modder Guide/APIs/Utilities#Constants|<tt>Constants.TargetPlatform</tt>]] 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 <tt>Constants.GameFramework</tt> instead.</dd>
+
<dd>[[Modding:Modder Guide/APIs/Utilities#Constants|<samp>Constants.TargetPlatform</samp>]] 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 <samp>Constants.GameFramework</samp> instead.</dd>
  
 
<dt>Don't target x86</dt>
 
<dt>Don't target x86</dt>
 
<dd>
 
<dd>
New mod projects target <tt>Any CPU</tt> by default. If you explicitly changed it to <tt>x86</tt>, you'll need to change it back to <tt>Any CPU</tt> to avoid errors for 64-bit players.
+
New mod projects target <samp>Any CPU</samp> by default. If you explicitly changed it to <samp>x86</samp>, you'll need to change it back to <samp>Any CPU</samp> to avoid errors for 64-bit players.
  
 
To fix affected mods:
 
To fix affected mods:
 
<ol>
 
<ol>
<li>In each mod's <tt>.csproj</tt> project file, remove these lines if present:
+
<li>In each mod's <samp>.csproj</samp> project file, remove these lines if present:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
     <Platforms>x86</Platforms>
 
     <Platforms>x86</Platforms>
Line 43: Line 43:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If the mod uses the old project format (i.e. there's no <code><nowiki><Project Sdk="Microsoft.NET.Sdk"></nowiki></code> at the top), see [https://docs.microsoft.com/en-ca/visualstudio/ide/how-to-configure-projects-to-target-platforms ''How to: Configure projects to target platforms''] to set the platform to <tt>Any CPU</tt>.
+
If the mod uses the old project format (''i.e.,'' there's no <code><nowiki><Project Sdk="Microsoft.NET.Sdk"></nowiki></code> at the top), see [https://docs.microsoft.com/en-ca/visualstudio/ide/how-to-configure-projects-to-target-platforms ''How to: Configure projects to target platforms''] to set the platform to <samp>Any CPU</samp>.
 
</li>
 
</li>
 
<li>Fully exit Visual Studio.</li>
 
<li>Fully exit Visual Studio.</li>
<li>In the <tt>.sln</tt> solution file, replace all instances of <tt>x86</tt> with <tt>Any CPU</tt>.</li>
+
<li>In the <samp>.sln</samp> solution file, replace all instances of <samp>x86</samp> with <samp>Any CPU</samp>.</li>
 
</ol>
 
</ol>
 
</dd>
 
</dd>
  
 
==Enable 64-bit mode==
 
==Enable 64-bit mode==
===Download Linux version===
+
The latest {{version|1.5.5|Stardew Valley 1.5.5}} is officially 64-bit, so you don't need to do anything else to enable it.
First you'll need a separate Linux version of the game. To download it, follow the instructions for your game platform below.
+
 
 +
{{collapse|obsolete instructions (August to November 2021)|content=
 +
The Stardew Valley 1.5.5 beta is [https://forums.stardewvalley.net/threads/important-announcement-for-modders-stardew-valley-64-bit.8669/ officially 64-bit].
 +
 
 +
To enable the beta:
 +
# Open the Steam client. (The beta isn't available on GOG currently.)
 +
# Right-click ''Stardew Valley'' and choose ''Properties''.
 +
# Click the ''Betas'' tab.
 +
# Change the dropdown to <samp>monogame64bit</samp>. (Ignore the 'check code' box.)
 +
 
 +
You'll also need the [https://smapi.io/ SMAPI 3.13.0-beta] to play with mods.}}
 +
 
 +
{{collapse|obsolete instructions (March to August 2021)|content=
 +
<table style="width: 95%; background-color: rgba(255,192,203,0.8); border: 3px solid maroon; border-radius: 12px; padding: 6px; margin: 0 auto 12px auto;">
 +
<tr>
 +
<td><span style="font-size: larger;">'''These instructions are obsolete and kept for historical interest.'''</span><br />Unofficial 64-bit is not compatible with newer SMAPI versions.</td>
 +
</tr>
 +
</table>
 +
 
 +
<div style="font-size: larger;">'''Download Linux version'''</div>
 +
First you'll need a separate Linux version of the game. To download it, follow the instructions for your game platform below. [https://www.youtube.com/watch?v=_qij_OlZmis Here's a video explaining the steps.]
  
 
; From Steam
 
; From Steam
Line 60: Line 80:
 
:# The downloaded game path is shown in the Steam console.
 
:# The downloaded game path is shown in the Steam console.
  
''Alternatively'', if you're comfortable with the command line, you can use the [https://github.com/SteamRE/DepotDownloader '''DepotDownloader''' open source tool]. In this case, the downloaded folder will be under the <code>depots</code> folder, which itself will be created under whatever folder you were in when you run the tool. [https://www.youtube.com/watch?v=_qij_OlZmis Here's a video explaining the steps.]
+
''Alternatively'', if you're comfortable with the command line, you can use the [https://github.com/SteamRE/DepotDownloader '''DepotDownloader''' open source tool]. In this case, the downloaded folder will be under the <code>depots</code> folder, which itself will be created under whatever folder you were in when you run the tool.
  
 
; From GOG
 
; From GOG
 
:# Install Python through the Microsoft Store.
 
:# Install Python through the Microsoft Store.
 
:# From your [https://www.gog.com/account GOG web library]: click Stardew Valley, change the ''System'' dropdown to Linux, and download the installer file shown in the list.
 
:# From your [https://www.gog.com/account GOG web library]: click Stardew Valley, change the ''System'' dropdown to Linux, and download the installer file shown in the list.
:# Download <tt>gogextract.py</tt> from {{github|Yepoleb/gogextract|Yepoleb/gogextract}} into the folder containing the above download.
+
:# Download <samp>gogextract.py</samp> from {{github|Yepoleb/gogextract|Yepoleb/gogextract}} into the folder containing the above download.
:# Open a command prompt in the same folder and run this command (correcting the <tt>.sh</tt> filename if needed): <pre>python gogextract.py stardew_valley_1_5_4_981587505_44377.sh stardew-valley-installer</pre>
+
:# Open a command prompt in the same folder and run this command (correcting the <samp>.sh</samp> filename if needed): <pre>python gogextract.py stardew_valley_1_5_4_981587505_44377.sh stardew-valley-installer</pre>
:# In the extracted folder, unzip <tt>data.zip</tt>.
+
:# In the extracted folder, unzip <samp>data.zip</samp>.
:# The downloaded game is in the extracted <tt>data/noarch/game</tt> folder.
+
:# The downloaded game is in the extracted <samp>data/noarch/game</samp> folder.
  
===Install guide===
+
<div style="font-size: larger;">'''Install guide'''</div>
 
# Update all your mods to their latest versions (they might add 64-bit support).
 
# Update all your mods to their latest versions (they might add 64-bit support).
 
# [[#Download Linux version|Download the Linux version]] if you haven't already.<br />'''This is downloaded into a <u>separate</u> folder. Use the downloaded folder path for the steps below, ''not'' the original game folder.'''
 
# [[#Download Linux version|Download the Linux version]] if you haven't already.<br />'''This is downloaded into a <u>separate</u> folder. Use the downloaded folder path for the steps below, ''not'' the original game folder.'''
Line 82: Line 102:
 
That's it! Now run <code>StardewModdingAPI.exe</code> in the downloaded game folder, and the game should be 64-bit!
 
That's it! Now run <code>StardewModdingAPI.exe</code> in the downloaded game folder, and the game should be 64-bit!
  
==Troubleshooting==
+
<div style="font-size: larger;">'''Troubleshooting'''</div>
 
; Screen tearing
 
; Screen tearing
 
: Some players report [[wikipedia:Screen tearing|screen tearing]] in 64-bit mode. Common fixes:
 
: Some players report [[wikipedia:Screen tearing|screen tearing]] in 64-bit mode. Common fixes:
Line 89: Line 109:
  
 
; "''Unhandled exception: System.Reflection.TargetInvocationException: [...] Could not load file or assembly 'SMAPI.Toolkit[...]''"
 
; "''Unhandled exception: System.Reflection.TargetInvocationException: [...] Could not load file or assembly 'SMAPI.Toolkit[...]''"
: Make sure you run <tt>StardewModdingAPI.exe</tt>, ''not'' <tt>StardewValley.exe</tt>. The 64-bit version of the game won't work without SMAPI.
+
: Make sure you run <samp>StardewModdingAPI.exe</samp>, ''not'' <samp>StardewValley.exe</samp>. The 64-bit version of the game won't work without SMAPI.
  
 
; Help with other issues
 
; Help with other issues
 
: See [[Modding:Help]] for the best places to ask.
 
: 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.
 
: 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.
 +
}}
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 +
[[zh:模组:在_Windows_上使用_64_位游戏]]

Latest revision as of 21:40, 14 December 2021

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

The latest Stardew Valley 1.5.5 is officially 64-bit, so you don't need to do anything else to enable it.

obsolete instructions (August to November 2021) 
The Stardew Valley 1.5.5 beta is officially 64-bit.

To enable the beta:

  1. Open the Steam client. (The beta isn't available on GOG currently.)
  2. Right-click Stardew Valley and choose Properties.
  3. Click the Betas tab.
  4. Change the dropdown to monogame64bit. (Ignore the 'check code' box.)

You'll also need the SMAPI 3.13.0-beta to play with mods.

obsolete instructions (March to August 2021) 
These instructions are obsolete and kept for historical interest.
Unofficial 64-bit is not compatible with newer SMAPI versions.
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. Here's a video explaining the steps.

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.

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.