Skip to content

Commit

Permalink
updated to libhat 0.2.0 + remove binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
phasephasephase committed Oct 6, 2024
1 parent c93c875 commit 89293b7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
5 changes: 4 additions & 1 deletion bindings/cs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -484,4 +484,7 @@ $RECYCLE.BIN/
*.swp

# JetBrains Rider
.idea/
.idea/

# libhat_c binaries should only exist locally
libhat_c.*
17 changes: 12 additions & 5 deletions bindings/cs/libhat-sharp/ScanResult.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Numerics;

namespace Hat;
namespace Hat;

/// <summary>
/// Represents the result of a pattern scan.
/// </summary>
public unsafe class ScanResult
{
/// <summary>
Expand All @@ -27,8 +28,14 @@ public T Read<T>(int offset = 0) where T : unmanaged
/// Resolves a RIP relative address located at a given offset.
/// </summary>
/// <param name="offset">The offset of the relative address.</param>
public nint Relative(int offset)
/// <param name="remaining">The amount of bytes remaining after the relative address.</param>
/// <remarks>
/// In some cases, the instruction pointed at by the result does not end with the relative address.
/// To prevent incorrect results caused by the remaining bytes, the <paramref name="remaining"/> parameter
/// should be used to specify the amount of bytes remaining in the instruction.
/// </remarks>
public nint Relative(int offset, int remaining = 0)
{
return Address + Read<int>(offset) + offset + sizeof(int);
return Address + Read<int>(offset) + offset + sizeof(int) + remaining;
}
}
17 changes: 11 additions & 6 deletions bindings/cs/libhat-sharp/libhat-sharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,36 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>0.1.2</AssemblyVersion>
<FileVersion>0.1.2.1</FileVersion>
<AssemblyVersion>0.2.0</AssemblyVersion>
<FileVersion>0.2.0.1</FileVersion>

<!-- nuget package -->
<PackageId>libhat-sharp</PackageId>
<Version>0.1.2</Version>
<Version>0.2.0</Version>
<Authors>phase</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>libhat-sharp</Title>
<Description>C# bindings for libhat, a high-performance game hacking library. Currently only includes the pattern scanner, which uses CPU vectorization features to quickly find patterns.</Description>
<Description>
C# bindings for libhat, a high-performance game hacking library.
Currently only includes the pattern scanner, which uses CPU vectorization features to quickly find patterns.
</Description>
<PackageProjectUrl>https://github.com/BasedInc/libhat</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/phasephasephase/libhat</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>libhat;vectorized;game-hacking;modding;pattern-scanning</PackageTags>
<PackageReleaseNotes>
- Updated to latest libhat release
- Added missing summary for ScanResult class
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<!-- make README available in the package -->
<None Include="../README.md" Pack="true" PackagePath="/" />

<!-- include the native libraries in the package -->
<Content Include="runtimes/win-x64/native/libhat_c.dll" Pack="true" PackagePath="runtimes/win-x64/native/" />
<Content Include="runtimes/win-x86/native/libhat_c.dll" Pack="true" PackagePath="runtimes/win-x86/native/" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When building, place your compiled libhat_c binary here.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When building, place your compiled libhat_c binary here.
Binary file not shown.

0 comments on commit 89293b7

Please sign in to comment.