Started working on events

master
1987kostya 4 years ago
parent e03e50a993
commit d8872e71e1

@ -189,6 +189,7 @@
<Compile Include="MMFParser\Decompiling\MFAGenerator.cs" />
<Compile Include="MMFParser\Decompiling\PAME2MFA.cs" />
<Compile Include="MMFParser\MFALoaders\ChunkList.cs" />
<Compile Include="MMFParser\MFALoaders\Events.cs" />
<Compile Include="MMFParser\MFALoaders\Frame.cs" />
<Compile Include="MMFParser\MFALoaders\FrameInstance.cs" />
<Compile Include="MMFParser\MFALoaders\FrameItem.cs" />

@ -17,9 +17,10 @@ namespace DotNetCTFDumper.GUI
public HexViewForm(byte[] parsedData, byte[] rawData,Color color)
{
InitializeComponent();
sizeLabel.ForeColor = color;
rawBox.ForeColor = color;
hexBox1.ForeColor = color;
foreach (Control item in Controls)
{
item.ForeColor = color;
}
hexBox1.InfoForeColor = Color.FromArgb(color.R/2, color.G/2, color.B/2);
hexBox1.SelectionForeColor=Color.FromArgb(color.R, color.G, color.B);
hexBox1.SelectionBackColor=Color.FromArgb(color.R/4, color.G/4, color.B/4);

@ -119,6 +119,7 @@
// GameInfo
//
this.GameInfo.AutoSize = true;
this.GameInfo.BackColor = System.Drawing.Color.Transparent;
this.GameInfo.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.GameInfo.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.GameInfo.Location = new System.Drawing.Point(9, 55);
@ -216,7 +217,6 @@
//
this.MFABtn.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MFABtn.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (64)))), ((int) (((byte) (64)))), ((int) (((byte) (64)))));
this.MFABtn.Enabled = false;
this.MFABtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.MFABtn.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204)));
this.MFABtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));

