diff --git a/LSLib/LS/Save/SavegameHelpers.cs b/LSLib/LS/Save/SavegameHelpers.cs index 3046c9b4..de7e0a3b 100644 --- a/LSLib/LS/Save/SavegameHelpers.cs +++ b/LSLib/LS/Save/SavegameHelpers.cs @@ -74,7 +74,7 @@ public byte[] ResaveStoryToGlobals(Story.Story story, ResourceConversionParamete var rsrcWriter = new LSFWriter(rewrittenStream) { Version = conversionParams.LSF, - EncodeSiblingData = false + MetadataFormat = LSFMetadataFormat.None }; rsrcWriter.Write(globals); rewrittenStream.Seek(0, SeekOrigin.Begin); @@ -105,10 +105,10 @@ public void ResaveStory(Story.Story story, Game game, string path) foreach (var file in Package.Files.Where(x => x.Name.ToLowerInvariant() != "globals.lsf")) { using var stream = file.CreateContentReader(); - var contents = new byte[stream.Length]; - stream.ReadExactly(contents, 0, contents.Length); + using var unpacked = new MemoryStream(); + stream.CopyTo(unpacked); - build.Files.Add(PackageBuildInputFile.CreateFromBlob(contents, file.Name)); + build.Files.Add(PackageBuildInputFile.CreateFromBlob(unpacked.ToArray(), file.Name)); } } else @@ -124,10 +124,10 @@ public void ResaveStory(Story.Story story, Game game, string path) foreach (var file in Package.Files.Where(x => x.Name.ToLowerInvariant() != "StorySave.bin")) { using var stream = file.CreateContentReader(); - var contents = new byte[stream.Length]; - stream.ReadExactly(contents, 0, contents.Length); + using var unpacked = new MemoryStream(); + stream.CopyTo(unpacked); - build.Files.Add(PackageBuildInputFile.CreateFromBlob(contents, file.Name)); + build.Files.Add(PackageBuildInputFile.CreateFromBlob(unpacked.ToArray(), file.Name)); } } diff --git a/LSLib/LS/Story/Compiler/StoryEmitter.cs b/LSLib/LS/Story/Compiler/StoryEmitter.cs index a404da7c..ce7123de 100644 --- a/LSLib/LS/Story/Compiler/StoryEmitter.cs +++ b/LSLib/LS/Story/Compiler/StoryEmitter.cs @@ -389,8 +389,7 @@ private DatabaseNode EmitDatabase(FunctionSignature signature) { Types = new List(signature.Params.Count) }, - OwnerNode = null, - FactsPosition = 0 + OwnerNode = null }; foreach (var param in signature.Params) @@ -457,8 +456,7 @@ private Database EmitIntermediateDatabase(IRRule rule, int tupleSize, Node owner { Types = paramTypes }, - OwnerNode = ownerNode, - FactsPosition = 0 + OwnerNode = ownerNode }; osiDb.Facts = new FactCollection(osiDb, Story); diff --git a/LSLib/LS/Story/Database.cs b/LSLib/LS/Story/Database.cs index b23ce7f0..71859882 100644 --- a/LSLib/LS/Story/Database.cs +++ b/LSLib/LS/Story/Database.cs @@ -195,7 +195,6 @@ public class Database : OsirisSerializable public ParameterList Parameters; public FactCollection Facts; public Node OwnerNode; - public long FactsPosition; public void Read(OsiReader reader) { @@ -203,7 +202,6 @@ public void Read(OsiReader reader) Parameters = new ParameterList(); Parameters.Read(reader); - FactsPosition = reader.BaseStream.Position; Facts = new FactCollection(this, reader.Story); reader.ReadList(Facts); } @@ -229,7 +227,6 @@ public void DebugDump(TextWriter writer, Story story) writer.Write("(Not owned)"); } - writer.Write(" @ {0:X}: ", FactsPosition); Parameters.DebugDump(writer, story); writer.WriteLine("");