|
102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
|
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <windows.h>#include <SDL3/SDL.h>Go to the source code of this file.
Data Structures | |
| struct | DTTR_Config |
| struct | DTTR_ConfigFieldSpec |
| struct | DTTR_ConfigChoice |
Functions | |
| const char * | DTTR_Config_GraphicsAPIName (DTTR_GraphicsApi api) |
| Returns the config token for a graphics API selection. | |
| int | DTTR_Config_SchemaCount () |
| const DTTR_ConfigFieldSpec * | DTTR_Config_SchemaGet (int index) |
| bool | DTTR_Config_FieldChanged (const DTTR_Config *current, const DTTR_Config *base, const DTTR_ConfigFieldSpec *spec) |
| bool | DTTR_Config_SchemaChanged (const DTTR_Config *current, const DTTR_Config *base) |
| int | DTTR_Config_ChoiceCount (DTTR_ConfigChoiceList list) |
| const DTTR_ConfigChoice * | DTTR_Config_ChoiceGet (DTTR_ConfigChoiceList list, int index) |
| const DTTR_ConfigChoice * | DTTR_Config_Choices (DTTR_ConfigChoiceList list, int *count) |
| void | DTTR_Config_ClearGamepadButtonMap (int *map) |
| bool | DTTR_Config_IsModDisabled (const DTTR_Config *config, const char *mod_filename) |
| bool | DTTR_Config_SetModEnabled (DTTR_Config *config, const char *mod_filename, bool enabled) |
| bool | DTTR_Config_DisabledModsChanged (const DTTR_Config *current, const DTTR_Config *base) |
| void | DTTR_Config_SetDefaults (DTTR_Config *config) |
| Resets a config object to built-in defaults. | |
| bool | DTTR_Config_Load (const char *filename) |
| Loads config values from a strict JSON file into the global config object. | |
| const char * | DTTR_Config_LastError () |
| Returns details from the most recent config load failure, or NULL when none exist. | |
| bool | DTTR_Config_Save (const char *filename, const DTTR_Config *config) |
| Saves config values back to a strict JSON file. | |
Variables | |
| DTTR_Config | dttr_config |
| #define DTTR_CONFIG_DISABLED_MODS_MAX 32 |
Definition at line 56 of file dttr_config.h.
Referenced by add_disabled_mod(), and scan_mod_dlls().
| #define DTTR_CONFIG_FILENAME "dttr.json" |
Definition at line 197 of file dttr_config.h.
Referenced by config_path_from_args(), DTTR_Hook_WinMainCallback(), get_config_path(), and resolve_config_path().
| #define DTTR_CONFIG_SCHEMA_MAJOR_VERSION 1 |
Definition at line 55 of file dttr_config.h.
Referenced by validate_schema_major_version().
| #define DTTR_DRIVER_AUTO "auto" |
Definition at line 30 of file dttr_config.h.
| #define DTTR_DRIVER_DIRECT3D12 "direct3d12" |
Definition at line 32 of file dttr_config.h.
Referenced by create_device(), driver_display_name(), dttr_graphics_shader_format_for_driver(), and graphics_api_driver_name().
| #define DTTR_DRIVER_DIRECT3D12_SHORT "d3d12" |
Definition at line 33 of file dttr_config.h.
Referenced by CONFIG_PARSE_CHOICE_FN().
| #define DTTR_DRIVER_OPENGL "opengl" |
Definition at line 34 of file dttr_config.h.
| #define DTTR_DRIVER_VULKAN "vulkan" |
Definition at line 31 of file dttr_config.h.
Referenced by create_device(), driver_display_name(), dttr_graphics_shader_format_for_driver(), and graphics_api_driver_name().
| #define DTTR_GAMEPAD_AXIS_IDX_CAMERA_RZ 2 |
Definition at line 62 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define DTTR_GAMEPAD_AXIS_IDX_STICK_X 0 |
Definition at line 60 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define DTTR_GAMEPAD_AXIS_IDX_STICK_Y 1 |
Definition at line 61 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define DTTR_GAMEPAD_AXIS_MAPPING_COUNT 3 |
Definition at line 59 of file dttr_config.h.
| #define DTTR_GAMEPAD_MAPPING_NONE (-1) |
Definition at line 48 of file dttr_config.h.
Referenced by config_apply_buttons(), config_clear_button_map(), draw_gamepad_button_row(), dttr_inputs_hook_dinput_poll_callback(), game_action_tooltip(), gamepad_button_row_action(), gamepad_default_source_for_action(), read_axis(), source_for_action(), source_label(), source_tooltip(), and sync_rows_from_config().
| #define DTTR_GAMEPAD_SOURCE_COUNT (SDL_GAMEPAD_BUTTON_COUNT + 2) |
Definition at line 53 of file dttr_config.h.
Referenced by button_source_in_range(), config_add_gamepad_buttons(), config_clear_button_map(), dttr_inputs_hook_dinput_poll_callback(), source_for_action(), and sync_rows_from_config().
| #define DTTR_GAMEPAD_SOURCE_TRIGGER_LEFT (SDL_GAMEPAD_BUTTON_COUNT) |
Definition at line 51 of file dttr_config.h.
Referenced by is_source_pressed(), source_from_event(), and source_label().
| #define DTTR_GAMEPAD_SOURCE_TRIGGER_RIGHT (SDL_GAMEPAD_BUTTON_COUNT + 1) |
Definition at line 52 of file dttr_config.h.
Referenced by is_source_pressed(), source_from_event(), and source_label().
| #define DTTR_GAMEPAD_TRIGGER_THRESHOLD 300 |
Definition at line 49 of file dttr_config.h.
Referenced by is_source_pressed(), and source_from_event().
| #define DTTR_MODS_SHADOW_PREFIX "_dttr_hot_" |
Definition at line 57 of file dttr_config.h.
Referenced by is_shadow_mod(), is_shadow_mod_dll(), and make_shadow_path().
| #define PCDOGS_GAMEPAD_IDX_BTN_0 6 |
Definition at line 70 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define PCDOGS_GAMEPAD_IDX_BTN_1 7 |
Definition at line 71 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_10 16 |
Definition at line 80 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_11 17 |
Definition at line 81 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_12 18 |
Definition at line 82 of file dttr_config.h.
Referenced by button_action_in_range(), and dttr_inputs_hook_dinput_poll_callback().
| #define PCDOGS_GAMEPAD_IDX_BTN_2 8 |
Definition at line 72 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_3 9 |
Definition at line 73 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_4 10 |
Definition at line 74 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_5 11 |
Definition at line 75 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_6 12 |
Definition at line 76 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_7 13 |
Definition at line 77 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_8 14 |
Definition at line 78 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_BTN_9 15 |
Definition at line 79 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_DOWN 1 |
Definition at line 65 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define PCDOGS_GAMEPAD_IDX_LEFT 2 |
Definition at line 66 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define PCDOGS_GAMEPAD_IDX_POV_DOWN 5 |
Definition at line 69 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_POV_UP 4 |
Definition at line 68 of file dttr_config.h.
| #define PCDOGS_GAMEPAD_IDX_RIGHT 3 |
Definition at line 67 of file dttr_config.h.
Referenced by dttr_inputs_hook_dinput_poll_callback().
| #define PCDOGS_GAMEPAD_IDX_UP 0 |
Definition at line 64 of file dttr_config.h.
Referenced by button_action_in_range(), and dttr_inputs_hook_dinput_poll_callback().
| #define WINDOW_HEIGHT 480 |
Definition at line 12 of file dttr_config.h.
Referenced by dttr_graphics_init(), dttr_graphics_set_logical_resolution(), and select_render_resolution().
| #define WINDOW_WIDTH 640 |
Definition at line 11 of file dttr_config.h.
Referenced by dttr_graphics_init(), dttr_graphics_set_logical_resolution(), and select_render_resolution().
Definition at line 147 of file dttr_config.h.
| enum DTTR_ConfigValueType |
Definition at line 119 of file dttr_config.h.
| enum DTTR_GraphicsApi |
| Enumerator | |
|---|---|
| DTTR_GRAPHICS_API_AUTO | |
| DTTR_GRAPHICS_API_VULKAN | |
| DTTR_GRAPHICS_API_DIRECT3D12 | |
| DTTR_GRAPHICS_API_OPENGL | |
Definition at line 36 of file dttr_config.h.
| enum DTTR_MinidumpType |
| Enumerator | |
|---|---|
| DTTR_MINIDUMP_NORMAL | |
| DTTR_MINIDUMP_DETAILED | |
Definition at line 25 of file dttr_config.h.
| enum DTTR_ScalingMethod |
| Enumerator | |
|---|---|
| DTTR_SCALING_METHOD_PRESENT | |
| DTTR_SCALING_METHOD_LOGICAL | |
Definition at line 20 of file dttr_config.h.
| enum DTTR_ScalingMode |
| Enumerator | |
|---|---|
| DTTR_SCALING_MODE_LETTERBOX | |
| DTTR_SCALING_MODE_STRETCH | |
| DTTR_SCALING_MODE_INTEGER | |
Definition at line 14 of file dttr_config.h.
| enum DTTR_VertexPrecision |
| Enumerator | |
|---|---|
| DTTR_VERTEX_PRECISION_NATIVE | |
| DTTR_VERTEX_PRECISION_SUBPIXEL | |
Definition at line 43 of file dttr_config.h.
| int DTTR_Config_ChoiceCount | ( | DTTR_ConfigChoiceList | list | ) |
Definition at line 198 of file parse.c.
References config_choice_list(), and data.
Referenced by gamepad_button_row_count().
| const DTTR_ConfigChoice * DTTR_Config_ChoiceGet | ( | DTTR_ConfigChoiceList | list, |
| int | index ) |
Definition at line 203 of file parse.c.
References config_choice_list(), data, and NULL.
Referenced by gamepad_button_row_choice().
| const DTTR_ConfigChoice * DTTR_Config_Choices | ( | DTTR_ConfigChoiceList | list, |
| int * | count ) |
Definition at line 212 of file parse.c.
References config_choice_list(), count, data, and NULL.
Referenced by choice_combo(), and config_parse_choice().
| void DTTR_Config_ClearGamepadButtonMap | ( | int * | map | ) |
Definition at line 72 of file defaults.c.
References config_clear_button_map().
Referenced by set_default_button_map(), and sync_config_from_rows().
| bool DTTR_Config_DisabledModsChanged | ( | const DTTR_Config * | current, |
| const DTTR_Config * | base ) |
Definition at line 166 of file defaults.c.
References DTTR_Config::disabled_mod_count, DTTR_Config::disabled_mods, and DTTR_Config_IsModDisabled().
Referenced by config_has_unsaved_changes().
| bool DTTR_Config_FieldChanged | ( | const DTTR_Config * | current, |
| const DTTR_Config * | base, | ||
| const DTTR_ConfigFieldSpec * | spec ) |
Definition at line 110 of file schema.c.
References config_field_bytes(), DTTR_CONFIG_VALUE_STRING, DTTR_Path_MatchesNormalized(), DTTR_ConfigFieldSpec::size, and DTTR_ConfigFieldSpec::value_type.
Referenced by DTTR_Config_SchemaChanged().
| const char * DTTR_Config_GraphicsAPIName | ( | DTTR_GraphicsApi | api | ) |
Returns the config token for a graphics API selection.
Definition at line 192 of file defaults.c.
References config_format_graphics_api().
Referenced by dttr_graphics_init().
| bool DTTR_Config_IsModDisabled | ( | const DTTR_Config * | config, |
| const char * | mod_filename ) |
Definition at line 98 of file defaults.c.
References find_disabled_mod().
Referenced by draw_mod_toggle_row(), DTTR_Config_DisabledModsChanged(), and scan_mod_file().
| const char * DTTR_Config_LastError | ( | ) |
Returns details from the most recent config load failure, or NULL when none exist.
Definition at line 46 of file io.c.
Referenced by dttr_launcher_main(), and load_config().
| bool DTTR_Config_Load | ( | const char * | filename | ) |
Loads config values from a strict JSON file into the global config object.
Definition at line 259 of file io.c.
References apply_section(), config_apply_buttons(), config_apply_disabled_mods(), dttr_config, DTTR_Config_Save(), DTTR_Config_SetDefaults(), DTTR_LOG_ERROR, DTTR_LOG_WARN, errors_addf(), errors_clear(), errors_show(), NULL, and validate_schema_major_version().
Referenced by DTTR_Hook_WinMainCallback(), dttr_launcher_main(), and load_config().
| bool DTTR_Config_Save | ( | const char * | filename, |
| const DTTR_Config * | config ) |
Saves config values back to a strict JSON file.
Definition at line 483 of file io.c.
References config_json_objects::audio, config_add_disabled_mods(), config_add_gamepad_buttons(), config_add_schema_fields(), DTTR_LOG_ERROR, config_json_objects::gamepad, config_json_objects::graphics, config_json_objects::modding, and NULL.
Referenced by DTTR_Config_Load(), save_config(), and save_selected_path().
| bool DTTR_Config_SchemaChanged | ( | const DTTR_Config * | current, |
| const DTTR_Config * | base ) |
Definition at line 128 of file schema.c.
References config_schema, CONFIG_SCHEMA_COUNT, and DTTR_Config_FieldChanged().
Referenced by config_has_unsaved_changes().
| int DTTR_Config_SchemaCount | ( | ) |
Definition at line 91 of file schema.c.
References CONFIG_SCHEMA_COUNT.
Referenced by config_add_schema_fields().
| const DTTR_ConfigFieldSpec * DTTR_Config_SchemaGet | ( | int | index | ) |
Definition at line 95 of file schema.c.
References config_schema, CONFIG_SCHEMA_COUNT, and NULL.
Referenced by config_add_schema_fields(), and config_schema_find().
| void DTTR_Config_SetDefaults | ( | DTTR_Config * | config | ) |
Resets a config object to built-in defaults.
Definition at line 196 of file defaults.c.
References default_config, DTTR_Config::gamepad_button_map, and set_default_button_map().
Referenced by DTTR_Config_Load(), init_state_from_args(), and reset_defaults().
| bool DTTR_Config_SetModEnabled | ( | DTTR_Config * | config, |
| const char * | mod_filename, | ||
| bool | enabled ) |
Definition at line 145 of file defaults.c.
References add_disabled_mod(), find_disabled_mod(), and remove_disabled_mod().
Referenced by config_apply_disabled_mods(), and draw_mod_toggle_row().
|
extern |
Definition at line 53 of file defaults.c.
Referenced by apply_section(), attempt_hot_reload_mods(), attempt_play_startup_movies(), build_saves_dir(), collect_and_upload_pending(), create_device(), create_samplers(), d3d_device7_record_draw(), DTTR_Config_Load(), dttr_graphics_hooks_init(), dttr_graphics_init(), dttr_graphics_sdl3gpu_init(), dttr_graphics_should_fill_mesh_seams(), DTTR_Hook_WinMainCallback(), dttr_inputs_handle_device_event(), dttr_inputs_hook_dinput_poll_callback(), dttr_inputs_init(), dttr_inputs_late_init(), dttr_launcher_main(), dttr_mods_hot_reload_enabled(), dttr_mss_core_sample_headroom_gain(), dttr_mss_core_sample_preemphasis(), end_frame(), end_frame(), init_sidecar_context(), load_config(), minidump_type(), open_log_file(), prepare_mod(), present_video_frame_bgra(), read_axis(), redirect_path(), save_selected_path(), scan_mod_file(), select_gl_msaa_samples(), select_msaa_sample_count(), select_render_resolution(), try_open_configured_gamepad(), unhandled_exception_filter(), upload_pending_textures_gl(), upload_texture_data(), and write_child_dump().