@ -24,39 +24,33 @@ namespace DotNetCTFDumper.GUI
public Color ColorTheme = Color.FromArgb(223,114,38);
public PackDataForm PackForm;
public delegate void SaveHandler(int index, int all);
public MainForm()
{
//Buttons
InitializeComponent();
cryptKeyBtn.ForeColor = ColorTheme;
dumpSortedBtn.ForeColor = ColorTheme;
showHexBtn.ForeColor = ColorTheme;
FolderBTN.ForeColor = ColorTheme;
MFABtn.ForeColor = ColorTheme;
imagesButton.ForeColor = ColorTheme;
soundsButton.ForeColor = ColorTheme;
packDataBtn.ForeColor = ColorTheme;
//Menu
saveChunkBtn.ForeColor = ColorTheme;
saveChunkBtn.BackColor=Color.Black;
viewHexBtn.ForeColor = ColorTheme;
viewHexBtn.BackColor=Color.Black;
previewFrameBtn.ForeColor = ColorTheme;
previewFrameBtn.BackColor=Color.Black;
//Labels
label1.ForeColor = ColorTheme;
foreach (Control item in Controls)
{
item.ForeColor = ColorTheme;
item.BackColor=Color.Black;
if(item is Button) item.BackColor=Color.FromArgb(30,30,30);
if (item is Label)
{
item.BackColor = Color.Transparent;
item.Refresh();
}
}
foreach (var item in ChunkCombo.Items)
{
((ToolStripItem)item).ForeColor = ColorTheme;
((ToolStripItem)item).BackColor=Color.Black;
}
label1.Text = Settings.DumperVersion;
button1.ForeColor = ColorTheme;
GameInfo.ForeColor = ColorTheme;
loadingLabel.ForeColor = ColorTheme;
imageLabel.ForeColor = ColorTheme;
soundLabel.ForeColor=ColorTheme;
//Other
treeView1.ForeColor = ColorTheme;
listBox1.ForeColor = ColorTheme;
imageBar.ForeColor = ColorTheme;
soundBar.ForeColor = ColorTheme;
@ -187,6 +181,9 @@ namespace DotNetCTFDumper.GUI
}
}
}
GameInfo.BackColor=Color.Transparent;
GameInfo.Refresh();
}
public void AfterLoad()
@ -253,11 +250,12 @@ namespace DotNetCTFDumper.GUI
toLog += $"Unique FrameItems: {Exe.Instance.GameData.Frameitems.NumberOfItems}\n";
toLog += $"Frame Count: {Exe.Instance.GameData.Frames.Count}\n";
toLog += $"Chunks Count: {Exe.Instance.GameData.GameChunks.Chunks.Count}\n";
//toLog += $"Runtime Subversion: {Exe.LatestInst.GameData.RuntimeSubversion}\n";
if (Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>() != null)
Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>().OnImageSaved += UpdateImageBar;
if (Exe.Instance.GameData.GameChunks.GetChunk<SoundBank>() != null)
Exe.Instance.GameData.GameChunks.GetChunk<SoundBank>().OnSoundSaved += UpdateSoundBar;
if (Exe.Instance.GameData.GameChunks.GetChunk<MusicBank>() != null)
Exe.Instance.GameData.GameChunks.GetChunk<MusicBank>().OnMusicSaved += UpdateMusicBar;
GameInfo.Text = toLog;
}
@ -301,6 +299,7 @@ namespace DotNetCTFDumper.GUI
if (!IsDumpingSounds)
{
SetSoundElements(true);
IsDumpingSounds = true;
Backend.DumpSounds(this,true,true);
}
@ -316,6 +315,7 @@ namespace DotNetCTFDumper.GUI
if (!IsDumpingImages)
{
SetImageElements(true);
IsDumpingImages = true;
Backend.DumpImages(this,true,true);
}
@ -326,6 +326,23 @@ namespace DotNetCTFDumper.GUI
SetImageElements(false);
}
}
private void musicsButton_Click(object sender, EventArgs e)
{
if (!IsDumpingMusics)
{
SetMusicElements(true);
IsDumpingMusics = true;
Backend.DumpMusics(this,true,true);
}
else
{
BreakMusics = true;
IsDumpingMusics = false;
SetMusicElements(false);
}
}
public void SetSoundElements(bool state)
@ -430,21 +447,19 @@ namespace DotNetCTFDumper.GUI
PackForm.Show();
}
private void musicsButton_Click(object sender, EventArgs e)
private void button2_Click(object sender, EventArgs e)
{
var myPic = new PictureBox();
var img = Exe.Instance.GameData.GameChunks.GetChunk<ImageBank>().Images[65].Bitmap;
myPic.SizeMode = PictureBoxSizeMode.StretchImage;
if (!IsDumpingMusics)
{
Backend.DumpMusics(this,true,true);
}
else
{
BreakMusics = true;
IsDumpingMusics = false;
SetMusicElements(false);
}
myPic.Image = img;
myPic.Width = img.Width / 2;
myPic.Height = img.Height / 2;
Controls.Add(myPic);
}
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using DotNetCTFDumper.Utils;
using static DotNetCTFDumper.MMFParser.Data.ChunkList;
@ -170,7 +171,10 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Events
}
}
public void Write(ByteWriter Writer)
{
}
}

@ -123,6 +123,7 @@ namespace DotNetCTFDumper.MMFParser.Data
public override void Write(ByteWriter Writer)
{
Writer.WriteAscii("MFU2");
Writer.WriteInt32(MfaBuild);
Writer.WriteInt32(Product);
@ -218,7 +219,16 @@ namespace DotNetCTFDumper.MMFParser.Data
}
Writer.WriteInt32(0);//custom qualifiers
Writer.WriteInt32(0); //extensions
Writer.WriteInt32(0); //frame
Writer.WriteInt32(Frames.Count); //frame
var startPos = Reader.Tell() + 4 * Frames.Count + 4;
ByteWriter newWriter = new ByteWriter(new MemoryStream());
foreach (Frame frame in Frames)
{
Writer.WriteUInt32((uint) (startPos+newWriter.Tell()+4));
frame.Write(newWriter);
}
Writer.WriteUInt32((uint) (startPos+newWriter.Tell()+4));
Writer.WriteWriter(newWriter);

@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
@ -6,8 +7,8 @@ namespace DotNetCTFDumper.MMFParser.Decompiling
{
public static class MFAGenerator
{
public static readonly string TemplatePath = @"C:\Users\MED45\Downloads\testNoFrames.mfa";
// public static readonly string TemplatePath = @"C:\Users\ivani\Desktop\CTFResearch\testNoFrames.mfa";
//public static readonly string TemplatePath = @"C:\Users\MED45\Downloads\testNoFrames.mfa";
public static readonly string TemplatePath = @"C:\Users\ivani\Desktop\CTFResearch\testNoFrames.mfa";
public static void BuildMFA()
{
@ -17,13 +18,15 @@ namespace DotNetCTFDumper.MMFParser.Decompiling
template.Read(); //Loading template
var gameMFA = template; //Pame2Mfa.Translate(template, Exe.LatestInst.GameData); //Translation
Pame2Mfa.Translate(ref template, Exe.Instance.GameData); //Translation
var mfaWriter =
new ByteWriter(
Settings.GameName.Length > 0 ? $"{Settings.DumpPath}\\{Exe.Instance.GameData.Name}.mfa" : "out.mfa",
FileMode.Create); //New writer for new MFA
gameMFA.Write(mfaWriter); //Writing new MFA
template.Write(mfaWriter); //Writing new MFA
mfaWriter.Dispose();
Logger.Log("MFA Done",true,ConsoleColor.Yellow);
}
public static void ReadTestMFA()
@ -32,6 +35,9 @@ namespace DotNetCTFDumper.MMFParser.Decompiling
var template = new MFA(mfaReader);
Settings.DoMFA = true;
template.Read();
//Add modifications
var mfaWriter = new ByteWriter("outTest.mfa", FileMode.Create);
template.Write(mfaWriter);
}

@ -5,17 +5,19 @@ namespace DotNetCTFDumper.MMFParser.Decompiling
{
public static class Pame2Mfa
{
public static MFA Translate(MFA template, GameData game)
public static void Translate(ref MFA mfa, GameData game)
{
MFA mfa = template;
mfa.MfaBuild = 4;
mfa.Product = (int) game.ProductVersion;
//mfa.MfaBuild = 4;
//mfa.Product = (int) game.ProductVersion;
mfa.BuildVersion = 283;
mfa.Name = game.Name;
mfa.Description = $"Decompiled with {Settings.DumperVersion}";
mfa.Path = game.EditorFilename;
return;
//mfa.Stamp = wtf;
mfa.Fonts = game.Fonts;
if (game.Fonts != null) mfa.Fonts = game.Fonts;
mfa.Sounds = game.Sounds;
foreach (var item in mfa.Sounds.Items)
{
@ -49,20 +51,11 @@ namespace DotNetCTFDumper.MMFParser.Decompiling
mfa.BuildType = 0;
mfa.BuildPath = game.TargetFilename;
mfa.CommandLine = "";
mfa.Aboutbox = game.AboutText.Length > 0
? game.AboutText
mfa.Aboutbox = game.AboutText?.Length > 0
? game?.AboutText
: "This game was decompiled with " + Settings.DumperVersion;
return mfa;
}
}
}

@ -0,0 +1,384 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Runtime.InteropServices;
using DotNetCTFDumper.MMFParser.ChunkLoaders.Events;
using DotNetCTFDumper.MMFParser.Data;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.MFALoaders
{
public class Events:DataLoader
{
public readonly string EventData = "Evts";
public readonly string CommentData = "Rems";
public readonly string ObjectData = "EvOb";
public readonly string EventEditorData = "EvCs";
public readonly string ObjectListData = "EvEd";
public readonly string TimeListData = "EvEd";
public readonly string EditorPositionData = "EvTs";
public readonly string EditorLineData = "EvLs";
public readonly string EventEnd ="!DNE";
public List<EventGroup> Items;
public ushort Version;
public ushort FrameType;
public List<Comment> Comments;
public List<EventObject> Objects;
public ushort ConditionWidth;
public ushort ObjectHeight;
public List<ushort> ObjectTypes;
public List<ushort> ObjectHandles;
public List<ushort> ObjectFlags;
public List<string> Folders;
public uint X;
public uint Y;
public uint CaretType;
public uint CaretX;
public uint CaretY;
public uint LineY;
public uint LineItemType;
public uint EventLine;
public uint EventLineY;
public Events(ByteReader reader) : base(reader)
{
}
public Events(Data.ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
Version = Reader.ReadUInt16();
FrameType = Reader.ReadUInt16();
Items = new List<EventGroup>();
while (true)
{
string name = Reader.ReadAscii(4);
if (name == EventData)
{
uint size = Reader.ReadUInt32();
uint end = (uint) (Reader.Tell() + size);
while (true)
{
EventGroup evGrp = new EventGroup(Reader);
evGrp.Read();
Items.Add(evGrp);
if (Reader.Tell() >= end) break;
}
}
else if (name == CommentData)
{
try
{
uint len = Reader.ReadUInt32();
Comments = new List<Comment>();
Comment comment = new Comment(Reader);
comment.Read();
Comments.Add(comment);
}
catch
{
//What the fuck?
/*
import code
code.interact(local = locals())
*/
}
}
else if (name == ObjectData)
{
Objects = new List<EventObject>();
uint len = Reader.ReadUInt32();
for (int i = 0; i < len; i++)
{
EventObject eventObject = new EventObject(Reader);
eventObject.Read();
Objects.Add(eventObject);
}
}
else if (name == EventEditorData)
{
Reader.Skip(4);
ConditionWidth = Reader.ReadUInt16();
ObjectHeight = Reader.ReadUInt16();
Reader.Skip(12);
}
else if (name == ObjectListData)
{
short count = Reader.ReadInt16();
short realCount = count;
if (count == -1)
{
realCount = Reader.ReadInt16();
}
ObjectTypes = new List<ushort>();
for (int i = 0; i < realCount; i++)
{
ObjectTypes.Add(Reader.ReadUInt16());
}
ObjectHandles = new List<ushort>();
for (int i = 0; i < realCount; i++)
{
ObjectHandles.Add(Reader.ReadUInt16());
}
ObjectFlags = new List<ushort>();
for (int i = 0; i < realCount; i++)
{
ObjectFlags.Add(Reader.ReadUInt16());
}
if (count == -1)
{
Folders = new List<string>();
var folderCount = Reader.ReadUInt16();
for (int i = 0; i < folderCount; i++)
{
Folders.Add( Reader.AutoReadUnicode());
}
}
}
else if (name == TimeListData)
{
throw new NotImplementedException("I don't like no timelist");
}
else if (name == EditorPositionData)
{
if(Reader.ReadUInt16()!=1) throw new NotImplementedException("Invalid chunkversion");
X = Reader.ReadUInt32();
Y = Reader.ReadUInt32();
CaretType = Reader.ReadUInt32();
CaretX = Reader.ReadUInt32();
CaretY = Reader.ReadUInt32();
}
else if (name == EditorLineData)
{
if(Reader.ReadUInt16()!=1) throw new NotImplementedException("Invalid chunkversion");
LineY = Reader.ReadUInt32();
LineItemType = Reader.ReadUInt32();
EventLine = Reader.ReadUInt32();
EventLineY = Reader.ReadUInt32();
}
else if (name == EventEnd) break;
//else throw new NotImplementedException("Fuck Something Broken");
}
}
public override void Write(ByteWriter Writer)
{
Writer.WriteUInt16(Version);
Writer.WriteInt16((short) FrameType);
if (Items != null)
{
Writer.WriteAscii(EventData);
ByteWriter newWriter = new ByteWriter(new MemoryStream());
foreach (EventGroup eventGroup in Items)
{
eventGroup.Write(newWriter);
}
Writer.WriteWriter(newWriter);
}
if (Comments != null)
{
Writer.WriteAscii(CommentData);
foreach (Comment comment in Comments)
{
comment.Write(Writer);
}
}
if (Objects != null)
{
Writer.WriteAscii(ObjectData);
Writer.WriteUInt32((uint) Objects.Count);
foreach (EventObject eventObject in Objects)
{
eventObject.Write(Writer);
}
}
Writer.WriteAscii(EventEditorData);
Writer.Skip(4+2*2+4*3);
if (ObjectTypes != null)
{
Writer.WriteAscii(ObjectListData);
Writer.WriteInt16(-1);
Writer.WriteInt16((short) ObjectTypes.Count);
foreach (ushort objectType in ObjectTypes)
{
Writer.WriteUInt16(objectType);
}
foreach (ushort objectHandle in ObjectHandles)
{
Writer.WriteUInt16(objectHandle);
}
foreach (ushort objectFlag in ObjectFlags)
{
Writer.WriteUInt16(objectFlag);
}
Writer.WriteUInt16((ushort) Folders.Count);
foreach (string folder in Folders)
{
Writer.AutoWriteUnicode(folder);
}
}
if (X != 0)
{
Writer.WriteAscii(EditorPositionData);
Writer.WriteInt16(1);
Writer.WriteInt32((int) X);
Writer.WriteInt32((int) Y);
Writer.WriteUInt32(CaretType);
Writer.WriteUInt32(CaretX);
Writer.WriteUInt32(CaretY);
}
if (LineY != 0)
{
Writer.WriteAscii(EditorLineData);
Writer.WriteInt16(1);
Writer.WriteUInt32(LineY);
Writer.WriteUInt32(LineItemType);
Writer.WriteUInt32(EventLine);
Writer.WriteUInt32(EventLineY);
}
Writer.WriteAscii(EventEnd);
}
public override void Print()
{
throw new System.NotImplementedException();
}
}
public class Comment:DataLoader
{
public uint Handle;
public string Value;
public Comment(ByteReader reader) : base(reader)
{
}
public Comment(Data.ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
Handle = Reader.ReadUInt32();
Value = Helper.AutoReadUnicode(Reader);
}
public override void Write(ByteWriter Writer)
{
Writer.WriteUInt32(Handle);
Writer.AutoWriteUnicode(Value);
}
public override void Print()
{
throw new System.NotImplementedException();
}
}
public class EventObject : DataLoader
{
public uint Handle;
public ushort ObjectType;
public ushort ItemType;
public string Name;
public string TypeName;
public ushort Flags;
public uint ItemHandle;
public uint InstanceHandle;
public string Code;
public string IconBuffer;
public ushort SystemQualifier;
public EventObject(ByteReader reader) : base(reader)
{
}
public EventObject(Data.ChunkList.Chunk chunk) : base(chunk)
{
}
public override void Read()
{
Handle = Reader.ReadUInt32();
ObjectType = Reader.ReadUInt16();
ItemType = Reader.ReadUInt16();
Name = Reader.AutoReadUnicode();//Not Sure
TypeName = Reader.AutoReadUnicode();//Not Sure
Flags = Reader.ReadUInt16();
if (ObjectType == 1)//FrameItemType
{
ItemHandle = Reader.ReadUInt32();
InstanceHandle = Reader.ReadUInt32();
}
else if (ObjectType == 2)//ShortcutItemType
{
Code = Reader.ReadAscii(4);
if (Code == "OIC2")//IconBufferCode
{
IconBuffer = Reader.AutoReadUnicode();
}
}
if (ObjectType == 3) //SystemItemType
{
SystemQualifier = Reader.ReadUInt16();
}
}
public override void Write(ByteWriter Writer)
{
Writer.WriteUInt32(Handle);
Writer.WriteUInt16(ObjectType);
Writer.WriteUInt16(ItemType);
Writer.AutoWriteUnicode(Name);//Not Sure
Writer.AutoWriteUnicode(TypeName);//Not Sure
Writer.WriteUInt16(Flags);
if (ObjectType == 1)
{
Writer.WriteUInt32(ItemHandle);
Writer.WriteUInt32(InstanceHandle);
}
else if (ObjectType == 2)
{
Writer.WriteAscii(Code);
if (Code == "OIC2")
{
Writer.AutoWriteUnicode(IconBuffer);
}
}
if (ObjectType == 3)
{
Writer.WriteUInt16(SystemQualifier);
}
}
public override void Print()
{
throw new System.NotImplementedException();
}
}
}

@ -53,7 +53,7 @@ namespace DotNetCTFDumper.Utils
return temp;
}
public static string AutoReadUnicode(ByteReader reader)
public static string AutoReadUnicode(this ByteReader reader)
{
var len = reader.ReadInt16();
reader.Skip(2);
@ -180,19 +180,7 @@ namespace DotNetCTFDumper.Utils
}
}
public static void OnImageSaved(int index, int all)
{
Program.MyForm.UpdateImageBar(index, all);
}
public static void OnSoundSaved(int index, int all)
{
Program.MyForm.UpdateSoundBar(index, all);
}
public static void OnMusicSaved(int index, int all)
{
Program.MyForm.UpdateSoundBar(index, all);
}
private const long OneKb = 1024;
private const long OneMb = OneKb * 1024;

@ -33,6 +33,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
public override void Read()
{
long currentPosition = Reader.Tell();
uint headerSize = Reader.ReadUInt32();
int menuOffset = Reader.ReadInt32();
@ -46,14 +47,14 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
Load(Reader);
Reader.Seek(currentPosition + accelOffset);
AccelShift = new List<byte>();
AccelKey = new List<short>();
AccelId = new List<short>();
for (int i = 0; i < accelSize / 8; i++)
{
AccelShift = new List<byte>();
AccelKey = new List<short>();
AccelId = new List<short>();
AccelShift.Add(Reader.ReadByte());
;
Reader.Skip(1);
AccelKey.Add(Reader.ReadInt16());
AccelId.Add(Reader.ReadInt16());
@ -65,7 +66,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
{
writer.WriteInt32(20);
writer.WriteInt32(20);
writer.WriteInt32(0);
writer.WriteInt32(458);
ByteWriter menuDataWriter = new ByteWriter(new MemoryStream());
@ -74,7 +75,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
item.Write(menuDataWriter);
}
writer.WriteUInt32((uint) (24 + menuDataWriter.BaseStream.Position));
writer.WriteUInt32((uint) ( menuDataWriter.BaseStream.Position)+62);//shit
writer.WriteInt32(AccelKey.Count * 8);
writer.WriteInt32(0);
writer.WriteWriter(menuDataWriter);
@ -152,7 +153,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
Mnemonic = Name[i + 1].ToString().ToUpper();
}
Name = Name.Replace("&", "");
//Name = Name.Replace("&", "");
}
Console.WriteLine(Name);
@ -171,12 +172,12 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders
}
String MName = Name;
if (Mnemonic != null)
if (Mnemonic!=null)
{
MName = MName.Replace(Mnemonic, "&" + Mnemonic);
//MName = MName.Replace(Mnemonic, "&" + Mnemonic);
}
writer.AutoWriteUnicode(MName);
writer.WriteUnicode(MName);
}
}
}

