diff --git a/BaseHandlers/TriggerData.cs b/BaseHandlers/TriggerData.cs index 4ddee9f..4bd34fe 100644 --- a/BaseHandlers/TriggerData.cs +++ b/BaseHandlers/TriggerData.cs @@ -841,15 +841,14 @@ public bool Write(BundleEntry entry) writer.Write(mpLandmarks.Count + mpGenericRegions.Count + mpBlackspots.Count + mpVFXBoxRegions.Count); writer.WriteUniquePadding(4); // padding - List TriggerRegionOffsets = new List(); - long currentPosition = writer.BaseStream.Position; writer.BaseStream.Position = LandmarkOffsetPosition; writer.Write((uint)currentPosition); writer.BaseStream.Position = currentPosition; + List landmarkOffsets = new List(); foreach (Landmark landmark in mpLandmarks) { - TriggerRegionOffsets.Add((uint)writer.BaseStream.Position); + landmarkOffsets.Add((uint)writer.BaseStream.Position); landmark.Write(writer); } writer.WritePadding(); @@ -872,7 +871,6 @@ public bool Write(BundleEntry entry) foreach (GenericRegion region in mpGenericRegions) { genericRegionOffsets.Add(region.mId, (uint)writer.BaseStream.Position); - TriggerRegionOffsets.Add((uint)writer.BaseStream.Position); region.Write(writer); } writer.WritePadding(); @@ -891,9 +889,10 @@ public bool Write(BundleEntry entry) writer.BaseStream.Position = BlackspotOffsetPosition; writer.Write((uint)currentPosition); writer.BaseStream.Position = currentPosition; + List blackspotOffsets = new List(); foreach (Blackspot blackspot in mpBlackspots) { - TriggerRegionOffsets.Add((uint)writer.BaseStream.Position); + blackspotOffsets.Add((uint)writer.BaseStream.Position); blackspot.Write(writer); } writer.WritePadding(); @@ -902,9 +901,10 @@ public bool Write(BundleEntry entry) writer.BaseStream.Position = VFXBoxRegionsOffsetPosition; writer.Write((uint)currentPosition); writer.BaseStream.Position = currentPosition; + List vfxBoxRegionOffsets = new List(); foreach (VFXBoxRegion region in mpVFXBoxRegions) { - TriggerRegionOffsets.Add((uint)writer.BaseStream.Position); + vfxBoxRegionOffsets.Add((uint)writer.BaseStream.Position); region.Write(writer); } writer.WritePadding(); @@ -947,10 +947,10 @@ public bool Write(BundleEntry entry) writer.BaseStream.Position = TriggerOffsetPosition; writer.Write((uint)currentPosition); writer.BaseStream.Position = currentPosition; - foreach (uint region in TriggerOffsets) - { - writer.Write(region); - } + foreach (uint region in vfxBoxRegionOffsets) writer.Write(region); + foreach (uint region in blackspotOffsets) writer.Write(region); + foreach (uint region in genericRegionOffsets.Values) writer.Write(region); + foreach (uint region in landmarkOffsets) writer.Write(region); currentPosition = writer.BaseStream.Position; writer.BaseStream.Position = SizePosition; diff --git a/BundleManager/EntryEditor.cs b/BundleManager/EntryEditor.cs index 05a090b..a3c6e39 100644 --- a/BundleManager/EntryEditor.cs +++ b/BundleManager/EntryEditor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.IO; @@ -88,6 +89,76 @@ private void FocusTab() } } + private delegate byte[] GetDataHex(); + private delegate void SetDataHex(byte[] hex); + private byte[] DataHex + { + get + { + if (hexData.InvokeRequired) + { + GetDataHex method = () => + { + return hexData.HexData; + }; + return (byte[])Invoke(method); + } + else + { + return hexData.HexData; + } + } + set + { + if (hexData.InvokeRequired) + { + SetDataHex method = (byte[] hex) => + { + hexData.HexData = hex; + }; + Invoke(method, value); + } + else + { + hexData.HexData = value; + } + } + } + + private byte[] ExtraDataHex + { + get + { + if (hexExtraData.InvokeRequired) + { + GetDataHex method = () => + { + return hexExtraData.HexData; + }; + return (byte[])Invoke(method); + } + else + { + return hexExtraData.HexData; + } + } + set + { + if (hexExtraData.InvokeRequired) + { + SetDataHex method = (byte[] hex) => + { + hexExtraData.HexData = hex; + }; + Invoke(method, value); + } + else + { + hexExtraData.HexData = value; + } + } + } + private delegate Image GetImage(); private delegate void SetImage(Image img); private Image Image @@ -404,6 +475,12 @@ private void UpdateDisplay() ImageMenuVisible = ImageVisible; BinaryMenuVisible = TabsVisible; + if (TabsVisible) + { + DataHex = _entry.EntryBlocks[0].Data; + ExtraDataHex = _entry.EntryBlocks[1].Data; + } + MenuVisible = true; InfoText = GetInfo(); diff --git a/LangEditor/LangEdit.cs b/LangEditor/LangEdit.cs index f228fab..58986d9 100644 --- a/LangEditor/LangEdit.cs +++ b/LangEditor/LangEdit.cs @@ -41,7 +41,7 @@ public LangEdit() public void GenerateDictionary() { dict = new Dictionary(); - StreamReader keys = new StreamReader("keys/keys.txt", Encoding.UTF8); + StreamReader keys = new StreamReader(AppContext.BaseDirectory + "keys/keys.txt", Encoding.UTF8); string key; while ((key = keys.ReadLine()) != null) {