This commit is contained in:
libretroadmin 2023-05-30 12:19:53 +02:00
parent dbd7153526
commit c09fb6d95d
23 changed files with 356 additions and 513 deletions

View File

@ -2508,30 +2508,31 @@ void config_set_defaults(void *data)
#ifdef HAVE_MENU
static bool first_initialized = true;
#endif
global_t *global = (global_t*)data;
settings_t *settings = config_st;
recording_state_t *recording_st = recording_state_get_ptr();
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
int float_settings_size = sizeof(settings->floats) / sizeof(settings->floats.placeholder);
int int_settings_size = sizeof(settings->ints) / sizeof(settings->ints.placeholder);
int uint_settings_size = sizeof(settings->uints) / sizeof(settings->uints.placeholder);
int size_settings_size = sizeof(settings->sizes) / sizeof(settings->sizes.placeholder);
const char *def_video = config_get_default_video();
const char *def_audio = config_get_default_audio();
const char *def_audio_resampler = config_get_default_audio_resampler();
const char *def_input = config_get_default_input();
const char *def_joypad = config_get_default_joypad();
global_t *global = (global_t*)data;
settings_t *settings = config_st;
recording_state_t *recording_st = recording_state_get_ptr();
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
int float_settings_size = sizeof(settings->floats) / sizeof(settings->floats.placeholder);
int int_settings_size = sizeof(settings->ints) / sizeof(settings->ints.placeholder);
int uint_settings_size = sizeof(settings->uints) / sizeof(settings->uints.placeholder);
int size_settings_size = sizeof(settings->sizes) / sizeof(settings->sizes.placeholder);
const char *def_video = config_get_default_video();
const char *def_audio = config_get_default_audio();
const char *def_audio_resampler = config_get_default_audio_resampler();
const char *def_input = config_get_default_input();
const char *def_joypad = config_get_default_joypad();
#ifdef HAVE_MENU
const char *def_menu = config_get_default_menu();
const char *def_menu = config_get_default_menu();
#endif
const char *def_camera = config_get_default_camera();
const char *def_bluetooth = config_get_default_bluetooth();
const char *def_wifi = config_get_default_wifi();
const char *def_led = config_get_default_led();
const char *def_location = config_get_default_location();
const char *def_record = config_get_default_record();
const char *def_midi = config_get_default_midi();
const char *def_mitm = DEFAULT_NETPLAY_MITM_SERVER;
const char *def_camera = config_get_default_camera();
const char *def_bluetooth = config_get_default_bluetooth();
const char *def_wifi = config_get_default_wifi();
const char *def_led = config_get_default_led();
const char *def_location = config_get_default_location();
const char *def_record = config_get_default_record();
const char *def_midi = config_get_default_midi();
const char *def_mitm = DEFAULT_NETPLAY_MITM_SERVER;
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct config_float_setting *float_settings = populate_settings_float (settings, &float_settings_size);
struct config_bool_setting *bool_settings = populate_settings_bool (settings, &bool_settings_size);
struct config_int_setting *int_settings = populate_settings_int (settings, &int_settings_size);
@ -2743,7 +2744,10 @@ void config_set_defaults(void *data)
settings->uints.input_mouse_index[i] = (unsigned)i;
}
video_driver_reset_custom_viewport(settings);
custom_vp->width = 0;
custom_vp->height = 0;
custom_vp->x = 0;
custom_vp->y = 0;
/* Make sure settings from other configs carry over into defaults
* for another config. */

View File

@ -1383,12 +1383,11 @@ void d3d9_calculate_rect(d3d9_video_t *d3d,
#if defined(HAVE_MENU)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
video_viewport_t *custom = video_viewport_get_custom();
*x = custom->x;
*y = custom->y;
*width = custom->width;
*height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
*x = custom_vp->x;
*y = custom_vp->y;
*width = custom_vp->width;
*height = custom_vp->height;
}
else
#endif

View File

@ -1524,18 +1524,20 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
{
uint32_t queue_count;
unsigned i;
const char *enabled_device_extensions[8];
static const float one = 1.0f;
bool found_queue = false;
video_driver_state_t *video_st = video_state_get_ptr();
VkPhysicalDeviceFeatures features = { false };
VkDeviceQueueCreateInfo queue_info = { VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO };
VkDeviceCreateInfo device_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
const char *enabled_device_extensions[8];
unsigned enabled_device_extension_count = 0;
struct retro_hw_render_context_negotiation_interface_vulkan *iface =
(struct retro_hw_render_context_negotiation_interface_vulkan*)video_driver_get_context_negotiation_interface();
struct retro_hw_render_context_negotiation_interface_vulkan
*iface = (struct retro_hw_render_context_negotiation_interface_vulkan*)
video_st->hw_render_context_negotiation;
if (iface && iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
{
@ -1593,11 +1595,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
&features);
}
if (!ret)
{
RARCH_WARN("[Vulkan]: Failed to create device with negotiation interface. Falling back to default path.\n");
}
else
if (ret)
{
if (vk->context.gpu != VK_NULL_HANDLE && context.gpu != vk->context.gpu)
RARCH_ERR("[Vulkan]: Got unexpected VkPhysicalDevice, despite RetroArch using explicit physical device.\n");
@ -1616,6 +1614,10 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
return false;
}
}
else
{
RARCH_WARN("[Vulkan]: Failed to create device with negotiation interface. Falling back to default path.\n");
}
}
if (cached_device_vk && cached_destroy_device_vk)
@ -1752,7 +1754,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
vk->context.device = cached_device_vk;
cached_device_vk = NULL;
video_state_get_ptr()->flags |= VIDEO_FLAG_CACHE_CONTEXT_ACK;
video_st->flags |= VIDEO_FLAG_CACHE_CONTEXT_ACK;
RARCH_LOG("[Vulkan]: Using cached Vulkan context.\n");
}
else if (vkCreateDevice(vk->context.gpu, &device_info,
@ -1895,9 +1897,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
enum vulkan_wsi_type type)
{
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
VkApplicationInfo app = { VK_STRUCTURE_TYPE_APPLICATION_INFO };
struct retro_hw_render_context_negotiation_interface_vulkan *iface =
(struct retro_hw_render_context_negotiation_interface_vulkan*)video_driver_get_context_negotiation_interface();
VkApplicationInfo app = { VK_STRUCTURE_TYPE_APPLICATION_INFO };
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_hw_render_context_negotiation_interface_vulkan
*iface = (struct retro_hw_render_context_negotiation_interface_vulkan*)video_st->hw_render_context_negotiation;
if (iface && iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
{

View File

@ -292,10 +292,11 @@ static bool d3d8_setup_init(void *data,
{
unsigned width, height;
d3d8_video_t *d3d = (d3d8_video_t*)data;
settings_t *settings = config_get_ptr();
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
unsigned fmt = (rgb32) ? RETRO_PIXEL_FORMAT_XRGB8888 : RETRO_PIXEL_FORMAT_RGB565;
struct video_viewport *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_driver_get_size(&width, &height);
@ -798,12 +799,12 @@ static void d3d8_calculate_rect(void *data,
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
video_viewport_t *custom = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
*x = custom->x;
*y = custom->y;
*width = custom->width;
*height = custom->height;
*x = custom_vp->x;
*y = custom_vp->y;
*width = custom_vp->width;
*height = custom_vp->height;
}
else
#endif

View File

@ -505,12 +505,12 @@ void gl1_gfx_set_viewport(gl1_t *gl1,
#if defined(HAVE_MENU)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* GL has bottom-left origin viewport. */
x = custom->x;
y = height - custom->y - custom->height;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* OpenGL has bottom-left origin viewport. */
x = custom_vp->x;
y = height - custom_vp->y - custom_vp->height;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -436,12 +436,12 @@ static void gl2_set_viewport(gl2_t *gl,
#if defined(HAVE_MENU)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* GL has bottom-left origin viewport. */
x = custom->x;
y = height - custom->y - custom->height;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* OpenGL has bottom-left origin viewport. */
x = custom_vp->x;
y = height - custom_vp->y - custom_vp->height;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -599,12 +599,12 @@ static void gl3_set_viewport(gl3_t *gl,
#if defined(HAVE_MENU)
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* GL has bottom-left origin viewport. */
x = custom->x;
y = height - custom->y - custom->height;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* OpenGL has bottom-left origin viewport. */
x = custom_vp->x;
y = height - custom_vp->y - custom_vp->height;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -133,13 +133,12 @@ static void wiiu_gfx_update_viewport(wiiu_video_t *wiiu)
#if defined(HAVE_MENU)
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* Vulkan has top-left origin viewport. */
x = custom->x;
y = custom->y;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* GX2 has top-left origin viewport. */
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -990,6 +990,7 @@ static void gx_resize(gx_video_t *gx,
float top = 1, bottom = -1, left = -1, right = 1;
int x = 0, y = 0;
const global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
unsigned width = gx->vp.full_width;
unsigned height = gx->vp.full_height;
@ -1012,14 +1013,14 @@ static void gx_resize(gx_video_t *gx,
{
float desired_aspect = video_driver_get_aspect_ratio();
if (desired_aspect == 0.0)
desired_aspect = 1.0;
if (gx->orientation == ORIENTATION_VERTICAL ||
gx->orientation == ORIENTATION_FLIPPED_ROTATED)
desired_aspect = 1.0 / desired_aspect;
desired_aspect = 1.0;
if ( (gx->orientation == ORIENTATION_VERTICAL)
|| (gx->orientation == ORIENTATION_FLIPPED_ROTATED))
desired_aspect = 1.0 / desired_aspect;
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
struct video_viewport *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
if (!custom_vp->width || !custom_vp->height)
{

View File

@ -434,6 +434,7 @@ static void *psp_init(const video_info_t *video,
else
{
u16 i;
video_driver_state_t *video_st = video_state_get_ptr();
uint16_t* LUT_r_local = (uint16_t*)(SCEGU_VRAM_BP_2);
uint16_t* LUT_b_local = (uint16_t*)(SCEGU_VRAM_BP_2) + (1 << 5);
@ -446,8 +447,8 @@ static void *psp_init(const video_info_t *video,
psp->bpp_log2 = 1;
pixel_format =
(video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_0RGB1555)
? GU_PSM_5551 : GU_PSM_5650 ;
(video_st->pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)
? GU_PSM_5551 : GU_PSM_5650;
lut_pixel_format = GU_PSM_T16;
@ -824,7 +825,7 @@ static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle)
switch(src_pixelformat)
{
case PSP_DISPLAY_PIXEL_FORMAT_565:
for (j = (src_y_max - 1); j >= src_y ; j--)
for (j = (src_y_max - 1); j >= src_y; j--)
{
uint16_t* src = (uint16_t*)src_buffer + src_bufferwidth * j + src_x;
for (i = src_x; i < src_x_max; i++)
@ -839,7 +840,7 @@ static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle)
return true;
case PSP_DISPLAY_PIXEL_FORMAT_5551:
for (j = (src_y_max - 1); j >= src_y ; j--)
for (j = (src_y_max - 1); j >= src_y; j--)
{
uint16_t* src = (uint16_t*)src_buffer + src_bufferwidth * j + src_x;
for (i = src_x; i < src_x_max; i++)
@ -854,7 +855,7 @@ static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle)
return true;
case PSP_DISPLAY_PIXEL_FORMAT_4444:
for (j = (src_y_max - 1); j >= src_y ; j--)
for (j = (src_y_max - 1); j >= src_y; j--)
{
uint16_t* src = (uint16_t*)src_buffer + src_bufferwidth * j + src_x;
for (i = src_x; i < src_x_max; i++)
@ -869,7 +870,7 @@ static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle)
return true;
case PSP_DISPLAY_PIXEL_FORMAT_8888:
for (j = (src_y_max - 1); j >= src_y ; j--)
for (j = (src_y_max - 1); j >= src_y; j--)
{
uint32_t* src = (uint32_t*)src_buffer + src_bufferwidth * j + src_x;
for (i = src_x; i < src_x_max; i++)

View File

@ -194,12 +194,12 @@ static void rsx_set_viewport(void *data, unsigned viewport_width,
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
x = custom->x;
y = custom->y;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* RSX/libgcm has top-left origin viewport. */
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif
@ -691,12 +691,12 @@ static void rsx_update_viewport(rsx_t* rsx)
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
x = custom->x;
y = custom->y;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* RSX/libgcm has top-left origin viewport. */
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -242,13 +242,11 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
vid->video.force_aspect);
else if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom =
(const struct video_viewport*)video_viewport_get_custom();
vid->vp.x = custom->x;
vid->vp.y = custom->y;
vid->vp.width = custom->width;
vid->vp.height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
vid->vp.x = custom_vp->x;
vid->vp.y = custom_vp->y;
vid->vp.width = custom_vp->width;
vid->vp.height = custom_vp->height;
}
else if (vid->video.force_aspect)
{

View File

@ -522,18 +522,16 @@ static void vita2d_gfx_set_viewport(void *data, unsigned viewport_width,
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
x = custom->x;
y = custom->y;
viewport_width = custom->width;
viewport_height = custom->height;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif
{
float delta;
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
{
/* If the aspect ratios of screen and desired aspect

View File

@ -1974,18 +1974,16 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
}
else if ((vk->flags & VK_FLAG_KEEP_ASPECT) && !force_full)
{
float desired_aspect = video_driver_get_aspect_ratio();
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
/* Vulkan has top-left origin viewport. */
x = custom->x;
y = custom->y;
viewport_width = custom->width;
viewport_height = custom->height;
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
}
else
#endif

View File

@ -1,5 +1,5 @@
/* CRT SwitchRes Core
* Copyright (C) 2018 Alphanu / Ben Templeman.
* Copyright (C) 2018 Alphanu / Ben Templeman.
*
* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
@ -83,10 +83,11 @@ static void crt_aspect_ratio_switch(
float srm_width, float srm_height)
{
/* Send aspect float to video_driver */
p_switch->fly_aspect = (float)width / (float)height;
video_driver_set_aspect_ratio_value((float)p_switch->fly_aspect);
RARCH_LOG("[CRT]: Setting Aspect Ratio: %f \n",
(float)p_switch->fly_aspect);
video_driver_state_t *video_st = video_state_get_ptr();
float fly_aspect = (float)width / (float)height;
p_switch->fly_aspect = fly_aspect;
video_st->aspect_ratio = fly_aspect;
RARCH_LOG("[CRT]: Setting Aspect Ratio: %f \n", fly_aspect);
RARCH_LOG("[CRT]: Setting Video Screen Size to: %dx%d \n",
width, height);
video_driver_set_size(width , height);
@ -419,9 +420,10 @@ void crt_switch_res_core(
if (video_driver_get_aspect_ratio() != p_switch->fly_aspect)
{
RARCH_LOG("[CRT]: Restoring Aspect Ratio: %f \n",
(float)p_switch->fly_aspect);
video_driver_set_aspect_ratio_value((float)p_switch->fly_aspect);
video_driver_state_t *video_st = video_state_get_ptr();
float fly_aspect = (float)p_switch->fly_aspect;
RARCH_LOG("[CRT]: Restoring Aspect Ratio: %f \n", fly_aspect);
video_st->aspect_ratio = fly_aspect;
video_driver_apply_state_changes();
}
}

View File

@ -812,8 +812,7 @@ const char* config_get_video_driver_options(void)
return char_list_new_special(STRING_LIST_VIDEO_DRIVERS, NULL);
}
void video_driver_pixel_converter_free(
video_pixel_scaler_t *scalr)
void video_driver_pixel_converter_free(video_pixel_scaler_t *scalr)
{
if (!scalr)
return;
@ -887,11 +886,6 @@ error:
return NULL;
}
struct video_viewport *video_viewport_get_custom(void)
{
return &config_get_ptr()->video_viewport_custom;
}
bool video_driver_monitor_adjust_system_rates(
float timing_skew_hz,
float video_refresh_rate,
@ -923,16 +917,6 @@ bool video_driver_monitor_adjust_system_rates(
return input_fps <= target_video_sync_rate;
}
void video_driver_reset_custom_viewport(settings_t *settings)
{
struct video_viewport *custom_vp = &settings->video_viewport_custom;
custom_vp->width = 0;
custom_vp->height = 0;
custom_vp->x = 0;
custom_vp->y = 0;
}
struct retro_system_av_info *video_viewport_get_system_av_info(void)
{
return &video_driver_st.av_info;
@ -985,8 +969,8 @@ void recording_dump_frame(
}
/* User has resized. We kinda have a problem now. */
if ( vp.width != record_st->gpu_width ||
vp.height != record_st->gpu_height)
if ( (vp.width != record_st->gpu_width)
|| (vp.height != record_st->gpu_height))
{
const char *recording_failed_str =
msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE);
@ -1002,7 +986,9 @@ void recording_dump_frame(
/* Big bottleneck.
* Since we might need to do read-backs asynchronously,
* it might take 3-4 times before this returns true. */
if (!video_driver_read_viewport(video_st->record_gpu_buffer, is_idle))
if (!( video_st->current_video->read_viewport
&& video_st->current_video->read_viewport(
video_st->data, video_st->record_gpu_buffer, is_idle)))
return;
ffemu_data.pitch = (int)(record_st->gpu_width * 3);
@ -1020,9 +1006,9 @@ void recording_dump_frame(
const char *video_display_server_get_ident(void)
{
if (!current_display_server)
return FILE_PATH_UNKNOWN;
return current_display_server->ident;
if (current_display_server)
return current_display_server->ident;
return FILE_PATH_UNKNOWN;
}
void* video_display_server_init(enum rarch_display_type type)
@ -1160,9 +1146,9 @@ bool video_display_server_has_refresh_rate(float hz)
for (i = 0; i < size && !rate_exists; i++)
{
if (video_list[i].width == video_driver_width &&
video_list[i].height == video_driver_height &&
video_list[i].refreshrate == floor(hz))
if ( (video_list[i].width == video_driver_width)
&& (video_list[i].height == video_driver_height)
&& (video_list[i].refreshrate == floor(hz)))
rate_exists = true;
}
@ -1193,14 +1179,14 @@ void video_switch_refresh_rate_maybe(
/* Roundings to PAL & NTSC standards */
if (refresh_rate > 49.00 && refresh_rate < 54.50)
refresh_rate = 50.00f;
refresh_rate = 50.00f;
else if (refresh_rate > 54.00 && refresh_rate < 60.00)
refresh_rate = 59.94f;
refresh_rate = 59.94f;
else if (refresh_rate > 60.00 && refresh_rate < 61.00)
refresh_rate = 60.00f;
refresh_rate = 60.00f;
/* Black frame insertion + swap interval multiplier */
refresh_rate = (refresh_rate * (video_bfi + 1.0f) * video_swap_interval);
refresh_rate = (refresh_rate * (video_bfi + 1.0f) * video_swap_interval);
/* Fallback when target refresh rate is not exposed or when below standards */
if (!video_display_server_has_refresh_rate(refresh_rate) || refresh_rate < 50)
@ -1214,15 +1200,15 @@ void video_switch_refresh_rate_maybe(
* - 'CRT SwitchRes' OFF & 'Sync to Exact Content Framerate' OFF
* - Automatic refresh rate switching not OFF
*/
if ( refresh_rate != video_refresh_rate
if ( (refresh_rate != video_refresh_rate)
&& !crt_switch_resolution
&& !vrr_runloop_enable
&& (autoswitch_refresh_rate != AUTOSWITCH_REFRESH_RATE_OFF))
{
*video_switch_refresh_rate = (
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN) && exclusive_fullscreen) ||
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_WINDOWED_FULLSCREEN) && windowed_fullscreen) ||
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_ALL_FULLSCREEN) && all_fullscreen));
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN) && exclusive_fullscreen)
|| ((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_WINDOWED_FULLSCREEN) && windowed_fullscreen)
|| ((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_ALL_FULLSCREEN) && all_fullscreen));
/* Store original refresh rate on automatic change, and
* restore it in deinit_core and main_quit, because not all
@ -1246,10 +1232,10 @@ bool video_display_server_set_refresh_rate(float hz)
void video_display_server_restore_refresh_rate(void)
{
video_driver_state_t *video_st = &video_driver_st;
settings_t *settings = config_get_ptr();
float refresh_rate_original = video_st->video_refresh_rate_original;
float refresh_rate_current = settings->floats.video_refresh_rate;
video_driver_state_t *video_st = &video_driver_st;
settings_t *settings = config_get_ptr();
float refresh_rate_original = video_st->video_refresh_rate_original;
float refresh_rate_current = settings->floats.video_refresh_rate;
if (!refresh_rate_original || refresh_rate_current == refresh_rate_original)
return;
@ -1269,7 +1255,7 @@ const char *video_display_server_get_output_options(void)
void video_display_server_set_screen_orientation(enum rotation rotation)
{
video_driver_state_t *video_st = &video_driver_st;
video_driver_state_t *video_st = &video_driver_st;
if (current_display_server && current_display_server->set_screen_orientation)
{
RARCH_LOG("[Video]: Setting screen orientation to %d.\n", rotation);
@ -1394,7 +1380,7 @@ void video_driver_filter_free(void)
video_driver_state_t *video_st = &video_driver_st;
if (video_st->state_filter)
rarch_softfilter_free(video_st->state_filter);
video_st->state_filter = NULL;
video_st->state_filter = NULL;
if (video_st->state_buffer)
{
@ -1422,8 +1408,8 @@ void video_driver_init_filter(enum retro_pixel_format colfmt_int,
unsigned height = geom->max_height;
/* Deprecated format. Gets pre-converted. */
enum retro_pixel_format colfmt =
(colfmt_int == RETRO_PIXEL_FORMAT_0RGB1555) ?
RETRO_PIXEL_FORMAT_RGB565 : colfmt_int;
(colfmt_int == RETRO_PIXEL_FORMAT_0RGB1555)
? RETRO_PIXEL_FORMAT_RGB565 : colfmt_int;
if (video_driver_is_hw_context())
{
@ -1431,11 +1417,9 @@ void video_driver_init_filter(enum retro_pixel_format colfmt_int,
return;
}
video_st->state_filter = rarch_softfilter_new(
if (!(video_st->state_filter = rarch_softfilter_new(
settings->paths.path_softfilter_plugin,
RARCH_SOFTFILTER_THREADS_AUTO, colfmt, width, height);
if (!video_st->state_filter)
RARCH_SOFTFILTER_THREADS_AUTO, colfmt, width, height)))
{
RARCH_ERR("[Video]: Failed to load filter.\n");
return;
@ -1466,9 +1450,9 @@ void video_driver_init_filter(enum retro_pixel_format colfmt_int,
video_st->state_scale = maxsize / RARCH_SCALE_BASE;
if (rarch_softfilter_get_output_format(
video_st->state_filter) == RETRO_PIXEL_FORMAT_XRGB8888)
video_st->flags |= VIDEO_FLAG_STATE_OUT_RGB32;
video_st->flags |= VIDEO_FLAG_STATE_OUT_RGB32;
else
video_st->flags &= ~VIDEO_FLAG_STATE_OUT_RGB32;
video_st->flags &= ~VIDEO_FLAG_STATE_OUT_RGB32;
video_st->state_out_bpp = (video_st->flags & VIDEO_FLAG_STATE_OUT_RGB32)
? sizeof(uint32_t) : sizeof(uint16_t);
@ -1584,9 +1568,9 @@ void video_driver_set_viewport_config(
/* Get around division by zero errors */
if (base_width == 0)
base_width = 1;
base_width = 1;
if (base_height == 0)
base_height = 1;
base_height = 1;
aspectratio_lut[ASPECT_RATIO_CONFIG].value =
(float)base_width / base_height; /* 1:1 PAR. */
}
@ -1618,11 +1602,11 @@ void video_driver_set_viewport_square_pixel(struct retro_game_geometry *geom)
if (rotation % 2)
{
aspect_x = height / highest;
aspect_y = width / highest;
aspect_y = width / highest;
}
else
{
aspect_x = width / highest;
aspect_x = width / highest;
aspect_y = height / highest;
}
@ -1770,8 +1754,8 @@ void video_driver_set_size(unsigned width, unsigned height)
bool is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
VIDEO_DRIVER_THREADED_LOCK(video_st, is_threaded);
#endif
video_st->width = width;
video_st->height = height;
video_st->width = width;
video_st->height = height;
#ifdef HAVE_THREADS
VIDEO_DRIVER_THREADED_UNLOCK(video_st, is_threaded);
#endif
@ -1847,18 +1831,6 @@ float video_driver_get_aspect_ratio(void)
return video_st->aspect_ratio;
}
void video_driver_set_aspect_ratio_value(float value)
{
video_driver_state_t *video_st = &video_driver_st;
video_st->aspect_ratio = value;
}
enum retro_pixel_format video_driver_get_pixel_format(void)
{
video_driver_state_t *video_st = &video_driver_st;
return video_st->pix_fmt;
}
void video_driver_lock_new(void)
{
#ifdef HAVE_THREADS
@ -1896,37 +1868,15 @@ void video_driver_unset_stub_frame(void)
video_st->frame_bak = NULL;
}
bool video_driver_supports_viewport_read(void)
{
video_driver_state_t *video_st = &video_driver_st;
return video_st->current_video->read_viewport
&& video_st->current_video->viewport_info;
}
bool video_driver_prefer_viewport_read(void)
{
video_driver_state_t *video_st = &video_driver_st;
return (video_driver_is_hw_context() &&
!video_st->current_video->read_frame_raw);
}
bool video_driver_supports_read_frame_raw(void)
{
video_driver_state_t *video_st = &video_driver_st;
if (video_st->current_video->read_frame_raw)
return true;
return false;
}
/* Get aspect ratio (DAR) requested by the core */
float video_driver_get_core_aspect(void)
{
video_driver_state_t *video_st = &video_driver_st;
struct retro_game_geometry *geom = &video_st->av_info.geometry;
float out_aspect = 0;
video_driver_state_t *video_st = &video_driver_st;
struct retro_game_geometry *geom = &video_st->av_info.geometry;
float out_aspect = 0;
if (!geom || geom->base_width <= 0.0f || geom->base_height <= 0.0f)
return out_aspect;
return 0.0f;
/* Fallback to 1:1 pixel ratio if none provided */
if (geom->aspect_ratio > 0.0f)
@ -1936,7 +1886,7 @@ float video_driver_get_core_aspect(void)
/* Flip rotated aspect */
if ((retroarch_get_rotation() + retroarch_get_core_requested_rotation()) % 2)
out_aspect = 1.0f / out_aspect;
return (1.0f / out_aspect);
return out_aspect;
}
@ -2067,8 +2017,7 @@ void video_driver_set_aspect_ratio(void)
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
video_st->aspect_ratio = aspectratio_lut[aspect_ratio_idx].value;
if ( video_st->poke
&& video_st->poke->set_aspect_ratio)
@ -2103,12 +2052,11 @@ void video_driver_update_viewport(
#if defined(HAVE_MENU)
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = &settings->video_viewport_custom;
vp->x = custom->x;
vp->y = custom->y;
vp->width = custom->width;
vp->height = custom->height;
const struct video_viewport *custom_vp = &settings->video_viewport_custom;
vp->x = custom_vp->x;
vp->y = custom_vp->y;
vp->width = custom_vp->width;
vp->height = custom_vp->height;
}
else
#endif
@ -2223,8 +2171,8 @@ bool video_driver_find_driver(
/* If we have configured one of the HW render
* capable GL drivers, go with that. */
#if defined(HAVE_OPENGL_CORE)
if ( !string_is_equal(settings->arrays.video_driver, "gl") &&
!string_is_equal(settings->arrays.video_driver, "glcore"))
if ( !string_is_equal(settings->arrays.video_driver, "gl")
&& !string_is_equal(settings->arrays.video_driver, "glcore"))
{
strlcpy(video_st->cached_driver_id,
settings->arrays.video_driver,
@ -2307,16 +2255,6 @@ void video_driver_apply_state_changes(void)
video_st->poke->apply_state_changes(video_st->data);
}
bool video_driver_read_viewport(uint8_t *buffer, bool is_idle)
{
video_driver_state_t *video_st = &video_driver_st;
if ( video_st->current_video->read_viewport
&& video_st->current_video->read_viewport(
video_st->data, buffer, is_idle))
return true;
return false;
}
bool video_driver_is_hw_context(void)
{
bool is_hw_context = false;
@ -2330,13 +2268,6 @@ bool video_driver_is_hw_context(void)
return is_hw_context;
}
const struct retro_hw_render_context_negotiation_interface *
video_driver_get_context_negotiation_interface(void)
{
video_driver_state_t *video_st = &video_driver_st;
return video_st->hw_render_context_negotiation;
}
bool video_driver_get_viewport_info(struct video_viewport *viewport)
{
video_driver_state_t *video_st = &video_driver_st;
@ -2370,14 +2301,14 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
struct video_viewport *custom = &settings->video_viewport_custom;
struct video_viewport *custom_vp = &settings->video_viewport_custom;
if (custom)
if (custom_vp)
{
padding_x = width - custom->width;
padding_y = height - custom->height;
width = custom->width;
height = custom->height;
padding_x = width - custom_vp->width;
padding_y = height - custom_vp->height;
width = custom_vp->width;
height = custom_vp->height;
}
}
else
@ -2418,19 +2349,19 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
max_scale = MIN(width / base_width,
height / base_height);
padding_x = width - base_width * max_scale;
padding_x = width - base_width * max_scale;
padding_y = height - base_height * max_scale;
}
else
{
/* X/Y can be independent, each scaled as much as possible. */
padding_x = width % base_width;
padding_x = width % base_width;
padding_y = height % base_height;
}
}
width -= padding_x;
height -= padding_y;
width -= padding_x;
height -= padding_y;
}
vp->width = width;
@ -2848,11 +2779,10 @@ bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
{
flags->flags = video_st->deferred_flag_data.flags;
video_st->flags &= ~VIDEO_FLAG_DEFERRED_VIDEO_CTX_DRIVER_SET_FLAGS;
return true;
}
flags->flags = video_st->current_video_context.get_flags(
video_st->context_data);
else
flags->flags = video_st->current_video_context.get_flags(
video_st->context_data);
return true;
}
@ -3057,8 +2987,8 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
const char *path_softfilter_plugin = settings->paths.path_softfilter_plugin;
/* Init video filter only when game is running */
if ((runloop_st->current_core.flags & RETRO_CORE_FLAG_GAME_LOADED) &&
!string_is_empty(path_softfilter_plugin))
if (( runloop_st->current_core.flags & RETRO_CORE_FLAG_GAME_LOADED)
&& !string_is_empty(path_softfilter_plugin))
video_driver_init_filter(video_driver_pix_fmt, settings);
#endif
@ -3106,10 +3036,8 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
/* Guard against aspect ratio index possibly being out of bounds */
unsigned new_aspect_idx = settings->uints.video_aspect_ratio_idx;
if (new_aspect_idx > ASPECT_RATIO_END)
new_aspect_idx = settings->uints.video_aspect_ratio_idx = 0;
video_driver_set_aspect_ratio_value(
aspectratio_lut[new_aspect_idx].value);
new_aspect_idx = settings->uints.video_aspect_ratio_idx = 0;
video_st->aspect_ratio = aspectratio_lut[new_aspect_idx].value;
}
if ( settings->bools.video_fullscreen
@ -3135,24 +3063,23 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
#else
bool window_custom_size_enable = settings->bools.video_window_custom_size_enable;
#endif
/* TODO: remove when the new window resizing core is hooked */
if (window_custom_size_enable &&
settings->uints.window_position_width &&
settings->uints.window_position_height)
/* TODO/FIXME: remove when the new window resizing core is hooked */
if ( window_custom_size_enable
&& settings->uints.window_position_width
&& settings->uints.window_position_height)
{
width = settings->uints.window_position_width;
height = settings->uints.window_position_height;
}
else
{
unsigned video_scale = settings->uints.video_scale;
unsigned video_scale = settings->uints.video_scale;
/* Determine maximum allowed window dimensions
* NOTE: We cannot read the actual display
* metrics here, because the context driver
* has not yet been initialised... */
/* > Try explicitly configured values */
unsigned max_win_width = settings->uints.window_auto_width_max;
unsigned max_win_width = settings->uints.window_auto_width_max;
unsigned max_win_height = settings->uints.window_auto_height_max;
/* > Handle invalid settings */
@ -3167,7 +3094,7 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
/* Maximum window width/size *must* be non-zero;
* if all else fails, used defined default
* maximum window size */
max_win_width = DEFAULT_WINDOW_AUTO_WIDTH_MAX;
max_win_width = DEFAULT_WINDOW_AUTO_WIDTH_MAX;
max_win_height = DEFAULT_WINDOW_AUTO_HEIGHT_MAX;
}
}
@ -3212,15 +3139,15 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
/* Cap window size to maximum allowed values */
if ((width > max_win_width) || (height > max_win_height))
{
unsigned geom_width = (width > 0) ? width : 1;
unsigned geom_width = (width > 0) ? width : 1;
unsigned geom_height = (height > 0) ? height : 1;
float geom_aspect = (float)geom_width / (float)geom_height;
float max_win_aspect = (float)max_win_width / (float)max_win_height;
if (geom_aspect > max_win_aspect)
{
width = max_win_width;
height = geom_height * max_win_width / geom_width;
width = max_win_width;
height = geom_height * max_win_width / geom_width;
/* Account for any possible rounding errors... */
if (height < 1)
height = 1;
@ -3229,13 +3156,13 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
}
else
{
height = max_win_height;
width = geom_width * max_win_height / geom_height;
height = max_win_height;
width = geom_width * max_win_height / geom_height;
/* Account for any possible rounding errors... */
if (width < 1)
width = 1;
width = 1;
else if (width > max_win_width)
width = max_win_width;
width = max_win_width;
}
}
}
@ -3475,10 +3402,10 @@ void video_driver_frame(const void *data, unsigned width,
* current frame is not (i.e. if core was
* previously sending duped frames, ensure
* that the next frame update is captured) */
if (video_info.input_driver_nonblock_state &&
video_info.fastforward_frameskip &&
!(video_info.menu_is_alive ||
(last_frame_duped && !!data)))
if ( video_info.input_driver_nonblock_state
&& video_info.fastforward_frameskip
&& !(video_info.menu_is_alive
|| (last_frame_duped && !!data)))
{
retro_time_t frame_time_accumulator_prev = frame_time_accumulator;
retro_time_t frame_time_delta = new_time - last_time;
@ -3537,18 +3464,14 @@ void video_driver_frame(const void *data, unsigned width,
/* Get the amount of frames per seconds. */
if (video_st->frame_count)
{
unsigned fps_update_interval =
video_info.fps_update_interval;
unsigned memory_update_interval =
video_info.memory_update_interval;
unsigned fps_update_interval = video_info.fps_update_interval;
unsigned memory_update_interval = video_info.memory_update_interval;
/* set this to 1 to avoid an offset issue */
unsigned write_index =
video_st->frame_time_count++ &
(MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
frame_time = new_time - fps_time;
video_st->frame_time_samples
[write_index] = frame_time;
fps_time = new_time;
unsigned write_index = video_st->frame_time_count++
& (MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
frame_time = new_time - fps_time;
video_st->frame_time_samples[write_index] = frame_time;
fps_time = new_time;
if (video_info.fps_show)
{
@ -3620,8 +3543,7 @@ void video_driver_frame(const void *data, unsigned width,
fps_update_interval);
video_st->window_title_len = strlcpy(video_st->window_title,
video_st->title_buf,
sizeof(video_st->window_title));
video_st->title_buf, sizeof(video_st->window_title));
if (!string_is_empty(status_text))
{
@ -3738,7 +3660,7 @@ void video_driver_frame(const void *data, unsigned width,
video_st->state_buffer, output_pitch,
data, width, height, pitch);
if (video_info.post_filter_record
if ( video_info.post_filter_record
&& recording_st->data
&& recording_st->driver
&& recording_st->driver->push_video)
@ -3815,20 +3737,19 @@ void video_driver_frame(const void *data, unsigned width,
char tmp[128];
size_t len;
double stddev = 0.0;
float scale = 1.0f;
float font_size_scale = video_info.font_size / 100;
struct retro_system_av_info *av_info = &video_st->av_info;
unsigned red = 235;
unsigned green = 235;
unsigned blue = 235;
unsigned alpha = 255;
scale = ((float)video_info.height / 480)
float scale = ((float)video_info.height / 480)
* 0.50f * (DEFAULT_FONT_SIZE / video_info.font_size);
scale = (scale < font_size_scale)
? font_size_scale : scale;
scale = (scale > 1.00f)
? 1.00f : scale;
/* Clamp scale */
if (scale < font_size_scale)
scale = font_size_scale;
if (scale > 1.00f)
scale = 1.00f;
if (scale > font_size_scale)
{
@ -3999,7 +3920,6 @@ void video_driver_frame(const void *data, unsigned width,
case 3840:
case 1920:
width = video_info.crt_switch_resolution_super;
dynamic_super_width = false;
break;
case 1:
dynamic_super_width = true;

View File

@ -906,18 +906,10 @@ void video_driver_set_stub_frame(void);
void video_driver_unset_stub_frame(void);
bool video_driver_supports_viewport_read(void);
bool video_driver_prefer_viewport_read(void);
bool video_driver_supports_read_frame_raw(void);
float video_driver_get_core_aspect(void);
void video_driver_set_viewport_core(void);
void video_driver_reset_custom_viewport(settings_t *settings);
void video_driver_set_rgba(void);
void video_driver_unset_rgba(void);
@ -942,17 +934,12 @@ void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bo
void video_driver_apply_state_changes(void);
bool video_driver_read_viewport(uint8_t *buffer, bool is_idle);
void video_driver_cached_frame(void);
bool video_driver_is_hw_context(void);
struct retro_hw_render_callback *video_driver_get_hw_context(void);
const struct retro_hw_render_context_negotiation_interface
*video_driver_get_context_negotiation_interface(void);
bool video_driver_get_viewport_info(struct video_viewport *viewport);
/**
@ -1005,10 +992,6 @@ void video_driver_set_size(unsigned width, unsigned height);
float video_driver_get_aspect_ratio(void);
void video_driver_set_aspect_ratio_value(float value);
enum retro_pixel_format video_driver_get_pixel_format(void);
void video_driver_cached_frame_set(const void *data, unsigned width,
unsigned height, size_t pitch);
@ -1035,8 +1018,6 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
struct retro_system_av_info *video_viewport_get_system_av_info(void);
struct video_viewport *video_viewport_get_custom(void);
/**
* video_monitor_set_refresh_rate:
* @hz : New refresh rate for monitor.

View File

@ -641,15 +641,16 @@ static INLINE void android_mouse_calculate_deltas(android_input_t *android,
/* Adjust mouse speed based on ratio
* between core resolution and system resolution */
float x = 0, y = 0;
float x_scale = 1;
float y_scale = 1;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
float x_scale = 1;
float y_scale = 1;
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
if (av_info)
{
video_viewport_t *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
const struct retro_game_geometry *geom = (const struct retro_game_geometry*)&av_info->geometry;
x_scale = 2 * (float)geom->base_width / (float)custom_vp->width;
x_scale = 2 * (float)geom->base_width / (float)custom_vp->width;
y_scale = 2 * (float)geom->base_height / (float)custom_vp->height;
}

View File

@ -5861,11 +5861,12 @@ bool rgui_is_video_config_equal(
static void rgui_get_video_config(
rgui_video_settings_t *video_settings,
settings_t *settings,
unsigned video_aspect_ratio_idx)
{
/* Could use settings->video_viewport_custom directly,
* but this seems to be the standard way of doing it... */
video_viewport_t *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_settings->aspect_ratio_idx = video_aspect_ratio_idx;
video_settings->viewport.width = custom_vp->width;
video_settings->viewport.height = custom_vp->height;
@ -5881,7 +5882,7 @@ static void rgui_set_video_config(
{
/* Could use settings->video_viewport_custom directly,
* but this seems to be the standard way of doing it... */
video_viewport_t *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
settings->uints.video_aspect_ratio_idx = video_settings->aspect_ratio_idx;
custom_vp->width = video_settings->viewport.width;
custom_vp->height = video_settings->viewport.height;
@ -6432,7 +6433,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
goto error;
/* Cache initial video settings */
rgui_get_video_config(&rgui->content_video_settings, settings->uints.video_aspect_ratio_idx);
rgui_get_video_config(&rgui->content_video_settings, settings, settings->uints.video_aspect_ratio_idx);
/* Get initial 'window' dimensions */
video_driver_get_viewport_info(&vp);
@ -7339,7 +7340,7 @@ static void rgui_populate_entries(
/* Make sure that any changes made while accessing
* the video settings menu are preserved */
rgui_video_settings_t current_video_settings = {{0}};
rgui_get_video_config(&current_video_settings, settings->uints.video_aspect_ratio_idx);
rgui_get_video_config(&current_video_settings, settings, settings->uints.video_aspect_ratio_idx);
if (rgui_is_video_config_equal(&current_video_settings, &rgui->menu_video_settings))
{
rgui_set_video_config(rgui, settings, &rgui->content_video_settings, false);
@ -7775,7 +7776,7 @@ static void rgui_toggle(void *userdata, bool menu_on)
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
{
/* Cache content video settings */
rgui_get_video_config(&rgui->content_video_settings, settings->uints.video_aspect_ratio_idx);
rgui_get_video_config(&rgui->content_video_settings, settings, settings->uints.video_aspect_ratio_idx);
/* Update menu viewport */
rgui_update_menu_viewport(rgui, p_disp, settings->uints.menu_rgui_aspect_ratio_lock);
/* Apply menu video settings */
@ -7790,7 +7791,7 @@ static void rgui_toggle(void *userdata, bool menu_on)
* has not changed video settings since menu was
* last toggled on */
rgui_video_settings_t current_video_settings = {{0}};
rgui_get_video_config(&current_video_settings, settings->uints.video_aspect_ratio_idx);
rgui_get_video_config(&current_video_settings, settings, settings->uints.video_aspect_ratio_idx);
if (rgui_is_video_config_equal(&current_video_settings, &rgui->menu_video_settings))
rgui_set_video_config(rgui, settings, &rgui->content_video_settings, false);
@ -7883,7 +7884,7 @@ static enum menu_action rgui_parse_menu_entry_action(
{
settings_t *settings = config_get_ptr();
rgui_video_settings_t current_video_settings = {{0}};
rgui_get_video_config(&current_video_settings, settings->uints.video_aspect_ratio_idx);
rgui_get_video_config(&current_video_settings, settings, settings->uints.video_aspect_ratio_idx);
if (rgui_is_video_config_equal(&current_video_settings,
&rgui->menu_video_settings))
{

View File

@ -7215,11 +7215,15 @@ unsigned menu_displaylist_build_list(
PARSE_ONLY_UINT, false) == 0)
count++;
#ifdef HAVE_SCREENSHOTS
if (video_driver_supports_viewport_read())
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT,
PARSE_ONLY_BOOL, false) == 0)
count++;
{
video_driver_state_t *video_st = video_state_get_ptr();
if ( video_st->current_video->read_viewport
&& video_st->current_video->viewport_info)
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT,
PARSE_ONLY_BOOL, false) == 0)
count++;
}
#endif
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_CTX_SCALING,

View File

@ -5498,8 +5498,8 @@ static int setting_uint_action_left_custom_viewport_width(
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -5538,8 +5538,8 @@ static int setting_uint_action_left_custom_viewport_height(
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -5799,8 +5799,8 @@ static int setting_uint_action_right_custom_viewport_width(
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -5833,8 +5833,8 @@ static int setting_uint_action_right_custom_viewport_height(
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -7226,8 +7226,8 @@ static int setting_action_start_custom_viewport_width(rarch_setting_t *setting)
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -7259,8 +7259,8 @@ static int setting_action_start_custom_viewport_height(rarch_setting_t *setting)
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -7747,6 +7747,7 @@ static void write_handler_logging_verbosity(rarch_setting_t *setting)
static void general_write_handler(rarch_setting_t *setting)
{
enum event_command rarch_cmd = CMD_EVENT_NONE;
settings_t *settings = config_get_ptr();
if (!setting)
return;
@ -7757,19 +7758,14 @@ static void general_write_handler(rarch_setting_t *setting)
{
case MENU_ENUM_LABEL_VIDEO_SHADERS_ENABLE:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
{
settings_t *settings = config_get_ptr();
video_shader_toggle(settings);
}
video_shader_toggle(settings);
#endif
break;
case MENU_ENUM_LABEL_VIDEO_THREADED:
{
if (*setting->value.target.boolean)
task_queue_set_threaded();
else
task_queue_unset_threaded();
}
if (*setting->value.target.boolean)
task_queue_set_threaded();
else
task_queue_unset_threaded();
break;
case MENU_ENUM_LABEL_GAMEMODE_ENABLE:
if (frontend_driver_has_gamemode())
@ -7778,7 +7774,6 @@ static void general_write_handler(rarch_setting_t *setting)
if (!frontend_driver_set_gamemode(on) && on)
{
settings_t *settings = config_get_ptr();
/* If we failed to enable game mode, display
* a notification and force disable the feature */
@ -7802,7 +7797,7 @@ static void general_write_handler(rarch_setting_t *setting)
{
video_viewport_t vp;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
@ -7812,21 +7807,21 @@ static void general_write_handler(rarch_setting_t *setting)
{
unsigned int rotation = retroarch_get_rotation();
custom->x = 0;
custom->y = 0;
custom_vp->x = 0;
custom_vp->y = 0;
if (rotation % 2)
{
custom->width = ((custom->width + geom->base_height - 1) / geom->base_height) * geom->base_height;
custom->height = ((custom->height + geom->base_width - 1) / geom->base_width) * geom->base_width;
custom_vp->width = ((custom_vp->width + geom->base_height - 1) / geom->base_height) * geom->base_height;
custom_vp->height = ((custom_vp->height + geom->base_width - 1) / geom->base_width) * geom->base_width;
}
else
{
custom->width = ((custom->width + geom->base_width - 1) / geom->base_width) * geom->base_width;
custom->height = ((custom->height + geom->base_height - 1) / geom->base_height) * geom->base_height;
custom_vp->width = ((custom_vp->width + geom->base_width - 1) / geom->base_width) * geom->base_width;
custom_vp->height = ((custom_vp->height + geom->base_height - 1) / geom->base_height) * geom->base_height;
}
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
(float)custom->width / custom->height;
(float)custom_vp->width / custom_vp->height;
}
}
break;
@ -7834,7 +7829,6 @@ static void general_write_handler(rarch_setting_t *setting)
if (*setting->value.target.boolean)
{
menu_displaylist_info_t info;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
@ -7853,12 +7847,9 @@ static void general_write_handler(rarch_setting_t *setting)
}
break;
case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW:
{
settings_t *settings = config_get_ptr();
configuration_set_float(settings,
settings->floats.audio_max_timing_skew,
*setting->value.target.fraction);
}
configuration_set_float(settings,
settings->floats.audio_max_timing_skew,
*setting->value.target.fraction);
break;
#ifdef HAVE_CHEEVOS
case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY:
@ -7881,7 +7872,6 @@ static void general_write_handler(rarch_setting_t *setting)
#if defined(DINGUX) && defined(DINGUX_BETA)
case MENU_ENUM_LABEL_VIDEO_DINGUX_REFRESH_RATE:
{
settings_t *settings = config_get_ptr();
enum dingux_refresh_rate
current_refresh_rate = DINGUX_REFRESH_RATE_60HZ;
enum dingux_refresh_rate
@ -7922,27 +7912,20 @@ static void general_write_handler(rarch_setting_t *setting)
break;
#endif
case MENU_ENUM_LABEL_VIDEO_SCALE:
{
settings_t *settings = config_get_ptr();
settings->modified = true;
settings->uints.video_scale = *setting->value.target.unsigned_integer;
settings->modified = true;
settings->uints.video_scale = *setting->value.target.unsigned_integer;
if (!settings->bools.video_fullscreen)
rarch_cmd = CMD_EVENT_REINIT;
}
if (!settings->bools.video_fullscreen)
rarch_cmd = CMD_EVENT_REINIT;
break;
case MENU_ENUM_LABEL_VIDEO_HDR_ENABLE:
{
settings_t *settings = config_get_ptr();
settings->modified = true;
settings->bools.video_hdr_enable = *setting->value.target.boolean;
settings->modified = true;
settings->bools.video_hdr_enable = *setting->value.target.boolean;
rarch_cmd = CMD_EVENT_REINIT;
}
rarch_cmd = CMD_EVENT_REINIT;
break;
case MENU_ENUM_LABEL_VIDEO_HDR_MAX_NITS:
{
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
settings->modified = true;
settings->floats.video_hdr_max_nits = roundf(*setting->value.target.fraction);
@ -7965,7 +7948,6 @@ static void general_write_handler(rarch_setting_t *setting)
break;
case MENU_ENUM_LABEL_VIDEO_HDR_CONTRAST:
{
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
settings->modified = true;
settings->floats.video_hdr_display_contrast = *setting->value.target.fraction;
@ -7976,7 +7958,6 @@ static void general_write_handler(rarch_setting_t *setting)
break;
case MENU_ENUM_LABEL_VIDEO_HDR_EXPAND_GAMUT:
{
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
settings->modified = true;
settings->bools.video_hdr_expand_gamut = *setting->value.target.boolean;
@ -7993,25 +7974,18 @@ static void general_write_handler(rarch_setting_t *setting)
case MENU_ENUM_LABEL_INPUT_PLAYER3_JOYPAD_INDEX:
case MENU_ENUM_LABEL_INPUT_PLAYER4_JOYPAD_INDEX:
case MENU_ENUM_LABEL_INPUT_PLAYER5_JOYPAD_INDEX:
{
settings_t *settings = config_get_ptr();
settings->modified = true;
settings->uints.input_joypad_index[setting->enum_idx - MENU_ENUM_LABEL_INPUT_PLAYER1_JOYPAD_INDEX] = *setting->value.target.integer;
}
settings->modified = true;
settings->uints.input_joypad_index[setting->enum_idx - MENU_ENUM_LABEL_INPUT_PLAYER1_JOYPAD_INDEX] = *setting->value.target.integer;
break;
#ifdef ANDROID
case MENU_ENUM_LABEL_INPUT_SELECT_PHYSICAL_KEYBOARD:
{
settings_t *settings = config_get_ptr();
settings->modified = true;
strlcpy(settings->arrays.input_android_physical_keyboard, setting->value.target.string, sizeof(settings->arrays.input_android_physical_keyboard));
}
break;
#endif
case MENU_ENUM_LABEL_LOG_TO_FILE:
if (verbosity_is_enabled())
{
settings_t *settings = config_get_ptr();
bool log_to_file = settings->bools.log_to_file;
bool log_to_file_timestamp = settings->bools.log_to_file_timestamp;
const char *log_dir = settings->paths.log_dir;
@ -8031,7 +8005,6 @@ static void general_write_handler(rarch_setting_t *setting)
case MENU_ENUM_LABEL_LOG_TO_FILE_TIMESTAMP:
if (verbosity_is_enabled() && is_logging_to_file())
{
settings_t *settings = config_get_ptr();
bool log_to_file = settings->bools.log_to_file;
bool log_to_file_timestamp = settings->bools.log_to_file_timestamp;
const char *log_dir = settings->paths.log_dir;
@ -8051,24 +8024,21 @@ static void general_write_handler(rarch_setting_t *setting)
case MENU_ENUM_LABEL_VIDEO_DINGUX_RS90_SOFTFILTER_TYPE:
#endif
#endif
{
settings_t *settings = config_get_ptr();
video_driver_set_filtering(1, settings->bools.video_smooth,
settings->bools.video_ctx_scaling);
}
video_driver_set_filtering(1, settings->bools.video_smooth,
settings->bools.video_ctx_scaling);
break;
case MENU_ENUM_LABEL_VIDEO_ROTATION:
{
video_viewport_t vp;
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_t *custom = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
struct retro_game_geometry *geom = (struct retro_game_geometry*)
&av_info->geometry;
if (system)
{
unsigned int rotation = retroarch_get_rotation();
unsigned int rotation = retroarch_get_rotation();
video_driver_set_rotation(
(*setting->value.target.unsigned_integer +
@ -8076,22 +8046,22 @@ static void general_write_handler(rarch_setting_t *setting)
/* Update Custom Aspect Ratio values */
video_driver_get_viewport_info(&vp);
custom->x = 0;
custom->y = 0;
custom_vp->x = 0;
custom_vp->y = 0;
/* Round down when rotation is "horizontal", round up when rotation is "vertical"
to avoid expanding viewport each time user rotates */
if (rotation % 2)
{
custom->width = MAX(1,(custom->width / geom->base_height)) * geom->base_height;
custom->height = MAX(1,(custom->height/ geom->base_width )) * geom->base_width;
custom_vp->width = MAX(1, (custom_vp->width / geom->base_height)) * geom->base_height;
custom_vp->height = MAX(1, (custom_vp->height / geom->base_width )) * geom->base_width;
}
else
{
custom->width = ((custom->width + geom->base_width - 1) / geom->base_width) * geom->base_width;
custom->height = ((custom->height + geom->base_height - 1) / geom->base_height) * geom->base_height;
custom_vp->width = ((custom_vp->width + geom->base_width - 1) / geom->base_width) * geom->base_width;
custom_vp->height = ((custom_vp->height + geom->base_height - 1) / geom->base_height) * geom->base_height;
}
aspectratio_lut[ASPECT_RATIO_CUSTOM].value = (float)custom->width / custom->height;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value = (float)custom_vp->width / custom_vp->height;
/* Update Aspect Ratio (only useful for 1:1 PAR) */
video_driver_set_aspect_ratio();
@ -8099,13 +8069,11 @@ static void general_write_handler(rarch_setting_t *setting)
}
break;
case MENU_ENUM_LABEL_SCREEN_ORIENTATION:
{
#ifndef ANDROID
/* FIXME: Changing at runtime on Android causes setting to somehow be incremented again, many times */
video_display_server_set_screen_orientation(
(enum rotation)(*setting->value.target.unsigned_integer));
/* FIXME: Changing at runtime on Android causes setting to somehow be incremented again, many times */
video_display_server_set_screen_orientation(
(enum rotation)(*setting->value.target.unsigned_integer));
#endif
}
break;
case MENU_ENUM_LABEL_AUDIO_VOLUME:
audio_set_float(AUDIO_ACTION_VOLUME_GAIN, *setting->value.target.fraction);
@ -8123,13 +8091,10 @@ static void general_write_handler(rarch_setting_t *setting)
rarch_cmd = CMD_EVENT_AUDIO_REINIT;
break;
case MENU_ENUM_LABEL_PAL60_ENABLE:
{
global_t *global = global_get_ptr();
if (*setting->value.target.boolean && global->console.screen.pal_enable)
rarch_cmd = CMD_EVENT_REINIT;
else
setting_set_with_string_representation(setting, "false");
}
if (*setting->value.target.boolean && global_get_ptr()->console.screen.pal_enable)
rarch_cmd = CMD_EVENT_REINIT;
else
setting_set_with_string_representation(setting, "false");
break;
case MENU_ENUM_LABEL_SYSTEM_BGM_ENABLE:
if (*setting->value.target.boolean)
@ -8146,65 +8111,41 @@ static void general_write_handler(rarch_setting_t *setting)
}
break;
case MENU_ENUM_LABEL_AUDIO_ENABLE_MENU:
{
#ifdef HAVE_AUDIOMIXER
settings_t *settings = config_get_ptr();
if (settings->bools.audio_enable_menu)
audio_driver_load_system_sounds();
else
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
if (settings->bools.audio_enable_menu)
audio_driver_load_system_sounds();
else
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
#endif
}
break;
case MENU_ENUM_LABEL_MENU_SOUND_BGM:
{
#ifdef HAVE_AUDIOMIXER
settings_t *settings = config_get_ptr();
if (settings->bools.audio_enable_menu)
{
if (settings->bools.audio_enable_menu_bgm)
audio_driver_mixer_play_menu_sound_looped(AUDIO_MIXER_SYSTEM_SLOT_BGM);
else
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
}
#endif
if (settings->bools.audio_enable_menu)
{
if (settings->bools.audio_enable_menu_bgm)
audio_driver_mixer_play_menu_sound_looped(AUDIO_MIXER_SYSTEM_SLOT_BGM);
else
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
}
#endif
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY:
{
settings_t *settings = config_get_ptr();
video_display_server_set_window_opacity(settings->uints.video_window_opacity);
}
video_display_server_set_window_opacity(settings->uints.video_window_opacity);
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS:
{
settings_t *settings = config_get_ptr();
video_display_server_set_window_decorations(settings->bools.video_window_show_decorations);
}
video_display_server_set_window_decorations(settings->bools.video_window_show_decorations);
break;
case MENU_ENUM_LABEL_MIDI_INPUT:
{
settings_t *settings = config_get_ptr();
midi_driver_set_input(settings->arrays.midi_input);
}
midi_driver_set_input(settings->arrays.midi_input);
break;
case MENU_ENUM_LABEL_MIDI_OUTPUT:
{
settings_t *settings = config_get_ptr();
midi_driver_set_output(settings, settings->arrays.midi_output);
}
midi_driver_set_output(settings, settings->arrays.midi_output);
break;
case MENU_ENUM_LABEL_MIDI_VOLUME:
{
settings_t *settings = config_get_ptr();
midi_driver_set_volume(settings->uints.midi_volume);
}
midi_driver_set_volume(settings->uints.midi_volume);
break;
case MENU_ENUM_LABEL_SUSTAINED_PERFORMANCE_MODE:
{
settings_t *settings = config_get_ptr();
frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode);
}
frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode);
break;
case MENU_ENUM_LABEL_REWIND_BUFFER_SIZE_STEP:
{
@ -8222,14 +8163,12 @@ static void general_write_handler(rarch_setting_t *setting)
*(setting->value.target.unsigned_integer) = 0;
setting->max = cheat_manager_get_state_search_size(cheat_manager_state.working_cheat.memory_search_size);
}
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE);
if (setting)
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE)))
{
*setting->value.target.unsigned_integer = 0;
setting->max = cheat_manager_get_state_search_size(cheat_manager_state.working_cheat.memory_search_size);
}
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION);
if (setting)
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION)))
{
int max_bit_position;
*setting->value.target.unsigned_integer = 0;
@ -8248,14 +8187,12 @@ static void general_write_handler(rarch_setting_t *setting)
*setting->value.target.unsigned_integer = 0;
setting->max = cheat_manager_get_state_search_size(cheat_manager_state.search_bit_size);
}
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS);
if (setting)
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS)))
{
*setting->value.target.unsigned_integer = 0;
setting->max = cheat_manager_get_state_search_size(cheat_manager_state.search_bit_size);
}
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS);
if (setting)
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS)))
{
*setting->value.target.unsigned_integer = 0;
setting->max = cheat_manager_get_state_search_size(cheat_manager_state.search_bit_size);
@ -8265,15 +8202,12 @@ static void general_write_handler(rarch_setting_t *setting)
break;
case MENU_ENUM_LABEL_CONTENT_FAVORITES_SIZE:
{
unsigned new_capacity;
settings_t *settings = config_get_ptr();
unsigned new_capacity = COLLECTION_SIZE;
int content_favorites_size = settings->ints.content_favorites_size;
/* Get new size */
if (content_favorites_size < 0)
new_capacity = COLLECTION_SIZE;
else
new_capacity = (unsigned)content_favorites_size;
if (content_favorites_size >= 0)
new_capacity = (unsigned)content_favorites_size;
/* Check whether capacity has changed */
if (new_capacity != playlist_capacity(g_defaults.content_favorites))
@ -8328,28 +8262,19 @@ static void general_write_handler(rarch_setting_t *setting)
}
break;
case MENU_ENUM_LABEL_CHEEVOS_USERNAME:
{
settings_t *settings = config_get_ptr();
/* when changing the username, clear out the password and token */
settings->arrays.cheevos_password[0] = '\0';
settings->arrays.cheevos_token[0] = '\0';
}
/* When changing the username, clear out the password and token */
settings->arrays.cheevos_password[0] = '\0';
settings->arrays.cheevos_token[0] = '\0';
break;
case MENU_ENUM_LABEL_CHEEVOS_PASSWORD:
{
settings_t *settings = config_get_ptr();
/* when changing the password, clear out the token */
settings->arrays.cheevos_token[0] = '\0';
}
/* When changing the password, clear out the token */
settings->arrays.cheevos_token[0] = '\0';
break;
case MENU_ENUM_LABEL_CHEEVOS_UNLOCK_SOUND_ENABLE:
{
#ifdef HAVE_AUDIOMIXER
settings_t *settings = config_get_ptr();
if (settings->bools.cheevos_unlock_sound_enable)
audio_driver_load_system_sounds();
if (settings->bools.cheevos_unlock_sound_enable)
audio_driver_load_system_sounds();
#endif
}
break;
case MENU_ENUM_LABEL_INPUT_SENSORS_ENABLE:
/* When toggling sensor input off, ensure
@ -8395,7 +8320,6 @@ static void general_write_handler(rarch_setting_t *setting)
break;
case MENU_ENUM_LABEL_CORE_INFO_CACHE_ENABLE:
{
settings_t *settings = config_get_ptr();
const char *dir_libretro = settings->paths.directory_libretro;
const char *path_libretro_info = settings->paths.path_libretro_info;
@ -8429,7 +8353,7 @@ static void general_write_handler(rarch_setting_t *setting)
/* Whenever custom viewport dimensions are
* changed, ASPECT_RATIO_CUSTOM must be
* recalculated */
video_viewport_t *custom_vp = video_viewport_get_custom();
video_viewport_t *custom_vp = &settings->video_viewport_custom;
float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
@ -11567,7 +11491,7 @@ static bool setting_append_list(
break;
case SETTINGS_LIST_VIDEO:
{
struct video_viewport *custom_vp = video_viewport_get_custom();
struct video_viewport *custom_vp = &settings->video_viewport_custom;
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), parent_group);
MENU_SETTINGS_LIST_CURRENT_ADD_ENUM_IDX_PTR(list, list_info, MENU_ENUM_LABEL_VIDEO_SETTINGS);

View File

@ -418,6 +418,7 @@ static bool take_screenshot_viewport(
unsigned pixel_format_type)
{
struct video_viewport vp;
video_driver_state_t *video_st = video_state_get_ptr();
uint8_t *buffer = NULL;
vp.x = 0;
@ -434,7 +435,9 @@ static bool take_screenshot_viewport(
if (!(buffer = (uint8_t*)malloc(vp.width * vp.height * 3)))
return false;
if (!video_driver_read_viewport(buffer, runloop_flags & RUNLOOP_FLAG_IDLE))
if (!( video_st->current_video->read_viewport
&& video_st->current_video->read_viewport(
video_st->data, buffer, runloop_flags & RUNLOOP_FLAG_IDLE)))
goto error;
/* Data read from viewport is in bottom-up order, suitable for BMP. */
@ -542,13 +545,16 @@ bool take_screenshot(
bool savestate, bool has_valid_framebuffer,
bool fullpath, bool use_thread)
{
bool ret = false;
uint32_t runloop_flags = runloop_get_flags();
settings_t *settings = config_get_ptr();
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
bool supports_viewport_read = video_driver_supports_viewport_read();
bool prefer_viewport_read = supports_viewport_read &&
video_driver_prefer_viewport_read();
bool ret = false;
uint32_t runloop_flags = runloop_get_flags();
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
bool supports_viewport_read = video_st->current_video->read_viewport
&& (video_st->current_video->viewport_info);
bool prefer_viewport_read = supports_viewport_read
&& video_driver_is_hw_context()
&& !video_st->current_video->read_frame_raw;
/* Avoid GPU screenshots with savestates */
if (supports_viewport_read && video_gpu_screenshot && !savestate)
@ -564,8 +570,8 @@ bool take_screenshot(
name_base, savestate, runloop_flags,
has_valid_framebuffer, fullpath, use_thread,
prefer_viewport_read,
video_driver_supports_read_frame_raw(),
video_driver_get_pixel_format()
(video_st->current_video->read_frame_raw),
video_st->pix_fmt
);
if ( (runloop_flags & RUNLOOP_FLAG_PAUSED)

View File

@ -842,7 +842,7 @@ bool run_translation_service(settings_t *settings, bool paused)
label_len = strlen(label);
system_label = (char*)malloc(label_len + system_id_len + 3);
memcpy(system_label, system_id, system_id_len);
memcpy(system_label + system_id_len, "__", 2);
memcpy(system_label + system_id_len, "__", 2);
memcpy(system_label + 2 + system_id_len, label, label_len);
system_label[system_id_len + 2 + label_len] = '\0';
}
@ -882,7 +882,9 @@ bool run_translation_service(settings_t *settings, bool paused)
if (!bit24_image_prev || !bit24_image)
goto finish;
if (!video_driver_read_viewport(bit24_image_prev, false))
if (!( video_st->current_video->read_viewport
&& video_st->current_video->read_viewport(
video_st->data, bit24_image_prev, false)))
{
RARCH_LOG("Could not read viewport for translation service...\n");
goto finish;