Skip to content

Commit

Permalink
Move over various TERA.exe interop definitions from TERA Arise.
Browse files Browse the repository at this point in the history
Closes #86.
  • Loading branch information
alexrp committed Dec 11, 2023
1 parent 0192676 commit fdb3ee2
Show file tree
Hide file tree
Showing 37 changed files with 1,242 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/interop/.globalconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
global_level = 2

dotnet_diagnostic.CA1008.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1711.severity = none
dotnet_diagnostic.CA1815.severity = none
Expand Down
120 changes: 120 additions & 0 deletions src/interop/FArchive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using Vezel.Novadrop.Interop.Support;
using Vezel.Novadrop.Interop.System;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8c)]
public unsafe struct FArchive
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public delegate* unmanaged<FArchive*, uint, FArchive*> __vdtor;

public delegate* unmanaged<FArchive*, void*, int> Serialize;

public delegate* unmanaged<FArchive*, void*, int> SerializeBits;

public delegate* unmanaged<FArchive*, uint*, uint> SerializeInt;

public void* __slot4;

public delegate* unmanaged<FArchive*, ulong, ulong> CountBytes;

public void* __slot6;

public void* __slot7;

public void* __slot8;

public void* __slot9;

public delegate* unmanaged<FArchive*, int> Tell;

public delegate* unmanaged<FArchive*, int> TotalSize;

public delegate* unmanaged<FArchive*, BOOL> AtEnd;

public delegate* unmanaged<FArchive*, int, void> Seek;

public void* __slot14;

public void* __slot15;

public void* __slot16;

public void* __slot17;

public void* __slot18;

public void* __slot19;

public delegate* unmanaged<FArchive*, void> Flush;

public delegate* unmanaged<FArchive*, BOOL> Close;

public delegate* unmanaged<FArchive*, BOOL> GetError;

public void* __slot23;

public void* __slot24;

public void* __slot25;

public void* __slot26;

public void* __slot27;

public void* __slot28;

public void* __slot29;
}

public static delegate* unmanaged<FArchive*, FArchive*> __ctor { get; } =
(delegate* unmanaged<FArchive*, FArchive*>)Tera.Resolve(0x7ff69a843f10);

public static delegate* unmanaged<FArchive*, uint, FArchive*> __vdtor { get; } =
(delegate* unmanaged<FArchive*, uint, FArchive*>)Tera.Resolve(0x7ff69a845fe0);

public static delegate* unmanaged<FArchive*, BOOL> AtEnd { get; } =
(delegate* unmanaged<FArchive*, BOOL>)Tera.Resolve(0x7ff69a846ac0);

public static delegate* unmanaged<FArchive*, void*, int, FArchive*> ByteOrderSerialize { get; } =
(delegate* unmanaged<FArchive*, void*, int, FArchive*>)Tera.Resolve(0x7ff69a846b10);

public static delegate* unmanaged<FArchive*, BOOL> Close { get; } =
(delegate* unmanaged<FArchive*, BOOL>)Tera.Resolve(0x7ff69a846ba0);

public static delegate* unmanaged<FArchive*, BOOL> GetError { get; } =
(delegate* unmanaged<FArchive*, BOOL>)Tera.Resolve(0x7ff69a8488f0);

public static delegate* unmanaged<FArchive*, void*, int, void> SerializeBits { get; } =
(delegate* unmanaged<FArchive*, void*, int, void>)Tera.Resolve(0x7ff69a84bf20);

public static delegate* unmanaged<FArchive*, uint*, uint, void> SerializeInt { get; } =
(delegate* unmanaged<FArchive*, uint*, uint, void>)Tera.Resolve(0x7ff69a84bf90);

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;

[FieldOffset(0xc)]
public int package_version;

[FieldOffset(0x10)]
public int network_version;

[FieldOffset(0x14)]
public int licensee_version;

[FieldOffset(0x18)]
public BOOL is_reader;

[FieldOffset(0x2c)]
public BOOL is_persistent;

[FieldOffset(0x3c)]
public BOOL has_errors;

[FieldOffset(0x50)]
public BOOL force_order_swap;
}
56 changes: 56 additions & 0 deletions src/interop/FBufferReader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Vezel.Novadrop.Interop.Support;
using Vezel.Novadrop.Interop.System;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0xa0)]
public unsafe struct FBufferReader
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public FArchive.VirtualFunctionTable FArchive;
}

public static delegate* unmanaged<FBufferReader*, void*, int, BOOL, BOOL, FBufferReader*> __ctor { get; } =
(delegate* unmanaged<FBufferReader*, void*, int, BOOL, BOOL, FBufferReader*>)Tera.Resolve(0x7ff69a852b50);

public static delegate* unmanaged<FBufferReader*, void> __dtor { get; } =
(delegate* unmanaged<FBufferReader*, void>)Tera.Resolve(0x7ff69a854b20);

public static delegate* unmanaged<FBufferReader*, FBufferReader*> __vdtor { get; } =
(delegate* unmanaged<FBufferReader*, FBufferReader*>)Tera.Resolve(0x7ff69a8582e0);

public static delegate* unmanaged<FBufferReader*, BOOL> AtEnd { get; } =
(delegate* unmanaged<FBufferReader*, BOOL>)Tera.Resolve(0x7ff69a85be40);

public static delegate* unmanaged<FBufferReader*, BOOL> Close { get; } =
(delegate* unmanaged<FBufferReader*, BOOL>)Tera.Resolve(0x7ff69a85bfc0);

public static delegate* unmanaged<FBufferReader*, int, void> Seek { get; } =
(delegate* unmanaged<FBufferReader*, int, void>)Tera.Resolve(0x7ff69a879ef0);

