Update GUI tool
This commit is contained in:
parent
f8abf663e0
commit
115c535298
|
@ -6,9 +6,10 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace ScriptTool
|
||||
{
|
||||
interface ICompiler
|
||||
public interface ICompiler
|
||||
{
|
||||
void ScanString(string str, ref int referenceAddress);
|
||||
IList<string> ScanString(string str, bool scanCodesOnly);
|
||||
IList<string> ScanString(string str, ref int referenceAddress, bool scanCodesOnly);
|
||||
void CompileString(string str, IList<byte> buffer, ref int referenceAddress);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.IO;
|
|||
|
||||
namespace ScriptTool
|
||||
{
|
||||
class M12Compiler : ICompiler
|
||||
public class M12Compiler : ICompiler
|
||||
{
|
||||
private static IEnumerable<M12ControlCode> controlCodes;
|
||||
private static string[] charLookup;
|
||||
|
@ -63,8 +63,16 @@ namespace ScriptTool
|
|||
return (byte)(ebCharLookup.IndexOf(c) + 0x50);
|
||||
}
|
||||
|
||||
public void ScanString(string str, ref int referenceAddress)
|
||||
public IList<string> ScanString(string str, bool scanCodesOnly)
|
||||
{
|
||||
int temp = 0;
|
||||
return ScanString(str, ref temp, scanCodesOnly);
|
||||
}
|
||||
|
||||
public IList<string> ScanString(string str, ref int referenceAddress, bool scanCodesOnly)
|
||||
{
|
||||
var references = new List<string>();
|
||||
|
||||
for (int i = 0; i < str.Length; )
|
||||
{
|
||||
if (str[i] == '[')
|
||||
|
@ -85,11 +93,15 @@ namespace ScriptTool
|
|||
if (codeString.Length <= 2)
|
||||
throw new Exception("Reference is empty");
|
||||
|
||||
referenceAddress += 4;
|
||||
if (!scanCodesOnly)
|
||||
referenceAddress += 4;
|
||||
|
||||
references.Add(codeString.Substring(1, codeString.Length - 2));
|
||||
}
|
||||
else if (IsHexByte(codeString))
|
||||
{
|
||||
referenceAddress++;
|
||||
if (!scanCodesOnly)
|
||||
referenceAddress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -114,7 +126,8 @@ namespace ScriptTool
|
|||
if (AddressMap.ContainsKey(label))
|
||||
throw new Exception("Label already defined");
|
||||
|
||||
AddressMap.Add(label, referenceAddress);
|
||||
if(!scanCodesOnly)
|
||||
AddressMap.Add(label, referenceAddress);
|
||||
|
||||
i = str.IndexOf('^', i + 1) + 1;
|
||||
}
|
||||
|
@ -122,14 +135,19 @@ namespace ScriptTool
|
|||
{
|
||||
if (!(str[i] == '\r') && !(str[i] == '\n'))
|
||||
{
|
||||
if (!IsValidChar(str[i]))
|
||||
throw new Exception("Invalid character: " + str[i]);
|
||||
if (!scanCodesOnly)
|
||||
{
|
||||
if (!IsValidChar(str[i]))
|
||||
throw new Exception("Invalid character: " + str[i]);
|
||||
|
||||
referenceAddress++;
|
||||
referenceAddress++;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return references;
|
||||
}
|
||||
|
||||
public void CompileString(string str, IList<byte> buffer, ref int referenceAddress)
|
||||
|
@ -163,7 +181,8 @@ namespace ScriptTool
|
|||
throw new Exception("Code string for unrecognized control code block must be a byte literal");
|
||||
|
||||
byte value = byte.Parse(codeStrings[j], System.Globalization.NumberStyles.HexNumber);
|
||||
buffer.Add(value);
|
||||
if (buffer != null)
|
||||
buffer.Add(value);
|
||||
referenceAddress++;
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +216,8 @@ namespace ScriptTool
|
|||
pointer |= 0x8000000;
|
||||
}
|
||||
|
||||
buffer.AddInt(pointer);
|
||||
if (buffer != null)
|
||||
buffer.AddInt(pointer);
|
||||
referenceAddress += 4;
|
||||
}
|
||||
else if (IsHexByte(codeString))
|
||||
|
@ -235,7 +255,8 @@ namespace ScriptTool
|
|||
throw new Exception("Invalid character: " + str[i]);
|
||||
|
||||
byte value = GetByte(str[i]);
|
||||
buffer.Add(value);
|
||||
if (buffer != null)
|
||||
buffer.Add(value);
|
||||
referenceAddress++;
|
||||
}
|
||||
i++;
|
||||
|
@ -251,7 +272,8 @@ namespace ScriptTool
|
|||
|
||||
for (int i = bytesWritten; i < padLength; i++)
|
||||
{
|
||||
buffer.Add(0);
|
||||
if (buffer != null)
|
||||
buffer.Add(0);
|
||||
referenceAddress++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,10 @@ namespace ScriptTool
|
|||
0x57D
|
||||
};
|
||||
|
||||
public static MainStringRef[] ReadTptRefs(byte[] rom)
|
||||
public static Tuple<MainStringRef[], MainStringRef[]> ReadTptRefs(byte[] rom)
|
||||
{
|
||||
var refs = new List<MainStringRef>();
|
||||
var primaryRefs = new List<MainStringRef>();
|
||||
var secondaryRefs = new List<MainStringRef>();
|
||||
|
||||
int address = 0x8EB14;
|
||||
int entries = 1584;
|
||||
|
@ -32,35 +33,35 @@ namespace ScriptTool
|
|||
{
|
||||
int firstPointer = rom.ReadGbaPointer(address + 9);
|
||||
if (firstPointer != 0)
|
||||
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 9, OldPointer = firstPointer });
|
||||
primaryRefs.Add(new MainStringRef { Index = i, PointerLocation = address + 9, OldPointer = firstPointer });
|
||||
|
||||
byte type = rom[address];
|
||||
if (type != 2)
|
||||
{
|
||||
int secondPointer = rom.ReadGbaPointer(address + 13);
|
||||
if (secondPointer != 0)
|
||||
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 13, OldPointer = secondPointer });
|
||||
secondaryRefs.Add(new MainStringRef { Index = i, PointerLocation = address + 13, OldPointer = secondPointer });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int firstPointer = rom.ReadGbaPointer(address + 12);
|
||||
if (firstPointer != 0)
|
||||
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 12, OldPointer = firstPointer });
|
||||
primaryRefs.Add(new MainStringRef { Index = i, PointerLocation = address + 12, OldPointer = firstPointer });
|
||||
|
||||
byte type = rom[address];
|
||||
if (type != 2)
|
||||
{
|
||||
int secondPointer = rom.ReadGbaPointer(address + 16);
|
||||
if (secondPointer != 0)
|
||||
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 16, OldPointer = secondPointer });
|
||||
secondaryRefs.Add(new MainStringRef { Index = i, PointerLocation = address + 16, OldPointer = secondPointer });
|
||||
}
|
||||
}
|
||||
|
||||
address += 20;
|
||||
}
|
||||
|
||||
return refs.ToArray();
|
||||
return Tuple.Create(primaryRefs.ToArray(), secondaryRefs.ToArray());
|
||||
}
|
||||
|
||||
public static MainStringRef[] ReadPsiHelpRefs(byte[] rom)
|
||||
|
|
|
@ -19,5 +19,10 @@ namespace ScriptTool
|
|||
public int OldPointer { get; set; }
|
||||
|
||||
public string Label { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "[" + Index.ToString("X3") + "] " + Label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,10 @@ namespace ScriptTool
|
|||
{
|
||||
// Pull all string refs from the ROM
|
||||
var allRefs = new List<Tuple<string, MainStringRef[]>>();
|
||||
allRefs.Add(Tuple.Create("m12-tpt", M12TextTables.ReadTptRefs(m12Rom)));
|
||||
|
||||
var tptTuple = M12TextTables.ReadTptRefs(m12Rom);
|
||||
allRefs.Add(Tuple.Create("m12-tpt-primary", tptTuple.Item1));
|
||||
allRefs.Add(Tuple.Create("m12-tpt-secondary", tptTuple.Item2));
|
||||
allRefs.Add(Tuple.Create("m12-psihelp", M12TextTables.ReadPsiHelpRefs(m12Rom)));
|
||||
allRefs.Add(Tuple.Create("m12-battle-actions", M12TextTables.ReadBattleActionRefs(m12Rom)));
|
||||
allRefs.Add(Tuple.Create("m12-itemhelp", M12TextTables.ReadItemHelpRefs(m12Rom)));
|
||||
|
@ -311,7 +314,7 @@ namespace ScriptTool
|
|||
string m12Strings = File.ReadAllText(Path.Combine(options.WorkingDirectory, "m12-strings-english.txt"));
|
||||
|
||||
// Compile
|
||||
m12Compiler.ScanString(m12Strings, ref referenceAddress);
|
||||
m12Compiler.ScanString(m12Strings, ref referenceAddress, false);
|
||||
referenceAddress = baseAddress;
|
||||
m12Compiler.CompileString(m12Strings, buffer, ref referenceAddress);
|
||||
File.WriteAllBytes(Path.Combine(options.WorkingDirectory, "m12-main-strings.bin"), buffer.ToArray());
|
||||
|
|
|
@ -30,14 +30,25 @@
|
|||
{
|
||||
this.tptSelector = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.previewSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.ebString = new System.Windows.Forms.TextBox();
|
||||
this.m12String = new System.Windows.Forms.TextBox();
|
||||
this.m12StringEnglish = new System.Windows.Forms.TextBox();
|
||||
this.textSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.previewSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.controlCodeTabs = new System.Windows.Forms.TabControl();
|
||||
this.ebControlCodeTab = new System.Windows.Forms.TabPage();
|
||||
this.m12ControlCodeTab = new System.Windows.Forms.TabPage();
|
||||
this.codeSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.codeList = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.referenceList = new System.Windows.Forms.ListBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.gameSelectorPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.ebSelector = new System.Windows.Forms.RadioButton();
|
||||
this.m12Selector = new System.Windows.Forms.RadioButton();
|
||||
this.backButton = new System.Windows.Forms.Button();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.textSplitContainer)).BeginInit();
|
||||
this.textSplitContainer.Panel1.SuspendLayout();
|
||||
this.textSplitContainer.Panel2.SuspendLayout();
|
||||
|
@ -45,14 +56,21 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.previewSplitContainer)).BeginInit();
|
||||
this.previewSplitContainer.Panel1.SuspendLayout();
|
||||
this.previewSplitContainer.SuspendLayout();
|
||||
this.controlCodeTabs.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.codeSplitContainer)).BeginInit();
|
||||
this.codeSplitContainer.Panel1.SuspendLayout();
|
||||
this.codeSplitContainer.Panel2.SuspendLayout();
|
||||
this.codeSplitContainer.SuspendLayout();
|
||||
this.gameSelectorPanel.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tptSelector
|
||||
//
|
||||
this.tptSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.tptSelector.FormattingEnabled = true;
|
||||
this.tptSelector.Location = new System.Drawing.Point(77, 12);
|
||||
this.tptSelector.Location = new System.Drawing.Point(66, 4);
|
||||
this.tptSelector.Name = "tptSelector";
|
||||
this.tptSelector.Size = new System.Drawing.Size(238, 21);
|
||||
this.tptSelector.TabIndex = 0;
|
||||
|
@ -61,45 +79,12 @@
|
|||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(14, 15);
|
||||
this.label1.Location = new System.Drawing.Point(3, 7);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(57, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "TPT entry:";
|
||||
//
|
||||
// ebString
|
||||
//
|
||||
this.ebString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ebString.Location = new System.Drawing.Point(3, 3);
|
||||
this.ebString.Multiline = true;
|
||||
this.ebString.Name = "ebString";
|
||||
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.ebString.Size = new System.Drawing.Size(344, 86);
|
||||
this.ebString.TabIndex = 2;
|
||||
//
|
||||
// m12String
|
||||
//
|
||||
this.m12String.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.m12String.Location = new System.Drawing.Point(3, 95);
|
||||
this.m12String.Multiline = true;
|
||||
this.m12String.Name = "m12String";
|
||||
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.m12String.Size = new System.Drawing.Size(344, 86);
|
||||
this.m12String.TabIndex = 3;
|
||||
//
|
||||
// m12StringEnglish
|
||||
//
|
||||
this.m12StringEnglish.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.m12StringEnglish.Location = new System.Drawing.Point(3, 187);
|
||||
this.m12StringEnglish.Multiline = true;
|
||||
this.m12StringEnglish.Name = "m12StringEnglish";
|
||||
this.m12StringEnglish.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.m12StringEnglish.Size = new System.Drawing.Size(344, 86);
|
||||
this.m12StringEnglish.TabIndex = 4;
|
||||
//
|
||||
// textSplitContainer
|
||||
//
|
||||
this.textSplitContainer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
|
@ -112,91 +97,264 @@
|
|||
//
|
||||
this.textSplitContainer.Panel1.AutoScroll = true;
|
||||
this.textSplitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.textSplitContainer.Panel1.Controls.Add(this.ebString);
|
||||
this.textSplitContainer.Panel1.Controls.Add(this.m12StringEnglish);
|
||||
this.textSplitContainer.Panel1.Controls.Add(this.m12String);
|
||||
this.textSplitContainer.Panel1.Controls.Add(this.previewSplitContainer);
|
||||
//
|
||||
// textSplitContainer.Panel2
|
||||
//
|
||||
this.textSplitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.textSplitContainer.Panel2.Controls.Add(this.controlCodeTabs);
|
||||
this.textSplitContainer.Size = new System.Drawing.Size(582, 299);
|
||||
this.textSplitContainer.SplitterDistance = 356;
|
||||
this.textSplitContainer.TabIndex = 5;
|
||||
this.textSplitContainer.Panel2.Controls.Add(this.codeSplitContainer);
|
||||
this.textSplitContainer.Panel2.Controls.Add(this.gameSelectorPanel);
|
||||
this.textSplitContainer.Size = new System.Drawing.Size(761, 560);
|
||||
this.textSplitContainer.SplitterDistance = 535;
|
||||
this.textSplitContainer.TabIndex = 6;
|
||||
//
|
||||
// previewSplitContainer
|
||||
//
|
||||
this.previewSplitContainer.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.previewSplitContainer.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.previewSplitContainer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.previewSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.previewSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.previewSplitContainer.Location = new System.Drawing.Point(12, 39);
|
||||
this.previewSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.previewSplitContainer.Name = "previewSplitContainer";
|
||||
this.previewSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// previewSplitContainer.Panel1
|
||||
//
|
||||
this.previewSplitContainer.Panel1.Controls.Add(this.textSplitContainer);
|
||||
this.previewSplitContainer.Panel1.AutoScroll = true;
|
||||
this.previewSplitContainer.Panel1.Controls.Add(this.ebString);
|
||||
this.previewSplitContainer.Panel1.Controls.Add(this.m12String);
|
||||
this.previewSplitContainer.Panel1.Controls.Add(this.m12StringEnglish);
|
||||
this.previewSplitContainer.Size = new System.Drawing.Size(535, 560);
|
||||
this.previewSplitContainer.SplitterDistance = 432;
|
||||
this.previewSplitContainer.TabIndex = 5;
|
||||
//
|
||||
// previewSplitContainer.Panel2
|
||||
// ebString
|
||||
//
|
||||
this.previewSplitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.previewSplitContainer.Size = new System.Drawing.Size(582, 446);
|
||||
this.previewSplitContainer.SplitterDistance = 299;
|
||||
this.previewSplitContainer.TabIndex = 6;
|
||||
this.ebString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ebString.Location = new System.Drawing.Point(3, 6);
|
||||
this.ebString.Multiline = true;
|
||||
this.ebString.Name = "ebString";
|
||||
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.ebString.Size = new System.Drawing.Size(525, 128);
|
||||
this.ebString.TabIndex = 2;
|
||||
//
|
||||
// controlCodeTabs
|
||||
// m12String
|
||||
//
|
||||
this.controlCodeTabs.Controls.Add(this.ebControlCodeTab);
|
||||
this.controlCodeTabs.Controls.Add(this.m12ControlCodeTab);
|
||||
this.controlCodeTabs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.controlCodeTabs.Location = new System.Drawing.Point(0, 0);
|
||||
this.controlCodeTabs.Name = "controlCodeTabs";
|
||||
this.controlCodeTabs.SelectedIndex = 0;
|
||||
this.controlCodeTabs.Size = new System.Drawing.Size(218, 295);
|
||||
this.controlCodeTabs.TabIndex = 0;
|
||||
this.m12String.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.m12String.Location = new System.Drawing.Point(3, 140);
|
||||
this.m12String.Multiline = true;
|
||||
this.m12String.Name = "m12String";
|
||||
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.m12String.Size = new System.Drawing.Size(525, 128);
|
||||
this.m12String.TabIndex = 3;
|
||||
//
|
||||
// ebControlCodeTab
|
||||
// m12StringEnglish
|
||||
//
|
||||
this.ebControlCodeTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.ebControlCodeTab.Name = "ebControlCodeTab";
|
||||
this.ebControlCodeTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.ebControlCodeTab.Size = new System.Drawing.Size(210, 193);
|
||||
this.ebControlCodeTab.TabIndex = 0;
|
||||
this.ebControlCodeTab.Text = "EB codes";
|
||||
this.ebControlCodeTab.UseVisualStyleBackColor = true;
|
||||
this.m12StringEnglish.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.m12StringEnglish.Location = new System.Drawing.Point(3, 274);
|
||||
this.m12StringEnglish.Multiline = true;
|
||||
this.m12StringEnglish.Name = "m12StringEnglish";
|
||||
this.m12StringEnglish.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.m12StringEnglish.Size = new System.Drawing.Size(525, 128);
|
||||
this.m12StringEnglish.TabIndex = 4;
|
||||
//
|
||||
// m12ControlCodeTab
|
||||
// codeSplitContainer
|
||||
//
|
||||
this.m12ControlCodeTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.m12ControlCodeTab.Name = "m12ControlCodeTab";
|
||||
this.m12ControlCodeTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.m12ControlCodeTab.Size = new System.Drawing.Size(210, 269);
|
||||
this.m12ControlCodeTab.TabIndex = 1;
|
||||
this.m12ControlCodeTab.Text = "M12 codes";
|
||||
this.m12ControlCodeTab.UseVisualStyleBackColor = true;
|
||||
this.codeSplitContainer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.codeSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.codeSplitContainer.Location = new System.Drawing.Point(0, 33);
|
||||
this.codeSplitContainer.Name = "codeSplitContainer";
|
||||
this.codeSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// codeSplitContainer.Panel1
|
||||
//
|
||||
this.codeSplitContainer.Panel1.Controls.Add(this.codeList);
|
||||
this.codeSplitContainer.Panel1.Controls.Add(this.label2);
|
||||
//
|
||||
// codeSplitContainer.Panel2
|
||||
//
|
||||
this.codeSplitContainer.Panel2.Controls.Add(this.referenceList);
|
||||
this.codeSplitContainer.Panel2.Controls.Add(this.label3);
|
||||
this.codeSplitContainer.Size = new System.Drawing.Size(222, 527);
|
||||
this.codeSplitContainer.SplitterDistance = 245;
|
||||
this.codeSplitContainer.TabIndex = 1;
|
||||
//
|
||||
// codeList
|
||||
//
|
||||
this.codeList.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.codeList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.codeList.Location = new System.Drawing.Point(0, 19);
|
||||
this.codeList.Multiline = true;
|
||||
this.codeList.Name = "codeList";
|
||||
this.codeList.ReadOnly = true;
|
||||
this.codeList.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.codeList.Size = new System.Drawing.Size(218, 222);
|
||||
this.codeList.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label2.Location = new System.Drawing.Point(0, 0);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label2.Size = new System.Drawing.Size(46, 19);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Codes:";
|
||||
//
|
||||
// referenceList
|
||||
//
|
||||
this.referenceList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.referenceList.FormattingEnabled = true;
|
||||
this.referenceList.Location = new System.Drawing.Point(0, 19);
|
||||
this.referenceList.Name = "referenceList";
|
||||
this.referenceList.Size = new System.Drawing.Size(218, 255);
|
||||
this.referenceList.TabIndex = 2;
|
||||
this.referenceList.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.referenceList_MouseDoubleClick);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label3.Location = new System.Drawing.Point(0, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label3.Size = new System.Drawing.Size(71, 19);
|
||||
this.label3.TabIndex = 1;
|
||||
this.label3.Text = "References:";
|
||||
//
|
||||
// gameSelectorPanel
|
||||
//
|
||||
this.gameSelectorPanel.AutoSize = true;
|
||||
this.gameSelectorPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.gameSelectorPanel.Controls.Add(this.ebSelector);
|
||||
this.gameSelectorPanel.Controls.Add(this.m12Selector);
|
||||
this.gameSelectorPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.gameSelectorPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.gameSelectorPanel.Name = "gameSelectorPanel";
|
||||
this.gameSelectorPanel.Size = new System.Drawing.Size(222, 33);
|
||||
this.gameSelectorPanel.TabIndex = 0;
|
||||
//
|
||||
// ebSelector
|
||||
//
|
||||
this.ebSelector.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.ebSelector.Location = new System.Drawing.Point(3, 3);
|
||||
this.ebSelector.Name = "ebSelector";
|
||||
this.ebSelector.Size = new System.Drawing.Size(64, 23);
|
||||
this.ebSelector.TabIndex = 0;
|
||||
this.ebSelector.Text = "EB";
|
||||
this.ebSelector.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.ebSelector.UseVisualStyleBackColor = true;
|
||||
this.ebSelector.CheckedChanged += new System.EventHandler(this.gameSelector_CheckedChanged);
|
||||
//
|
||||
// m12Selector
|
||||
//
|
||||
this.m12Selector.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.m12Selector.Checked = true;
|
||||
this.m12Selector.Location = new System.Drawing.Point(73, 3);
|
||||
this.m12Selector.Name = "m12Selector";
|
||||
this.m12Selector.Size = new System.Drawing.Size(64, 23);
|
||||
this.m12Selector.TabIndex = 1;
|
||||
this.m12Selector.TabStop = true;
|
||||
this.m12Selector.Text = "M12";
|
||||
this.m12Selector.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.m12Selector.UseVisualStyleBackColor = true;
|
||||
this.m12Selector.CheckedChanged += new System.EventHandler(this.gameSelector_CheckedChanged);
|
||||
//
|
||||
// backButton
|
||||
//
|
||||
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.backButton.Location = new System.Drawing.Point(683, 3);
|
||||
this.backButton.Name = "backButton";
|
||||
this.backButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.backButton.TabIndex = 7;
|
||||
this.backButton.Text = "Back";
|
||||
this.backButton.UseVisualStyleBackColor = true;
|
||||
this.backButton.Click += new System.EventHandler(this.backButton_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileMenu});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(761, 24);
|
||||
this.menuStrip1.TabIndex = 8;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AutoSize = true;
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.backButton);
|
||||
this.panel1.Controls.Add(this.tptSelector);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 24);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(761, 29);
|
||||
this.panel1.TabIndex = 9;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.textSplitContainer);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 53);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(761, 560);
|
||||
this.panel2.TabIndex = 10;
|
||||
//
|
||||
// fileMenu
|
||||
//
|
||||
this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveMenu});
|
||||
this.fileMenu.Name = "fileMenu";
|
||||
this.fileMenu.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileMenu.Text = "File";
|
||||
//
|
||||
// saveMenu
|
||||
//
|
||||
this.saveMenu.Name = "saveMenu";
|
||||
this.saveMenu.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.saveMenu.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveMenu.Text = "Save";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(606, 497);
|
||||
this.Controls.Add(this.previewSplitContainer);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.tptSelector);
|
||||
this.ClientSize = new System.Drawing.Size(761, 613);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "MOTHER 1+2 Funland";
|
||||
this.textSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.textSplitContainer.Panel1.PerformLayout();
|
||||
this.textSplitContainer.Panel2.ResumeLayout(false);
|
||||
this.textSplitContainer.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.textSplitContainer)).EndInit();
|
||||
this.textSplitContainer.ResumeLayout(false);
|
||||
this.previewSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.previewSplitContainer.Panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewSplitContainer)).EndInit();
|
||||
this.previewSplitContainer.ResumeLayout(false);
|
||||
this.controlCodeTabs.ResumeLayout(false);
|
||||
this.codeSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.codeSplitContainer.Panel1.PerformLayout();
|
||||
this.codeSplitContainer.Panel2.ResumeLayout(false);
|
||||
this.codeSplitContainer.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.codeSplitContainer)).EndInit();
|
||||
this.codeSplitContainer.ResumeLayout(false);
|
||||
this.gameSelectorPanel.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -206,14 +364,25 @@
|
|||
|
||||
private System.Windows.Forms.ComboBox tptSelector;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.SplitContainer textSplitContainer;
|
||||
private System.Windows.Forms.SplitContainer previewSplitContainer;
|
||||
private System.Windows.Forms.TextBox ebString;
|
||||
private System.Windows.Forms.TextBox m12String;
|
||||
private System.Windows.Forms.TextBox m12StringEnglish;
|
||||
private System.Windows.Forms.SplitContainer textSplitContainer;
|
||||
private System.Windows.Forms.SplitContainer previewSplitContainer;
|
||||
private System.Windows.Forms.TabControl controlCodeTabs;
|
||||
private System.Windows.Forms.TabPage ebControlCodeTab;
|
||||
private System.Windows.Forms.TabPage m12ControlCodeTab;
|
||||
private System.Windows.Forms.FlowLayoutPanel gameSelectorPanel;
|
||||
private System.Windows.Forms.RadioButton ebSelector;
|
||||
private System.Windows.Forms.RadioButton m12Selector;
|
||||
private System.Windows.Forms.SplitContainer codeSplitContainer;
|
||||
private System.Windows.Forms.TextBox codeList;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ListBox referenceList;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button backButton;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveMenu;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,145 +15,234 @@ namespace ScriptToolGui
|
|||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
const string workingFolder = @"..\..\..\..\working";
|
||||
static IDictionary<Game, TextBox> textboxLookup;
|
||||
static IDictionary<Game, IList<string>> stringsLookup;
|
||||
|
||||
// String references
|
||||
MainStringRef[] m12TptRefs;
|
||||
MainStringRef[] ebTptRefs;
|
||||
//MainStringRef[] m2TptRefs;
|
||||
const string workingFolder = @"..\..\..\..\working";
|
||||
static M12Compiler m12Compiler = new M12Compiler();
|
||||
|
||||
// Strings
|
||||
IList<string> m12Strings;
|
||||
IList<string> m12StringsEnglish;
|
||||
IList<string> ebStrings;
|
||||
//IList<string> m2Strings;
|
||||
|
||||
// Matched reference pairs
|
||||
List<MatchedReferenceGroup> matchedGroups = new List<MatchedReferenceGroup>();
|
||||
|
||||
// Navigation stack
|
||||
MatchedReferenceGroup previousGroup = null;
|
||||
Stack<MatchedReferenceGroup> navigationStack = new Stack<MatchedReferenceGroup>();
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
m12String.Font = new Font("Meiryo UI", 8);
|
||||
ImportAllStringRefs(workingFolder);
|
||||
ImportAllStrings(workingFolder);
|
||||
|
||||
LoadAllStringRefs(workingFolder);
|
||||
LoadAllStrings(workingFolder);
|
||||
textboxLookup = new Dictionary<Game, TextBox> {
|
||||
{ Game.Eb, ebString },
|
||||
{ Game.M12, m12String },
|
||||
{ Game.M12English, m12StringEnglish }
|
||||
};
|
||||
|
||||
stringsLookup = new Dictionary<Game, IList<string>> {
|
||||
{ Game.Eb, ebStrings },
|
||||
{ Game.M12, m12Strings },
|
||||
{ Game.M12English, m12StringsEnglish }
|
||||
};
|
||||
|
||||
PopulateTptList();
|
||||
}
|
||||
|
||||
private void LoadAllStringRefs(string folder)
|
||||
private void ImportAllStringRefs(string folder)
|
||||
{
|
||||
string m12FileName = Path.Combine(folder, "m12-tpt.json");
|
||||
string ebFileName = Path.Combine(folder, "eb-tpt.json");
|
||||
//string m2FileName = Path.Combine(folder, "m2-tpt.json");
|
||||
string m12PrimaryFileName = Path.Combine(folder, "m12-tpt-primary.json");
|
||||
string ebPrimaryFileName = Path.Combine(folder, "eb-tpt-primary.json");
|
||||
|
||||
m12TptRefs = LoadStringRefs(m12FileName);
|
||||
ebTptRefs = LoadStringRefs(ebFileName);
|
||||
//m2TptRefs = LoadStringRefs(m2FileName);
|
||||
var m12PrimaryTptRefs = ImportStringRefs(m12PrimaryFileName);
|
||||
var ebPrimaryTptRefs = ImportStringRefs(ebPrimaryFileName);
|
||||
|
||||
string m12SecondaryFileName = Path.Combine(folder, "m12-tpt-secondary.json");
|
||||
string ebSecondaryFileName = Path.Combine(folder, "eb-tpt-secondary.json");
|
||||
|
||||
var m12SecondaryTptRefs = ImportStringRefs(m12SecondaryFileName);
|
||||
var ebSecondaryTptRefs = ImportStringRefs(ebSecondaryFileName);
|
||||
|
||||
matchedGroups.AddRange(MatchRefs(ebPrimaryTptRefs, m12PrimaryTptRefs));
|
||||
matchedGroups.AddRange(MatchRefs(ebSecondaryTptRefs, m12SecondaryTptRefs));
|
||||
|
||||
matchedGroups.Sort((g1, g2) => g1.EbRef.Index.CompareTo(g2.EbRef.Index));
|
||||
}
|
||||
|
||||
private MainStringRef[] LoadStringRefs(string fileName)
|
||||
private MatchedReferenceGroup[] MatchRefs(MainStringRef[] ebRefs, MainStringRef[] m12Refs)
|
||||
{
|
||||
return ebRefs.Join(m12Refs, e => e.Index, m => m.Index, (e, m) => new { e, m })
|
||||
.Select(p => new MatchedReferenceGroup(p.e, p.m))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private MainStringRef[] ImportStringRefs(string fileName)
|
||||
{
|
||||
string jsonString = File.ReadAllText(fileName);
|
||||
return JsonConvert.DeserializeObject<MainStringRef[]>(jsonString);
|
||||
}
|
||||
|
||||
private void LoadAllStrings(string folder)
|
||||
private void ImportAllStrings(string folder)
|
||||
{
|
||||
string m12FileName = Path.Combine(folder, "m12-strings.txt");
|
||||
string m12EnglishFileName = Path.Combine(folder, "m12-strings-english.txt");
|
||||
string ebFileName = Path.Combine(folder, "eb-strings.txt");
|
||||
//string m2FileName = Path.Combine(folder, "m2-strings.txt");
|
||||
|
||||
m12Strings = LoadStrings(m12FileName);
|
||||
m12StringsEnglish = LoadStrings(m12EnglishFileName);
|
||||
ebStrings = LoadStrings(ebFileName);
|
||||
//m2Strings = LoadStrings(m2FileName);
|
||||
m12Strings = ImportStrings(m12FileName);
|
||||
m12StringsEnglish = ImportStrings(m12EnglishFileName);
|
||||
ebStrings = ImportStrings(ebFileName);
|
||||
}
|
||||
|
||||
private IList<string> LoadStrings(string fileName)
|
||||
private IList<string> ImportStrings(string fileName)
|
||||
{
|
||||
return new List<string>(File.ReadAllLines(fileName).Where(l => !l.Equals("")));
|
||||
}
|
||||
|
||||
private Game GetCurrentGame()
|
||||
{
|
||||
if (ebSelector.Checked)
|
||||
return Game.Eb;
|
||||
|
||||
else if (m12Selector.Checked)
|
||||
return Game.M12;
|
||||
|
||||
return Game.None;
|
||||
}
|
||||
|
||||
private void PopulateTptList()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
tptSelector.Items.Clear();
|
||||
foreach (var m12Ref in m12TptRefs)
|
||||
{
|
||||
sb.Clear();
|
||||
sb.Append('[');
|
||||
sb.Append(m12Ref.Index.ToString("X3"));
|
||||
sb.Append("] ");
|
||||
sb.Append(m12Ref.Label);
|
||||
tptSelector.Items.Add(sb.ToString());
|
||||
}
|
||||
tptSelector.Items.AddRange(matchedGroups.ToArray());
|
||||
}
|
||||
|
||||
private void LoadTptEntry(int index)
|
||||
private void PopulateCodeList()
|
||||
{
|
||||
if (index == -1)
|
||||
|
||||
}
|
||||
|
||||
private void PopulateReferenceList()
|
||||
{
|
||||
codeList.Text = "";
|
||||
referenceList.Items.Clear();
|
||||
|
||||
if (ebSelector.Checked)
|
||||
{
|
||||
ebString.Text =
|
||||
m12String.Text =
|
||||
m12StringEnglish.Text = "";
|
||||
|
||||
}
|
||||
else
|
||||
else if (m12Selector.Checked)
|
||||
{
|
||||
var ebRef = ebTptRefs.FirstOrDefault(eb => eb.Index == index);
|
||||
var m12Ref = m12TptRefs.FirstOrDefault(m12 => m12.Index == index);
|
||||
|
||||
if (ebRef == null)
|
||||
ebString.Text = "";
|
||||
else
|
||||
{
|
||||
string str = GetString(ebStrings, ebRef.Label);
|
||||
if (str != null)
|
||||
ebString.Text = str;
|
||||
}
|
||||
|
||||
if (m12Ref == null)
|
||||
m12String.Text = "";
|
||||
else
|
||||
{
|
||||
string str = GetString(m12Strings, m12Ref.Label);
|
||||
if (str != null)
|
||||
m12String.Text = str;
|
||||
|
||||
str = GetString(m12StringsEnglish, m12Ref.Label);
|
||||
if (str != null)
|
||||
m12StringEnglish.Text = str;
|
||||
}
|
||||
|
||||
var references = m12Compiler.ScanString(m12String.Text, true).Distinct().OrderBy(r => r);
|
||||
referenceList.Items.AddRange(references.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
private string GetString(IList<string> strings, string label)
|
||||
private string GetString(Game game, string label)
|
||||
{
|
||||
try
|
||||
{
|
||||
return strings.First(l => l.Contains("^" + label + "^"));
|
||||
return stringsLookup[game].First(l => l.Contains("^" + label + "^"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Error: label definition not found in strings: " + label);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void NavigateTo(MatchedReferenceGroup group)
|
||||
{
|
||||
if (group == null)
|
||||
{
|
||||
ebString.Text = "";
|
||||
m12String.Text = "";
|
||||
m12StringEnglish.Text = "";
|
||||
|
||||
tptSelector.SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string eb = GetString(Game.Eb, group.EbRef.Label);
|
||||
string m12 = GetString(Game.M12, group.M12Ref.Label);
|
||||
string m12English = GetString(Game.M12English, group.M12Ref.Label);
|
||||
|
||||
ebString.Text = eb;
|
||||
m12String.Text = m12;
|
||||
m12StringEnglish.Text = m12English;
|
||||
|
||||
tptSelector.SelectedItem = group;
|
||||
}
|
||||
|
||||
PopulateCodeList();
|
||||
PopulateReferenceList();
|
||||
}
|
||||
|
||||
private void NavigateTo(Game game, string label)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PushPreviousGroup()
|
||||
{
|
||||
if (previousGroup != null)
|
||||
{
|
||||
navigationStack.Push(previousGroup);
|
||||
}
|
||||
}
|
||||
|
||||
private void tptSelector_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
if (tptSelector.SelectedIndex == -1)
|
||||
{
|
||||
LoadTptEntry(-1);
|
||||
}
|
||||
NavigateTo(null);
|
||||
else
|
||||
{
|
||||
string tptString = (string)tptSelector.Items[tptSelector.SelectedIndex];
|
||||
string indexString = tptString.Substring(1, 3);
|
||||
int index = Convert.ToInt32(indexString, 16);
|
||||
LoadTptEntry(index);
|
||||
PushPreviousGroup();
|
||||
|
||||
var currentGroup = (MatchedReferenceGroup)tptSelector.SelectedItem;
|
||||
NavigateTo(currentGroup);
|
||||
previousGroup = currentGroup;
|
||||
}
|
||||
}
|
||||
|
||||
private void gameSelector_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
PopulateCodeList();
|
||||
PopulateReferenceList();
|
||||
}
|
||||
|
||||
private void referenceList_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
int match = referenceList.IndexFromPoint(e.Location);
|
||||
if (match != ListBox.NoMatches)
|
||||
{
|
||||
Game game = GetCurrentGame();
|
||||
string label = (string)referenceList.SelectedItem;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void backButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (navigationStack.Count < 1)
|
||||
return;
|
||||
|
||||
var group = navigationStack.Pop();
|
||||
NavigateTo(group);
|
||||
previousGroup = group;
|
||||
}
|
||||
}
|
||||
|
||||
enum Game
|
||||
{
|
||||
None,
|
||||
Eb,
|
||||
M2,
|
||||
M12,
|
||||
M12English
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,4 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ScriptTool;
|
||||
|
||||
namespace ScriptToolGui
|
||||
{
|
||||
class MatchedReferenceGroup
|
||||
{
|
||||
public MainStringRef EbRef { get; private set; }
|
||||
public MainStringRef M12Ref { get; private set; }
|
||||
|
||||
public MatchedReferenceGroup(MainStringRef ebRef, MainStringRef m12Ref)
|
||||
{
|
||||
if(ebRef.Index != m12Ref.Index)
|
||||
{
|
||||
|
||||
}
|
||||
EbRef = ebRef;
|
||||
M12Ref = m12Ref;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("[{0:X3}] EB: {1} / M12: {2}", EbRef.Index.ToString("X3"),
|
||||
EbRef.Label, M12Ref.Label);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ScriptToolGui
|
||||
{
|
||||
class NavigationLabel
|
||||
{
|
||||
public Game Game { get; private set; }
|
||||
public string Label { get; private set; }
|
||||
|
||||
public NavigationLabel(Game game, string label)
|
||||
{
|
||||
Game = game;
|
||||
Label = label;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,6 +55,8 @@
|
|||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MatchedReferenceGroup.cs" />
|
||||
<Compile Include="NavigationEntry.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue