From d248c19715277c83d09489be645bc46debfd4535 Mon Sep 17 00:00:00 2001 From: 1987kostya Date: Tue, 24 Nov 2020 23:58:25 +0600 Subject: [PATCH] Started working on events --- NetMFAPatcher/DotNetCTFDumper.csproj | 20 +++ .../MMFParser/ChunkLoaders/Events/Events.cs | 160 ++++++++++++++++++ .../ChunkLoaders/Events/EventsParts.cs | 143 ++++++++++++++++ .../Events/Parameters/AlterableValue.cs | 23 +++ .../ChunkLoaders/Events/Parameters/Colour.cs | 24 +++ .../ChunkLoaders/Events/Parameters/Create.cs | 31 ++++ .../ChunkLoaders/Events/Parameters/Every.cs | 28 +++ .../ChunkLoaders/Events/Parameters/Float.cs | 25 +++ .../Events/Parameters/GlobalValue.cs | 25 +++ .../ChunkLoaders/Events/Parameters/Int.cs | 21 +++ .../Events/Parameters/ParamObject.cs | 27 +++ .../Events/Parameters/ParameterCommon.cs | 27 +++ .../Events/Parameters/Position.cs | 44 +++++ .../ChunkLoaders/Events/Parameters/Remark.cs | 22 +++ .../ChunkLoaders/Events/Parameters/Sample.cs | 28 +++ .../ChunkLoaders/Events/Parameters/Short.cs | 25 +++ .../ChunkLoaders/Events/Parameters/Time.cs | 28 +++ .../MMFParser/ChunkLoaders/Globals.cs | 71 ++++++++ NetMFAPatcher/MMFParser/Data/ChunkList.cs | 23 ++- NetMFAPatcher/MMFParser/Data/GameData.cs | 132 +++++++++++++-- NetMFAPatcher/Utils/Decryption.cs | 2 +- NetMFAPatcher/Utils/Helper.cs | 26 ++- NetMFAPatcher/mmfparser/Constants.cs | 41 ++++- .../mmfparser/chunkloaders/AppHeader.cs | 14 +- .../mmfparser/chunkloaders/AppMenu.cs | 4 +- .../mmfparser/chunkloaders/ChunkLoader.cs | 2 +- NetMFAPatcher/mmfparser/chunkloaders/Frame.cs | 12 +- .../mmfparser/chunkloaders/FrameItems.cs | 10 +- .../mmfparser/chunkloaders/ObjectInfo.cs | 2 +- .../mmfparser/chunkloaders/banks/FontBank.cs | 4 +- .../mmfparser/chunkloaders/banks/ImageBank.cs | 4 +- .../mmfparser/chunkloaders/banks/MusicBank.cs | 2 +- .../mmfparser/chunkloaders/banks/SoundBank.cs | 3 +- .../mmfparser/mfaloaders/ChunkList.cs | 2 +- 34 files changed, 1000 insertions(+), 55 deletions(-) create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Events.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/EventsParts.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/AlterableValue.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Colour.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Create.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Every.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Float.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/GlobalValue.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Int.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParamObject.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParameterCommon.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Position.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Remark.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Sample.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Short.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Time.cs create mode 100644 NetMFAPatcher/MMFParser/ChunkLoaders/Globals.cs diff --git a/NetMFAPatcher/DotNetCTFDumper.csproj b/NetMFAPatcher/DotNetCTFDumper.csproj index b3ab08f..8d59d9c 100644 --- a/NetMFAPatcher/DotNetCTFDumper.csproj +++ b/NetMFAPatcher/DotNetCTFDumper.csproj @@ -90,6 +90,23 @@ + + + + + + + + + + + + + + + + + @@ -147,5 +164,8 @@ false + + + \ No newline at end of file diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Events.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Events.cs new file mode 100644 index 0000000..0f875a7 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Events.cs @@ -0,0 +1,160 @@ +using NetMFAPatcher.chunkloaders; +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static NetMFAPatcher.MMFParser.Data.ChunkList; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events +{ + public class Events : ChunkLoader + { + public readonly string Header = "ER>>"; + public readonly string EventCount = "ERes"; + public readonly string EventgroupData = "ERev"; + public readonly string End = "< QualifiersList = new List(); + public Quailifer[] Quailifers; + public List NumberOfConditions = new List(); + + + public Events(Chunk chunk) : base(chunk) { } + public override void Print(bool ext) + { + throw new NotImplementedException(); + } + + public override void Read() + { + while(true) + { + var identifier = reader.ReadAscii(4); + if (identifier == Header) + { + MaxObjects = reader.ReadInt16(); + MaxObjectInfo = reader.ReadInt16(); + NumberOfPlayers = reader.ReadInt16(); + for (int i = 0; i < 17; i++) + { + NumberOfConditions.Add(reader.ReadInt16()); + } + var QualifierCount = reader.ReadInt16();//should be 0, so i dont give a fuck + Quailifers = new Quailifer[QualifierCount + 1]; + for (int i = 0; i < QualifierCount; i++) + { + var NewQualifier = new Quailifer(reader); + QualifiersList.Add(NewQualifier);//fucking python types + //THIS IS NOT DONE + + } + } + else if(identifier==EventCount) + { + var size = reader.ReadInt32(); + } + else if(identifier==EventgroupData) + { + var size = reader.ReadInt32(); + var end_position = reader.Tell() + size; + while(true) + { + var eg = new EventGroup(reader); + eg.Read(); + } + } + + } + + } + } + + public class Quailifer : ChunkLoader + { + public int objectInfo; + public int type; + public Quailifer qualifier; + List Objects = new List(); + + public Quailifer(Chunk chunk) : base(chunk) { } + public Quailifer(ByteIO reader) : base(reader) { } + + public override void Print(bool ext) + { + throw new NotImplementedException(); + } + + public override void Read() + { + objectInfo = reader.ReadUInt16(); + type = reader.ReadInt16(); + qualifier = this; + + } + } + + + public class EventGroup : ChunkLoader + { + public int Flags; + public int IsRestricted; + public int restrictCPT; + public int identifier; + public int undo; + public List Conditions = new List(); + public List Actions = new List(); + + public EventGroup(Chunk chunk) : base(chunk) { } + public EventGroup(ByteIO reader) : base(reader) { } + + public override void Print(bool ext) + { + throw new NotImplementedException(); + } + + public override void Read() + { + var currentPosition = reader.Tell(); + var size = reader.ReadInt16() * -1; + var NumberOfConditions = reader.ReadByte(); + var NumberOfActions = reader.ReadByte(); + var flags = reader.ReadUInt16(); + var nop = reader.ReadInt16(); + IsRestricted = reader.ReadInt32(); + restrictCPT = reader.ReadInt32(); + for (int i = 0; i < NumberOfConditions; i++) + { + var item = new Condition(reader); + item.Read(); + Conditions.Add(item); + } + for (int i = 0; i < NumberOfActions; i++) + { + var item = new Action(reader); + item.Read(); + Actions.Add(item); + } + reader.Seek(currentPosition + size); + if(Conditions[0].items[0].loader!=null) + { + Logger.Log(Conditions[0].items[0].loader.ToString()); + Console.ReadKey(); + + } + + + } + } + + + + + + + +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/EventsParts.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/EventsParts.cs new file mode 100644 index 0000000..6067582 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/EventsParts.cs @@ -0,0 +1,143 @@ +using mmfparser; +using NetMFAPatcher.chunkloaders; +using NetMFAPatcher.MMFParser.Data; +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static NetMFAPatcher.mmfparser.Constants; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events +{ + public class Condition : DataLoader + { + public int Flags; + public int OtherFlags; + public int DefType; + public int NumberOfParameters; + public ObjectType ObjectType; + public int num; + public int ObjectInfo; + public int Identifier; + public int ObjectInfoList; + public List items = new List(); + public Condition(ByteIO reader) : base(reader) { } + public override void Print() + { + throw new NotImplementedException(); + } + + public override void Read() + { + var currentPosition = reader.Tell(); + var size = reader.ReadUInt16(); + ObjectType = (ObjectType)reader.ReadInt16(); + num = reader.ReadInt16(); + ObjectInfo = reader.ReadUInt16(); + ObjectInfoList = reader.ReadInt16(); + Flags = reader.ReadSByte(); + OtherFlags = reader.ReadSByte(); + NumberOfParameters = reader.ReadByte(); + DefType = reader.ReadByte(); + Identifier = reader.ReadInt16(); + for (int i = 0; i < NumberOfParameters; i++) + { + var item = new Parameter(reader); + item.Read(); + items.Add(item); + } + reader.Seek(currentPosition + size); + + + } + } + + public class Action : DataLoader + { + public int Flags; + public int OtherFlags; + public int DefType; + public ObjectType ObjectType; + public int num; + public int ObjectInfo; + public int ObjectInfoList; + public List items = new List(); + public Action(ByteIO reader) : base(reader) { } + public override void Print( ) + { + throw new NotImplementedException(); + } + + public override void Read() + { + var currentPosition = reader.Tell(); + var size = reader.ReadUInt16(); + ObjectType = (ObjectType)reader.ReadInt16(); + num = reader.ReadInt16(); + ObjectInfo = reader.ReadUInt16(); + ObjectInfoList = reader.ReadInt16(); + Flags = reader.ReadSByte(); + OtherFlags = reader.ReadSByte(); + var number_of_parameters=reader.ReadByte(); + DefType = reader.ReadByte(); + for (int i = 0; i < DefType; i++) + { + var item = new Parameter(reader); + item.Read(); + items.Add(item); + } + + + } + } + + public class Parameter : DataLoader + { + public int Code; + public DataLoader loader; + + public Parameter(ByteIO reader) : base(reader) { } + + public override void Print() + { + throw new NotImplementedException(); + } + + public override void Read() + { + var current_position = reader.Tell(); + var size = reader.ReadInt16(); + Code = reader.ReadInt16(); + Logger.Log(Code.ToString()); + var ActualLoader = Helper.LoadParameter(Code,reader); + if(loader!=null) + { + this.loader = ActualLoader; + } + reader.Seek(current_position+size); + + } + public object value + { + get + { + if(loader.GetType().GetField("value")!=null) + { + return loader.GetType().GetField("value").GetValue(loader); + } + else + { + return null; + } + } + } + public override string ToString() + { + if (value != null) return (string)value; + else return "UNKNOWN-PARAM"; + } + } + +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/AlterableValue.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/AlterableValue.cs new file mode 100644 index 0000000..592e71f --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/AlterableValue.cs @@ -0,0 +1,23 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class AlterableValue : Short + { + + public AlterableValue(ByteIO reader) : base(reader) { } + public override void Read() + { + base.Read(); + } + public override string ToString() + { + return $"AlterableValue{Convert.ToChar(value).ToString().ToUpper()}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Colour.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Colour.cs new file mode 100644 index 0000000..7ec5c6b --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Colour.cs @@ -0,0 +1,24 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Colour : ParameterCommon + { + public Color value; + + public Colour(ByteIO reader) : base(reader) { } + public override void Read() + { + var bytes = reader.ReadBytes(4); + value = Color.FromArgb(bytes[0], bytes[1], bytes[2]); + + } + + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Create.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Create.cs new file mode 100644 index 0000000..637051b --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Create.cs @@ -0,0 +1,31 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Create : ParameterCommon + { + public int ObjectInstances; + public int ObjectInfo; + public Position Position; + + public Create(ByteIO reader) : base(reader) { } + public override void Read() + { + Position = new Position(reader); + Position.Read(); + ObjectInstances = reader.ReadUInt16(); + ObjectInfo = reader.ReadUInt16(); + + + } + public override string ToString() + { + return $"Create obj instance:{ObjectInstances} info:{ObjectInfo} pos:({Position.ToString()})"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Every.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Every.cs new file mode 100644 index 0000000..cf01f23 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Every.cs @@ -0,0 +1,28 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Every : ParameterCommon + { + public int Delay; + public int Compteur; + + + public Every(ByteIO reader) : base(reader) { } + public override void Read() + { + Delay = reader.ReadInt32(); + Compteur = reader.ReadInt32(); + + } + public override string ToString() + { + return $"Every {Delay/1000} sec"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Float.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Float.cs new file mode 100644 index 0000000..8a6d99a --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Float.cs @@ -0,0 +1,25 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Float : ParameterCommon + { + public float value; + + public Float(ByteIO reader) : base(reader) { } + public override void Read() + { + value = reader.ReadSingle(); + + } + public override string ToString() + { + return $"{this.GetType().Name} value: {value}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/GlobalValue.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/GlobalValue.cs new file mode 100644 index 0000000..342a2b5 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/GlobalValue.cs @@ -0,0 +1,25 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class GlobalValue : Short + { + + + public GlobalValue(ByteIO reader) : base(reader) { } + public override void Read() + { + base.Read(); + } + public override string ToString() + { + if(value>26) return $"GlobalValue{value}"; + return $"GlobalValue{Convert.ToChar(value).ToString().ToUpper()}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Int.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Int.cs new file mode 100644 index 0000000..e11a432 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Int.cs @@ -0,0 +1,21 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Int : Short + { + + + public Int(ByteIO reader) : base(reader) { } + public override void Read() + { + value = (short)reader.ReadInt32(); + } + + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParamObject.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParamObject.cs new file mode 100644 index 0000000..7507b45 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParamObject.cs @@ -0,0 +1,27 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class ParamObject : ParameterCommon + { + public int ObjectInfoList; + public int ObjectInfo; + public int ObjectType; + public ParamObject(ByteIO reader) : base(reader) { } + public override void Read() + { + ObjectInfoList = reader.ReadInt16(); + ObjectInfo = reader.ReadUInt16(); + ObjectType = reader.ReadInt16(); + } + public override string ToString() + { + return $"Object {ObjectInfoList} {ObjectInfo} {ObjectType}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParameterCommon.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParameterCommon.cs new file mode 100644 index 0000000..c39a2e2 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/ParameterCommon.cs @@ -0,0 +1,27 @@ +using mmfparser; +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class ParameterCommon : DataLoader + { + + + public ParameterCommon(ByteIO reader) : base(reader) { } + public override void Print() + { + throw new NotImplementedException(); + } + + public override void Read() + { + + + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Position.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Position.cs new file mode 100644 index 0000000..9370a30 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Position.cs @@ -0,0 +1,44 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Position : ParameterCommon + { + public int ObjectInfoParent; + public int Flags; + public int X; + public int Y; + public int Slope; + public int Angle; + public float Direction; + public int TypeParent; + public int ObjectInfoList; + public int Layer; + + public Position(ByteIO reader) : base(reader) { } + public override void Read() + { + ObjectInfoParent = reader.ReadInt16(); + Flags = reader.ReadUInt16(); + X = reader.ReadInt16(); + Y = reader.ReadInt16(); + Slope = reader.ReadInt16(); + Angle = reader.ReadInt16(); + Direction = reader.ReadSingle(); + TypeParent = reader.ReadInt16(); + ObjectInfoList = reader.ReadInt16(); + Layer = reader.ReadInt16(); + + + } + public override string ToString() + { + return $"Object X:{X} Y:{Y} Angle:{Angle} Direction:{Direction} Parent:{ObjectInfoList}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Remark.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Remark.cs new file mode 100644 index 0000000..688077c --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Remark.cs @@ -0,0 +1,22 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Remark : ParameterCommon + { + + + public Remark(ByteIO reader) : base(reader) { } + public override void Read() + { + //TODO + + } + + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Sample.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Sample.cs new file mode 100644 index 0000000..5b32962 --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Sample.cs @@ -0,0 +1,28 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Sample : ParameterCommon + { + public int handle; + public string name; + public int flags; + + public Sample(ByteIO reader) : base(reader) { } + public override void Read() + { + handle = reader.ReadInt16(); + flags = reader.ReadUInt16(); + name = reader.ReadWideString(); + } + public override string ToString() + { + return $"Sample '{name}' handle: {handle}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Short.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Short.cs new file mode 100644 index 0000000..5962e3b --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Short.cs @@ -0,0 +1,25 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Short : ParameterCommon + { + public short value; + + public Short(ByteIO reader) : base(reader) { } + public override void Read() + { + value = reader.ReadInt16(); + + } + public override string ToString() + { + return $"{this.GetType().Name} value: {value}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Time.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Time.cs new file mode 100644 index 0000000..6c4ba1e --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Events/Parameters/Time.cs @@ -0,0 +1,28 @@ +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters +{ + class Time : ParameterCommon + { + public int Timer; + public int Loops; + + public Time(ByteIO reader) : base(reader) { } + public override void Read() + { + Timer = reader.ReadInt32(); + Loops = reader.ReadInt32(); + Logger.Log($"Time time: {Timer} loops: {Loops}"); + + } + public override string ToString() + { + return $"Time time: {Timer} loops: {Loops}"; + } + } +} diff --git a/NetMFAPatcher/MMFParser/ChunkLoaders/Globals.cs b/NetMFAPatcher/MMFParser/ChunkLoaders/Globals.cs new file mode 100644 index 0000000..157c7bf --- /dev/null +++ b/NetMFAPatcher/MMFParser/ChunkLoaders/Globals.cs @@ -0,0 +1,71 @@ +using NetMFAPatcher.chunkloaders; +using NetMFAPatcher.mmfparser; +using NetMFAPatcher.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static NetMFAPatcher.MMFParser.Data.ChunkList; + +namespace NetMFAPatcher.MMFParser.ChunkLoaders +{ + public class GlobalValues : ChunkLoader + { + public List items = new List(); + public GlobalValues(Chunk chunk) : base(chunk) { } + public override void Print(bool ext) + { + + } + + public override void Read() + { + var numberOfItems = reader.ReadUInt16(); + var templist = new List(); + for (int i = 0; i < numberOfItems; i++) + { + templist.Add(new ByteIO(reader.ReadBytes(4))); + } + foreach (var item in templist) + { + var globalType = reader.ReadSByte(); + float newGlobal = 0f; + if((Constants.ValueType)globalType==Constants.ValueType.Float) + { + newGlobal = item.ReadSingle(); + } + else if ((Constants.ValueType)globalType == Constants.ValueType.Int) + { + newGlobal = item.ReadInt32(); + } + else + { + throw new Exception("unknown global type"); + } + items.Add(newGlobal); + } + + + } + } + public class GlobalStrings : ChunkLoader + { + public List items = new List(); + public GlobalStrings(Chunk chunk) : base(chunk) { } + public override void Print(bool ext) + { + + } + + public override void Read() + { + var count = reader.ReadUInt32(); + for (int i = 0; i < count; i++) + { + items.Add(reader.ReadAscii()); + } + + } + } +} diff --git a/NetMFAPatcher/MMFParser/Data/ChunkList.cs b/NetMFAPatcher/MMFParser/Data/ChunkList.cs index 0a7253a..41204ed 100644 --- a/NetMFAPatcher/MMFParser/Data/ChunkList.cs +++ b/NetMFAPatcher/MMFParser/Data/ChunkList.cs @@ -1,5 +1,7 @@ using NetMFAPatcher.chunkloaders; using NetMFAPatcher.mmfparser.chunkloaders; +using NetMFAPatcher.MMFParser.ChunkLoaders; +using NetMFAPatcher.MMFParser.ChunkLoaders.Events; using NetMFAPatcher.utils; using NetMFAPatcher.Utils; using System; @@ -13,6 +15,7 @@ namespace NetMFAPatcher.MMFParser.Data { public List chunks = new List(); public bool verbose = false; + public List Frames = new List(); public void Read(ByteIO exeReader) { @@ -27,7 +30,7 @@ namespace NetMFAPatcher.MMFParser.Data { if (chunk.loader.verbose) { - chunk.loader.Print(Program.LogAll); + //chunk.loader.Print(Program.LogAll); } } if (chunk.verbose) @@ -45,6 +48,11 @@ namespace NetMFAPatcher.MMFParser.Data { chunk.BuildKey(); } + if (chunk.id == 8755) + { + Console.WriteLine("Fisting Found"); + Console.ReadKey(); + } if (chunk.id == 32639) break; //LAST chunkID @@ -227,6 +235,7 @@ namespace NetMFAPatcher.MMFParser.Data break; case 13107: loader = new Frame(chunk); + Frames.Add((Frame)loader); break; case 13108: loader = new FrameHeader(chunk); @@ -249,7 +258,15 @@ namespace NetMFAPatcher.MMFParser.Data case 8788: loader = new ObjectNames(chunk); break; - + case 8754: + loader = new GlobalValues(chunk); + break; + case 8755: + loader = new GlobalStrings(chunk); + break; + case 13117: + loader = new Events(chunk); + break; } if (loader != null) @@ -272,7 +289,7 @@ namespace NetMFAPatcher.MMFParser.Data } } } - + //Logger.Log($"ChunkLoader {typeof(T).Name} not found", true, ConsoleColor.Red); return null; //I hope this wont happen } public T get_loader(ChunkLoader loader) where T : ChunkLoader diff --git a/NetMFAPatcher/MMFParser/Data/GameData.cs b/NetMFAPatcher/MMFParser/Data/GameData.cs index ccb4310..bca9e57 100644 --- a/NetMFAPatcher/MMFParser/Data/GameData.cs +++ b/NetMFAPatcher/MMFParser/Data/GameData.cs @@ -1,5 +1,7 @@ using NetMFAPatcher.chunkloaders; using NetMFAPatcher.mmfparser; +using NetMFAPatcher.mmfparser.chunkloaders; +using NetMFAPatcher.MMFParser.ChunkLoaders; using NetMFAPatcher.Utils; using System; using System.Collections.Generic; @@ -18,41 +20,135 @@ namespace NetMFAPatcher.MMFParser.Data public int product_version; public Products build; public ChunkList gameChunks; + + public string Name; + public string Author; + public string Copyright; + public string aboutText; + public string Doc; + + public string EditorFilename; + public string TargetFilename; + + //public ExeOnly Exe_Only; + + public AppMenu Menu; + public AppIcon Icon; + + public AppHeader Header; + //public ExtentedHeader ExtHeader; + + public FontBank Fonts; + public SoundBank Sounds; + public MusicBank Music; + public ImageBank Images; + + public GlobalValues GValues; + public GlobalStrings GStrings; + public static FrameItems testItems; + + //public Extensions Ext; + + public FrameItems Frameitems; + + public List Frames = new List(); + + public void Read(ByteIO exeReader) { - string magic = exeReader.ReadAscii(4); + string magic = exeReader.ReadAscii(4); //Reading header + //Checking for header + if (magic == Constants.UNICODE_GAME_HEADER) Constants.isUnicode = true;//PAMU + else if (magic == Constants.GAME_HEADER) Constants.isUnicode = false;//PAME + else Logger.Log("Header Fucked Up", true, ConsoleColor.Red);//Header not found - if (magic == Constants.UNICODE_GAME_HEADER) Constants.isUnicode = true; - else if (magic == Constants.GAME_HEADER) Constants.isUnicode = false; - else - { - Logger.Log("Header Fucked Up", true, ConsoleColor.Red); - } - - runtime_version = exeReader.ReadUInt16(); - runtime_subversion = exeReader.ReadUInt16(); - product_version = exeReader.ReadInt32(); - product_build = exeReader.ReadInt32(); + runtime_version = exeReader.ReadUInt16(); // + runtime_subversion = exeReader.ReadUInt16(); //0 + product_version = exeReader.ReadInt32(); //CTF/MMF2/MMF1.5/CNC + product_build = exeReader.ReadInt32(); //CTF Build build = (Products)runtime_version; - - Print(); - Logger.Log("Press any key to continue",true,ConsoleColor.Magenta); + //Print(); + //Logger.Log("Press any key to continue", true, ConsoleColor.Magenta); //Console.ReadKey(); + - gameChunks = new ChunkList(); + gameChunks = new ChunkList(); //Reading game chunks gameChunks.Read(exeReader); + //Load chunks into gamedata for easier access + if (gameChunks.get_chunk() != null) Name = gameChunks.get_chunk().value; + if (gameChunks.get_chunk() != null) Copyright = gameChunks.get_chunk().value; + if(gameChunks.get_chunk()!=null) Author = gameChunks.get_chunk().value; + if (gameChunks.get_chunk() != null) EditorFilename = gameChunks.get_chunk().value; + if (gameChunks.get_chunk() != null) TargetFilename = gameChunks.get_chunk().value; + if (gameChunks.get_chunk() != null) Menu = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Header = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Sounds = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Music = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Fonts = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Images = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Icon = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) GStrings = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) GValues = gameChunks.get_chunk(); + if (gameChunks.get_chunk() != null) Frameitems = gameChunks.get_chunk(); + Frames = gameChunks.Frames; + + Print(); } public void Print() { - Logger.Log("GameData Info:", true, ConsoleColor.DarkGreen); + Logger.Log($"GameData Info:", true, ConsoleColor.DarkGreen); Logger.Log($" Runtime Version: {runtime_version}", true, ConsoleColor.DarkGreen); Logger.Log($" Runtime Subversion: { runtime_subversion}", true, ConsoleColor.DarkGreen); - Logger.Log($" Product Version: { product_version}", true, ConsoleColor.DarkGreen); + Logger.Log($" Product Version: { ((Products)product_version).ToString()}", true, ConsoleColor.DarkGreen); Logger.Log($" Product Build: {product_build}", true, ConsoleColor.DarkGreen); Logger.Log($" {(isUnicode ? "Unicode" : "NonUnicode")} Game", true, ConsoleColor.DarkGreen); + Logger.Log($"Game Info:", true, ConsoleColor.Cyan); + Logger.Log($" Name:{Name}", true, ConsoleColor.Cyan); + Logger.Log($" Author:{Author}", true, ConsoleColor.Cyan); + Logger.Log($" Copyright:{Copyright}", true, ConsoleColor.Cyan); + Logger.Log($" Editor Filename:{EditorFilename}", true, ConsoleColor.Cyan); + Logger.Log($" Target Filename:{TargetFilename}", true, ConsoleColor.Cyan); + Logger.Log($" Screen Resolution: {Header.windowWidth}x{Header.windowHeight}", true, ConsoleColor.Cyan); + + Logger.Log($" Frame Count:{Header.numberOfFrames}", true, ConsoleColor.Cyan); + if (GStrings != null && GStrings.items.Count > 0) + { + + + Logger.Log($" Global Strings:", true, ConsoleColor.Cyan); + foreach (var item in GStrings.items) + { + Logger.Log($" {item}"); + } + } + if (GValues != null && GValues.items.Count > 0) + { + + + Logger.Log($" Global Values:", true, ConsoleColor.Cyan); + foreach (var item in GValues.items) + { + Logger.Log($" {item.ToString()}"); + } + } + if(Frames!=null&&Frames.Count>0) + { + Logger.Log("Frames: ", true, ConsoleColor.Cyan); + foreach (var item in Frames) + { + Logger.Log($" Frame: {item.name}, Size: {item.width}x{item.height}, Number of objects: {item.CountOfObjs}", true, ConsoleColor.Cyan); + } + + + } + + + + + } diff --git a/NetMFAPatcher/Utils/Decryption.cs b/NetMFAPatcher/Utils/Decryption.cs index c147269..1f08334 100644 --- a/NetMFAPatcher/Utils/Decryption.cs +++ b/NetMFAPatcher/Utils/Decryption.cs @@ -39,7 +39,7 @@ namespace NetMFAPatcher.utils Marshal.FreeHGlobal(copyright); Marshal.FreeHGlobal(pathfilename); key = Key; - //key.Log(true, "X2"); + key.Log(true, "X2"); diff --git a/NetMFAPatcher/Utils/Helper.cs b/NetMFAPatcher/Utils/Helper.cs index e2d7930..fb10bdd 100644 --- a/NetMFAPatcher/Utils/Helper.cs +++ b/NetMFAPatcher/Utils/Helper.cs @@ -1,4 +1,8 @@ -using NetMFAPatcher.chunkloaders; +using mmfparser; +using NetMFAPatcher.chunkloaders; +using NetMFAPatcher.mmfparser.mfaloaders; +using NetMFAPatcher.MMFParser.ChunkLoaders.Events.Parameters; +using NetMFAPatcher.Utils; using System; using System.Collections.Generic; using System.Linq; @@ -51,6 +55,26 @@ namespace NetMFAPatcher return Temp; + } + public static DataLoader LoadParameter(int code, ByteIO reader) + { + DataLoader item = null; + if(code==13) + { + item = new Every(reader); + + } + if (code == 2) + { + item = new Time(reader); + + } + if(item!=null) item.Read(); + + return item; + + + } diff --git a/NetMFAPatcher/mmfparser/Constants.cs b/NetMFAPatcher/mmfparser/Constants.cs index 6d43ebb..ec581f4 100644 --- a/NetMFAPatcher/mmfparser/Constants.cs +++ b/NetMFAPatcher/mmfparser/Constants.cs @@ -13,10 +13,43 @@ namespace NetMFAPatcher.mmfparser public static bool isUnicode; public enum Products { - MMF1, - MMF15, - MMF2, - CNC1 + MMF1=1, + MMF15=2, + MMF2=3, + CNC1=0 + + } + public enum ValueType + { + Long=0, + Int=0, + String=1, + Float=2, + Double=2 + } + public enum ObjectType + { + Player=-7, + Keyboard=-6, + Create=-5, + Timer=-4, + Game=-3, + Speaker=-2, + System=-1, + QuickBackdrop=0, + Backdrop=1, + Active=2, + Text=3, + Question=4, + Score=5, + Lives = 6, + Counter=7, + RTF=8, + SubApplication=9, + INI=33, + IniPp=32, + File=34, + TextEntry=35 } public enum ChunkNames diff --git a/NetMFAPatcher/mmfparser/chunkloaders/AppHeader.cs b/NetMFAPatcher/mmfparser/chunkloaders/AppHeader.cs index e668787..35997ae 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/AppHeader.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/AppHeader.cs @@ -10,13 +10,13 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.chunkloaders { - class AppHeader : ChunkLoader + public class AppHeader : ChunkLoader { - int size; - int windowWidth; - int windowHeight; - int initialScore; - int initialLives; + public int size; + public int windowWidth; + public int windowHeight; + public int initialScore; + public int initialLives; public int numberOfFrames; @@ -34,7 +34,7 @@ namespace NetMFAPatcher.chunkloaders initialLives = (int) (reader.ReadUInt32() ^ 0xffffffff); var controls = new Controls(reader); controls.Read(); - controls.Print(false); + // controls.Print(false); var borderColor = reader.ReadBytes(4); numberOfFrames = reader.ReadInt32(); diff --git a/NetMFAPatcher/mmfparser/chunkloaders/AppMenu.cs b/NetMFAPatcher/mmfparser/chunkloaders/AppMenu.cs index 914f9c5..b788dd9 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/AppMenu.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/AppMenu.cs @@ -10,7 +10,7 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.mmfparser.chunkloaders { - class AppMenu : ChunkLoader + public class AppMenu : ChunkLoader { public List items = new List(); public AppMenu(ByteIO reader) : base(reader) @@ -78,7 +78,7 @@ namespace NetMFAPatcher.mmfparser.chunkloaders } } - class AppMenuItem : ChunkLoader + public class AppMenuItem : ChunkLoader { public string name = ""; public int flags = 0; diff --git a/NetMFAPatcher/mmfparser/chunkloaders/ChunkLoader.cs b/NetMFAPatcher/mmfparser/chunkloaders/ChunkLoader.cs index 31cca94..fa72d9e 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/ChunkLoader.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/ChunkLoader.cs @@ -13,7 +13,7 @@ namespace NetMFAPatcher.chunkloaders { public Chunk chunk; public ByteIO reader; - public bool verbose = true; + public bool verbose = false; protected ChunkLoader(ByteIO reader) { diff --git a/NetMFAPatcher/mmfparser/chunkloaders/Frame.cs b/NetMFAPatcher/mmfparser/chunkloaders/Frame.cs index 507f7bc..f0d902e 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/Frame.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/Frame.cs @@ -66,12 +66,12 @@ namespace NetMFAPatcher.chunkloaders chunks.Read(FrameReader); var name = chunks.get_chunk(); - if (name != null) + if (name != null) //Just to be sure { this.name = name.value; } var password = chunks.get_chunk(); - if (password != null) + if (password != null) //Just to be sure { this.password = password.value; } @@ -83,8 +83,7 @@ namespace NetMFAPatcher.chunkloaders var objects = chunks.get_chunk(); if(objects!=null) { - CountOfObjs = objects.CountOfObjects; - + CountOfObjs = objects.CountOfObjects; } @@ -147,7 +146,7 @@ namespace NetMFAPatcher.chunkloaders class ObjectInstances : ChunkLoader { - public int CountOfObjects; + public int CountOfObjects=0; public List items = new List(); public ObjectInstances(ByteIO reader) : base(reader) @@ -165,8 +164,9 @@ namespace NetMFAPatcher.chunkloaders public override void Read() { - return; + CountOfObjects = (int)reader.ReadUInt32(); + return; for (int i = 0; i < CountOfObjects; i++) { var item = new ObjectInstances(reader); diff --git a/NetMFAPatcher/mmfparser/chunkloaders/FrameItems.cs b/NetMFAPatcher/mmfparser/chunkloaders/FrameItems.cs index d328ee2..95395f5 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/FrameItems.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/FrameItems.cs @@ -1,4 +1,5 @@ using NetMFAPatcher.chunkloaders; +using NetMFAPatcher.MMFParser.Data; using NetMFAPatcher.Utils; using System; using System.Collections.Generic; @@ -9,9 +10,9 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.mmfparser.chunkloaders { - class FrameItems : ChunkLoader + public class FrameItems : ChunkLoader { - public Dictionary itemDict = new Dictionary(); + public Dictionary ItemDict = new Dictionary(); public List names = new List(); public FrameItems(Chunk chunk) : base(chunk) { } public FrameItems(ByteIO reader) : base(reader) { } @@ -30,10 +31,11 @@ namespace NetMFAPatcher.mmfparser.chunkloaders var item = new ObjectInfo(reader); item.verbose = false; item.Read(); - itemDict.Add(item.handle, item); + ItemDict.Add(item.handle, item); names.Add(item.name); - Logger.Log($"Found FrameItem: '{item.name}' with handle ({item.handle})", true, ConsoleColor.Magenta); + //Logger.Log($"Found FrameItem: '{item.name}' with handle ({item.handle})", true, ConsoleColor.Magenta); } + GameData.testItems = this; } } diff --git a/NetMFAPatcher/mmfparser/chunkloaders/ObjectInfo.cs b/NetMFAPatcher/mmfparser/chunkloaders/ObjectInfo.cs index 3582cc7..3e7cad6 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/ObjectInfo.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/ObjectInfo.cs @@ -7,7 +7,7 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.mmfparser.chunkloaders { - class ObjectInfo : ChunkLoader + public class ObjectInfo : ChunkLoader { public List chunks = new List(); public int properties = 0; diff --git a/NetMFAPatcher/mmfparser/chunkloaders/banks/FontBank.cs b/NetMFAPatcher/mmfparser/chunkloaders/banks/FontBank.cs index 0fb9acf..055db7e 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/banks/FontBank.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/banks/FontBank.cs @@ -10,9 +10,9 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.chunkloaders { - class FontBank : ChunkLoader + public class FontBank : ChunkLoader { - int numberOfItems; + public int numberOfItems; public override void Print(bool ext) { Logger.Log($"FontCount:{numberOfItems.ToString()}"); diff --git a/NetMFAPatcher/mmfparser/chunkloaders/banks/ImageBank.cs b/NetMFAPatcher/mmfparser/chunkloaders/banks/ImageBank.cs index bdc1b0f..a84827d 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/banks/ImageBank.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/banks/ImageBank.cs @@ -14,7 +14,7 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.chunkloaders { - class ImageBank : ChunkLoader + public class ImageBank : ChunkLoader { Dictionary images = new Dictionary(); public ImageBank(ByteIO reader) : base(reader) @@ -51,7 +51,7 @@ namespace NetMFAPatcher.chunkloaders } } - class ImageItem : ChunkLoader + public class ImageItem : ChunkLoader { public int handle; diff --git a/NetMFAPatcher/mmfparser/chunkloaders/banks/MusicBank.cs b/NetMFAPatcher/mmfparser/chunkloaders/banks/MusicBank.cs index 783e77d..71e39a8 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/banks/MusicBank.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/banks/MusicBank.cs @@ -10,7 +10,7 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.chunkloaders { - class MusicBank : ChunkLoader + public class MusicBank : ChunkLoader { public int num_of_items = 0; public int references = 0; diff --git a/NetMFAPatcher/mmfparser/chunkloaders/banks/SoundBank.cs b/NetMFAPatcher/mmfparser/chunkloaders/banks/SoundBank.cs index 4c2242d..2c4c0b0 100644 --- a/NetMFAPatcher/mmfparser/chunkloaders/banks/SoundBank.cs +++ b/NetMFAPatcher/mmfparser/chunkloaders/banks/SoundBank.cs @@ -10,7 +10,7 @@ using static NetMFAPatcher.MMFParser.Data.ChunkList; namespace NetMFAPatcher.chunkloaders { - class SoundBank : ChunkLoader + public class SoundBank : ChunkLoader { public int num_of_items = 0; public int references = 0; @@ -26,6 +26,7 @@ namespace NetMFAPatcher.chunkloaders //Implementing for standalone-only because of my lazyness items = new List(); num_of_items = reader.ReadInt32(); + return; for (int i = 0; i < num_of_items; i++) { var item = new SoundItem(reader); diff --git a/NetMFAPatcher/mmfparser/mfaloaders/ChunkList.cs b/NetMFAPatcher/mmfparser/mfaloaders/ChunkList.cs index ca7abaf..e0db09c 100644 --- a/NetMFAPatcher/mmfparser/mfaloaders/ChunkList.cs +++ b/NetMFAPatcher/mmfparser/mfaloaders/ChunkList.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace NetMFAPatcher.mmfparser.mfaloaders { - class ChunkList : DataLoader + class ChunkList : DataLoader//This is used for MFA reading/writing { List items = new List(); public override void Print()