Skip to content

Commit

Permalink
Add readme and simplify usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Inari-Whitebear committed Mar 1, 2016
1 parent bffb766 commit ba130ec
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 5 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Usage

### Explorer
##### Unpacking and opening
* Just drag the xnb file onto the .exe and it will create a .tbin file of the same name.
* Open with [tIDE Map Editor](http://tide.codeplex.com/releases)

* You may get an error message saying something like: "An error occured while opening the file. Details: Unable to load tile sheet 'desert-new' with image source '-------------------------------------------\DesertTiles' Inner Message: Parameter is not valid."
* Here you see it saying \DesertTiles before "Inner Message" that means the tIDE Editor cannot find the DesertTiles graphics file.
* In your Stardew Valley\Content\Maps\ Folder find the right file (in this case desertTiles.xnb)
* Use one of the already available tools to turn it into a png file and rename it to remove the .png extension
* Place alongside the .tbin map file when opening
* Repeat this until tIDE stops complaining about not being able to load tilesheets

##### Putting it back
* Now when done editing, save and drag the .tbin file onto the .exe again.
* It will overwrite the .xnb file of the same name in this folder with the new data
* Put the xnb File back into the Stardew Valley\Content\Maps\ Folder (Make a copy of the original first!)
* Start Stardew Valley (You can keep doing this save-edit-putback cycle without having to unpack the xnb again first)

### Command Line

Usage: SimpleXNBDemapper <command> <input> <output>
commands: pack, unpack

See explorer usage on how to get the tbin file to load.

If providing only 1 argument it will figure out the command by file extension (.tbin makes it pack and .xnb unpack) and the output file will have the same name as the input file but with different extension.

If providing 2 arguments, it will use an output name that is the name of the input file with the new extension.
47 changes: 42 additions & 5 deletions SimpleXNBDemapper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,64 @@ static void unpack(string filePath, string outPath)

static void help()
{
Console.WriteLine("usage xnbdemapper (pack|unpack) <input> <output>");
Console.WriteLine("usage xnbdemapper (pack|unpack) <input> [<output>]");
Console.WriteLine("pack - packs a .tbin file to .xnb");
Console.WriteLine("unpacks - unpacks a .xnb map file to .tbin");
}

static void Main(string[] args)
{
if (args.Length < 3)
String outPath;
String inPath;
String command;
if (args.Length < 1)
{
help();
return;
}
switch (args[0])
inPath = args[0];
if (args.Length == 1)
{
switch (Path.GetExtension(inPath))
{
case ".tbin":
{
command = "pack";
}
break;
case ".xnb":
{
command = "unpack";
}
break;
default:
{
Console.WriteLine("Error: Unrecognized file extension.");
Console.ReadKey();
return;
}
}
outPath = Path.GetFileNameWithoutExtension(inPath);
} else if (args.Length == 2)
{
command = args[0];
inPath = args[1];
outPath = Path.GetFileNameWithoutExtension(args[1]);
} else
{
command = args[0];
inPath = args[1];
outPath = args[2];
}
switch (command)
{
case "pack":
{
pack(args[1], args[2]);
pack(inPath, (args.Length <= 2 ? outPath + ".xnb" : outPath));
} break;
case "unpack":
{
unpack(args[1], args[2]);
unpack(inPath, (args.Length <= 2 ? outPath + ".tbin" : outPath));
} break;
default:
{
Expand Down

0 comments on commit ba130ec

Please sign in to comment.