mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Adding to get_video_output_size 2 parameters for additional info
This commit is contained in:
parent
216675919b
commit
3bbfcf7b39
@ -2527,7 +2527,7 @@ bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
|
||||
return true;
|
||||
}
|
||||
|
||||
void win32_get_video_output_size(unsigned *width, unsigned *height)
|
||||
void win32_get_video_output_size(unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
DEVMODE dm;
|
||||
|
||||
|
@ -113,7 +113,7 @@ void win32_set_window(unsigned *width, unsigned *height,
|
||||
bool fullscreen, bool windowed_full, void *rect_data);
|
||||
|
||||
void win32_get_video_output_size(
|
||||
unsigned *width, unsigned *height);
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len);
|
||||
|
||||
void win32_get_video_output_prev(
|
||||
unsigned *width, unsigned *height);
|
||||
|
@ -1750,9 +1750,9 @@ static uint32_t d3d10_get_flags(void *data)
|
||||
|
||||
#ifndef __WINRT__
|
||||
static void d3d10_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void d3d10_get_video_output_prev(void *data)
|
||||
|
@ -2325,9 +2325,9 @@ static bool d3d11_get_hw_render_interface(
|
||||
|
||||
#ifndef __WINRT__
|
||||
static void d3d11_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void d3d11_get_video_output_prev(void *data)
|
||||
|
@ -2208,9 +2208,9 @@ static uint32_t d3d12_get_flags(void *data)
|
||||
|
||||
#ifndef __WINRT__
|
||||
static void d3d12_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void d3d12_get_video_output_prev(void *data)
|
||||
|
@ -349,7 +349,7 @@ static void fpga_set_osd_msg(void *data,
|
||||
}
|
||||
|
||||
static void fpga_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height) { }
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len) { }
|
||||
static void fpga_get_video_output_prev(void *data) { }
|
||||
static void fpga_get_video_output_next(void *data) { }
|
||||
|
||||
|
@ -684,9 +684,9 @@ static void gdi_unload_texture(void *data,
|
||||
static uint32_t gdi_get_flags(void *data) { return 0; }
|
||||
|
||||
static void gdi_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gdi_get_video_output_prev(void *data)
|
||||
|
@ -1214,14 +1214,14 @@ static void gl1_set_texture_frame(void *data,
|
||||
}
|
||||
|
||||
static void gl1_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
gl1_t *gl = (gl1_t*)data;
|
||||
if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_size)
|
||||
return;
|
||||
gl->ctx_driver->get_video_output_size(
|
||||
gl->ctx_data,
|
||||
width, height);
|
||||
width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gl1_get_video_output_prev(void *data)
|
||||
|
@ -4417,14 +4417,14 @@ static void gl2_apply_state_changes(void *data)
|
||||
}
|
||||
|
||||
static void gl2_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
gl2_t *gl = (gl2_t*)data;
|
||||
if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_size)
|
||||
return;
|
||||
gl->ctx_driver->get_video_output_size(
|
||||
gl->ctx_data,
|
||||
width, height);
|
||||
width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gl2_get_video_output_prev(void *data)
|
||||
|
@ -2221,14 +2221,14 @@ static void gl_core_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
}
|
||||
|
||||
static void gl_core_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
gl_core_t *gl = (gl_core_t*)data;
|
||||
if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_size)
|
||||
return;
|
||||
gl->ctx_driver->get_video_output_size(
|
||||
gl->ctx_data,
|
||||
width, height);
|
||||
width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gl_core_get_video_output_prev(void *data)
|
||||
|
@ -600,7 +600,7 @@ static void gx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
||||
}
|
||||
|
||||
static void gx_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
@ -621,6 +621,7 @@ static void gx_get_video_output_size(void *data,
|
||||
static void setup_video_mode(gx_video_t *gx)
|
||||
{
|
||||
unsigned width, height;
|
||||
char desc[64] = {0};
|
||||
|
||||
if (!gx->framebuf[0])
|
||||
{
|
||||
@ -633,7 +634,7 @@ static void setup_video_mode(gx_video_t *gx)
|
||||
gx->orientation = ORIENTATION_NORMAL;
|
||||
OSInitThreadQueue(&g_video_cond);
|
||||
|
||||
gx_get_video_output_size(gx, &width, &height);
|
||||
gx_get_video_output_size(gx, &width, &height, desc, sizeof(desc));
|
||||
gx_set_video_mode(gx, width, height, true);
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ static void network_set_texture_frame(void *data,
|
||||
}
|
||||
|
||||
static void network_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height) { }
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len) { }
|
||||
static void network_get_video_output_prev(void *data) { }
|
||||
static void network_get_video_output_next(void *data) { }
|
||||
|
||||
|
@ -543,7 +543,7 @@ static void ps2_set_filtering(void *data, unsigned index, bool smooth, bool ctx_
|
||||
}
|
||||
|
||||
static void ps2_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
@ -557,6 +557,8 @@ static void ps2_get_video_output_size(void *data,
|
||||
global->console.screen.resolutions.current.id].width;
|
||||
*height = rm_mode_table[
|
||||
global->console.screen.resolutions.current.id].height;
|
||||
|
||||
strlcpy(desc, rm_mode_table[global->console.screen.resolutions.current.id].desc, desc_len);
|
||||
}
|
||||
|
||||
static void ps2_get_video_output_prev(void *data)
|
||||
|
@ -516,7 +516,7 @@ static void sixel_set_texture_frame(void *data,
|
||||
}
|
||||
|
||||
static void sixel_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height) { }
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len) { }
|
||||
static void sixel_get_video_output_prev(void *data) { }
|
||||
static void sixel_get_video_output_next(void *data) { }
|
||||
static void sixel_set_video_mode(void *data, unsigned width, unsigned height,
|
||||
|
@ -2590,14 +2590,14 @@ static uint32_t vulkan_get_flags(void *data)
|
||||
}
|
||||
|
||||
static void vulkan_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
vk_t *vk = (vk_t*)data;
|
||||
if (!vk || !vk->ctx_driver || !vk->ctx_driver->get_video_output_size)
|
||||
return;
|
||||
vk->ctx_driver->get_video_output_size(
|
||||
vk->ctx_data,
|
||||
width, height);
|
||||
width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void vulkan_get_video_output_prev(void *data)
|
||||
|
@ -312,7 +312,7 @@ static bool gfx_ctx_ps3_bind_api(void *data,
|
||||
}
|
||||
|
||||
static void gfx_ctx_ps3_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
|
@ -249,7 +249,7 @@ static bool gfx_ctx_psl1ght_bind_api(void *data,
|
||||
}
|
||||
|
||||
static void gfx_ctx_psl1ght_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
|
@ -345,9 +345,9 @@ static uint32_t gfx_ctx_w_vk_get_flags(void *data)
|
||||
static void gfx_ctx_w_vk_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
static void gfx_ctx_w_vk_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gfx_ctx_w_vk_get_video_output_prev(void *data) { }
|
||||
|
@ -836,9 +836,9 @@ static void gfx_ctx_wgl_set_flags(void *data, uint32_t flags)
|
||||
}
|
||||
|
||||
static void gfx_ctx_wgl_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
win32_get_video_output_size(width, height);
|
||||
win32_get_video_output_size(width, height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void gfx_ctx_wgl_get_video_output_prev(void *data) { }
|
||||
|
@ -544,7 +544,7 @@ typedef struct gfx_ctx_driver
|
||||
|
||||
float (*get_refresh_rate)(void*);
|
||||
|
||||
void (*get_video_output_size)(void*, unsigned*, unsigned*);
|
||||
void (*get_video_output_size)(void*, unsigned*, unsigned*, char *, size_t);
|
||||
|
||||
void (*get_video_output_prev)(void*);
|
||||
|
||||
@ -687,7 +687,7 @@ typedef struct video_poke_interface
|
||||
float (*get_refresh_rate)(void *data);
|
||||
void (*set_filtering)(void *data, unsigned index, bool smooth, bool ctx_scaling);
|
||||
void (*get_video_output_size)(void *data,
|
||||
unsigned *width, unsigned *height);
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len);
|
||||
|
||||
/* Move index to previous resolution */
|
||||
void (*get_video_output_prev)(void *data);
|
||||
@ -922,7 +922,7 @@ bool video_driver_set_video_mode(unsigned width,
|
||||
unsigned height, bool fullscreen);
|
||||
|
||||
bool video_driver_get_video_output_size(
|
||||
unsigned *width, unsigned *height);
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len);
|
||||
|
||||
void video_driver_set_texture_enable(bool enable, bool full_screen);
|
||||
|
||||
|
@ -1012,7 +1012,7 @@ static void thread_set_hdr_expand_gamut(void *data, bool expand_gamut)
|
||||
}
|
||||
|
||||
static void thread_get_video_output_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
thread_video_t *thr = (thread_video_t*)data;
|
||||
|
||||
@ -1022,7 +1022,7 @@ static void thread_get_video_output_size(void *data,
|
||||
if (thr->poke && thr->poke->get_video_output_size)
|
||||
thr->poke->get_video_output_size(thr->driver_data,
|
||||
width,
|
||||
height);
|
||||
height, desc, desc_len);
|
||||
}
|
||||
|
||||
static void thread_get_video_output_prev(void *data)
|
||||
|
@ -1036,13 +1036,13 @@ static void menu_action_setting_disp_set_label_menu_video_resolution(
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
unsigned width = 0, height = 0;
|
||||
|
||||
char desc[64] = {0};
|
||||
*w = 19;
|
||||
*s = '\0';
|
||||
|
||||
strlcpy(s2, path, len2);
|
||||
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
|
||||
{
|
||||
#ifdef GEKKO
|
||||
if (width == 0 || height == 0)
|
||||
@ -1050,6 +1050,9 @@ static void menu_action_setting_disp_set_label_menu_video_resolution(
|
||||
else
|
||||
#endif
|
||||
snprintf(s, len, "%ux%u", width, height);
|
||||
/* Add video output description if exists */
|
||||
if (!string_is_empty(desc))
|
||||
snprintf(s, len, "%s - %s", s, desc);
|
||||
}
|
||||
else
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
|
||||
|
@ -6760,8 +6760,9 @@ static int action_ok_video_resolution(const char *path,
|
||||
#if defined(GEKKO) || defined(PS2) || !defined(__PSL1GHT__) && defined(__PS3__)
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
char desc[64] = {0};
|
||||
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
|
||||
@ -6777,8 +6778,12 @@ static int action_ok_video_resolution(const char *path,
|
||||
else
|
||||
#endif
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Applying: %dx%d\n START to reset",
|
||||
"Applying: %dx%d",
|
||||
width, height);
|
||||
/* Add description of resolution */
|
||||
if (!string_is_empty(desc))
|
||||
snprintf(msg, sizeof(msg), "%s - %s", msg, desc);
|
||||
snprintf(msg, sizeof(msg), "%s\n START to reset", msg);
|
||||
runloop_msg_queue_push(msg, 1, 100, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
|
@ -488,12 +488,13 @@ static int action_start_video_resolution(
|
||||
{
|
||||
#if defined(GEKKO) || defined(PS2) || !defined(__PSL1GHT__) && !defined(__PS3__)
|
||||
unsigned width = 0, height = 0;
|
||||
char desc[64] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* Reset the resolution id to zero */
|
||||
global->console.screen.resolutions.current.id = 0;
|
||||
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
|
||||
@ -510,6 +511,10 @@ static int action_start_video_resolution(
|
||||
#endif
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Resetting to: %dx%d", width, height);
|
||||
/* Add description of resolution */
|
||||
if (!string_is_empty(desc))
|
||||
snprintf(msg, sizeof(msg), "%s - %s", msg, desc);
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
#endif
|
||||
|
15
retroarch.c
15
retroarch.c
@ -7194,13 +7194,14 @@ bool command_event(enum event_command cmd, void *data)
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_SET_PER_GAME_RESOLUTION:
|
||||
#if defined(GEKKO) || defined(PS2)
|
||||
#if defined(GEKKO)
|
||||
{
|
||||
unsigned width = 0, height = 0;
|
||||
char desc[64] = {0};
|
||||
|
||||
command_event(CMD_EVENT_VIDEO_SET_ASPECT_RATIO, NULL);
|
||||
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
|
||||
{
|
||||
char msg[128] = {0};
|
||||
|
||||
@ -7210,9 +7211,15 @@ bool command_event(enum event_command cmd, void *data)
|
||||
snprintf(msg, sizeof(msg), "%s: DEFAULT",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION));
|
||||
else
|
||||
{
|
||||
snprintf(msg, sizeof(msg),"%s: %dx%d",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION),
|
||||
width, height);
|
||||
/* Add description of resolution */
|
||||
if (!string_is_empty(desc))
|
||||
snprintf(msg, sizeof(msg), "%s - %s", msg, desc);
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
}
|
||||
@ -18454,13 +18461,13 @@ bool video_driver_set_video_mode(unsigned width,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
bool video_driver_get_video_output_size(unsigned *width, unsigned *height, char *desc, size_t desc_len)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
if (!p_rarch->video_driver_poke || !p_rarch->video_driver_poke->get_video_output_size)
|
||||
return false;
|
||||
p_rarch->video_driver_poke->get_video_output_size(p_rarch->video_driver_data,
|
||||
width, height);
|
||||
width, height, desc, desc_len);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user