HydraHook
Direct3D and Core Audio hooking library for Windows
Loading...
Searching...
No Matches
Game.h File Reference

Main hook worker thread entry point. More...

#include <Windows.h>
#include "HydraHook/Engine/HydraHookCore.h"

Go to the source code of this file.

Classes

struct  D3D12ResizePreExtension
struct  D3D12ResizeCallbackScope
struct  ScopedSuppressD3D12QueueCapture
 Suppresses ExecuteCommandLists queue observation on this thread (readback, worker probes). More...

Functions

ID3D12CommandQueue * GetUniformD3D12PresentQueue (UINT bufferCount, IUnknown *const *presentQueues)
ID3D12CommandQueue * GetD3D12CommandQueueForSwapChain (IDXGISwapChain *pSwapChain, bool requireVerifiedQueue=false)
 Returns the D3D12 command queue associated with a swap chain.
DWORD HydraHookMainThread (LPVOID Params)
 Main hook worker thread; probes and hooks render and audio APIs.

Variables

bool g_suppressD3D12QueueCapture = false

Detailed Description

Main hook worker thread entry point.

HydraHookMainThread runs in a dedicated thread, probing for Direct3D and Core Audio APIs, then installing hooks and dispatching callbacks.

Definition in file Game.h.

Function Documentation

◆ GetD3D12CommandQueueForSwapChain()

ID3D12CommandQueue * GetD3D12CommandQueueForSwapChain ( IDXGISwapChain * pSwapChain,
bool requireVerifiedQueue = false )

Returns the D3D12 command queue associated with a swap chain.

Checks the recorded association, then the current back buffer's queue on a supported DXGI build, then the device map filled by the ExecuteCommandLists hook.

Parameters
pSwapChainThe swap chain to query. May be null.
requireVerifiedQueueOnly accept an exact association for the current back buffer.
Returns
The command queue with AddRef, or nullptr if it is not captured or pSwapChain is null.

Definition at line 2188 of file Game.cpp.

References g_d3d12DeviceToQueue, g_d3d12QueueMapLock, g_d3d12SwapChainToQueue, and GetD3D12CommandQueueForSwapChain().

Referenced by GetD3D12CommandQueueForSwapChain(), HydraHookEngineGetD3D12CommandQueue(), and HydraHookEngineGetVerifiedD3D12CommandQueue().

◆ GetUniformD3D12PresentQueue()

ID3D12CommandQueue * GetUniformD3D12PresentQueue ( UINT bufferCount,
IUnknown *const * presentQueues )

Definition at line 2077 of file Game.cpp.

References GetUniformD3D12PresentQueue().

Referenced by GetUniformD3D12PresentQueue().

◆ HydraHookMainThread()

DWORD HydraHookMainThread ( LPVOID Params)

Main hook worker thread; probes and hooks render and audio APIs.

Installs the configured hooks, waits for cancellation, then uninstalls them. The worker does not own the unload. When the host calls FreeLibrary, that hook runs cleanup and its caller exits with FreeLibraryAndExitThread, while the worker exits with ExitThread. On any other shutdown the worker exits with FreeLibraryAndExitThread after cleanup.

Parameters
ParamsPHYDRAHOOK_ENGINE cast to LPVOID.
Returns
Thread exit code. The thread does not return to its caller.

Definition at line 451 of file Game.cpp.

References Hook< cc, retn, args >::apply(), BindChannelLoggers(), ResettableOnce::call(), Hook< cc, retn, args >::call_orig(), Direct3D9Hooking::EndScene, HookAnnouncements::endScene9, engine, ExitProcessHook, g_announce, g_exitProcessHook, g_freeLibraryHook, g_freeLibraryHost, g_freeLibraryTarget, g_logD3D9, g_logGame, g_postQuitMessageHook, HYDRAHOOK_ERROR_NONE, HydraHookCrashHandlerInstallThreadSEH(), HydraHookDirect3DVersion9, HydraHookEngineDestroyBeforeUnload(), HydraHookLoggingEnableAsync(), HydraHookMainThread(), HookActivityTracker::Guard::invoke, INVOKE_D3D9_CALLBACK, INVOKE_HYDRAHOOK_GAME_HOOKED, PerformShutdownCleanup(), PostQuitMessageHook, Direct3D9Hooking::Present, HookAnnouncements::present9, Direct3D9Hooking::PresentEx, HydraHook::Core::Util::process_name(), Direct3D9Hooking::Reset, HookAnnouncements::reset9, HookAnnouncements::reset9Ex, HookAnnouncements::reset_all(), ResetDxgiModuleCache(), Direct3D9Hooking::ResetEx, stdcall_t, and StoreRenderPipelinePtr().

Referenced by HydraHookEngineCreate(), HydraHookEngineRehook(), and HydraHookMainThread().

Variable Documentation

◆ g_suppressD3D12QueueCapture

bool g_suppressD3D12QueueCapture = false
inlinethread_local