mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-20 01:43:37 +00:00
Move bool settings
This commit is contained in:
parent
9e7ac432c3
commit
3e24672a43
@ -273,7 +273,7 @@ static bool audio_driver_deinit_internal(void)
|
||||
|
||||
audio_driver_rewind_size = 0;
|
||||
|
||||
if (settings && !settings->audio.enable)
|
||||
if (settings && !settings->bools.audio_enable)
|
||||
{
|
||||
audio_driver_active = false;
|
||||
return false;
|
||||
@ -338,7 +338,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
audio_driver_rewind_buf = rewind_buf;
|
||||
audio_driver_rewind_size = max_bufsamples;
|
||||
|
||||
if (!settings->audio.enable)
|
||||
if (!settings->bools.audio_enable)
|
||||
{
|
||||
audio_driver_active = false;
|
||||
return false;
|
||||
@ -368,7 +368,8 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
audio_driver_context_audio_data =
|
||||
current_audio->init(*settings->audio.device ?
|
||||
settings->audio.device : NULL,
|
||||
settings->audio.out_rate, settings->audio.latency,
|
||||
settings->audio.out_rate,
|
||||
settings->audio.latency,
|
||||
settings->audio.block_frames,
|
||||
&new_rate);
|
||||
}
|
||||
@ -389,7 +390,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
&& current_audio->use_float(audio_driver_context_audio_data))
|
||||
audio_driver_use_float = true;
|
||||
|
||||
if (!settings->audio.sync && audio_driver_active)
|
||||
if (!settings->bools.audio_sync && audio_driver_active)
|
||||
{
|
||||
command_event(CMD_EVENT_AUDIO_SET_NONBLOCKING_STATE, NULL);
|
||||
audio_driver_chunk_size = audio_driver_chunk_nonblock_size;
|
||||
@ -442,7 +443,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
if (
|
||||
!audio_cb_inited
|
||||
&& audio_driver_active
|
||||
&& settings->audio.rate_control
|
||||
&& settings->bools.audio_rate_control
|
||||
)
|
||||
{
|
||||
/* Audio rate control requires write_avail
|
||||
@ -481,8 +482,9 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
audio_driver_active
|
||||
&& audio_driver_context_audio_data
|
||||
)
|
||||
current_audio->set_nonblock_state(audio_driver_context_audio_data,
|
||||
settings->audio.sync ? enable : true);
|
||||
current_audio->set_nonblock_state(
|
||||
audio_driver_context_audio_data,
|
||||
settings->bools.audio_sync ? enable : true);
|
||||
|
||||
audio_driver_chunk_size = enable ?
|
||||
audio_driver_chunk_nonblock_size :
|
||||
@ -523,7 +525,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
|
||||
&is_perfcnt_enable);
|
||||
|
||||
if (is_paused || settings->audio.mute_enable)
|
||||
if (is_paused || settings->bools.audio_mute_enable)
|
||||
return true;
|
||||
if (!audio_driver_active || !audio_driver_input_data)
|
||||
return false;
|
||||
@ -932,14 +934,14 @@ bool audio_driver_has_callback(void)
|
||||
bool audio_driver_toggle_mute(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool new_mute_state = !settings->audio.mute_enable;
|
||||
bool new_mute_state = !settings->bools.audio_mute_enable;
|
||||
if (!audio_driver_context_audio_data)
|
||||
return false;
|
||||
if (!audio_driver_active)
|
||||
return false;
|
||||
|
||||
configuration_set_bool(settings,
|
||||
settings->audio.mute_enable, new_mute_state);
|
||||
settings->bools.audio_mute_enable, new_mute_state);
|
||||
|
||||
if (new_mute_state)
|
||||
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
||||
|
@ -503,10 +503,10 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
UINT32 frame_count = 0;
|
||||
BYTE *dest = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool float_format = settings->audio.wasapi.float_format;
|
||||
bool float_format = settings->bools.audio_wasapi_float_format;
|
||||
unsigned sh_buffer_length = settings->audio.wasapi.sh_buffer_length;
|
||||
wasapi_t *w = (wasapi_t*)calloc(1, sizeof(wasapi_t));
|
||||
w->exclusive = settings->audio.wasapi.exclusive_mode;
|
||||
w->exclusive = settings->bools.audio_wasapi_exclusive_mode;
|
||||
|
||||
WASAPI_CHECK(w, "Out of memory", return NULL);
|
||||
|
||||
|
@ -2073,7 +2073,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_AUDIO_MUTE_TOGGLE:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *msg = !settings->audio.mute_enable ?
|
||||
const char *msg = !settings->bools.audio_mute_enable ?
|
||||
msg_hash_to_str(MSG_AUDIO_MUTED):
|
||||
msg_hash_to_str(MSG_AUDIO_UNMUTED);
|
||||
|
||||
|
@ -748,7 +748,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("ui_menubar_enable", &settings->bools.ui_menubar_enable, true, true, false);
|
||||
SETTING_BOOL("suspend_screensaver_enable", &settings->bools.ui_suspend_screensaver_enable, true, true, false);
|
||||
SETTING_BOOL("rewind_enable", &settings->rewind_enable, true, rewind_enable, false);
|
||||
SETTING_BOOL("audio_sync", &settings->audio.sync, true, audio_sync, false);
|
||||
SETTING_BOOL("audio_sync", &settings->bools.audio_sync, true, audio_sync, false);
|
||||
SETTING_BOOL("video_shader_enable", &settings->bools.video_shader_enable, true, shader_enable, false);
|
||||
|
||||
/* Let implementation decide if automatic, or 1:1 PAR. */
|
||||
@ -775,8 +775,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("video_post_filter_record", &settings->bools.video_post_filter_record, true, post_filter_record, false);
|
||||
SETTING_BOOL("keyboard_gamepad_enable", &settings->input.keyboard_gamepad_enable, true, true, false);
|
||||
SETTING_BOOL("core_set_supports_no_game_enable", &settings->set_supports_no_game_enable, true, true, false);
|
||||
SETTING_BOOL("audio_enable", &settings->audio.enable, true, audio_enable, false);
|
||||
SETTING_BOOL("audio_mute_enable", &settings->audio.mute_enable, true, false, false);
|
||||
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, audio_enable, false);
|
||||
SETTING_BOOL("audio_mute_enable", &settings->bools.audio_mute_enable, true, false, false);
|
||||
SETTING_BOOL("location_allow", &settings->location.allow, true, false, false);
|
||||
SETTING_BOOL("video_font_enable", &settings->bools.video_font_enable, true, font_enable, false);
|
||||
SETTING_BOOL("core_updater_auto_extract_archive", &settings->network.buildbot_auto_extract_archive, true, true, false);
|
||||
@ -866,10 +866,10 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("config_save_on_exit", &settings->config_save_on_exit, true, config_save_on_exit, false);
|
||||
SETTING_BOOL("show_hidden_files", &settings->show_hidden_files, true, show_hidden_files, false);
|
||||
SETTING_BOOL("input_autodetect_enable", &settings->input.autodetect_enable, true, input_autodetect_enable, false);
|
||||
SETTING_BOOL("audio_rate_control", &settings->audio.rate_control, true, rate_control, false);
|
||||
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, rate_control, false);
|
||||
#ifdef HAVE_WASAPI
|
||||
SETTING_BOOL("audio_wasapi_exclusive_mode", &settings->audio.wasapi.exclusive_mode, true, true, false);
|
||||
SETTING_BOOL("audio_wasapi_float_format", &settings->audio.wasapi.float_format, true, false, false);
|
||||
SETTING_BOOL("audio_wasapi_exclusive_mode", &settings->bools.audio_wasapi_exclusive_mode, true, true, false);
|
||||
SETTING_BOOL("audio_wasapi_float_format", &settings->bools.audio_wasapi_float_format, true, false, false);
|
||||
#endif
|
||||
|
||||
if (global)
|
||||
|
@ -71,6 +71,15 @@ typedef struct settings
|
||||
bool video_shared_context;
|
||||
bool video_force_srgb_disable;
|
||||
|
||||
bool audio_enable;
|
||||
bool audio_mute_enable;
|
||||
bool audio_sync;
|
||||
bool audio_rate_control;
|
||||
#ifdef HAVE_WASAPI
|
||||
bool audio_wasapi_exclusive_mode;
|
||||
bool audio_wasapi_float_format;
|
||||
#endif
|
||||
|
||||
bool ui_menubar_enable;
|
||||
bool ui_suspend_screensaver_enable;
|
||||
bool ui_companion_start_on_boot;
|
||||
@ -245,15 +254,10 @@ typedef struct settings
|
||||
char driver[32];
|
||||
char resampler[32];
|
||||
char device[255];
|
||||
bool enable;
|
||||
bool mute_enable;
|
||||
unsigned out_rate;
|
||||
unsigned block_frames;
|
||||
unsigned latency;
|
||||
bool sync;
|
||||
|
||||
|
||||
bool rate_control;
|
||||
float rate_control_delta;
|
||||
float max_timing_skew;
|
||||
float volume; /* dB scale. */
|
||||
@ -262,8 +266,6 @@ typedef struct settings
|
||||
struct
|
||||
{
|
||||
unsigned sh_buffer_length; /* in frames (0 disables buffering) */
|
||||
bool exclusive_mode;
|
||||
bool float_format;
|
||||
} wasapi;
|
||||
#endif
|
||||
|
||||
|
@ -1484,12 +1484,12 @@ void general_read_handler(void *data)
|
||||
*setting->value.target.fraction = settings->audio.rate_control_delta;
|
||||
if (*setting->value.target.fraction < 0.0005)
|
||||
{
|
||||
configuration_set_bool(settings, settings->audio.rate_control, false);
|
||||
configuration_set_bool(settings, settings->bools.audio_rate_control, false);
|
||||
settings->audio.rate_control_delta = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
configuration_set_bool(settings, settings->audio.rate_control, true);
|
||||
configuration_set_bool(settings, settings->bools.audio_rate_control, true);
|
||||
settings->audio.rate_control_delta = *setting->value.target.fraction;
|
||||
}
|
||||
break;
|
||||
@ -1602,12 +1602,12 @@ void general_write_handler(void *data)
|
||||
case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA:
|
||||
if (*setting->value.target.fraction < 0.0005)
|
||||
{
|
||||
configuration_set_bool(settings, settings->audio.rate_control, false);
|
||||
configuration_set_bool(settings, settings->bools.audio_rate_control, false);
|
||||
settings->audio.rate_control_delta = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
configuration_set_bool(settings, settings->audio.rate_control, true);
|
||||
configuration_set_bool(settings, settings->bools.audio_rate_control, true);
|
||||
settings->audio.rate_control_delta = *setting->value.target.fraction;
|
||||
}
|
||||
break;
|
||||
@ -3695,7 +3695,7 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->audio.enable,
|
||||
&settings->bools.audio_enable,
|
||||
MENU_ENUM_LABEL_AUDIO_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE,
|
||||
audio_enable,
|
||||
@ -3711,7 +3711,7 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->audio.mute_enable,
|
||||
&settings->bools.audio_mute_enable,
|
||||
MENU_ENUM_LABEL_AUDIO_MUTE,
|
||||
MENU_ENUM_LABEL_VALUE_AUDIO_MUTE,
|
||||
false,
|
||||
@ -3771,7 +3771,7 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->audio.sync,
|
||||
&settings->bools.audio_sync,
|
||||
MENU_ENUM_LABEL_AUDIO_SYNC,
|
||||
MENU_ENUM_LABEL_VALUE_AUDIO_SYNC,
|
||||
audio_sync,
|
||||
|
Loading…
x
Reference in New Issue
Block a user