Changes

Jump to navigation Jump to search
→‎Go further: refactor into FAQs section, tweaks
Line 171: Line 171:  
# If all else fails, come ask for help in the [[Modding:Community#Discord|#modding in the Stardew Valley Discord]]. :)
 
# If all else fails, come ask for help in the [[Modding:Community#Discord|#modding in the Stardew Valley Discord]]. :)
   −
==Go further==
+
==FAQs==
===SMAPI APIs===
+
===Where's the SMAPI documentation?===
SMAPI provides a set of APIs you can use to do more. See [[Modding:Modder Guide/APIs|SMAPI reference]] for more info.
+
This is just the 'getting started' tutorial. For more documentation, see the [[Modding:Modder Guide/APIs|SMAPI reference]] and the [[Modding:Index|topics listed on the index page]].
   −
===Crossplatform support===
+
===How do I make my mod work crossplatform?===
SMAPI will automatically adjust your mod so it works on Linux, Mac, and Windows. However, there are a few things you should do to avoid problems:
+
SMAPI will automatically adjust your mod so it works on Linux, MacOS, and Windows. However, there are a few things you should do to avoid problems:
    
<ol>
 
<ol>
Line 184: Line 184:     
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
// ✘ Don't do this! It will crash on Linux/Mac.
+
// ✘ Don't do this! It won't work on Linux/Mac.
string path = this.Helper.DirectoryPath + "\assets\asset.xnb";
+
string path = this.Helper.DirectoryPath + "\assets\image.png";
    
// ✓ This is OK
 
// ✓ This is OK
string path = Path.Combine(this.Helper.DirectoryPath, "assets", "asset.xnb");
+
string path = Path.Combine(this.Helper.DirectoryPath, "assets", "image.png");
 
</syntaxhighlight></li>
 
</syntaxhighlight></li>
   Line 202: Line 202:  
</ol>
 
</ol>
   −
===Decompile the game code===
+
===How do I decompile the game code?===
It's often useful to see how the game code works. The game code is compiled into the <tt>StardewValley.exe</tt> (i.e. converted to a machine-readable format), but you can decompile it get a mostly-readable approximation of the original code. (This won't be fully functional due to decompiler limitations, but you'll be able to see what it's doing.)
+
It's often useful to see how the game code works. The game code is compiled into <tt>StardewValley.exe</tt> (i.e. converted to a machine-readable format), but you can decompile it get a mostly-readable approximation of the original code. (This might not be fully functional due to decompiler limitations, but you'll be able to see what it's doing.)
   −
To decompile the game code:
+
To decompile the game code...
   −
* On Windows:
+
; On Windows&#58;
*# First-time setup:
+
:# First-time setup:
*## Install the latest {{github|icsharpcode/ILSpy/releases|ILSpy}} release (get the "ILSpy_binaries" file under assets).
+
:## Install the latest {{github|icsharpcode/ILSpy/releases|ILSpy}} release (get the "ILSpy_binaries" file under assets).
*## Open ILSpy.
+
:## Open ILSpy.
*## Click ''View > Options'', scroll to the "Other" section at the bottom, and enable "Always qualify member references".
+
:## Click ''View > Options'', scroll to the "Other" section at the bottom, and enable "Always qualify member references".
*# Open <tt>StardewValley.exe</tt> in ILSpy.
+
:# Open <tt>StardewValley.exe</tt> in ILSpy.
*# Right-click on ''Stardew Valley'' and choose ''Save Code'' to create a decompiled project you can open in Visual Studio.
+
:# Right-click on ''Stardew Valley'' and choose ''Save Code'' to create a decompiled project you can open in Visual Studio.
* On Linux/Mac:
+
 
*# Install [https://code.visualstudio.com/download Visual Studio Code].
+
; On Linux/MacOS&#58;
*# Get the [https://marketplace.visualstudio.com/items?itemName=icsharpcode.ilspy-vscode ILSpy .NET Decompiler] plugin for VSCode.
+
:# Install [https://code.visualstudio.com/download Visual Studio Code].
*# Open the Visual Studio Code Command Palette (<code>Command+Shift+P</code>), then type <code>ilspy</code> to show the two commands.
+
:# Get the [https://marketplace.visualstudio.com/items?itemName=icsharpcode.ilspy-vscode ILSpy .NET Decompiler] plugin for VSCode.
*# Choose ''Decompile IL Assembly (pick file)'', then choose the <tt>StardewValley.exe</tt> in your [[Modding:Player Guide/Getting Started#Find your game folder|game folder]].
+
:# Open the Visual Studio Code Command Palette (<code>Command+Shift+P</code>), then type <code>ilspy</code> to show the two commands.
*# A tree view named <tt>ILSPY DECOMPILED MEMBERS</tt> should appear in the Explorer view. This lets you expand and select various nodes to see the decompiled C# code in the editor.
+
:# Choose ''Decompile IL Assembly (pick file)'', then choose the <tt>StardewValley.exe</tt> in your [[Modding:Player Guide/Getting Started#Find your game folder|game folder]].
 +
:# A tree view named <tt>ILSPY DECOMPILED MEMBERS</tt> should appear in the Explorer view. This lets you expand and select various nodes to see the decompiled C# code in the editor.
    
To unpack the XNB data/image files, see [[Modding:Editing XNB files]].
 
To unpack the XNB data/image files, see [[Modding:Editing XNB files]].
translators
8,445

edits

Navigation menu