102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
dttr_config.h
Go to the documentation of this file.
1#ifndef DTTR_CONFIG_H
2#define DTTR_CONFIG_H
3
4#include <stdbool.h>
5#include <stddef.h>
6#include <stdint.h>
7#include <windows.h>
8
9#include <SDL3/SDL.h>
10
11#define WINDOW_WIDTH 640
12#define WINDOW_HEIGHT 480
13
19
24
29
30#define DTTR_DRIVER_AUTO "auto"
31#define DTTR_DRIVER_VULKAN "vulkan"
32#define DTTR_DRIVER_DIRECT3D12 "direct3d12"
33#define DTTR_DRIVER_DIRECT3D12_SHORT "d3d12"
34#define DTTR_DRIVER_OPENGL "opengl"
35
42
47
48#define DTTR_GAMEPAD_MAPPING_NONE (-1)
49#define DTTR_GAMEPAD_TRIGGER_THRESHOLD 300
50
51#define DTTR_GAMEPAD_SOURCE_TRIGGER_LEFT (SDL_GAMEPAD_BUTTON_COUNT)
52#define DTTR_GAMEPAD_SOURCE_TRIGGER_RIGHT (SDL_GAMEPAD_BUTTON_COUNT + 1)
53#define DTTR_GAMEPAD_SOURCE_COUNT (SDL_GAMEPAD_BUTTON_COUNT + 2)
54
55#define DTTR_CONFIG_SCHEMA_MAJOR_VERSION 1
56#define DTTR_CONFIG_DISABLED_MODS_MAX 32
57#define DTTR_MODS_SHADOW_PREFIX "_dttr_hot_"
58
59#define DTTR_GAMEPAD_AXIS_MAPPING_COUNT 3
60#define DTTR_GAMEPAD_AXIS_IDX_STICK_X 0
61#define DTTR_GAMEPAD_AXIS_IDX_STICK_Y 1
62#define DTTR_GAMEPAD_AXIS_IDX_CAMERA_RZ 2
63
64#define PCDOGS_GAMEPAD_IDX_UP 0
65#define PCDOGS_GAMEPAD_IDX_DOWN 1
66#define PCDOGS_GAMEPAD_IDX_LEFT 2
67#define PCDOGS_GAMEPAD_IDX_RIGHT 3
68#define PCDOGS_GAMEPAD_IDX_POV_UP 4
69#define PCDOGS_GAMEPAD_IDX_POV_DOWN 5
70#define PCDOGS_GAMEPAD_IDX_BTN_0 6
71#define PCDOGS_GAMEPAD_IDX_BTN_1 7
72#define PCDOGS_GAMEPAD_IDX_BTN_2 8
73#define PCDOGS_GAMEPAD_IDX_BTN_3 9
74#define PCDOGS_GAMEPAD_IDX_BTN_4 10
75#define PCDOGS_GAMEPAD_IDX_BTN_5 11
76#define PCDOGS_GAMEPAD_IDX_BTN_6 12
77#define PCDOGS_GAMEPAD_IDX_BTN_7 13
78#define PCDOGS_GAMEPAD_IDX_BTN_8 14
79#define PCDOGS_GAMEPAD_IDX_BTN_9 15
80#define PCDOGS_GAMEPAD_IDX_BTN_10 16
81#define PCDOGS_GAMEPAD_IDX_BTN_11 17
82#define PCDOGS_GAMEPAD_IDX_BTN_12 18
83
116
118
133
134typedef struct {
135 const char *section;
136 const char *key;
137 ptrdiff_t offset;
138 size_t size;
141
142typedef struct {
143 const char *label;
144 int value;
146
158
161
165 const DTTR_Config *current,
166 const DTTR_Config *base,
167 const DTTR_ConfigFieldSpec *spec
168);
169bool DTTR_Config_SchemaChanged(const DTTR_Config *current, const DTTR_Config *base);
170
174
176
177bool DTTR_Config_IsModDisabled(const DTTR_Config *config, const char *mod_filename);
179 DTTR_Config *config,
180 const char *mod_filename,
181 bool enabled
182);
183bool DTTR_Config_DisabledModsChanged(const DTTR_Config *current, const DTTR_Config *base);
184
187
189bool DTTR_Config_Load(const char *filename);
190
192const char *DTTR_Config_LastError();
193
195bool DTTR_Config_Save(const char *filename, const DTTR_Config *config);
196
197#define DTTR_CONFIG_FILENAME "dttr.json"
198
199#endif
DTTR_Graphics_COM_Direct3DDevice7 void DWORD flags DWORD count
DTTR_VertexPrecision
Definition dttr_config.h:43
@ DTTR_VERTEX_PRECISION_NATIVE
Definition dttr_config.h:44
@ DTTR_VERTEX_PRECISION_SUBPIXEL
Definition dttr_config.h:45
bool DTTR_Config_SetModEnabled(DTTR_Config *config, const char *mod_filename, bool enabled)
Definition defaults.c:145
DTTR_GraphicsApi
Definition dttr_config.h:36
@ DTTR_GRAPHICS_API_DIRECT3D12
Definition dttr_config.h:39
@ DTTR_GRAPHICS_API_AUTO
Definition dttr_config.h:37
@ DTTR_GRAPHICS_API_OPENGL
Definition dttr_config.h:40
@ DTTR_GRAPHICS_API_VULKAN
Definition dttr_config.h:38
DTTR_ConfigValueType
@ DTTR_CONFIG_VALUE_FLOAT
@ DTTR_CONFIG_VALUE_BOOL
@ DTTR_CONFIG_VALUE_VERTEX_PRECISION
@ DTTR_CONFIG_VALUE_INT
@ DTTR_CONFIG_VALUE_GAMEPAD_AXIS
@ DTTR_CONFIG_VALUE_PRESENT_FILTER
@ DTTR_CONFIG_VALUE_MINIDUMP_TYPE
@ DTTR_CONFIG_VALUE_STRING
@ DTTR_CONFIG_VALUE_LOG_LEVEL
@ DTTR_CONFIG_VALUE_GRAPHICS_API
@ DTTR_CONFIG_VALUE_SCALING_FIT
@ DTTR_CONFIG_VALUE_SCALING_METHOD
void DTTR_Config_SetDefaults(DTTR_Config *config)
Resets a config object to built-in defaults.
Definition defaults.c:196
DTTR_ScalingMethod
Definition dttr_config.h:20
@ DTTR_SCALING_METHOD_PRESENT
Definition dttr_config.h:21
@ DTTR_SCALING_METHOD_LOGICAL
Definition dttr_config.h:22
const char * DTTR_Config_GraphicsAPIName(DTTR_GraphicsApi api)
Returns the config token for a graphics API selection.
Definition defaults.c:192
#define DTTR_GAMEPAD_SOURCE_COUNT
Definition dttr_config.h:53
DTTR_MinidumpType
Definition dttr_config.h:25
@ DTTR_MINIDUMP_DETAILED
Definition dttr_config.h:27
@ DTTR_MINIDUMP_NORMAL
Definition dttr_config.h:26
int DTTR_Config_SchemaCount()
Definition schema.c:91
void DTTR_Config_ClearGamepadButtonMap(int *map)
Definition defaults.c:72
bool DTTR_Config_SchemaChanged(const DTTR_Config *current, const DTTR_Config *base)
Definition schema.c:128
DTTR_ScalingMode
Definition dttr_config.h:14
@ DTTR_SCALING_MODE_STRETCH
Definition dttr_config.h:16
@ DTTR_SCALING_MODE_INTEGER
Definition dttr_config.h:17
@ DTTR_SCALING_MODE_LETTERBOX
Definition dttr_config.h:15
DTTR_ConfigChoiceList
@ DTTR_CONFIG_CHOICES_MINIDUMP_TYPE
@ DTTR_CONFIG_CHOICES_GAMEPAD_AXIS
@ DTTR_CONFIG_CHOICES_GRAPHICS_API
@ DTTR_CONFIG_CHOICES_LOG_LEVEL
@ DTTR_CONFIG_CHOICES_SCALING_FIT
@ DTTR_CONFIG_CHOICES_SCALING_METHOD
@ DTTR_CONFIG_CHOICES_PRESENT_FILTER
@ DTTR_CONFIG_CHOICES_GAME_ACTION
@ DTTR_CONFIG_CHOICES_VERTEX_PRECISION
const char * DTTR_Config_LastError()
Returns details from the most recent config load failure, or NULL when none exist.
Definition io.c:46
DTTR_Config dttr_config
Definition defaults.c:53
bool DTTR_Config_IsModDisabled(const DTTR_Config *config, const char *mod_filename)
Definition defaults.c:98
const DTTR_ConfigChoice * DTTR_Config_Choices(DTTR_ConfigChoiceList list, int *count)
Definition parse.c:212
bool DTTR_Config_DisabledModsChanged(const DTTR_Config *current, const DTTR_Config *base)
Definition defaults.c:166
const DTTR_ConfigChoice * DTTR_Config_ChoiceGet(DTTR_ConfigChoiceList list, int index)
Definition parse.c:203
#define DTTR_CONFIG_DISABLED_MODS_MAX
Definition dttr_config.h:56
const DTTR_ConfigFieldSpec * DTTR_Config_SchemaGet(int index)
Definition schema.c:95
bool DTTR_Config_Save(const char *filename, const DTTR_Config *config)
Saves config values back to a strict JSON file.
Definition io.c:483
bool DTTR_Config_Load(const char *filename)
Loads config values from a strict JSON file into the global config object.
Definition io.c:259
#define DTTR_GAMEPAD_AXIS_MAPPING_COUNT
Definition dttr_config.h:59
bool DTTR_Config_FieldChanged(const DTTR_Config *current, const DTTR_Config *base, const DTTR_ConfigFieldSpec *spec)
Definition schema.c:110
int DTTR_Config_ChoiceCount(DTTR_ConfigChoiceList list)
Definition parse.c:198
const char * label
DTTR_ConfigValueType value_type
const char * section
SDL_GPUFilter present_filter
Definition dttr_config.h:98
DTTR_GraphicsApi graphics_api
Definition dttr_config.h:95
bool gamepad_enabled
int gamepad_button_map[DTTR_GAMEPAD_SOURCE_COUNT]
float mss_sample_preemphasis
char pcdogs_path[MAX_PATH]
Definition dttr_config.h:90
DTTR_VertexPrecision vertex_precision
Definition dttr_config.h:96
bool show_crash_popup
Definition dttr_config.h:88
int gamepad_axes[DTTR_GAMEPAD_AXIS_MAPPING_COUNT]
float mss_sample_gain
int disabled_mod_count
DTTR_MinidumpType minidump_type
Definition dttr_config.h:87
bool generate_texture_mipmaps
char log_file_path[MAX_PATH]
Definition dttr_config.h:89
int schema_major_version
Definition dttr_config.h:85
bool sprite_smooth
Definition dttr_config.h:97
bool skip_intro_movies
Definition dttr_config.h:92
char disabled_mods[DTTR_CONFIG_DISABLED_MODS_MAX][MAX_PATH]
DTTR_ScalingMethod scaling_method
Definition dttr_config.h:94
char saves_path[MAX_PATH]
Definition dttr_config.h:91
int gamepad_axis_deadzone[DTTR_GAMEPAD_AXIS_MAPPING_COUNT]
DTTR_ScalingMode scaling_fit
Definition dttr_config.h:93
bool texture_upload_sync