102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
sidecar_private.h
Go to the documentation of this file.
1#ifndef DTTR_SIDECAR_PRIVATE_H
2#define DTTR_SIDECAR_PRIVATE_H
3
4#include <stdbool.h>
5#include <stddef.h>
6#include <stdint.h>
7#include <windows.h>
8
9#include <dttr_mods.h>
10#include <dttr_pcdogs.h>
11#include <dttr_runtime.h>
12
13#include <sds.h>
14
15#include <SDL3/SDL.h>
16
18
19extern HINSTANCE dttr_sidecar_module;
20extern char dttr_loader_dir[MAX_PATH];
21extern char dttr_exe_hash[DTTR_EXE_HASH_LENGTH + 1];
22
23DTTR_HOOK_STORAGE_SLOT(dttr_hook_win_main)
26 dttr_hook_cleanup_title_resources_original
27)
28
32 const char *path,
33 char *out_path,
34 size_t out_path_size
35);
37 const char *path,
38 char *out_path,
39 size_t out_path_size
40);
41const char *dttr_game_data_find_data_segment(const char *path);
42sds dttr_game_data_resolve_media_path(const char *relative);
43
46
51
52static inline const char *dttr_sidecar_result_detail(DTTR_Result result) {
53 return result.message ? result.message : DTTR_StatusName(result.status);
54}
55
56// Installs a PCDogs patch group with common sidecar logging and cleanup.
59 const char *label,
60 const DTTR_PCDOGS_T_Patch_Spec *patches,
61 size_t patch_count,
63) {
64 DTTR_PCDOGS_T_Patch_Report report = {0};
66 &ctx->runtime,
67 patches,
68 patch_count,
69 group,
70 &report
71 );
72 if (!DTTR_ResultOK(result)) {
74 ctx,
75 "%s: patch %u failed: %s",
76 label,
77 (unsigned)report.failed_index,
79 );
81 return false;
82 }
83
85 ctx,
86 "Installed %u %s patches (%u optional skipped)",
87 (unsigned)report.installed,
88 label,
89 (unsigned)report.skipped_optional
90 );
91 return true;
92}
93
94#endif // DTTR_SIDECAR_PRIVATE_H
void void * ctx
void void DWORD HANDLE event
void dttr_pcdogs_crash_symbols_clear()
Definition crash.c:126
void dttr_pcdogs_crash_symbols_register(const DTTR_Core_Context *runtime)
Definition crash.c:117
DTTR_Result DTTR_Core_PatchGroupRelease(DTTR_Core_PatchGroup **group)
Definition core.c:657
struct DTTR_Core_PatchGroup DTTR_Core_PatchGroup
Definition dttr_core.h:25
#define DTTR_MODS_LOG_ERROR(ctx,...)
Definition dttr_mods.h:225
union SDL_Event SDL_Event
Definition dttr_mods.h:19
#define DTTR_MODS_LOG_DEBUG(ctx,...)
Definition dttr_mods.h:219
BOOL(* DTTR_PCDOGS_F_Title_CleanupScreenResources_proto)()
const char * DTTR_StatusName(DTTR_Status status)
Definition core.c:23
bool DTTR_ResultOK(DTTR_Result result)
Definition core.c:78
#define DTTR_STORAGE_SLOT(type, name)
#define DTTR_HOOK_STORAGE_SLOT(name)
const DTTR_Mods_Context * dttr_sidecar_context()
Definition entrypoint.c:152
HINSTANCE dttr_sidecar_module
Definition entrypoint.c:35
const DTTR_Core_Context * dttr_sidecar_runtime_context()
Definition entrypoint.c:156
char dttr_exe_hash[DTTR_EXE_HASH_LENGTH+1]
Definition entrypoint.c:37
char dttr_loader_dir[MAX_PATH]
Definition entrypoint.c:36
void dttr_sidecar_handle_sdl_event(const SDL_Event *event)
Definition entrypoint.c:316
void dttr_sidecar_poll_sdl_events()
Definition entrypoint.c:383
sds dttr_game_data_resolve_media_path(const char *relative)
Definition game_data.c:210
bool dttr_game_data_resolve_read_path(const char *path, char *out_path, size_t out_path_size)
Definition game_data.c:184
void dttr_game_data_cleanup()
Definition game_data.c:23
bool dttr_game_data_resolve_existing_read_path(const char *path, char *out_path, size_t out_path_size)
Definition game_data.c:94
const char * dttr_game_data_find_data_segment(const char *path)
Definition game_data.c:144
void dttr_game_data_init()
Definition game_data.c:27
DTTR_Result DTTR_PCDOGS_PatchGroup_Install(const DTTR_Core_Context *ctx, const DTTR_PCDOGS_T_Patch_Spec *specs, size_t spec_count, DTTR_Core_PatchGroup **out_group, DTTR_PCDOGS_T_Patch_Report *out_report)
@ DTTR_EXE_HASH_LENGTH
static const char * dttr_sidecar_result_detail(DTTR_Result result)
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)