-
Notifications
You must be signed in to change notification settings - Fork 3
Developer Guide
GameHaxr is still in major development and will be changing frequently. More information will be added in the future.
You may want to go over the "Functions and Properties" before continuing.
This is a guide aimed at developers that will inform you about GameHaxr functions, properties and the general concepts when developing a trainer using it. Please note that GameHaxr is a C# program, so if something can't be implemented in C#, there's not much I can do. Due to this, we utilize tools such as Cheat Engine Lua and AutoHotKey because they provide powerful functionality.
GameHaxr lets developers create powerful trainers with out of the box powerful functions such as Cheat Engine Lua, AutoHotKey, file IO, browser manipulation, and more. GameHaxr is based in a Chromium browser, so the trainer is built as a HTML page. The base language is JavaScript, however you'll probably be using other languages such as Cheat Engine Lua and AutoHotKey, for hacking.
The website is http://gamehaxr.rf.gd. If you want to ask questions, talk to the community, read announcements, etc. then the GameHaxr discord server is the perfect place.
- Need to Know/Limitations
- Examples
- Components/Languages Overview
- Using Cheat Engine Lua
- Using AutoHotKey
- Using File IO
- Using C#
- If it's not implementable in C#, I can't add it into GameHaxr.
- GameHaxr browsers, which are used for trainers, are Chromium based (CefSharp).
- The GameHaxr classes to be used in your trainer can only be set at browser initialization.
- To use Flash Player, the PPAPI version needs to be installed.
- Asynchronous functions in GameHaxr classes use a callback function.
There are currently no examples. They will be added here once they are available.
GameHaxr utilizes various components/languages:
-
C# .NET - GameHaxr and its classes, such as
lua,ahk,engineIO. - Chromium (CefSharp) - C# classes are bridged to this browser to let it be called through JavaScript. Renders the HTML.
- JavaScript - The core language for using GameHaxr.
- HTML - The interface, such as the trainers.
- Cheat Engine Lua - Used primarily for memory hacking.
- AutoHotKey - Used primarily for macros and image recognition.
Trainers are ran in a Chromium browser, so you can use a standard HTML document and JavaScript to make them.
Cheat Engine Lua and AutoHotKey are used to provide powerful hacking functionality.
Cheat Engine Lua is achieved by using a pipe client to send commands to a Cheat Engine Lua server.
The name of the Lua server must be set before doing any commands using lua.serverName = 'TheNameHere'.
The name should be unique, because if a different script is using the same Lua server name it will cause problems.
When a command is executed and the server is not running, by default it will automatically try to open the server using lua.openServer(). You can disable this if you need: lua.autoOpenServer = false.
However, it is probably more convenient to have it running before executing any commands:
function init() {
lua.serverName = 'MyLuaServer';
if (!lua.serverRunning) {
lua.openServer();
}
}Unfortunately, I cannot get Cheat Engine Lua to return any other value than integers from the pipe client.
I have made a work around by using file IO. Then it tries to parse the string into a variable that JavaScript can use.
However, there are still variable types like tables that I cannot parse into their JavaScript counterpart, so they will remain as a string variable. You can of course try make your own method to parse this, though.
AutoHotKey is achieved by using AutoHotKey.Interop.
No prior setup is required, you can use it straight away.
Simple file IO functions.
You can compile your own C# code and interact with it.
The csharp.compile(...) function returns a unique key that is used to tell GameHaxr which code object you are referring to.
Example: code.cs file:
using System.Windows.Forms;
namespace GameHaxr
{
public class Bar
{
public string SayHello()
{
MessageBox.Show("Hello world.");
return "Test string return value";
}
}
}GameHaxr JavaScript:
// Compile the code above
let myCodeKey = csharp.compile('GameHaxr.Bar', engine.fileReadText('code.cs'), ['system.windows.forms.dll']);
// Invoke the SayHello method
let invokeResult = csharp.invokeMethod(myCodeKey, SayHello);
// invokeResult: "Test string return value"