Skip to content

Commit

Permalink
Use sequential layout for Context
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Sep 16, 2023
1 parent 8116b2c commit fdeb177
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
20 changes: 2 additions & 18 deletions GW2SDK/Features/Mumble/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,42 @@
namespace GuildWars2.Mumble;

[PublicAPI]
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
[StructLayout(LayoutKind.Sequential)]
[NoReorder]
public readonly record struct Context
{
[FieldOffset(0)]
internal readonly sockaddr_in serverAddress;

[FieldOffset(28)]
public readonly uint MapId;

[FieldOffset(32)]
public readonly uint MapType;

[FieldOffset(36)]
public readonly uint ShardId;

[FieldOffset(40)]
public readonly uint Instance;

[FieldOffset(44)]
public readonly uint BuildId;

[FieldOffset(48)]
public readonly UiState UiState;

[FieldOffset(52)]
public readonly ushort CompassWidth;

[FieldOffset(54)]
public readonly ushort CompassHeight;

[FieldOffset(56)]
public readonly float CompassRotation;

[FieldOffset(60)]
public readonly float PlayerX;

[FieldOffset(64)]
public readonly float PlayerY;

[FieldOffset(68)]
public readonly float MapCenterX;

[FieldOffset(72)]
public readonly float MapCenterY;

[FieldOffset(76)]
public readonly float MapScale;

[FieldOffset(80)]
public readonly uint ProcessId;

[FieldOffset(84)]
internal readonly byte MountIndex;

[MemberNotNullWhen(true, nameof(Mount))]
Expand Down
1 change: 1 addition & 0 deletions GW2SDK/Features/Mumble/GameTick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace GuildWars2.Mumble;

[PublicAPI]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
[NoReorder]
public readonly record struct GameTick
{
public readonly uint UiVersion;
Expand Down
2 changes: 1 addition & 1 deletion GW2SDK/Internal/Win32/sockaddr_in.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma warning disable IDE1006 // Naming Styles
namespace GuildWars2.Win32;

[StructLayout(LayoutKind.Sequential)]
[StructLayout(LayoutKind.Sequential, Size = 28)]
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
internal readonly struct sockaddr_in
{
Expand Down

0 comments on commit fdeb177

Please sign in to comment.