51 const float content_width = fmaxf(
59 for (
int i = 0; i < choice_count; i++) {
60 if (choices[i].value == value) {
72 const char *
const *tooltips
76 const int current =
choice_index(choice_list, choice_count, *value);
77 const char *preview = choice_count > 0 ? choice_list[current].
label :
"Unknown";
78 const ImVec2_c combo_popup_padding = {
79 igGetStyle()->WindowPadding.x,
83 igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, combo_popup_padding);
84 const bool open = igBeginCombo(label, preview, ImGuiComboFlags_None);
93 for (
int i = 0; i < choice_count; i++) {
94 const bool selected = i == current;
96 if (igSelectable_Bool(
99 ImGuiSelectableFlags_None,
100 (ImVec2_c){0.0f, 0.0f}
102 *value = choice_list[i].
value;
114 if (!start || start == end) {
118 igTextWrapped(
"%.*s", (
int)(end - start), start);
122 if (!start || start == end) {
126 igSameLine(0.0f, 0.0f);
127 igTextUnformatted(start, end);
131 if (!start || start == end) {
135 igSameLine(0.0f, 0.0f);
145 const char *default_value_start,
146 const char *default_value_end
148 const char *release_suffix = strstr(default_value_start,
" (release), ");
150 if (release_suffix && release_suffix < default_value_end) {
151 const char *debug_start = release_suffix + strlen(
" (release), ");
152 const char *debug_suffix = strstr(debug_start,
" (debug)");
154 if (debug_suffix && debug_suffix < default_value_end) {
167 if (!text || !text[0]) {
171 const ImVec2_c tooltip_padding = {
172 igGetStyle()->WindowPadding.x,
176 igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, tooltip_padding);
178 if (!igBeginItemTooltip()) {
184 const char *default_text = strstr(text,
"Default:");
187 const char *default_value_start = default_text + strlen(
"Default:");
189 while (*default_value_start ==
' ') {
190 default_value_start++;
193 const char *description_end = default_text;
194 while (description_end > text && description_end[-1] ==
' ') {
198 const char *default_value_end = default_value_start + strlen(default_value_start);
200 if (default_value_end > default_value_start && default_value_end[-1] ==
'.') {
208 if (*default_value_end) {
209 igSameLine(0.0f, 0.0f);
210 igTextUnformatted(default_value_end,
NULL);
213 igTextWrapped(
"%s", text);
227 const ImVec2_c
size = {
279 const bool status_visible =
state->status[0]
280 && SDL_GetTicks() <
state->status_expires_at_ms;
282 if (!changed && !status_visible) {
283 if (buffer_size > 0) {
290 if (changed && status_visible) {
291 snprintf(buffer, buffer_size,
"Unsaved changes.\n%s",
state->status);
292 }
else if (changed) {
293 snprintf(buffer, buffer_size,
"Unsaved changes.");
295 snprintf(buffer, buffer_size,
"%s",
state->status);
302 if (!status_text || !status_text[0]) {
308 for (
const char *p = status_text; *p; p++) {
314 return igGetTextLineHeight()
315 + (
float)(line_count - 1) * igGetTextLineHeightWithSpacing();
322 char status_text[
sizeof(
state->status) +
sizeof(
"Unsaved changes.\n")];
324 float height = igGetTextLineHeight();
338 const ImGuiWindowFlags content_flags = ImGuiWindowFlags_NoScrollbar
339 | ImGuiWindowFlags_NoScrollWithMouse;
340 return igBeginChild_Str(
342 (ImVec2_c){0.0f, -footer_height},
343 ImGuiChildFlags_None,
351 char status_text[
sizeof(
state->status) +
sizeof(
"Unsaved changes.\n")];
354 igTextWrapped(
"%s", status_text);
364 const ImVec2_c padding = {
369 const ImVec2_c item_spacing = {
374 igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, padding);
375 igPushStyleVar_Vec2(ImGuiStyleVar_ItemSpacing, item_spacing);
376 const ImGuiWindowFlags panel_flags = ImGuiWindowFlags_NoScrollbar
377 | ImGuiWindowFlags_NoScrollWithMouse;
378 return igBeginChild_Str(
380 (ImVec2_c){0.0f, 0.0f},
381 ImGuiChildFlags_AlwaysUseWindowPadding,
402 float cell_padding_x,
406 ImGuiStyleVar_CellPadding,
410 ImGuiStyleVar_ItemSpacing,
411 (ImVec2_c){igGetStyle()->ItemSpacing.x, 0.0f}
418 (ImVec2_c){table_width, 0.0f},
431 ImGuiTableColumnFlags
flags,
442 if (!igTableSetColumnIndex(column)) {
450 igTextUnformatted(text,
NULL);
454 igTableNextRow(ImGuiTableRowFlags_Headers, 0.0f);
456 ImGuiTableBgTarget_RowBg0,
457 igGetColorU32_Col(ImGuiCol_TableHeaderBg, 1.0f),
477 ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_IndentDisable
478 | ImGuiTableColumnFlags_NoHeaderLabel,
484 ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_NoHeaderLabel,
527 "##gamepad_button_table",
538 ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_IndentDisable
539 | ImGuiTableColumnFlags_NoHeaderLabel,
545 ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_NoHeaderLabel,
551 ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderLabel
552 | ImGuiTableColumnFlags_NoHeaderWidth,
558 ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderLabel
559 | ImGuiTableColumnFlags_NoHeaderWidth,
565 ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderLabel
566 | ImGuiTableColumnFlags_NoHeaderWidth,
583 const float available = igGetContentRegionAvail().x;
595 const float text_width = width > trailing_width + 1.0f ? width - trailing_width
597 return text_width > 1.0f ? text_width : 1.0f;
601 switch (label_state) {
633 igAlignTextToFramePadding();
662 for (
int i = 0; i < button_count; i++) {
663 if (!buttons[i].open_dialog) {
673 buttons[i].open_dialog
693 const bool edited = igInputText(
697 ImGuiInputTextFlags_None,
717 const bool edited = igInputText(
721 ImGuiInputTextFlags_None,
743 "Select an extracted or installed game directory.",
749 "Select an original game ISO.",
764 (
int)SDL_arraysize(buttons)
782 "Select a DttR log file path.",
797 (
int)SDL_arraysize(buttons)
813 const bool edited = igInputInt(
id, value, step, step_fast, ImGuiInputTextFlags_None);
828 const bool edited = igInputFloat(
834 ImGuiInputTextFlags_None
850 const bool edited = igCheckbox(
id, value);
861 const char *
const *tooltips,
867 const bool edited =
choice_combo(
id, value, choices, tooltips);
DTTR_Graphics_COM_Direct3DDevice7 DWORD block DTTR_Graphics_COM_Direct3DDevice7 DWORD block DTTR_Graphics_COM_Direct3DDevice7 void void void void DWORD f DTTR_Graphics_COM_Direct3DDevice7 DWORD idx float
const DTTR_BackendState * state
DTTR_Graphics_COM_Direct3DDevice7 void DWORD flags DWORD void DWORD DWORD color
DTTR_Graphics_COM_Direct3DDevice7 void DWORD flags DWORD void DWORD flags
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void *cb void * target
const DTTR_ConfigChoice * DTTR_Config_Choices(DTTR_ConfigChoiceList list, int *count)
float DTTR_ImGuiDialog_ScaledFloat(const DTTR_ImGuiDialogContext *ctx, float value)
bool DTTR_ImGuiDialog_Button(const DTTR_ImGuiDialogContext *ctx, const char *id, const char *label, ImVec2_c size)
#define DTTR_IMGUI_COLOR_BUTTON_BG
#define DTTR_IMGUI_COLOR_BUTTON_BG_HOVERED
#define DTTR_IMGUI_COLOR_STACK_FRAME_BG
#define DTTR_IMGUI_COLOR_BUTTON_BG_ACTIVE
void open_log_file_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void open_pcdogs_iso_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
void open_pcdogs_dir_dialog(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
#define DTTR_CONFIG_UI_PATH_BUTTON_W
#define DTTR_CONFIG_UI_SEPARATOR_COLOR
#define DTTR_CONFIG_UI_PATH_BUTTON_SPACING
#define DTTR_CONFIG_UI_GAMEPAD_SOURCE_W
#define DTTR_CONFIG_UI_BORDER_COLOR
@ CONFIG_LABEL_SAVED_CHANGED
bool config_has_unsaved_changes(const config_ui_state *state)
#define DTTR_CONFIG_UI_HINT_TEXT_COLOR
#define DTTR_CONFIG_UI_HEADER_TEXT_INSET_X
#define DTTR_CONFIG_UI_STATUS_TEXT_COLOR
#define DTTR_CONFIG_UI_TABLE_CELL_PADDING_X
#define DTTR_CONFIG_UI_SELECTED_TAB_BG
#define DTTR_CONFIG_UI_PATH_INPUT_W
#define DTTR_CONFIG_UI_SAVED_CHANGED_LABEL_TEXT_COLOR
#define DTTR_CONFIG_UI_TABLE_CELL_PADDING_Y
#define DTTR_CONFIG_UI_PANEL_PADDING_Y
#define DTTR_CONFIG_UI_LABEL_W
#define DTTR_CONFIG_UI_GAMEPAD_BUTTON_W
#define DTTR_CONFIG_UI_PANEL_PADDING_X
#define DTTR_CONFIG_UI_COMBO_POPUP_PADDING_Y
#define DTTR_CONFIG_UI_CHANGED_LABEL_TEXT_COLOR
#define DTTR_CONFIG_UI_INPUT_W
#define DTTR_CONFIG_UI_LABEL_TEXT_COLOR
#define DTTR_CONFIG_UI_ITEM_SPACING_X
#define DTTR_CONFIG_UI_TOOLTIP_PADDING_Y
#define DTTR_CONFIG_UI_TABLE_BORDER_COLOR
#define DTTR_CONFIG_UI_TOOLTIP_WRAP_W
#define CONFIG_TABLE_FLAGS
#define DTTR_CONFIG_UI_ITEM_SPACING_Y
#define DTTR_CONFIG_UI_TOOLTIP_DEFAULT_TEXT_COLOR