102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
gui_state.c File Reference
#include "gui_internal.h"

Go to the source code of this file.

Functions

const char * game_action_tooltip (int action)
static void clear_mods_dir (config_ui_state *state)
static bool button_source_in_range (int source)
static void refresh_button_rows (config_ui_state *state)
static bool button_action_in_range (int action)
static int source_for_action (const int *map, int action)
int gamepad_button_row_count ()
static const DTTR_ConfigChoicegamepad_button_row_choice (int row)
int gamepad_button_row_action (int row)
const char * gamepad_button_row_label (int row)
int gamepad_default_source_for_action (const config_ui_state *state, int action)
void set_status (config_ui_state *state, const char *status)
void set_mods_dir_from_config_path (config_ui_state *state)
void sync_rows_from_config (config_ui_state *state)
bool event_cancels_binding (const SDL_Event *event)
void cancel_binding (config_ui_state *state)
void capture_source (config_ui_state *state, int new_source)
void sync_config_from_rows (config_ui_state *state)
void load_config (config_ui_state *state)
void save_config (config_ui_state *state)
void reset_defaults (config_ui_state *state)
void request_reset_defaults (const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
config_label_state make_config_label_state (bool unsaved_changed, bool default_changed)
bool gamepad_button_rows_have_unsaved_changes (const config_ui_state *state)
config_label_state gamepad_button_label_state (const config_ui_state *state, int source, int action)
bool config_has_unsaved_changes (const config_ui_state *state)

Variables

static const char *const GAME_ACTION_TOOLTIPS []

Function Documentation

◆ button_action_in_range()

bool button_action_in_range ( int action)
static

Definition at line 47 of file gui_state.c.

References PCDOGS_GAMEPAD_IDX_BTN_12, and PCDOGS_GAMEPAD_IDX_UP.

Referenced by source_for_action().

◆ button_source_in_range()

bool button_source_in_range ( int source)
static

Definition at line 38 of file gui_state.c.

References DTTR_GAMEPAD_SOURCE_COUNT, and source.

Referenced by capture_source(), and sync_config_from_rows().

◆ cancel_binding()

void cancel_binding ( config_ui_state * state)

Definition at line 140 of file gui_state.c.

References set_status(), and state.

Referenced by process_events().

◆ capture_source()

void capture_source ( config_ui_state * state,
int new_source )

Definition at line 149 of file gui_state.c.

References button_source_in_range(), gamepad_button_row_count(), set_status(), and state.

Referenced by process_events().

◆ clear_mods_dir()

void clear_mods_dir ( config_ui_state * state)
static

Definition at line 36 of file gui_state.c.

References state.

Referenced by set_mods_dir_from_config_path().

◆ config_has_unsaved_changes()

bool config_has_unsaved_changes ( const config_ui_state * state)

◆ event_cancels_binding()

bool event_cancels_binding ( const SDL_Event * event)

Definition at line 135 of file gui_state.c.

References event.

Referenced by process_events().

◆ game_action_tooltip()

const char * game_action_tooltip ( int action)

Definition at line 26 of file gui_state.c.

References DTTR_GAMEPAD_MAPPING_NONE, and GAME_ACTION_TOOLTIPS.

Referenced by draw_gamepad_button_row().

◆ gamepad_button_label_state()

config_label_state gamepad_button_label_state ( const config_ui_state * state,
int source,
int action )

Definition at line 269 of file gui_state.c.

References make_config_label_state(), source, source_for_action(), and state.

Referenced by draw_gamepad_button_row().

◆ gamepad_button_row_action()

int gamepad_button_row_action ( int row)

◆ gamepad_button_row_choice()

const DTTR_ConfigChoice * gamepad_button_row_choice ( int row)
static

◆ gamepad_button_row_count()

◆ gamepad_button_row_label()

const char * gamepad_button_row_label ( int row)

◆ gamepad_button_rows_have_unsaved_changes()

bool gamepad_button_rows_have_unsaved_changes ( const config_ui_state * state)

Definition at line 254 of file gui_state.c.

References gamepad_button_row_count(), source_for_action(), and state.

Referenced by config_has_unsaved_changes().

◆ gamepad_default_source_for_action()

int gamepad_default_source_for_action ( const config_ui_state * state,
int action )

Definition at line 88 of file gui_state.c.

References DTTR_GAMEPAD_MAPPING_NONE, source_for_action(), and state.

Referenced by draw_gamepad_button_row().

◆ load_config()

◆ make_config_label_state()

config_label_state make_config_label_state ( bool unsaved_changed,
bool default_changed )

◆ refresh_button_rows()

void refresh_button_rows ( config_ui_state * state)
static

Definition at line 42 of file gui_state.c.

References state, and sync_rows_from_config().

Referenced by load_config(), and reset_defaults().

◆ request_reset_defaults()

void request_reset_defaults ( const DTTR_ImGuiDialogContext * ctx,
config_ui_state * state )

Definition at line 223 of file gui_state.c.

References ctx, DTTR_SDL_ShowMessageBox(), NULL, reset_defaults(), and state.

Referenced by draw_toolbar().

◆ reset_defaults()

void reset_defaults ( config_ui_state * state)

Definition at line 217 of file gui_state.c.

References DTTR_Config_SetDefaults(), refresh_button_rows(), set_status(), and state.

Referenced by request_reset_defaults().

◆ save_config()

void save_config ( config_ui_state * state)

Definition at line 205 of file gui_state.c.

References DTTR_Config_Save(), set_status(), state, and sync_config_from_rows().

Referenced by draw_toolbar(), and handle_shortcuts().

◆ set_mods_dir_from_config_path()

void set_mods_dir_from_config_path ( config_ui_state * state)

◆ set_status()

◆ source_for_action()

◆ sync_config_from_rows()

void sync_config_from_rows ( config_ui_state * state)

◆ sync_rows_from_config()

Variable Documentation

◆ GAME_ACTION_TOOLTIPS

const char* const GAME_ACTION_TOOLTIPS[]
static
Initial value:
= {
"Disables this gamepad action.",
"Moves up.",
"Moves down.",
"Moves left.",
"Moves right.",
"Activates POV up.",
"Activates POV down.",
"Acts as joy_1. In menus, joy_1 is the confirm button.",
"Acts as joy_2. In menus, joy_2 is the back button.",
"Acts as joy_3.",
"Acts as joy_4.",
"Acts as joy_5.",
"Acts as joy_6.",
"Acts as joy_7.",
"Acts as joy_8.",
"Acts as joy_9. joy_9 is the start/pause button.",
"Acts as joy_10.",
"Acts as joy_11.",
"Acts as joy_12.",
"Acts as joy_13.",
}

Definition at line 3 of file gui_state.c.

Referenced by game_action_tooltip().