Skip to content

Commit

Permalink
Removed: Dependency on Reloaded.Memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Feb 7, 2022
1 parent 63ec096 commit 34e7616
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
1 change: 0 additions & 1 deletion Reloaded.Universal.Redirector/FileAccessServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Reloaded.Hooks.Definitions;
using Reloaded.Memory.Pointers;
using Reloaded.Universal.Redirector.Utility;
using IReloadedHooks = Reloaded.Hooks.ReloadedII.Interfaces.IReloadedHooks;

Expand Down
2 changes: 1 addition & 1 deletion Reloaded.Universal.Redirector/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Security;
using System.Text;
using Reloaded.Hooks.Definitions.Structs;
using Reloaded.Memory.Pointers;
using Reloaded.Universal.Redirector.Structures;

namespace Reloaded.Universal.Redirector
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Reloaded.Memory" Version="3.1.1" />
<PackageReference Include="Reloaded.Mod.Interfaces" Version="1.8.0" />
<PackageReference Include="Reloaded.SharedLib.Hooks" Version="1.5.0" />
</ItemGroup>
Expand Down
33 changes: 33 additions & 0 deletions Reloaded.Universal.Redirector/Structures/BlittablePointer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reloaded.Universal.Redirector.Structures
{
/// <summary>
/// Blittable single level pointer type that you can use with generic types such as <see cref="RefFixedArrayPtr{TStruct}"/> (to create array of pointers to structs).
/// Requires .NET Core 3/Standard 2.1 to make good use of.
/// Relevant issue: https://github.com/dotnet/csharplang/issues/1744
/// </summary>
public unsafe struct BlittablePointer<T> where T : unmanaged
{
/// <summary>
/// The pointer to the value.
/// </summary>
public T* Pointer { get; set; }

/// <summary>
/// Creates a blittable pointer
/// </summary>
/// <param name="pointer"></param>
public BlittablePointer(T* pointer) => Pointer = pointer;

/// <summary/>
public static implicit operator BlittablePointer<T>(T* operand) => new BlittablePointer<T>(operand);

/// <summary/>
public static implicit operator T*(BlittablePointer<T> operand) => operand.Pointer;
}
}

0 comments on commit 34e7616

Please sign in to comment.