1#ifndef DTTR_CONFIG_TOOL_INTERNAL_H
2#define DTTR_CONFIG_TOOL_INTERNAL_H
15#define DTTR_CONFIG_UI_WINDOW_H 550
16#define DTTR_CONFIG_UI_LABEL_W 170.0f
17#define DTTR_CONFIG_UI_INPUT_W 285.0f
18#define DTTR_CONFIG_UI_PATH_INPUT_W 160.0f
19#define DTTR_CONFIG_UI_PATH_BUTTON_W 70.0f
20#define DTTR_CONFIG_UI_GAMEPAD_SOURCE_W 135.0f
21#define DTTR_CONFIG_UI_GAMEPAD_BUTTON_W 58.0f
22#define DTTR_CONFIG_UI_PANEL_PADDING_X 7.5f
23#define DTTR_CONFIG_UI_PANEL_PADDING_Y 14.0f
24#define DTTR_CONFIG_UI_ITEM_SPACING_X 8.0f
25#define DTTR_CONFIG_UI_ITEM_SPACING_Y 6.0f
26#define DTTR_CONFIG_UI_TABLE_CELL_PADDING_X 8.0f
27#define DTTR_CONFIG_UI_TABLE_CELL_PADDING_Y 4.0f
28#define DTTR_CONFIG_UI_HEADER_TEXT_INSET_X 2.0f
29#define DTTR_CONFIG_UI_COMBO_POPUP_PADDING_Y 0.0f
30#define DTTR_CONFIG_UI_SECTION_SPACING 10.0f
31#define DTTR_CONFIG_UI_LABEL_TEXT_COLOR ((ImVec4_c){0.72f, 0.50f, 0.95f, 1.0f})
32#define DTTR_CONFIG_UI_CHANGED_LABEL_TEXT_COLOR ((ImVec4_c){1.0f, 0.82f, 0.25f, 1.0f})
33#define DTTR_CONFIG_UI_SAVED_CHANGED_LABEL_TEXT_COLOR \
34 ((ImVec4_c){0.48f, 0.78f, 1.0f, 1.0f})
35#define DTTR_CONFIG_UI_TOOLTIP_DEFAULT_TEXT_COLOR ((ImVec4_c){0.48f, 0.90f, 0.48f, 1.0f})
36#define DTTR_CONFIG_UI_SELECTED_TAB_BG ((ImVec4_c){0.115f, 0.130f, 0.150f, 1.0f})
37#define DTTR_CONFIG_UI_BORDER_COLOR ((ImVec4_c){0.105f, 0.115f, 0.125f, 1.0f})
38#define DTTR_CONFIG_UI_TABLE_BORDER_COLOR ((ImVec4_c){0.135f, 0.145f, 0.155f, 1.0f})
39#define DTTR_CONFIG_UI_SEPARATOR_COLOR ((ImVec4_c){0.120f, 0.130f, 0.140f, 1.0f})
40#define DTTR_CONFIG_UI_PATH_BUTTON_SPACING 4.0f
41#define DTTR_CONFIG_UI_STATUS_TEXT_COLOR ((ImVec4_c){1.0f, 0.82f, 0.25f, 1.0f})
42#define DTTR_CONFIG_UI_HINT_TEXT_COLOR ((ImVec4_c){0.72f, 0.74f, 0.78f, 1.0f})
43#define DTTR_CONFIG_UI_WARNING_TEXT_COLOR ((ImVec4_c){1.0f, 0.55f, 0.18f, 1.0f})
44#define DTTR_CONFIG_UI_STATUS_TIMEOUT_MS 5000
45#define DTTR_CONFIG_UI_HEADER_TOP_SPACING 0.0f
46#define DTTR_CONFIG_UI_TOOLTIP_PADDING_Y 4.0f
47#define DTTR_CONFIG_UI_TOOLTIP_WRAP_W 360.0f
49#define CONFIG_TABLE_FLAGS \
50 (ImGuiTableFlags_BordersInnerH | ImGuiTableFlags_BordersOuterH \
51 | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoSavedSettings \
52 | ImGuiTableFlags_PadOuterX)
55#define DTTR_VERSION "unknown"
78#define FIELD_DIFFERS(state, base, field) \
79 (memcmp(&(state)->config.field, &(state)->base.field, sizeof((state)->config.field)) \
81#define FIELD_UNSAVED(state, field) FIELD_DIFFERS(state, saved_config, field)
82#define FIELD_DEFAULT_CHANGED(state, field) FIELD_DIFFERS(state, defaults, field)
83#define PATH_FIELD_DIFFERS(state, base, field) \
84 (!DTTR_Path_MatchesNormalized((state)->config.field, (state)->base.field))
85#define PATH_FIELD_UNSAVED(state, field) PATH_FIELD_DIFFERS(state, saved_config, field)
86#define PATH_FIELD_DEFAULT_CHANGED(state, field) \
87 PATH_FIELD_DIFFERS(state, defaults, field)
88#define FIELD_LABEL_STATE(state, field) \
89 make_config_label_state( \
90 FIELD_UNSAVED(state, field), \
91 FIELD_DEFAULT_CHANGED(state, field) \
93#define PATH_FIELD_LABEL_STATE(state, field) \
94 make_config_label_state( \
95 PATH_FIELD_UNSAVED(state, field), \
96 PATH_FIELD_DEFAULT_CHANGED(state, field) \
130 const char *
const *tooltips
238 const char *
const *tooltips,
const DTTR_BackendState * state
void void DWORD HANDLE event
#define DTTR_GAMEPAD_SOURCE_COUNT
union SDL_Event SDL_Event
static game_data_source source
void capture_source(config_ui_state *state, int new_source)
float path_text_input_width(const DTTR_ImGuiDialogContext *ctx, int button_count)
const char * source_tooltip(int source)
bool gamepad_button_rows_have_unsaved_changes(const config_ui_state *state)
void load_config(config_ui_state *state)
bool choice_combo(const char *label, int *value, DTTR_ConfigChoiceList choices, const char *const *tooltips)
int gamepad_default_source_for_action(const config_ui_state *state, int action)
void set_mods_dir_from_config_path(config_ui_state *state)
bool begin_settings_table_with_width(const DTTR_ImGuiDialogContext *ctx, const char *id, float label_width, float input_width, float table_width)
float table_input_width(const DTTR_ImGuiDialogContext *ctx, float input_width)
bool begin_padded_panel(const DTTR_ImGuiDialogContext *ctx)
bool labeled_input_float(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, float *value, const char *tooltip, config_label_state label_state)
const char * source_label(int source)
@ CONFIG_LABEL_SAVED_CHANGED
bool themed_row_button(const DTTR_ImGuiDialogContext *ctx, const char *id, const char *label, float width)
void sync_config_from_rows(config_ui_state *state)
config_label_state make_config_label_state(bool unsaved_changed, bool default_changed)
void same_path_button_row(const DTTR_ImGuiDialogContext *ctx)
bool begin_gamepad_button_table(const DTTR_ImGuiDialogContext *ctx)
const char * gamepad_button_row_label(int row)
bool config_has_unsaved_changes(const config_ui_state *state)
bool labeled_input_int(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, int *value, int step, int step_fast, const char *tooltip, config_label_state label_state)
bool labeled_checkbox(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, bool *value, const char *tooltip, config_label_state label_state)
bool begin_settings_table(const DTTR_ImGuiDialogContext *ctx, const char *id, float label_width, float input_width)
void save_config(config_ui_state *state)
bool begin_config_content_region(const DTTR_ImGuiDialogContext *ctx, const config_ui_state *state)
void draw_config_label(const char *label, const char *tooltip, config_label_state label_state)
void draw_tabs(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void draw_general_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void show_tooltip(const char *text)
void add_scaled_vertical_spacing(const DTTR_ImGuiDialogContext *ctx, float height)
void draw_footer_text(const DTTR_ImGuiDialogContext *ctx, const config_ui_state *state)
void draw_audio_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void begin_config_table_row()
void sync_rows_from_config(config_ui_state *state)
void end_settings_table()
void cancel_binding(config_ui_state *state)
int source_from_event(const SDL_Event *event)
void draw_gamepad_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
int gamepad_button_row_action(int row)
void request_reset_defaults(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void open_log_file_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
bool labeled_log_path_picker(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state, const char *label, const char *id, char *buf, size_t buf_size, const char *tooltip, config_label_state label_state)
int config_window_width()
float config_standard_input_width()
bool begin_tab_settings_table(const DTTR_ImGuiDialogContext *ctx, const char *id, float input_width)
bool event_cancels_binding(const SDL_Event *event)
bool labeled_input_text(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, char *buf, size_t buf_size, const char *tooltip, config_label_state label_state)
int gamepad_button_row_count()
void open_pcdogs_iso_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
config_label_state gamepad_button_label_state(const config_ui_state *state, int source, int action)
void end_config_content_region()
bool labeled_path_picker(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state, const char *label, const char *id, char *buf, size_t buf_size, const char *tooltip, config_label_state label_state)
void open_pcdogs_dir_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
bool labeled_choice_combo(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, int *value, DTTR_ConfigChoiceList choices, const char *const *tooltips, const char *tooltip, config_label_state label_state)
void draw_modding_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void reset_defaults(config_ui_state *state)
void set_status(config_ui_state *state, const char *status)
const char * game_action_tooltip(int action)
float config_footer_height(const DTTR_ImGuiDialogContext *ctx, const config_ui_state *state)
void draw_graphics_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
Uint64 status_expires_at_ms
int button_actions[DTTR_GAMEPAD_SOURCE_COUNT]
int button_sources[DTTR_GAMEPAD_SOURCE_COUNT]