102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
hooks.c
Go to the documentation of this file.
1#include "hooks_private.h"
2#include "sidecar_private.h"
3
4#include <dttr_pcdogs.h>
5
7
8// Installs the game-level patch group and clears cleanup state if any required hook
9// fails.
11 const DTTR_PCDOGS_T_Patch_Spec game_patches[] = {
14 true,
16 &dttr_hook_cleanup_title_resources_original
17 ),
19 false,
20 "51 8D 44 24 ?? 57",
21 0,
23 ),
24 };
25
27 ctx,
28 "sidecar/game",
29 game_patches,
30 DTTR_ARRAY_COUNT(game_patches),
32 )) {
33 dttr_hook_cleanup_title_resources_original = NULL;
34 return false;
35 }
36
37 return true;
38}
39
40// Releases all game-level patches and drops the saved cleanup callback pointer.
43 dttr_hook_cleanup_title_resources_original = NULL;
44}
void void * ctx
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
DTTR_Result DTTR_Core_PatchGroupRelease(DTTR_Core_PatchGroup **group)
Definition core.c:657
#define DTTR_ARRAY_COUNT(array_)
Definition dttr_core.h:18
struct DTTR_Core_PatchGroup DTTR_Core_PatchGroup
Definition dttr_core.h:25
DTTR_PCDOGS_API const struct dttr_pcdogs_function_accessor_File_Open *const DTTR_PCDOGS_F_File_Open
Accessor object for File_Open.
#define DTTR_PCDOGS_PATCH_SPEC_AOB_REL32_JMP(required_, aob_, offset_, detour_)
DTTR_PCDOGS_API const struct dttr_pcdogs_function_accessor_Title_CleanupScreenResources *const DTTR_PCDOGS_F_Title_CleanupScreenResources
Accessor object for Title_CleanupScreenResources.
static DTTR_Core_PatchGroup * game_targets
Definition hooks.c:6
void dttr_game_hooks_cleanup(const DTTR_Mods_Context *)
Definition hooks.c:41
bool dttr_game_hooks_init(const DTTR_Mods_Context *ctx)
Definition hooks.c:10
BOOL dttr_hook_cleanup_title_resources_callback()
DTTR_PCDOGS_T_File_Handle * dttr_crt_hook_open_file_callback(const char *path, const char *mode)
uint32_t dttr_hook_resolve_pcdogs_path_callback()
static bool dttr_sidecar_install_pcdogs_patch_group(const DTTR_Mods_Context *ctx, const char *label, const DTTR_PCDOGS_T_Patch_Spec *patches, size_t patch_count, DTTR_Core_PatchGroup **group)