diff --git a/Wonderking/Game/Data/Item/ContainedItem.cs b/Wonderking/Game/Data/Item/ContainedItem.cs index c89e1f3..caf2a91 100644 --- a/Wonderking/Game/Data/Item/ContainedItem.cs +++ b/Wonderking/Game/Data/Item/ContainedItem.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace Wonderking.Game.Data.Item; -[StructLayout(LayoutKind.Sequential)] +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ContainedItem { public short ID { get; internal set; } diff --git a/Wonderking/Game/Data/Item/ItemOptions.cs b/Wonderking/Game/Data/Item/ItemOptions.cs index abae6ca..0cd9a93 100644 --- a/Wonderking/Game/Data/Item/ItemOptions.cs +++ b/Wonderking/Game/Data/Item/ItemOptions.cs @@ -1,9 +1,14 @@ // Licensed to Timothy Schenk under the GNU AGPL Version 3 License. +using System.Runtime.InteropServices; + namespace Wonderking.Game.Data.Item; +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ItemOptions { - public uint[] OptionIDs { get; internal set; } - public bool OptionAvailable { get; internal set; } + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + public uint[] OptionIDs; + + public bool OptionAvailable; } diff --git a/Wonderking/Game/DataReader.cs b/Wonderking/Game/DataReader.cs index 39139bc..817fb31 100644 --- a/Wonderking/Game/DataReader.cs +++ b/Wonderking/Game/DataReader.cs @@ -45,7 +45,7 @@ public abstract class DataReader throw new NotSupportedException("XorKey is null"); } - private Span GetDatFileContent(string path) + private ReadOnlySpan GetDatFileContent(string path) { var fileData = File.ReadAllBytes(path + _datFileName); var data = new byte[fileData.Length]; diff --git a/Wonderking/Game/Reader/GenericReaderExtensions.cs b/Wonderking/Game/Reader/GenericReaderExtensions.cs index b3da49a..904f7cb 100644 --- a/Wonderking/Game/Reader/GenericReaderExtensions.cs +++ b/Wonderking/Game/Reader/GenericReaderExtensions.cs @@ -1,13 +1,5 @@ // Licensed to Timothy Schenk under the GNU AGPL Version 3 License. -/* Nicht gemergte Ă„nderung aus Projekt "Wonderking(net7.0)" -Vor: -using System.Runtime.InteropServices; -using System.Text; -Nach: -using System.Text; -*/ - using System.Text; namespace Wonderking.Game.Reader; @@ -16,7 +8,7 @@ public static class GenericReaderExtensions { public static string ReadString(this BinaryReader reader, int length) { - var ret = Encoding.ASCII.GetString(reader.ReadBytes(length)).Replace("\0", ""); + var ret = Encoding.ASCII.GetString(reader.ReadBytes(length)).Replace("\0", "", StringComparison.Ordinal); return ret; } diff --git a/docker-compose.yml b/docker-compose.yml index 13459da..44925ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - Tracing:Enabled=true - OTEL_EXPORTER_OTLP_ENDPOINT=http://aspire:18889 - Logging:LogLevel:Default=Debug + - OTEL_SERVICE_NAME=continuity-auth networks: - continuity ports: