Skip to content

Commit

Permalink
Remove Temp DataStruct, use actual one
Browse files Browse the repository at this point in the history
  • Loading branch information
MidoriKami committed Jul 2, 2023
1 parent 8bb9326 commit f45e655
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions Mappy/Models/TempClienstructsModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,9 @@
using System.Runtime.InteropServices;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.Interop;
using FFXIVClientStructs.STD;

namespace Mappy.Models;

[StructLayout(LayoutKind.Sequential)]
public unsafe struct StdVector<T> where T : unmanaged
{
public T* First;
public T* Last;
public T* End;

public ReadOnlySpan<T> Span
{
get
{
var size = Size();
if (size >= 0x7FEFFFFF)
throw new IndexOutOfRangeException($"Size exceeds max. Array index. (Size={size})");
return new ReadOnlySpan<T>(First, (int) size);
}
}

public ulong Size()
{
if (First == null || Last == null)
return 0;

return ((ulong) Last - (ulong) First) / (ulong) sizeof(T);
}

public ulong Capacity()
{
if (End == null || First == null)
return 0;

return ((ulong) End - (ulong) First) / (ulong) sizeof(T);
}

public T Get(ulong index)
{
if (index >= Size())
throw new IndexOutOfRangeException($"Index out of Range: {index}");

return First[index];
}
}

[StructLayout(LayoutKind.Explicit)]
public unsafe partial struct ClientStructsMapData
Expand Down

0 comments on commit f45e655

Please sign in to comment.