diff --git a/CSharp/Content/UniversalEditor.Content.PlatformIndependent/Extensions/SoftwareDeveloper/Associations/ExecutableObjectModel/RelocatableObject.uexml b/CSharp/Content/UniversalEditor.Content.PlatformIndependent/Extensions/SoftwareDeveloper/Associations/ExecutableObjectModel/RelocatableObject.uexml new file mode 100644 index 00000000..40c020b3 --- /dev/null +++ b/CSharp/Content/UniversalEditor.Content.PlatformIndependent/Extensions/SoftwareDeveloper/Associations/ExecutableObjectModel/RelocatableObject.uexml @@ -0,0 +1,20 @@ + + + + + + + + *.obj + + + + + + + + + + + + \ No newline at end of file diff --git a/CSharp/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj b/CSharp/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj index 950b48da..51e45f75 100644 --- a/CSharp/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj +++ b/CSharp/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj @@ -667,6 +667,9 @@ + + + diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJDataFormat.cs new file mode 100644 index 00000000..e8139259 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJDataFormat.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UniversalEditor.IO; +using UniversalEditor.ObjectModels.Executable; + +namespace UniversalEditor.DataFormats.Executable.RelocatableObject +{ + public class OBJDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = base.MakeReferenceInternal(); + _dfr.Capabilities.Add(typeof(ExecutableObjectModel), DataFormatCapabilities.All); + } + return _dfr; + } + + protected override void LoadInternal(ref ObjectModel objectModel) + { + ExecutableObjectModel exe = (objectModel as ExecutableObjectModel); + if (exe == null) throw new ObjectModelNotSupportedException(); + + Reader reader = base.Accessor.Reader; + while (!reader.EndOfStream) + { + OBJRecordType recordType = (OBJRecordType)reader.ReadByte(); + ushort dataLength = reader.ReadUInt16(); + byte[] data = reader.ReadBytes(dataLength); + byte checksum = reader.ReadByte(); + + switch (recordType) + { + case OBJRecordType.CodeDataText0xA0: + case OBJRecordType.CodeDataText0xA1: + { + break; + } + case OBJRecordType.Comment: + { + break; + } + case OBJRecordType.CommonDataInitialized0xC2: + case OBJRecordType.CommonDataInitialized0xC3: + { + break; + } + case OBJRecordType.CommonDataUninitialized: + { + break; + } + case OBJRecordType.ExternalReference: + { + break; + } + case OBJRecordType.ExternalSymbols0x90: + case OBJRecordType.ExternalSymbols0x91: + { + break; + } + case OBJRecordType.ModuleEnd0x8A: + case OBJRecordType.ModuleEnd0x8B: + { + break; + } + case OBJRecordType.Relocation0x9C: + case OBJRecordType.Relocation0x9D: + { + break; + } + case OBJRecordType.Segment0x98: + case OBJRecordType.Segment0x99: + { + break; + } + case OBJRecordType.SegmentGroup: + { + break; + } + } + } + } + + protected override void SaveInternal(ObjectModel objectModel) + { + throw new NotImplementedException(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJRecordType.cs b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJRecordType.cs new file mode 100644 index 00000000..06fea9d8 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/RelocatableObject/OBJRecordType.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniversalEditor.DataFormats.Executable.RelocatableObject +{ + public enum OBJRecordType : byte + { + Comment = 0x88, + + ExternalReference = 0x8C, + + ExternalSymbols0x90 = 0x90, + ExternalSymbols0x91 = 0x91, + + Segment0x98 = 0x98, + Segment0x99 = 0x99, + + SegmentGroup = 0x9A, + + Relocation0x9C = 0x9C, + Relocation0x9D = 0x9D, + + CodeDataText0xA0 = 0xA0, + CodeDataText0xA1 = 0xA1, + + CommonDataUninitialized = 0xB0, + + CommonDataInitialized0xC2 = 0xC2, + CommonDataInitialized0xC3 = 0xC3, + + ModuleEnd0x8A = 0x8A, + ModuleEnd0x8B = 0x8B + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Executable/UniversalEditor.Plugins.Executable.csproj b/CSharp/Plugins/UniversalEditor.Plugins.Executable/UniversalEditor.Plugins.Executable.csproj index d1e0c3a8..a9d118c2 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Executable/UniversalEditor.Plugins.Executable.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.Executable/UniversalEditor.Plugins.Executable.csproj @@ -60,6 +60,8 @@ + +