Changes

m
Text replacement - "tt>" to "samp>"
Line 5: Line 5:  
==Intro==
 
==Intro==
 
===What are XNB files?===
 
===What are XNB files?===
The game stores data, maps, and textures in a compressed format with the <tt>.xnb</tt> file extension inside its <tt>Content</tt> folder. For example, Abigail's portrait shown during dialogue is from <tt>Content\Portraits\Abigail.xnb</tt>. Unpacking that file gives you an <tt>Abigail.png</tt> like this:<br />[[File:Modding - creating an XNB mod - example portraits.png]]
+
The game stores data, maps, and textures in a compressed format with the <samp>.xnb</samp> file extension inside its <samp>Content</samp> folder. For example, Abigail's portrait shown during dialogue is from <samp>Content\Portraits\Abigail.xnb</samp>. Unpacking that file gives you an <samp>Abigail.png</samp> like this:<br />[[File:Modding - creating an XNB mod - example portraits.png]]
   −
(When using xnbcli, you may get an extra <tt>Abigail.json</tt> file. That's only used to convert it back into an <tt>.xnb</tt> later, and you generally won't need to change it.)
+
(When using xnbcli, you may get an extra <samp>Abigail.json</samp> file. That's only used to convert it back into an <samp>.xnb</samp> later, and you generally won't need to change it.)
    
===How do I get my changes in the game?===
 
===How do I get my changes in the game?===
Line 20: Line 20:     
==<span id="unpacking">Unpack game files</span>==
 
==<span id="unpacking">Unpack game files</span>==
You can't edit an <tt>.xnb</tt> file itself, you need to edit the file that's inside it. Pulling out that inner file is called ''unpacking'', and putting it back is called ''packing''. There are two main XNB unpackers available.
+
You can't edit an <samp>.xnb</samp> file itself, you need to edit the file that's inside it. Pulling out that inner file is called ''unpacking'', and putting it back is called ''packing''. There are two main XNB unpackers available.
    
===StardewXnbHack===
 
