f02342ac0c
Before, game capture would find addresses to important graphics functions by creating a graphics context for the desired API inside of the hook, and then find the function addresses that way. The big problem with that is that the context could often cause the hooked application to crash, especially if another hook was active. This bypasses that entire need by a simple console application that creates the contexts, finds the hook address offsets and then returns them via console output.
31 lines
625 B
C
31 lines
625 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "../graphics-hook-info.h"
|
|
|
|
#define DUMMY_WNDCLASS "get_addrs_wndclass"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#else
|
|
#ifndef inline
|
|
#define inline __inline
|
|
#endif
|
|
#endif
|
|
|
|
static inline uint32_t vtable_offset(HMODULE module, void *cls,
|
|
unsigned int offset)
|
|
{
|
|
uintptr_t *vtable = *(uintptr_t**)cls;
|
|
return (uint32_t)(vtable[offset] - (uintptr_t)module);
|
|
}
|
|
|
|
extern void get_dxgi_offsets(struct dxgi_offsets *offsets);
|
|
extern void get_d3d9_offsets(struct d3d9_offsets *offsets);
|
|
extern void get_d3d8_offsets(struct d3d8_offsets *offsets);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|