Updates pt. 3

This commit is contained in:
twinaphex 2015-03-20 22:08:36 +01:00
parent 950f15ac2c
commit f130b00596
35 changed files with 373 additions and 275 deletions

View File

@ -105,6 +105,7 @@ core_info_list_t *core_info_list_new(const char *modules_path)
size_t i;
core_info_t *core_info = NULL;
core_info_list_t *core_info_list = NULL;
settings_t *settings = config_get_ptr();
struct string_list *contents = (struct string_list*)
dir_list_new(modules_path, EXT_EXECUTABLES, false);
@ -142,8 +143,8 @@ core_info_list_t *core_info_list_new(const char *modules_path)
strlcat(info_path_base, ".info", sizeof(info_path_base));
fill_pathname_join(info_path, (*g_settings.libretro_info_path) ?
g_settings.libretro_info_path : modules_path,
fill_pathname_join(info_path, (*settings->libretro_info_path) ?
settings->libretro_info_path : modules_path,
info_path_base, sizeof(info_path));
core_info[i].data = config_file_new(info_path);

View File

@ -122,14 +122,20 @@ static void d3d_deinit_shader(void *data)
static bool d3d_init_shader(void *data)
{
const char *shader_path = NULL;
const shader_backend_t *backend = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
(void)d3d;
(void)data;
#if defined(HAVE_HLSL)
RARCH_LOG("D3D]: Using HLSL shader backend.\n");
const shader_backend_t *backend = &hlsl_backend;
const char *shader_path = g_settings.video.shader_path;
backend = &hlsl_backend;
shader_path = settings->video.shader_path;
d3d->shader = backend;
if (!d3d->shader)
return false;
@ -227,6 +233,7 @@ static bool d3d_init_base(void *data, const video_info_t *info)
static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
{
bool ret = true;
settings_t *settings = config_get_ptr();
if (!d3d)
return false;
@ -297,10 +304,10 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
}
#if defined(_XBOX360)
strlcpy(g_settings.video.font_path, "game:\\media\\Arial_12.xpr",
sizeof(g_settings.video.font_path));
strlcpy(settings->video.font_path, "game:\\media\\Arial_12.xpr",
sizeof(settings->video.font_path));
#endif
d3d->font_ctx = d3d_font_init_first(d3d, g_settings.video.font_path, 0);
d3d->font_ctx = d3d_font_init_first(d3d, settings->video.font_path, 0);
if (!d3d->font_ctx)
{
RARCH_ERR("Failed to initialize font.\n");
@ -349,7 +356,9 @@ static void d3d_calculate_rect(d3d_video_t *d3d,
unsigned width, unsigned height,
bool keep, float desired_aspect)
{
if (g_settings.video.scale_integer)
settings_t *settings = config_get_ptr();
if (settings->video.scale_integer)
{
struct video_viewport vp = {0};
video_viewport_get_scaled_integer(&vp, width, height, desired_aspect, keep);
@ -359,7 +368,7 @@ static void d3d_calculate_rect(d3d_video_t *d3d,
d3d_set_viewport(d3d, 0, 0, width, height);
else
{
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const video_viewport_t *custom =
&g_extern.console.screen.viewports.custom_vp;
@ -508,7 +517,8 @@ static bool d3d_construct(d3d_video_t *d3d,
void **input_data)
{
unsigned full_x, full_y;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
d3d->should_resize = false;
#ifndef _XBOX
@ -556,7 +566,7 @@ static bool d3d_construct(d3d_video_t *d3d,
#ifdef HAVE_MONITOR
RECT mon_rect = d3d_monitor_rect(d3d);
bool windowed_full = g_settings.video.windowed_fullscreen;
bool windowed_full = settings->video.windowed_fullscreen;
full_x = (windowed_full || info->width == 0) ?
(mon_rect.right - mon_rect.left) : info->width;
@ -612,7 +622,7 @@ static bool d3d_construct(d3d_video_t *d3d,
);
#if defined(HAVE_WINDOW) && !defined(_XBOX)
if (!info->fullscreen && g_settings.ui.menubar_enable)
if (!info->fullscreen && settings->ui.menubar_enable)
{
RECT rc_temp = {0, 0, win_height, 0x7FFF};
@ -634,9 +644,9 @@ static bool d3d_construct(d3d_video_t *d3d,
* to avoid set_shader() to be overridden
* later. */
enum rarch_shader_type type =
video_shader_parse_type(g_settings.video.shader_path, RARCH_SHADER_NONE);
if (g_settings.video.shader_enable && type == RARCH_SHADER_CG)
d3d->cg_shader = g_settings.video.shader_path;
video_shader_parse_type(settings->video.shader_path, RARCH_SHADER_NONE);
if (settings->video.shader_enable && type == RARCH_SHADER_CG)
d3d->cg_shader = settings->video.shader_path;
if (!d3d_process_shader(d3d))
return false;
@ -692,14 +702,15 @@ static const gfx_ctx_driver_t *d3d_get_context(void *data)
TODO: GL core contexts through ANGLE? */
enum gfx_ctx_api api = GFX_CTX_DIRECT3D9_API;
unsigned major = 9, minor = 0;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
#if defined(_XBOX1)
api = GFX_CTX_DIRECT3D8_API;
major = 8;
#endif
return gfx_ctx_init_first(driver->video_data,
g_settings.video.context_driver,
settings->video.context_driver,
api, major, minor, false);
}
@ -832,6 +843,7 @@ static RECT d3d_monitor_rect(d3d_video_t *d3d)
MONITORINFOEX current_mon;
HMONITOR hm_to_use;
monitor_count = 0;
settings_t *settings = config_get_ptr();
EnumDisplayMonitors(NULL, NULL, d3d_monitor_enum_proc, 0);
@ -840,7 +852,7 @@ static RECT d3d_monitor_rect(d3d_video_t *d3d)
GetDesktopWindow(), MONITOR_DEFAULTTONEAREST);
hm_to_use = monitor_last;
fs_monitor = g_settings.video.monitor_index;
fs_monitor = settings->video.monitor_index;
if (fs_monitor && fs_monitor <= monitor_count
&& monitor_all[fs_monitor - 1])
@ -1232,9 +1244,10 @@ static void d3d_set_font_rect(d3d_video_t *d3d,
const struct font_params *params)
{
#ifndef _XBOX
float pos_x = g_settings.video.msg_pos_x;
float pos_y = g_settings.video.msg_pos_y;
float font_size = g_settings.video.font_size;
settings_t *settings = config_get_ptr();
float pos_x = settings->video.msg_pos_x;
float pos_y = settings->video.msg_pos_y;
float font_size = settings->video.font_size;
if (params)
{
@ -1299,13 +1312,14 @@ static bool d3d_process_shader(d3d_video_t *d3d)
static bool d3d_init_luts(d3d_video_t *d3d)
{
unsigned i;
settings_t *settings = config_get_ptr();
for (i = 0; i < d3d->shader.luts; i++)
{
bool ret = renderchain_add_lut(
d3d->chain, d3d->shader.lut[i].id, d3d->shader.lut[i].path,
d3d->shader.lut[i].filter == RARCH_FILTER_UNSPEC ?
g_settings.video.smooth :
settings->video.smooth :
(d3d->shader.lut[i].filter == RARCH_FILTER_LINEAR));
if (!ret)
@ -1610,6 +1624,7 @@ static bool d3d_frame(void *data, const void *frame,
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
(void)i;
@ -1657,7 +1672,7 @@ static bool d3d_frame(void *data, const void *frame,
/* Insert black frame first, so we
* can screenshot, etc. */
if (g_settings.video.black_frame_insertion)
if (settings->video.black_frame_insertion)
{
d3d_swap(d3d, d3dr);
if (d3d->needs_restore)

View File

@ -20,8 +20,9 @@
static INLINE D3DTEXTUREFILTERTYPE translate_filter(unsigned type)
{
settings_t *settings = config_get_ptr();
if (type == RARCH_FILTER_UNSPEC)
return g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT;
return settings->video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT;
return type == RARCH_FILTER_LINEAR ? D3DTEXF_LINEAR : D3DTEXF_POINT;
}

View File

@ -114,7 +114,8 @@ static void renderchain_render_pass(void *data, const void *frame, unsigned widt
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
runloop_t *runloop = rarch_main_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
settings_t *settings = config_get_ptr();
#if defined(_XBOX1)
d3dr->SetFlickerFilter(g_extern.console.screen.flicker_filter_index);
@ -126,8 +127,8 @@ static void renderchain_render_pass(void *data, const void *frame, unsigned widt
d3d_set_texture(d3dr, 0, d3d->tex);
d3d_set_viewport(d3d->dev, &d3d->final_viewport);
d3d_set_sampler_minfilter(d3dr, 0, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_magfilter(d3dr, 0, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_minfilter(d3dr, 0, settings->video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_magfilter(d3dr, 0, settings->video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
#if defined(_XBOX1)
d3d_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1, NULL);

View File

@ -215,6 +215,7 @@ static bool dispmanx_setup_scale(void *data, unsigned width,
int i, dst_ypos;
VC_DISPMANX_ALPHA_T layerAlpha;
struct dispmanx_video *_dispvars = data;
settings_t *settings = config_get_ptr();
if (!_dispvars)
return false;
@ -255,7 +256,7 @@ static bool dispmanx_setup_scale(void *data, unsigned width,
layerAlpha.mask = 0;
_dispvars->alpha = &layerAlpha;
switch (g_settings.video.aspect_ratio_idx)
switch (settings->video.aspect_ratio_idx)
{
case ASPECT_RATIO_4_3:
_dispvars->aspect = (float)4 / (float)3;

View File

@ -594,8 +594,9 @@ static int exynos_open(struct exynos_data *pdata)
int devidx;
unsigned i;
int fd = -1;
struct exynos_drm *drm = NULL;
struct exynos_drm *drm = NULL;
struct exynos_fliphandler *fliphandler = NULL;
settings_t *settings = config_get_ptr();
pdata->fd = -1;
@ -632,8 +633,8 @@ static int exynos_open(struct exynos_data *pdata)
for (i = 0; i < drm->resources->count_connectors; ++i)
{
if (g_settings.video.monitor_index != 0 &&
g_settings.video.monitor_index - 1 != i)
if (settings->video.monitor_index != 0 &&
settings->video.monitor_index - 1 != i)
continue;
drm->connector = drmModeGetConnector(fd, drm->resources->connectors[i]);
@ -716,16 +717,17 @@ static void exynos_close(struct exynos_data *pdata)
static int exynos_init(struct exynos_data *pdata, unsigned bpp)
{
unsigned i;
int fd = pdata->fd;
struct exynos_drm *drm = pdata->drm;
int fd = pdata->fd;
settings_t *settings = config_get_ptr();
if (g_settings.video.fullscreen_x != 0 &&
g_settings.video.fullscreen_y != 0)
if (settings->video.fullscreen_x != 0 &&
settings->video.fullscreen_y != 0)
{
for (i = 0; i < drm->connector->count_modes; i++)
{
if (drm->connector->modes[i].hdisplay == g_settings.video.fullscreen_x &&
drm->connector->modes[i].vdisplay == g_settings.video.fullscreen_y)
if (drm->connector->modes[i].hdisplay == settings->video.fullscreen_x &&
drm->connector->modes[i].vdisplay == settings->video.fullscreen_y)
{
drm->mode = &drm->connector->modes[i];
break;
@ -735,7 +737,7 @@ static int exynos_init(struct exynos_data *pdata, unsigned bpp)
if (drm->mode == NULL)
{
RARCH_ERR("video_exynos: requested resolution (%ux%u) not available\n",
g_settings.video.fullscreen_x, g_settings.video.fullscreen_y);
settings->video.fullscreen_x, settings->video.fullscreen_y);
goto fail;
}
@ -1177,21 +1179,22 @@ struct exynos_video
static int exynos_init_font(struct exynos_video *vid)
{
struct exynos_data *pdata = vid->data;
struct g2d_image *src = pdata->src[EXYNOS_IMAGE_FONT];
struct g2d_image *src = pdata->src[EXYNOS_IMAGE_FONT];
const unsigned buf_height = defaults[EXYNOS_IMAGE_FONT].height;
const unsigned buf_width = align_common(pdata->aspect * (float)buf_height, 16);
const unsigned buf_bpp = defaults[EXYNOS_IMAGE_FONT].bpp;
const unsigned buf_width = align_common(pdata->aspect * (float)buf_height, 16);
const unsigned buf_bpp = defaults[EXYNOS_IMAGE_FONT].bpp;
settings_t *settings = config_get_ptr();
if (!g_settings.video.font_enable)
if (!settings->video.font_enable)
return 0;
if (font_renderer_create_default(&vid->font_driver, &vid->font,
*g_settings.video.font_path ? g_settings.video.font_path : NULL,
g_settings.video.font_size))
*settings->video.font_path ? settings->video.font_path : NULL,
settings->video.font_size))
{
const int r = g_settings.video.msg_color_r * 15;
const int g = g_settings.video.msg_color_g * 15;
const int b = g_settings.video.msg_color_b * 15;
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;
vid->font_color = ((b < 0 ? 0 : (b > 15 ? 15 : b)) << 0) |
((g < 0 ? 0 : (g > 15 ? 15 : g)) << 4) |
@ -1227,9 +1230,10 @@ static int exynos_render_msg(struct exynos_video *vid,
{
const struct font_atlas *atlas;
struct exynos_data *pdata = vid->data;
struct g2d_image *dst = pdata->src[EXYNOS_IMAGE_FONT];
int msg_base_x = g_settings.video.msg_pos_x * dst->width;
int msg_base_y = (1.0f - g_settings.video.msg_pos_y) * dst->height;
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;
if (vid->font == NULL || vid->font_driver == NULL)
return -1;
@ -1409,6 +1413,7 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
{
struct exynos_video *vid = data;
struct exynos_page *page = NULL;
settings_t *settings = config_get_ptr();
/* Check if neither menu nor core framebuffer is to be displayed. */
if (!vid->menu_active && frame == NULL)
@ -1436,11 +1441,11 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
goto fail;
}
if (g_settings.fps_show)
if (settings->fps_show)
{
char buffer[128], buffer_fps[128];
video_monitor_get_fps(buffer, sizeof(buffer),
g_settings.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
settings->fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
rarch_main_msg_queue_push(buffer_fps, 1, 1, false);
}

View File

@ -206,8 +206,9 @@ static bool gl_shader_init(gl_t *gl)
enum rarch_shader_type type;
bool ret = false;
const shader_backend_t *backend = NULL;
const char *shader_path = (g_settings.video.shader_enable && *g_settings.video.shader_path) ?
g_settings.video.shader_path : NULL;
settings_t *settings = config_get_ptr();
const char *shader_path = (settings->video.shader_enable && *settings->video.shader_path) ?
settings->video.shader_path : NULL;
if (!gl)
@ -422,37 +423,43 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
static void gl_create_fbo_textures(gl_t *gl)
{
int i;
GLuint base_filt = g_settings.video.smooth ? GL_LINEAR : GL_NEAREST;
GLuint base_mip_filt = g_settings.video.smooth ?
settings_t *settings = config_get_ptr();
GLuint base_filt = settings->video.smooth ? GL_LINEAR : GL_NEAREST;
GLuint base_mip_filt = settings->video.smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
glGenTextures(gl->fbo_pass, gl->fbo_texture);
for (i = 0; i < gl->fbo_pass; i++)
{
enum gfx_wrap_type wrap;
GLenum min_filter, mag_filter, wrap_enum;
bool mipmapped = false;
bool smooth = false;
bool fp_fbo, srgb_fbo;
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i]);
bool mipmapped = gl->shader->mipmap_input(i + 2);
mipmapped = gl->shader->mipmap_input(i + 2);
GLenum min_filter = mipmapped ? base_mip_filt : base_filt;
bool smooth = false;
min_filter = mipmapped ? base_mip_filt : base_filt;
if (gl->shader->filter_type(i + 2, &smooth))
min_filter = mipmapped ? (smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST)
: (smooth ? GL_LINEAR : GL_NEAREST);
GLenum mag_filter = min_filter_to_mag(min_filter);
mag_filter = min_filter_to_mag(min_filter);
enum gfx_wrap_type wrap = gl->shader->wrap_type(i + 2);
GLenum wrap_enum = gl_wrap_type_to_enum(wrap);
wrap = gl->shader->wrap_type(i + 2);
wrap_enum = gl_wrap_type_to_enum(wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_enum);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_enum);
bool fp_fbo = gl->fbo_scale[i].fp_fbo;
bool srgb_fbo = gl->fbo_scale[i].srgb_fbo;
fp_fbo = gl->fbo_scale[i].fp_fbo;
srgb_fbo = gl->fbo_scale[i].srgb_fbo;
if (fp_fbo)
{
@ -465,7 +472,7 @@ static void gl_create_fbo_textures(gl_t *gl)
RARCH_ERR("[GL]: sRGB FBO was requested, but it is not supported. Falling back to UNORM. Result may have banding!\n");
}
if (g_settings.video.force_srgb_disable)
if (settings->video.force_srgb_disable)
srgb_fbo = false;
#ifndef HAVE_OPENGLES2
@ -763,13 +770,14 @@ void gl_set_viewport(gl_t *gl, unsigned width,
unsigned height, bool force_full, bool allow_rotate)
{
int x = 0, y = 0;
float device_aspect = (float)width / height;
float device_aspect = (float)width / height;
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
settings_t *settings = config_get_ptr();
if (gl->ctx_driver->translate_aspect)
device_aspect = gl->ctx_driver->translate_aspect(gl, width, height);
if (g_settings.video.scale_integer && !force_full)
if (settings->video.scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp, width, height,
g_extern.system.aspect_ratio, gl->keep_aspect);
@ -782,7 +790,7 @@ void gl_set_viewport(gl_t *gl, unsigned width,
float desired_aspect = g_extern.system.aspect_ratio;
#if defined(HAVE_MENU)
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
@ -1465,8 +1473,9 @@ static bool gl_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, const char *msg)
{
gl_t *gl = (gl_t*)data;
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
RARCH_PERFORMANCE_INIT(frame_run);
RARCH_PERFORMANCE_START(frame_run);
@ -1650,7 +1659,7 @@ static bool gl_frame(void *data, const void *frame,
#endif
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
if (g_settings.video.black_frame_insertion &&
if (settings->video.black_frame_insertion &&
!driver->nonblock_state && !runloop->is_slowmotion
&& !runloop->is_paused)
{
@ -1661,7 +1670,7 @@ static bool gl_frame(void *data, const void *frame,
gl->ctx_driver->swap_buffers(gl);
#ifdef HAVE_GL_SYNC
if (g_settings.video.hard_sync && gl->have_sync)
if (settings->video.hard_sync && gl->have_sync)
{
RARCH_PERFORMANCE_INIT(gl_fence);
RARCH_PERFORMANCE_START(gl_fence);
@ -1669,7 +1678,7 @@ static bool gl_frame(void *data, const void *frame,
gl->fences[gl->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
while (gl->fence_count > g_settings.video.hard_sync_frames)
while (gl->fence_count > settings->video.hard_sync_frames)
{
glClientWaitSync(gl->fences[0],
GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
@ -1794,7 +1803,8 @@ static void gl_free(void *data)
static void gl_set_nonblock_state(void *data, bool state)
{
gl_t *gl = (gl_t*)data;
gl_t *gl = (gl_t*)data;
settings_t *settings = config_get_ptr();
if (!gl)
return;
@ -1803,13 +1813,14 @@ static void gl_set_nonblock_state(void *data, bool state)
context_bind_hw_render(gl, false);
gl->ctx_driver->swap_interval(gl,
state ? 0 : g_settings.video.swap_interval);
state ? 0 : settings->video.swap_interval);
context_bind_hw_render(gl, true);
}
static bool resolve_extensions(gl_t *gl)
{
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
#ifndef HAVE_OPENGLES
const char *vendor = NULL;
const char *renderer = NULL;
@ -1845,7 +1856,7 @@ static bool resolve_extensions(gl_t *gl)
#ifdef HAVE_GL_SYNC
gl->have_sync = check_sync_proc(gl);
if (gl->have_sync && g_settings.video.hard_sync)
if (gl->have_sync && settings->video.hard_sync)
RARCH_LOG("[GL]: Using ARB_sync to reduce latency.\n");
#endif
@ -1899,7 +1910,7 @@ static bool resolve_extensions(gl_t *gl)
#endif
#ifdef HAVE_FBO
if (g_settings.video.force_srgb_disable)
if (settings->video.force_srgb_disable)
gl->has_srgb_fbo = false;
#endif
@ -1976,6 +1987,7 @@ static void gl_init_pbo_readback(gl_t *gl)
{
unsigned i;
struct scaler_ctx *scaler = NULL;
settings_t *settings = config_get_ptr();
(void)scaler;
/* Only bother with this if we're doing GPU recording.
@ -1983,7 +1995,7 @@ static void gl_init_pbo_readback(gl_t *gl)
* driver.recording_data, because recording is
* not initialized yet.
*/
gl->pbo_readback_enable = g_settings.video.gpu_record
gl->pbo_readback_enable = settings->video.gpu_record
&& g_extern.record.enable;
if (!gl->pbo_readback_enable)
return;
@ -2029,6 +2041,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
&g_extern.system.hw_render_callback;
unsigned major = cb->version_major;
unsigned minor = cb->version_minor;
settings_t *settings = config_get_ptr();
#ifdef HAVE_OPENGLES
enum gfx_ctx_api api = GFX_CTX_OPENGL_ES_API;
const char *api_name = "OpenGL ES 2.0";
@ -2049,10 +2062,10 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
(void)api_name;
gl->shared_context_use = g_settings.video.shared_context
gl->shared_context_use = settings->video.shared_context
&& cb->context_type != RETRO_HW_CONTEXT_NONE;
return gfx_ctx_init_first(gl, g_settings.video.context_driver,
return gfx_ctx_init_first(gl, settings->video.context_driver,
api, major, minor, gl->shared_context_use);
}
@ -2202,6 +2215,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
const char *renderer = NULL;
const char *version = NULL;
struct retro_hw_render_callback *hw_render = NULL;
settings_t *settings = config_get_ptr();
#ifdef _WIN32
gfx_set_dwm();
#endif
@ -2226,7 +2240,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y);
gl->ctx_driver->swap_interval(gl,
video->vsync ? g_settings.video.swap_interval : 0);
video->vsync ? settings->video.swap_interval : 0);
win_width = video->width;
win_height = video->height;
@ -2414,11 +2428,11 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
if (input && input_data)
gl->ctx_driver->input_driver(gl, input, input_data);
if (g_settings.video.font_enable)
if (settings->video.font_enable)
{
if (!gl_font_init_first(&gl->font_driver, &gl->font_handle,
gl, *g_settings.video.font_path
? g_settings.video.font_path : NULL, g_settings.video.font_size))
gl, *settings->video.font_path
? settings->video.font_path : NULL, settings->video.font_size))
RARCH_ERR("[GL]: Failed to initialize font renderer.\n");
}
@ -2491,6 +2505,7 @@ static void gl_update_tex_filter_frame(gl_t *gl)
GLenum wrap_mode;
GLuint new_filt;
bool smooth = false;
settings_t *settings = config_get_ptr();
if (!gl)
return;
@ -2498,7 +2513,7 @@ static void gl_update_tex_filter_frame(gl_t *gl)
context_bind_hw_render(gl, false);
if (!gl->shader->filter_type(1, &smooth))
smooth = g_settings.video.smooth;
smooth = settings->video.smooth;
wrap_mode = gl_wrap_type_to_enum(gl->shader->wrap_type(1));
gl->tex_mipmap = gl->shader->mipmap_input(1);

View File

@ -230,11 +230,12 @@ static void gx_free_overlay(gx_video_t *gx)
static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
bool fullscreen)
{
bool progressive;
unsigned modetype, level, viHeightMultiplier, viWidth, tvmode,
max_width, max_height, i;
bool progressive;
gx_video_t *gx = (gx_video_t*)data;
menu_handle_t *menu = menu_driver_resolve();
gx_video_t *gx = (gx_video_t*)data;
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
(void)level;
@ -242,7 +243,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
VISetBlack(true);
VIFlush();
viHeightMultiplier = 1;
viWidth = g_settings.video.viwidth;
viWidth = settings->video.viwidth;
#if defined(HW_RVL)
progressive = CONF_GetProgressiveScan() > 0 && VIDEO_HaveComponentCable();
switch (CONF_GetVideo())
@ -376,7 +377,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
GX_SetDispCopyDst(xfbWidth, xfbHeight);
GX_SetCopyFilter(gx_mode.aa, gx_mode.sample_pattern,
(gx_mode.xfbMode == VI_XFBMODE_SF) ? GX_FALSE : g_settings.video.vfilter,
(gx_mode.xfbMode == VI_XFBMODE_SF) ? GX_FALSE : settings->video.vfilter,
gx_mode.vfilter);
GXColor color = { 0, 0, 0, 0xff };
GX_SetCopyClear(color, GX_MAX_Z24);
@ -476,11 +477,12 @@ static void init_texture(void *data, unsigned width, unsigned height)
gx_video_t *gx = (gx_video_t*)data;
struct __gx_texobj *fb_ptr = (struct __gx_texobj*)&g_tex.obj;
struct __gx_texobj *menu_ptr = (struct __gx_texobj*)&menu_tex.obj;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
width &= ~3;
height &= ~3;
g_filter = g_settings.video.smooth ? GX_LINEAR : GX_NEAR;
g_filter = settings->video.smooth ? GX_LINEAR : GX_NEAR;
menu_w = 320;
menu_h = 240;
@ -828,9 +830,9 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
static void gx_resize(void *data)
{
gx_video_t *gx = (gx_video_t*)data;
int x = 0, y = 0;
unsigned width = gx->vp.full_width, height = gx->vp.full_height;
settings_t *settings = config_get_ptr();
#ifdef HW_RVL
VIDEO_SetTrapFilter(g_extern.console.softfilter_enable);
@ -854,7 +856,7 @@ static void gx_resize(void *data)
float delta;
#ifdef RARCH_CONSOLE
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
if (!g_extern.console.screen.viewports.custom_vp.width ||
!g_extern.console.screen.viewports.custom_vp.height)
@ -1029,6 +1031,7 @@ static bool gx_frame(void *data, const void *frame,
gx_video_t *gx = (gx_video_t*)data;
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
u8 clear_efb = GX_FALSE;
settings_t *settings = config_get_ptr();
RARCH_PERFORMANCE_INIT(gx_frame);
RARCH_PERFORMANCE_START(gx_frame);
@ -1117,7 +1120,7 @@ static bool gx_frame(void *data, const void *frame,
video_monitor_get_fps(fps_txt, sizeof(fps_txt),
fps_text_buf, sizeof(fps_text_buf));
if (g_settings.fps_show)
if (settings->fps_show)
{
char mem1_txt[128];
unsigned x = 15;

View File

@ -86,7 +86,8 @@ typedef struct omapfb_data
static const char *get_fb_device(void)
{
static char fbname[12];
const int fbidx = g_settings.video.monitor_index;
settings_t *settings = config_get_ptr();
const int fbidx = settings->video.monitor_index;
if (fbidx == 0)
return "/dev/fb0";
@ -555,6 +556,7 @@ static int omapfb_init(omapfb_data_t *pdata, unsigned bpp)
{
const char *fbname = get_fb_device();
int fd = open(fbname, O_RDWR);
settings_t *settings = config_get_ptr();
if (fd == -1)
{
@ -579,7 +581,7 @@ static int omapfb_init(omapfb_data_t *pdata, unsigned bpp)
pdata->bpp = bpp;
pdata->num_pages = 3;
pdata->sync = g_settings.video.vsync;
pdata->sync = settings->video.vsync;
return 0;
}
@ -807,21 +809,22 @@ static void omap_gfx_free(void *data)
static void omap_init_font(omap_video_t *vid, const char *font_path, unsigned font_size)
{
int r, g, b;
settings_t *settings = config_get_ptr();
if (!g_settings.video.font_enable)
if (!settings->video.font_enable)
return;
if (!(font_renderer_create_default(&vid->font_driver, &vid->font,
*g_settings.video.font_path ? g_settings.video.font_path : NULL, g_settings.video.font_size)))
*settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size)))
{
RARCH_LOG("video_omap: font init failed\n");
return;
}
{
r = g_settings.video.msg_color_r * 255;
g = g_settings.video.msg_color_g * 255;
b = g_settings.video.msg_color_b * 255;
r = settings->video.msg_color_r * 255;
g = settings->video.msg_color_g * 255;
b = settings->video.msg_color_b * 255;
r = (r < 0) ? 0 : (r > 255 ? 255 : r);
g = (g < 0) ? 0 : (g > 255 ? 255 : g);
@ -836,8 +839,9 @@ static void omap_init_font(omap_video_t *vid, const char *font_path, unsigned fo
static void omap_render_msg(omap_video_t *vid, const char *msg)
{
const struct font_atlas *atlas = NULL;
int msg_base_x = g_settings.video.msg_pos_x * vid->width;
int msg_base_y = (1.0 - g_settings.video.msg_pos_y) * vid->height;
settings_t *settings = config_get_ptr();
int msg_base_x = settings->video.msg_pos_x * vid->width;
int msg_base_y = (1.0 - settings->video.msg_pos_y) * vid->height;
if (!vid->font)
return;
@ -911,6 +915,7 @@ static void *omap_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
omap_video_t *vid = NULL;
settings_t *settings = config_get_ptr();
/* Don't support filters at the moment since they make estimations *
* on the maximum used resolution difficult. */
@ -948,7 +953,7 @@ static void *omap_gfx_init(const video_info_t *video,
if (input && input_data)
*input = NULL;
omap_init_font(vid, g_settings.video.font_path, g_settings.video.font_size);
omap_init_font(vid, settings->video.font_path, settings->video.font_size);
vid->menu.frame = calloc(vid->width * vid->height, vid->bytes_per_pixel);
if (vid->menu.frame == NULL)

View File

@ -470,7 +470,7 @@ static bool psp_frame(void *data, const void *frame,
{
static char fps_txt[128], fps_text_buf[128];
psp1_video_t *psp = (psp1_video_t*)data;
settings_t *settings = config_get_ptr();
#ifdef DISPLAY_FPS
static uint64_t currentTick,lastTick;
static float fps=0.0;
@ -493,10 +493,10 @@ static bool psp_frame(void *data, const void *frame,
pspDebugScreenSetXY(0,0);
video_monitor_get_fps(fps_txt, sizeof(fps_txt),
g_settings.fps_show ? fps_text_buf : NULL,
g_settings.fps_show ? sizeof(fps_text_buf) : 0);
settings->fps_show ? fps_text_buf : NULL,
settings->fps_show ? sizeof(fps_text_buf) : 0);
if(g_settings.fps_show)
if(settings->fps_show)
{
pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0);
pspDebugScreenPuts(fps_text_buf);
@ -692,13 +692,14 @@ static void psp_set_texture_enable(void *data, bool state, bool full_screen)
static void psp_update_viewport(psp1_video_t* psp)
{
int x = 0;
int y = 0;
float device_aspect = ((float)SCEGU_SCR_WIDTH) / SCEGU_SCR_HEIGHT;
float width = SCEGU_SCR_WIDTH;
float height = SCEGU_SCR_HEIGHT;
int x = 0;
int y = 0;
settings_t *settings = config_get_ptr();
if (g_settings.video.scale_integer)
if (settings->video.scale_integer)
{
video_viewport_get_scaled_integer(&psp->vp, SCEGU_SCR_WIDTH,
SCEGU_SCR_HEIGHT, g_extern.system.aspect_ratio, psp->keep_aspect);
@ -711,7 +712,7 @@ static void psp_update_viewport(psp1_video_t* psp)
float desired_aspect = g_extern.system.aspect_ratio;
#if defined(HAVE_MENU)
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom =
&g_extern.console.screen.viewports.custom_vp;

View File

@ -99,8 +99,9 @@ static void sdl2_init_font(sdl2_video_t *vid, const char *font_path,
SDL_Surface *tmp;
SDL_Palette *pal = NULL;
const struct font_atlas *atlas = NULL;
settings_t *settings = config_get_ptr();
if (!g_settings.video.font_enable)
if (!settings->video.font_enable)
return;
if (!font_renderer_create_default(&vid->font_driver, &vid->font_data,
@ -110,9 +111,9 @@ static void sdl2_init_font(sdl2_video_t *vid, const char *font_path,
return;
}
r = g_settings.video.msg_color_r * 255;
g = g_settings.video.msg_color_g * 255;
b = g_settings.video.msg_color_b * 255;
r = settings->video.msg_color_r * 255;
g = settings->video.msg_color_g * 255;
b = settings->video.msg_color_b * 255;
r = (r < 0) ? 0 : (r > 255 ? 255 : r);
g = (g < 0) ? 0 : (g > 255 ? 255 : g);
@ -161,12 +162,13 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)
int x, y, delta_x, delta_y;
unsigned width = vid->vp.width;
unsigned height = vid->vp.height;
settings_t *settings = config_get_ptr();
if (!vid->font_data)
return;
x = g_settings.video.msg_pos_x * width;
y = (1.0f - g_settings.video.msg_pos_y) * height;
x = settings->video.msg_pos_x * width;
y = (1.0f - settings->video.msg_pos_y) * height;
delta_x = 0;
delta_y = 0;
@ -263,6 +265,7 @@ static void sdl_refresh_renderer(sdl2_video_t *vid)
static void sdl_refresh_viewport(sdl2_video_t *vid)
{
int win_w, win_h;
settings_t *settings = config_get_ptr();
SDL_GetWindowSize(vid->window, &win_w, &win_h);
@ -273,10 +276,10 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
vid->vp.full_width = win_w;
vid->vp.full_height = win_h;
if (g_settings.video.scale_integer)
if (settings->video.scale_integer)
video_viewport_get_scaled_integer(&vid->vp, win_w, win_h, g_extern.system.aspect_ratio,
vid->video.force_aspect);
else if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
else if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
@ -370,6 +373,8 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
{
int i;
unsigned flags;
settings_t *settings = config_get_ptr();
#ifdef _WIN32
gfx_set_dwm();
#endif
@ -417,9 +422,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
if (video->fullscreen)
{
flags = g_settings.video.windowed_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN;
}
flags = settings->video.windowed_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN;
else
flags = SDL_WINDOW_RESIZABLE;
@ -433,7 +436,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
}
vid->video = *video;
vid->video.smooth = g_settings.video.smooth;
vid->video.smooth = settings->video.smooth;
vid->should_resize = true;
sdl_tex_zero(&vid->frame);
@ -443,7 +446,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
SDL_ShowCursor(SDL_DISABLE);
sdl2_init_renderer(vid);
sdl2_init_font(vid, g_settings.video.font_path, g_settings.video.font_size);
sdl2_init_font(vid, settings->video.font_path, settings->video.font_size);
sdl2_gfx_set_handles(vid);

View File

@ -111,20 +111,22 @@ static void sdl_update_scaler(SDL_Surface *surf, struct scaler_ctx *scaler,
static void sdl_init_font(sdl_video_t *vid, const char *font_path, unsigned font_size)
{
int r, g, b;
if (!g_settings.video.font_enable)
settings_t *settings = config_get_ptr();
if (!settings->video.font_enable)
return;
if (!font_renderer_create_default(&vid->font_driver, &vid->font,
*g_settings.video.font_path ? g_settings.video.font_path : NULL,
g_settings.video.font_size))
*settings->video.font_path ? settings->video.font_path : NULL,
settings->video.font_size))
{
RARCH_LOG("[SDL]: Could not initialize fonts.\n");
return;
}
r = g_settings.video.msg_color_r * 255;
g = g_settings.video.msg_color_g * 255;
b = g_settings.video.msg_color_b * 255;
r = settings->video.msg_color_r * 255;
g = settings->video.msg_color_g * 255;
b = settings->video.msg_color_b * 255;
r = (r < 0) ? 0 : (r > 255 ? 255 : r);
g = (g < 0) ? 0 : (g > 255 ? 255 : g);
@ -140,14 +142,16 @@ static void sdl_render_msg(sdl_video_t *vid, SDL_Surface *buffer,
{
int x, y, msg_base_x, msg_base_y;
unsigned rshift, gshift, bshift;
const struct font_atlas *atlas = NULL;
settings_t *settings = config_get_ptr();
if (!vid->font)
return;
const struct font_atlas *atlas = vid->font_driver->get_atlas(vid->font);
atlas = vid->font_driver->get_atlas(vid->font);
msg_base_x = g_settings.video.msg_pos_x * width;
msg_base_y = (1.0f - g_settings.video.msg_pos_y) * height;
msg_base_x = settings->video.msg_pos_x * width;
msg_base_y = (1.0f - settings->video.msg_pos_y) * height;
rshift = fmt->Rshift;
gshift = fmt->Gshift;
@ -244,6 +248,8 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
{
unsigned full_x, full_y;
sdl_video_t *vid = NULL;
settings_t *settings = config_get_ptr();
#ifdef _WIN32
gfx_set_dwm();
#endif
@ -307,7 +313,7 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
}
}
sdl_init_font(vid, g_settings.video.font_path, g_settings.video.font_size);
sdl_init_font(vid, settings->video.font_path, settings->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

@ -1323,8 +1323,9 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
if (_dispvars->src_width != width || _dispvars->src_height != height)
{
int i;
unsigned inc_yoffset, xpos, visible_width;
float aspect;
unsigned inc_yoffset, xpos, visible_width;
settings_t *settings = config_get_ptr();
/* Sanity check on new dimensions */
if (width == 0 || height == 0)
@ -1349,7 +1350,7 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
for (i = 0; i < _dispvars->numpages; i++)
_dispvars->pages[i].yoffset = i * inc_yoffset;
switch (g_settings.video.aspect_ratio_idx)
switch (settings->video.aspect_ratio_idx)
{
case ASPECT_RATIO_4_3:
aspect = (float)4 / (float)3;

View File

@ -84,11 +84,14 @@ static INLINE bool vg_query_extension(const char *ext)
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
VGfloat clearColor[4] = {0, 0, 0, 1};
settings_t *settings = config_get_ptr();
vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
if (!vg)
return NULL;
vg->driver = gfx_ctx_init_first(vg, g_settings.video.context_driver,
vg->driver = gfx_ctx_init_first(vg, settings->video.context_driver,
GFX_CTX_OPENVG_API, 0, 0, false);
if (!vg->driver)
@ -129,7 +132,6 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
else
vg->mScreenAspect = (float)vg->mScreenWidth / vg->mScreenHeight;
VGfloat clearColor[4] = {0, 0, 0, 1};
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vg->mTextureWidth = vg->mTextureHeight = video->input_scale * RARCH_SCALE_BASE;
@ -139,8 +141,8 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
vg->driver->input_driver(vg, input, input_data);
if (g_settings.video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer,
*g_settings.video.font_path ? g_settings.video.font_path : NULL, g_settings.video.font_size))
if (settings->video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer,
*settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size))
{
vg->mFont = vgCreateFont(0);
@ -148,12 +150,12 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
{
vg->mFontsOn = true;
vg->mFontHeight = g_settings.video.font_size;
vg->mFontHeight = settings->video.font_size;
vg->mPaintFg = vgCreatePaint();
vg->mPaintBg = vgCreatePaint();
VGfloat paintFg[] = { g_settings.video.msg_color_r, g_settings.video.msg_color_g, g_settings.video.msg_color_b, 1.0f };
VGfloat paintBg[] = { g_settings.video.msg_color_r / 2.0f, g_settings.video.msg_color_g / 2.0f, g_settings.video.msg_color_b / 2.0f, 0.5f };
VGfloat paintFg[] = { settings->video.msg_color_r, settings->video.msg_color_g, settings->video.msg_color_b, 1.0f };
VGfloat paintBg[] = { settings->video.msg_color_r / 2.0f, settings->video.msg_color_g / 2.0f, settings->video.msg_color_b / 2.0f, 0.5f };
vgSetParameteri(vg->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetParameterfv(vg->mPaintFg, VG_PAINT_COLOR, 4, paintFg);
@ -257,6 +259,8 @@ static void vg_render_message(vg_t *vg, const char *msg)
static void vg_draw_message(vg_t *vg, const char *msg)
{
settings_t *settings = config_get_ptr();
if (!vg->mLastMsg || strcmp(vg->mLastMsg, msg))
vg_render_message(vg, msg);
@ -264,8 +268,8 @@ static void vg_draw_message(vg_t *vg, const char *msg)
vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_STENCIL);
VGfloat origins[] = {
vg->mScreenWidth * g_settings.video.msg_pos_x - 2.0f,
vg->mScreenHeight * g_settings.video.msg_pos_y - 2.0f,
vg->mScreenWidth * settings->video.msg_pos_x - 2.0f,
vg->mScreenHeight * settings->video.msg_pos_y - 2.0f,
};
vgSetfv(VG_GLYPH_ORIGIN, 2, origins);

View File

@ -128,19 +128,21 @@ static void init_yuv_tables(xv_t *xv)
static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size)
{
if (!g_settings.video.font_enable)
settings_t *settings = config_get_ptr();
if (!settings->video.font_enable)
return;
if (font_renderer_create_default(&xv->font_driver,
&xv->font, *g_settings.video.font_path
? g_settings.video.font_path : NULL, g_settings.video.font_size))
&xv->font, *settings->video.font_path
? settings->video.font_path : NULL, settings->video.font_size))
{
int r, g, b;
r = g_settings.video.msg_color_r * 255;
r = settings->video.msg_color_r * 255;
r = (r < 0 ? 0 : (r > 255 ? 255 : r));
g = g_settings.video.msg_color_g * 255;
g = settings->video.msg_color_g * 255;
g = (g < 0 ? 0 : (g > 255 ? 255 : g));
b = g_settings.video.msg_color_b * 255;
b = settings->video.msg_color_b * 255;
b = (b < 0 ? 0 : (b > 255 ? 255 : b));
calculate_yuv(&xv->font_y, &xv->font_u, &xv->font_v,
@ -354,13 +356,13 @@ static bool adaptor_set_format(xv_t *xv, Display *dpy,
static void calc_out_rect(bool keep_aspect, struct video_viewport *vp,
unsigned vp_width, unsigned vp_height)
{
settings_t *settings = config_get_ptr();
vp->full_width = vp_width;
vp->full_height = vp_height;
if (g_settings.video.scale_integer)
{
if (settings->video.scale_integer)
video_viewport_get_scaled_integer(vp, vp_width, vp_height, g_extern.system.aspect_ratio, keep_aspect);
}
else if (!keep_aspect)
{
vp->x = 0; vp->y = 0;
@ -415,8 +417,10 @@ static void *xv_init(const video_info_t *video,
void *xinput = NULL;
XVisualInfo *visualinfo = NULL;
XVisualInfo visualtemplate = {0};
XvAdaptorInfo *adaptor_info = NULL;
const struct retro_game_geometry *geom = NULL;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
if (!xv)
return NULL;
@ -436,7 +440,6 @@ static void *xv_init(const video_info_t *video,
/* Find an appropriate Xv port. */
xv->port = 0;
XvAdaptorInfo *adaptor_info;
XvQueryAdaptors(xv->display,
DefaultRootWindow(xv->display), &adaptor_count, &adaptor_info);
@ -473,7 +476,7 @@ static void *xv_init(const video_info_t *video,
visualtemplate.screen = DefaultScreen(xv->display);
visualtemplate.depth = xv->depth;
visualtemplate.visual = 0;
visualinfo = XGetVisualInfo(xv->display, VisualIDMask |
visualinfo = XGetVisualInfo(xv->display, VisualIDMask |
VisualScreenMask | VisualDepthMask, &visualtemplate, &visualmatches);
if (visualmatches < 1 || !visualinfo->visual)
@ -576,7 +579,7 @@ static void *xv_init(const video_info_t *video,
}
init_yuv_tables(xv);
xv_init_font(xv, g_settings.video.font_path, g_settings.video.font_size);
xv_init_font(xv, settings->video.font_path, settings->video.font_size);
if (!x11_create_input_context(xv->display, xv->window, &xv->xim, &xv->xic))
goto error;
@ -644,22 +647,27 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
static void xv_render_msg(xv_t *xv, const char *msg,
unsigned width, unsigned height)
{
int x, y, msg_base_x, msg_base_y;
unsigned i, luma_index[2], pitch;
unsigned chroma_u_index, chroma_v_index;
settings_t *settings = config_get_ptr();
const struct font_atlas *atlas = NULL;
if (!xv->font)
return;
int x, y;
unsigned i;
atlas = xv->font_driver->get_atlas(xv->font);
const struct font_atlas *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);
int msg_base_x = g_settings.video.msg_pos_x * width;
int msg_base_y = height * (1.0f - g_settings.video.msg_pos_y);
luma_index[0] = xv->luma_index[0];
luma_index[1] = xv->luma_index[1];
unsigned luma_index[2] = { xv->luma_index[0], xv->luma_index[1] };
unsigned chroma_u_index = xv->chroma_u_index;
unsigned chroma_v_index = xv->chroma_v_index;
chroma_u_index = xv->chroma_u_index;
chroma_v_index = xv->chroma_v_index;
unsigned pitch = width << 1; /* YUV formats used are 16 bpp. */
pitch = width << 1; /* YUV formats used are 16 bpp. */
for (; *msg; msg++)
{

View File

@ -278,10 +278,11 @@ static void android_gfx_ctx_set_resize(void *data,
static void android_gfx_ctx_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -353,12 +353,13 @@ static void gfx_ctx_qnx_set_resize(void *data, unsigned width, unsigned height)
static void gfx_ctx_qnx_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -70,7 +70,8 @@ static void d3d_resize(void *data, unsigned new_width, unsigned new_height)
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
switch (message)
{
@ -101,7 +102,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
}
return 0;
case WM_COMMAND:
if (g_settings.ui.menubar_enable)
if (settings->ui.menubar_enable)
{
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
HWND d3dr = d3d->hWnd;
@ -126,8 +127,9 @@ static void gfx_ctx_d3d_swap_buffers(void *data)
static void gfx_ctx_d3d_update_title(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
char buf[128], buffer_fps[128];
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
if (video_monitor_get_fps(buf, sizeof(buf),
buffer_fps, sizeof(buffer_fps)))
@ -137,7 +139,7 @@ static void gfx_ctx_d3d_update_title(void *data)
#endif
}
if (g_settings.fps_show)
if (settings->fps_show)
{
#ifdef _XBOX
char mem[128];
@ -165,20 +167,21 @@ static void gfx_ctx_d3d_show_mouse(void *data, bool state)
void d3d_make_d3dpp(void *data, const video_info_t *info, D3DPRESENT_PARAMETERS *d3dpp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d_video_t *d3d =(d3d_video_t*)data;
settings_t *settings = config_get_ptr();
memset(d3dpp, 0, sizeof(*d3dpp));
#ifdef _XBOX
d3dpp->Windowed = false;
#else
d3dpp->Windowed = g_settings.video.windowed_fullscreen || !info->fullscreen;
d3dpp->Windowed = settings->video.windowed_fullscreen || !info->fullscreen;
#endif
d3dpp->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
if (info->vsync)
{
switch (g_settings.video.swap_interval)
switch (settings->video.swap_interval)
{
default:
case 1:

View File

@ -269,10 +269,11 @@ static void gfx_ctx_drm_egl_set_resize(void *data,
static void gfx_ctx_drm_egl_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push( buf_fps, 1, 1, false);
}
@ -391,8 +392,9 @@ static bool gfx_ctx_drm_egl_init(void *data)
int i;
unsigned monitor_index;
unsigned gpu_index = 0;
unsigned monitor = max(g_settings.video.monitor_index, 1);
struct string_list *gpu_descriptors = NULL;
settings_t *settings = config_get_ptr();
unsigned monitor = max(settings->video.monitor_index, 1);
gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)calloc(1, sizeof(gfx_ctx_drm_egl_data_t));
driver_t *driver = driver_get_ptr();
@ -694,7 +696,8 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
int i, ret = 0;
struct sigaction sa = {{0}};
struct drm_fb *fb = NULL;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)
driver->video_context_data;
@ -729,7 +732,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
/* If we use black frame insertion,
* we fake a 60 Hz monitor for 120 Hz one, etc, so try to match that. */
refresh_mod = g_settings.video.black_frame_insertion ? 0.5f : 1.0f;
refresh_mod = settings->video.black_frame_insertion ? 0.5f : 1.0f;
/* Find desired video mode, and use that.
* If not fullscreen, we get desired windowed size,
@ -738,7 +741,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
drm->g_drm_mode = &drm->g_connector->modes[0];
else
{
/* Try to match g_settings.video.refresh_rate as closely as possible.
/* Try to match settings->video.refresh_rate as closely as possible.
* Lower resolutions tend to have multiple supported
* refresh rates as well.
*/
@ -752,7 +755,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
continue;
float diff = fabsf(refresh_mod *
drm->g_connector->modes[i].vrefresh - g_settings.video.refresh_rate);
drm->g_connector->modes[i].vrefresh - settings->video.refresh_rate);
if (!drm->g_drm_mode || diff < minimum_fps_diff)
{
drm->g_drm_mode = &drm->g_connector->modes[i];

View File

@ -87,12 +87,13 @@ static void gfx_ctx_emscripten_set_resize(void *data,
static void gfx_ctx_emscripten_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -207,13 +207,14 @@ static void gfx_ctx_glx_set_resize(void *data,
static void gfx_ctx_glx_update_window_title(void *data)
{
char buf[128], buf_fps[128];
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
XStoreName(glx->g_dpy, glx->g_win, buf);
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
@ -421,6 +422,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
driver_t *driver = driver_get_ptr();
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
struct sigaction sa = {{0}};
settings_t *settings = config_get_ptr();
sa.sa_handler = glx_sighandler;
sa.sa_flags = SA_RESTART;
@ -431,7 +433,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
if (!glx)
return false;
windowed_full = g_settings.video.windowed_fullscreen;
windowed_full = settings->video.windowed_fullscreen;
true_full = false;
vi = glXGetVisualFromFBConfig(glx->g_dpy, glx->g_fbc);
@ -455,8 +457,8 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
RARCH_ERR("[GLX]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (g_settings.video.monitor_index)
glx->g_screen = g_settings.video.monitor_index - 1;
if (settings->video.monitor_index)
glx->g_screen = settings->video.monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || glx->g_screen != 0)

View File

@ -199,12 +199,13 @@ static void gfx_ctx_mali_fbdev_set_resize(void *data,
static void gfx_ctx_mali_fbdev_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -216,12 +216,14 @@ static void gfx_ctx_ps3_set_resize(void *data,
static void gfx_ctx_ps3_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -173,7 +173,8 @@ static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
unsigned fsflag = 0;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
(void)data;
@ -185,7 +186,7 @@ static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height,
if (fullscreen)
{
if (g_settings.video.windowed_fullscreen)
if (settings->video.windowed_fullscreen)
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
else
fsflag = SDL_WINDOW_FULLSCREEN;
@ -200,7 +201,7 @@ static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height,
}
else
{
unsigned display = g_settings.video.monitor_index;
unsigned display = settings->video.monitor_index;
sdl->g_win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
@ -242,7 +243,8 @@ error:
static void sdl_ctx_get_video_size(void *data,
unsigned *width, unsigned *height)
{
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
if (!sdl)
@ -253,7 +255,7 @@ static void sdl_ctx_get_video_size(void *data,
if (!sdl->g_win)
{
int i = g_settings.video.monitor_index;
int i = settings->video.monitor_index;
#ifdef HAVE_SDL2
SDL_DisplayMode mode = {0};
@ -280,7 +282,8 @@ static void sdl_ctx_get_video_size(void *data,
static void sdl_ctx_update_window_title(void *data)
{
char buf[128], buf_fps[128];
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
if (!sdl)
@ -295,7 +298,7 @@ static void sdl_ctx_update_window_title(void *data)
SDL_WM_SetCaption(buf, NULL);
#endif
}
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -120,39 +120,42 @@ static void gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
static void gfx_ctx_vc_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_vc_get_video_size(void *data,
unsigned *width, unsigned *height)
{
settings_t *settings = config_get_ptr();
(void)data;
// Use dispmanx upscaling if fullscreen_x and fullscreen_y are set.
if (g_settings.video.fullscreen_x != 0 &&
g_settings.video.fullscreen_y != 0)
if (settings->video.fullscreen_x != 0 &&
settings->video.fullscreen_y != 0)
{
// Keep input and output aspect ratio equal.
// There are other aspect ratio settings which can be used to stretch video output.
// --------------------------------------------------------------------------------
// Calculate source and destination aspect ratios.
float srcAspect = (float)g_settings.video.fullscreen_x / (float)g_settings.video.fullscreen_y;
float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y;
float dstAspect = (float)g_fb_width / (float)g_fb_height;
// If source and destination aspect ratios are not equal correct source width.
if (srcAspect != dstAspect)
{
*width = (unsigned)(g_settings.video.fullscreen_y * dstAspect);
*width = (unsigned)(settings->video.fullscreen_y * dstAspect);
}
else
{
*width = g_settings.video.fullscreen_x;
*width = settings->video.fullscreen_x;
}
*height = g_settings.video.fullscreen_y;
*height = settings->video.fullscreen_y;
}
else
{
@ -190,6 +193,7 @@ static bool gfx_ctx_vc_init(void *data)
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
settings_t *settings = config_get_ptr();
RARCH_LOG("[VC/EGL]: Initializing...\n");
if (g_inited)
@ -243,25 +247,21 @@ static bool gfx_ctx_vc_init(void *data)
src_rect.y = 0;
// Use dispmanx upscaling if fullscreen_x and fullscreen_y are set.
if (g_settings.video.fullscreen_x != 0 &&
g_settings.video.fullscreen_y != 0)
if (settings->video.fullscreen_x != 0 &&
settings->video.fullscreen_y != 0)
{
// Keep input and output aspect ratio equal.
// There are other aspect ratio settings which can be used to stretch video output.
// --------------------------------------------------------------------------------
// Calculate source and destination aspect ratios.
float srcAspect = (float)g_settings.video.fullscreen_x / (float)g_settings.video.fullscreen_y;
float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y;
float dstAspect = (float)g_fb_width / (float)g_fb_height;
// If source and destination aspect ratios are not equal correct source width.
if (srcAspect != dstAspect)
{
src_rect.width = (unsigned)(g_settings.video.fullscreen_y * dstAspect) << 16;
}
src_rect.width = (unsigned)(settings->video.fullscreen_y * dstAspect) << 16;
else
{
src_rect.width = g_settings.video.fullscreen_x << 16;
}
src_rect.height = g_settings.video.fullscreen_y << 16;
src_rect.width = settings->video.fullscreen_x << 16;
src_rect.height = settings->video.fullscreen_y << 16;
}
else
{
@ -284,25 +284,21 @@ static bool gfx_ctx_vc_init(void *data)
nativewindow.element = dispman_element;
// Use dispmanx upscaling if fullscreen_x and fullscreen_y are set.
if (g_settings.video.fullscreen_x != 0 &&
g_settings.video.fullscreen_y != 0)
if (settings->video.fullscreen_x != 0 &&
settings->video.fullscreen_y != 0)
{
// Keep input and output aspect ratio equal.
// There are other aspect ratio settings which can be used to stretch video output.
// --------------------------------------------------------------------------------
// Calculate source and destination aspect ratios.
float srcAspect = (float)g_settings.video.fullscreen_x / (float)g_settings.video.fullscreen_y;
float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y;
float dstAspect = (float)g_fb_width / (float)g_fb_height;
// If source and destination aspect ratios are not equal correct source width.
if (srcAspect != dstAspect)
{
nativewindow.width = (unsigned)(g_settings.video.fullscreen_y * dstAspect);
}
nativewindow.width = (unsigned)(settings->video.fullscreen_y * dstAspect);
else
{
nativewindow.width = g_settings.video.fullscreen_x;
}
nativewindow.height = g_settings.video.fullscreen_y;
nativewindow.width = settings->video.fullscreen_x;
nativewindow.height = settings->video.fullscreen_y;
}
else
{

View File

@ -188,12 +188,13 @@ static void gfx_ctx_vivante_set_resize(void *data,
static void gfx_ctx_vivante_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -338,7 +338,8 @@ static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
static void gfx_ctx_wl_update_window_title(void *data)
{
char buf[128], buf_fps[128];
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
driver->video_context_data;
@ -348,7 +349,7 @@ static void gfx_ctx_wl_update_window_title(void *data)
buf_fps, sizeof(buf_fps)))
wl_shell_surface_set_title(wl->g_shell_surf, buf);
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -234,6 +234,8 @@ static void *dinput_wgl;
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
{
settings_t *settings = config_get_ptr();
switch (message)
{
case WM_SYSCOMMAND:
@ -278,7 +280,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
}
return 0;
case WM_COMMAND:
if (g_settings.ui.menubar_enable)
if (settings->ui.menubar_enable)
{
LRESULT ret = win32_menu_loop(g_hwnd, wparam);
}
@ -347,13 +349,14 @@ static void gfx_ctx_wgl_set_resize(void *data,
static void gfx_ctx_wgl_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
SetWindowText(g_hwnd, buf);
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
@ -442,12 +445,13 @@ static void show_cursor(bool show)
static void monitor_info(MONITORINFOEX *mon, HMONITOR *hm_to_use)
{
unsigned fs_monitor;
settings_t *settings = config_get_ptr();
if (!g_last_hm)
g_last_hm = MonitorFromWindow(GetDesktopWindow(), MONITOR_DEFAULTTONEAREST);
*hm_to_use = g_last_hm;
fs_monitor = g_settings.video.monitor_index;
fs_monitor = settings->video.monitor_index;
if (fs_monitor && fs_monitor <= g_num_mons && g_all_hms[fs_monitor - 1])
*hm_to_use = g_all_hms[fs_monitor - 1];
@ -467,15 +471,15 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
bool windowed_full;
RECT rect = {0};
HMONITOR hm_to_use = NULL;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
monitor_info(&current_mon, &hm_to_use);
mon_rect = current_mon.rcMonitor;
mon_rect = current_mon.rcMonitor;
g_resize_width = width;
g_resize_height = height;
windowed_full = g_settings.video.windowed_fullscreen;
windowed_full = settings->video.windowed_fullscreen;
if (fullscreen)
{
@ -519,7 +523,7 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
if (!fullscreen || windowed_full)
{
if (!fullscreen && g_settings.ui.menubar_enable)
if (!fullscreen && settings->ui.menubar_enable)
{
RECT rc_temp = {0, 0, height, 0x7FFF};
SetMenu(g_hwnd, LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));

View File

@ -66,10 +66,12 @@ static bool gfx_init_dwm(void)
void gfx_set_dwm(void)
{
HRESULT ret;
settings_t *settings = config_get_ptr();
if (!gfx_init_dwm())
return;
if (g_settings.video.disable_composition == dwm_composition_disabled)
if (settings->video.disable_composition == dwm_composition_disabled)
return;
HRESULT (WINAPI *composition_enable)(UINT) =
@ -80,9 +82,9 @@ void gfx_set_dwm(void)
return;
}
ret = composition_enable(!g_settings.video.disable_composition);
ret = composition_enable(!settings->video.disable_composition);
if (FAILED(ret))
RARCH_ERR("Failed to set composition state ...\n");
dwm_composition_disabled = g_settings.video.disable_composition;
dwm_composition_disabled = settings->video.disable_composition;
}
#endif

View File

@ -145,6 +145,7 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
bool ret = false;
float minimum_fps_diff = 0.0f;
XF86VidModeModeInfo **modes = NULL;
settings_t *settings = config_get_ptr();
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &num_modes, &modes);
@ -158,7 +159,7 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
/* If we use black frame insertion, we fake a 60 Hz monitor
* for 120 Hz one, etc, so try to match that. */
refresh_mod = g_settings.video.black_frame_insertion ? 0.5f : 1.0f;
refresh_mod = settings->video.black_frame_insertion ? 0.5f : 1.0f;
for (i = 0; i < num_modes; i++)
{
@ -174,7 +175,7 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
continue;
refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal);
diff = fabsf(refresh - g_settings.video.refresh_rate);
diff = fabsf(refresh - settings->video.refresh_rate);
if (!ret || diff < minimum_fps_diff)
{

View File

@ -222,13 +222,14 @@ static void gfx_ctx_xegl_set_resize(void *data,
static void gfx_ctx_xegl_update_window_title(void *data)
{
char buf[128], buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
XStoreName(g_dpy, g_win, buf);
if (g_settings.fps_show)
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
@ -454,7 +455,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
XVisualInfo temp = {0};
XSetWindowAttributes swa = {0};
XVisualInfo *vi = NULL;
driver_t *driver = driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
sa.sa_handler = egl_sighandler;
sa.sa_flags = SA_RESTART;
@ -462,7 +464,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
windowed_full = g_settings.video.windowed_fullscreen;
windowed_full = settings->video.windowed_fullscreen;
true_full = false;
int (*old_handler)(Display*, XErrorEvent*) = NULL;
@ -495,8 +497,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
RARCH_ERR("[X/EGL]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (g_settings.video.monitor_index)
g_screen = g_settings.video.monitor_index - 1;
if (settings->video.monitor_index)
g_screen = settings->video.monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_screen != 0)

View File

@ -25,6 +25,7 @@ static bool d3dfonts_w32_init_font(void *data,
{
uint32_t r, g, b;
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
D3DXFONT_DESC desc = {
static_cast<int>(font_size), 0, 400, 0,
false, DEFAULT_CHARSET,
@ -36,9 +37,9 @@ static bool d3dfonts_w32_init_font(void *data,
(void)font_path;
r = static_cast<uint32_t>(g_settings.video.msg_color_r * 255) & 0xff;
g = static_cast<uint32_t>(g_settings.video.msg_color_g * 255) & 0xff;
b = static_cast<uint32_t>(g_settings.video.msg_color_b * 255) & 0xff;
r = static_cast<uint32_t>(settings->video.msg_color_r * 255) & 0xff;
g = static_cast<uint32_t>(settings->video.msg_color_g * 255) & 0xff;
b = static_cast<uint32_t>(settings->video.msg_color_b * 255) & 0xff;
d3d->font_color = D3DCOLOR_XRGB(r, g, b);

View File

@ -248,6 +248,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
bool align_right;
gl_t *gl = NULL;
gl_raster_t *font = (gl_raster_t*)data;
settings_t *settings = config_get_ptr();
if (!font)
return;
@ -256,19 +257,19 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
if (params)
{
x = params->x;
y = params->y;
scale = params->scale;
x = params->x;
y = params->y;
scale = params->scale;
full_screen = params->full_screen;
align_right = params->align_right;
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_mod = params->drop_mod;
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_mod = params->drop_mod;
color[0] = FONT_COLOR_GET_RED(params->color) / 255.0f;
color[1] = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
color[2] = FONT_COLOR_GET_BLUE(params->color) / 255.0f;
color[3] = FONT_COLOR_GET_ALPHA(params->color) / 255.0f;
color[0] = FONT_COLOR_GET_RED(params->color) / 255.0f;
color[1] = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
color[2] = FONT_COLOR_GET_BLUE(params->color) / 255.0f;
color[3] = FONT_COLOR_GET_ALPHA(params->color) / 255.0f;
/* If alpha is 0.0f, turn it into default 1.0f */
if (color[3] <= 0.0f)
@ -276,15 +277,15 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
}
else
{
x = g_settings.video.msg_pos_x;
y = g_settings.video.msg_pos_y;
scale = 1.0f;
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
scale = 1.0f;
full_screen = false;
align_right = false;
color[0] = g_settings.video.msg_color_r;
color[1] = g_settings.video.msg_color_g;
color[2] = g_settings.video.msg_color_b;
color[0] = settings->video.msg_color_r;
color[1] = settings->video.msg_color_g;
color[2] = settings->video.msg_color_b;
color[3] = 1.0f;
drop_x = -2;

View File

@ -65,20 +65,21 @@ static void libdbg_font_render_msg(void *data, const char *msg,
{
float x, y, scale;
unsigned color;
settings_t *settings = config_get_ptr();
(void)data;
if (params)
{
x = params->x;
y = params->y;
x = params->x;
y = params->y;
scale = params->scale;
color = params->color;
}
else
{
x = g_settings.video.msg_pos_x;
y = 0.90f;
x = settings->video.msg_pos_x;
y = 0.90f;
scale = 1.04f;
color = SILVER;
}

View File

@ -45,9 +45,10 @@ static void xfonts_deinit_font(void *data)
static void xfonts_render_msg(void *data, const char *msg,
const struct font_params *params)
{
d3d_video_t *d3d = (d3d_video_t*)data;
wchar_t str[PATH_MAX_LENGTH];
float x, y;
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
if (params)
{
@ -56,8 +57,8 @@ static void xfonts_render_msg(void *data, const char *msg,
}
else
{
x = g_settings.video.msg_pos_x;
y = g_settings.video.msg_pos_y;
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
}
d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &pFrontBuffer);