mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 21:36:26 +00:00
Refactor write_handler for settings_data.c
This commit is contained in:
parent
40ff938296
commit
c201a546a3
698
settings_data.c
698
settings_data.c
@ -977,366 +977,370 @@ static void general_read_handler(const void *data)
|
||||
|
||||
static void general_write_handler(const void *data)
|
||||
{
|
||||
const rarch_setting_t *setting = (const rarch_setting_t*)data;
|
||||
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
if (!strcmp(setting->name, "fps_show"))
|
||||
g_settings.fps_show = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "pause_nonactive"))
|
||||
g_settings.pause_nonactive = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "config_save_on_exit"))
|
||||
g_extern.config_save_on_exit = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "rewind_enable"))
|
||||
{
|
||||
g_settings.rewind_enable = *setting->value.boolean;
|
||||
if (g_settings.rewind_enable)
|
||||
rarch_init_rewind();
|
||||
else
|
||||
rarch_deinit_rewind();
|
||||
}
|
||||
else if (!strcmp(setting->name, "rewind_granularity"))
|
||||
g_settings.rewind_granularity = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "block_sram_overwrite"))
|
||||
g_settings.block_sram_overwrite = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_smooth"))
|
||||
{
|
||||
g_settings.video.smooth = *setting->value.boolean;
|
||||
|
||||
if (driver.video_data && driver.video_poke && driver.video_poke->set_filtering)
|
||||
driver.video_poke->set_filtering(driver.video_data, 1, g_settings.video.smooth);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_monitor_index"))
|
||||
{
|
||||
g_settings.video.monitor_index = *setting->value.unsigned_integer;
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_disable_composition"))
|
||||
{
|
||||
g_settings.video.disable_composition = *setting->value.boolean;
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_vsync"))
|
||||
g_settings.video.vsync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_hard_sync"))
|
||||
g_settings.video.hard_sync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_hard_sync_frames"))
|
||||
g_settings.video.hard_sync_frames = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_scale_integer"))
|
||||
g_settings.video.scale_integer = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_fullscreen"))
|
||||
{
|
||||
g_settings.video.fullscreen = *setting->value.boolean;
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_rotation"))
|
||||
{
|
||||
g_settings.video.rotation = *setting->value.unsigned_integer;
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_threaded"))
|
||||
{
|
||||
g_settings.video.threaded = *setting->value.boolean;
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_swap_interval"))
|
||||
{
|
||||
g_settings.video.swap_interval = min(*setting->value.unsigned_integer, 4);
|
||||
g_settings.video.swap_interval = max(g_settings.video.swap_interval, 1);
|
||||
if (driver.video && driver.video_data)
|
||||
video_set_nonblock_state_func(false);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_crop_overscan"))
|
||||
g_settings.video.crop_overscan = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_black_frame_insertion"))
|
||||
g_settings.video.black_frame_insertion = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_font_path"))
|
||||
strlcpy(g_settings.video.font_path, setting->value.string, sizeof(g_settings.video.font_path));
|
||||
else if (!strcmp(setting->name, "video_font_size"))
|
||||
g_settings.video.font_size = *setting->value.fraction;
|
||||
#ifdef HAVE_OVERLAY
|
||||
else if (!strcmp(setting->name, "input_overlay_opacity"))
|
||||
{
|
||||
g_settings.input.overlay_opacity = *setting->value.fraction;
|
||||
if (driver.overlay)
|
||||
input_overlay_set_alpha_mod(driver.overlay,
|
||||
g_settings.input.overlay_opacity);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "audio_enable"))
|
||||
g_settings.audio.enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_sync"))
|
||||
g_settings.audio.sync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_mute"))
|
||||
g_extern.audio_data.mute = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_volume"))
|
||||
{
|
||||
g_extern.audio_data.volume_db += *setting->value.fraction;
|
||||
g_extern.audio_data.volume_db = max(g_extern.audio_data.volume_db, -80.0f);
|
||||
g_extern.audio_data.volume_db = min(g_extern.audio_data.volume_db, 12.0f);
|
||||
g_extern.audio_data.volume_gain = db_to_gain(g_extern.audio_data.volume_db);
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_device"))
|
||||
strlcpy(g_settings.audio.device, setting->value.string, sizeof(g_settings.audio.device));
|
||||
else if (!strcmp(setting->name, "audio_block_frames"))
|
||||
g_settings.audio.block_frames = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "audio_latency"))
|
||||
g_settings.audio.latency = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "audio_dsp_plugin"))
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
strlcpy(g_settings.audio.dsp_plugin, setting->value.string, sizeof(g_settings.audio.dsp_plugin));
|
||||
#endif
|
||||
rarch_deinit_dsp_filter();
|
||||
rarch_init_dsp_filter();
|
||||
}
|
||||
else if (!strcmp(setting->name, "state_slot"))
|
||||
g_settings.state_slot = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "audio_rate_control_delta"))
|
||||
{
|
||||
if (*setting->value.fraction < 0.0005)
|
||||
{
|
||||
g_settings.audio.rate_control = false;
|
||||
g_settings.audio.rate_control_delta = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_settings.audio.rate_control = true;
|
||||
g_settings.audio.rate_control_delta = *setting->value.fraction;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_out_rate"))
|
||||
g_settings.audio.out_rate = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_autodetect_enable"))
|
||||
g_settings.input.autodetect_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "input_turbo_period"))
|
||||
g_settings.input.turbo_period = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_duty_cycle"))
|
||||
g_settings.input.turbo_duty_cycle = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_axis_threshold"))
|
||||
g_settings.input.axis_threshold = max(min(*setting->value.fraction, 0.95f), 0.05f);
|
||||
else if (!strcmp(setting->name, "savestate_auto_save"))
|
||||
g_settings.savestate_auto_save = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "savestate_auto_load"))
|
||||
g_settings.savestate_auto_load = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "savestate_auto_index"))
|
||||
g_settings.savestate_auto_index = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "slowmotion_ratio"))
|
||||
g_settings.slowmotion_ratio = max(min(*setting->value.fraction, 10.0f), 1.0f);
|
||||
else if (!strcmp(setting->name, "fastforward_ratio"))
|
||||
g_settings.fastforward_ratio = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "autosave_interval"))
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
rarch_deinit_autosave();
|
||||
#endif
|
||||
g_settings.autosave_interval = *setting->value.unsigned_integer;
|
||||
#ifdef HAVE_THREADS
|
||||
if (g_settings.autosave_interval)
|
||||
rarch_init_autosave();
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_font_enable"))
|
||||
g_settings.video.font_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_gpu_screenshot"))
|
||||
g_settings.video.gpu_screenshot = *setting->value.boolean;
|
||||
#ifdef HAVE_NETPLAY
|
||||
else if (!strcmp(setting->name, "netplay_client_swap_input"))
|
||||
g_settings.input.netplay_client_swap_input = *setting->value.boolean;
|
||||
#endif
|
||||
#ifdef HAVE_OVERLAY
|
||||
else if (!strcmp(setting->name, "input_overlay"))
|
||||
{
|
||||
strlcpy(g_settings.input.overlay, setting->value.string, sizeof(g_settings.input.overlay));
|
||||
|
||||
if (driver.overlay)
|
||||
input_overlay_free(driver.overlay);
|
||||
|
||||
if (g_settings.input.overlay && g_settings.input.overlay[0] != '\0')
|
||||
driver.overlay = input_overlay_new(g_settings.input.overlay);
|
||||
}
|
||||
else if (!strcmp(setting->name, "input_overlay_scale"))
|
||||
{
|
||||
if (*setting->value.fraction < setting->min) // Avoid potential divide by zero.
|
||||
g_settings.input.overlay_scale = setting->min;
|
||||
else if (*setting->value.fraction > setting->max)
|
||||
g_settings.input.overlay_scale = setting->max;
|
||||
else
|
||||
g_settings.input.overlay_scale = *setting->value.fraction;
|
||||
bool has_set_reinit = false;
|
||||
const rarch_setting_t *setting = (const rarch_setting_t*)data;
|
||||
|
||||
if (driver.overlay)
|
||||
input_overlay_set_scale_factor(driver.overlay,
|
||||
g_settings.input.overlay_scale);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "video_allow_rotate"))
|
||||
g_settings.video.allow_rotate = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_windowed_fullscreen"))
|
||||
g_settings.video.windowed_fullscreen = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_fullscreen_x"))
|
||||
g_settings.video.fullscreen_x = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_fullscreen_y"))
|
||||
g_settings.video.fullscreen_y = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_refresh_rate"))
|
||||
{
|
||||
if (driver.video && driver.video_data)
|
||||
{
|
||||
driver_set_monitor_refresh_rate(*setting->value.fraction);
|
||||
/* In case refresh rate update forced non-block video. */
|
||||
video_set_nonblock_state_func(false);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio"))
|
||||
g_settings.video.aspect_ratio = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "video_xscale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.xscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_yscale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.yscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_force_aspect"))
|
||||
g_settings.video.force_aspect = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "aspect_ratio_index"))
|
||||
{
|
||||
g_settings.video.aspect_ratio_idx = *setting->value.unsigned_integer;
|
||||
|
||||
if (driver.video_data && driver.video_poke && driver.video_poke->set_aspect_ratio)
|
||||
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_message_pos_x"))
|
||||
g_settings.video.msg_pos_x = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "video_message_pos_y"))
|
||||
g_settings.video.msg_pos_y = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "network_cmd_enable"))
|
||||
g_settings.network_cmd_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "stdin_cmd_enable"))
|
||||
g_settings.stdin_cmd_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_post_filter_record"))
|
||||
g_settings.video.post_filter_record = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_gpu_record"))
|
||||
g_settings.video.gpu_record = *setting->value.boolean;
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
if (!strcmp(setting->name, "fps_show"))
|
||||
g_settings.fps_show = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "pause_nonactive"))
|
||||
g_settings.pause_nonactive = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "config_save_on_exit"))
|
||||
g_extern.config_save_on_exit = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "rewind_enable"))
|
||||
{
|
||||
g_settings.rewind_enable = *setting->value.boolean;
|
||||
if (g_settings.rewind_enable)
|
||||
rarch_init_rewind();
|
||||
else
|
||||
rarch_deinit_rewind();
|
||||
}
|
||||
else if (!strcmp(setting->name, "rewind_granularity"))
|
||||
g_settings.rewind_granularity = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "block_sram_overwrite"))
|
||||
g_settings.block_sram_overwrite = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_smooth"))
|
||||
{
|
||||
g_settings.video.smooth = *setting->value.boolean;
|
||||
|
||||
if (driver.video_data && driver.video_poke && driver.video_poke->set_filtering)
|
||||
driver.video_poke->set_filtering(driver.video_data, 1, g_settings.video.smooth);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_monitor_index"))
|
||||
{
|
||||
g_settings.video.monitor_index = *setting->value.unsigned_integer;
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_disable_composition"))
|
||||
{
|
||||
g_settings.video.disable_composition = *setting->value.boolean;
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_vsync"))
|
||||
g_settings.video.vsync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_hard_sync"))
|
||||
g_settings.video.hard_sync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_hard_sync_frames"))
|
||||
g_settings.video.hard_sync_frames = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_scale_integer"))
|
||||
g_settings.video.scale_integer = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_fullscreen"))
|
||||
{
|
||||
g_settings.video.fullscreen = *setting->value.boolean;
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_rotation"))
|
||||
{
|
||||
g_settings.video.rotation = *setting->value.unsigned_integer;
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_threaded"))
|
||||
{
|
||||
g_settings.video.threaded = *setting->value.boolean;
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_swap_interval"))
|
||||
{
|
||||
g_settings.video.swap_interval = min(*setting->value.unsigned_integer, 4);
|
||||
g_settings.video.swap_interval = max(g_settings.video.swap_interval, 1);
|
||||
if (driver.video && driver.video_data)
|
||||
video_set_nonblock_state_func(false);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_crop_overscan"))
|
||||
g_settings.video.crop_overscan = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_black_frame_insertion"))
|
||||
g_settings.video.black_frame_insertion = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_font_path"))
|
||||
strlcpy(g_settings.video.font_path, setting->value.string, sizeof(g_settings.video.font_path));
|
||||
else if (!strcmp(setting->name, "video_font_size"))
|
||||
g_settings.video.font_size = *setting->value.fraction;
|
||||
#ifdef HAVE_OVERLAY
|
||||
else if (!strcmp(setting->name, "overlay_directory"))
|
||||
strlcpy(g_extern.overlay_dir, setting->value.string, sizeof(g_extern.overlay_dir));
|
||||
else if (!strcmp(setting->name, "input_overlay_opacity"))
|
||||
{
|
||||
g_settings.input.overlay_opacity = *setting->value.fraction;
|
||||
if (driver.overlay)
|
||||
input_overlay_set_alpha_mod(driver.overlay,
|
||||
g_settings.input.overlay_opacity);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "joypad_autoconfig_dir"))
|
||||
strlcpy(g_settings.input.autoconfig_dir, setting->value.string, sizeof(g_settings.input.autoconfig_dir));
|
||||
else if (!strcmp(setting->name, "screenshot_directory"))
|
||||
strlcpy(g_settings.screenshot_directory, setting->value.string, sizeof(g_settings.screenshot_directory));
|
||||
else if (!strcmp(setting->name, "savefile_directory"))
|
||||
strlcpy(g_extern.savefile_dir, setting->value.string, sizeof(g_extern.savefile_dir));
|
||||
else if (!strcmp(setting->name, "savestate_directory"))
|
||||
strlcpy(g_extern.savestate_dir, setting->value.string, sizeof(g_extern.savestate_dir));
|
||||
else if (!strcmp(setting->name, "system_directory"))
|
||||
strlcpy(g_settings.system_directory, setting->value.string, sizeof(g_settings.system_directory));
|
||||
else if (!strcmp(setting->name, "extraction_directory"))
|
||||
strlcpy(g_settings.extraction_directory, setting->value.string, sizeof(g_settings.extraction_directory));
|
||||
else if (!strcmp(setting->name, "input_player1_joypad_index"))
|
||||
g_settings.input.joypad_map[0] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player2_joypad_index"))
|
||||
g_settings.input.joypad_map[1] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player3_joypad_index"))
|
||||
g_settings.input.joypad_map[2] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player4_joypad_index"))
|
||||
g_settings.input.joypad_map[3] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player5_joypad_index"))
|
||||
g_settings.input.joypad_map[4] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "rgui_show_start_screen"))
|
||||
g_settings.menu_show_start_screen = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "game_history_size"))
|
||||
g_settings.game_history_size = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "content_directory"))
|
||||
strlcpy(g_settings.content_directory, setting->value.string, sizeof(g_settings.content_directory));
|
||||
else if (!strcmp(setting->name, "audio_enable"))
|
||||
g_settings.audio.enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_sync"))
|
||||
g_settings.audio.sync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_mute"))
|
||||
g_extern.audio_data.mute = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_volume"))
|
||||
{
|
||||
g_extern.audio_data.volume_db += *setting->value.fraction;
|
||||
g_extern.audio_data.volume_db = max(g_extern.audio_data.volume_db, -80.0f);
|
||||
g_extern.audio_data.volume_db = min(g_extern.audio_data.volume_db, 12.0f);
|
||||
g_extern.audio_data.volume_gain = db_to_gain(g_extern.audio_data.volume_db);
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_device"))
|
||||
strlcpy(g_settings.audio.device, setting->value.string, sizeof(g_settings.audio.device));
|
||||
else if (!strcmp(setting->name, "audio_block_frames"))
|
||||
g_settings.audio.block_frames = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "audio_latency"))
|
||||
g_settings.audio.latency = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "audio_dsp_plugin"))
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
strlcpy(g_settings.audio.dsp_plugin, setting->value.string, sizeof(g_settings.audio.dsp_plugin));
|
||||
#endif
|
||||
rarch_deinit_dsp_filter();
|
||||
rarch_init_dsp_filter();
|
||||
}
|
||||
else if (!strcmp(setting->name, "state_slot"))
|
||||
g_settings.state_slot = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "audio_rate_control_delta"))
|
||||
{
|
||||
if (*setting->value.fraction < 0.0005)
|
||||
{
|
||||
g_settings.audio.rate_control = false;
|
||||
g_settings.audio.rate_control_delta = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_settings.audio.rate_control = true;
|
||||
g_settings.audio.rate_control_delta = *setting->value.fraction;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_out_rate"))
|
||||
g_settings.audio.out_rate = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_autodetect_enable"))
|
||||
g_settings.input.autodetect_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "input_turbo_period"))
|
||||
g_settings.input.turbo_period = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_duty_cycle"))
|
||||
g_settings.input.turbo_duty_cycle = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "input_axis_threshold"))
|
||||
g_settings.input.axis_threshold = max(min(*setting->value.fraction, 0.95f), 0.05f);
|
||||
else if (!strcmp(setting->name, "savestate_auto_save"))
|
||||
g_settings.savestate_auto_save = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "savestate_auto_load"))
|
||||
g_settings.savestate_auto_load = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "savestate_auto_index"))
|
||||
g_settings.savestate_auto_index = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "slowmotion_ratio"))
|
||||
g_settings.slowmotion_ratio = max(min(*setting->value.fraction, 10.0f), 1.0f);
|
||||
else if (!strcmp(setting->name, "fastforward_ratio"))
|
||||
g_settings.fastforward_ratio = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "autosave_interval"))
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
rarch_deinit_autosave();
|
||||
#endif
|
||||
g_settings.autosave_interval = *setting->value.unsigned_integer;
|
||||
#ifdef HAVE_THREADS
|
||||
if (g_settings.autosave_interval)
|
||||
rarch_init_autosave();
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_font_enable"))
|
||||
g_settings.video.font_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_gpu_screenshot"))
|
||||
g_settings.video.gpu_screenshot = *setting->value.boolean;
|
||||
#ifdef HAVE_NETPLAY
|
||||
else if (!strcmp(setting->name, "netplay_client_swap_input"))
|
||||
g_settings.input.netplay_client_swap_input = *setting->value.boolean;
|
||||
#endif
|
||||
#ifdef HAVE_OVERLAY
|
||||
else if (!strcmp(setting->name, "input_overlay"))
|
||||
{
|
||||
strlcpy(g_settings.input.overlay, setting->value.string, sizeof(g_settings.input.overlay));
|
||||
|
||||
if (driver.overlay)
|
||||
input_overlay_free(driver.overlay);
|
||||
|
||||
if (g_settings.input.overlay && g_settings.input.overlay[0] != '\0')
|
||||
driver.overlay = input_overlay_new(g_settings.input.overlay);
|
||||
}
|
||||
else if (!strcmp(setting->name, "input_overlay_scale"))
|
||||
{
|
||||
if (*setting->value.fraction < setting->min) // Avoid potential divide by zero.
|
||||
g_settings.input.overlay_scale = setting->min;
|
||||
else if (*setting->value.fraction > setting->max)
|
||||
g_settings.input.overlay_scale = setting->max;
|
||||
else
|
||||
g_settings.input.overlay_scale = *setting->value.fraction;
|
||||
|
||||
if (driver.overlay)
|
||||
input_overlay_set_scale_factor(driver.overlay,
|
||||
g_settings.input.overlay_scale);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "video_allow_rotate"))
|
||||
g_settings.video.allow_rotate = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_windowed_fullscreen"))
|
||||
g_settings.video.windowed_fullscreen = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_fullscreen_x"))
|
||||
g_settings.video.fullscreen_x = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_fullscreen_y"))
|
||||
g_settings.video.fullscreen_y = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "video_refresh_rate"))
|
||||
{
|
||||
if (driver.video && driver.video_data)
|
||||
{
|
||||
driver_set_monitor_refresh_rate(*setting->value.fraction);
|
||||
/* In case refresh rate update forced non-block video. */
|
||||
video_set_nonblock_state_func(false);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio"))
|
||||
g_settings.video.aspect_ratio = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "video_xscale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.xscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_yscale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.yscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_force_aspect"))
|
||||
g_settings.video.force_aspect = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "aspect_ratio_index"))
|
||||
{
|
||||
g_settings.video.aspect_ratio_idx = *setting->value.unsigned_integer;
|
||||
|
||||
if (driver.video_data && driver.video_poke && driver.video_poke->set_aspect_ratio)
|
||||
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_message_pos_x"))
|
||||
g_settings.video.msg_pos_x = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "video_message_pos_y"))
|
||||
g_settings.video.msg_pos_y = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "network_cmd_enable"))
|
||||
g_settings.network_cmd_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "stdin_cmd_enable"))
|
||||
g_settings.stdin_cmd_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_post_filter_record"))
|
||||
g_settings.video.post_filter_record = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_gpu_record"))
|
||||
g_settings.video.gpu_record = *setting->value.boolean;
|
||||
#ifdef HAVE_OVERLAY
|
||||
else if (!strcmp(setting->name, "overlay_directory"))
|
||||
strlcpy(g_extern.overlay_dir, setting->value.string, sizeof(g_extern.overlay_dir));
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "joypad_autoconfig_dir"))
|
||||
strlcpy(g_settings.input.autoconfig_dir, setting->value.string, sizeof(g_settings.input.autoconfig_dir));
|
||||
else if (!strcmp(setting->name, "screenshot_directory"))
|
||||
strlcpy(g_settings.screenshot_directory, setting->value.string, sizeof(g_settings.screenshot_directory));
|
||||
else if (!strcmp(setting->name, "savefile_directory"))
|
||||
strlcpy(g_extern.savefile_dir, setting->value.string, sizeof(g_extern.savefile_dir));
|
||||
else if (!strcmp(setting->name, "savestate_directory"))
|
||||
strlcpy(g_extern.savestate_dir, setting->value.string, sizeof(g_extern.savestate_dir));
|
||||
else if (!strcmp(setting->name, "system_directory"))
|
||||
strlcpy(g_settings.system_directory, setting->value.string, sizeof(g_settings.system_directory));
|
||||
else if (!strcmp(setting->name, "extraction_directory"))
|
||||
strlcpy(g_settings.extraction_directory, setting->value.string, sizeof(g_settings.extraction_directory));
|
||||
else if (!strcmp(setting->name, "input_player1_joypad_index"))
|
||||
g_settings.input.joypad_map[0] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player2_joypad_index"))
|
||||
g_settings.input.joypad_map[1] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player3_joypad_index"))
|
||||
g_settings.input.joypad_map[2] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player4_joypad_index"))
|
||||
g_settings.input.joypad_map[3] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "input_player5_joypad_index"))
|
||||
g_settings.input.joypad_map[4] = *setting->value.integer;
|
||||
else if (!strcmp(setting->name, "rgui_show_start_screen"))
|
||||
g_settings.menu_show_start_screen = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "game_history_size"))
|
||||
g_settings.game_history_size = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "content_directory"))
|
||||
strlcpy(g_settings.content_directory, setting->value.string, sizeof(g_settings.content_directory));
|
||||
#ifdef HAVE_MENU
|
||||
else if (!strcmp(setting->name, "rgui_browser_directory"))
|
||||
strlcpy(g_settings.menu_content_directory, setting->value.string, sizeof(g_settings.menu_content_directory));
|
||||
else if (!strcmp(setting->name, "assets_directory"))
|
||||
strlcpy(g_settings.assets_directory, setting->value.string, sizeof(g_settings.assets_directory));
|
||||
else if (!strcmp(setting->name, "rgui_config_directory"))
|
||||
strlcpy(g_settings.menu_config_directory, setting->value.string, sizeof(g_settings.menu_config_directory));
|
||||
else if (!strcmp(setting->name, "rgui_browser_directory"))
|
||||
strlcpy(g_settings.menu_content_directory, setting->value.string, sizeof(g_settings.menu_content_directory));
|
||||
else if (!strcmp(setting->name, "assets_directory"))
|
||||
strlcpy(g_settings.assets_directory, setting->value.string, sizeof(g_settings.assets_directory));
|
||||
else if (!strcmp(setting->name, "rgui_config_directory"))
|
||||
strlcpy(g_settings.menu_config_directory, setting->value.string, sizeof(g_settings.menu_config_directory));
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "libretro_path"))
|
||||
strlcpy(g_settings.libretro, setting->value.string, sizeof(g_settings.libretro));
|
||||
else if (!strcmp(setting->name, "libretro_info_path"))
|
||||
strlcpy(g_settings.libretro_info_path, setting->value.string, sizeof(g_settings.libretro_info_path));
|
||||
else if (!strcmp(setting->name, "core_options_path"))
|
||||
strlcpy(g_settings.core_options_path, setting->value.string, sizeof(g_settings.core_options_path));
|
||||
else if (!strcmp(setting->name, "cheat_database_path"))
|
||||
strlcpy(g_settings.cheat_database, setting->value.string, sizeof(g_settings.cheat_database));
|
||||
else if (!strcmp(setting->name, "cheat_settings_path"))
|
||||
strlcpy(g_settings.cheat_settings_path, setting->value.string, sizeof(g_settings.cheat_settings_path));
|
||||
else if (!strcmp(setting->name, "game_history_path"))
|
||||
strlcpy(g_settings.content_history_path, setting->value.string, sizeof(g_settings.content_history_path));
|
||||
else if (!strcmp(setting->name, "video_shader_dir"))
|
||||
strlcpy(g_settings.video.shader_dir, setting->value.string, sizeof(g_settings.video.shader_dir));
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio_auto"))
|
||||
g_settings.video.aspect_ratio_auto = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_filter"))
|
||||
{
|
||||
strlcpy(g_settings.video.filter_path, setting->value.string, sizeof(g_settings.video.filter_path));
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
else if (!strcmp(setting->name, "libretro_path"))
|
||||
strlcpy(g_settings.libretro, setting->value.string, sizeof(g_settings.libretro));
|
||||
else if (!strcmp(setting->name, "libretro_info_path"))
|
||||
strlcpy(g_settings.libretro_info_path, setting->value.string, sizeof(g_settings.libretro_info_path));
|
||||
else if (!strcmp(setting->name, "core_options_path"))
|
||||
strlcpy(g_settings.core_options_path, setting->value.string, sizeof(g_settings.core_options_path));
|
||||
else if (!strcmp(setting->name, "cheat_database_path"))
|
||||
strlcpy(g_settings.cheat_database, setting->value.string, sizeof(g_settings.cheat_database));
|
||||
else if (!strcmp(setting->name, "cheat_settings_path"))
|
||||
strlcpy(g_settings.cheat_settings_path, setting->value.string, sizeof(g_settings.cheat_settings_path));
|
||||
else if (!strcmp(setting->name, "game_history_path"))
|
||||
strlcpy(g_settings.content_history_path, setting->value.string, sizeof(g_settings.content_history_path));
|
||||
else if (!strcmp(setting->name, "video_shader_dir"))
|
||||
strlcpy(g_settings.video.shader_dir, setting->value.string, sizeof(g_settings.video.shader_dir));
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio_auto"))
|
||||
g_settings.video.aspect_ratio_auto = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_filter"))
|
||||
{
|
||||
strlcpy(g_settings.video.filter_path, setting->value.string, sizeof(g_settings.video.filter_path));
|
||||
has_set_reinit = true;
|
||||
}
|
||||
#ifdef HAVE_CAMERA
|
||||
else if (!strcmp(setting->name, "camera_allow"))
|
||||
g_settings.camera.allow = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "camera_allow"))
|
||||
g_settings.camera.allow = *setting->value.boolean;
|
||||
#endif
|
||||
#ifdef HAVE_LOCATION
|
||||
else if (!strcmp(setting->name, "location_allow"))
|
||||
g_settings.location.allow = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "location_allow"))
|
||||
g_settings.location.allow = *setting->value.boolean;
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "video_shared_context"))
|
||||
g_settings.video.shared_context = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "video_shared_context"))
|
||||
g_settings.video.shared_context = *setting->value.boolean;
|
||||
#ifdef HAVE_NETPLAY
|
||||
else if (!strcmp(setting->name, "netplay_enable"))
|
||||
g_extern.netplay_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "netplay_mode"))
|
||||
{
|
||||
g_extern.netplay_is_client = *setting->value.boolean;
|
||||
if (!g_extern.netplay_is_client)
|
||||
*g_extern.netplay_server = '\0';
|
||||
}
|
||||
else if (!strcmp(setting->name, "netplay_spectator_mode_enable"))
|
||||
{
|
||||
g_extern.netplay_is_spectate = *setting->value.boolean;
|
||||
if (g_extern.netplay_is_spectate)
|
||||
*g_extern.netplay_server = '\0';
|
||||
}
|
||||
else if (!strcmp(setting->name, "netplay_delay_frames"))
|
||||
{
|
||||
g_extern.netplay_sync_frames = *setting->value.unsigned_integer;
|
||||
}
|
||||
else if (!strcmp(setting->name, "netplay_enable"))
|
||||
g_extern.netplay_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "netplay_mode"))
|
||||
{
|
||||
g_extern.netplay_is_client = *setting->value.boolean;
|
||||
if (!g_extern.netplay_is_client)
|
||||
*g_extern.netplay_server = '\0';
|
||||
}
|
||||
else if (!strcmp(setting->name, "netplay_spectator_mode_enable"))
|
||||
{
|
||||
g_extern.netplay_is_spectate = *setting->value.boolean;
|
||||
if (g_extern.netplay_is_spectate)
|
||||
*g_extern.netplay_server = '\0';
|
||||
}
|
||||
else if (!strcmp(setting->name, "netplay_delay_frames"))
|
||||
{
|
||||
g_extern.netplay_sync_frames = *setting->value.unsigned_integer;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "log_verbosity"))
|
||||
g_extern.verbosity = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "perfcnt_enable"))
|
||||
g_extern.perfcnt_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "core_specific_config"))
|
||||
g_settings.core_specific_config = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "dummy_on_core_shutdown"))
|
||||
g_settings.load_dummy_on_core_shutdown = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "libretro_log_level"))
|
||||
g_settings.libretro_log_level = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "log_verbosity"))
|
||||
g_extern.verbosity = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "perfcnt_enable"))
|
||||
g_extern.perfcnt_enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "core_specific_config"))
|
||||
g_settings.core_specific_config = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "dummy_on_core_shutdown"))
|
||||
g_settings.load_dummy_on_core_shutdown = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "libretro_log_level"))
|
||||
g_settings.libretro_log_level = *setting->value.unsigned_integer;
|
||||
#ifdef HAVE_OSK
|
||||
else if (!strcmp(setting->name, "osk_enable"))
|
||||
g_settings.osk.enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "osk_enable"))
|
||||
g_settings.osk.enable = *setting->value.boolean;
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "user_language"))
|
||||
g_settings.user_language = *setting->value.unsigned_integer;
|
||||
else if (!strcmp(setting->name, "user_language"))
|
||||
g_settings.user_language = *setting->value.unsigned_integer;
|
||||
|
||||
if (has_set_reinit)
|
||||
rarch_set_fullscreen(g_settings.video.fullscreen);
|
||||
}
|
||||
|
||||
#define NEXT (list[index++])
|
||||
|
Loading…
x
Reference in New Issue
Block a user