-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
38 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using BinarySerialization; | ||
|
||
namespace ME3Tweaks.Wwiser.Formats; | ||
|
||
public class V36ByteCount : IBinarySerializable | ||
{ | ||
[Ignore] | ||
public byte Value { get; set; } | ||
|
||
public void Serialize(Stream stream, Endianness endianness, BinarySerializationContext serializationContext) | ||
{ | ||
var version = serializationContext.FindAncestor<BankSerializationContext>().Version; | ||
if (version <= 36) | ||
{ | ||
stream.Write(BitConverter.GetBytes((uint)Value)); | ||
} | ||
else stream.WriteByte(Value); | ||
} | ||
|
||
public void Deserialize(Stream stream, Endianness endianness, BinarySerializationContext serializationContext) | ||
{ | ||
var version = serializationContext.FindAncestor<BankSerializationContext>().Version; | ||
if (version <= 36) | ||
{ | ||
Span<byte> span = stackalloc byte[4]; | ||
var read = stream.Read(span); | ||
if (read != 4) throw new Exception(); | ||
Value = (byte)BitConverter.ToUInt32(span); | ||
} | ||
else Value = (byte)stream.ReadByte(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
ME3Tweaks.Wwiser/Model/ParameterNode/Positioning/SpatializationMode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters