Skip to content

Latest commit

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

kiero


Universal graphical hook for Direct3D, OpenGL, and Vulkan based games

Requirement

Windows SDK (Direct3D/OpenGL)

Vulkan SDK

Usage

// Example for D3D9 hook// Include required libraries
#include<d3d9.h>
#include<Windows.h>
#include<kiero.hpp>// Create the type of function that we will hookusing pfnEndScene = HRESULT(__stdcall*)(LPDIRECT3DDEVICE9);
static pfnEndScene oEndScene = nullptr;
// Declare the detour functionstaticHRESULT __stdcall hk_EndScene(LPDIRECT3DDEVICE9 pDevice) {
// static bool init = false;// if (!init) {// MessageBox(0, "Hello, World!", "Kiero", MB_OK);// init = true;// }returnoEndScene(pDevice);
}
staticDWORDWINAPIkieroExampleThread(LPVOID) {
// Explicitly initialize for D3D9, "RenderType::Auto" can also be usedif (kiero::init(kiero::RenderType::D3D9) != kiero::Status::Success) {
returnS_FALSE;
}
// Using kiero::bind to hook EndScene
kiero::Status status = kiero::bind<&IDirect3DDevice9::EndScene>(&oEndScene, &hk_EndScene);
if (status == kiero::Status::Success) {
std::println("Successfully hooked IDirect3DDevice9::EndScene");
}
// Alternatively, get the address of the function via kiero::getMethod.// By default, the return type is the same as the expected detour function type
pfnEndScene endScene = kiero::getMethod<&IDirect3DDevice9::EndScene>();
// A template parameter can be used to specify the return type to anything// which can be bit_cast-ed from a uintptr_tuintptr_t endScene = kiero::getMethod<&IDirect3DDevice9::EndScene, uintptr_t>();
returnS_OK;
}
BOOLWINAPIDllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
auto handle = CreateThread(nullptr, 0, &kieroExampleThread, nullptr, 0, nullptr);
if (!handle) {
returnFALSE;
}
CloseHandle(handle);
}
returnTRUE;
}

About

A modernized fork of the universal graphical hook

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages