102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
config_internal.h
Go to the documentation of this file.
1#ifndef DTTR_CONFIG_INTERNAL_H
2#define DTTR_CONFIG_INTERNAL_H
3
4#include <dttr_config.h>
5
6#include <stdbool.h>
7#include <stddef.h>
8#include <string.h>
9
10enum {
23};
24
25#define CONFIG_GAMEPAD_AXIS_FIELDS(X) \
26 X("axis_stick_x", DTTR_GAMEPAD_AXIS_IDX_STICK_X) \
27 X("axis_stick_y", DTTR_GAMEPAD_AXIS_IDX_STICK_Y) \
28 X("axis_camera_rz", DTTR_GAMEPAD_AXIS_IDX_CAMERA_RZ)
29
30#define CONFIG_GAMEPAD_DEADZONE_FIELDS(X) \
31 X("deadzone_stick_x", DTTR_GAMEPAD_AXIS_IDX_STICK_X) \
32 X("deadzone_stick_y", DTTR_GAMEPAD_AXIS_IDX_STICK_Y) \
33 X("deadzone_camera_rz", DTTR_GAMEPAD_AXIS_IDX_CAMERA_RZ)
34
35static inline bool config_sections_match(const char *lhs, const char *rhs) {
36 return lhs == rhs || (lhs && rhs && strcmp(lhs, rhs) == 0);
37}
38
39static inline void config_clear_button_map(int *map) {
40 for (int i = 0; i < DTTR_GAMEPAD_SOURCE_COUNT; i++) {
42 }
43}
44
45const DTTR_ConfigFieldSpec *config_schema_find(const char *section, const char *key);
46
47bool config_parse_bool(const char *value, bool *out_value);
48bool config_parse_scaling_fit(const char *value, DTTR_ScalingMode *out_value);
49bool config_parse_scaling_method(const char *value, DTTR_ScalingMethod *out_value);
50bool config_parse_graphics_api(const char *value, DTTR_GraphicsApi *out_value);
51bool config_parse_int(const char *value, int *out_value);
52bool config_parse_float(const char *value, float *out_value);
53bool config_parse_present_filter(const char *value, SDL_GPUFilter *out_value);
54bool config_parse_gamepad_source(const char *value, int *out_value);
55bool config_parse_game_action(const char *value, int *out_value);
56bool config_parse_gamepad_axis(const char *value, int *out_value);
57bool config_parse_log_level(const char *value, int *out_value);
58bool config_parse_minidump_type(const char *value, DTTR_MinidumpType *out_value);
59bool config_parse_string(const char *value, char *out_value, size_t out_size);
60bool config_parse_vertex_precision(const char *value, DTTR_VertexPrecision *out_value);
61
62void config_format_int(int value, char *buf, size_t buf_size);
63void config_format_float(float value, char *buf, size_t buf_size);
67const char *config_format_present_filter(SDL_GPUFilter filter);
68const char *config_format_log_level(int level);
71const char *config_format_game_action(int action);
72const char *config_format_gamepad_axis(int axis);
74
76 DTTR_Config *config,
77 const char *section,
78 const char *key,
79 const char *value
80);
81
82#endif
const DTTR_PrimitiveType type
static void config_clear_button_map(int *map)
bool config_parse_float(const char *value, float *out_value)
Definition parse.c:369
bool config_parse_game_action(const char *value, int *out_value)
Definition parse.c:322
bool config_apply_entry(DTTR_Config *config, const char *section, const char *key, const char *value)
Definition schema.c:252
bool config_parse_string(const char *value, char *out_value, size_t out_size)
Definition parse.c:386
bool config_parse_scaling_fit(const char *value, DTTR_ScalingMode *out_value)
const char * config_format_graphics_api(DTTR_GraphicsApi api)
const char * config_format_vertex_precision(DTTR_VertexPrecision precision)
bool config_parse_scaling_method(const char *value, DTTR_ScalingMethod *out_value)
bool config_parse_present_filter(const char *value, SDL_GPUFilter *out_value)
const char * config_format_scaling_fit(DTTR_ScalingMode mode)
bool config_parse_minidump_type(const char *value, DTTR_MinidumpType *out_value)
void config_format_int(int value, char *buf, size_t buf_size)
Definition parse.c:404
bool config_parse_graphics_api(const char *value, DTTR_GraphicsApi *out_value)
bool config_parse_bool(const char *value, bool *out_value)
Definition parse.c:242
bool config_parse_int(const char *value, int *out_value)
const DTTR_ConfigFieldSpec * config_schema_find(const char *section, const char *key)
Definition schema.c:173
const char * config_format_minidump_type(DTTR_MinidumpType type)
@ CONFIG_VERTEX_PRECISION
@ CONFIG_SCALING_FIT
@ CONFIG_MINIDUMP_TYPE
@ CONFIG_STRING
@ CONFIG_PRESENT_FILTER
@ CONFIG_GRAPHICS_API
@ CONFIG_LOG_LEVEL
@ CONFIG_INT
@ CONFIG_FLOAT
@ CONFIG_GAMEPAD_AXIS
@ CONFIG_BOOL
@ CONFIG_SCALING_METHOD
const char * config_format_present_filter(SDL_GPUFilter filter)
const char * config_format_gamepad_axis(int axis)
const char * config_format_game_action(int action)
const char * config_format_gamepad_source(int source)
bool config_parse_log_level(const char *value, int *out_value)
Definition parse.c:330
static bool config_sections_match(const char *lhs, const char *rhs)
bool config_parse_vertex_precision(const char *value, DTTR_VertexPrecision *out_value)
bool config_parse_gamepad_axis(const char *value, int *out_value)
Definition parse.c:326
void config_format_float(float value, char *buf, size_t buf_size)
Definition parse.c:408
bool config_parse_gamepad_source(const char *value, int *out_value)
Definition parse.c:311
const char * config_format_scaling_method(DTTR_ScalingMethod method)
const char * config_format_log_level(int level)
DTTR_VertexPrecision
Definition dttr_config.h:43
DTTR_GraphicsApi
Definition dttr_config.h:36
@ 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
DTTR_ScalingMethod
Definition dttr_config.h:20
#define DTTR_GAMEPAD_SOURCE_COUNT
Definition dttr_config.h:53
#define DTTR_GAMEPAD_MAPPING_NONE
Definition dttr_config.h:48
DTTR_MinidumpType
Definition dttr_config.h:25
DTTR_ScalingMode
Definition dttr_config.h:14
static game_data_source source
Definition game_data.c:21