public RAMTableEntryInfo(RAMTableEntry ram) { _ram = ram; }
public override bool LoadFromBytes(byte[] bytes) { base.LoadFromBytes(bytes); if (LevelInfoOffsets == null) LevelInfoOffsets = new List<uint>(); if (LevelHeaderOffsets == null) LevelHeaderOffsets = new List<uint>(); LevelInfoOffsets.Clear(); LevelHeaderOffsets.Clear(); //Level Info Offsets - I wish I didn't have to hardcode these values' locations, but oh well byte[] offsetData; _dmaData.TakeMemory(LEVEL_INFO_OFFSETS_LOCATION, LEVEL_COUNT * sizeof(uint), out offsetData); for (int i = 0; i < LEVEL_COUNT; i++) { LevelInfoOffsets.Add(ByteHelper.ReadUInt(offsetData, i * sizeof(uint))); } _dmaData.TakeMemory(LEVEL_HEADER_OFFSETS_LOCATION, LEVEL_COUNT * sizeof(uint), out offsetData); for (int i = 0; i < LEVEL_COUNT; i++) { LevelHeaderOffsets.Add(ByteHelper.ReadUInt(offsetData, i * sizeof(uint))); } //Simple objects if (SimpleObjects == null) SimpleObjects = new List<RefSimpleLevelObject>(); SimpleObjects.Clear(); for (int i = 0; i < SIMPLE_OBJECTS_COUNT; i++) { int index = SIMPLE_OBJECTS_LOCATION + i * RefSimpleLevelObject.Size; _dmaData.TakeMemory(index, RefSimpleLevelObject.Size, out offsetData); RefSimpleLevelObject newObj = new RefSimpleLevelObject(index, offsetData); SimpleObjects.Add(newObj); } //Advanced objects if (AdvancedObjects == null) AdvancedObjects = new List<RefAdvancedLevelObject>(); AdvancedObjects.Clear(); for (int i = 0; i < ADVANCED_OBJECTS_COUNT; i++) { int index = ADVANCED_OBJECTS_LOCATION + i * RefAdvancedLevelObject.Size; _dmaData.TakeMemory(index, RefAdvancedLevelObject.Size, out offsetData); RefAdvancedLevelObject newObj = new RefAdvancedLevelObject(index, offsetData); AdvancedObjects.Add(newObj); } //RAM table if (RAMTable == null) RAMTable = new List<RAMTableEntry>(); RAMTable.Clear(); for (int i = 0; i < RAM_TABLE_COUNT; i++) { int index = RAM_TABLE_LOCATION + i * RAMTableEntry.Size; _dmaData.TakeMemory(index, RAMTableEntry.Size, out offsetData); RAMTableEntry newObj = new RAMTableEntry(index, offsetData); RAMTable.Add(newObj); } return true; }