diff --git a/CTFAK/CTFAK.csproj b/CTFAK/CTFAK.csproj
index 8c206c3..bd2803d 100644
--- a/CTFAK/CTFAK.csproj
+++ b/CTFAK/CTFAK.csproj
@@ -8,7 +8,7 @@
Debug
AnyCPU
{86D99F9E-98FB-4E50-AB68-F5C115850C33}
- WinExe
+ Exe
CTFAK
CTFAK
v4.7.2
@@ -67,7 +67,7 @@
bin\x64\Release\
TRACE
true
- full
+ pdbonly
x64
7.3
prompt
@@ -78,6 +78,8 @@
bin\x86\Release\
x86
+ true
+ pdbonly
diff --git a/CTFAK/GUI/MainForm.Designer.cs b/CTFAK/GUI/MainForm.Designer.cs
index 323cd3b..3ada21c 100644
--- a/CTFAK/GUI/MainForm.Designer.cs
+++ b/CTFAK/GUI/MainForm.Designer.cs
@@ -44,7 +44,6 @@
this.soundsButton = new System.Windows.Forms.Button();
this.imagesButton = new System.Windows.Forms.Button();
this.loadingLabel = new System.Windows.Forms.Label();
- this.dumpSortedBtn = new System.Windows.Forms.Button();
this.ChunkCombo = new System.Windows.Forms.ContextMenuStrip(this.components);
this.saveChunkBtn = new System.Windows.Forms.ToolStripMenuItem();
this.viewHexBtn = new System.Windows.Forms.ToolStripMenuItem();
@@ -52,7 +51,6 @@
this.musicsButton = new System.Windows.Forms.Button();
this.musicBar = new System.Windows.Forms.ProgressBar();
this.musicLabel = new System.Windows.Forms.Label();
- this.SortedProgressBar = new System.Windows.Forms.ProgressBar();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.mainTab = new System.Windows.Forms.TabPage();
this.mfaTab = new System.Windows.Forms.TabPage();
@@ -63,11 +61,11 @@
this.dumpAllPackButton = new System.Windows.Forms.Button();
this.dumpPackButton = new System.Windows.Forms.Button();
this.packDataListBox = new System.Windows.Forms.ListBox();
- this.imgViewerTab = new System.Windows.Forms.TabPage();
- this.imageViewerInfo = new System.Windows.Forms.Label();
+ this.objViewerTab = new System.Windows.Forms.TabPage();
+ this.objViewerInfo = new System.Windows.Forms.Label();
this.imageViewerPlayAnim = new System.Windows.Forms.Button();
this.imageViewPictureBox = new System.Windows.Forms.PictureBox();
- this.imagesTreeView = new System.Windows.Forms.TreeView();
+ this.objTreeView = new System.Windows.Forms.TreeView();
this.soundViewTab = new System.Windows.Forms.TabPage();
this.stopSoundBtn = new System.Windows.Forms.Button();
this.soundList = new System.Windows.Forms.TreeView();
@@ -81,6 +79,8 @@
this.activatePluginBtn = new System.Windows.Forms.Button();
this.pluginsList = new System.Windows.Forms.ListBox();
this.settingsTab = new System.Windows.Forms.TabPage();
+ this.langComboBox = new System.Windows.Forms.ComboBox();
+ this.langLabel = new System.Windows.Forms.Label();
this.colorLabel = new System.Windows.Forms.Label();
this.updateSettings = new System.Windows.Forms.Button();
this.colorBox = new System.Windows.Forms.TextBox();
@@ -90,7 +90,7 @@
this.mainTab.SuspendLayout();
this.mfaTab.SuspendLayout();
this.packDataTab.SuspendLayout();
- this.imgViewerTab.SuspendLayout();
+ this.objViewerTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize) (this.imageViewPictureBox)).BeginInit();
this.soundViewTab.SuspendLayout();
this.cryptKeyTab.SuspendLayout();
@@ -121,16 +121,16 @@
//
// treeView1
//
- this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right)));
this.treeView1.BackColor = System.Drawing.Color.Black;
this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.treeView1.Dock = System.Windows.Forms.DockStyle.Right;
this.treeView1.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.treeView1.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
- this.treeView1.Location = new System.Drawing.Point(649, 8);
+ this.treeView1.Location = new System.Drawing.Point(646, 3);
this.treeView1.Margin = new System.Windows.Forms.Padding(0);
this.treeView1.MaximumSize = new System.Drawing.Size(500, 900);
this.treeView1.Name = "treeView1";
- this.treeView1.Size = new System.Drawing.Size(286, 460);
+ this.treeView1.Size = new System.Drawing.Size(286, 473);
this.treeView1.TabIndex = 1;
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
this.treeView1.DoubleClick += new System.EventHandler(this.treeView1_AfterDblClick);
@@ -138,20 +138,20 @@
//
// listBox1
//
- this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.BackColor = System.Drawing.Color.Black;
this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.listBox1.Dock = System.Windows.Forms.DockStyle.Right;
this.listBox1.Font = new System.Drawing.Font("Courier New", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.listBox1.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.listBox1.FormattingEnabled = true;
this.listBox1.IntegralHeight = false;
this.listBox1.ItemHeight = 17;
- this.listBox1.Location = new System.Drawing.Point(349, 8);
+ this.listBox1.Location = new System.Drawing.Point(346, 3);
this.listBox1.Margin = new System.Windows.Forms.Padding(0);
this.listBox1.MaximumSize = new System.Drawing.Size(300, 50000);
this.listBox1.MinimumSize = new System.Drawing.Size(180, 234);
this.listBox1.Name = "listBox1";
- this.listBox1.Size = new System.Drawing.Size(300, 277);
+ this.listBox1.Size = new System.Drawing.Size(300, 473);
this.listBox1.TabIndex = 5;
//
// GameInfo
@@ -295,22 +295,6 @@
this.loadingLabel.TabIndex = 16;
this.loadingLabel.Text = "Loading...";
//
- // dumpSortedBtn
- //
- this.dumpSortedBtn.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.dumpSortedBtn.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
- this.dumpSortedBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.dumpSortedBtn.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
- this.dumpSortedBtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
- this.dumpSortedBtn.Location = new System.Drawing.Point(8, 406);
- this.dumpSortedBtn.Name = "dumpSortedBtn";
- this.dumpSortedBtn.Size = new System.Drawing.Size(83, 42);
- this.dumpSortedBtn.TabIndex = 19;
- this.dumpSortedBtn.Text = "Dump Sorted";
- this.dumpSortedBtn.UseVisualStyleBackColor = false;
- this.dumpSortedBtn.Visible = false;
- this.dumpSortedBtn.Click += new System.EventHandler(this.dumpSortedBtn_Click);
- //
// ChunkCombo
//
this.ChunkCombo.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.saveChunkBtn, this.viewHexBtn, this.previewFrameBtn});
@@ -380,22 +364,13 @@
this.musicLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.musicLabel.Visible = false;
//
- // SortedProgressBar
- //
- this.SortedProgressBar.Location = new System.Drawing.Point(97, 407);
- this.SortedProgressBar.Name = "SortedProgressBar";
- this.SortedProgressBar.Size = new System.Drawing.Size(209, 41);
- this.SortedProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
- this.SortedProgressBar.TabIndex = 24;
- this.SortedProgressBar.Visible = false;
- //
// tabControl1
//
this.tabControl1.AllowDrop = true;
this.tabControl1.Controls.Add(this.mainTab);
this.tabControl1.Controls.Add(this.mfaTab);
this.tabControl1.Controls.Add(this.packDataTab);
- this.tabControl1.Controls.Add(this.imgViewerTab);
+ this.tabControl1.Controls.Add(this.objViewerTab);
this.tabControl1.Controls.Add(this.soundViewTab);
this.tabControl1.Controls.Add(this.cryptKeyTab);
this.tabControl1.Controls.Add(this.pluginTab);
@@ -420,7 +395,6 @@
this.mainTab.Controls.Add(this.label1);
this.mainTab.Controls.Add(this.loadingLabel);
this.mainTab.Controls.Add(this.button1);
- this.mainTab.Controls.Add(this.SortedProgressBar);
this.mainTab.Controls.Add(this.imageBar);
this.mainTab.Controls.Add(this.treeView1);
this.mainTab.Controls.Add(this.musicLabel);
@@ -431,7 +405,6 @@
this.mainTab.Controls.Add(this.musicsButton);
this.mainTab.Controls.Add(this.soundLabel);
this.mainTab.Controls.Add(this.FolderBTN);
- this.mainTab.Controls.Add(this.dumpSortedBtn);
this.mainTab.Controls.Add(this.soundsButton);
this.mainTab.Location = new System.Drawing.Point(4, 24);
this.mainTab.Name = "mainTab";
@@ -547,32 +520,32 @@
this.packDataListBox.TabIndex = 4;
this.packDataListBox.SelectedIndexChanged += new System.EventHandler(this.packDataListBox_SelectedIndexChanged);
//
- // imgViewerTab
- //
- this.imgViewerTab.BackColor = System.Drawing.Color.Black;
- this.imgViewerTab.Controls.Add(this.imageViewerInfo);
- this.imgViewerTab.Controls.Add(this.imageViewerPlayAnim);
- this.imgViewerTab.Controls.Add(this.imageViewPictureBox);
- this.imgViewerTab.Controls.Add(this.imagesTreeView);
- this.imgViewerTab.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
- this.imgViewerTab.Location = new System.Drawing.Point(4, 24);
- this.imgViewerTab.Name = "imgViewerTab";
- this.imgViewerTab.Padding = new System.Windows.Forms.Padding(3);
- this.imgViewerTab.Size = new System.Drawing.Size(935, 479);
- this.imgViewerTab.TabIndex = 1;
- this.imgViewerTab.Text = "Images";
- //
- // imageViewerInfo
- //
- this.imageViewerInfo.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.imageViewerInfo.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
- this.imageViewerInfo.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
- this.imageViewerInfo.Location = new System.Drawing.Point(696, 3);
- this.imageViewerInfo.Name = "imageViewerInfo";
- this.imageViewerInfo.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
- this.imageViewerInfo.Size = new System.Drawing.Size(236, 63);
- this.imageViewerInfo.TabIndex = 3;
- this.imageViewerInfo.Text = "DEBUG";
+ // objViewerTab
+ //
+ this.objViewerTab.BackColor = System.Drawing.Color.Black;
+ this.objViewerTab.Controls.Add(this.objViewerInfo);
+ this.objViewerTab.Controls.Add(this.imageViewerPlayAnim);
+ this.objViewerTab.Controls.Add(this.imageViewPictureBox);
+ this.objViewerTab.Controls.Add(this.objTreeView);
+ this.objViewerTab.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
+ this.objViewerTab.Location = new System.Drawing.Point(4, 24);
+ this.objViewerTab.Name = "objViewerTab";
+ this.objViewerTab.Padding = new System.Windows.Forms.Padding(3);
+ this.objViewerTab.Size = new System.Drawing.Size(935, 479);
+ this.objViewerTab.TabIndex = 1;
+ this.objViewerTab.Text = "Objects";
+ //
+ // objViewerInfo
+ //
+ this.objViewerInfo.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.objViewerInfo.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
+ this.objViewerInfo.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
+ this.objViewerInfo.Location = new System.Drawing.Point(623, 3);
+ this.objViewerInfo.Name = "objViewerInfo";
+ this.objViewerInfo.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.objViewerInfo.Size = new System.Drawing.Size(309, 63);
+ this.objViewerInfo.TabIndex = 3;
+ this.objViewerInfo.Text = "DEBUG";
//
// imageViewerPlayAnim
//
@@ -596,15 +569,15 @@
this.imageViewPictureBox.TabIndex = 1;
this.imageViewPictureBox.TabStop = false;
//
- // imagesTreeView
+ // objTreeView
//
- this.imagesTreeView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.imagesTreeView.Dock = System.Windows.Forms.DockStyle.Left;
- this.imagesTreeView.Location = new System.Drawing.Point(3, 3);
- this.imagesTreeView.Name = "imagesTreeView";
- this.imagesTreeView.Size = new System.Drawing.Size(198, 473);
- this.imagesTreeView.TabIndex = 1;
- this.imagesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.advancedTreeView_AfterSelect);
+ this.objTreeView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.objTreeView.Dock = System.Windows.Forms.DockStyle.Left;
+ this.objTreeView.Location = new System.Drawing.Point(3, 3);
+ this.objTreeView.Name = "objTreeView";
+ this.objTreeView.Size = new System.Drawing.Size(198, 473);
+ this.objTreeView.TabIndex = 1;
+ this.objTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.advancedTreeView_AfterSelect);
//
// soundViewTab
//
@@ -749,6 +722,8 @@
// settingsTab
//
this.settingsTab.BackColor = System.Drawing.Color.Black;
+ this.settingsTab.Controls.Add(this.langComboBox);
+ this.settingsTab.Controls.Add(this.langLabel);
this.settingsTab.Controls.Add(this.colorLabel);
this.settingsTab.Controls.Add(this.updateSettings);
this.settingsTab.Controls.Add(this.colorBox);
@@ -758,6 +733,25 @@
this.settingsTab.TabIndex = 7;
this.settingsTab.Text = "Settings";
//
+ // langComboBox
+ //
+ this.langComboBox.FormattingEnabled = true;
+ this.langComboBox.Items.AddRange(new object[] {"en-US", "ru-RU"});
+ this.langComboBox.Location = new System.Drawing.Point(70, 31);
+ this.langComboBox.Name = "langComboBox";
+ this.langComboBox.Size = new System.Drawing.Size(109, 23);
+ this.langComboBox.TabIndex = 4;
+ this.langComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+ //
+ // langLabel
+ //
+ this.langLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
+ this.langLabel.Location = new System.Drawing.Point(8, 34);
+ this.langLabel.Name = "langLabel";
+ this.langLabel.Size = new System.Drawing.Size(56, 15);
+ this.langLabel.TabIndex = 3;
+ this.langLabel.Text = "Lang:";
+ //
// colorLabel
//
this.colorLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
@@ -810,7 +804,7 @@
this.mfaTab.ResumeLayout(false);
this.mfaTab.PerformLayout();
this.packDataTab.ResumeLayout(false);
- this.imgViewerTab.ResumeLayout(false);
+ this.objViewerTab.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize) (this.imageViewPictureBox)).EndInit();
this.soundViewTab.ResumeLayout(false);
this.cryptKeyTab.ResumeLayout(false);
@@ -822,6 +816,16 @@
this.ResumeLayout(false);
}
+ private System.Windows.Forms.ComboBox langComboBox;
+
+ private System.Windows.Forms.Label langLabel;
+
+ private System.Windows.Forms.TreeView objTreeView;
+
+ private System.Windows.Forms.Label objViewerInfo;
+
+ private System.Windows.Forms.TabPage objViewerTab;
+
private System.Windows.Forms.TextBox colorBox;
private System.Windows.Forms.Label colorLabel;
private System.Windows.Forms.Button updateSettings;
@@ -836,12 +840,8 @@
private System.Windows.Forms.TabPage soundViewTab;
- private System.Windows.Forms.TreeView imagesTreeView;
private System.Windows.Forms.Button imageViewerPlayAnim;
private System.Windows.Forms.PictureBox imageViewPictureBox;
- private System.Windows.Forms.TabPage imgViewerTab;
-
- private System.Windows.Forms.Label imageViewerInfo;
private System.Windows.Forms.Button activatePluginBtn;
private System.Windows.Forms.ListBox pluginsList;
@@ -875,11 +875,8 @@
private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.ProgressBar SortedProgressBar;
-
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ContextMenuStrip ChunkCombo;
- private System.Windows.Forms.Button dumpSortedBtn;
private System.Windows.Forms.Button FolderBTN;
private System.Windows.Forms.Label GameInfo;
private System.Windows.Forms.ProgressBar imageBar;
diff --git a/CTFAK/GUI/MainForm.cs b/CTFAK/GUI/MainForm.cs
index fae9365..75ccada 100644
--- a/CTFAK/GUI/MainForm.cs
+++ b/CTFAK/GUI/MainForm.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Media;
@@ -49,6 +50,8 @@ namespace CTFAK.GUI
{
//Buttons
InitializeComponent();
+ Thread.CurrentThread.CurrentUICulture=new CultureInfo(LoadableSettings.instance["lang"].ToString());
+
ColorTheme = color;
foreach (Control item in Controls)
{
@@ -93,7 +96,6 @@ namespace CTFAK.GUI
imagesButton.Text = Properties.GlobalStrings.dumpImages;
soundsButton.Text = Properties.GlobalStrings.dumpSounds;
musicsButton.Text = Properties.GlobalStrings.dumpMusics;
- dumpSortedBtn.Text = Properties.GlobalStrings.dumpSorted;
FolderBTN.Text=Properties.GlobalStrings.openFolder;
@@ -111,9 +113,9 @@ namespace CTFAK.GUI
if (dlg == DialogResult.Yes) Environment.Exit(0);
else e.Cancel = true;
};
- imageViewerInfo.Parent = imageViewPictureBox;
- imageViewerInfo.BackColor=Color.Transparent;
- imageViewerInfo.Dock = DockStyle.Right;
+ objViewerInfo.Parent = imageViewPictureBox;
+ objViewerInfo.BackColor=Color.Transparent;
+ objViewerInfo.Dock = DockStyle.Right;
@@ -142,7 +144,12 @@ namespace CTFAK.GUI
var worker = new BackgroundWorker();
worker.DoWork += (workSender, workE) =>
{
- if (File.Exists(openFileDialog1.FileName)) StartReading();
+ if (File.Exists(openFileDialog1.FileName))
+ {
+ objTreeView.Nodes.Clear();
+
+ StartReading();
+ }
else throw new NotImplementedException("File not found");
};
worker.RunWorkerCompleted += (workSender, workE) => { AfterLoad(); };
@@ -174,7 +181,8 @@ namespace CTFAK.GUI
private void StartReading()
{
var path = openFileDialog1.FileName;
- //loadingLabel.Visible = true;
+ Loaded = false;
+ loadingLabel.Visible = true;
Program.ReadFile(path, Settings.Verbose, Settings.DumpImages, Settings.DumpSounds);
imageBar.Value = 0;
@@ -187,8 +195,6 @@ namespace CTFAK.GUI
imagesButton.Visible = false;
soundsButton.Visible = false;
musicsButton.Visible = false;
- dumpSortedBtn.Visible = false;
- Loaded = false;
}
private void treeView1_AfterDblClick(object sender, EventArgs e)
@@ -306,7 +312,6 @@ namespace CTFAK.GUI
imagesButton.Visible = true;
soundsButton.Visible = true;
musicsButton.Visible = true;
- dumpSortedBtn.Visible = true;
GameInfo.Visible = true;
loadingLabel.Visible = false;
@@ -334,7 +339,6 @@ namespace CTFAK.GUI
Exe.Instance.GameData.GameChunks.GetChunk().OnSoundSaved += UpdateSoundBar;
if (Exe.Instance.GameData.GameChunks.GetChunk() != null)
Exe.Instance.GameData.GameChunks.GetChunk().OnMusicSaved += UpdateMusicBar;
- ImageDumper.SortedImageSaved += IncrementSortedBar;
GameInfo.Text = toLog;
@@ -363,13 +367,7 @@ namespace CTFAK.GUI
musicLabel.Text = $@"{index}/{all}";
}
- private void IncrementSortedBar(int all)
- {
- SortedProgressBar.Visible = true;
- SortedProgressBar.Maximum = all;
- SortedProgressBar.Value += 1;
- if (SortedProgressBar.Value >= SortedProgressBar.Maximum) SortedProgressBar.Visible = false;
- }
+
private void FolderBTN_Click(object sender, EventArgs e)
@@ -611,7 +609,7 @@ namespace CTFAK.GUI
foreach (var frame in Exe.Instance.GameData.Frames)
{
var frameNode = new ChunkNode(frame.Name, frame);
- imagesTreeView.Nodes.Add(frameNode);
+ objTreeView.Nodes.Add(frameNode);
if (frame.Objects != null)
foreach (var objInst in frame.Objects.Items)
{
@@ -697,7 +695,7 @@ namespace CTFAK.GUI
private void advancedPlayAnimation_Click(object sender, EventArgs e)
{
- if (((ChunkNode) imagesTreeView.SelectedNode).loader is Animation anim)
+ if (((ChunkNode) objTreeView.SelectedNode).loader is Animation anim)
{
if (_isAnimRunning)
{
@@ -717,7 +715,7 @@ namespace CTFAK.GUI
}
}
}
- else if (((ChunkNode) imagesTreeView.SelectedNode).loader is AnimationDirection dir)
+ else if (((ChunkNode) objTreeView.SelectedNode).loader is AnimationDirection dir)
{
if (_isAnimRunning)
{
@@ -750,7 +748,7 @@ namespace CTFAK.GUI
foreach (var frame in frames)
{
imageViewPictureBox.Image = frame;
- imageViewerInfo.Text = $"Current frame: {frames.IndexOf(frame)}\nAnimation Speed: {fps}";
+ objViewerInfo.Text = $"Current frame: {frames.IndexOf(frame)}\nAnimation Speed: {fps}";
Thread.Sleep((int) (delay * 1500));
}
@@ -769,7 +767,7 @@ namespace CTFAK.GUI
{
var frame = frames[i];
imageViewPictureBox.Image = frame;
- imageViewerInfo.Text = $"Current frame: {i.ToString()}\nAnimation Speed: {fps}";
+ objViewerInfo.Text = $"Current frame: {i.ToString()}\nAnimation Speed: {fps}";
Thread.Sleep((int) (delay * 1500));
i++;
if (i == frames.Count) i = 0;
@@ -797,6 +795,31 @@ namespace CTFAK.GUI
text += $"Action Point: {img.ActionX}x{img.ActionY}\r\n";
text += $"Hotspot: {img.XHotspot}x{img.YHotspot}\r\n";
imageViewPictureBox.Image = img.Bitmap;
+ }
+ else if (loader is Animation anim)
+ {
+ text += $"Current frame: 0";
+ text+=$"\r\nAnimation Speed: {anim.DirectionDict.FirstOrDefault().Value.MaxSpeed}";
+
+ imageViewPictureBox.Image = Exe.Instance.GameData.GameChunks.GetChunk()
+ .FromHandle(anim.DirectionDict.FirstOrDefault().Value.Frames[0]).Bitmap;
+
+ }
+ else if (loader is Frame frame)
+ {
+ text += $"Name: {frame.Name}\r\n";
+ text += $"Size: {frame.Width}x{frame.Height}\r\n";
+ text += $"Objects: {frame.Objects.Items.Count}\r\n";
+ text += $"Layers: {frame.Layers.Items.Count}\r\n";
+ text += $"Flags:\r\n";
+ foreach (var part in frame.Flags.ToString().Split(';'))
+ {
+ text += part+"\r\n";
+
+ }
+
+
+
}
else if (loader is ObjectInstance instance)
{
@@ -810,6 +833,12 @@ namespace CTFAK.GUI
var common = ((ObjectCommon) instance.FrameItem.Properties.Loader);
switch (instance.FrameItem.ObjectType)
{
+ case 2:
+ text += $"Animations: {common.Animations?.AnimationDict.Count}";
+ imageViewPictureBox.Image = Exe.Instance.GameData.GameChunks.GetChunk()
+ .FromHandle(common.Animations.AnimationDict.FirstOrDefault().Value.DirectionDict
+ .FirstOrDefault().Value.Frames.FirstOrDefault()).Bitmap;
+ break;
case 3:
ObjectViewerLabel = new Label();
var content = string.Empty;
@@ -825,18 +854,35 @@ namespace CTFAK.GUI
imageViewPictureBox.Controls.Add(ObjectViewerLabel);
break;
+ case 7:
+ var handle = common.Counters?.Frames.FirstOrDefault();
+ if (handle == null) imageViewPictureBox.Image = imageViewPictureBox.ErrorImage;
+ else
+ {
+ imageViewPictureBox.Image = Exe.Instance.GameData.GameChunks.GetChunk()
+ .FromHandle((int) handle).Bitmap;
+ }
+
+ //text += $"Add 0's to the left: {common?.Counters?.AddNulls}";
+ //text += $"Fixed number of digits: {(common.Counters.UseDecimals ? common?.Counters?.FloatDigits : common?.Counters?.IntegerDigits)}";
+ break;
+
default:
text += "No additional info";
break;
-
}
}
+ else
+ {
+ if (instance.FrameItem.ObjectType == 1)
+ imageViewPictureBox.Image = Exe.Instance.GameData.GameChunks.GetChunk().FromHandle(((Backdrop)instance.FrameItem.Properties.Loader).Image).Bitmap;
+ }
}
- imageViewerInfo.Text = text;
+ objViewerInfo.Text = text;
}
@@ -875,12 +921,12 @@ namespace CTFAK.GUI
protected override void OnKeyDown(KeyEventArgs e)
{
- if (tabControl1.SelectedTab == imgViewerTab)
+ if (tabControl1.SelectedTab == objViewerTab)
if (e.Control)
{
- var node = (ChunkNode) imagesTreeView.SelectedNode;
+ var node = (ChunkNode) objTreeView.SelectedNode;
var path =
- $"{Settings.ImagePath}\\{Helper.GetTreePath(imagesTreeView, (ChunkNode) imagesTreeView.SelectedNode)}";
+ $"{Settings.ImagePath}\\{Helper.GetTreePath(objTreeView, (ChunkNode) objTreeView.SelectedNode)}";
if (node == null) return;
ImageDumper.SaveFromNode(node);
}
@@ -901,5 +947,10 @@ namespace CTFAK.GUI
{
LoadableSettings.instance["mainColor"] = colorBox.Text;
}
+
+ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ LoadableSettings.instance["lang"] = langComboBox.SelectedItem;
+ }
}
}
\ No newline at end of file
diff --git a/CTFAK/GUI/MainForm.resx b/CTFAK/GUI/MainForm.resx
index c223d76..4a28920 100644
--- a/CTFAK/GUI/MainForm.resx
+++ b/CTFAK/GUI/MainForm.resx
@@ -127,7 +127,7 @@
270, 17
- 73
+ 74
diff --git a/CTFAK/MMFParser/EXE/ChunkList.cs b/CTFAK/MMFParser/EXE/ChunkList.cs
index d952e7d..2dee7e0 100644
--- a/CTFAK/MMFParser/EXE/ChunkList.cs
+++ b/CTFAK/MMFParser/EXE/ChunkList.cs
@@ -169,6 +169,9 @@ namespace CTFAK.MMFParser.EXE
case 8741:
loader = new AppAuthor(chunk);
break;
+ case 8742:
+ loader = new AppMenu(chunk);
+ break;
case 8743:
loader = new ExtPath(chunk);
break;
@@ -327,6 +330,7 @@ namespace CTFAK.MMFParser.EXE
case 8770: return Properties.Locale.ChunkNames.protection;//"Protection";
case 8771: return Properties.Locale.ChunkNames.shaders;//"Shaders";
case 8773: return Properties.Locale.ChunkNames.extHeader;//"Extended Header";
+ case 8774: return "Spacer";//"Spacer";
case 13107:return Properties.Locale.ChunkNames.frame;//"Frame";
case 13108:return Properties.Locale.ChunkNames.frameHeader;//"Frame Header";
case 13109:return Properties.Locale.ChunkNames.frameName;//"Frame Name";
diff --git a/CTFAK/MMFParser/EXE/EXE.cs b/CTFAK/MMFParser/EXE/EXE.cs
index b0e4db8..7c6fae9 100644
--- a/CTFAK/MMFParser/EXE/EXE.cs
+++ b/CTFAK/MMFParser/EXE/EXE.cs
@@ -62,8 +62,7 @@ namespace CTFAK.MMFParser.EXE
exeReader.Seek(possition);
var firstShort = exeReader.PeekUInt16();
Logger.Log("First Short: " + firstShort.ToString("X2"), true, ConsoleColor.Yellow);
- if (firstShort == 0x7777) Settings.Old = false;
- else Settings.Old = true;
+ if (firstShort != 0x7777) Settings.Old = true;
if (!Settings.Old)
{
PackData = new PackData();
@@ -75,6 +74,7 @@ namespace CTFAK.MMFParser.EXE
}
else
{
+ Logger.Log("Game is too old");
var oldData = new ChunkList();
oldData.Read(exeReader);
GameData = new GameData();
diff --git a/CTFAK/MMFParser/EXE/Loaders/AppMenu.cs b/CTFAK/MMFParser/EXE/Loaders/AppMenu.cs
index 4e769ef..6b480be 100644
--- a/CTFAK/MMFParser/EXE/Loaders/AppMenu.cs
+++ b/CTFAK/MMFParser/EXE/Loaders/AppMenu.cs
@@ -27,7 +27,13 @@ namespace CTFAK.MMFParser.EXE.Loaders
public override string[] GetReadableData()
{
- throw new NotImplementedException();
+ List list = new List();
+ foreach (AppMenuItem item in Items)
+ {
+ list.Add(item.Name);
+ }
+
+ return list.ToArray();
}
public override void Read()
diff --git a/CTFAK/MMFParser/EXE/Loaders/Banks/ImageBank.cs b/CTFAK/MMFParser/EXE/Loaders/Banks/ImageBank.cs
index bd7c832..49efbdd 100644
--- a/CTFAK/MMFParser/EXE/Loaders/Banks/ImageBank.cs
+++ b/CTFAK/MMFParser/EXE/Loaders/Banks/ImageBank.cs
@@ -50,6 +50,7 @@ namespace CTFAK.MMFParser.EXE.Loaders.Banks
public ImageItem FromHandle(int handle)
{
Images.TryGetValue(handle, out var img);
+ if (handle == -1) return Images[Images.Count-1];
if (img == null) return null;
else return img;
}
@@ -57,6 +58,7 @@ namespace CTFAK.MMFParser.EXE.Loaders.Banks
public void LoadByHandle(int handle)
{
+
Images[handle].Load();
}
diff --git a/CTFAK/MMFParser/EXE/Loaders/Objects/Counters.cs b/CTFAK/MMFParser/EXE/Loaders/Objects/Counters.cs
index 8283114..52b2e8c 100644
--- a/CTFAK/MMFParser/EXE/Loaders/Objects/Counters.cs
+++ b/CTFAK/MMFParser/EXE/Loaders/Objects/Counters.cs
@@ -49,6 +49,16 @@ namespace CTFAK.MMFParser.EXE.Loaders.Objects
int _floatDecimalsShift = 12;
int _floatPad = 0x0800;
public List Frames;
+ public uint Width;
+ public uint Height;
+ public int IntegerDigits;
+ public bool FormatFloat;
+ public int FloatDigits;
+ public bool UseDecimals;
+ public int Decimals;
+ public ushort Font;
+ public bool Inverse;
+ public bool AddNulls;
public Counters(ByteReader reader) : base(reader)
{
@@ -62,21 +72,21 @@ namespace CTFAK.MMFParser.EXE.Loaders.Objects
{
var size = Reader.ReadUInt32();
- var width = Reader.ReadUInt32();
- var height = Reader.ReadUInt32();
+ Width = Reader.ReadUInt32();
+ Height = Reader.ReadUInt32();
var player = Reader.ReadUInt16();
var displayType = Reader.ReadUInt16();
var flags = Reader.ReadUInt16();
- var integerDigits = flags & _intDigitsMask;
- var formatFloat = (flags & _formatFloat) != 0;
- var floatDigits = (flags & _floatDigitsMask) >> _floatDigitsShift + 1;
- var useDecimals = (flags & _useDecimals) != 0;
- var decimals = (flags & _floatDecimalsMask) >> _floatDecimalsShift;
- var addNulls = (flags & _floatPad) != 0;
+ IntegerDigits = flags & _intDigitsMask;
+ FormatFloat = (flags & _formatFloat) != 0;
+ FloatDigits = (flags & _floatDigitsMask) >> _floatDigitsShift + 1;
+ UseDecimals = (flags & _useDecimals) != 0;
+ Decimals = (flags & _floatDecimalsMask) >> _floatDecimalsShift;
+ AddNulls = (flags & _floatPad) != 0;
- var inverse = ByteFlag.GetFlag(flags, 8);
- var font = Reader.ReadUInt16();
+ Inverse = ByteFlag.GetFlag(flags, 8);
+ Font = Reader.ReadUInt16();
if (displayType == 0) return;
else if (displayType == 1 || displayType == 4|| displayType==50)
{
diff --git a/CTFAK/Program.cs b/CTFAK/Program.cs
index e5b0393..456a2bc 100644
--- a/CTFAK/Program.cs
+++ b/CTFAK/Program.cs
@@ -24,6 +24,7 @@ namespace CTFAK
private static void Main(string[] args)
{
InitNativeLibrary();
+
if (!File.Exists("settings.sav"))
{
File.Create("settings.sav");
@@ -33,14 +34,14 @@ namespace CTFAK
// MFAGenerator.ReadTestMFA();
// Environment.Exit(0);
- AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
+ /*AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
if (eventArgs.Exception is ThreadAbortException) return;
var ex = (Exception) eventArgs.Exception;
Logger.Log("ERROR: ");
Logger.Log(ex.ToString());
- };
+ };*/
Settings.UseGUI = true;
diff --git a/CTFAK/Settings.cs b/CTFAK/Settings.cs
index 501cf93..fc07472 100644
--- a/CTFAK/Settings.cs
+++ b/CTFAK/Settings.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
+using System.Threading;
namespace CTFAK
{
@@ -37,7 +38,7 @@ namespace CTFAK
- public static string DumperVersion = true ? "CTFAK 0.3 Alpha" : "CTFAK 0.2.1-a Debug";
+ public static string DumperVersion = true ? "CTFAK 0.3.5 Alpha" : "CTFAK 0.2.1-a Debug";
}
public class LoadableSettings
@@ -49,17 +50,19 @@ namespace CTFAK
public static LoadableSettings FromFile(string path)
{
-
if (!File.Exists(path)) File.Create(path);
+ Thread.Sleep(1500);
var settings = new LoadableSettings();
settings.path = path;
var rawData = File.ReadAllLines(path);
- foreach (string rawLine in rawData)
+ if (rawData.Length > 0)
{
- var split = rawLine.Split('=');
- settings._data.Add(split[0],split[1]);
+ foreach (string rawLine in rawData)
+ {
+ var split = rawLine.Split('=');
+ settings._data.Add(split[0],split[1]);
+ }
}
-
instance = settings;
return settings;
diff --git a/CTFAK/Utils/ImageDumper.cs b/CTFAK/Utils/ImageDumper.cs
index 6c5315a..c7a4565 100644
--- a/CTFAK/Utils/ImageDumper.cs
+++ b/CTFAK/Utils/ImageDumper.cs
@@ -34,7 +34,10 @@ namespace CTFAK.Utils
SaveAnimation(anim,bank,fullPath);
}
- else if(node.loader is ObjectInstance) Console.WriteLine("Dumping Common");
+ else if (node.loader is ObjectInstance instance)
+ {
+ SaveInstance(instance,bank,fullPath);
+ }
else if(node.loader is Backdrop) Console.WriteLine("Dumping Backdrop");
else if(node.loader is Frame) Console.WriteLine("Dumping Frame");
@@ -55,7 +58,32 @@ namespace CTFAK.Utils
bank.Images[frame].Save($"{fullPath}\\{i}.png");
}
}
-
+ public static void SaveInstance(ObjectInstance inst, ImageBank bank,string fullPath)
+ {
+ if (inst.FrameItem.Properties.IsCommon)
+ {
+ var common = ((ObjectCommon)inst.FrameItem.Properties.Loader);
+ switch (common.Parent.ObjectType)
+ {
+ case 2:
+ foreach (var pair in common.Animations.AnimationDict.ToArray())
+ {
+ SaveAnimation(pair.Value,bank,fullPath+"\\Animation "+pair.Key);
+ }
+ break;
+ case 7:
+ foreach (int frame in common.Counters.Frames)
+ {
+ var img = bank.FromHandle(frame);
+ img.Save(fullPath+$"\\{frame}.png");
+ }
+ break;
+
+ }
+
+ }
+
+ }
public static void SaveAnimation(Animation anim, ImageBank bank, string fullPath)
{
if (anim.DirectionDict.ToArray().Length > 1)
@@ -65,6 +93,7 @@ namespace CTFAK.Utils
Directory.CreateDirectory($"{fullPath}\\Direction {anim.DirectionDict.ToList().IndexOf(dirpair)}");
for (int i = 0; i < anim.DirectionDict[0].Frames.Count; i++)
{
+
var frame = dirpair.Value.Frames[i];
bank.Images[frame].Save($"{fullPath}\\Direction {anim.DirectionDict.ToList().IndexOf(dirpair)}\\{i}.png");
}
@@ -74,6 +103,7 @@ namespace CTFAK.Utils
{
for (int i = 0; i < anim.DirectionDict[0].Frames.Count; i++)
{
+ Directory.CreateDirectory(fullPath);
var frame = anim.DirectionDict[0].Frames[i];
bank.Images[frame].Save($"{fullPath}\\{i}.png");
}