===StardewXnbHack===
{{github|Pathoschild/StardewXnbHack#readme|StardewXnbHack}} is an open-source and crossplatform tool for unpacking XNB files. It can't pack files back into <tt>.xnb</tt>, but you [[Modding:Content Patcher|rarely need to]].
+
{{github|Pathoschild/StardewXnbHack#readme|StardewXnbHack}} is an open-source and crossplatform tool for unpacking XNB files. It can't pack files back into <samp>.xnb</samp>, but you [[Modding:Content Patcher|rarely need to]].
    
Here's how:
 
Here's how:
    
# [[Modding:Player Guide/Getting Started|Install SMAPI]].
 
# [[Modding:Player Guide/Getting Started|Install SMAPI]].
# {{github|Pathoschild/StardewXnbHack/releases|Download StardewXnbHack}}. (Make sure you download the file for your OS, such as <tt>StardewXnbHack-*-for-windows.zip</tt>, not the source code!)
+
# {{github|Pathoschild/StardewXnbHack/releases|Download StardewXnbHack}}. (Make sure you download the file for your OS, such as <samp>StardewXnbHack-*-for-windows.zip</samp>, not the source code!)
# Unzip the download into [[Modding:Game folder|your game folder]], so <tt>StardewXnbHack.exe</tt> is in the same folder as <tt>StardewValley.exe</tt>.
+
# Unzip the download into [[Modding:Game folder|your game folder]], so <samp>StardewXnbHack.exe</samp> is in the same folder as <samp>StardewValley.exe</samp>.
# Double-click <tt>StardewXnbHack.exe</tt> (on Windows), <tt>StardewXnbHack.sh</tt> (on Linux), or <tt>StardewXnbHack.command</tt> (on MacOS) to unpack your game's entire <tt>Content</tt> folder.
+
# Double-click <samp>StardewXnbHack.exe</samp> (on Windows), <samp>StardewXnbHack.sh</samp> (on Linux), or <samp>StardewXnbHack.command</samp> (on MacOS) to unpack your game's entire <samp>Content</samp> folder.
   −
That's it! It'll unpack the files into a <tt>Content (unpacked)</tt> folder. The unpacked files will already be compatible with [[Modding:Content Patcher|Content Patcher]].
+
That's it! It'll unpack the files into a <samp>Content (unpacked)</samp> folder. The unpacked files will already be compatible with [[Modding:Content Patcher|Content Patcher]].
    
===xnbcli===
 
===xnbcli===
{{github|LeonBlade/xnbcli#readme|xnbcli}} is an open-source and crossplatform tool for packing and unpacking XNB files. It can't unpack XNB files containing data models (like <tt>Data\FishPondData</tt> or <tt>Data\Movies</tt>), and you'll need to edit data files manually to work with mods like Content Patcher.
+
{{github|LeonBlade/xnbcli#readme|xnbcli}} is an open-source and crossplatform tool for packing and unpacking XNB files. It can't unpack XNB files containing data models (like <samp>Data\FishPondData</samp> or <samp>Data\Movies</samp>), and you'll need to edit data files manually to work with mods like Content Patcher.
    
Here's how:
 
Here's how:
    
<ol>
 
<ol>
<li>{{github|LeonBlade/xnbcli/releases|Download xnbcli}}. (Make sure you download the file for your OS, such as <tt>xnbcli-windows-x64.zip</tt>, not the source code!)</li>
+
<li>{{github|LeonBlade/xnbcli/releases|Download xnbcli}}. (Make sure you download the file for your OS, such as <samp>xnbcli-windows-x64.zip</samp>, not the source code!)</li>
 
<li>Unpack the file for editing:
 
<li>Unpack the file for editing:
# Find the file you want to edit in the [[Modding:Player Guide/Getting Started#Find your game folder|game's <tt>Content</tt> folder]].
+
# Find the file you want to edit in the [[Modding:Player Guide/Getting Started#Find your game folder|game's <samp>Content</samp> folder]].
# Copy it into xnbcli's <tt>packed</tt> folder.
+
# Copy it into xnbcli's <samp>packed</samp> folder.
# Double-click <tt>unpack.bat</tt> (Windows), <tt>unpack.sh</tt> (Linux), or <tt>unpack.command</tt> (Mac).
+
# Double-click <samp>unpack.bat</samp> (Windows), <samp>unpack.sh</samp> (Linux), or <samp>unpack.command</samp> (Mac).
# Check the <tt>Unpacked</tt> folder for your unpacked files. (If you didn't unpack many files, it may just flash onscreen and disappear again, but that's normal! Check the folder for your changes anyway. Note that 1.4 introduced a new data model format that xnbcli can't handle; for some data files you'll need to use [[#StardewXnbHack|StardewXnbHack]] instead.)
+
# Check the <samp>Unpacked</samp> folder for your unpacked files. (If you didn't unpack many files, it may just flash onscreen and disappear again, but that's normal! Check the folder for your changes anyway. Note that 1.4 introduced a new data model format that xnbcli can't handle; for some data files you'll need to use [[#StardewXnbHack|StardewXnbHack]] instead.)
 
</li>
 
</li>
 
<li>Edit the unpacked file (see below).</li>
 
<li>Edit the unpacked file (see below).</li>
Line 88: Line 88:  
*# Open a terminal. (In MacOS, search 'Terminal' in Spotlight.)
 
*# Open a terminal. (In MacOS, search 'Terminal' in Spotlight.)
 
*# Type <code>chmod +x&nbsp;</code>, ''with a space at the end''. Don't press enter yet.
 
*# Type <code>chmod +x&nbsp;</code>, ''with a space at the end''. Don't press enter yet.
*# Drag the <tt>unpack.sh</tt> (Linux) or <tt>unpack.command</tt> (Mac) file onto the terminal to paste its path.
+
*# Drag the <samp>unpack.sh</samp> (Linux) or <samp>unpack.command</samp> (Mac) file onto the terminal to paste its path.
 
*# Hit enter. If you did it correctly, the terminal won't show any message but the permission error should be gone.
 
*# Hit enter. If you did it correctly, the terminal won't show any message but the permission error should be gone.
*# Repeat for <tt>pack.sh</tt> (Linux) or <tt>pack.command</tt> (Mac).
+
*# Repeat for <samp>pack.sh</samp> (Linux) or <samp>pack.command</samp> (Mac).
 
* If you get unrecognized command on Windows:
 
* If you get unrecognized command on Windows:
 
*# Make sure you didn't download the source code zip by mistake. If the folder path refers to "master", it's the wrong one!
 
*# Make sure you didn't download the source code zip by mistake. If the folder path refers to "master", it's the wrong one!
    
==Pack game files==
 
==Pack game files==
There's no need to repack game files if you're using [[Modding:Content Patcher|Content Patcher]]! Just use the <tt>.json</tt>, <tt>.png</tt>, or <tt>.tbin</tt> file directly in your <tt>content.json</tt>.
+
There's no need to repack game files if you're using [[Modding:Content Patcher|Content Patcher]]! Just use the <samp>.json</samp>, <samp>.png</samp>, or <samp>.tbin</samp> file directly in your <samp>content.json</samp>.
    
If you really want to repack the files, you'll need to use [[#xnbcli|xnbcli]]:
 
If you really want to repack the files, you'll need to use [[#xnbcli|xnbcli]]:
    
# Find the file you want to repack.
 
# Find the file you want to repack.
# Copy it into xnbcli's <tt>unpacked</tt> folder.
+
# Copy it into xnbcli's <samp>unpacked</samp> folder.
# Double-click <tt>pack.bat</tt> (Windows), <tt>pack.sh</tt> (Linux), or <tt>pack.command</tt> (Mac).
+
# Double-click <samp>pack.bat</samp> (Windows), <samp>pack.sh</samp> (Linux), or <samp>pack.command</samp> (Mac).
# Move the repacked <tt>.xnb</tt> file back to the original location.
+
# Move the repacked <samp>.xnb</samp> file back to the original location.
    
==Making changes==
 
==Making changes==
Line 111: Line 111:  
[[File:Modding - creating an XNB mod - example tilesheet.png|thumb|An example tilesheet, which consists of a grid of tiles like this: [[File:Modding - creating an XNB mod - example tile 1.png]]]]
 
[[File:Modding - creating an XNB mod - example tilesheet.png|thumb|An example tilesheet, which consists of a grid of tiles like this: [[File:Modding - creating an XNB mod - example tile 1.png]]]]
 
A few definitions:
 
A few definitions:
* A '''spritesheet''' is a PNG file containing small images (usually in a regular grid pattern). Each square in the spritesheet's grid pattern is called a '''sprite'''. For example, each in-game item has a sprite in <tt>Content\Maps\spring_objects.xnb</tt>.
+
* A '''spritesheet''' is a PNG file containing small images (usually in a regular grid pattern). Each square in the spritesheet's grid pattern is called a '''sprite'''. For example, each in-game item has a sprite in <samp>Content\Maps\spring_objects.xnb</samp>.
 
* A '''tilesheet''' is a synonym for spritesheet when used for map tiles. In a tilesheet, each square is called a ''tile'' and is 16×16 pixels.
 
* A '''tilesheet''' is a synonym for spritesheet when used for map tiles. In a tilesheet, each square is called a ''tile'' and is 16×16 pixels.
* A '''portrait''' is a sprite from the <tt>Content\Characters\*.xnb</tt> spritesheets.
+
* A '''portrait''' is a sprite from the <samp>Content\Characters\*.xnb</samp> spritesheets.
    
Spritesheets are easy to edit:
 
Spritesheets are easy to edit:
 
# [[#unpacking|Unpack the file]] you want to change.
 
# [[#unpacking|Unpack the file]] you want to change.
# Open the unpacked <tt>.png</tt> file in an image editor (like [http://www.getpaint.net/download.html Paint.NET] on Windows, or [https://www.gimp.org/downloads/ GIMP] on Windows/Linux/Mac).  ''Note that it's important to use an image editor that can handle transparency (a.k.a. an alpha channel), unlike Microsoft Paint.''
+
# Open the unpacked <samp>.png</samp> file in an image editor (like [http://www.getpaint.net/download.html Paint.NET] on Windows, or [https://www.gimp.org/downloads/ GIMP] on Windows/Linux/Mac).  ''Note that it's important to use an image editor that can handle transparency (a.k.a. an alpha channel), unlike Microsoft Paint.''
 
# Make changes directly to the image.
 
# Make changes directly to the image.
 
# [[#unpacking|Repack the file]] and copy it back to the original location.
 
# [[#unpacking|Repack the file]] and copy it back to the original location.
106,307

edits