Add Future Tools subform ui

For unpacking/repacking files
This commit is contained in:
Kurt
2015-05-02 23:28:04 -07:00
parent 45299c725d
commit ce8801fe37
6 changed files with 388 additions and 0 deletions

13
pk3DS/Main.Designer.cs generated
View File

@@ -55,6 +55,7 @@ private void InitializeComponent()
this.B_MoveTutor = new System.Windows.Forms.Button();
this.B_TMHM = new System.Windows.Forms.Button();
this.RTB_Status = new System.Windows.Forms.RichTextBox();
this.L_SubTools = new System.Windows.Forms.Label();
this.GB_RomFS.SuspendLayout();
this.GB_ExeFS.SuspendLayout();
this.SuspendLayout();
@@ -362,11 +363,22 @@ private void InitializeComponent()
this.RTB_Status.TabIndex = 7;
this.RTB_Status.Text = "";
//
// L_SubTools
//
this.L_SubTools.AutoSize = true;
this.L_SubTools.Location = new System.Drawing.Point(393, -1);
this.L_SubTools.Name = "L_SubTools";
this.L_SubTools.Size = new System.Drawing.Size(64, 13);
this.L_SubTools.TabIndex = 8;
this.L_SubTools.Text = "[Misc Tools]";
this.L_SubTools.Click += new System.EventHandler(this.L_SubTools_Click);
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(454, 422);
this.Controls.Add(this.L_SubTools);
this.Controls.Add(this.RTB_Status);
this.Controls.Add(this.GB_ExeFS);
this.Controls.Add(this.L_About);
@@ -420,5 +432,6 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_TMHM;
public System.Windows.Forms.RichTextBox RTB_Status;
private System.Windows.Forms.Button B_OPower;
private System.Windows.Forms.Label L_SubTools;
}
}

View File

@@ -510,6 +510,12 @@ private void B_OPower_Click(object sender, EventArgs e)
if (ExeFS != null) new OPower().Show();
}
// Extra Tools
private void L_SubTools_Click(object sender, EventArgs e)
{
new Tools().ShowDialog();
}
// GARC Requests
public string getGARCFileName(string requestedGARC)
{

View File

@@ -162,6 +162,42 @@
<metadata name="B_GameText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Maison.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_EggMove.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_LevelUp.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_StoryText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Item.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Move.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Evolution.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Personal.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_MegaEvo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Wild.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Trainer.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_GameText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Lang.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -192,9 +228,24 @@
<metadata name="B_TMHM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Pickup.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Mart.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_MoveTutor.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_TMHM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RTB_Status.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="L_SubTools.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

114
pk3DS/Tools/ToolsUI.Designer.cs generated Normal file
View File

@@ -0,0 +1,114 @@
namespace pk3DS
{
partial class ToolsUI
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.PB_Unpack = new System.Windows.Forms.Panel();
this.L_DARCMini = new System.Windows.Forms.Label();
this.PB_BCLIM = new System.Windows.Forms.Panel();
this.CHK_PNG = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// PB_Unpack
//
this.PB_Unpack.Location = new System.Drawing.Point(12, 25);
this.PB_Unpack.Name = "PB_Unpack";
this.PB_Unpack.Size = new System.Drawing.Size(150, 67);
this.PB_Unpack.TabIndex = 0;
//
// L_DARCMini
//
this.L_DARCMini.AutoSize = true;
this.L_DARCMini.Location = new System.Drawing.Point(12, 9);
this.L_DARCMini.Name = "L_DARCMini";
this.L_DARCMini.Size = new System.Drawing.Size(109, 13);
this.L_DARCMini.TabIndex = 1;
this.L_DARCMini.Text = "DARC && Mini Unpack";
//
// PB_BCLIM
//
this.PB_BCLIM.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PB_BCLIM.Location = new System.Drawing.Point(15, 283);
this.PB_BCLIM.Name = "PB_BCLIM";
this.PB_BCLIM.Size = new System.Drawing.Size(300, 67);
this.PB_BCLIM.TabIndex = 1;
this.PB_BCLIM.Paint += new System.Windows.Forms.PaintEventHandler(this.PB_BCLIM_Paint);
//
// CHK_PNG
//
this.CHK_PNG.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CHK_PNG.AutoSize = true;
this.CHK_PNG.Location = new System.Drawing.Point(218, 266);
this.CHK_PNG.Name = "CHK_PNG";
this.CHK_PNG.Size = new System.Drawing.Size(97, 17);
this.CHK_PNG.TabIndex = 2;
this.CHK_PNG.Text = "Autosave PNG";
this.CHK_PNG.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 267);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 13);
this.label1.TabIndex = 3;
this.label1.Text = "BCLIM Converter";
//
// ToolsUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(324, 362);
this.Controls.Add(this.label1);
this.Controls.Add(this.CHK_PNG);
this.Controls.Add(this.PB_BCLIM);
this.Controls.Add(this.L_DARCMini);
this.Controls.Add(this.PB_Unpack);
this.MaximizeBox = false;
this.MinimumSize = new System.Drawing.Size(340, 400);
this.Name = "ToolsUI";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Tools";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel PB_Unpack;
private System.Windows.Forms.Label L_DARCMini;
private System.Windows.Forms.Panel PB_BCLIM;
private System.Windows.Forms.CheckBox CHK_PNG;
private System.Windows.Forms.Label label1;
}
}

84
pk3DS/Tools/ToolsUI.cs Normal file
View File

@@ -0,0 +1,84 @@
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace pk3DS
{
public partial class ToolsUI : Form
{
public ToolsUI()
{
InitializeComponent();
PB_Unpack.DragEnter += tabMain_DragEnter;
PB_Unpack.DragDrop += tabMain_DragDrop;
}
private void tabMain_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void tabMain_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
string path = files[0]; // open first D&D
openQuick(path);
}
private void openQuick(string path, bool recursing = false)
{
try
{
// Pre-check file length to see if it is at least valid.
FileInfo fi = new FileInfo(path);
if (fi.Length > 900000) { Util.Error("File is too big!"); return; }
string newFolder = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
// Determine if it is a DARC or a Mini
using (var s = new FileStream(path, FileMode.Open))
using (var br = new BinaryReader(s))
{
// Check if Mini first
// ushort magic = br.ReadUInt16();
string fx = new string(br.ReadChars(2));
newFolder += "." + fx + "-";
ushort count = br.ReadUInt16();
uint[] offsets = new uint[count + 1];
for (int i = 0; i < count; i++)
{
offsets[i] = br.ReadUInt32();
}
uint length = br.ReadUInt32();
offsets[offsets.Length - 1] = length;
if (fi.Length == length)
{
// Fetch Mini File Contents
Util.unpackMini(path, fx, newFolder);
// Recurse throught the extracted contents if they extract successfully
if (Directory.Exists(newFolder))
foreach (string file in Directory.GetFiles(newFolder))
openQuick(file, true);
}
else if (false)
{
}
else if (!recursing)
Util.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path);
}
}
catch (Exception e)
{
Util.Error("File error:" + Environment.NewLine + path, e.ToString());
}
}
private void PB_BCLIM_Paint(object sender, PaintEventArgs e)
{
if (ModifierKeys == Keys.Control && Util.Prompt(MessageBoxButtons.YesNo, "Copy image to clipboard?") == DialogResult.Yes)
Clipboard.SetImage(PB_BCLIM.BackgroundImage);
else if (PB_BCLIM.BackColor == Color.Transparent)
PB_BCLIM.BackColor = Color.GreenYellow;
else PB_BCLIM.BackColor = Color.Transparent;
}
}
}

120
pk3DS/Tools/ToolsUI.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>