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()); } } } }