102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
defaults.c File Reference
#include "config_internal.h"
#include <dttr_config.h>
#include <dttr_log.h>
#include <dttr_path.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  default_gamepad_binding

Functions

void DTTR_Config_ClearGamepadButtonMap (int *map)
static int find_disabled_mod (const DTTR_Config *config, const char *mod_filename)
bool DTTR_Config_IsModDisabled (const DTTR_Config *config, const char *mod_filename)
static void remove_disabled_mod (DTTR_Config *config, int index)
static bool add_disabled_mod (DTTR_Config *config, const char *mod_filename)
bool DTTR_Config_SetModEnabled (DTTR_Config *config, const char *mod_filename, bool enabled)
bool DTTR_Config_DisabledModsChanged (const DTTR_Config *current, const DTTR_Config *base)
static void set_default_button_map (int *map)
const char * DTTR_Config_GraphicsAPIName (DTTR_GraphicsApi api)
 Returns the config token for a graphics API selection.
void DTTR_Config_SetDefaults (DTTR_Config *config)
 Resets a config object to built-in defaults.

Variables

static const DTTR_Config default_config
DTTR_Config dttr_config
static const default_gamepad_binding default_button_map []

Function Documentation

◆ add_disabled_mod()

bool add_disabled_mod ( DTTR_Config * config,
const char * mod_filename )
static

◆ DTTR_Config_ClearGamepadButtonMap()

void DTTR_Config_ClearGamepadButtonMap ( int * map)

Definition at line 72 of file defaults.c.

References config_clear_button_map().

Referenced by set_default_button_map(), and sync_config_from_rows().

◆ DTTR_Config_DisabledModsChanged()

bool DTTR_Config_DisabledModsChanged ( const DTTR_Config * current,
const DTTR_Config * base )

◆ DTTR_Config_GraphicsAPIName()

const char * DTTR_Config_GraphicsAPIName ( DTTR_GraphicsApi api)

Returns the config token for a graphics API selection.

Definition at line 192 of file defaults.c.

References config_format_graphics_api().

Referenced by dttr_graphics_init().

◆ DTTR_Config_IsModDisabled()

bool DTTR_Config_IsModDisabled ( const DTTR_Config * config,
const char * mod_filename )

Definition at line 98 of file defaults.c.

References find_disabled_mod().

Referenced by draw_mod_toggle_row(), DTTR_Config_DisabledModsChanged(), and scan_mod_file().

◆ DTTR_Config_SetDefaults()

void DTTR_Config_SetDefaults ( DTTR_Config * config)

Resets a config object to built-in defaults.

Definition at line 196 of file defaults.c.

References default_config, DTTR_Config::gamepad_button_map, and set_default_button_map().

Referenced by DTTR_Config_Load(), init_state_from_args(), and reset_defaults().

◆ DTTR_Config_SetModEnabled()

bool DTTR_Config_SetModEnabled ( DTTR_Config * config,
const char * mod_filename,
bool enabled )

◆ find_disabled_mod()

int find_disabled_mod ( const DTTR_Config * config,
const char * mod_filename )
static

◆ remove_disabled_mod()

void remove_disabled_mod ( DTTR_Config * config,
int index )
static

Definition at line 102 of file defaults.c.

References DTTR_Config::disabled_mod_count, and DTTR_Config::disabled_mods.

Referenced by DTTR_Config_SetModEnabled().

◆ set_default_button_map()

void set_default_button_map ( int * map)
static

Definition at line 184 of file defaults.c.

References default_button_map, and DTTR_Config_ClearGamepadButtonMap().

Referenced by DTTR_Config_SetDefaults().

Variable Documentation

◆ default_button_map

const default_gamepad_binding default_button_map[]
static
Initial value:
= {
{SDL_GAMEPAD_BUTTON_SOUTH, PCDOGS_GAMEPAD_IDX_BTN_0},
{SDL_GAMEPAD_BUTTON_EAST, PCDOGS_GAMEPAD_IDX_BTN_1},
{SDL_GAMEPAD_BUTTON_WEST, PCDOGS_GAMEPAD_IDX_BTN_2},
{SDL_GAMEPAD_BUTTON_NORTH, PCDOGS_GAMEPAD_IDX_BTN_3},
{SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, PCDOGS_GAMEPAD_IDX_BTN_4},
{SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, PCDOGS_GAMEPAD_IDX_BTN_5},
{SDL_GAMEPAD_BUTTON_BACK, PCDOGS_GAMEPAD_IDX_BTN_6},
{SDL_GAMEPAD_BUTTON_START, PCDOGS_GAMEPAD_IDX_BTN_8},
{SDL_GAMEPAD_BUTTON_DPAD_UP, PCDOGS_GAMEPAD_IDX_UP},
{SDL_GAMEPAD_BUTTON_DPAD_DOWN, PCDOGS_GAMEPAD_IDX_DOWN},
{SDL_GAMEPAD_BUTTON_DPAD_LEFT, PCDOGS_GAMEPAD_IDX_LEFT},
{SDL_GAMEPAD_BUTTON_DPAD_RIGHT, PCDOGS_GAMEPAD_IDX_RIGHT},
}
#define PCDOGS_GAMEPAD_IDX_BTN_1
Definition dttr_config.h:71
#define DTTR_GAMEPAD_SOURCE_TRIGGER_RIGHT
Definition dttr_config.h:52
#define PCDOGS_GAMEPAD_IDX_BTN_4
Definition dttr_config.h:74
#define PCDOGS_GAMEPAD_IDX_BTN_5
Definition dttr_config.h:75
#define DTTR_GAMEPAD_SOURCE_TRIGGER_LEFT
Definition dttr_config.h:51
#define PCDOGS_GAMEPAD_IDX_BTN_6
Definition dttr_config.h:76
#define PCDOGS_GAMEPAD_IDX_BTN_3
Definition dttr_config.h:73
#define PCDOGS_GAMEPAD_IDX_BTN_0
Definition dttr_config.h:70
#define PCDOGS_GAMEPAD_IDX_BTN_8
Definition dttr_config.h:78
#define PCDOGS_GAMEPAD_IDX_UP
Definition dttr_config.h:64
#define PCDOGS_GAMEPAD_IDX_BTN_2
Definition dttr_config.h:72
#define PCDOGS_GAMEPAD_IDX_LEFT
Definition dttr_config.h:66
#define PCDOGS_GAMEPAD_IDX_RIGHT
Definition dttr_config.h:67
#define PCDOGS_GAMEPAD_IDX_DOWN
Definition dttr_config.h:65

Definition at line 55 of file defaults.c.

Referenced by set_default_button_map().

◆ default_config

const DTTR_Config default_config
static

Definition at line 13 of file defaults.c.

Referenced by DTTR_Config_SetDefaults().

◆ dttr_config