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

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

@ -1,6 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
namespace NetMFAPatcher.GUI namespace DotNetCTFDumper.GUI
{ {
partial class CryptoKeyForm partial class CryptoKeyForm
{ {
@ -43,6 +43,7 @@ namespace NetMFAPatcher.GUI
this.charBox.BackColor = System.Drawing.Color.Black; this.charBox.BackColor = System.Drawing.Color.Black;
this.charBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.charBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.charBox.Dock = System.Windows.Forms.DockStyle.Top; 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.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.Location = new System.Drawing.Point(0, 0);
this.charBox.Name = "charBox"; this.charBox.Name = "charBox";
@ -57,7 +58,7 @@ namespace NetMFAPatcher.GUI
this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hexBox1.ColumnInfoVisible = true; this.hexBox1.ColumnInfoVisible = true;
this.hexBox1.Dock = System.Windows.Forms.DockStyle.Fill; 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.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.hexBox1.LineInfoVisible = true; this.hexBox1.LineInfoVisible = true;
this.hexBox1.Location = new System.Drawing.Point(0, 20); 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.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.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.plusButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.Location = new System.Drawing.Point(616, 0);
this.plusButton.Name = "plusButton"; 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.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.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.minusButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.Location = new System.Drawing.Point(589, 0);
this.minusButton.Name = "minusButton"; this.minusButton.Name = "minusButton";

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

@ -1,6 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
namespace NetMFAPatcher.GUI namespace DotNetCTFDumper.GUI
{ {
partial class HexViewForm partial class HexViewForm
{ {
@ -40,6 +40,7 @@ namespace NetMFAPatcher.GUI
// rawBox // rawBox
// //
this.rawBox.Dock = System.Windows.Forms.DockStyle.Top; 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.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.Location = new System.Drawing.Point(0, 0);
this.rawBox.Name = "rawBox"; this.rawBox.Name = "rawBox";
@ -55,7 +56,7 @@ namespace NetMFAPatcher.GUI
this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.hexBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.hexBox1.ColumnInfoVisible = true; this.hexBox1.ColumnInfoVisible = true;
this.hexBox1.Dock = System.Windows.Forms.DockStyle.Fill; 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.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.hexBox1.LineInfoVisible = true; this.hexBox1.LineInfoVisible = true;
this.hexBox1.Location = new System.Drawing.Point(0, 28); this.hexBox1.Location = new System.Drawing.Point(0, 28);
@ -72,6 +73,7 @@ namespace NetMFAPatcher.GUI
// sizeLabel // sizeLabel
// //
this.sizeLabel.Dock = System.Windows.Forms.DockStyle.Bottom; 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.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.Location = new System.Drawing.Point(0, 369);
this.sizeLabel.Name = "sizeLabel"; this.sizeLabel.Name = "sizeLabel";

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

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

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

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

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

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

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

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

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

@ -1,7 +1,7 @@
using System.Drawing; using System.Drawing;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{ {
class Colour : ParameterCommon 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 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 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 class Float : ParameterCommon
{ {

@ -1,7 +1,7 @@
using System; using System;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{ {
class GlobalValue : Short 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 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 class ParamObject : ParameterCommon
{ {

@ -1,8 +1,8 @@
using System; using System;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters
{ {
class ParameterCommon : DataLoader 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 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 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 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 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 class Time : ParameterCommon
{ {

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

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

@ -1,13 +1,8 @@
using System; using System;
using System.Collections.Generic; using DotNetCTFDumper.Utils;
using System.Linq; using static DotNetCTFDumper.MMFParser.Data.ChunkList;
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 namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{ {
class ObjectNames : ChunkLoader//Fucking trash class ObjectNames : ChunkLoader//Fucking trash
{ {

@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{ {
public class Animations:ChunkLoader public class Animations:ChunkLoader
{ {
@ -28,13 +28,11 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects
offsets.Add(Reader.ReadInt16()); offsets.Add(Reader.ReadInt16());
} }
AnimationDict = new Dictionary<int,Animation>(); AnimationDict = new Dictionary<int,Animation>();
if (offsets.Count <= 0) return; for (int i = 0; i < offsets.Count; i++)
for (int i = 0; i < 1; i++)//I am stupid faggot, i don't know, whats wrong with this list
{ {
var offset = offsets[i]; var offset = offsets[i];
if (offset != 0) if (offset != 0)
{ {
Console.WriteLine("Offset: "+offset);
Reader.Seek(currentPosition+offset); Reader.Seek(currentPosition+offset);
var anim = new Animation(Reader); var anim = new Animation(Reader);
anim.Read(); 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;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.ChunkLoaders.Objects namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Objects
{ {
public class ObjectCommon : ChunkLoader 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) : base(reader)
{ {
} }
public ObjectCommon(ByteReader reader,ObjectInfo parent) : base(reader)
{
Parent = parent;
}
public ObjectCommon(ChunkList.Chunk chunk) : base(chunk) public ObjectCommon(ChunkList.Chunk chunk) : base(chunk)
{ {
} }
public override void Read() public override void Read()
{ {
if (Parent.ObjectType != 2) return;
long currentPosition = Reader.Tell(); long currentPosition = Reader.Tell();
int size = Reader.ReadInt32(); int size = Reader.ReadInt32();
bool newobj = Settings.Build > 284; bool newobj = Settings.Build >= 284;
if (newobj && true) if (newobj)
{ {
_animationsOffset = (short) Reader.ReadUInt16(); _animationsOffset = (short) Reader.ReadUInt16();
_movementsOffset = 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) else
{ {
_counterOffset = Reader.ReadInt16(); _movementsOffset = Reader.ReadUInt16();
short version = Reader.ReadInt16();
Reader.ReadBytes(2);
_movementsOffset = (ushort) Reader.ReadInt16();
_extensionOffset = Reader.ReadInt16();
_animationsOffset = 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);
} }
short version = Reader.ReadInt16();
_counterOffset = (short) Reader.ReadUInt16();
_systemObjectOffset = (short) Reader.ReadUInt16();
flags.flag = Reader.ReadUInt32();
var end = Reader.Tell() + 16;
Reader.Seek(end); Reader.Seek(end);
if (newobj)
_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();
_systemObjectOffset = Reader.ReadInt16(); _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);
} }
else
Reader.Seek(_end); {
_extensionOffset = Reader.ReadInt16(); _extensionOffset = Reader.ReadInt16();
}
_valuesOffset = Reader.ReadInt16(); _valuesOffset = Reader.ReadInt16();
_stringsOffset = Reader.ReadInt16(); _stringsOffset = Reader.ReadInt16();
new_flags.flag = Reader.ReadUInt16(); new_flags.flag = Reader.ReadUInt16();
preferences.flag = Reader.ReadUInt16(); preferences.flag = Reader.ReadUInt16();
byte[] identifier = Reader.ReadFourCc(); byte[] identifier = Reader.ReadFourCc();
Color backColor = Reader.ReadColor(); BackColor = Reader.ReadColor();
_fadeinOffset = Reader.ReadInt32(); _fadeinOffset = Reader.ReadInt32();
_fadeoutOffset = Reader.ReadInt32(); _fadeoutOffset = Reader.ReadInt32();
}
if (_movementsOffset != 0) if (_movementsOffset != 0)
{ {
//Reader.Seek(currentPosition+_movementsOffset); //Reader.Seek(currentPosition+_movementsOffset);
//var movements = new Movements(Reader); //var movements = new Movements(Reader);
//movements.Read(); //movements.Read();
Console.WriteLine("Movements done");
} }
Console.WriteLine("Movements done");
if (_valuesOffset != 0) if (_valuesOffset != 0)
{ {
Reader.Seek(currentPosition + _valuesOffset); Reader.Seek(currentPosition + _valuesOffset);
AlterableValues values = new AlterableValues(Reader); AlterableValues values = new AlterableValues(Reader);
values.Read(); values.Read();
Console.WriteLine("Values done");
} }
Console.WriteLine("Values done");
if (_stringsOffset != 0) if (_stringsOffset != 0)
{ {
Reader.Seek(currentPosition + _stringsOffset); Reader.Seek(currentPosition + _stringsOffset);
AlterableStrings strings = new AlterableStrings(Reader); AlterableStrings strings = new AlterableStrings(Reader);
strings.Read(); 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 = new Animations(Reader);
Animations.Read(); Animations.Read();
Console.WriteLine("Animations done");
} }
Console.WriteLine("Animations done"); /*if (_counterOffset != 0)
{
Reader.Seek(currentPosition + _counterOffset);
var counter = new Counter(Reader);
counter.Read();
Console.WriteLine("Counters 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("SysObjOff: " + _systemObjectOffset);
Console.WriteLine("ExtOff: " + _extensionOffset); Console.WriteLine("ExtOff: " + _extensionOffset);
} }

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

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

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

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

@ -1,15 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using DotNetCTFDumper.MMFParser.ChunkLoaders;
using System.Text; using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using System.Threading.Tasks; using DotNetCTFDumper.Utils;
using NetMFAPatcher.MMFParser.ChunkLoaders; namespace DotNetCTFDumper.MMFParser.Data
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.Utils;
namespace NetMFAPatcher.MMFParser.Data
{ {
public class GameData public class GameData
{ {
@ -62,10 +57,10 @@ namespace NetMFAPatcher.MMFParser.Data
else if (magic == Constants.GameHeader) Constants.IsUnicode = false;//PAME else if (magic == Constants.GameHeader) Constants.IsUnicode = false;//PAME
else Logger.Log("Couldn't found any known headers", true, ConsoleColor.Red);//Header not found else Logger.Log("Couldn't found any known headers", true, ConsoleColor.Red);//Header not found
RuntimeVersion = exeReader.ReadUInt16(); // RuntimeVersion = exeReader.ReadUInt16();
RuntimeSubversion = exeReader.ReadUInt16(); //0 RuntimeSubversion = exeReader.ReadUInt16();
ProductVersion = (Constants.Products)exeReader.ReadInt32(); //CTF/MMF2/MMF1.5/CNC ProductVersion = (Constants.Products)exeReader.ReadInt32();
ProductBuild = exeReader.ReadInt32(); //CTF Build ProductBuild = exeReader.ReadInt32();//Easy Access
Settings.Build=ProductBuild; Settings.Build=ProductBuild;
Build = ProductBuild; Build = ProductBuild;
@ -74,24 +69,26 @@ namespace NetMFAPatcher.MMFParser.Data
GameChunks.Read(exeReader); GameChunks.Read(exeReader);
//Load chunks into gamedata for easier access //Load chunks into gamedata for easier access
if (GameChunks.get_chunk<AppName>() != null) Name = GameChunks.get_chunk<AppName>().Value; //Can only be accessed from here AFTER loading all the chunks
if (GameChunks.get_chunk<Copyright>() != null) Copyright = GameChunks.get_chunk<Copyright>().Value; //If you need it AT LOADING - use ChunkList.get_chunk<ChunkType>();
if (GameChunks.get_chunk<AppAuthor>()!=null) Author = GameChunks.get_chunk<AppAuthor>().Value; if (GameChunks.GetChunk<AppName>() != null) Name = GameChunks.GetChunk<AppName>().Value;
if (GameChunks.get_chunk<EditorFilename>() != null) EditorFilename = GameChunks.get_chunk<EditorFilename>().Value; if (GameChunks.GetChunk<Copyright>() != null) Copyright = GameChunks.GetChunk<Copyright>().Value;
if (GameChunks.get_chunk<TargetFilename>() != null) TargetFilename = GameChunks.get_chunk<TargetFilename>().Value; if (GameChunks.GetChunk<AppAuthor>()!=null) Author = GameChunks.GetChunk<AppAuthor>().Value;
if (GameChunks.get_chunk<AppMenu>() != null) Menu = GameChunks.get_chunk<AppMenu>(); if (GameChunks.GetChunk<EditorFilename>() != null) EditorFilename = GameChunks.GetChunk<EditorFilename>().Value;
if (GameChunks.get_chunk<AppHeader>() != null) Header = GameChunks.get_chunk<AppHeader>(); if (GameChunks.GetChunk<TargetFilename>() != null) TargetFilename = GameChunks.GetChunk<TargetFilename>().Value;
if (GameChunks.get_chunk<SoundBank>() != null) Sounds = GameChunks.get_chunk<SoundBank>(); if (GameChunks.GetChunk<AppMenu>() != null) Menu = GameChunks.GetChunk<AppMenu>();
if (GameChunks.get_chunk<MusicBank>() != null) Music = GameChunks.get_chunk<MusicBank>(); if (GameChunks.GetChunk<AppHeader>() != null) Header = GameChunks.GetChunk<AppHeader>();
if (GameChunks.get_chunk<FontBank>() != null) Fonts = GameChunks.get_chunk<FontBank>(); if (GameChunks.GetChunk<SoundBank>() != null) Sounds = GameChunks.GetChunk<SoundBank>();
if (GameChunks.get_chunk<ImageBank>() != null) Images = GameChunks.get_chunk<ImageBank>(); if (GameChunks.GetChunk<MusicBank>() != null) Music = GameChunks.GetChunk<MusicBank>();
if (GameChunks.get_chunk<AppIcon>() != null) Icon = GameChunks.get_chunk<AppIcon>(); if (GameChunks.GetChunk<FontBank>() != null) Fonts = GameChunks.GetChunk<FontBank>();
if (GameChunks.get_chunk<GlobalStrings>() != null) GStrings = GameChunks.get_chunk<GlobalStrings>(); if (GameChunks.GetChunk<ImageBank>() != null) Images = GameChunks.GetChunk<ImageBank>();
if (GameChunks.get_chunk<GlobalValues>() != null) GValues = GameChunks.get_chunk<GlobalValues>(); if (GameChunks.GetChunk<AppIcon>() != null) Icon = GameChunks.GetChunk<AppIcon>();
if (GameChunks.get_chunk<FrameItems>() != null) Frameitems = GameChunks.get_chunk<FrameItems>(); 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. Frames = GameChunks.Frames; //Its a list, so i have to manually parse them in chunk list.
Print(); //Print();
} }
public void Print() public void Print()
{ {
@ -136,12 +133,12 @@ namespace NetMFAPatcher.MMFParser.Data
foreach (var item in Frames) 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); 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) if (objects != null)
{ {
foreach (var obj in objects.Items) 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using DotNetCTFDumper.MMFParser.ChunkLoaders;
using System.Net.NetworkInformation; using DotNetCTFDumper.MMFParser.ChunkLoaders.Banks;
using System.Windows.Forms; using DotNetCTFDumper.MMFParser.MFALoaders;
using NetMFAPatcher.MMFParser.ChunkLoaders; using DotNetCTFDumper.Utils;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks; using Controls = DotNetCTFDumper.MMFParser.MFALoaders.Controls;
using NetMFAPatcher.MMFParser.MFALoaders; using Frame = DotNetCTFDumper.MMFParser.MFALoaders.Frame;
using NetMFAPatcher.Utils;
using Controls = NetMFAPatcher.MMFParser.MFALoaders.Controls; namespace DotNetCTFDumper.MMFParser.Data
using Frame = NetMFAPatcher.MMFParser.MFALoaders.Frame;
namespace NetMFAPatcher.MMFParser.Data
{ {
public class MFA : DataLoader public class MFA : DataLoader
{ {
@ -134,13 +131,18 @@ namespace NetMFAPatcher.MMFParser.Data
Fonts.Write(writer); Fonts.Write(writer);
writer.WriteAscii(SoundBankId); writer.WriteAscii(SoundBankId);
Sounds.Write(writer); Sounds.Write(writer);
writer.WriteAscii(MusicBankId); writer.WriteAscii(MusicBankId);
//music.Write();//cum cum cum cum cum cum cum cum //music.Write();//cum cum cum cum cum cum cum cum
writer.WriteInt32(0);//someone is using musics lol? writer.WriteInt32(0);//someone is using musics lol?
//TODO: Do music
//I am not an asshole lol
writer.WriteAscii(ImageBankId); writer.WriteAscii(ImageBankId);
Icons.Write(writer); Icons.Write(writer);
return;
writer.WriteAscii(ImageBankId); writer.WriteAscii(ImageBankId);
Images.Write(writer); Images.Write(writer);
writer.AutoWriteUnicode(Name); writer.AutoWriteUnicode(Name);
writer.AutoWriteUnicode(Author); writer.AutoWriteUnicode(Author);
writer.AutoWriteUnicode(Description); writer.AutoWriteUnicode(Description);
@ -208,9 +210,9 @@ namespace NetMFAPatcher.MMFParser.Data
writer.AutoWriteUnicode(item.Item3); writer.AutoWriteUnicode(item.Item3);
writer.WriteInt32(item.Item4); writer.WriteInt32(item.Item4);
writer.WriteBytes(item.Item5); writer.WriteBytes(item.Item5);
writer.WriteInt32(Frames.Count);
} }
writer.WriteInt32(Extensions.Count); writer.WriteInt32(Frames.Count);
var startPosition = writer.Tell() + 4 * Frames.Count + 4; var startPosition = writer.Tell() + 4 * Frames.Count + 4;
//help //help
//how to implement write writer //how to implement write writer

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

@ -1,8 +1,8 @@
using System.IO; using System.IO;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.Decompiling namespace DotNetCTFDumper.MMFParser.Decompiling
{ {
public static class MFAGenerator public static class MFAGenerator
{ {
@ -16,11 +16,11 @@ namespace NetMFAPatcher.MMFParser.Decompiling
template.Read(); //Loading template 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 = var mfaWriter =
new ByteWriter( 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 FileMode.Create); //New writer for new MFA
gameMFA.Write(mfaWriter); //Writing 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 public static class Pame2Mfa
{ {

@ -1,12 +1,12 @@
using System; using System;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using NetMFAPatcher.GUI; using DotNetCTFDumper.GUI;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.MMFParser.Decompiling; using DotNetCTFDumper.MMFParser.Decompiling;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher namespace DotNetCTFDumper
{ {
internal class Program internal class Program
{ {
@ -73,16 +73,19 @@ namespace NetMFAPatcher
Settings.DumpImages = dumpImages; Settings.DumpImages = dumpImages;
Settings.DumpSounds = dumpSounds; Settings.DumpSounds = dumpSounds;
Settings.Verbose = verbose; 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 (File.Exists(path))
{ {
if (path.EndsWith(".exe")) if (path.EndsWith(".exe"))
{ {
Settings.DoMFA = false; 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")) else if (path.EndsWith(".mfa"))
{ {
@ -106,7 +109,9 @@ namespace NetMFAPatcher
{ {
Directory.CreateDirectory($"{Settings.ImagePath}"); Directory.CreateDirectory($"{Settings.ImagePath}");
Directory.CreateDirectory($"{Settings.SoundPath}"); Directory.CreateDirectory($"{Settings.SoundPath}");
Directory.CreateDirectory($"{Settings.MusicPath}");
Directory.CreateDirectory($"{Settings.ChunkPath}"); Directory.CreateDirectory($"{Settings.ChunkPath}");
Directory.CreateDirectory($"{Settings.ExtensionPath}"); Directory.CreateDirectory($"{Settings.ExtensionPath}");

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

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

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

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

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

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

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

@ -5,13 +5,13 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NetMFAPatcher.GUI; using DotNetCTFDumper.GUI;
using NetMFAPatcher.MMFParser; using DotNetCTFDumper.MMFParser;
using NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters; using DotNetCTFDumper.MMFParser.ChunkLoaders.Events.Parameters;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects; using DotNetCTFDumper.MMFParser.ChunkLoaders.Objects;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
namespace NetMFAPatcher.Utils namespace DotNetCTFDumper.Utils
{ {
static class Helper static class Helper
{ {
@ -188,6 +188,10 @@ namespace NetMFAPatcher.Utils
{ {
Program.MyForm.UpdateSoundBar(index, 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 OneKb = 1024;
private const long OneMb = OneKb * 1024; private const long OneMb = OneKb * 1024;
@ -284,5 +288,16 @@ namespace NetMFAPatcher.Utils
// Step 3: return the new array. // Step 3: return the new array.
return result; 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 System.IO;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks; using System.Linq;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects; using DotNetCTFDumper.MMFParser.ChunkLoaders;
using NetMFAPatcher.MMFParser.Data; 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() public static void DumpImages()
{ {
@ -17,39 +20,115 @@ namespace NetMFAPatcher.Utils
public static void Dump() public static void Dump()
{ {
var rootFolder = $"{Settings.DumpPath}\\ImageBank\\Sorted"; var rootFolder = $"{Settings.DumpPath}\\ImageBank\\Sorted";
var Bank = Exe.LatestInst.GameData.GameChunks.get_chunk<ImageBank>(); var Bank = Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>();
foreach (var frame in Exe.LatestInst.GameData.Frames) foreach (var frame in Exe.Instance.GameData.Frames)
{ {
if (frame.Objects != null) if (frame.Objects != null)
{ {
var currentFramePath = rootFolder + "\\" + frame.Name; var currentFramePath = rootFolder + "\\" + Helper.CleanInput(frame.Name);
Directory.CreateDirectory(currentFramePath);
foreach (var item in frame.Objects.Items) foreach (var item in frame.Objects.Items)
{ {
var currentObjPath = currentFramePath + "\\" + item.Handle;
var currentObjPath = currentFramePath + "\\" + Helper.CleanInput(item.Name);
Directory.CreateDirectory(currentObjPath); Directory.CreateDirectory(currentObjPath);
var anims = (item.FrameItem.Properties).Loader.Animations.AnimationDict; var frames = item.FrameItem.GetFrames();
foreach (var key in anims.Keys) 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 dir = anim.DirectionDict[dirKey];
foreach (var frame in dir.Frames)
{ {
var anim = anims[key]; if (!frames.ContainsKey(frame))
var directions = anim.DirectionDict;
foreach (var key1 in directions.Keys)
{ {
var dir = directions[0]; var animIndex = common.Animations.AnimationDict.Keys.ToList().IndexOf(animKey);
foreach (var AnimFrame in dir.Frames) var dirIndex = anim.DirectionDict.Keys.ToList().IndexOf(dirKey);
var frameIndex = dir.Frames.IndexOf(frame);
string finalPath = "";
var animAll = dir.Frames.Count == 1;
if(!animAll)
{ {
ImageItem img = null; if (common.Animations.AnimationDict.Keys.Count > 1)
Bank.Images.TryGetValue(AnimFrame, out img); {
img.Save(currentObjPath+"\\"+AnimFrame+".png"); 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; using System;
namespace NetMFAPatcher.Utils namespace DotNetCTFDumper.Utils
{ {
public static class ImageHelper public static class ImageHelper
{ {
@ -73,9 +73,12 @@ namespace NetMFAPatcher.Utils
byte g = (byte) ((newShort & 992) >> 5); byte g = (byte) ((newShort & 992) >> 5);
byte b = (byte) ((newShort & 31)); byte b = (byte) ((newShort & 31));
colorArray[(y * stride) + (x * 4) + 0] = (byte) (r << 3); r=(byte) (r << 3);
colorArray[(y * stride) + (x * 4) + 1] = (byte) (g << 3); g=(byte) (g << 3);
colorArray[(y * stride) + (x * 4) + 2] = (byte) (b << 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; colorArray[(y * stride) + (x * 4) + 3] = 255;
position += 2; position += 2;
} }

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

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

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

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

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

@ -1,18 +1,10 @@
 using System;
using NetMFAPatcher.MMFParser.Data;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using DotNetCTFDumper.MMFParser.Data;
using System.Linq; using DotNetCTFDumper.Utils;
using System.Text; using ChunkList = DotNetCTFDumper.MMFParser.Data.ChunkList;
using System.Threading.Tasks;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks; namespace DotNetCTFDumper.MMFParser.ChunkLoaders
using NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters;
using NetMFAPatcher.MMFParser.MFALoaders;
using NetMFAPatcher.Utils;
using ChunkList = NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders
{ {
class FrameName : StringChunk class FrameName : StringChunk
{ {
@ -76,28 +68,33 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public override void Read() public override void Read()
{ {
var frameReader = new ByteReader(Chunk.ChunkData); var frameReader = new ByteReader(Chunk.ChunkData);
Chunks = new ChunkList(); Chunks = new ChunkList();
Chunks.Verbose = false; Chunks.Verbose = false;
Chunks.Read(frameReader); Chunks.Read(frameReader);
//return;
var name = Chunks.get_chunk<FrameName>(); var name = Chunks.GetChunk<FrameName>();
if (name != null) //Just to be sure if (name != null) //Just to be sure
{ {
this.Name = name.Value; 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 if (password != null) //Just to be sure
{ {
this.Password = password.Value; this.Password = password.Value;
} }
Header = Chunks.get_chunk<FrameHeader>();
Header = Chunks.GetChunk<FrameHeader>();
Width = Header.Width; Width = Header.Width;
Height = Header.Height; Height = Header.Height;
Background = Header.Background; Background = Header.Background;
//Flags = header.Flags; //Flags = header.Flags;
Objects = Chunks.get_chunk<ObjectInstances>(); Objects = Chunks.GetChunk<ObjectInstances>();
if(Objects!=null) if(Objects!=null)
{ {
CountOfObjs = Objects.CountOfObjects; CountOfObjs = Objects.CountOfObjects;
@ -247,20 +244,19 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public override void Read() public override void Read()
{ {
ObjectInfo = (ushort) Reader.ReadInt16();
Handle = (ushort) Reader.ReadInt16();
Handle = Reader.ReadUInt16();
//if (Handle > 0) Handle -= 1;
ObjectInfo = Reader.ReadUInt16();
X = Reader.ReadInt32(); X = Reader.ReadInt32();
Y = Reader.ReadInt32(); Y = Reader.ReadInt32();
ParentType = Reader.ReadInt16(); ParentType = Reader.ReadInt16();
ParentHandle = Reader.ReadInt16(); ParentHandle = Reader.ReadInt16();
Layer = Reader.ReadInt16(); Layer = Reader.ReadInt16();
Reader.Skip(2); var reserved = Reader.ReadInt16();
//------------------------- //-------------------------
if (FrameItem != null) Name = FrameItem.Name; if (FrameItem != null) Name = FrameItem.Name;
else Name = $"UNKNOWN-{Handle}"; else Name = $"UNKNOWN-{Handle}";
Console.WriteLine("ObjectInfoHandle: "+Handle);
} }
@ -268,7 +264,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
{ {
get 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}", $"Name: {Name}",
$"Type:{(Constants.ObjectType)FrameItem.ObjectType} - {FrameItem.ObjectType}", $"Type:{(Constants.ObjectType)FrameItem.ObjectType} - {FrameItem.ObjectType}",
$"Position: {X,5}x{Y,5}", $"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.Collections.Generic;
using System.Linq; using DotNetCTFDumper.MMFParser.Data;
using System.Text; using DotNetCTFDumper.Utils;
using System.Threading.Tasks; using static DotNetCTFDumper.MMFParser.Data.ChunkList;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks;
using NetMFAPatcher.MMFParser.MFALoaders;
using NetMFAPatcher.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{ {
public class FrameItems : ChunkLoader public class FrameItems : ChunkLoader
{ {
@ -38,7 +33,6 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
for (int i = 0; i < NumberOfItems; i++) for (int i = 0; i < NumberOfItems; i++)
{ {
var item = new ObjectInfo(Reader); var item = new ObjectInfo(Reader);
item.Verbose = false;
item.Read(); item.Read();
ItemDict.Add(item.Handle, item); ItemDict.Add(item.Handle, item);
Names.Add(item.Name); 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); ItemDict.TryGetValue(handle, out var ret);
return 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 System;
using NetMFAPatcher.MMFParser.Data;
using System.Collections.Generic; using System.Collections.Generic;
using NetMFAPatcher.MMFParser.ChunkLoaders.Banks; using DotNetCTFDumper.MMFParser.ChunkLoaders.Objects;
using NetMFAPatcher.MMFParser.ChunkLoaders.Objects; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
using static NetMFAPatcher.MMFParser.Data.ChunkList; using static DotNetCTFDumper.MMFParser.Data.ChunkList;
namespace NetMFAPatcher.MMFParser.ChunkLoaders namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{ {
public class ObjectInfo : ChunkLoader public class ObjectInfo : ChunkLoader
{ {
@ -60,13 +59,13 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
if (loader is ObjectName) if (loader is ObjectName)
{ {
var actualLoader = infoChunks.get_loader<ObjectName>(loader); var actualLoader = (ObjectName)(loader);
Name = actualLoader.Value; Name = actualLoader.Value;
} }
else if (loader is ObjectHeader) else if (loader is ObjectHeader)
{ {
var actualLoader = infoChunks.get_loader<ObjectHeader>(loader); var actualLoader = (ObjectHeader)(loader);
Handle = actualLoader.Handle; Handle = actualLoader.Handle;
ObjectType = actualLoader.ObjectType; ObjectType = actualLoader.ObjectType;
Flags = actualLoader.Flags; Flags = actualLoader.Flags;
@ -84,7 +83,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
if (Properties != null) if (Properties != null)
{ {
//Properties.ReadNew(ObjectType); //Properties.ReadNew(ObjectType,this);
} }
} }
} }
@ -103,7 +102,7 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders
public class ObjectProperties : ChunkLoader public class ObjectProperties : ChunkLoader
{ {
public bool IsCommon; public bool IsCommon;
public ObjectCommon Loader; public ChunkLoader Loader;
public ObjectProperties(ByteReader reader) : base(reader) 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 //TODO: Fix shit
IsCommon = true;//ITS NOT DONE Console.WriteLine("Reading properties of "+parent.Name);
if (ObjectType == 2) if (ObjectType == 1)//Backdrop
{ {
Loader = new ObjectCommon(Reader); Loader = new Backdrop(Reader);
Loader.Read(); }
else if(ObjectType==2|| ObjectType==7)
{
IsCommon = true;
Loader = new ObjectCommon(Reader,parent);
} }
if (Loader != null)
{
Loader.Read();
}
} }
public override void Read() public override void Read()

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

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

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

@ -1,9 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NetMFAPatcher.Utils; using System.IO;
using static NetMFAPatcher.MMFParser.Data.ChunkList; 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 public class MusicBank : ChunkLoader
{ {
@ -19,17 +23,29 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void Read(bool save)
{
var cache = Settings.DumpMusic;
Settings.DumpMusic = save;
Read();
Settings.DumpMusic = cache;
}
public override void Read() public override void Read()
{ {
//Someone is using this lol? //Someone is using this lol?
//Actually,yes
Reader.Seek(0);
Items = new List<MusicFile>(); Items = new List<MusicFile>();
NumOfItems = Reader.ReadInt32(); NumOfItems = Reader.ReadInt32();
if (!Settings.DumpMusic) return;
Console.WriteLine(NumOfItems); Console.WriteLine(NumOfItems);
for (int i = 0; i < NumOfItems; i++) for (int i = 0; i < NumOfItems; i++)
{ {
if (MainForm.BreakMusics) break;
var item = new MusicFile(Reader); var item = new MusicFile(Reader);
item.Read(); item.Read();
Helper.OnMusicSaved(i,NumOfItems);
Items.Add(item); Items.Add(item);
} }
} }
@ -45,9 +61,13 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
public class MusicFile : ChunkLoader 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 byte[] Data;
public int Handle;
public override void Print(bool ext) public override void Print(bool ext)
{ {
@ -58,8 +78,34 @@ namespace NetMFAPatcher.MMFParser.ChunkLoaders.Banks
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override void Read() 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) public MusicFile(ByteReader reader) : base(reader)

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

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

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

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

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

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

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

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

@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NetMFAPatcher.MMFParser.Data; using DotNetCTFDumper.MMFParser.Data;
using NetMFAPatcher.Utils; using DotNetCTFDumper.Utils;
namespace NetMFAPatcher.MMFParser.MFALoaders namespace DotNetCTFDumper.MMFParser.MFALoaders
{ {
public class ValueList : DataLoader 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 class Active : AnimationObject
{ {

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

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

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

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

Loading…
Cancel
Save