Move all float settings

This commit is contained in:
twinaphex 2017-04-28 14:57:55 +02:00
parent 4e92a4ed77
commit 0da40fb3aa
16 changed files with 176 additions and 177 deletions

View File

@ -312,7 +312,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
/* Accomodate rewind since at some point we might have two full buffers. */
outsamples_max = max_bufsamples * AUDIO_MAX_RATIO *
settings->slowmotion_ratio;
settings->floats.slowmotion_ratio;
conv_buf = (int16_t*)malloc(outsamples_max
* sizeof(int16_t));
@ -570,7 +570,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
(int)current_audio->write_avail(audio_driver_context_audio_data);
int delta_mid = avail - half_size;
double direction = (double)delta_mid / half_size;
double adjust = 1.0 + settings->audio.rate_control_delta * direction;
double adjust = 1.0 + settings->floats.audio_rate_control_delta * direction;
#if 0
RARCH_LOG_OUTPUT("[Audio]: Audio buffer is %u%% full\n",
@ -591,7 +591,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
src_data.ratio = audio_source_ratio_current;
if (is_slowmotion)
src_data.ratio *= settings->slowmotion_ratio;
src_data.ratio *= settings->floats.slowmotion_ratio;
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
@ -751,6 +751,7 @@ void audio_driver_monitor_adjust_system_rates(void)
settings_t *settings = config_get_ptr();
const struct retro_system_timing *info = NULL;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
float video_refresh_rate = settings->floats.video_refresh_rate;
if (av_info)
info = (const struct retro_system_timing*)&av_info->timing;
@ -758,11 +759,11 @@ void audio_driver_monitor_adjust_system_rates(void)
if (!info || info->sample_rate <= 0.0)
return;
timing_skew = fabs(1.0f - info->fps / settings->video.refresh_rate);
timing_skew = fabs(1.0f - info->fps / video_refresh_rate);
audio_driver_input = info->sample_rate;
if (timing_skew <= settings->audio.max_timing_skew)
audio_driver_input *= (settings->video.refresh_rate / info->fps);
if (timing_skew <= settings->floats.audio_max_timing_skew)
audio_driver_input *= (video_refresh_rate / info->fps);
RARCH_LOG("[Audio]: Set audio input rate to: %.2f Hz.\n",
audio_driver_input);

View File

@ -1096,12 +1096,12 @@ static void command_event_set_volume(float gain)
{
char msg[128];
settings_t *settings = config_get_ptr();
float new_volume = settings->audio.volume + gain;
float new_volume = settings->floats.audio_volume + gain;
new_volume = MAX(new_volume, -80.0f);
new_volume = MIN(new_volume, 12.0f);
configuration_set_float(settings, settings->audio.volume, new_volume);
configuration_set_float(settings, settings->floats.audio_volume, new_volume);
snprintf(msg, sizeof(msg), "%s: %.1f dB",
msg_hash_to_str(MSG_AUDIO_VOLUME),
@ -1784,7 +1784,7 @@ static bool command_event_resize_windowed_scale(void)
if (!window_scale || *window_scale == 0)
return false;
configuration_set_float(settings, settings->video.scale, *window_scale);
configuration_set_float(settings, settings->floats.video_scale, *window_scale);
}
if (!settings->bools.video_fullscreen)
@ -2110,7 +2110,7 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_OVERLAY
input_overlay_next(overlay_ptr, settings->input.overlay_opacity);
input_overlay_next(overlay_ptr, settings->floats.input_overlay_opacity);
#endif
}
break;
@ -2260,7 +2260,7 @@ bool command_event(enum event_command cmd, void *data)
{
#ifdef HAVE_OVERLAY
settings_t *settings = config_get_ptr();
input_overlay_set_scale_factor(overlay_ptr, settings->input.overlay_scale);
input_overlay_set_scale_factor(overlay_ptr, settings->floats.input_overlay_scale);
#endif
}
break;
@ -2268,7 +2268,7 @@ bool command_event(enum event_command cmd, void *data)
{
#ifdef HAVE_OVERLAY
settings_t *settings = config_get_ptr();
input_overlay_set_alpha_mod(overlay_ptr, settings->input.overlay_opacity);
input_overlay_set_alpha_mod(overlay_ptr, settings->floats.input_overlay_opacity);
#endif
}
break;

View File

@ -893,27 +893,27 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
unsigned count = 0;
struct config_float_setting *tmp = NULL;
SETTING_FLOAT("video_aspect_ratio", &settings->video.aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_scale", &settings->video.scale, false, 0.0f, false);
SETTING_FLOAT("video_refresh_rate", &settings->video.refresh_rate, true, refresh_rate, false);
SETTING_FLOAT("audio_rate_control_delta", &settings->audio.rate_control_delta, true, rate_control_delta, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->audio.max_timing_skew, true, max_timing_skew, false);
SETTING_FLOAT("audio_volume", &settings->audio.volume, true, audio_volume, false);
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false);
SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, refresh_rate, false);
SETTING_FLOAT("audio_rate_control_delta", &settings->floats.audio_rate_control_delta, true, rate_control_delta, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->floats.audio_max_timing_skew, true, max_timing_skew, false);
SETTING_FLOAT("audio_volume", &settings->floats.audio_volume, true, audio_volume, false);
#ifdef HAVE_OVERLAY
SETTING_FLOAT("input_overlay_opacity", &settings->input.overlay_opacity, true, 0.7f, false);
SETTING_FLOAT("input_overlay_scale", &settings->input.overlay_scale, true, 1.0f, false);
SETTING_FLOAT("input_overlay_opacity", &settings->floats.input_overlay_opacity, true, 0.7f, false);
SETTING_FLOAT("input_overlay_scale", &settings->floats.input_overlay_scale, true, 1.0f, false);
#endif
#ifdef HAVE_MENU
SETTING_FLOAT("menu_wallpaper_opacity", &settings->menu.wallpaper.opacity, true, menu_wallpaper_opacity, false);
SETTING_FLOAT("menu_footer_opacity", &settings->menu.footer.opacity, true, menu_footer_opacity, false);
SETTING_FLOAT("menu_header_opacity", &settings->menu.header.opacity, true, menu_header_opacity, false);
SETTING_FLOAT("menu_wallpaper_opacity", &settings->floats.menu_wallpaper_opacity, true, menu_wallpaper_opacity, false);
SETTING_FLOAT("menu_footer_opacity", &settings->floats.menu_footer_opacity, true, menu_footer_opacity, false);
SETTING_FLOAT("menu_header_opacity", &settings->floats.menu_header_opacity, true, menu_header_opacity, false);
#endif
SETTING_FLOAT("video_message_pos_x", &settings->video.msg_pos_x, true, message_pos_offset_x, false);
SETTING_FLOAT("video_message_pos_y", &settings->video.msg_pos_y, true, message_pos_offset_y, false);
SETTING_FLOAT("video_font_size", &settings->video.font_size, true, font_size, false);
SETTING_FLOAT("fastforward_ratio", &settings->fastforward_ratio, true, fastforward_ratio, false);
SETTING_FLOAT("slowmotion_ratio", &settings->slowmotion_ratio, true, slowmotion_ratio, false);
SETTING_FLOAT("input_axis_threshold", &settings->input.axis_threshold, true, axis_threshold, false);
SETTING_FLOAT("video_message_pos_x", &settings->floats.video_msg_pos_x, true, message_pos_offset_x, false);
SETTING_FLOAT("video_message_pos_y", &settings->floats.video_msg_pos_y, true, message_pos_offset_y, false);
SETTING_FLOAT("video_font_size", &settings->floats.video_font_size, true, font_size, false);
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
SETTING_FLOAT("input_axis_threshold", &settings->floats.input_axis_threshold, true, axis_threshold, false);
*size = count;
@ -1111,7 +1111,7 @@ static void config_set_defaults(void)
#else
configuration_set_bool(settings, settings->bools.multimedia_builtin_mediaplayer_enable, false);
#endif
settings->video.scale = scale;
settings->floats.video_scale = scale;
if (rarch_ctl(RARCH_CTL_IS_FORCE_FULLSCREEN, NULL))
{
@ -1121,13 +1121,13 @@ static void config_set_defaults(void)
if (g_defaults.settings.video_threaded_enable != video_threaded)
settings->bools.video_threaded = g_defaults.settings.video_threaded_enable;
settings->video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
settings->video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f;
settings->video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f;
settings->floats.video_msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
settings->floats.video_msg_color_g = ((message_color >> 8) & 0xff) / 255.0f;
settings->floats.video_msg_color_b = ((message_color >> 0) & 0xff) / 255.0f;
if (g_defaults.settings.video_refresh_rate > 0.0 &&
g_defaults.settings.video_refresh_rate != refresh_rate)
settings->video.refresh_rate = g_defaults.settings.video_refresh_rate;
settings->floats.video_refresh_rate = g_defaults.settings.video_refresh_rate;
if (audio_device)
strlcpy(settings->audio.device,
@ -1138,7 +1138,7 @@ static void config_set_defaults(void)
settings->audio.latency = g_defaults.settings.out_latency;
audio_driver_set_volume_gain(db_to_gain(settings->audio.volume));
audio_driver_set_volume_gain(db_to_gain(settings->floats.audio_volume));
settings->rewind_buffer_size = rewind_buffer_size;
@ -1937,9 +1937,9 @@ static bool config_load_file(const char *path, bool set_defaults,
if (config_get_hex(conf, "video_message_color", &msg_color))
{
settings->video.msg_color_r = ((msg_color >> 16) & 0xff) / 255.0f;
settings->video.msg_color_g = ((msg_color >> 8) & 0xff) / 255.0f;
settings->video.msg_color_b = ((msg_color >> 0) & 0xff) / 255.0f;
settings->floats.video_msg_color_r = ((msg_color >> 16) & 0xff) / 255.0f;
settings->floats.video_msg_color_g = ((msg_color >> 8) & 0xff) / 255.0f;
settings->floats.video_msg_color_b = ((msg_color >> 0) & 0xff) / 255.0f;
}
#ifdef HAVE_MENU
config_get_hex_base(conf, "menu_entry_normal_color",
@ -2016,7 +2016,7 @@ static bool config_load_file(const char *path, bool set_defaults,
settings->video.swap_interval = MAX(settings->video.swap_interval, 1);
settings->video.swap_interval = MIN(settings->video.swap_interval, 4);
audio_driver_set_volume_gain(db_to_gain(settings->audio.volume));
audio_driver_set_volume_gain(db_to_gain(settings->floats.audio_volume));
if (string_is_empty(settings->path.content_history))
{
@ -2147,16 +2147,16 @@ static bool config_load_file(const char *path, bool set_defaults,
if (memcmp(settings->directory.system, "default", 7) == 0)
*settings->directory.system = '\0';
if (settings->slowmotion_ratio < 1.0f)
if (settings->floats.slowmotion_ratio < 1.0f)
{
configuration_set_float(settings, settings->slowmotion_ratio, 1.0f);
configuration_set_float(settings, settings->floats.slowmotion_ratio, 1.0f);
}
/* Sanitize fastforward_ratio value - previously range was -1
* and up (with 0 being skipped) */
if (settings->fastforward_ratio < 0.0f)
if (settings->floats.fastforward_ratio < 0.0f)
{
configuration_set_float(settings, settings->fastforward_ratio, 0.0f);
configuration_set_float(settings, settings->floats.fastforward_ratio, 0.0f);
}
#ifdef HAVE_LAKKA
@ -3084,9 +3084,9 @@ bool config_save_file(const char *path)
config_set_bool(conf, "perfcnt_enable",
runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL));
msg_color = (((int)(settings->video.msg_color_r * 255.0f) & 0xff) << 16) +
(((int)(settings->video.msg_color_g * 255.0f) & 0xff) << 8) +
(((int)(settings->video.msg_color_b * 255.0f) & 0xff));
msg_color = (((int)(settings->floats.video_msg_color_r * 255.0f) & 0xff) << 16) +
(((int)(settings->floats.video_msg_color_g * 255.0f) & 0xff) << 8) +
(((int)(settings->floats.video_msg_color_b * 255.0f) & 0xff));
/* Hexadecimal settings */
config_set_hex(conf, "video_message_color", msg_color);

View File

@ -213,6 +213,35 @@ typedef struct settings
#endif
} bools;
struct
{
float placeholder;
float video_scale;
float video_aspect_ratio;
float video_refresh_rate;
float video_font_size;
float video_msg_pos_x;
float video_msg_pos_y;
float video_msg_color_r;
float video_msg_color_g;
float video_msg_color_b;
float menu_wallpaper_opacity;
float menu_footer_opacity;
float menu_header_opacity;
float audio_rate_control_delta;
float audio_max_timing_skew;
float audio_volume; /* dB scale. */
float input_axis_threshold;
float input_overlay_opacity;
float input_overlay_scale;
float slowmotion_ratio;
float fastforward_ratio;
} floats;
bool modified;
video_viewport_t video_viewport_custom;
@ -225,7 +254,6 @@ typedef struct settings
{
char driver[32];
char context_driver[32];
float scale;
unsigned window_x;
unsigned window_y;
unsigned monitor_index;
@ -238,17 +266,8 @@ typedef struct settings
#ifdef GEKKO
unsigned viwidth;
#endif
float aspect_ratio;
unsigned aspect_ratio_idx;
unsigned rotation;
float refresh_rate;
float font_size;
float msg_pos_x;
float msg_pos_y;
float msg_color_r;
float msg_color_g;
float msg_color_b;
} video;
struct
@ -263,21 +282,6 @@ typedef struct settings
unsigned thumbnails;
struct
{
float opacity;
} wallpaper;
struct
{
float opacity;
} footer;
struct
{
float opacity;
} header;
struct
{
unsigned override_value;
@ -336,9 +340,6 @@ typedef struct settings
unsigned block_frames;
unsigned latency;
float rate_control_delta;
float max_timing_skew;
float volume; /* dB scale. */
#ifdef HAVE_WASAPI
struct
@ -365,15 +366,12 @@ typedef struct settings
unsigned libretro_device[MAX_USERS];
unsigned analog_dpad_mode[MAX_USERS];
float axis_threshold;
unsigned joypad_map[MAX_USERS];
unsigned device[MAX_USERS];
unsigned turbo_period;
unsigned turbo_duty_cycle;
float overlay_opacity;
float overlay_scale;
unsigned bind_timeout;
@ -474,8 +472,6 @@ typedef struct settings
size_t rewind_buffer_size;
unsigned rewind_granularity;
float slowmotion_ratio;
float fastforward_ratio;
unsigned autosave_interval;

View File

@ -1056,11 +1056,11 @@ static int exynos_init_font(struct exynos_video *vid)
if (font_renderer_create_default(&vid->font_driver, &vid->font,
*settings->video.font_path ? settings->video.font_path : NULL,
settings->video.font_size))
settings->floats.video_font_size))
{
const int r = settings->video.msg_color_r * 15;
const int g = settings->video.msg_color_g * 15;
const int b = settings->video.msg_color_b * 15;
const int r = settings->floats.video_msg_color_r * 15;
const int g = settings->floats.video_msg_color_g * 15;
const int b = settings->floats.video_msg_color_b * 15;
vid->font_color = ((b < 0 ? 0 : (b > 15 ? 15 : b)) << 0) |
((g < 0 ? 0 : (g > 15 ? 15 : g)) << 4) |
@ -1099,8 +1099,8 @@ static int exynos_render_msg(struct exynos_video *vid,
struct exynos_data *pdata = vid->data;
struct g2d_image *dst = pdata->src[EXYNOS_IMAGE_FONT];
settings_t *settings = config_get_ptr();
int msg_base_x = settings->video.msg_pos_x * dst->width;
int msg_base_y = (1.0f - settings->video.msg_pos_y) * dst->height;
int msg_base_x = settings->floats.video_msg_pos_x * dst->width;
int msg_base_y = (1.0f - settings->floats.video_msg_pos_y) * dst->height;
if (!vid->font || !vid->font_driver)
return -1;

View File

@ -112,9 +112,9 @@ static void sdl2_init_font(sdl2_video_t *vid, const char *font_path,
return;
}
r = settings->video.msg_color_r * 255;
g = settings->video.msg_color_g * 255;
b = settings->video.msg_color_b * 255;
r = settings->floats.video_msg_color_r * 255;
g = settings->floats.video_msg_color_g * 255;
b = settings->floats.video_msg_color_b * 255;
r = (r < 0) ? 0 : (r > 255 ? 255 : r);
g = (g < 0) ? 0 : (g > 255 ? 255 : g);
@ -168,8 +168,8 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)
if (!vid->font_data)
return;
x = settings->video.msg_pos_x * width;
y = (1.0f - settings->video.msg_pos_y) * height;
x = settings->floats.video_msg_pos_x * width;
y = (1.0f - settings->floats.video_msg_pos_y) * height;
delta_x = 0;
delta_y = 0;
@ -450,7 +450,7 @@ static void *sdl2_gfx_init(const video_info_t *video,
SDL_ShowCursor(SDL_DISABLE);
sdl2_init_renderer(vid);
sdl2_init_font(vid, settings->path.font, settings->video.font_size);
sdl2_init_font(vid, settings->path.font, settings->floats.video_font_size);
sdl2_gfx_set_handles(vid);

View File

@ -100,15 +100,15 @@ static void sdl_init_font(sdl_video_t *vid, const char *font_path, unsigned font
if (!font_renderer_create_default((const void**)&vid->font_driver, &vid->font,
*settings->path.font ? settings->path.font : NULL,
settings->video.font_size))
settings->floats.video_font_size))
{
RARCH_LOG("[SDL]: Could not initialize fonts.\n");
return;
}
r = settings->video.msg_color_r * 255;
g = settings->video.msg_color_g * 255;
b = settings->video.msg_color_b * 255;
r = settings->floats.video_msg_color_r * 255;
g = settings->floats.video_msg_color_g * 255;
b = settings->floats.video_msg_color_b * 255;
r = (r < 0) ? 0 : (r > 255 ? 255 : r);
g = (g < 0) ? 0 : (g > 255 ? 255 : g);
@ -294,7 +294,7 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
}
}
sdl_init_font(vid, settings->path.font, settings->video.font_size);
sdl_init_font(vid, settings->path.font, settings->floats.video_font_size);
vid->scaler.scaler_type = video->smooth ? SCALER_TYPE_BILINEAR : SCALER_TYPE_POINT;
vid->scaler.in_fmt = video->rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGB565;

View File

@ -196,7 +196,7 @@ static void *vg_init(const video_info_t *video,
if ( video->font_enable
&& font_renderer_create_default((const void**)&vg->font_driver, &vg->mFontRenderer,
*settings->path.font ? settings->path.font : NULL, settings->video.font_size))
*settings->path.font ? settings->path.font : NULL, settings->floats.video_font_size))
{
vg->mFont = vgCreateFont(0);
@ -206,18 +206,18 @@ static void *vg_init(const video_info_t *video,
VGfloat paintBg[4];
vg->mFontsOn = true;
vg->mFontHeight = settings->video.font_size;
vg->mFontHeight = settings->floats.video_font_size;
vg->mPaintFg = vgCreatePaint();
vg->mPaintBg = vgCreatePaint();
paintFg[0] = settings->video.msg_color_r;
paintFg[1] = settings->video.msg_color_g;
paintFg[2] = settings->video.msg_color_b;
paintFg[0] = settings->floats.video_msg_color_r;
paintFg[1] = settings->floats.video_msg_color_g;
paintFg[2] = settings->floats.video_msg_color_b;
paintFg[3] = 1.0f;
paintBg[0] = settings->video.msg_color_r / 2.0f;
paintBg[1] = settings->video.msg_color_g / 2.0f;
paintBg[2] = settings->video.msg_color_b / 2.0f;
paintBg[0] = settings->floats.video_msg_color_r / 2.0f;
paintBg[1] = settings->floats.video_msg_color_g / 2.0f;
paintBg[2] = settings->floats.video_msg_color_b / 2.0f;
paintBg[3] = 0.5f;
vgSetParameteri(vg->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);

View File

@ -141,14 +141,14 @@ static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size)
if (font_renderer_create_default((const void**)&xv->font_driver,
&xv->font, *settings->path.font
? settings->path.font : NULL, settings->video.font_size))
? settings->path.font : NULL, settings->floats.video_font_size))
{
int r, g, b;
r = settings->video.msg_color_r * 255;
r = settings->floats.video_msg_color_r * 255;
r = (r < 0 ? 0 : (r > 255 ? 255 : r));
g = settings->video.msg_color_g * 255;
g = settings->floats.video_msg_color_g * 255;
g = (g < 0 ? 0 : (g > 255 ? 255 : g));
b = settings->video.msg_color_b * 255;
b = settings->floats.video_msg_color_b * 255;
b = (b < 0 ? 0 : (b > 255 ? 255 : b));
xv_calculate_yuv(&xv->font_y, &xv->font_u, &xv->font_v,
@ -605,7 +605,7 @@ static void *xv_init(const video_info_t *video,
}
xv_init_yuv_tables(xv);
xv_init_font(xv, settings->path.font, settings->video.font_size);
xv_init_font(xv, settings->path.font, settings->floats.video_font_size);
if (!x11_input_ctx_new(true))
goto error;
@ -690,8 +690,8 @@ static void xv_render_msg(xv_t *xv, const char *msg,
atlas = xv->font_driver->get_atlas(xv->font);
msg_base_x = settings->video.msg_pos_x * width;
msg_base_y = height * (1.0f - settings->video.msg_pos_y);
msg_base_x = settings->floats.video_msg_pos_x * width;
msg_base_y = height * (1.0f - settings->floats.video_msg_pos_y);
luma_index[0] = xv->luma_index[0];
luma_index[1] = xv->luma_index[1];

View File

@ -1500,9 +1500,9 @@ static void cg_d3d9_renderchain_set_font_rect(
{
settings_t *settings = config_get_ptr();
d3d_video_t *d3d = (d3d_video_t*)data;
float pos_x = settings->video.msg_pos_x;
float pos_y = settings->video.msg_pos_y;
float font_size = settings->video.font_size;
float pos_x = settings->floats.video_msg_pos_x;
float pos_y = settings->floats.video_msg_pos_y;
float font_size = settings->floats.video_font_size;
const struct font_params *params = (const struct font_params*)font_data;
if (params)

View File

@ -495,7 +495,7 @@ void font_driver_init_osd(void *video_data, bool threading_hint, enum font_drive
video_font_driver = font_driver_init_first(video_data,
*settings->path.font ? settings->path.font : NULL,
settings->video.font_size, threading_hint, api);
settings->floats.video_font_size, threading_hint, api);
if (!video_font_driver)
RARCH_ERR("[font]: Failed to initialize OSD font.\n");

View File

@ -751,11 +751,11 @@ static bool video_driver_init_internal(void)
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
width = roundf(base_width * settings->floats.video_scale);
}
else
width = roundf(geom->base_width * settings->video.scale);
height = roundf(geom->base_height * settings->video.scale);
width = roundf(geom->base_width * settings->floats.video_scale);
height = roundf(geom->base_height * settings->floats.video_scale);
}
}
@ -1020,7 +1020,7 @@ void video_monitor_set_refresh_rate(float hz)
RARCH_LOG("%s\n", msg);
configuration_set_float(settings,
settings->video.refresh_rate,
settings->floats.video_refresh_rate,
hz);
}
@ -1165,6 +1165,7 @@ void video_driver_monitor_adjust_system_rates(void)
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
settings_t *settings = config_get_ptr();
float video_refresh_rate = settings->floats.video_refresh_rate;
runloop_ctl(RUNLOOP_CTL_UNSET_NONBLOCK_FORCED, NULL);
@ -1174,18 +1175,18 @@ void video_driver_monitor_adjust_system_rates(void)
if (!info || info->fps <= 0.0)
return;
timing_skew = fabs(1.0f - info->fps / settings->video.refresh_rate);
timing_skew = fabs(1.0f - info->fps / video_refresh_rate);
/* We don't want to adjust pitch too much. If we have extreme cases,
* just don't readjust at all. */
if (timing_skew <= settings->audio.max_timing_skew)
if (timing_skew <= settings->floats.audio_max_timing_skew)
return;
RARCH_LOG("[Video]: Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n",
settings->video.refresh_rate,
video_refresh_rate,
(float)info->fps);
if (info->fps <= settings->video.refresh_rate)
if (info->fps <= video_refresh_rate)
return;
/* We won't be able to do VSync reliably when game FPS > monitor FPS. */
@ -1367,7 +1368,7 @@ void video_driver_set_viewport_config(void)
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
if (settings->video.aspect_ratio < 0.0f)
if (settings->floats.video_aspect_ratio < 0.0f)
{
struct retro_game_geometry *geom = &av_info->geometry;
@ -1393,7 +1394,7 @@ void video_driver_set_viewport_config(void)
else
{
aspectratio_lut[ASPECT_RATIO_CONFIG].value =
settings->video.aspect_ratio;
settings->floats.video_aspect_ratio;
}
}
@ -2237,7 +2238,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
settings_t *settings = NULL;
video_driver_threaded_lock();
settings = config_get_ptr();
video_info->refresh_rate = settings->video.refresh_rate;
video_info->refresh_rate = settings->floats.video_refresh_rate;
video_info->black_frame_insertion =
settings->bools.video_black_frame_insertion;
video_info->hard_sync = settings->bools.video_hard_sync;
@ -2252,11 +2253,11 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->monitor_index = settings->video.monitor_index;
video_info->shared_context = settings->bools.video_shared_context;
video_info->font_enable = settings->bools.video_font_enable;
video_info->font_msg_pos_x = settings->video.msg_pos_x;
video_info->font_msg_pos_y = settings->video.msg_pos_y;
video_info->font_msg_color_r = settings->video.msg_color_r;
video_info->font_msg_color_g = settings->video.msg_color_g;
video_info->font_msg_color_b = settings->video.msg_color_b;
video_info->font_msg_pos_x = settings->floats.video_msg_pos_x;
video_info->font_msg_pos_y = settings->floats.video_msg_pos_y;
video_info->font_msg_color_r = settings->floats.video_msg_color_r;
video_info->font_msg_color_g = settings->floats.video_msg_color_g;
video_info->font_msg_color_b = settings->floats.video_msg_color_b;
video_info->fps_text[0] = '\0';
@ -2268,8 +2269,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->libretro_running = false;
#ifdef HAVE_MENU
video_info->menu_is_alive = menu_driver_is_alive();
video_info->menu_footer_opacity = settings->menu.footer.opacity;
video_info->menu_header_opacity = settings->menu.header.opacity;
video_info->menu_footer_opacity = settings->floats.menu_footer_opacity;
video_info->menu_header_opacity = settings->floats.menu_header_opacity;
video_info->materialui_color_theme = settings->menu.materialui.menu_color_theme;
video_info->menu_shader_pipeline = settings->menu.xmb.shader_pipeline;
video_info->xmb_theme = settings->menu.xmb.theme;
@ -2278,7 +2279,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->battery_level_enable = settings->bools.menu_battery_level_enable;
video_info->xmb_shadows_enable = settings->bools.menu_xmb_shadows_enable;
video_info->xmb_alpha_factor = settings->menu.xmb.alpha_factor;
video_info->menu_wallpaper_opacity = settings->menu.wallpaper.opacity;
video_info->menu_wallpaper_opacity = settings->floats.menu_wallpaper_opacity;
if (!settings->bools.menu_pause_libretro)
video_info->libretro_running = (rarch_ctl(RARCH_CTL_IS_INITED, NULL)

View File

@ -271,6 +271,7 @@ void input_poll(void)
size_t i;
settings_t *settings = config_get_ptr();
unsigned max_users = settings->input.max_users;
float axis_threshold = settings->floats.input_axis_threshold;
current_input->poll(current_input_data);
@ -284,7 +285,7 @@ void input_poll(void)
libretro_input_binds[i][RARCH_TURBO_ENABLE].valid)
{
rarch_joypad_info_t joypad_info;
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = axis_threshold;
joypad_info.joy_idx = settings->input.joypad_map[i];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
@ -301,9 +302,9 @@ void input_poll(void)
if (overlay_ptr && input_overlay_is_alive(overlay_ptr))
input_poll_overlay(
overlay_ptr,
settings->input.overlay_opacity,
settings->floats.input_overlay_opacity,
settings->input.analog_dpad_mode[0],
settings->input.axis_threshold);
axis_threshold);
#endif
#ifdef HAVE_COMMAND
@ -379,7 +380,7 @@ int16_t input_state(unsigned port, unsigned device,
{
rarch_joypad_info_t joypad_info;
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
joypad_info.joy_idx = settings->input.joypad_map[port];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
@ -496,7 +497,7 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
if (!input_driver_block_libretro_input)
{
rarch_joypad_info_t joypad_info;
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
for (i = 4; i < 16; i++)
{
@ -557,7 +558,7 @@ static INLINE bool input_menu_keys_pressed_internal(
joypad_info.joy_idx = settings->input.joypad_map[port];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
if (sec && input_joypad_pressed(sec,
joypad_info, port, input_config_binds[0], i))
@ -692,7 +693,7 @@ uint64_t input_menu_keys_pressed(
joypad_info.joy_idx = 0;
joypad_info.auto_binds = NULL;
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
input_driver_block_libretro_input = false;
input_driver_block_hotkey = false;
@ -838,7 +839,7 @@ static INLINE bool input_keys_pressed_internal(
joypad_info.joy_idx = settings->input.joypad_map[0];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
if (bind_valid && current_input->input_state(current_input_data,
joypad_info, &binds,
@ -915,7 +916,7 @@ uint64_t input_keys_pressed(
joypad_info.joy_idx = 0;
joypad_info.auto_binds = NULL;
joypad_info.axis_threshold = settings->input.axis_threshold;
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
input_driver_block_libretro_input = false;
input_driver_block_hotkey = false;

View File

@ -1481,23 +1481,23 @@ void general_read_handler(void *data)
switch (setting->enum_idx)
{
case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA:
*setting->value.target.fraction = settings->audio.rate_control_delta;
*setting->value.target.fraction = settings->floats.audio_rate_control_delta;
if (*setting->value.target.fraction < 0.0005)
{
configuration_set_bool(settings, settings->bools.audio_rate_control, false);
settings->audio.rate_control_delta = 0.0;
settings->floats.audio_rate_control_delta = 0.0;
}
else
{
configuration_set_bool(settings, settings->bools.audio_rate_control, true);
settings->audio.rate_control_delta = *setting->value.target.fraction;
settings->floats.audio_rate_control_delta = *setting->value.target.fraction;
}
break;
case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW:
*setting->value.target.fraction = settings->audio.max_timing_skew;
*setting->value.target.fraction = settings->floats.audio_max_timing_skew;
break;
case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO:
*setting->value.target.fraction = settings->video.refresh_rate;
*setting->value.target.fraction = settings->floats.video_refresh_rate;
break;
case MENU_ENUM_LABEL_INPUT_PLAYER1_JOYPAD_INDEX:
*setting->value.target.integer = settings->input.joypad_map[0];
@ -1596,19 +1596,19 @@ void general_write_handler(void *data)
}
break;
case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW:
configuration_set_float(settings, settings->audio.max_timing_skew,
configuration_set_float(settings, settings->floats.audio_max_timing_skew,
*setting->value.target.fraction);
break;
case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA:
if (*setting->value.target.fraction < 0.0005)
{
configuration_set_bool(settings, settings->bools.audio_rate_control, false);
settings->audio.rate_control_delta = 0.0;
settings->floats.audio_rate_control_delta = 0.0;
}
else
{
configuration_set_bool(settings, settings->bools.audio_rate_control, true);
settings->audio.rate_control_delta = *setting->value.target.fraction;
settings->floats.audio_rate_control_delta = *setting->value.target.fraction;
}
break;
case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO:
@ -1618,8 +1618,8 @@ void general_write_handler(void *data)
rarch_cmd = CMD_EVENT_VIDEO_SET_BLOCKING_STATE;
break;
case MENU_ENUM_LABEL_VIDEO_SCALE:
settings->modified = true;
settings->video.scale = roundf(*setting->value.target.fraction);
settings->modified = true;
settings->floats.video_scale = roundf(*setting->value.target.fraction);
if (!settings->bools.video_fullscreen)
rarch_cmd = CMD_EVENT_REINIT;
@ -3189,7 +3189,7 @@ static bool setting_append_list(
}
CONFIG_FLOAT(
list, list_info,
&settings->video.refresh_rate,
&settings->floats.video_refresh_rate,
MENU_ENUM_LABEL_VIDEO_REFRESH_RATE,
MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE,
refresh_rate,
@ -3204,7 +3204,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->video.refresh_rate,
&settings->floats.video_refresh_rate,
MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO,
MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO,
refresh_rate,
@ -3359,7 +3359,7 @@ static bool setting_append_list(
{
CONFIG_FLOAT(
list, list_info,
&settings->video.scale,
&settings->floats.video_scale,
MENU_ENUM_LABEL_VIDEO_SCALE,
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE,
scale,
@ -3727,7 +3727,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->audio.volume,
&settings->floats.audio_volume,
MENU_ENUM_LABEL_AUDIO_VOLUME,
MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME,
audio_volume,
@ -3803,7 +3803,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->audio.rate_control_delta,
&settings->floats.audio_rate_control_delta,
MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA,
MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA,
rate_control_delta,
@ -3825,7 +3825,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->audio.max_timing_skew,
&settings->floats.audio_max_timing_skew,
MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW,
MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW,
max_timing_skew,
@ -4185,7 +4185,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->input.axis_threshold,
&settings->floats.input_axis_threshold,
MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD,
MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD,
axis_threshold,
@ -4432,7 +4432,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->fastforward_ratio,
&settings->floats.fastforward_ratio,
MENU_ENUM_LABEL_FASTFORWARD_RATIO,
MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO,
fastforward_ratio,
@ -4447,7 +4447,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->slowmotion_ratio,
&settings->floats.slowmotion_ratio,
MENU_ENUM_LABEL_SLOWMOTION_RATIO,
MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO,
slowmotion_ratio,
@ -4521,7 +4521,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->video.font_size,
&settings->floats.video_font_size,
MENU_ENUM_LABEL_VIDEO_FONT_SIZE,
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE,
font_size,
@ -4535,7 +4535,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->video.msg_pos_x,
&settings->floats.video_msg_pos_x,
MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X,
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X,
message_pos_offset_x,
@ -4549,7 +4549,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->video.msg_pos_y,
&settings->floats.video_msg_pos_y,
MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y,
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y,
message_pos_offset_y,
@ -4642,7 +4642,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->input.overlay_opacity,
&settings->floats.input_overlay_opacity,
MENU_ENUM_LABEL_OVERLAY_OPACITY,
MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY,
0.7f,
@ -4658,7 +4658,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->input.overlay_scale,
&settings->floats.input_overlay_scale,
MENU_ENUM_LABEL_OVERLAY_SCALE,
MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE,
1.0f,
@ -4708,7 +4708,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->menu.wallpaper.opacity,
&settings->floats.menu_wallpaper_opacity,
MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY,
MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY,
menu_wallpaper_opacity,
@ -5193,7 +5193,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->menu.header.opacity,
&settings->floats.menu_header_opacity,
MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY,
MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY,
menu_header_opacity,
@ -5207,7 +5207,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->menu.footer.opacity,
&settings->floats.menu_footer_opacity,
MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY,
MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY,
menu_footer_opacity,

View File

@ -317,8 +317,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
float fastforward_ratio =
(settings->fastforward_ratio == 0.0f)
? 1.0f : settings->fastforward_ratio;
(settings->floats.fastforward_ratio == 0.0f)
? 1.0f : settings->floats.fastforward_ratio;
frame_limit_last_time = cpu_features_get_time_usec();
frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f
@ -828,7 +828,7 @@ static enum runloop_state runloop_check_state(
if (menu_driver_is_alive())
{
if (!settings->bools.menu_throttle_framerate && !settings->fastforward_ratio)
if (!settings->bools.menu_throttle_framerate && !settings->floats.fastforward_ratio)
return RUNLOOP_STATE_MENU_ITERATE;
return RUNLOOP_STATE_END;
@ -1091,7 +1091,7 @@ int runloop_iterate(unsigned *sleep_ms)
delta = runloop_frame_time.reference;
if (!is_locked_fps && runloop_slowmotion)
delta /= settings->slowmotion_ratio;
delta /= settings->floats.slowmotion_ratio;
runloop_frame_time_last = current;
@ -1179,7 +1179,7 @@ int runloop_iterate(unsigned *sleep_ms)
autosave_unlock();
if (!settings->fastforward_ratio)
if (!settings->floats.fastforward_ratio)
return 0;
end:

View File

@ -712,8 +712,8 @@ static void task_overlay_handler(retro_task_t *task)
data->active = loader->active;
data->hide_in_menu = settings->bools.input_overlay_hide_in_menu;
data->overlay_enable = settings->bools.input_overlay_enable;
data->overlay_opacity = settings->input.overlay_opacity;
data->overlay_scale = settings->input.overlay_scale;
data->overlay_opacity = settings->floats.input_overlay_opacity;
data->overlay_scale = settings->floats.input_overlay_scale;
task_set_data(task, data);
}