Hour one: Dump the data, decode the header
To be able to edit items, we first need to know where to look. All of the items are stored in common3. pac, under a section called ItmCommonParam.
Each child node of ItmCommonParam is for an item, and each one contains one MiscData file that contains the data. Well, lets get to work!
The first step was to write code to dump all the MiscData for each item using BrawlLib.
static void ItemDump()
{
//Get ItmCommonParam
ResourceNode node = NodeFactory.FromFile(null, "W:\\brawl_hax\\brawl_dump\\system\\common3_en.pac").FindChild("ItmCommonParam",true);
//Foreach child node...
foreach (ResourceNode item in node.Children)
{
item.Children[0].ExportUncompressed("W:\\brawl_hax\\itemdump\\"+item.Name + ".itemparam");
System.Console.WriteLine(item.Name);
}
System.Console.ReadKey();
}
This produced all the files dumped into a folder.
Now, its time to check them out!
Hex editor, away!
I choose to look at one of the files for a piece of Wario’s bike(ItmWarioBikeA) because it has a smaller size, so probably less complex, the smart bomb(ItemSmartBomb) for being a larger file, and SandBag(ItmSandbag) for being the biggest
First thing to do is examine the header, which appears to be 0×20 bytes, as ItemSmartBomb has strings and stuff starting at 0×20
000003E7 0000030C 00000026 00000002 00000000 00000000 00000000 00000000 ItmWarioBikeA 0000115B 00000E90 000000A2 00000002 00000000 00000000 00000000 00000000 ItmSmartBomb 00002127 00001C50 00000125 00000002 00000000 00000000 00000000 00000000 ItmSandbag
Notes on the above info:
- For the first 3 values, the bigger files have a bigger value.
- In fact the first value in these files appears to be the filesize in bytes. Could be useful for editing them later
- The second value is much bigger than the third
- If there is ANY data in the last 4 values, its something that doesn’t apply to all items. (one thing to note is that Sandbag cannot be held, but shares the rest of the header with the other items)
- The 3rd value cannot be an offset, as 125 in ItmSandbag is not evenly divisible by 4, and data is always loaded at a word boundary. Its probably a count
Now, to find out what these mean, we can do a lot of things. The first thing I am going to do is try jumping to Header[1](The 2nd header value) and seeing where I end up in each file. I did this, and I didn’t make too much progress. So, I decided to print the above table…for all of the items.
static unsafe void ItemHeaderDump()
{
var dump = File.CreateText("W:\\brawl_hax\\itemdump\\dump.txt");
//Get ItmCommonParam
ResourceNode node = NodeFactory.FromFile(null, "W:\\brawl_hax\\brawl_dump\\system\\common3_en.pac").FindChild("ItmCommonParam", true);
//Foreach child node...
foreach (ResourceNode item in node.Children)
{
var ptr = (bint*)item.Children[0].UncompressedSource.Address.address;
for (int i = 0; i < 8; i++)
{
var str = String.Format("{0:X8} ", (int)*ptr++);
System.Console.Write(str);
dump.Write(str);
}
System.Console.WriteLine(item.Name);
dump.WriteLine(item.Name);
}
dump.Close();
System.Console.ReadKey();
}
Download resulting header dump
Download dump of raw item files
This is as far as I got in one hour. I am going to keep working more today maybe.