Changes

→‎Enable 64-bit mode: keep old instructions for historical interest
Line 5: Line 5:  
==For players==
 
==For players==
 
===What does 64-bit mean?===
 
===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 <tt>OutOfMemoryException</tt> crashes. Changing the game to 64-bit unlocks access to all available memory, which avoids <tt>OutOfMemoryException</tt> errors (if the computer itself has enough memory available).
+
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 <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 20: Line 22:     
===Is this the modapocalypse?===
 
===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.
+
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?===
 
===How do I update mod code for 64-bit?===
Line 26: 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 41: 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==
{{SMAPI upcoming|3.10}}
+
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.
   −
===Caveats===
+
{{collapse|obsolete instructions (August to November 2021)|content=
* <span style="color: red;">'''SMAPI 64-bit isn't released yet, so you can't complete these instructions.'''</span>
+
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].
* 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===
+
To enable the beta:
'''Follow these instructions closely!''' You need a special version of the game.
+
# 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.)
   −
# Update all your mods to their latest versions. (Newer versions may add 64-bit support.)
+
You'll also need the [https://smapi.io/ SMAPI 3.13.0-beta] to play with mods.}}
# Download the Linux version of the game:
+
 
## Go to <code>steam://nav/console</code> in your browser to open the Steam console.
+
{{collapse|obsolete instructions (March to August 2021)|content=
## Run this command: <code>download_depot 413150 413153</code>
+
<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;">
## Wait for the download to finish.<br />''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.''
+
<tr>
## '''For the rest of the instructions, "depot folder" means this downloaded folder.'''
+
<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
 +
:# Go to <code>steam://nav/console</code> in your browser to open the Steam console.
 +
:# Run this command: <code>download_depot 413150 413153</code>
 +
:# Wait for the download to finish.<br />''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.''
 +
:# 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.
 +
 
 +
; From GOG
 +
:# 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.
 +
:# 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 <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 <samp>data.zip</samp>.
 +
:# The downloaded game is in the extracted <samp>data/noarch/game</samp> folder.
 +
 
 +
<div style="font-size: larger;">'''Install guide'''</div>
 +
# 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.'''
 
# Make Stardew Valley 64-bit:
 
# Make Stardew Valley 64-bit:
 
## Download and unzip the {{Github|Steviegt6/Stardew64Installer/releases|latest Stardew64Installer release}}.
 
## Download and unzip the {{Github|Steviegt6/Stardew64Installer/releases|latest Stardew64Installer release}}.
 
## Double-click the <code>Stardew64Installer.exe</code> file and follow the on-screen instructions.
 
## Double-click the <code>Stardew64Installer.exe</code> file and follow the on-screen instructions.
 
# Install SMAPI 64-bit:
 
# Install SMAPI 64-bit:
## <s>Download and unzip [https://smapi.io/ SMAPI 3.9.6 or later].</s><br />'''Note:''' 64-bit SMAPI is not released yet.
+
## Download and unzip [https://smapi.io/ SMAPI 3.10 or later].
## Run the SMAPI installer on the depot folder.<br />''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.''
+
## Run the Windows SMAPI installer in the downloaded game folder.
 +
 
 +
That's it! Now run <code>StardewModdingAPI.exe</code> in the downloaded game folder, and the game should be 64-bit!
 +
 
 +
<div style="font-size: larger;">'''Troubleshooting'''</div>
 +
; Screen tearing
 +
: Some players report [[wikipedia:Screen tearing|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.
   −
That's it! Now run <code>StardewModdingAPI.exe</code> in the depot folder, and the game should be 64-bit!
+
; "''Unhandled exception: System.Reflection.TargetInvocationException: [...] Could not load file or assembly 'SMAPI.Toolkit[...]''"
 +
: 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
 +
: 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.
 +
}}
    
[[Category:Modding]]
 
[[Category:Modding]]
 +
[[zh:模组:在_Windows_上使用_64_位游戏]]
translators
8,404

edits