|
102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
|
#include "hooks_private.h"#include "sidecar_private.h"#include <dttr_config.h>#include <dttr_log.h>#include <dttr_path.h>#include <dttr_pcdogs.h>#include <dttr_sdl.h>#include <SDL3/SDL.h>#include <sds.h>#include <sys/stat.h>#include <windows.h>Go to the source code of this file.
Macros | |
| #define | IS_READ_ONLY_MODE(m) |
Functions | |
| static DTTR_PCDOGS_T_File_Handle * | file_open_with_mode (const char *path, const char *mode, uint8_t sharing_flag) |
| static bool | is_relative_path (const char *path) |
| static bool | mode_wants_write (const char *mode) |
| static void | create_dir_if_set (const char *path) |
| static void | build_saves_dir (char *buf, size_t buf_size) |
| static void | build_save_slot_dir (char *buf, size_t buf_size) |
| static void | ensure_save_dir () |
| static const char * | redirect_path (const char *path, char *buf, size_t buf_size, const char *mode) |
| static DTTR_PCDOGS_T_File_Handle * | report_file_open_failure (const char *path, const char *mode) |
| static DTTR_PCDOGS_T_File_Handle * | try_fix_permissions (const char *path, const char *mode) |
| static DTTR_PCDOGS_T_File_Handle * | try_open_read_path (const char *path, const char *mode) |
| DTTR_PCDOGS_T_File_Handle * | dttr_crt_hook_open_file_callback (const char *path, const char *mode) |
Variables | |
| static bool | redirect_saves_initialized = false |
| #define IS_READ_ONLY_MODE | ( | m | ) |
Definition at line 14 of file hook_crt_open_file.c.
Referenced by dttr_crt_hook_open_file_callback(), and redirect_path().
|
static |
Definition at line 84 of file hook_crt_open_file.c.
References build_saves_dir(), dttr_exe_hash, DTTR_Path_AppendSegment(), and DTTR_Path_CopySds().
Referenced by ensure_save_dir(), and redirect_path().
|
static |
Definition at line 63 of file hook_crt_open_file.c.
References dttr_config, dttr_loader_dir, DTTR_Path_AppendSegment(), DTTR_Path_CopySds(), is_relative_path(), and NULL.
Referenced by build_save_slot_dir(), and ensure_save_dir().
|
static |
Definition at line 56 of file hook_crt_open_file.c.
References NULL.
Referenced by ensure_save_dir().
| DTTR_PCDOGS_T_File_Handle * dttr_crt_hook_open_file_callback | ( | const char * | path, |
| const char * | mode ) |
Definition at line 248 of file hook_crt_open_file.c.
References DTTR_LOG_ERROR, file_open_with_mode(), IS_READ_ONLY_MODE, mode_wants_write(), redirect_path(), report_file_open_failure(), try_fix_permissions(), and try_open_read_path().
Referenced by dttr_game_hooks_init().
|
static |
Definition at line 97 of file hook_crt_open_file.c.
References build_save_slot_dir(), build_saves_dir(), create_dir_if_set(), and redirect_saves_initialized.
Referenced by redirect_path().
|
static |
Definition at line 17 of file hook_crt_open_file.c.
References DTTR_LOG_ERROR, DTTR_PCDOGS_F_File_OpenWithMode, DTTR_ResultOK(), dttr_sidecar_result_detail(), dttr_sidecar_runtime_context(), and NULL.
Referenced by dttr_crt_hook_open_file_callback(), try_fix_permissions(), and try_open_read_path().
|
static |
Definition at line 44 of file hook_crt_open_file.c.
References DTTR_Path_IsSafeRelative().
Referenced by build_saves_dir(), and redirect_path().
|
static |
Definition at line 49 of file hook_crt_open_file.c.
Referenced by dttr_crt_hook_open_file_callback(), and try_fix_permissions().
|
static |
Definition at line 113 of file hook_crt_open_file.c.
References build_save_slot_dir(), dttr_config, DTTR_LOG_DEBUG, DTTR_Path_AppendSegment(), DTTR_Path_CopySds(), DTTR_Path_ExactExists(), ensure_save_dir(), IS_READ_ONLY_MODE, and is_relative_path().
Referenced by dttr_crt_hook_open_file_callback().
|
static |
Definition at line 148 of file hook_crt_open_file.c.
References DTTR_SDL_ShowSimpleMessageBox(), and NULL.
Referenced by dttr_crt_hook_open_file_callback().
|
static |
Definition at line 166 of file hook_crt_open_file.c.
References DTTR_LOG_DEBUG, DTTR_LOG_ERROR, DTTR_SDL_ShowMessageBox(), file_open_with_mode(), mode_wants_write(), and NULL.
Referenced by dttr_crt_hook_open_file_callback().
|
static |
Definition at line 230 of file hook_crt_open_file.c.
References dttr_game_data_resolve_existing_read_path(), dttr_game_data_resolve_read_path(), DTTR_LOG_DEBUG, file_open_with_mode(), and NULL.
Referenced by dttr_crt_hook_open_file_callback().
|
static |
Definition at line 53 of file hook_crt_open_file.c.
Referenced by ensure_save_dir().