public static delegate* unmanaged<FBufferReader*, void*, int, void> Serialize { get; } =
(delegate* unmanaged<FBufferReader*, void*, int, void>)Tera.Resolve(0x7ff69a87a370);

public static delegate* unmanaged<FBufferReader*, int> Tell { get; } =
(delegate* unmanaged<FBufferReader*, int>)Tera.Resolve(0x7ff69a87faf0);

[FieldOffset(0x0)]
public FArchive FArchive;

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;

[FieldOffset(0x8c)]
public void* data;

[FieldOffset(0x94)]
public int position;

[FieldOffset(0x98)]
public int size;

[FieldOffset(0x9c)]
public BOOL free_on_close;
}
11 changes: 11 additions & 0 deletions src/interop/FName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8)]
public unsafe struct FName
{
[FieldOffset(0x0)]
public int name_index;

[FieldOffset(0x4)]
public int number;
}
16 changes: 16 additions & 0 deletions src/interop/FString.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Vezel.Novadrop.Interop.Support;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x14)]
public unsafe struct FString
{
public static delegate* unmanaged<FString*, char*, FString*> __ctor { get; } =
(delegate* unmanaged<FString*, char*, FString*>)Tera.Resolve(0x7ff69a844310);

public static delegate* unmanaged<FString*, FString*, FString*> __ctor2 { get; } =
(delegate* unmanaged<FString*, FString*, FString*>)Tera.Resolve(0x7ff69a844140);

[FieldOffset(0x0)]
public TArray<char> TArray_char;
}
22 changes: 22 additions & 0 deletions src/interop/ILauncherEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Vezel.Novadrop.Interop.System;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8)]
public unsafe struct ILauncherEvent
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public delegate* unmanaged<ILauncherEvent*, BOOL, S1ServerList*, void> OnServerList;

public delegate* unmanaged<ILauncherEvent*, byte*, void> OnCreateRoom;

public delegate* unmanaged<ILauncherEvent*, BOOL, void> OnJoinRoom;

public delegate* unmanaged<ILauncherEvent*, BOOL, void> OnLeaveRoom;
}

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;
}
24 changes: 24 additions & 0 deletions src/interop/IS1ConnectionEventHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Vezel.Novadrop.Interop.Support;
using Vezel.Novadrop.Interop.System;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8)]
public unsafe struct IS1ConnectionEventHandler
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public delegate* unmanaged<IS1ConnectionEventHandler*, BOOL, void> OnConnect;

public delegate* unmanaged<IS1ConnectionEventHandler*, void> OnDisconnect;

public delegate* unmanaged<IS1ConnectionEventHandler*, byte*, int, void> OnReceive;
}

public static delegate* unmanaged<IS1ConnectionEventHandler*, byte*, int, void> OnReceive { get; } =
(delegate* unmanaged<IS1ConnectionEventHandler*, byte*, int, void>)Tera.Resolve(0x7ff69b9c1ce0);

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;
}
23 changes: 23 additions & 0 deletions src/interop/IS1ConnectionInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8)]
public unsafe struct IS1ConnectionInfo
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public IS1MemoryObject.VirtualFunctionTable IS1MemoryObject;

public void* __slot2;

public void* __slot3;

public delegate* unmanaged<IS1ConnectionInfo*, S1ClientSocket*> CreateSocket;
}

[FieldOffset(0x0)]
public IS1MemoryObject IS1MemoryObject;

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;
}
21 changes: 21 additions & 0 deletions src/interop/IS1MemoryObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Vezel.Novadrop.Interop.Support;

namespace Vezel.Novadrop.Interop;

[StructLayout(LayoutKind.Explicit, Size = 0x8)]
public unsafe struct IS1MemoryObject
{
[StructLayout(LayoutKind.Sequential)]
public struct VirtualFunctionTable
{
public delegate* unmanaged<IS1MemoryObject*, uint, IS1MemoryObject*> __vdtor;

public delegate* unmanaged<IS1MemoryObject*, int> GetSize;
}

public static delegate* unmanaged<IS1MemoryObject*, uint, IS1MemoryObject*> __vdtor { get; } =
(delegate* unmanaged<IS1MemoryObject*, uint, IS1MemoryObject*>)Tera.Resolve(0x7ff69b4579e0);

[FieldOffset(0x0)]
public VirtualFunctionTable* VFT;
}
21 changes: 21 additions & 0 deletions src/interop/S1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Vezel.Novadrop.Interop.Support;

namespace Vezel.Novadrop.Interop;

public static unsafe class S1
{
public static ref S1Context* Context => ref *(S1Context**)Tera.Resolve(0x7ff69d7b2040);

public static ref S1LauncherProxy* LauncherProxy => ref *(S1LauncherProxy**)Tera.Resolve(0x7ff69d87de00);

public static ref S1ServerDataEvent ServerDataEvent => ref *(S1ServerDataEvent*)Tera.Resolve(0x7ff69d4f6840);

public static delegate* unmanaged<uint, uint, void*> appMalloc { get; } =
(delegate* unmanaged<uint, uint, void*>)Tera.Resolve(0x7ff69a8977d0);

public static delegate* unmanaged<void*, uint, uint, void*> appRealloc { get; } =
(delegate* unmanaged<void*, uint, uint, void*>)Tera.Resolve(0x7ff69a897870);

public static delegate* unmanaged<void*, void> appFree { get; } =
(delegate* unmanaged<void*, void>)Tera.Resolve(0x7ff69a897750);
}
Loading

0 comments on commit fdb3ee2

Please sign in to comment.