Changes

Jump to navigation Jump to search
→‎Unpack & pack game files: cover unpacking/repacking for Content Patcher
Line 10: Line 10:  
Abigail.xnb
 
Abigail.xnb
 
   Abigail.png
 
   Abigail.png
   Abigail.yaml
+
   Abigail.json
 
</pre>
 
</pre>
   Line 16: Line 16:     
* <tt>Abigail.png</tt> contains Abigail's portraits. This is the file you would edit if you wanted to change her portraits in the game:<br />[[File:Modding - creating an XNB mod - example portraits.png]]
 
* <tt>Abigail.png</tt> contains Abigail's portraits. This is the file you would edit if you wanted to change her portraits in the game:<br />[[File:Modding - creating an XNB mod - example portraits.png]]
* <tt>Abigail.yaml</tt> contains metadata about <tt>Abigail.png</tt> (like what type of file it is). You don't need to worry about this file, since you generally won't be changing it.
+
* <tt>Abigail.json</tt> contains metadata about <tt>Abigail.png</tt> (like what type of file it is). You don't need to worry about this file, since you generally won't be changing it.
    
===How do I get my changes in the game?===
 
===How do I get my changes in the game?===
Line 28: Line 28:  
The Stardew Valley modding community is very welcoming. Feel free to [[Modding:Community|ask the community]] for help.
 
The Stardew Valley modding community is very welcoming. Feel free to [[Modding:Community|ask the community]] for help.
   −
==<span id="unpacking">Unpack & pack 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''. You can do that using xnbcli, a tool for packing and unpacking XNB files. It's [https://github.com/LeonBlade/xnbcli open-source] and natively crossplatform.
 
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''. You can do that using xnbcli, a tool for packing and unpacking XNB files. It's [https://github.com/LeonBlade/xnbcli open-source] and natively crossplatform.
    
Here's how:
 
Here's how:
   −
# Download [https://github.com/LeonBlade/xnbcli/releases xnbcli].
+
<ol>
# Unpack the file for editing:
+
<li>Download [https://github.com/LeonBlade/xnbcli/releases xnbcli].</li>
## Find the file you want to edit in the [[Modding:Player Guide/Getting Started#Find your game folder|game's <tt>Content</tt> folder]].
+
<li>Unpack the file for editing:
## Copy it into xnbcli's <tt>packed</tt> folder.
+
# Find the file you want to edit in the [[Modding:Player Guide/Getting Started#Find your game folder|game's <tt>Content</tt> folder]].
## Double-click <tt>unpack.bat</tt> (Windows), <tt>unpack.sh</tt> (Linux), or <tt>unpack.command</tt> (Mac).
+
# Copy it into xnbcli's <tt>packed</tt> folder.
# Edit the unpacked file (see below).
+
# Double-click <tt>unpack.bat</tt> (Windows), <tt>unpack.sh</tt> (Linux), or <tt>unpack.command</tt> (Mac).
# Repack the file for the game:
+
</li>
## Double-click <tt>pack.bat</tt> (Windows), <tt>pack.sh</tt> (Linux), or <tt>pack.command</tt> (Mac).
+
<li>Edit the unpacked file (see below).</li>
## Move the repacked <tt>.xnb</tt> file back to the original location.
+
<li>If this is a data file (not an image or map), there's one more step if you want to replace the file with {{nexus mod|1915|Content Patcher}}'s <tt>Action: Load</tt>: removing the XNB metadata. Your current JSON file should look something like this:
 +
<source lang="js">
 +
{
 +
    "header": {
 +
        "target": "w",
 +
        "formatVersion": 5,
 +
        "hidef": true,
 +
        "compressed": true
 +
    },
 +
    "readers": [
 +
        {
 +
            "type": "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]",
 +
            "version": 0
 +
        },
 +
        {
 +
            "type": "Microsoft.Xna.Framework.Content.Int32Reader",
 +
            "version": 0
 +
        },
 +
        {
 +
            "type": "Microsoft.Xna.Framework.Content.StringReader",
 +
            "version": 0
 +
        }
 +
    ],
 +
    "content": {
 +
        "0": "Weeds/0/-1/Basic/Weeds/A bunch of obnoxious weeds."
 +
    }
 +
}
 +
</source>
 +
Just remove everything except the content field, so it looks like this:
 +
<source lang="js">
 +
{
 +
    "0": "Weeds/0/-1/Basic/Weeds/A bunch of obnoxious weeds."
 +
}
 +
</source></li>
 +
</ol>
    
'''Troubleshooting:'''
 
'''Troubleshooting:'''
Line 50: Line 84:  
*# 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 <tt>pack.sh</tt> (Linux) or <tt>pack.command</tt> (Mac).
 +
 +
==Pack game files==
 +
There's no need to repack game files if you're using {{nexus mod|1915|Content Patcher}}! Just use the <tt>.json</tt>, <tt>.png</tt>, or <tt>.tbin</tt> file directly in your <tt>content.json</tt>.
 +
 +
If you really want to repack the files:
 +
 +
# Find the file you want to repack.
 +
# Copy it into xnbcli's <tt>unpacked</tt> folder.
 +
# Double-click <tt>pack.bat</tt> (Windows), <tt>pack.sh</tt> (Linux), or <tt>pack.command</tt> (Mac).
 +
# Move the repacked <tt>.xnb</tt> file back to the original location.
    
==Making changes==
 
==Making changes==
translators
8,403

edits

Navigation menu