https://github.com/jones-hm/gtlibcpp
GTLIbCpp is library to make game trainer in C++ it provide all the necessary methods to make simple game trainer with Cheat-Engine support
https://github.com/jones-hm/gtlibcpp
cheat-engine cheat-engine-tables game-development game-hacking game-modding game-trainer game-trainer-lib windows-api
Last synced: 9 months ago
JSON representation
GTLIbCpp is library to make game trainer in C++ it provide all the necessary methods to make simple game trainer with Cheat-Engine support
- Host: GitHub
- URL: https://github.com/jones-hm/gtlibcpp
- Owner: Jones-HM
- License: mit
- Created: 2023-04-13T05:27:24.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-25T22:58:50.000Z (over 2 years ago)
- Last Synced: 2025-04-10T08:59:51.700Z (9 months ago)
- Topics: cheat-engine, cheat-engine-tables, game-development, game-hacking, game-modding, game-trainer, game-trainer-lib, windows-api
- Language: C++
- Homepage:
- Size: 6.07 MB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# GTLibCpp - Game Trainer Library
GTLibc is a library designed to facilitate the creation of game trainers in C++ with **latest C++17 features**.
It offers a comprehensive set of methods that enable developers to develop simple game trainers for the Windows operating system using the Win32 API with ease.
**Notably**, GTLibc exclusively employs Win32 API methods and eschews CRT methods as its primary aim is to operate exclusively on Windows systems and not to be portable to other operating systems such as _Linux or Mac OS_.
It provides all the requisite methods necessary for game trainer development from the inception of the project to its completion.
It streamlines the development process, making it _less cumbersome for developers_.
## ONLINE_USAGE
This library is intended to be used only for **offline** games. You agree not to use the Library for any online games.
for more information, see [ONLINE_USAGE.md](ONLINE_USAGE.md)
## Demo and Usages
- Generic Trainer - **[GTLibc-Generator]** used to generate the trainer example `GenericTrainer.cpp` file is generated from Cheat Engine table file.
- Simple Trainer - **[SimpleTrainer]** is a simple trainer example using GTLibc library. Example `IGITrainer.cpp`
## Usage and Installation
- To use GTLibc just include the `GTLibc.h` header file in your project.
- To use the **[GTLibc-Generator]**, you need to install **[Cheat Engine]** and include the `GTLibc.h` header file in your project.
1. **Read** the **Cheat Engine** table file using this `gtlibc.ReadCheatTable("CheatTableFile.ct");` method.
2. **Activate** the **Cheat Entries** you want to use in the trainer using this `gtlibc.ActivateCheatTableEntries({0, 1, 2});` method.
3. **Execute** and **Generate** the trainer using this `gtlibc.ExecuteCheatTable();` method.
- To **compile** and **run** the file use `CppRunner.bat file_name.cpp`.
- Or to run manually use this command `g++ -std=c++17 -w -DGT_USE_CE_PARSER -o GenericTrainer.exe GenericTrainer.cpp GTLibc.cpp CEParser.cpp` note the flag `GT_USE_CE_PARSER` is important to use if compiling for CheatEngine. You need to have **C++ 17 Compiler** _installed_ on your **machine**.
## Features and Usages
- Game **Process** and **Window** Detection.
- Memory **Reading** and **Writing** with advanced **pointer support**.
- Hotkey Detection with **advanced support** for **multiple hotkeys**.
- Using latest **C++ 17 features** for ease of use and readability.
- No external dependencies - only the **Win32 API** and **Standard C++ Library**.
- Generate Generic trainer using the **[GTLibc-Generator]**.
- Advanced support for famous **Cheat Engine**.
## Methods information and usages
Method
Description
Example
Signature
FindGameProcess
Finds the game process by its name.
HANDLE handle = FindGameProcess("GameName");
HANDLE FindGameProcess(const std::string &gameName);
FindGameWindow
Finds the game window by its name.
HWND gameWindow = FindGameWindow("GameWindowName");
HWND FindGameWindow(const std::string &windowName);
ReadAddress
Reads the value at the address.
Int value = ReadAddress<int>(0x12345678);
T ReadAddress(DWORD address);
WriteAddress
Writes the value at the address.
Bool result = WriteAddress<int>(0x12345678, 100);
Bool WriteAddress(DWORD address, const T &value);
ReadAddressOffset
Reads the value at the address with the offset.
Int value = ReadAddressOffset<int>(0x12345678, 0x10);
T ReadAddressOffset(DWORD address, const DWORD offset);
WriteAddressOffset
Writes the value at the address with the offset.
Bool result = WriteAddressOffset<int>(0x12345678, 0x10, 100);
Bool WriteAddressOffset(DWORD address, DWORD offset, const T &value);
ReadAddressOffsets
Reads the value at the address with the offsets.
Int value = ReadAddressOffsets<int>(0x12345678, {0x10, 0x20});
T ReadAddressOffsets(DWORD address, const std::vector &offsets);
WriteAddressOffsets
Writes the value at the address with the offsets.
Bool result = WriteAddressOffsets<int>(0x12345678, {0x10, 0x20}, 100);
Bool WriteAddressOffsets(DWORD address, const std::vector &offsets, const T &value);
ReadPointer
Reads the value at the address.
Int value = ReadPointer<int>(0x12345678);
T ReadPointer(DWORD address);
WritePointer
Writes the value at the address with the pointer offset.
Bool result = WritePointer<int>(0x12345678, 0x10, 100);
Bool WritePointer(DWORD address, DWORD pointerOffset, const T &value);
ReadPointerOffset
Reads the value at the address with the pointer offset.
Int value = ReadPointerOffset<int>(0x12345678, 0x10);
T ReadPointerOffset(DWORD address, const DWORD offset);
WritePointerOffset
Writes the value at the address with the pointer and offset.
Bool result = WritePointerOffset<int>(0x12345678, 0x10, 0x20, 100);
Bool WritePointerOffset(DWORD address, DWORD pointerOffset, DWORD offset, const T &value);
ReadPointerOffsets
Reads the value at the address with the pointer offsets.
Int value = ReadPointerOffsets<int>(0x12345678, {0x10, 0x20});
T ReadPointerOffsets(DWORD address, const std::vector &offsets);
WritePointerOffsets
Writes the value at the address with the pointer and offsets.
Bool result = WritePointerOffsets<int>(0x12345678, 0x10, {0x20, 0x30}, 100);
Bool WritePointerOffsets(DWORD address, DWORD pointerOffset, const std::vector &offsets, const T &value);
ReadString
Reads the string at the address with the size.
Std::string value = ReadString(0x12345678, 20);
Std::string ReadString(DWORD address, size_t size);
WriteString
Writes the string at the address.
Bool result = WriteString(0x12345678, "Hello World");
Bool WriteString(DWORD address, const std::string &str);
HotKeysDown
Checks if all the keys are pressed.
Bool isPressed = HotKeysDown({VK_A, VK_B, VK_C});
Bool HotKeysDown(const std::vector &keys);
IsKeyPressed
Checks if the key is pressed.
Bool isPressed = IsKeyPressed(VK_A);
Bool IsKeyPressed(int keycode);
IsKeyToggled
Checks if the key is toggled.
Bool isToggled = IsKeyToggled(VK_CAPITAL);
Bool IsKeyToggled(int keycode);
GetGameName
Returns the name of the game.
Std::string gameName = GetGameName();
Std::string GetGameName();
GetProcessId
Returns the process id of the game.
DWORD processId = GetProcessId();
DWORD GetProcessId();
GetGameHandle4mHWND
Returns the game handle from the window handle.
HANDLE gameHandle = GetGameHandle4mHWND(gameWindow);
HANDLE GetGameHandle4mHWND(HWND hwnd);
GetProcessID4mHWND
Returns the process id from the window handle.
DWORD processId = GetProcessID4mHWND(gameWindow);
DWORD GetProcessID4mHWND(HWND hwnd);
GetGameHandle
Returns the game handle.
HANDLE gameHandle = GetGameHandle();
HANDLE GetGameHandle();
GetGameBaseAddress
Returns the base address of the game.
DWORD baseAddress = GetGameBaseAddress();
DWORD GetGameBaseAddress();
EnableLogs
Enables or disables the logs.
EnableLogs(true);
Void EnableLogs(bool status);
ReadCheatTable
Reads the cheat table file and returns the cheat table.
CheatTable ct = ReadCheatTable("cheatTableFile.ct");
CheatTable ReadCheatTable(const std::string &cheatTableFile, int entries = -1);
AddCheatTableEntry
Adds the cheat entry to the cheat table.
AddCheatTableEntry("Armor", CheatTypes.Integer, 0x07290BC8, {}, {VK_CONTROL, 'M'}, CheatActions.SetValue, "150");
Void AddCheatTableEntry(const std::string &description, const std::string &dataType, const DWORD address, const std::vector &offsets, const std::vector &hotkeys, const std::string &hotkeyAction, const std::string hotkeyValue);
DisplayCheatTable
Displays the cheat table.
DisplayCheatTable();
Void DisplayCheatTable(bool showMenuIndex = true, bool showMenuDescription = true, bool showMenuAction = false, bool showMenuHotkeys = true, bool showMenuValue = false);
ReadCheatTableEntries
Reads the cheat table entries and print their values.
ReadCheatTableEntries();
Void ReadCheatTableEntries();
ActivateCheatTableEntries
Activates the cheat table entries.
ActivateCheatTableEntries({1, 2, 3});
Void ActivateCheatTableEntries(const std::vector &cheatEntryIndex);
ExecuteCheatTable
Executes the cheat table and generate trainer.
ExecuteCheatTable(true, VK_ESCAPE, true, true, false, true);
Void ExecuteCheatTable(bool showTrainerOutput = false, int exitTrainerKey = EXIT_TRAINER_KEY, bool showMenuIndex = true, bool showMenuDescription = true, bool showMenuAction = false, bool showMenuHotkeys = true);
Written and maintained by: **HeavenHM@2023.**
