GUI refactor, ImageBank refactor, MIDI support, ObjectInfo refactor

master
1987kostya 5 years ago
parent 3bd7bca7c6
commit e171a46eac

@ -9,7 +9,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{86D99F9E-98FB-4E50-AB68-F5C115850C33}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>NetMFAPatcher</RootNamespace>
<RootNamespace>DotNetCTFDumper</RootNamespace>
<AssemblyName>DotNetCTFDumper</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@ -67,12 +67,13 @@
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Be.Windows.Forms.HexBox, Version=1.6.1.0, Culture=neutral, PublicKeyToken=null">
@ -147,6 +148,8 @@
<Compile Include="MMFParser\ChunkLoaders\FrameItems.cs" />
<Compile Include="MMFParser\ChunkLoaders\ObjectNames.cs" />
<Compile Include="MMFParser\ChunkLoaders\Objects\Animations.cs" />
<Compile Include="MMFParser\ChunkLoaders\Objects\Backdrop.cs" />
<Compile Include="MMFParser\ChunkLoaders\Objects\Counters.cs" />
<Compile Include="MMFParser\ChunkLoaders\Objects\ObjectCommon.cs" />
<Compile Include="MMFParser\ChunkLoaders\Objects\Value.cs" />
<Compile Include="MMFParser\Data\DataLoader.cs" />

