Home

Awesome

🔧 Ratchet

A game client hooking framework to aid debugging by embedding the .Net Core run time into the target. In this case Firefall, to all debugging and extensions written with the full power of .Net Core and C#

Can use either the C++ layer or the C# layer

Features

// Define the hook
int HelpHook(int A1);
static Hooks::FuncDef Help("Help", 0x1248160, &HelpHook);

// Install it with
Hooks::InstallHook(Help);

// Uninstall it with
Hooks::UninstallHook(Help);

// Handle when the hooked function is called
int HelpHook(int A1)
{
	printf("Console help function :>\n");
	auto ret = Help.Trampoline(A1); // Call the original function
	return ret;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int ReloadUIDelegate(int A1);

public static ReloadUIDelegate ReloadUICB;

[Hook(0x7E39D0, typeof(ReloadUIDelegate))]
public static int ReloadUI(int A1)
{
    Logger.Info($"OnRelaodUI A1: {A1}");
    return ReloadUICB(A1); ;
}

(Hoping to simplify that more too)

// Binding to a c# defined function
typedef void(*VoidFunc)();
BenchmarkTest2 = (VoidFunc)CreateRatchetDelegate("InterOpbenchmark2",		"RatchetSharp.TestLab");
BenchmarkTest2();

C#

namespace RatchetSharp
{
  public class TestLab
  {
    public static void InterOpbenchmark2() // Some simple math
    {

    }
  }
}

Binding a c++ function in C#

ExposeFunction("Log", (unsigned int)&Log);

void Log(int Level, char* Msg)
{

}

C# side

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        public delegate void LogCBDelegate([MarshalAs(UnmanagedType.I4)] int Level, [MarshalAs(UnmanagedType.LPStr)] string Msg);

[NativeBinding("Log", typeof(LogCBDelegate))]
public static LogCBDelegate LogCB;

LogCB(1, ":>"); // call it

Building

Future goals

Libraries / other projects used

This tool was created for educational purposes only and should not be used by anyone.