diff options
author | Treeki <treeki@gmail.com> | 2011-03-26 05:14:59 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-26 05:14:59 +0100 |
commit | cff0bbcdf339ec99b9a1311605fb16f6378b3fb4 (patch) | |
tree | e921928236eef23869ddf4d27faa01f14e457594 /ConsoleApp | |
parent | e00b60edda34f50baaa0a21cf2bae4fcad1609a4 (diff) | |
download | nw4rtools-cff0bbcdf339ec99b9a1311605fb16f6378b3fb4.tar.gz nw4rtools-cff0bbcdf339ec99b9a1311605fb16f6378b3fb4.zip |
the Wii killing bug is hopefully gone for good! also, a few other improvements
Diffstat (limited to 'ConsoleApp')
-rw-r--r-- | ConsoleApp/Main.cs | 1 | ||||
-rw-r--r-- | ConsoleApp/ResFileCommands.cs | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/ConsoleApp/Main.cs b/ConsoleApp/Main.cs index 322d277..9a180f6 100644 --- a/ConsoleApp/Main.cs +++ b/ConsoleApp/Main.cs @@ -10,6 +10,7 @@ namespace ConsoleApp { CommandLookup.Add("init", new InitCommand()); CommandLookup.Add("list", new ListCommand()); + CommandLookup.Add("list-offsets", new ListOffsetsCommand()); CommandLookup.Add("import-obj", new ImportObjCommand()); CommandLookup.Add("export-obj", new ExportObjCommand()); CommandLookup.Add("export-collada", new ExportColladaCommand()); diff --git a/ConsoleApp/ResFileCommands.cs b/ConsoleApp/ResFileCommands.cs index ac734e4..83c28b2 100644 --- a/ConsoleApp/ResFileCommands.cs +++ b/ConsoleApp/ResFileCommands.cs @@ -85,5 +85,33 @@ namespace ConsoleApp { return "syntax: list <filename> -- lists the contents of a .brres file"; } } + + + public class ListOffsetsCommand : Command { + // this class also doesn't inherit from ResFileCommand, because I want to + // keep the OffsetMap + + public ListOffsetsCommand() : base("list offsets of data within a .brres file") { + } + + + public override void Execute(string[] args) { + if (args.Length == 0) { + Console.WriteLine("No path entered"); + return; + } + + SortedDictionary<int, string> offsetMap; + var rf = BrresReader.LoadFile(System.IO.File.ReadAllBytes(args[0]), false, out offsetMap); + + foreach (var e in offsetMap) { + Console.WriteLine("0x{0:X} : {1}", e.Key, e.Value); + } + } + + public override string GetHelp(string[] args) { + return "syntax: init <filename> -- creates an empty .brres file"; + } + } } |