@ -1,8 +1,8 @@
using System.Windows.Forms;
using NetMFAPatcher.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.Data;
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.Data;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
public class ChunkNode:TreeNode
{

@ -1,6 +1,6 @@
using System.ComponentModel;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
partial class CryptoKeyForm
{
@ -43,6 +43,7 @@ namespace NetMFAPatcher.GUI
this.charBox.BackColor = System.Drawing.Color.Black;
this.charBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.charBox.Dock = System.Windows.Forms.DockStyle.Top;
this.charBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.charBox.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.charBox.Location = new System.Drawing.Point(0, 0);
this.charBox.Name = "charBox";
@ -57,7 +58,7 @@ namespace NetMFAPatcher.GUI
this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hexBox1.ColumnInfoVisible = true;
this.hexBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.hexBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.hexBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.hexBox1.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.hexBox1.LineInfoVisible = true;
this.hexBox1.Location = new System.Drawing.Point(0, 20);
@ -75,6 +76,7 @@ namespace NetMFAPatcher.GUI
this.plusButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.plusButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.plusButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.plusButton.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.plusButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.plusButton.Location = new System.Drawing.Point(616, 0);
this.plusButton.Name = "plusButton";
@ -89,6 +91,7 @@ namespace NetMFAPatcher.GUI
this.minusButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.minusButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.minusButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.minusButton.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.minusButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.minusButton.Location = new System.Drawing.Point(589, 0);
this.minusButton.Name = "minusButton";

@ -1,11 +1,10 @@
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Be.Windows.Forms;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
public partial class CryptoKeyForm : Form
{

@ -1,6 +1,6 @@
using System.ComponentModel;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
partial class HexViewForm
{
@ -40,6 +40,7 @@ namespace NetMFAPatcher.GUI
// rawBox
//
this.rawBox.Dock = System.Windows.Forms.DockStyle.Top;
this.rawBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.rawBox.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.rawBox.Location = new System.Drawing.Point(0, 0);
this.rawBox.Name = "rawBox";
@ -55,7 +56,7 @@ namespace NetMFAPatcher.GUI
this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hexBox1.ColumnInfoVisible = true;
this.hexBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.hexBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.hexBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.hexBox1.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.hexBox1.LineInfoVisible = true;
this.hexBox1.Location = new System.Drawing.Point(0, 28);
@ -72,6 +73,7 @@ namespace NetMFAPatcher.GUI
// sizeLabel
//
this.sizeLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.sizeLabel.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.sizeLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.sizeLabel.Location = new System.Drawing.Point(0, 369);
this.sizeLabel.Name = "sizeLabel";

@ -1,12 +1,11 @@
using System;
using System.ComponentModel.Design;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Be.Windows.Forms;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
public partial class HexViewForm : Form
{

@ -1,7 +1,4 @@
using System;
using System.Windows.Forms;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
partial class MainForm
{
@ -39,17 +36,14 @@ namespace NetMFAPatcher.GUI
this.listBox1 = new System.Windows.Forms.ListBox();
this.GameInfo = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.ImageBox = new System.Windows.Forms.CheckBox();
this.SoundBox = new System.Windows.Forms.CheckBox();
this.ChunkBox = new System.Windows.Forms.CheckBox();
this.ImagesBar = new System.Windows.Forms.ProgressBar();
this.ImagesLabel = new System.Windows.Forms.Label();
this.SoundsLabel = new System.Windows.Forms.Label();
this.SoundBar = new System.Windows.Forms.ProgressBar();
this.imageBar = new System.Windows.Forms.ProgressBar();
this.imageLabel = new System.Windows.Forms.Label();
this.soundLabel = new System.Windows.Forms.Label();
this.soundBar = new System.Windows.Forms.ProgressBar();
this.FolderBTN = new System.Windows.Forms.Button();
this.MFABtn = new System.Windows.Forms.Button();
this.SoundsButton = new System.Windows.Forms.Button();
this.ImagesButton = new System.Windows.Forms.Button();
this.soundsButton = new System.Windows.Forms.Button();
this.imagesButton = new System.Windows.Forms.Button();
this.loadingLabel = new System.Windows.Forms.Label();
this.cryptKeyBtn = new System.Windows.Forms.Button();
this.showHexBtn = new System.Windows.Forms.Button();
@ -58,6 +52,9 @@ namespace NetMFAPatcher.GUI
this.saveChunkBtn = new System.Windows.Forms.ToolStripMenuItem();
this.viewHexBtn = new System.Windows.Forms.ToolStripMenuItem();
this.packDataBtn = new System.Windows.Forms.Button();
this.musicsButton = new System.Windows.Forms.Button();
this.musicBar = new System.Windows.Forms.ProgressBar();
this.musicLabel = new System.Windows.Forms.Label();
this.ChunkCombo.SuspendLayout();
this.SuspendLayout();
//
@ -143,100 +140,61 @@ namespace NetMFAPatcher.GUI
this.label1.TabIndex = 4;
this.label1.Text = "CTFDumper 0.1.1 Debug";
//
// ImageBox
//
this.ImageBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ImageBox.ForeColor = System.Drawing.Color.Lime;
this.ImageBox.Location = new System.Drawing.Point(9, 239);
this.ImageBox.Name = "ImageBox";
this.ImageBox.Size = new System.Drawing.Size(104, 24);
this.ImageBox.TabIndex = 5;
this.ImageBox.Text = "Dump Images";
this.ImageBox.UseVisualStyleBackColor = true;
this.ImageBox.Visible = false;
this.ImageBox.CheckedChanged += new System.EventHandler(this.ImageBox_CheckedChanged);
//
// SoundBox
//
this.SoundBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SoundBox.ForeColor = System.Drawing.Color.Lime;
this.SoundBox.Location = new System.Drawing.Point(9, 269);
this.SoundBox.Name = "SoundBox";
this.SoundBox.Size = new System.Drawing.Size(104, 24);
this.SoundBox.TabIndex = 6;
this.SoundBox.Text = "Dump Sounds";
this.SoundBox.UseVisualStyleBackColor = true;
this.SoundBox.Visible = false;
this.SoundBox.CheckedChanged += new System.EventHandler(this.SoundBox_CheckedChanged);
//
// ChunkBox
//
this.ChunkBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ChunkBox.ForeColor = System.Drawing.Color.Lime;
this.ChunkBox.Location = new System.Drawing.Point(9, 299);
this.ChunkBox.Name = "ChunkBox";
this.ChunkBox.Size = new System.Drawing.Size(104, 24);
this.ChunkBox.TabIndex = 7;
this.ChunkBox.Text = "Export Chunks\r\n";
this.ChunkBox.UseVisualStyleBackColor = true;
this.ChunkBox.Visible = false;
this.ChunkBox.CheckedChanged += new System.EventHandler(this.ChunkBox_CheckedChanged);
//
// ImagesBar
//
this.ImagesBar.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ImagesBar.BackColor = System.Drawing.Color.Black;
this.ImagesBar.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.ImagesBar.Location = new System.Drawing.Point(190, 367);
this.ImagesBar.Name = "ImagesBar";
this.ImagesBar.Size = new System.Drawing.Size(126, 23);
this.ImagesBar.Step = 2;
this.ImagesBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.ImagesBar.TabIndex = 8;
this.ImagesBar.Visible = false;
//
// ImagesLabel
//
this.ImagesLabel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ImagesLabel.BackColor = System.Drawing.Color.Transparent;
this.ImagesLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ImagesLabel.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.ImagesLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.ImagesLabel.Location = new System.Drawing.Point(322, 367);
this.ImagesLabel.Name = "ImagesLabel";
this.ImagesLabel.Size = new System.Drawing.Size(126, 24);
this.ImagesLabel.TabIndex = 9;
this.ImagesLabel.Text = "0/0";
this.ImagesLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ImagesLabel.Visible = false;
//
// SoundsLabel
//
this.SoundsLabel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SoundsLabel.BackColor = System.Drawing.Color.Black;
this.SoundsLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SoundsLabel.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.SoundsLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.SoundsLabel.Location = new System.Drawing.Point(322, 415);
this.SoundsLabel.Name = "SoundsLabel";
this.SoundsLabel.Size = new System.Drawing.Size(126, 24);
this.SoundsLabel.TabIndex = 11;
this.SoundsLabel.Text = "0/0";
this.SoundsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.SoundsLabel.Visible = false;
//
// SoundBar
//
this.SoundBar.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SoundBar.BackColor = System.Drawing.Color.Black;
this.SoundBar.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.SoundBar.Location = new System.Drawing.Point(190, 415);
this.SoundBar.Name = "SoundBar";
this.SoundBar.Size = new System.Drawing.Size(126, 23);
this.SoundBar.Step = 2;
this.SoundBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.SoundBar.TabIndex = 10;
this.SoundBar.Visible = false;
// imageBar
//
this.imageBar.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBar.BackColor = System.Drawing.Color.Black;
this.imageBar.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.imageBar.Location = new System.Drawing.Point(190, 367);
this.imageBar.Name = "imageBar";
this.imageBar.Size = new System.Drawing.Size(126, 23);
this.imageBar.Step = 2;
this.imageBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.imageBar.TabIndex = 8;
this.imageBar.Visible = false;
//
// imageLabel
//
this.imageLabel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageLabel.BackColor = System.Drawing.Color.Transparent;
this.imageLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.imageLabel.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.imageLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.imageLabel.Location = new System.Drawing.Point(322, 367);
this.imageLabel.Name = "imageLabel";
this.imageLabel.Size = new System.Drawing.Size(126, 24);
this.imageLabel.TabIndex = 9;
this.imageLabel.Text = "0/0";
this.imageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.imageLabel.Visible = false;
//
// soundLabel
//
this.soundLabel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.soundLabel.BackColor = System.Drawing.Color.Black;
this.soundLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.soundLabel.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.soundLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.soundLabel.Location = new System.Drawing.Point(322, 415);
this.soundLabel.Name = "soundLabel";
this.soundLabel.Size = new System.Drawing.Size(126, 24);
this.soundLabel.TabIndex = 11;
this.soundLabel.Text = "0/0";
this.soundLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.soundLabel.Visible = false;
//
// soundBar
//
this.soundBar.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.soundBar.BackColor = System.Drawing.Color.Black;
this.soundBar.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.soundBar.Location = new System.Drawing.Point(190, 415);
this.soundBar.Name = "soundBar";
this.soundBar.Size = new System.Drawing.Size(126, 23);
this.soundBar.Step = 2;
this.soundBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.soundBar.TabIndex = 10;
this.soundBar.Visible = false;
//
// FolderBTN
//
@ -245,7 +203,7 @@ namespace NetMFAPatcher.GUI
this.FolderBTN.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.FolderBTN.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.FolderBTN.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.FolderBTN.Location = new System.Drawing.Point(190, 453);
this.FolderBTN.Location = new System.Drawing.Point(101, 309);
this.FolderBTN.Name = "FolderBTN";
this.FolderBTN.Size = new System.Drawing.Size(83, 42);
this.FolderBTN.TabIndex = 12;
@ -258,10 +216,11 @@ namespace NetMFAPatcher.GUI
//
this.MFABtn.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MFABtn.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.MFABtn.Enabled = false;
this.MFABtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.MFABtn.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.MFABtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.MFABtn.Location = new System.Drawing.Point(101, 453);
this.MFABtn.Location = new System.Drawing.Point(12, 453);
this.MFABtn.Name = "MFABtn";
this.MFABtn.Size = new System.Drawing.Size(83, 42);
this.MFABtn.TabIndex = 13;
@ -270,37 +229,37 @@ namespace NetMFAPatcher.GUI
this.MFABtn.Visible = false;
this.MFABtn.Click += new System.EventHandler(this.MFABtn_Click);
//
// SoundsButton
//
this.SoundsButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SoundsButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.SoundsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SoundsButton.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.SoundsButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.SoundsButton.Location = new System.Drawing.Point(101, 405);
this.SoundsButton.Name = "SoundsButton";
this.SoundsButton.Size = new System.Drawing.Size(83, 42);
this.SoundsButton.TabIndex = 14;
this.SoundsButton.Text = "Dump Sounds";
this.SoundsButton.UseVisualStyleBackColor = false;
this.SoundsButton.Visible = false;
this.SoundsButton.Click += new System.EventHandler(this.SoundsButton_Click);
//
// ImagesButton
//
this.ImagesButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ImagesButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.ImagesButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ImagesButton.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.ImagesButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.ImagesButton.Location = new System.Drawing.Point(101, 357);
this.ImagesButton.Name = "ImagesButton";
this.ImagesButton.Size = new System.Drawing.Size(83, 42);
this.ImagesButton.TabIndex = 15;
this.ImagesButton.Text = "Dump\r\nImages";
this.ImagesButton.UseVisualStyleBackColor = false;
this.ImagesButton.Visible = false;
this.ImagesButton.Click += new System.EventHandler(this.ImagesButton_Click);
// soundsButton
//
this.soundsButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.soundsButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.soundsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.soundsButton.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.soundsButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.soundsButton.Location = new System.Drawing.Point(101, 405);
this.soundsButton.Name = "soundsButton";
this.soundsButton.Size = new System.Drawing.Size(83, 42);
this.soundsButton.TabIndex = 14;
this.soundsButton.Text = "Dump Sounds";
this.soundsButton.UseVisualStyleBackColor = false;
this.soundsButton.Visible = false;
this.soundsButton.Click += new System.EventHandler(this.soundsButton_Click);
//
// imagesButton
//
this.imagesButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imagesButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.imagesButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.imagesButton.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.imagesButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.imagesButton.Location = new System.Drawing.Point(101, 357);
this.imagesButton.Name = "imagesButton";
this.imagesButton.Size = new System.Drawing.Size(83, 42);
this.imagesButton.TabIndex = 15;
this.imagesButton.Text = "Dump\r\nImages";
this.imagesButton.UseVisualStyleBackColor = false;
this.imagesButton.Visible = false;
this.imagesButton.Click += new System.EventHandler(this.imagesButton_Click);
//
// loadingLabel
//
@ -321,7 +280,7 @@ namespace NetMFAPatcher.GUI
this.cryptKeyBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cryptKeyBtn.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.cryptKeyBtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.cryptKeyBtn.Location = new System.Drawing.Point(12, 405);
this.cryptKeyBtn.Location = new System.Drawing.Point(12, 357);
this.cryptKeyBtn.Name = "cryptKeyBtn";
this.cryptKeyBtn.Size = new System.Drawing.Size(83, 42);
this.cryptKeyBtn.TabIndex = 17;
@ -352,7 +311,7 @@ namespace NetMFAPatcher.GUI
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(12, 453);
this.dumpSortedBtn.Location = new System.Drawing.Point(12, 405);
this.dumpSortedBtn.Name = "dumpSortedBtn";
this.dumpSortedBtn.Size = new System.Drawing.Size(83, 42);
this.dumpSortedBtn.TabIndex = 19;
@ -388,7 +347,7 @@ namespace NetMFAPatcher.GUI
this.packDataBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.packDataBtn.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.packDataBtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.packDataBtn.Location = new System.Drawing.Point(12, 357);
this.packDataBtn.Location = new System.Drawing.Point(12, 309);
this.packDataBtn.Name = "packDataBtn";
this.packDataBtn.Size = new System.Drawing.Size(83, 42);
this.packDataBtn.TabIndex = 20;
@ -397,28 +356,72 @@ namespace NetMFAPatcher.GUI
this.packDataBtn.Visible = false;
this.packDataBtn.Click += new System.EventHandler(this.packDataBtn_Click);
//
// musicsButton
//
this.musicsButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.musicsButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.musicsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.musicsButton.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.musicsButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.musicsButton.Location = new System.Drawing.Point(101, 453);
this.musicsButton.Name = "musicsButton";
this.musicsButton.Size = new System.Drawing.Size(83, 42);
this.musicsButton.TabIndex = 21;
this.musicsButton.Text = "Dump Musics";
this.musicsButton.UseVisualStyleBackColor = false;
this.musicsButton.Visible = false;
this.musicsButton.Click += new System.EventHandler(this.musicsButton_Click);
//
// musicBar
//
this.musicBar.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.musicBar.BackColor = System.Drawing.Color.Black;
this.musicBar.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.musicBar.Location = new System.Drawing.Point(190, 463);
this.musicBar.Name = "musicBar";
this.musicBar.Size = new System.Drawing.Size(126, 23);
this.musicBar.Step = 2;
this.musicBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.musicBar.TabIndex = 22;
this.musicBar.Visible = false;
//
// musicLabel
//
this.musicLabel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.musicLabel.BackColor = System.Drawing.Color.Black;
this.musicLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.musicLabel.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.musicLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.musicLabel.Location = new System.Drawing.Point(322, 463);
this.musicLabel.Name = "musicLabel";
this.musicLabel.Size = new System.Drawing.Size(126, 24);
this.musicLabel.TabIndex = 23;
this.musicLabel.Text = "0/0";
this.musicLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.musicLabel.Visible = false;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(943, 507);
this.Controls.Add(this.musicLabel);
this.Controls.Add(this.musicBar);
this.Controls.Add(this.musicsButton);
this.Controls.Add(this.packDataBtn);
this.Controls.Add(this.dumpSortedBtn);
this.Controls.Add(this.showHexBtn);
this.Controls.Add(this.cryptKeyBtn);
this.Controls.Add(this.loadingLabel);
this.Controls.Add(this.ImagesButton);
this.Controls.Add(this.SoundsButton);
this.Controls.Add(this.imagesButton);
this.Controls.Add(this.soundsButton);
this.Controls.Add(this.MFABtn);
this.Controls.Add(this.FolderBTN);
this.Controls.Add(this.SoundsLabel);
this.Controls.Add(this.SoundBar);
this.Controls.Add(this.ImagesLabel);
this.Controls.Add(this.ImagesBar);
this.Controls.Add(this.ChunkBox);
this.Controls.Add(this.SoundBox);
this.Controls.Add(this.ImageBox);
this.Controls.Add(this.soundLabel);
this.Controls.Add(this.soundBar);
this.Controls.Add(this.imageLabel);
this.Controls.Add(this.imageBar);
this.Controls.Add(this.label1);
this.Controls.Add(this.GameInfo);
this.Controls.Add(this.listBox1);
@ -434,17 +437,23 @@ namespace NetMFAPatcher.GUI
this.PerformLayout();
}
private System.Windows.Forms.Button musicsButton;
private System.Windows.Forms.ProgressBar imageBar;
private System.Windows.Forms.Label imageLabel;
private System.Windows.Forms.Button imagesButton;
private System.Windows.Forms.ProgressBar musicBar;
private System.Windows.Forms.Label musicLabel;
private System.Windows.Forms.ProgressBar soundBar;
private System.Windows.Forms.Label soundLabel;
private System.Windows.Forms.Button soundsButton;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox ChunkBox;
private System.Windows.Forms.ContextMenuStrip ChunkCombo;
private System.Windows.Forms.Button cryptKeyBtn;
private System.Windows.Forms.Button dumpSortedBtn;
private System.Windows.Forms.Button FolderBTN;
private System.Windows.Forms.Label GameInfo;
private System.Windows.Forms.CheckBox ImageBox;
private System.Windows.Forms.ProgressBar ImagesBar;
private System.Windows.Forms.Button ImagesButton;
private System.Windows.Forms.Label ImagesLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label loadingLabel;
@ -453,10 +462,6 @@ namespace NetMFAPatcher.GUI
private System.Windows.Forms.Button packDataBtn;
private System.Windows.Forms.ToolStripMenuItem saveChunkBtn;
private System.Windows.Forms.Button showHexBtn;
private System.Windows.Forms.ProgressBar SoundBar;
private System.Windows.Forms.CheckBox SoundBox;
private System.Windows.Forms.Button SoundsButton;
private System.Windows.Forms.Label SoundsLabel;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.ToolStripMenuItem viewHexBtn;

@ -4,24 +4,26 @@ using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using Be.Windows.Forms;
using NetMFAPatcher.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.MMFParser.Decompiling;
using NetMFAPatcher.Utils;
namespace NetMFAPatcher.GUI
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.MMFParser.Decompiling;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.GUI
{
public partial class MainForm : Form
{
public static bool IsDumpingImages;
public static bool IsDumpingSounds;
public static bool IsDumpingMusics;
public static bool BreakImages;
public static bool BreakSounds;
public static bool BreakMusics;
public Thread LoaderThread;
public Color ColorTheme = Color.FromArgb(223,114,38);
public PackDataForm PackForm;
public MainForm()
{
@ -32,8 +34,8 @@ namespace NetMFAPatcher.GUI
showHexBtn.ForeColor = ColorTheme;
FolderBTN.ForeColor = ColorTheme;
MFABtn.ForeColor = ColorTheme;
ImagesButton.ForeColor = ColorTheme;
SoundsButton.ForeColor = ColorTheme;
imagesButton.ForeColor = ColorTheme;
soundsButton.ForeColor = ColorTheme;
packDataBtn.ForeColor = ColorTheme;
//Menu
saveChunkBtn.ForeColor = ColorTheme;
@ -46,13 +48,15 @@ namespace NetMFAPatcher.GUI
button1.ForeColor = ColorTheme;
GameInfo.ForeColor = ColorTheme;
loadingLabel.ForeColor = ColorTheme;
ImagesLabel.ForeColor = ColorTheme;
SoundsLabel.ForeColor=ColorTheme;
imageLabel.ForeColor = ColorTheme;
soundLabel.ForeColor=ColorTheme;
//Other
treeView1.ForeColor = ColorTheme;
listBox1.ForeColor = ColorTheme;
ImagesBar.ForeColor = ColorTheme;
SoundBar.ForeColor = ColorTheme;
imageBar.ForeColor = ColorTheme;
soundBar.ForeColor = ColorTheme;
}
@ -60,11 +64,20 @@ namespace NetMFAPatcher.GUI
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
var worker = new BackgroundWorker();
worker.DoWork += (senderA, eA) => { StartReading(); };
worker.RunWorkerCompleted += (senderA, eA) => { AfterLoad(); };
worker.DoWork += worker_DoWork;
worker.RunWorkerCompleted += worker_RunWorkerCompleted;
worker.RunWorkerAsync();
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
StartReading();
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
AfterLoad();
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
@ -72,34 +85,34 @@ namespace NetMFAPatcher.GUI
private void MainForm_Load(object sender, EventArgs e)
{
listBox1.Items.Clear();
loadingLabel.Visible = false;
listBox1.Items.Clear();
}
private void StartReading()
{
var path = openFileDialog1.FileName;
ImagesBar.Value = 0;
SoundBar.Value = 0;
Program.ReadFile(path, Settings.Verbose, Settings.DumpImages, Settings.DumpSounds);
imageBar.Value = 0;
soundBar.Value = 0;
GameInfo.Text = "";
loadingLabel.Visible = true;
ImagesLabel.Text = "0/0";
SoundsLabel.Text = "0/0";
ImageBox.Enabled = false;
SoundBox.Enabled = false;
ChunkBox.Enabled = false;
imageLabel.Text = "Using nonGUI mode";
soundLabel.Text = "Using nonGUI mode";
MFABtn.Visible = false;
FolderBTN.Visible = false;
ImagesButton.Visible = false;
SoundsButton.Visible = false;
imagesButton.Visible = false;
soundsButton.Visible = false;
musicsButton.Visible = false;
cryptKeyBtn.Visible = false;
showHexBtn.Visible = false;
dumpSortedBtn.Visible = false;
packDataBtn.Visible = false;
Program.ReadFile(path, Settings.Verbose, Settings.DumpImages, Settings.DumpSounds);
}
private void treeView1_AfterDblClick(object sender, EventArgs e)
@ -129,34 +142,23 @@ namespace NetMFAPatcher.GUI
case "viewHexBtn":
ShowHex();
break;
}
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
var nodeChunk = ((ChunkNode) treeView1.SelectedNode).chunk;
var nodeLoader = ((ChunkNode) treeView1.SelectedNode).loader;
Console.WriteLine("NodeChunk:"+nodeChunk!=null);
Console.WriteLine("NodeLoader:"+nodeLoader!=null);
ChunkList.Chunk chunk = null;
listBox1.Items.Clear();
if (nodeChunk != null) chunk = nodeChunk;
//if (nodeLoader.Chunk != null) chunk = nodeLoader.Chunk;
if (chunk != null)
if (nodeChunk != null)
{
chunk = nodeChunk;
listBox1.Items.Add($"Name: {chunk.Name}");
listBox1.Items.Add($"Id: {chunk.Id}");
listBox1.Items.Add($"Flag: {chunk.Flag}");
listBox1.Items.Add($"Size: {chunk.Size.ToPrettySize()}");
if (chunk.DecompressedSize>-1)listBox1.Items.Add($"Decompressed Size: {chunk.DecompressedSize.ToPrettySize()}");
listBox1.Items.Add($"Name: {nodeChunk.Name}");
listBox1.Items.Add($"Id: {nodeChunk.Id}");
listBox1.Items.Add($"Flag: {nodeChunk.Flag}");
listBox1.Items.Add($"Size: {nodeChunk.Size.ToPrettySize()}");
if (nodeChunk.DecompressedSize>-1)listBox1.Items.Add($"Decompressed Size: {nodeChunk.DecompressedSize.ToPrettySize()}");
}
if (nodeLoader != null)
@ -178,9 +180,9 @@ namespace NetMFAPatcher.GUI
public void AfterLoad()
{
GameData gameData = null;
gameData = Exe.LatestInst.GameData;
//GameData gameData = null;
var exe = Exe.Instance;
var gameData = exe.GameData;
treeView1.Nodes.Clear();
@ -199,11 +201,11 @@ namespace NetMFAPatcher.GUI
if (item.Loader is Frame frame)
foreach (var frmChunk in frame.Chunks.Chunks)
{
var frameNode = Helper.GetChunkNode(frmChunk);//new ChunkNode(frmChunk.Name, frmChunk);
var frameNode = Helper.GetChunkNode(frmChunk);
newNode.Nodes.Add(frameNode);
if (frameNode.loader is ObjectInstances)
{
var objs = frame.Chunks.get_chunk<ObjectInstances>();
var objs = frame.Chunks.GetChunk<ObjectInstances>();
if (objs != null)
{
foreach (var frmitem in objs.Items)
@ -216,13 +218,12 @@ namespace NetMFAPatcher.GUI
}
}
ImageBox.Enabled = true;
SoundBox.Enabled = true;
ChunkBox.Enabled = true;
MFABtn.Visible = true;
FolderBTN.Visible = true;
ImagesButton.Visible = true;
SoundsButton.Visible = true;
imagesButton.Visible = true;
soundsButton.Visible = true;
musicsButton.Visible = true;
cryptKeyBtn.Visible = true;
//showHexBtn.Visible = true;
dumpSortedBtn.Visible = true;
@ -230,17 +231,17 @@ namespace NetMFAPatcher.GUI
GameInfo.Visible = true;
loadingLabel.Visible = false;
var toLog = "";
toLog += $"Title:{Exe.LatestInst.GameData.Name}\n";
toLog += $"Copyright:{Exe.LatestInst.GameData.Copyright}\n";
toLog += $"Editor Filename: {Exe.LatestInst.GameData.EditorFilename}\n";
toLog += $"Product Version: {Exe.LatestInst.GameData.ProductVersion}\n";
toLog += $"Build: {Exe.LatestInst.GameData.Build}\n";
toLog += $"Runtime Version: {Exe.LatestInst.GameData.RuntimeVersion}\n";
toLog += $"Number Of Images: {Exe.LatestInst.GameData.Images.NumberOfItems}\n";
toLog += $"Number Of Sounds: {Exe.LatestInst.GameData.Sounds.NumOfItems}\n";
toLog += $"Unique FrameItems: {Exe.LatestInst.GameData.Frameitems.NumberOfItems}\n";
toLog += $"Frame Count: {Exe.LatestInst.GameData.Frames.Count}\n";
toLog += $"Chunks Count: {Exe.LatestInst.GameData.GameChunks.Chunks.Count}\n";
toLog += $"Title:{Exe.Instance.GameData.Name}\n";
toLog += $"Copyright:{Exe.Instance.GameData.Copyright}\n";
toLog += $"Editor Filename: {Exe.Instance.GameData.EditorFilename}\n";
toLog += $"Product Version: {Exe.Instance.GameData.ProductVersion}\n";
toLog += $"Build: {Exe.Instance.GameData.Build}\n";
toLog += $"Runtime Version: {Exe.Instance.GameData.RuntimeVersion}\n";
toLog += $"Number Of Images: {Exe.Instance.GameData.Images.NumberOfItems}\n";
toLog += $"Number Of Sounds: {(Exe.Instance.GameData.Sounds!= null ? Exe.Instance.GameData.Sounds.NumOfItems: 0)}\n";
toLog += $"Unique FrameItems: {Exe.Instance.GameData.Frameitems.NumberOfItems}\n";
toLog += $"Frame Count: {Exe.Instance.GameData.Frames.Count}\n";
toLog += $"Chunks Count: {Exe.Instance.GameData.GameChunks.Chunks.Count}\n";
@ -251,39 +252,29 @@ namespace NetMFAPatcher.GUI
}
private void ImageBox_CheckedChanged(object sender, EventArgs e)
{
Settings.DumpImages = ImageBox.Checked;
ImagesBar.Visible = ImageBox.Checked;
ImagesLabel.Visible = ImageBox.Checked;
}
private void SoundBox_CheckedChanged(object sender, EventArgs e)
{
Settings.DumpSounds = SoundBox.Checked;
SoundBar.Visible = SoundBox.Checked;
SoundsLabel.Visible = SoundBox.Checked;
}
private void ChunkBox_CheckedChanged(object sender, EventArgs e)
{
Settings.SaveChunks = ChunkBox.Checked;
}
public void UpdateImageBar(int index, int all)
{
all -= 1;
ImagesBar.Value = (int) (index / (float) all * 100);
ImagesLabel.Text = $"{index}/{all}";
imageBar.Value = (int) (index / (float) all * 100);
imageLabel.Text = $"{index}/{all}";
}
public void UpdateSoundBar(int index, int all)
{
all -= 1;
SoundBar.Value = (int) (index / (float) all * 100);
SoundsLabel.Text = $"{index}/{all}";
soundBar.Value = (int) (index / (float) all * 100);
soundLabel.Text = $"{index}/{all}";
}
public void UpdateMusicBar(int index, int all)
{
all -= 1;
musicBar.Value = (int) (index / (float) all * 100);
musicLabel.Text = $"{index}/{all}";
}
private void FolderBTN_Click(object sender, EventArgs e)
{
Process.Start($"{Settings.DumpPath}");
@ -294,80 +285,76 @@ namespace NetMFAPatcher.GUI
MFAGenerator.BuildMFA();
}
private void SoundsButton_Click(object sender, EventArgs e)
private void soundsButton_Click(object sender, EventArgs e)
{
if (!IsDumpingSounds)
{
SoundBar.Visible = true;
SoundsLabel.Visible = true;
SoundsButton.Text = "Cancel";
soundBar.Visible = true;
soundLabel.Visible = true;
soundsButton.Text = "Cancel";
soundBar.Value = 0;
IsDumpingSounds = true;
BreakSounds = false;
var worker = new BackgroundWorker();
worker.DoWork += (senderA, eA) =>
{
var cachedImgState = Settings.DumpSounds;
Settings.DumpSounds = true;
Exe.LatestInst.GameData.GameChunks.get_chunk<SoundBank>().Read();
Settings.DumpSounds = cachedImgState;
Exe.Instance.GameData.GameChunks.GetChunk<SoundBank>().Read(true);
};
worker.RunWorkerCompleted += (senderA, eA) =>
{
SoundBar.Visible = false;
SoundsLabel.Visible = false;
soundBar.Visible = false;
soundLabel.Visible = false;
Logger.Log("Sounds done");
SoundsButton.Text = "Dump Sounds";
soundsButton.Text = "Dump Sounds";
};
worker.RunWorkerAsync();
}
else
{
BreakSounds = true;
SoundBar.Visible = false;
SoundsLabel.Visible = false;
SoundsButton.Text = "Dump Sounds";
soundBar.Visible = false;
soundLabel.Visible = false;
soundsButton.Text = "Dump Sounds";
IsDumpingSounds = false;
}
}
private void ImagesButton_Click(object sender, EventArgs e)
private void imagesButton_Click(object sender, EventArgs e)
{
if (!IsDumpingImages)
{
ImagesBar.Visible = true;
ImagesLabel.Visible = true;
ImagesButton.Text = "Cancel";
imageBar.Visible = true;
imageLabel.Visible = true;
imagesButton.Text = "Cancel";
imageBar.Value = 0;
IsDumpingImages = true;
//ImagesLabel.BackColor=Color.Transparent;
//ImagesLabel.ForeColor=Color.Red;
;
BreakImages = false;
var worker = new BackgroundWorker();
worker.DoWork += (senderA, eA) =>
{
var cachedImgState = Settings.DumpImages;
Settings.DumpImages = true;
Exe.LatestInst.GameData.GameChunks.get_chunk<ImageBank>().Read();
Settings.DumpImages = cachedImgState;
Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>().Read(true,true);
};
worker.RunWorkerCompleted += (senderA, eA) =>
{
ImagesBar.Visible = false;
ImagesLabel.Visible = false;
ImagesButton.Text = "Dump\nImages";
Logger.Log("Images done");
imageBar.Visible = false;
imageLabel.Visible = false;
Logger.Log("Images done",true,ConsoleColor.Yellow);
imagesButton.Text = "Dump Images";
};
worker.RunWorkerAsync();
}
else
{
BreakImages = true;
ImagesBar.Visible = false;
ImagesLabel.Visible = false;
ImagesButton.Text = "Dump\nImages";
imageBar.Visible = false;
imageLabel.Visible = false;
imagesButton.Text = "Dump Images";
IsDumpingImages = false;
}
}
private void cryptKeyBtn_Click(object sender, EventArgs e)
{
@ -417,7 +404,27 @@ namespace NetMFAPatcher.GUI
private void dumpSortedBtn_Click(object sender, EventArgs e)
{
ImageDumper.DumpImages();
imageBar.Visible = true;
imageLabel.Visible = true;
var worker = new BackgroundWorker();
worker.DoWork += (senderA, eA) =>
{
Settings.DumpImages = true;
var bank = Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>();
bank.SaveImages=false;
bank.Read();
};
worker.RunWorkerCompleted += (senderA, eA) =>
{
imageBar.Visible = false;
imageLabel.Visible = false;
ImageDumper.DumpImages();
};
worker.RunWorkerAsync();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
@ -439,8 +446,45 @@ namespace NetMFAPatcher.GUI
private void packDataBtn_Click(object sender, EventArgs e)
{
if(PackForm==null)PackForm = new PackDataForm(Exe.LatestInst.PackData,ColorTheme);
if(PackForm==null)PackForm = new PackDataForm(Exe.Instance.PackData,ColorTheme);
PackForm.Show();
}
private void musicsButton_Click(object sender, EventArgs e)
{
var bank = Exe.Instance.GameData.GameChunks.GetChunk<MusicBank>();
if (bank == null) return;
if (!IsDumpingMusics)
{
musicBar.Visible = true;
musicLabel.Visible = true;
musicsButton.Text = "Cancel";
musicBar.Value = 0;
IsDumpingMusics = true;
BreakMusics = false;
var worker = new BackgroundWorker();
worker.DoWork += (senderA, eA) =>
{
Exe.Instance.GameData.GameChunks.GetChunk<MusicBank>().Read(true);
};
worker.RunWorkerCompleted += (senderA, eA) =>
{
musicBar.Visible = false;
musicLabel.Visible = false;
Logger.Log("Musics done",true,ConsoleColor.Yellow);
musicsButton.Text = "Dump Musics";
};
worker.RunWorkerAsync();
}
else
{
BreakMusics = true;
musicBar.Visible = false;
musicLabel.Visible = false;
musicsButton.Text = "Dump Musics";
IsDumpingMusics = false;
}
}
}
}

@ -120,15 +120,6 @@
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="ImageBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SoundBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChunkBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChunkCombo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>150, 17</value>
</metadata>

@ -1,6 +1,6 @@
using System.ComponentModel;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
partial class PackDataForm
{
@ -43,8 +43,10 @@ namespace NetMFAPatcher.GUI
//
this.listBox1.BackColor = System.Drawing.SystemColors.WindowText;
this.listBox1.Dock = System.Windows.Forms.DockStyle.Left;
this.listBox1.Font = new System.Drawing.Font("Courier New", 8.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.ItemHeight = 14;
this.listBox1.Items.AddRange(new object[] {"PackFile1", "PackFile2", "PackFile3", "PackFile4", "PackFile5", "PackFile6"});
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.Name = "listBox1";
@ -56,6 +58,7 @@ namespace NetMFAPatcher.GUI
//
this.dumpButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.dumpButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.dumpButton.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.dumpButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.dumpButton.Location = new System.Drawing.Point(204, 105);
this.dumpButton.Name = "dumpButton";
@ -69,6 +72,7 @@ namespace NetMFAPatcher.GUI
//
this.dumpAllButton.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.dumpAllButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.dumpAllButton.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.dumpAllButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.dumpAllButton.Location = new System.Drawing.Point(204, 148);
this.dumpAllButton.Name = "dumpAllButton";
@ -80,6 +84,7 @@ namespace NetMFAPatcher.GUI
//
// infoLabel
//
this.infoLabel.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.infoLabel.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.infoLabel.Location = new System.Drawing.Point(204, 14);
this.infoLabel.Name = "infoLabel";

@ -1,15 +1,12 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Be.Windows.Forms;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.GUI
namespace DotNetCTFDumper.GUI
{
public partial class PackDataForm : Form
{

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events
{
public class Events : ChunkLoader
{

@ -1,13 +1,9 @@
using NetMFAPatcher.MMFParser.Data;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events
{
public class Condition : DataLoader
{

@ -1,8 +1,8 @@
using System;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Expressions
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Expressions
{
class Expression : DataLoader
{

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class AlterableValue : Short
{

@ -1,7 +1,7 @@
using System.Drawing;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Colour : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Create : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Every : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Float : ParameterCommon
{

@ -1,7 +1,7 @@
using System;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class GlobalValue : Short
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Int : Short
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class ParamObject : ParameterCommon
{

@ -1,8 +1,8 @@
using System;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class ParameterCommon : DataLoader
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Position : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Remark : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Sample : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Short : ParameterCommon
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{
class Time : ParameterCommon
{

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
class ExtData : ChunkLoader
{

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class GlobalValues : ChunkLoader
{

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
class ObjectNames : ChunkLoader//Fucking trash
{

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{
public class Animations:ChunkLoader
{
@ -28,13 +28,11 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
offsets.Add(Reader.ReadInt16());
}
AnimationDict = new Dictionary<int,Animation>();
if (offsets.Count <= 0) return;
for (int i = 0; i < 1; i++)//I am stupid faggot, i don't know, whats wrong with this list
for (int i = 0; i < offsets.Count; i++)
{
var offset = offsets[i];
if (offset != 0)
{
Console.WriteLine("Offset: "+offset);
Reader.Seek(currentPosition+offset);
var anim = new Animation(Reader);
anim.Read();

@ -0,0 +1,59 @@
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{
public enum Obstacle
{
None = 0,
Solid = 1,
Platform = 2,
Ladder = 3,
Transparent = 4
}
public enum Collision
{
Fine = 0,
Box = 1
}
public class Backdrop:ChunkLoader
{
public int Size;
public Obstacle ObstacleType;
public Collision CollisionType;
public int Width;
public int Height;
public int Image;
public Backdrop(ByteReader reader) : base(reader)
{
}
public Backdrop(ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
Size = Reader.ReadInt32();
ObstacleType = (Obstacle) Reader.ReadInt16();
CollisionType = (Collision) Reader.ReadInt16();
Width = Reader.ReadInt32();
Height = Reader.ReadInt32();
Image = Reader.ReadInt16();
}
public override void Print(bool ext)
{
throw new System.NotImplementedException();
}
public override string[] GetReadableData()
{
throw new System.NotImplementedException();
}
}
}

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{
public class Counter:ChunkLoader
{
public short Size;
public int Initial;
public int Minimum;
public int Maximum;
public Counter(ByteReader reader) : base(reader)
{
}
public Counter(ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
Size = Reader.ReadInt16();
Initial = Reader.ReadInt32();
Minimum = Reader.ReadInt32();
Maximum = Reader.ReadInt32();
}
public override void Print(bool ext)
{
throw new System.NotImplementedException();
}
public override string[] GetReadableData()
{
throw new System.NotImplementedException();
}
}
public class Counters : ChunkLoader
{
int _intDigitsMask = 0xF;
int _floatDigitsMask = 0xF0;
int _formatFloat = 0x0200;
int _floatDigitsShift = 4;
int _useDecimals = 0x0400;
int _floatDecimalsMask = 0xF000;
int _floatDecimalsShift = 12;
int _floatPad = 0x0800;
public List<int> Frames;
public Counters(ByteReader reader) : base(reader)
{
}
public Counters(ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
var size = Reader.ReadUInt32();
var width = Reader.ReadUInt32();
var 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;
var inverse = ByteFlag.GetFlag(flags, 8);
var font = Reader.ReadUInt16();
if (displayType == 0) return;
else if (displayType == 1 || displayType == 4)
{
Frames = new List<int>();
var count = Reader.ReadInt16();
for (int i = 0; i < count; i++)
{
Frames.Add(Reader.ReadUInt16());
}
}
else if (displayType == 2 || displayType == 3 || displayType == 5)
{
//TODO: Shapes
throw new NotImplementedException();
}
}
public override void Print(bool ext)
{
throw new System.NotImplementedException();
}
public override string[] GetReadableData()
{
throw new System.NotImplementedException();
}
}
}

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{
public class ObjectCommon : ChunkLoader
{
@ -76,148 +74,144 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
}
);
public Color BackColor;
public ObjectInfo Parent;
public Counters Counters;
public byte[] ExtensionData;
public int ExtensionPrivate;
public int ExtensionId;
public int ExtensionVersion;
public ObjectCommon(ByteReader reader) : base(reader)
{
}
public ObjectCommon(ByteReader reader,ObjectInfo parent) : base(reader)
{
Parent = parent;
}
public ObjectCommon(ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
if (Parent.ObjectType != 2) return;
long currentPosition = Reader.Tell();
int size = Reader.ReadInt32();
bool newobj = Settings.Build > 284;
if (newobj && true)
bool newobj = Settings.Build >= 284;
if (newobj)
{
_animationsOffset = (short) Reader.ReadUInt16();
_movementsOffset = Reader.ReadUInt16();
short version = Reader.ReadInt16();
Reader.ReadBytes(2);
ushort extensionOffset = Reader.ReadUInt16();
ushort counterOffset = Reader.ReadUInt16();
flags.flag = Reader.ReadUInt32();
long end = Reader.Tell() + 16;
List<short> qualifiers = new List<short>();
for (int i = 0; i < 8; i++)
{
short qualifier = Reader.ReadInt16();
if (qualifier == -1) break;
qualifiers.Add(qualifier);
}
Reader.Seek(end);
short systemObjectOffset = Reader.ReadInt16();
_valuesOffset = Reader.ReadInt16();
_stringsOffset = Reader.ReadInt16();
new_flags.flag = Reader.ReadUInt16();
preferences.flag = Reader.ReadUInt16();
Identifier = Reader.ReadFourCc();
Color backColor = Reader.ReadColor();
int fadeinOffset = Reader.ReadInt32();
int fadeoutOffset = Reader.ReadInt32();
}
else if (newobj)
{
_counterOffset = Reader.ReadInt16();
short version = Reader.ReadInt16();
Reader.ReadBytes(2);
_movementsOffset = (ushort) Reader.ReadInt16();
_extensionOffset = Reader.ReadInt16();
_animationsOffset = Reader.ReadInt16();
uint flags = Reader.ReadUInt32();
long end = Reader.Tell() + 16;
List<short> qualifiers = new List<short>();
for (int i = 0; i < 8; i++)
{
short qualifier = Reader.ReadInt16();
if (qualifier == -1) break;
qualifiers.Add(qualifier);
}
Reader.Seek(end);
_valuesOffset = Reader.ReadInt16();
_stringsOffset = Reader.ReadInt16();
ushort newFlags = Reader.ReadUInt16();
byte[] preferences = Reader.ReadFourCc();
Color backColor = Reader.ReadColor();
_fadeinOffset = Reader.ReadInt32();
_fadeoutOffset = Reader.ReadInt32();
}
else
{
_movementsOffset = Reader.ReadUInt16();
_animationsOffset = Reader.ReadInt16();
short version = Reader.ReadInt16();
_counterOffset = Reader.ReadInt16();
}
short version = Reader.ReadInt16();
_counterOffset = (short) Reader.ReadUInt16();
_systemObjectOffset = (short) Reader.ReadUInt16();
flags.flag = Reader.ReadUInt32();
var end = Reader.Tell() + 16;
Reader.Seek(end);
if (newobj)
{
_systemObjectOffset = Reader.ReadInt16();
Reader.ReadBytes(2);
flags.flag = Reader.ReadUInt32();
_end = Reader.Tell() + 16;
List<short> qualifiers = new List<short>();
for (int i = 0; i < 8; i++)
{
short qualifier = Reader.ReadInt16();
if (qualifier == -1) break;
qualifiers.Add(qualifier);
}
Reader.Seek(_end);
}
else
{
_extensionOffset = Reader.ReadInt16();
_valuesOffset = Reader.ReadInt16();
_stringsOffset = Reader.ReadInt16();
new_flags.flag = Reader.ReadUInt16();
preferences.flag = Reader.ReadUInt16();
byte[] identifier = Reader.ReadFourCc();
Color backColor = Reader.ReadColor();
_fadeinOffset = Reader.ReadInt32();
_fadeoutOffset = Reader.ReadInt32();
}
_valuesOffset = Reader.ReadInt16();
_stringsOffset = Reader.ReadInt16();
new_flags.flag = Reader.ReadUInt16();
preferences.flag = Reader.ReadUInt16();
byte[] identifier = Reader.ReadFourCc();
BackColor = Reader.ReadColor();
_fadeinOffset = Reader.ReadInt32();
_fadeoutOffset = Reader.ReadInt32();
if (_movementsOffset != 0)
{
//Reader.Seek(currentPosition+_movementsOffset);
//var movements = new Movements(Reader);
//movements.Read();
Console.WriteLine("Movements done");
}
Console.WriteLine("Movements done");
if (_valuesOffset != 0)
{
Reader.Seek(currentPosition + _valuesOffset);
AlterableValues values = new AlterableValues(Reader);
values.Read();
Console.WriteLine("Values done");
}
Console.WriteLine("Values done");
if (_stringsOffset != 0)
{
Reader.Seek(currentPosition + _stringsOffset);
AlterableStrings strings = new AlterableStrings(Reader);
strings.Read();
Console.WriteLine("Strings done");
}
Console.WriteLine("Strings done");
if (_animationsOffset != 0)
if (_animationsOffset != 0&& Parent.ObjectType==2)
{
Reader.Seek(currentPosition + _stringsOffset);
Reader.Seek(currentPosition + _animationsOffset);
Animations = new Animations(Reader);
Animations.Read();
Console.WriteLine("Animations done");
}
/*if (_counterOffset != 0)
{
Reader.Seek(currentPosition + _counterOffset);
var counter = new Counter(Reader);
counter.Read();
Console.WriteLine("Counters done");
}
Console.WriteLine("Animations done");
if (_extensionOffset != 0)
{
var dataSize = Reader.ReadInt32() - 20;
ExtensionVersion = Reader.ReadInt32();
ExtensionId = Reader.ReadInt32();
ExtensionPrivate = Reader.ReadInt32();
if (dataSize != 0)
ExtensionData = Reader.ReadBytes(dataSize);
Console.WriteLine("Extensions Done");
}*/
if (_systemObjectOffset > 0)
{
Console.WriteLine("Reading System Object");
Reader.Seek(currentPosition+_systemObjectOffset);
if (Parent.ObjectType == ((int) Constants.ObjectType.Text) ||
Parent.ObjectType == ((int) Constants.ObjectType.Question))
{
//TODO; Text.read();
}
else if (Parent.ObjectType == ((int) Constants.ObjectType.Score) ||
Parent.ObjectType == ((int) Constants.ObjectType.Lives)||
Parent.ObjectType == ((int) Constants.ObjectType.Counter))
{
Counters = new Counters(Reader);
Counters.Read();
}
}
Console.WriteLine("SysObjOff: " + _systemObjectOffset);
Console.WriteLine("ExtOff: " + _extensionOffset);
}

@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{
public class AlterableValues:ChunkLoader
{

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using NetMFAPatcher.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Constants;
using System.Xml.Linq;
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.Data
namespace DotNetCTFDumper.MMFParser.Data
{
public class ChunkList
{
@ -24,36 +23,14 @@ namespace NetMFAPatcher.MMFParser.Data
chunk.Verbose = Verbose;
chunk.Read(exeReader);
chunk.Loader = LoadChunk(chunk);
if (chunk.Loader != null)
{
if (chunk.Loader.Verbose)
{
//chunk.loader.Print(Program.LogAll);
}
}
if (chunk.Verbose)
{
chunk.Print(false);
}
Chunks.Add(chunk);
if (chunk.Id == 8750)
{
chunk.BuildKey();
}
if (exeReader.Tell() >= exeReader.Size()) break;
if (chunk.Id == 32639) break; //LAST chunkID
}
//Logger.Log(verbose ? $" Total Chunks Count: {chunks.Count}":"ChunkList Done", true, ConsoleColor.Blue);
}
public class Chunk
@ -84,6 +61,7 @@ namespace NetMFAPatcher.MMFParser.Data
public void Read(ByteReader exeReader)
{
Id = exeReader.ReadInt16();
Name = this.ActualName();
@ -161,20 +139,20 @@ namespace NetMFAPatcher.MMFParser.Data
string copyright = "";
string project = "";
var titleChunk = _chunkList.get_chunk<AppName>();
var titleChunk = _chunkList.GetChunk<AppName>();
if (titleChunk != null) title = titleChunk.Value;
var copyrightChunk = _chunkList.get_chunk<Copyright>();
var copyrightChunk = _chunkList.GetChunk<Copyright>();
if (copyrightChunk != null) copyright = copyrightChunk.Value;
var projectChunk = _chunkList.get_chunk<EditorFilename>();
var projectChunk = _chunkList.GetChunk<EditorFilename>();
if (projectChunk != null) project = projectChunk.Value;
Settings.AppName=title;
Settings.Copyright = copyright;
Settings.ProjectPath = project;
if (Exe.LatestInst.GameData.ProductBuild > 284)
if (Exe.Instance.GameData.ProductBuild > 284)
{
Decryption.MakeKey(title, copyright, project);
}
@ -258,6 +236,9 @@ namespace NetMFAPatcher.MMFParser.Data
case 26216:
loader = new SoundBank(chunk);
break;
case 26217:
loader = new MusicBank(chunk);
break;
case 17477:
loader = new ObjectName(chunk);
break;
@ -281,6 +262,7 @@ namespace NetMFAPatcher.MMFParser.Data
//loader = new Events(chunk);//NOT WORKING
break;
}
if (loader != null)
@ -293,7 +275,7 @@ namespace NetMFAPatcher.MMFParser.Data
}
public T get_chunk<T>() where T : ChunkLoader
public T GetChunk<T>() where T : ChunkLoader
{
foreach (Chunk chunk in Chunks)
{
@ -308,10 +290,6 @@ namespace NetMFAPatcher.MMFParser.Data
//Logger.Log($"ChunkLoader {typeof(T).Name} not found", true, ConsoleColor.Red);
return null;
}
public T get_loader<T>(ChunkLoader loader) where T : ChunkLoader
{
return (T)loader;
}
}
}

@ -1,7 +1,7 @@
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.Data
namespace DotNetCTFDumper.MMFParser.Data
{
public abstract class DataLoader
{

@ -1,28 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.Data
namespace DotNetCTFDumper.MMFParser.Data
{
public class Exe
{
public PackData PackData;
public GameData GameData;
public static Exe LatestInst;
public static Exe Instance;
public void ParseExe(ByteReader exeReader)
{
Exe.LatestInst = this;
Logger.Log($"Executable: {Settings.GameName}\n", true, ConsoleColor.DarkRed);
string sig = exeReader.ReadAscii(2);
Logger.Log("EXE Header: " + sig, true, ConsoleColor.Yellow);
if (sig != "MZ")
{
Console.WriteLine("Invalid executable signature");
Logger.Log("Invalid executable signature",true,ConsoleColor.Red);
}
exeReader.Seek(60, SeekOrigin.Begin);

@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.Utils;
using NetMFAPatcher.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
namespace NetMFAPatcher.MMFParser.Data
namespace DotNetCTFDumper.MMFParser.Data
{
public class GameData
{
@ -62,10 +57,10 @@ namespace NetMFAPatcher.MMFParser.Data
else if (magic == Constants.GameHeader) Constants.IsUnicode = false;//PAME
else Logger.Log("Couldn't found any known headers", true, ConsoleColor.Red);//Header not found
RuntimeVersion = exeReader.ReadUInt16(); //
RuntimeSubversion = exeReader.ReadUInt16(); //0
ProductVersion = (Constants.Products)exeReader.ReadInt32(); //CTF/MMF2/MMF1.5/CNC
ProductBuild = exeReader.ReadInt32(); //CTF Build
RuntimeVersion = exeReader.ReadUInt16();
RuntimeSubversion = exeReader.ReadUInt16();
ProductVersion = (Constants.Products)exeReader.ReadInt32();
ProductBuild = exeReader.ReadInt32();//Easy Access
Settings.Build=ProductBuild;
Build = ProductBuild;
@ -74,24 +69,26 @@ namespace NetMFAPatcher.MMFParser.Data
GameChunks.Read(exeReader);
//Load chunks into gamedata for easier access
if (GameChunks.get_chunk<AppName>() != null) Name = GameChunks.get_chunk<AppName>().Value;
if (GameChunks.get_chunk<Copyright>() != null) Copyright = GameChunks.get_chunk<Copyright>().Value;
if (GameChunks.get_chunk<AppAuthor>()!=null) Author = GameChunks.get_chunk<AppAuthor>().Value;
if (GameChunks.get_chunk<EditorFilename>() != null) EditorFilename = GameChunks.get_chunk<EditorFilename>().Value;
if (GameChunks.get_chunk<TargetFilename>() != null) TargetFilename = GameChunks.get_chunk<TargetFilename>().Value;
if (GameChunks.get_chunk<AppMenu>() != null) Menu = GameChunks.get_chunk<AppMenu>();
if (GameChunks.get_chunk<AppHeader>() != null) Header = GameChunks.get_chunk<AppHeader>();
if (GameChunks.get_chunk<SoundBank>() != null) Sounds = GameChunks.get_chunk<SoundBank>();
if (GameChunks.get_chunk<MusicBank>() != null) Music = GameChunks.get_chunk<MusicBank>();
if (GameChunks.get_chunk<FontBank>() != null) Fonts = GameChunks.get_chunk<FontBank>();
if (GameChunks.get_chunk<ImageBank>() != null) Images = GameChunks.get_chunk<ImageBank>();
if (GameChunks.get_chunk<AppIcon>() != null) Icon = GameChunks.get_chunk<AppIcon>();
if (GameChunks.get_chunk<GlobalStrings>() != null) GStrings = GameChunks.get_chunk<GlobalStrings>();
if (GameChunks.get_chunk<GlobalValues>() != null) GValues = GameChunks.get_chunk<GlobalValues>();
if (GameChunks.get_chunk<FrameItems>() != null) Frameitems = GameChunks.get_chunk<FrameItems>();
//Can only be accessed from here AFTER loading all the chunks
//If you need it AT LOADING - use ChunkList.get_chunk<ChunkType>();
if (GameChunks.GetChunk<AppName>() != null) Name = GameChunks.GetChunk<AppName>().Value;
if (GameChunks.GetChunk<Copyright>() != null) Copyright = GameChunks.GetChunk<Copyright>().Value;
if (GameChunks.GetChunk<AppAuthor>()!=null) Author = GameChunks.GetChunk<AppAuthor>().Value;
if (GameChunks.GetChunk<EditorFilename>() != null) EditorFilename = GameChunks.GetChunk<EditorFilename>().Value;
if (GameChunks.GetChunk<TargetFilename>() != null) TargetFilename = GameChunks.GetChunk<TargetFilename>().Value;
if (GameChunks.GetChunk<AppMenu>() != null) Menu = GameChunks.GetChunk<AppMenu>();
if (GameChunks.GetChunk<AppHeader>() != null) Header = GameChunks.GetChunk<AppHeader>();
if (GameChunks.GetChunk<SoundBank>() != null) Sounds = GameChunks.GetChunk<SoundBank>();
if (GameChunks.GetChunk<MusicBank>() != null) Music = GameChunks.GetChunk<MusicBank>();
if (GameChunks.GetChunk<FontBank>() != null) Fonts = GameChunks.GetChunk<FontBank>();
if (GameChunks.GetChunk<ImageBank>() != null) Images = GameChunks.GetChunk<ImageBank>();
if (GameChunks.GetChunk<AppIcon>() != null) Icon = GameChunks.GetChunk<AppIcon>();
if (GameChunks.GetChunk<GlobalStrings>() != null) GStrings = GameChunks.GetChunk<GlobalStrings>();
if (GameChunks.GetChunk<GlobalValues>() != null) GValues = GameChunks.GetChunk<GlobalValues>();
if (GameChunks.GetChunk<FrameItems>() != null) Frameitems = GameChunks.GetChunk<FrameItems>();
Frames = GameChunks.Frames; //Its a list, so i have to manually parse them in chunk list.
Print();
//Print();
}
public void Print()
{
@ -136,12 +133,12 @@ namespace NetMFAPatcher.MMFParser.Data
foreach (var item in Frames)
{
Logger.Log($" Frame: {item.Name,25}, Size: {item.Width,4}x{item.Height,4}, Number of objects: {item.CountOfObjs,5}", true, ConsoleColor.Cyan);
var objects = item.Chunks.get_chunk<ObjectInstances>();
var objects = item.Chunks.GetChunk<ObjectInstances>();
if (objects != null)
{
foreach (var obj in objects.Items)
{
Logger.Log($" Object: {obj.Name}", true, ConsoleColor.Green);
Logger.Log($" Object: {obj.Name} - {obj.Handle} - {obj.FrameItem.ObjectType}", true, ConsoleColor.Green);
}
}

@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Windows.Forms;
using NetMFAPatcher.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.MFALoaders;
using NetMFAPatcher.Utils;
using Controls = NetMFAPatcher.MMFParser.MFALoaders.Controls;
using Frame = NetMFAPatcher.MMFParser.MFALoaders.Frame;
namespace NetMFAPatcher.MMFParser.Data
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.MMFParser.MFALoaders;
using DotNetCTFDumper.Utils;
using Controls = DotNetCTFDumper.MMFParser.MFALoaders.Controls;
using Frame = DotNetCTFDumper.MMFParser.MFALoaders.Frame;
namespace DotNetCTFDumper.MMFParser.Data
{
public class MFA : DataLoader
{
@ -134,13 +131,18 @@ namespace NetMFAPatcher.MMFParser.Data
Fonts.Write(writer);
writer.WriteAscii(SoundBankId);
Sounds.Write(writer);
writer.WriteAscii(MusicBankId);
//music.Write();//cum cum cum cum cum cum cum cum
writer.WriteInt32(0);//someone is using musics lol?
//TODO: Do music
//I am not an asshole lol
writer.WriteAscii(ImageBankId);
Icons.Write(writer);
return;
writer.WriteAscii(ImageBankId);
Images.Write(writer);
writer.AutoWriteUnicode(Name);
writer.AutoWriteUnicode(Author);
writer.AutoWriteUnicode(Description);
@ -208,9 +210,9 @@ namespace NetMFAPatcher.MMFParser.Data
writer.AutoWriteUnicode(item.Item3);
writer.WriteInt32(item.Item4);
writer.WriteBytes(item.Item5);
writer.WriteInt32(Frames.Count);
}
writer.WriteInt32(Extensions.Count);
writer.WriteInt32(Frames.Count);
var startPosition = writer.Tell() + 4 * Frames.Count + 4;
//help
//how to implement write writer

@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.Data
namespace DotNetCTFDumper.MMFParser.Data
{
public class PackData
{
@ -47,7 +42,7 @@ namespace NetMFAPatcher.MMFParser.Data
exeReader.Skip(value);
if (!exeReader.Check(value)) break;
}
exeReader.BaseStream.Position -= 5;//wtf lol
header = exeReader.ReadFourCc();
exeReader.Seek(offset);

@ -1,8 +1,8 @@
using System.IO;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.Decompiling
namespace DotNetCTFDumper.MMFParser.Decompiling
{
public static class MFAGenerator
{
@ -16,11 +16,11 @@ namespace NetMFAPatcher.MMFParser.Decompiling
template.Read(); //Loading template
var gameMFA = Pame2Mfa.Translate(template, Exe.LatestInst.GameData); //Translation
var gameMFA = template;//Pame2Mfa.Translate(template, Exe.LatestInst.GameData); //Translation
var mfaWriter =
new ByteWriter(
Settings.GameName.Length > 0 ? $"{Settings.DumpPath}\\{Exe.LatestInst.GameData.Name}.mfa" : "out.mfa",
Settings.GameName.Length > 0 ? $"{Settings.DumpPath}\\{Exe.Instance.GameData.Name}.mfa" : "out.mfa",
FileMode.Create); //New writer for new MFA
gameMFA.Write(mfaWriter); //Writing new MFA
}

@ -1,7 +1,7 @@

using NetMFAPatcher.MMFParser.Data;
using DotNetCTFDumper.MMFParser.Data;
namespace NetMFAPatcher.MMFParser.Decompiling
namespace DotNetCTFDumper.MMFParser.Decompiling
{
public static class Pame2Mfa
{

@ -1,12 +1,12 @@
using System;
using System.IO;
using System.Windows.Forms;
using NetMFAPatcher.GUI;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.MMFParser.Decompiling;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.MMFParser.Decompiling;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher
namespace DotNetCTFDumper
{
internal class Program
{
@ -73,16 +73,19 @@ namespace NetMFAPatcher
Settings.DumpImages = dumpImages;
Settings.DumpSounds = dumpSounds;
Settings.Verbose = verbose;
var exeReader = new ByteReader(path, FileMode.OpenOrCreate);
var currentExe = new Exe();
Exe.Instance = currentExe;
currentExe.ParseExe(exeReader);
Logger.Log("Finished!", true, ConsoleColor.Yellow);
return;
if (File.Exists(path))
{
if (path.EndsWith(".exe"))
{
Settings.DoMFA = false;
var exeReader = new ByteReader(path, FileMode.OpenOrCreate);
var currentExe = new Exe();
currentExe.ParseExe(exeReader);
Logger.Log("Finished!", true, ConsoleColor.Yellow);
}
else if (path.EndsWith(".mfa"))
{
@ -106,7 +109,9 @@ namespace NetMFAPatcher
{
Directory.CreateDirectory($"{Settings.ImagePath}");
Directory.CreateDirectory($"{Settings.SoundPath}");
Directory.CreateDirectory($"{Settings.MusicPath}");
Directory.CreateDirectory($"{Settings.ChunkPath}");
Directory.CreateDirectory($"{Settings.ExtensionPath}");

@ -1,13 +1,13 @@
using System.IO;
using System.Runtime.Remoting.Messaging;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher
namespace DotNetCTFDumper
{
public static class Settings
{
public static bool DumpImages;
public static bool DumpSounds;
public static bool DumpMusic;
public static bool SaveChunks;
public static bool Verbose;
@ -16,6 +16,8 @@ namespace NetMFAPatcher
public static string DumpPath => $"DUMP\\{GameName}";
public static string ImagePath=>$"{DumpPath}\\ImageBank";
public static string SoundPath=>$"{DumpPath}\\SoundBank";
public static string MusicPath=>$"{DumpPath}\\MusicBank";
public static string ChunkPath=>$"{DumpPath}\\Chunks";
public static string ExtensionPath=>$"{DumpPath}\\Extensions";
@ -29,7 +31,7 @@ namespace NetMFAPatcher
public static bool DoMFA;
public static bool UseGUI;
public static string DumperVersion = "CTFAN 0.1.1 Debug";
public static string DumperVersion = "CTFAN 0.1.1-c Debug";
public static byte[] EncryptionKey=>Decryption.DecryptionKey;

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public class BitDict
{

@ -1,6 +1,6 @@
using System;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public static class ByteFlag
{

@ -3,7 +3,7 @@ using System.Drawing;
using System.IO;
using System.Text;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public class ByteReader : BinaryReader
{

@ -3,7 +3,7 @@ using System.Drawing;
using System.IO;
using System.Text;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public class ByteWriter : BinaryWriter
{

@ -1,8 +1,7 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public static class Decompressor
{

@ -1,11 +1,8 @@
using System;
using System.IO;
using System.Linq;
using System.Management.Instrumentation;
using System.Runtime.InteropServices;
using System.Text;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
class Decryption
{

@ -5,13 +5,13 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using NetMFAPatcher.GUI;
using NetMFAPatcher.MMFParser;
using NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects;
using NetMFAPatcher.MMFParser.Data;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.MMFParser;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Objects;
using DotNetCTFDumper.MMFParser.Data;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
static class Helper
{
@ -181,13 +181,17 @@ namespace NetMFAPatcher.Utils
public static void OnImageSaved(int index, int all)
{
Program.MyForm.UpdateImageBar(index, all);
Program.MyForm.UpdateImageBar(index, all);
}
public static void OnSoundSaved(int index, int all)
{
Program.MyForm.UpdateSoundBar(index, all);
}
public static void OnMusicSaved(int index, int all)
{
Program.MyForm.UpdateSoundBar(index, all);
}
private const long OneKb = 1024;
private const long OneMb = OneKb * 1024;
@ -284,5 +288,16 @@ namespace NetMFAPatcher.Utils
// Step 3: return the new array.
return result;
}
public static void WriteWriter(this ByteWriter writer, ByteWriter toWrite)
{
var endPos = toWrite.Tell();
toWrite.Seek(0);
for (int i = 0; i < endPos; i++)
{
writer.WriteInt8(((MemoryStream)(toWrite.BaseStream)).GetBuffer()[i]);
}
}
}
}

@ -1,12 +1,15 @@
using System.Drawing;
using System;
using System.Collections.Generic;
using System.IO;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects;
using NetMFAPatcher.MMFParser.Data;
using System.Linq;
using DotNetCTFDumper.MMFParser.ChunkLoaders;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Objects;
using DotNetCTFDumper.MMFParser.Data;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public class ImageDumper
public static class ImageDumper
{
public static void DumpImages()
{
@ -17,39 +20,115 @@ namespace NetMFAPatcher.Utils
public static void Dump()
{
var rootFolder = $"{Settings.DumpPath}\\ImageBank\\Sorted";
var Bank = Exe.LatestInst.GameData.GameChunks.get_chunk<ImageBank>();
foreach (var frame in Exe.LatestInst.GameData.Frames)
var Bank = Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>();
foreach (var frame in Exe.Instance.GameData.Frames)
{
if (frame.Objects != null)
{
var currentFramePath = rootFolder + "\\" + frame.Name;
Directory.CreateDirectory(currentFramePath);
var currentFramePath = rootFolder + "\\" + Helper.CleanInput(frame.Name);
foreach (var item in frame.Objects.Items)
{
var currentObjPath = currentFramePath + "\\" + item.Handle;
var currentObjPath = currentFramePath + "\\" + Helper.CleanInput(item.Name);
Directory.CreateDirectory(currentObjPath);
var anims = (item.FrameItem.Properties).Loader.Animations.AnimationDict;
foreach (var key in anims.Keys)
var frames = item.FrameItem.GetFrames();
foreach (var key in frames.Keys)
{
frames.TryGetValue(key, out var name);
Bank.Images.TryGetValue(key, out var actualFrame);
try
{
var path =
$"{Settings.ImagePath}\\Sorted\\{frame.Name}\\{Helper.CleanInput(item.Name)}\\{name}";
Directory.CreateDirectory(Path.GetDirectoryName(path));
Logger.Log("Saving Image: "+path);
actualFrame.Save(path);
}
catch (Exception e)
{
Logger.Log("Error while dumping images: "+e.Message,true,ConsoleColor.Red);
}
}
}
}
}
Logger.Log("Sorted Images Done",true,ConsoleColor.Yellow);
}
public static Dictionary<int,string> GetFrames(this ObjectInfo obj)
{
Dictionary<int, string> frames = new Dictionary<int, string>();
if (obj.Properties.Loader is ObjectCommon common)
{
if (obj.ObjectType == 2)
{
foreach (var animKey in common.Animations.AnimationDict.Keys)
{
var anim = common.Animations.AnimationDict[animKey];
foreach (var dirKey in anim.DirectionDict.Keys)
{
var anim = anims[key];
var directions = anim.DirectionDict;
foreach (var key1 in directions.Keys)
var dir = anim.DirectionDict[dirKey];
foreach (var frame in dir.Frames)
{
var dir = directions[0];
foreach (var AnimFrame in dir.Frames)
if (!frames.ContainsKey(frame))
{
ImageItem img = null;
Bank.Images.TryGetValue(AnimFrame, out img);
img.Save(currentObjPath+"\\"+AnimFrame+".png");
var animIndex = common.Animations.AnimationDict.Keys.ToList().IndexOf(animKey);
var dirIndex = anim.DirectionDict.Keys.ToList().IndexOf(dirKey);
var frameIndex = dir.Frames.IndexOf(frame);
string finalPath = "";
var animAll = dir.Frames.Count == 1;
if(!animAll)
{
if (common.Animations.AnimationDict.Keys.Count > 1)
{
finalPath += $"Animation{animIndex}\\";
}
}
if (anim.DirectionDict.Keys.Count > 1)
{
finalPath += $"Direction{dirIndex}\\";
}
finalPath += $"{(animAll ? ("Animation"+animIndex.ToString()):(frameIndex.ToString()))}.png";
frames.Add(frame, finalPath);
}
}
}
}
}
}
else if (obj.ObjectType == 7)
{
var counters = common.Counters;
if (counters == null) return frames;
foreach (var item in counters.Frames)
{
frames.Add(item,item.ToString());
}
}
}
else if (obj.Properties.Loader is Backdrop backdrop)
{
frames.Add(backdrop.Image,"0.png");
}
return frames;
}
}
}

@ -1,6 +1,6 @@
using System;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public static class ImageHelper
{
@ -73,9 +73,12 @@ namespace NetMFAPatcher.Utils
byte g = (byte) ((newShort & 992) >> 5);
byte b = (byte) ((newShort & 31));
colorArray[(y * stride) + (x * 4) + 0] = (byte) (r << 3);
colorArray[(y * stride) + (x * 4) + 1] = (byte) (g << 3);
colorArray[(y * stride) + (x * 4) + 2] = (byte) (b << 3);
r=(byte) (r << 3);
g=(byte) (g << 3);
b=(byte) (b << 3);
colorArray[(y * stride) + (x * 4) + 2] = r;
colorArray[(y * stride) + (x * 4) + 1] = g;
colorArray[(y * stride) + (x * 4) + 0] = b;
colorArray[(y * stride) + (x * 4) + 3] = 255;
position += 2;
}

@ -1,7 +1,7 @@
using System;
using System.IO;
namespace NetMFAPatcher.Utils
namespace DotNetCTFDumper.Utils
{
public static class Logger
{

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NetMFAPatcher.MMFParser
namespace DotNetCTFDumper.MMFParser
{
public static class Constants
{
@ -108,7 +102,7 @@ namespace NetMFAPatcher.MMFParser
DemoFilePath=13123,
RandomSeed=13124,
FrameLayerEffects=13125,
BlurayFrameOptions=13126,
BluRayFrameOptions=13126,
MvTimerBase=13127,
MosaicImageTable=13128,
FrameEffects=13129,

@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class AppHeader : ChunkLoader
{
@ -66,18 +61,22 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
{
Reader = new ByteReader(Chunk.ChunkData);
Size = Reader.ReadInt32();
Flags.flag=(uint) Reader.ReadInt16();//I finally got my balls back
Flags.flag=(uint) Reader.ReadInt16();
var newFlags = Reader.ReadInt16(); //read flags or no balls
var graphicsMode = Reader.ReadInt16(); //i am serious
var otherflags = Reader.ReadInt16(); //last chance to get balls back
NewFlags.flag = (uint) Reader.ReadInt16();
var graphicsMode = Reader.ReadInt16();
var otherflags = Reader.ReadInt16();// I am an asshole
//TODO: Add OtherFlags
WindowWidth = Reader.ReadInt16();
WindowHeight = Reader.ReadInt16();
InitialScore = (int) (Reader.ReadUInt32() ^ 0xffffffff);
InitialLives = (int) (Reader.ReadUInt32() ^ 0xffffffff);
var controls = new Controls(Reader);
controls.Read();
// controls.Print(false);
BorderColor = Reader.ReadColor();
NumberOfFrames = Reader.ReadInt32();

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class AppMenu : ChunkLoader
{

@ -1,18 +1,23 @@
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public abstract class ChunkLoader//:DataLoader
public abstract class ChunkLoader
{
public Chunk Chunk;
public ByteReader Reader;
public bool Verbose = false;
protected ChunkLoader(ByteReader reader)
public ChunkLoader(ByteReader reader)
{
this.Reader = reader;
}
protected ChunkLoader(Chunk chunk)
{
this.Chunk = chunk;
@ -25,5 +30,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public abstract void Print(bool ext);
public abstract string[] GetReadableData();
}
}

@ -1,18 +1,10 @@

using NetMFAPatcher.MMFParser.Data;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters;
using NetMFAPatcher.MMFParser.MFALoaders;
using NetMFAPatcher.Utils;
using ChunkList = NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using ChunkList = DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
class FrameName : StringChunk
{
@ -76,28 +68,33 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public override void Read()
{
var frameReader = new ByteReader(Chunk.ChunkData);
Chunks = new ChunkList();
Chunks.Verbose = false;
Chunks.Read(frameReader);
var name = Chunks.get_chunk<FrameName>();
//return;
var name = Chunks.GetChunk<FrameName>();
if (name != null) //Just to be sure
{
this.Name = name.Value;
Console.WriteLine("Reading Frame: "+Name);
}
var password = Chunks.get_chunk<FramePassword>();
var password = Chunks.GetChunk<FramePassword>();
if (password != null) //Just to be sure
{
this.Password = password.Value;
}
Header = Chunks.get_chunk<FrameHeader>();
Header = Chunks.GetChunk<FrameHeader>();
Width = Header.Width;
Height = Header.Height;
Background = Header.Background;
//Flags = header.Flags;
Objects = Chunks.get_chunk<ObjectInstances>();
Objects = Chunks.GetChunk<ObjectInstances>();
if(Objects!=null)
{
CountOfObjs = Objects.CountOfObjects;
@ -247,20 +244,19 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public override void Read()
{
Handle = Reader.ReadUInt16();
//if (Handle > 0) Handle -= 1;
ObjectInfo = Reader.ReadUInt16();
ObjectInfo = (ushort) Reader.ReadInt16();
Handle = (ushort) Reader.ReadInt16();
X = Reader.ReadInt32();
Y = Reader.ReadInt32();
ParentType = Reader.ReadInt16();
ParentHandle = Reader.ReadInt16();
Layer = Reader.ReadInt16();
Reader.Skip(2);
var reserved = Reader.ReadInt16();
//-------------------------
if (FrameItem != null) Name = FrameItem.Name;
else Name = $"UNKNOWN-{Handle}";
Console.WriteLine("ObjectInfoHandle: "+Handle);
}
@ -268,7 +264,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
{
get
{
return Exe.LatestInst.GameData.GameChunks.get_chunk<FrameItems>().GetItemByHandle(Handle);
return Exe.Instance.GameData.GameChunks.GetChunk<FrameItems>().FromHandle(Handle);
}
}
@ -284,7 +280,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
$"Name: {Name}",
$"Type:{(Constants.ObjectType)FrameItem.ObjectType} - {FrameItem.ObjectType}",
$"Position: {X,5}x{Y,5}",
$"Size: CUMxCUM"
$"Size: NotImplementedYet"
};
}

@ -1,15 +1,10 @@
using NetMFAPatcher.MMFParser.Data;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.MFALoaders;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class FrameItems : ChunkLoader
{
@ -38,7 +33,6 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
for (int i = 0; i < NumberOfItems; i++)
{
var item = new ObjectInfo(Reader);
item.Verbose = false;
item.Read();
ItemDict.Add(item.Handle, item);
Names.Add(item.Name);
@ -48,10 +42,22 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
}
public ObjectInfo GetItemByHandle(int handle)
public ObjectInfo FromHandle(int handle)
{
ItemDict.TryGetValue(handle, out var ret);
return ret;
}
public List<ObjectInfo> FromName(string name)
{
var tempList = new List<ObjectInfo>();
foreach (var key in ItemDict.Keys)
{
var item = ItemDict[key];
if(item.Name==name)tempList.Add(item);
}
return tempList;
}
}
}

@ -1,12 +1,11 @@
using System;
using NetMFAPatcher.MMFParser.Data;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Objects;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class ObjectInfo : ChunkLoader
{
@ -60,13 +59,13 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
if (loader is ObjectName)
{
var actualLoader = infoChunks.get_loader<ObjectName>(loader);
var actualLoader = (ObjectName)(loader);
Name = actualLoader.Value;
}
else if (loader is ObjectHeader)
{
var actualLoader = infoChunks.get_loader<ObjectHeader>(loader);
var actualLoader = (ObjectHeader)(loader);
Handle = actualLoader.Handle;
ObjectType = actualLoader.ObjectType;
Flags = actualLoader.Flags;
@ -84,7 +83,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
if (Properties != null)
{
//Properties.ReadNew(ObjectType);
//Properties.ReadNew(ObjectType,this);
}
}
}
@ -103,7 +102,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public class ObjectProperties : ChunkLoader
{
public bool IsCommon;
public ObjectCommon Loader;
public ChunkLoader Loader;
public ObjectProperties(ByteReader reader) : base(reader)
{
@ -113,17 +112,25 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
{
}
public void ReadNew(int ObjectType)
public void ReadNew(int ObjectType,ObjectInfo parent)
{
Reader.Seek(0);
//var objType = 2;//THIS IS SHITCODE
IsCommon = true;//ITS NOT DONE
if (ObjectType == 2)
//TODO: Fix shit
Console.WriteLine("Reading properties of "+parent.Name);
if (ObjectType == 1)//Backdrop
{
Loader = new Backdrop(Reader);
}
else if(ObjectType==2|| ObjectType==7)
{
IsCommon = true;
Loader = new ObjectCommon(Reader,parent);
}
if (Loader != null)
{
Loader = new ObjectCommon(Reader);
Loader.Read();
}
}
public override void Read()

@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class StringChunk : ChunkLoader
{

@ -1,7 +1,7 @@
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
{
public class FontBank : ChunkLoader
{

@ -1,21 +1,19 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Windows.Forms;
using NetMFAPatcher.GUI;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
{
public class ImageBank : ChunkLoader
{
public bool SaveImages=true;
public Dictionary<int, ImageItem> Images = new Dictionary<int, ImageItem>();
public uint NumberOfItems;
@ -38,10 +36,20 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
$"Number of images: {NumberOfItems}"
};
}
public void Read(bool load,bool save)
{
var cache = Settings.DumpImages;
Settings.DumpImages = load;
SaveImages = save;
Read();
Settings.DumpImages = cache;
}
public override void Read()
{
Reader.Seek(0); //Reset the reader to avoid bugs when dumping more than once
Images = new Dictionary<int, ImageItem>();
NumberOfItems = Reader.ReadUInt32();
@ -59,14 +67,13 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
var item = new ImageItem(Reader);
item.Read();
Images.Add(item.Handle, item);
if (Settings.DumpImages)
{
item.Save($"{Settings.ImagePath}\\" + item.Handle.ToString() + ".png");
Console.ReadKey();
if(SaveImages)item.Save($"{Settings.ImagePath}\\" + item.Handle.ToString() + ".png");
Helper.OnImageSaved(i, (int) NumberOfItems);
}
if (Exe.LatestInst.GameData.ProductBuild >= 284)
if (Exe.Instance.GameData.ProductBuild >= 284)
item.Handle -= 1;
//images[item.handle] = item;
@ -115,7 +122,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
public override void Read()
{
Handle = Reader.ReadInt32();
Handle = Reader.ReadInt32()-1;
Position = (int) Reader.Tell();
Load();
}
@ -150,6 +157,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
_width = imageReader.ReadInt16();
_height = imageReader.ReadInt16();
_graphicMode = imageReader.ReadByte(); //Graphic mode is always 4 for SL
Console.WriteLine("COLORMODE: "+_graphicMode);
Flags.flag = imageReader.ReadByte();
imageReader.Skip(2);
@ -262,13 +270,14 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
chunk.WriteBytes(_transparent);
chunk.WriteBytes(rawImg);
chunk.WriteBytes(rawAlpha);
if(Flags["Alpha"])chunk.WriteBytes(rawAlpha);
writer.WriteInt32(Handle);
chunk.Seek(0);
MemoryStream ms = (MemoryStream) chunk.BaseStream;
writer.WriteBytes(ms.GetBuffer());
writer.WriteWriter(chunk);
//MemoryStream ms = (MemoryStream) chunk.BaseStream;
//writer.WriteBytes(ms.GetBuffer());
}

@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using System.IO;
using System.Net;
using System.Windows.Forms;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
{
public class MusicBank : ChunkLoader
{
@ -19,17 +23,29 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
{
throw new NotImplementedException();
}
public void Read(bool save)
{
var cache = Settings.DumpMusic;
Settings.DumpMusic = save;
Read();
Settings.DumpMusic = cache;
}
public override void Read()
{
//Someone is using this lol?
//Actually,yes
Reader.Seek(0);
Items = new List<MusicFile>();
NumOfItems = Reader.ReadInt32();
if (!Settings.DumpMusic) return;
Console.WriteLine(NumOfItems);
for (int i = 0; i < NumOfItems; i++)
{
if (MainForm.BreakMusics) break;
var item = new MusicFile(Reader);
item.Read();
Helper.OnMusicSaved(i,NumOfItems);
Items.Add(item);
}
}
@ -45,9 +61,13 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
public class MusicFile : ChunkLoader
{
public int Handle;
public string Name = "ERROR";
public int Checksum;
public int References;
public string Name;
private uint _flags;
public byte[] Data;
public int Handle;
public override void Print(bool ext)
{
@ -58,8 +78,34 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
throw new NotImplementedException();
}
public override void Read()
{
var compressed = true;
Handle = Reader.ReadInt32();
if (compressed)
{
Reader = Decompressor.DecompressAsReader(Reader,out int decompressed);
}
Checksum = Reader.ReadInt32();
References = Reader.ReadInt32();
var size = Reader.ReadUInt32();
_flags = Reader.ReadUInt32();
var reserved = Reader.ReadInt32();
var nameLen = Reader.ReadInt32();
Name = Reader.ReadWideString(nameLen);
Data = Reader.ReadBytes((int) (size - nameLen));
if (Settings.DumpMusic)
{
Logger.Log("Saving MIDI: "+Name);
Save($"{Settings.MusicPath}\\{Helper.CleanInput(Name)}.MID");
}
}
public void Save(string filename)
{
File.WriteAllBytes(filename,Data);
}
public MusicFile(ByteReader reader) : base(reader)

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using NetMFAPatcher.GUI;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
{
public class SoundBank : ChunkLoader
{
@ -25,16 +25,24 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
$"Number of sounds: {NumOfItems}"
};
}
public void Read(bool dump)
{
var cache = Settings.DumpSounds;
Settings.DumpSounds = dump;
Read();
Settings.DumpSounds = cache;
}
public override void Read()
{
//Implementing for standalone-only because of my lazyness
if(!Settings.DoMFA) Reader.Seek(0);//Reset the reader to avoid bugs when dumping more than once
Reader.Seek(0);//Reset the reader to avoid bugs when dumping more than once
Items = new List<SoundItem>();
NumOfItems = Reader.ReadInt32();
Logger.Log("Found " + NumOfItems + " sounds");
if (!Settings.DumpSounds&&!Settings.DoMFA) return;
if (!Settings.DumpSounds) return;
for (int i = 0; i < NumOfItems; i++)
{
@ -107,6 +115,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
public int Flags;
public bool IsCompressed = true;
public override void Read()
{
var start = Reader.Tell();

@ -3,15 +3,11 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
public class AppIcon : ChunkLoader
{
@ -28,7 +24,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public override void Read()
{
return;
Logger.Log("dumpingIcon");
Reader.ReadBytes(Reader.ReadInt32() - 4);
List<byte> colorIndexes = new List<byte>();
@ -76,7 +72,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
bmp.Save("icon.png");
}
File.WriteAllBytes("fatcock.raw", _points.ToArray());
}

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
class ChunkList : DataLoader//This is used for MFA reading/writing
{

@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class Controls : DataLoader
{

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class Frame : DataLoader
{

@ -1,9 +1,9 @@
using System;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.MMFParser.MFALoaders.mfachunks;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.MMFParser.MFALoaders.mfachunks;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class FrameItem : DataLoader
{

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class AgmiBank : DataLoader
{

@ -1,8 +1,8 @@
using System;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
class Layer : DataLoader
{

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class ValueList : DataLoader
{

@ -1,6 +1,6 @@
using NetMFAPatcher.Utils;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders.mfachunks
namespace DotNetCTFDumper.MMFParser.MFALoaders.mfachunks
{
class Active : AnimationObject
{

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders.mfachunks
namespace DotNetCTFDumper.MMFParser.MFALoaders.mfachunks
{
class AnimationObject:ObjectLoader
{

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders.mfachunks
namespace DotNetCTFDumper.MMFParser.MFALoaders.mfachunks
{
class Behaviours : DataLoader
{

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders.mfachunks
namespace DotNetCTFDumper.MMFParser.MFALoaders.mfachunks
{
class Movements : DataLoader
{

@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Drawing;
using NetMFAPatcher.MMFParser.Data;
using NetMFAPatcher.Utils;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders.mfachunks
namespace DotNetCTFDumper.MMFParser.MFALoaders.mfachunks
{
class ObjectLoader : DataLoader
{

Loading…
Cancel
Save