@ -46,6 +46,13 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
Settings.DumpImages = cache;
}
public event MainForm.SaveHandler OnImageSaved;
public override void Read()
{
if (!Settings.DoMFA) Reader.Seek(0); //Reset the reader to avoid bugs when dumping more than once
@ -70,11 +77,11 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
Images.Add(item.Handle, item);
if (SaveImages) item.Save($"{Settings.ImagePath}\\" + item.Handle.ToString() + ".png");
OnImageSaved?.Invoke(i,(int) NumberOfItems);
Helper.OnImageSaved(i, (int) NumberOfItems);
if (Exe.Instance.GameData.ProductBuild >= 284)
if (Settings.Build >= 284)
item.Handle -= 1;
//images[item.handle] = item;

@ -30,7 +30,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
Read();
Settings.DumpMusic = cache;
}
public event MainForm.SaveHandler OnMusicSaved;
public override void Read()
{
//Someone is using this lol?
@ -45,7 +45,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
if (MainForm.BreakMusics) break;
var item = new MusicFile(Reader);
item.Read();
Helper.OnMusicSaved(i,NumOfItems);
OnMusicSaved?.Invoke(i,(int) NumOfItems);
Items.Add(item);
}
}

@ -33,7 +33,7 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
Settings.DumpSounds = cache;
}
public event MainForm.SaveHandler OnSoundSaved;
public override void Read()
{
//Implementing for standalone-only because of my lazyness
@ -58,7 +58,8 @@ namespace DotNetCTFDumper.MMFParser.ChunkLoaders.Banks
var item = new SoundItem(Reader);
item.IsCompressed = IsCompressed;
item.Read();
Helper.OnSoundSaved(i, NumOfItems);
OnSoundSaved?.Invoke(i,(int) NumOfItems);
Items.Add(item);

@ -54,6 +54,14 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
public int Button2;
public int Button3;
public int Button4;
public int Unk1;
public int Unk2;
public int Unk3;
public int Unk4;
public int Unk5;
public int Unk6;
public int Unk7;
public int Unk8;
public PlayerControl(ByteReader reader) : base(reader)
@ -79,10 +87,15 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
Button2 = Reader.ReadInt32();
Button3 = Reader.ReadInt32();
Button4 = Reader.ReadInt32();
for (int i = 0; i < 8; i++)
{
Reader.ReadInt32();
}
Unk1 = Reader.ReadInt32();
Unk2 = Reader.ReadInt32();
Unk3 = Reader.ReadInt32();
Unk4 = Reader.ReadInt32();
Unk5 = Reader.ReadInt32();
Unk6 = Reader.ReadInt32();
Unk7 = Reader.ReadInt32();
Unk8 = Reader.ReadInt32();
}
public override void Write(ByteWriter writer)
@ -97,10 +110,15 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
writer.WriteInt32(Button2);
writer.WriteInt32(Button3);
writer.WriteInt32(Button4);
for (int i = 0; i < 8; i++)
{
writer.WriteInt32(0);
}
writer.WriteInt32(Unk1);
writer.WriteInt32(Unk2);
writer.WriteInt32(Unk3);
writer.WriteInt32(Unk4);
writer.WriteInt32(Unk5);
writer.WriteInt32(Unk6);
writer.WriteInt32(Unk7);
writer.WriteInt32(Unk8);
}

@ -25,6 +25,7 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
public int StampHandle;
public int ActiveLayer;
public List<Layer> Layers;
public Events Events;
public Frame(ByteReader reader) : base(reader)
{
@ -58,18 +59,24 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
}
//TODO: Do transitions
Writer.WriteInt8(0);
Writer.WriteInt8(0);
Writer.WriteInt32(Items.Count);
foreach (var item in Items)
{
item.Write(Writer);
}
Writer.WriteInt32(Folders.Count);
foreach (var item in Folders)
{
item.Write(Writer);
}
Writer.WriteInt32(Instances.Count);
foreach (var item in Instances)
{
item.Write(Writer);
}
Events.Write(Writer);
@ -145,6 +152,8 @@ namespace DotNetCTFDumper.MMFParser.MFALoaders
//inst.Read();
Instances.Add(inst);
}
Events = new Events(Reader);
Events.Read();

Loading…
Cancel
Save