GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BasedInc/kiero: A modernized fork of the universal graphical hook

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

74 Commits
74 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
include
include
 
 
src
src
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

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 hook
using pfnEndScene = HRESULT(__stdcall*)(LPDIRECT3DDEVICE9);
static pfnEndScene oEndScene = nullptr;

// Declare the detour function
static HRESULT __stdcall hk_EndScene(LPDIRECT3DDEVICE9 pDevice) {
    // static bool init = false;
    // if (!init) {
    //     MessageBox(0, "Hello, World!", "Kiero", MB_OK);
    //     init = true;
    // }
    return oEndScene(pDevice);
}

static DWORD WINAPI kieroExampleThread(LPVOID) {
    // Explicitly initialize for D3D9, "RenderType::Auto" can also be used
    if (kiero::init(kiero::RenderType::D3D9) != kiero::Status::Success) {
        return S_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_t
    uintptr_t endScene = kiero::getMethod<&IDirect3DDevice9::EndScene, uintptr_t>();

    return S_OK;
}

BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpReserved) {
    if (fdwReason == DLL_PROCESS_ATTACH) {
        auto handle = CreateThread(nullptr, 0, &kieroExampleThread, nullptr, 0, nullptr);
        if (!handle) {
            return FALSE;
        }
        CloseHandle(handle);
    }
    return TRUE;
}

About

A modernized fork of the universal graphical hook

Resources

Readme
License
Activity
Custom properties

Stars

12 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.