From cff0bbcdf339ec99b9a1311605fb16f6378b3fb4 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 26 Mar 2011 05:14:59 +0100 Subject: the Wii killing bug is hopefully gone for good! also, a few other improvements --- ConsoleApp/Main.cs | 1 + ConsoleApp/ResFileCommands.cs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'ConsoleApp') 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 -- 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 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 -- creates an empty .brres file"; + } + } } -- cgit v1.2.3