mirror of
https://github.com/libretro/RetroArch
synced 2024-07-01 07:54:27 +00:00
Compare commits
9 Commits
929fa20348
...
8aa5fd2658
Author | SHA1 | Date | |
---|---|---|---|
|
8aa5fd2658 | ||
|
c570a6a20a | ||
|
286d65b42e | ||
|
00add4bb37 | ||
|
2805694378 | ||
|
05faba73e3 | ||
|
e7c6d1df84 | ||
|
cc92ac7577 | ||
|
27f337d5a0 |
|
@ -69,6 +69,14 @@
|
||||||
#define DEFAULT_ASPECT_RATIO 1.3333f
|
#define DEFAULT_ASPECT_RATIO 1.3333f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_VIEWPORT_BIAS_X 0.5
|
||||||
|
#define DEFAULT_VIEWPORT_BIAS_Y 0.5
|
||||||
|
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
#define DEFAULT_VIEWPORT_BIAS_PORTRAIT_X 0.5
|
||||||
|
#define DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y 0.0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GEKKO)
|
#if defined(GEKKO)
|
||||||
#define DEFAULT_MOUSE_SCALE 1
|
#define DEFAULT_MOUSE_SCALE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1769,6 +1769,8 @@ static struct config_bool_setting *populate_settings_bool(
|
||||||
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
|
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
|
||||||
SETTING_BOOL("cloud_sync_enable", &settings->bools.cloud_sync_enable, true, false, false);
|
SETTING_BOOL("cloud_sync_enable", &settings->bools.cloud_sync_enable, true, false, false);
|
||||||
SETTING_BOOL("cloud_sync_destructive", &settings->bools.cloud_sync_destructive, true, false, false);
|
SETTING_BOOL("cloud_sync_destructive", &settings->bools.cloud_sync_destructive, true, false, false);
|
||||||
|
SETTING_BOOL("cloud_sync_sync_saves", &settings->bools.cloud_sync_sync_saves, true, true, false);
|
||||||
|
SETTING_BOOL("cloud_sync_sync_configs", &settings->bools.cloud_sync_sync_configs, true, true, false);
|
||||||
SETTING_BOOL("discord_allow", &settings->bools.discord_enable, true, false, false);
|
SETTING_BOOL("discord_allow", &settings->bools.discord_enable, true, false, false);
|
||||||
#ifdef HAVE_MIST
|
#ifdef HAVE_MIST
|
||||||
SETTING_BOOL("steam_rich_presence_enable", &settings->bools.steam_rich_presence_enable, true, false, false);
|
SETTING_BOOL("steam_rich_presence_enable", &settings->bools.steam_rich_presence_enable, true, false, false);
|
||||||
|
@ -2255,6 +2257,12 @@ static struct config_float_setting *populate_settings_float(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false);
|
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false);
|
||||||
|
SETTING_FLOAT("video_viewport_bias_x", &settings->floats.video_viewport_bias_x, true, DEFAULT_VIEWPORT_BIAS_X, false);
|
||||||
|
SETTING_FLOAT("video_viewport_bias_y", &settings->floats.video_viewport_bias_y, true, DEFAULT_VIEWPORT_BIAS_Y, false);
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
SETTING_FLOAT("video_viewport_bias_portrait_x", &settings->floats.video_viewport_bias_portrait_x, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_X, false);
|
||||||
|
SETTING_FLOAT("video_viewport_bias_portrait_y", &settings->floats.video_viewport_bias_portrait_y, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y, false);
|
||||||
|
#endif
|
||||||
SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false);
|
SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false);
|
||||||
SETTING_FLOAT("video_autoswitch_pal_threshold", &settings->floats.video_autoswitch_pal_threshold, true, DEFAULT_AUTOSWITCH_PAL_THRESHOLD, false);
|
SETTING_FLOAT("video_autoswitch_pal_threshold", &settings->floats.video_autoswitch_pal_threshold, true, DEFAULT_AUTOSWITCH_PAL_THRESHOLD, false);
|
||||||
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, DEFAULT_CRT_REFRESH_RATE, false);
|
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, DEFAULT_CRT_REFRESH_RATE, false);
|
||||||
|
|
|
@ -375,6 +375,12 @@ typedef struct settings
|
||||||
{
|
{
|
||||||
float placeholder;
|
float placeholder;
|
||||||
float video_aspect_ratio;
|
float video_aspect_ratio;
|
||||||
|
float video_viewport_bias_x;
|
||||||
|
float video_viewport_bias_y;
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
float video_viewport_bias_portrait_x;
|
||||||
|
float video_viewport_bias_portrait_y;
|
||||||
|
#endif
|
||||||
float video_refresh_rate;
|
float video_refresh_rate;
|
||||||
float video_autoswitch_pal_threshold;
|
float video_autoswitch_pal_threshold;
|
||||||
float crt_video_refresh_rate;
|
float crt_video_refresh_rate;
|
||||||
|
@ -954,6 +960,8 @@ typedef struct settings
|
||||||
/* Cloud Sync */
|
/* Cloud Sync */
|
||||||
bool cloud_sync_enable;
|
bool cloud_sync_enable;
|
||||||
bool cloud_sync_destructive;
|
bool cloud_sync_destructive;
|
||||||
|
bool cloud_sync_sync_saves;
|
||||||
|
bool cloud_sync_sync_configs;
|
||||||
|
|
||||||
/* Misc. */
|
/* Misc. */
|
||||||
bool discord_enable;
|
bool discord_enable;
|
||||||
|
|
|
@ -1316,74 +1316,35 @@ void d3d9_calculate_rect(d3d9_video_t *d3d,
|
||||||
{
|
{
|
||||||
float device_aspect = (float)*width / *height;
|
float device_aspect = (float)*width / *height;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
|
struct video_viewport vp;
|
||||||
|
|
||||||
video_driver_get_size(width, height);
|
video_driver_get_size(width, height);
|
||||||
|
|
||||||
*x = 0;
|
vp.x = 0;
|
||||||
*y = 0;
|
vp.y = 0;
|
||||||
|
vp.width = *width;
|
||||||
|
vp.height = *height;
|
||||||
|
vp.full_width = *width;
|
||||||
|
vp.full_height = *height;
|
||||||
|
|
||||||
if (scale_integer && !force_full)
|
if (video_scale_integer && !force_full)
|
||||||
{
|
{
|
||||||
struct video_viewport vp;
|
|
||||||
|
|
||||||
vp.x = 0;
|
|
||||||
vp.y = 0;
|
|
||||||
vp.width = 0;
|
|
||||||
vp.height = 0;
|
|
||||||
vp.full_width = 0;
|
|
||||||
vp.full_height = 0;
|
|
||||||
|
|
||||||
video_viewport_get_scaled_integer(&vp,
|
video_viewport_get_scaled_integer(&vp,
|
||||||
*width,
|
*width,
|
||||||
*height,
|
*height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
d3d->keep_aspect);
|
d3d->keep_aspect,
|
||||||
|
true);
|
||||||
*x = vp.x;
|
|
||||||
*y = vp.y;
|
|
||||||
*width = vp.width;
|
|
||||||
*height = vp.height;
|
|
||||||
}
|
}
|
||||||
else if (d3d->keep_aspect && !force_full)
|
else if (d3d->keep_aspect && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect(&vp, *width, *height, true);
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
|
||||||
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
*x = (int)(roundf(*width * (0.5f - delta)));
|
|
||||||
*width = (unsigned)(roundf(2.0f * (*width) * delta));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
*y = (int)(roundf(*height * (0.5f - delta)));
|
|
||||||
*height = (unsigned)(roundf(2.0f * (*height) * delta));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*x = vp.x;
|
||||||
|
*y = vp.y;
|
||||||
|
*width = vp.width;
|
||||||
|
*height = vp.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void d3d9_set_rotation(void *data, unsigned rot)
|
void d3d9_set_rotation(void *data, unsigned rot)
|
||||||
|
|
|
@ -987,6 +987,8 @@ static LRESULT CALLBACK wnd_proc_common(
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
if (GetKeyState(VK_SCROLL) & 0x81)
|
if (GetKeyState(VK_SCROLL) & 0x81)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 0x81)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
|
@ -1111,6 +1113,8 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
if (GetKeyState(VK_SCROLL) & 0x81)
|
if (GetKeyState(VK_SCROLL) & 0x81)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 0x81)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
|
@ -1369,6 +1373,8 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
if (GetKeyState(VK_SCROLL) & 0x81)
|
if (GetKeyState(VK_SCROLL) & 0x81)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 0x81)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
|
|
|
@ -595,6 +595,8 @@ static void x11_handle_key_event(unsigned keycode, XEvent *event,
|
||||||
mod |= RETROKMOD_ALT;
|
mod |= RETROKMOD_ALT;
|
||||||
if (state & Mod2Mask)
|
if (state & Mod2Mask)
|
||||||
mod |= RETROKMOD_NUMLOCK;
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
|
if (state & Mod3Mask)
|
||||||
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
if (state & Mod4Mask)
|
if (state & Mod4Mask)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
|
@ -669,6 +671,8 @@ bool x11_alive(void *data)
|
||||||
case 5: /* Scroll down */
|
case 5: /* Scroll down */
|
||||||
case 6: /* Scroll wheel left */
|
case 6: /* Scroll wheel left */
|
||||||
case 7: /* Scroll wheel right */
|
case 7: /* Scroll wheel right */
|
||||||
|
case 8: /* Mouse button 4 */
|
||||||
|
case 9: /* Mouse button 5 */
|
||||||
x_input_poll_wheel(&event.xbutton, true);
|
x_input_poll_wheel(&event.xbutton, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -683,6 +687,13 @@ bool x11_alive(void *data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
|
switch (event.xbutton.button)
|
||||||
|
{
|
||||||
|
case 8: /* Mouse button 4 - not handled as click */
|
||||||
|
case 9: /* Mouse button 5 - not handled as click */
|
||||||
|
x_input_poll_wheel(&event.xbutton, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
|
|
|
@ -762,52 +762,14 @@ static void ctr_update_viewport(
|
||||||
|
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
{
|
{
|
||||||
|
/* TODO: does CTR use top-left or bottom-left coordinates? assuming top-left. */
|
||||||
video_viewport_get_scaled_integer(&ctr->vp, ctr->vp.full_width,
|
video_viewport_get_scaled_integer(&ctr->vp, ctr->vp.full_width,
|
||||||
ctr->vp.full_height, desired_aspect, ctr->keep_aspect);
|
ctr->vp.full_height, desired_aspect, ctr->keep_aspect,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
else if (ctr->keep_aspect)
|
else if (ctr->keep_aspect)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MENU)
|
video_viewport_get_scaled_aspect(&ctr->vp, width, height, true);
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
x = custom_vp_x;
|
|
||||||
y = custom_vp_y;
|
|
||||||
width = custom_vp_width;
|
|
||||||
height = custom_vp_height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
float device_aspect = ((float)ctr->vp.full_width) / ctr->vp.full_height;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(width * (0.5f - delta));
|
|
||||||
width = (unsigned)roundf(2.0f * width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(height * (0.5f - delta));
|
|
||||||
height = (unsigned)roundf(2.0f * height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctr->vp.x = x;
|
|
||||||
ctr->vp.y = y;
|
|
||||||
ctr->vp.width = width;
|
|
||||||
ctr->vp.height = height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1164,74 +1164,34 @@ static void d3d8_calculate_rect(void *data,
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||||
|
struct video_viewport vp;
|
||||||
|
|
||||||
video_driver_get_size(width, height);
|
video_driver_get_size(width, height);
|
||||||
|
|
||||||
*x = 0;
|
vp.x = 0;
|
||||||
*y = 0;
|
vp.y = 0;
|
||||||
|
vp.width = width;
|
||||||
|
vp.height = height;
|
||||||
|
vp.full_width = width;
|
||||||
|
vp.full_height = height;
|
||||||
|
|
||||||
if (video_scale_integer && !force_full)
|
if (video_scale_integer && !force_full)
|
||||||
{
|
{
|
||||||
struct video_viewport vp;
|
|
||||||
|
|
||||||
vp.x = 0;
|
|
||||||
vp.y = 0;
|
|
||||||
vp.width = 0;
|
|
||||||
vp.height = 0;
|
|
||||||
vp.full_width = 0;
|
|
||||||
vp.full_height = 0;
|
|
||||||
|
|
||||||
video_viewport_get_scaled_integer(&vp,
|
video_viewport_get_scaled_integer(&vp,
|
||||||
*width,
|
*width,
|
||||||
*height,
|
*height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
d3d->keep_aspect);
|
d3d->keep_aspect,
|
||||||
|
true);
|
||||||
*x = vp.x;
|
|
||||||
*y = vp.y;
|
|
||||||
*width = vp.width;
|
|
||||||
*height = vp.height;
|
|
||||||
}
|
}
|
||||||
else if (d3d->keep_aspect && !force_full)
|
else if (d3d->keep_aspect && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect(vp, viewport_width, viewport_height, true);
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
*x = (int)(roundf(*width * (0.5f - delta)));
|
|
||||||
*width = (unsigned)(roundf(2.0f * (*width) * delta));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
*y = (int)(roundf(*height * (0.5f - delta)));
|
|
||||||
*height = (unsigned)(roundf(2.0f * (*height) * delta));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*x = vp.x;
|
||||||
|
*y = vp.y;
|
||||||
|
*width = vp.width;
|
||||||
|
*height = vp.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d8_set_viewport(void *data,
|
static void d3d8_set_viewport(void *data,
|
||||||
|
|
|
@ -1227,54 +1227,16 @@ static void gl1_set_viewport(gl1_t *gl1,
|
||||||
video_viewport_get_scaled_integer(&gl1->vp,
|
video_viewport_get_scaled_integer(&gl1->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
gl1->flags & GL1_FLAG_KEEP_ASPECT);
|
gl1->flags & GL1_FLAG_KEEP_ASPECT, false);
|
||||||
viewport_width = gl1->vp.width;
|
viewport_width = gl1->vp.width;
|
||||||
viewport_height = gl1->vp.height;
|
viewport_height = gl1->vp.height;
|
||||||
}
|
}
|
||||||
else if ((gl1->flags & GL1_FLAG_KEEP_ASPECT) && !force_full)
|
else if ((gl1->flags & GL1_FLAG_KEEP_ASPECT) && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
gl1->vp.full_height = gl1->video_height;
|
||||||
|
video_viewport_get_scaled_aspect2(&gl1->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
|
||||||
#if defined(HAVE_MENU)
|
viewport_width = gl1->vp.width;
|
||||||
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
viewport_height = gl1->vp.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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl1->vp.x = x;
|
|
||||||
gl1->vp.y = y;
|
|
||||||
gl1->vp.width = viewport_width;
|
|
||||||
gl1->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1283,12 +1245,6 @@ static void gl1_set_viewport(gl1_t *gl1,
|
||||||
gl1->vp.height = viewport_height;
|
gl1->vp.height = viewport_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RARCH_MOBILE)
|
|
||||||
/* In portrait mode, we want viewport to gravitate to top of screen. */
|
|
||||||
if (device_aspect < 1.0f)
|
|
||||||
gl1->vp.y *= 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glViewport(gl1->vp.x, gl1->vp.y, gl1->vp.width, gl1->vp.height);
|
glViewport(gl1->vp.x, gl1->vp.y, gl1->vp.width, gl1->vp.height);
|
||||||
gl1_set_projection(gl1, &gl1_default_ortho, allow_rotate);
|
gl1_set_projection(gl1, &gl1_default_ortho, allow_rotate);
|
||||||
|
|
||||||
|
|
|
@ -1273,11 +1273,8 @@ static void gl2_set_viewport(gl2_t *gl,
|
||||||
bool force_full, bool allow_rotate)
|
bool force_full, bool allow_rotate)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
unsigned height = gl->video_height;
|
float device_aspect = (float) viewport_width / (float)viewport_height;
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
float device_aspect = (float)viewport_width / viewport_height;
|
|
||||||
|
|
||||||
if (gl->ctx_driver->translate_aspect)
|
if (gl->ctx_driver->translate_aspect)
|
||||||
device_aspect = gl->ctx_driver->translate_aspect(
|
device_aspect = gl->ctx_driver->translate_aspect(
|
||||||
gl->ctx_data, viewport_width, viewport_height);
|
gl->ctx_data, viewport_width, viewport_height);
|
||||||
|
@ -1287,54 +1284,17 @@ static void gl2_set_viewport(gl2_t *gl,
|
||||||
video_viewport_get_scaled_integer(&gl->vp,
|
video_viewport_get_scaled_integer(&gl->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
(gl->flags & GL2_FLAG_KEEP_ASPECT) ? true : false);
|
(gl->flags & GL2_FLAG_KEEP_ASPECT) ? true : false,
|
||||||
|
false);
|
||||||
viewport_width = gl->vp.width;
|
viewport_width = gl->vp.width;
|
||||||
viewport_height = gl->vp.height;
|
viewport_height = gl->vp.height;
|
||||||
}
|
}
|
||||||
else if ((gl->flags & GL2_FLAG_KEEP_ASPECT) && !force_full)
|
else if ((gl->flags & GL2_FLAG_KEEP_ASPECT) && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
gl->vp.full_height = gl->video_height;
|
||||||
|
video_viewport_get_scaled_aspect2(&gl->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
|
||||||
#if defined(HAVE_MENU)
|
viewport_width = gl->vp.width;
|
||||||
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
viewport_height = gl->vp.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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->vp.x = x;
|
|
||||||
gl->vp.y = y;
|
|
||||||
gl->vp.width = viewport_width;
|
|
||||||
gl->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1343,12 +1303,6 @@ static void gl2_set_viewport(gl2_t *gl,
|
||||||
gl->vp.height = viewport_height;
|
gl->vp.height = viewport_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RARCH_MOBILE)
|
|
||||||
/* In portrait mode, we want viewport to gravitate to top of screen. */
|
|
||||||
if (device_aspect < 1.0f)
|
|
||||||
gl->vp.y *= 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
|
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
|
||||||
gl2_set_projection(gl, &default_ortho, allow_rotate);
|
gl2_set_projection(gl, &default_ortho, allow_rotate);
|
||||||
|
|
||||||
|
|
|
@ -1385,7 +1385,6 @@ static void gl3_set_viewport(gl3_t *gl,
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
float device_aspect = (float)viewport_width / viewport_height;
|
float device_aspect = (float)viewport_width / viewport_height;
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
|
||||||
|
|
||||||
if (gl->ctx_driver->translate_aspect)
|
if (gl->ctx_driver->translate_aspect)
|
||||||
device_aspect = gl->ctx_driver->translate_aspect(
|
device_aspect = gl->ctx_driver->translate_aspect(
|
||||||
|
@ -1396,54 +1395,17 @@ static void gl3_set_viewport(gl3_t *gl,
|
||||||
video_viewport_get_scaled_integer(&gl->vp,
|
video_viewport_get_scaled_integer(&gl->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
(gl->flags & GL3_FLAG_KEEP_ASPECT) ? true : false);
|
(gl->flags & GL3_FLAG_KEEP_ASPECT) ? true : false,
|
||||||
|
false);
|
||||||
viewport_width = gl->vp.width;
|
viewport_width = gl->vp.width;
|
||||||
viewport_height = gl->vp.height;
|
viewport_height = gl->vp.height;
|
||||||
}
|
}
|
||||||
else if ((gl->flags & GL3_FLAG_KEEP_ASPECT) && !force_full)
|
else if ((gl->flags & GL3_FLAG_KEEP_ASPECT) && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
gl->vp.full_height = gl->video_height;
|
||||||
|
video_viewport_get_scaled_aspect2(&gl->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
|
||||||
#if defined(HAVE_MENU)
|
viewport_width = gl->vp.width;
|
||||||
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
viewport_height = gl->vp.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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->vp.x = x;
|
|
||||||
gl->vp.y = y;
|
|
||||||
gl->vp.width = viewport_width;
|
|
||||||
gl->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1452,12 +1414,6 @@ static void gl3_set_viewport(gl3_t *gl,
|
||||||
gl->vp.height = viewport_height;
|
gl->vp.height = viewport_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RARCH_MOBILE)
|
|
||||||
/* In portrait mode, we want viewport to gravitate to top of screen. */
|
|
||||||
if (device_aspect < 1.0f)
|
|
||||||
gl->vp.y *= 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
|
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
|
||||||
gl3_set_projection(gl, &gl3_default_ortho, allow_rotate);
|
gl3_set_projection(gl, &gl3_default_ortho, allow_rotate);
|
||||||
|
|
||||||
|
|
|
@ -923,69 +923,22 @@ static void gx2_set_projection(wiiu_video_t *wiiu)
|
||||||
|
|
||||||
static void gx2_update_viewport(wiiu_video_t *wiiu)
|
static void gx2_update_viewport(wiiu_video_t *wiiu)
|
||||||
{
|
{
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
unsigned viewport_width = wiiu->color_buffer.surface.width;
|
unsigned viewport_width = wiiu->color_buffer.surface.width;
|
||||||
unsigned viewport_height = wiiu->color_buffer.surface.height;
|
unsigned viewport_height = wiiu->color_buffer.surface.height;
|
||||||
float device_aspect = (float)viewport_width / viewport_height;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
|
||||||
|
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&wiiu->vp,
|
video_viewport_get_scaled_integer(&wiiu->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(), wiiu->keep_aspect);
|
video_driver_get_aspect_ratio(), wiiu->keep_aspect, true);
|
||||||
viewport_width = wiiu->vp.width;
|
viewport_width = wiiu->vp.width;
|
||||||
viewport_height = wiiu->vp.height;
|
viewport_height = wiiu->vp.height;
|
||||||
}
|
}
|
||||||
else if (wiiu->keep_aspect)
|
else if (wiiu->keep_aspect)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect(&wiiu->vp, viewport_width, viewport_height, true);
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
|
||||||
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wiiu->vp.x = x;
|
|
||||||
wiiu->vp.y = y;
|
|
||||||
wiiu->vp.width = viewport_width;
|
|
||||||
wiiu->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1011,58 +1011,23 @@ static void gx_resize(gx_video_t *gx,
|
||||||
/* Ignore this for custom resolutions */
|
/* Ignore this for custom resolutions */
|
||||||
if (gx->keep_aspect && gx_mode.efbHeight >= 192)
|
if (gx->keep_aspect && gx_mode.efbHeight >= 192)
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
float device_aspect = CONF_GetAspectRatio() == CONF_ASPECT_4_3 ?
|
||||||
|
4.0 / 3.0 : 16.0 / 9.0;
|
||||||
|
#else
|
||||||
|
float device_aspect = 4.0 / 3.0;
|
||||||
|
#endif
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
float desired_aspect = video_driver_get_aspect_ratio();
|
||||||
if (desired_aspect == 0.0)
|
if (desired_aspect == 0.0)
|
||||||
desired_aspect = 1.0;
|
desired_aspect = 1.0;
|
||||||
if ( (gx->orientation == ORIENTATION_VERTICAL)
|
if ( (gx->orientation == ORIENTATION_VERTICAL)
|
||||||
|| (gx->orientation == ORIENTATION_FLIPPED_ROTATED))
|
|| (gx->orientation == ORIENTATION_FLIPPED_ROTATED))
|
||||||
desired_aspect = 1.0 / desired_aspect;
|
desired_aspect = 1.0 / desired_aspect;
|
||||||
|
video_viewport_get_scaled_aspect2(&gx->vp, width, height, true, device_aspect, desired_aspect);
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
x = gx->vp.x;
|
||||||
{
|
y = gx->vp.y;
|
||||||
video_viewport_t *custom_vp = &settings->video_viewport_custom;
|
width = gx->vp.width;
|
||||||
|
height = gx->vp.height;
|
||||||
if (!custom_vp->width || !custom_vp->height)
|
|
||||||
{
|
|
||||||
custom_vp->x = 0;
|
|
||||||
custom_vp->y = 0;
|
|
||||||
custom_vp->width = gx->vp.full_width;
|
|
||||||
custom_vp->height = gx->vp.full_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
x = custom_vp->x;
|
|
||||||
y = custom_vp->y;
|
|
||||||
width = custom_vp->width;
|
|
||||||
height = custom_vp->height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
#ifdef HW_RVL
|
|
||||||
float device_aspect = CONF_GetAspectRatio() == CONF_ASPECT_4_3 ?
|
|
||||||
4.0 / 3.0 : 16.0 / 9.0;
|
|
||||||
#else
|
|
||||||
float device_aspect = 4.0 / 3.0;
|
|
||||||
#endif
|
|
||||||
if (fabs(device_aspect - desired_aspect) < 0.0001)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect ratio
|
|
||||||
* are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal. */
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
|
||||||
x = (unsigned)(width * (0.5 - delta));
|
|
||||||
width = (unsigned)(2.0 * width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5;
|
|
||||||
y = (unsigned)(height * (0.5 - delta));
|
|
||||||
height = (unsigned)(2.0 * height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overscan correction */
|
/* Overscan correction */
|
||||||
|
|
|
@ -257,54 +257,15 @@ static void psp_update_viewport(psp1_video_t* psp,
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&psp->vp, SCEGU_SCR_WIDTH,
|
video_viewport_get_scaled_integer(&psp->vp, SCEGU_SCR_WIDTH,
|
||||||
SCEGU_SCR_HEIGHT, video_driver_get_aspect_ratio(), psp->keep_aspect);
|
SCEGU_SCR_HEIGHT, video_driver_get_aspect_ratio(), psp->keep_aspect, true);
|
||||||
width = psp->vp.width;
|
width = psp->vp.width;
|
||||||
height = psp->vp.height;
|
height = psp->vp.height;
|
||||||
}
|
}
|
||||||
else if (psp->keep_aspect)
|
else if (psp->keep_aspect)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MENU)
|
video_viewport_get_scaled_aspect(&psp->vp, width, height, true);
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
width = psp->vp.width;
|
||||||
{
|
height = psp->vp.height;
|
||||||
x = video_info->custom_vp_x;
|
|
||||||
y = video_info->custom_vp_y;
|
|
||||||
width = video_info->custom_vp_width;
|
|
||||||
height = video_info->custom_vp_height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
|
||||||
|
|
||||||
if ( (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
|| (fabsf((16.0/9.0) - desired_aspect) < 0.02f))
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(width * (0.5f - delta));
|
|
||||||
width = (unsigned)roundf(2.0f * width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(height * (0.5f - delta));
|
|
||||||
height = (unsigned)roundf(2.0f * height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
psp->vp.x = x;
|
|
||||||
psp->vp.y = y;
|
|
||||||
psp->vp.width = width;
|
|
||||||
psp->vp.height = height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -996,55 +996,16 @@ static void rsx_set_viewport(void *data, unsigned viewport_width,
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&rsx->vp,
|
video_viewport_get_scaled_integer(&rsx->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(), rsx->keep_aspect);
|
video_driver_get_aspect_ratio(), rsx->keep_aspect,
|
||||||
viewport_width = rsx->vp.width;
|
true);
|
||||||
viewport_height = rsx->vp.height;
|
viewport_width = rsx->vp.width;
|
||||||
|
viewport_height = rsx->vp.height;
|
||||||
}
|
}
|
||||||
else if (rsx->keep_aspect && !force_full)
|
else if (rsx->keep_aspect && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect(&rsx->vp, viewport_width, viewport_height, true);
|
||||||
|
viewport_width = rsx->vp.width;
|
||||||
#if defined(HAVE_MENU)
|
viewport_height = rsx->vp.height;
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rsx->vp.x = x;
|
|
||||||
rsx->vp.y = y;
|
|
||||||
rsx->vp.width = viewport_width;
|
|
||||||
rsx->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1493,7 +1454,8 @@ static void rsx_update_viewport(rsx_t* rsx)
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&rsx->vp, viewport_width,
|
video_viewport_get_scaled_integer(&rsx->vp, viewport_width,
|
||||||
viewport_height, video_driver_get_aspect_ratio(), rsx->keep_aspect);
|
viewport_height, video_driver_get_aspect_ratio(), rsx->keep_aspect,
|
||||||
|
true);
|
||||||
viewport_width = rsx->vp.width;
|
viewport_width = rsx->vp.width;
|
||||||
viewport_height = rsx->vp.height;
|
viewport_height = rsx->vp.height;
|
||||||
}
|
}
|
||||||
|
@ -1525,16 +1487,18 @@ static void rsx_update_viewport(rsx_t* rsx)
|
||||||
}
|
}
|
||||||
else if (device_aspect > desired_aspect)
|
else if (device_aspect > desired_aspect)
|
||||||
{
|
{
|
||||||
|
float viewport_bias = settings->floats.video_viewport_bias_x;
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
delta = (desired_aspect / device_aspect - 1.0f)
|
||||||
/ 2.0f + 0.5f;
|
/ 2.0f + 0.5f;
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
x = (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
float viewport_bias = 1.0 - settings->floats.video_viewport_bias_y;
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
delta = (device_aspect / desired_aspect - 1.0f)
|
||||||
/ 2.0f + 0.5f;
|
/ 2.0f + 0.5f;
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
y = (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,6 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
||||||
int win_w, win_h;
|
int win_w, win_h;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
|
||||||
|
|
||||||
SDL_GetWindowSize(vid->window, &win_w, &win_h);
|
SDL_GetWindowSize(vid->window, &win_w, &win_h);
|
||||||
|
|
||||||
|
@ -243,39 +242,10 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
video_viewport_get_scaled_integer(&vid->vp,
|
video_viewport_get_scaled_integer(&vid->vp,
|
||||||
win_w, win_h, video_driver_get_aspect_ratio(),
|
win_w, win_h, video_driver_get_aspect_ratio(),
|
||||||
vid->video.force_aspect);
|
vid->video.force_aspect, true);
|
||||||
else if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
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)
|
else if (vid->video.force_aspect)
|
||||||
{
|
{
|
||||||
float delta;
|
video_viewport_get_scaled_aspect(&vid->vp, win_w, win_h, true);
|
||||||
float device_aspect = (float)win_w / win_h;
|
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect ratio are
|
|
||||||
* sufficiently equal (floating point stuff), assume they are
|
|
||||||
* actually equal. */
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
vid->vp.x = (int)roundf(win_w * (0.5f - delta));
|
|
||||||
vid->vp.width = (unsigned)roundf(2.0f * win_w * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
vid->vp.y = (int)roundf(win_h * (0.5f - delta));
|
|
||||||
vid->vp.height = (unsigned)roundf(2.0f * win_h * delta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vid->flags &= ~SDL2_FLAG_SHOULD_RESIZE;
|
vid->flags &= ~SDL2_FLAG_SHOULD_RESIZE;
|
||||||
|
|
|
@ -572,50 +572,12 @@ static void switch_update_viewport(switch_video_t *sw,
|
||||||
|
|
||||||
if (settings->bools.video_scale_integer)
|
if (settings->bools.video_scale_integer)
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&sw->vp, sw->vp.full_width, sw->vp.full_height, desired_aspect, sw->keep_aspect);
|
/* TODO: Does nx use top-left or bottom-left origin? I'm assuming top left. */
|
||||||
|
video_viewport_get_scaled_integer(&sw->vp, sw->vp.full_width, sw->vp.full_height, desired_aspect, sw->keep_aspect, true);
|
||||||
}
|
}
|
||||||
else if (sw->keep_aspect)
|
else if (sw->keep_aspect)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MENU)
|
video_viewport_get_scaled_aspect(&sw->vp, width, height, true);
|
||||||
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
|
||||||
{
|
|
||||||
sw->vp.x = sw->vp.y = 0;
|
|
||||||
sw->vp.width = width;
|
|
||||||
sw->vp.height = height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
float device_aspect = ((float)sw->vp.full_width) / sw->vp.full_height;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(width * (0.5f - delta));
|
|
||||||
width = (unsigned)roundf(2.0f * width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(height * (0.5f - delta));
|
|
||||||
height = (unsigned)roundf(2.0f * height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sw->vp.x = x;
|
|
||||||
sw->vp.y = y;
|
|
||||||
|
|
||||||
sw->vp.width = width;
|
|
||||||
sw->vp.height = height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,45 +318,39 @@ static void vg_free(void *data)
|
||||||
static void vg_calculate_quad(vg_t *vg,
|
static void vg_calculate_quad(vg_t *vg,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
/* set viewport for aspect ratio, taken from the OpenGL driver. */
|
settings_t *settings = config_get_ptr();
|
||||||
if (vg->keep_aspect)
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
{
|
float device_aspect = (float)width / height;
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
struct video_viewport_t vp;
|
||||||
|
|
||||||
/* If the aspect ratios of screen and desired aspect ratio
|
vp.x = 0;
|
||||||
* are sufficiently equal (floating point stuff),
|
vp.y = 0;
|
||||||
* assume they are actually equal. */
|
vp.width = width;
|
||||||
if (fabs(vg->mScreenAspect - desired_aspect) < 0.0001)
|
vp.height = height;
|
||||||
{
|
vp.full_width = width;
|
||||||
vg->x1 = 0;
|
vp.full_height = height;
|
||||||
vg->y1 = 0;
|
|
||||||
vg->x2 = width;
|
if (vg->ctx_driver->translate_aspect)
|
||||||
vg->y2 = height;
|
device_aspect = vg->ctx_driver->translate_aspect(vg->ctx_data, width, height);
|
||||||
}
|
|
||||||
else if (vg->mScreenAspect > desired_aspect)
|
vg->mScreenAspect = device_aspect;
|
||||||
{
|
/* OpenVG uses a bottom-left origin coordinate system */
|
||||||
float delta = (desired_aspect / vg->mScreenAspect - 1.0) / 2.0 + 0.5;
|
if (video_scale_integer)
|
||||||
vg->x1 = width * (0.5 - delta);
|
|
||||||
vg->y1 = 0;
|
|
||||||
vg->x2 = 2.0 * width * delta + vg->x1;
|
|
||||||
vg->y2 = height + vg->y1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float delta = (vg->mScreenAspect / desired_aspect - 1.0) / 2.0 + 0.5;
|
|
||||||
vg->x1 = 0;
|
|
||||||
vg->y1 = height * (0.5 - delta);
|
|
||||||
vg->x2 = width + vg->x1;
|
|
||||||
vg->y2 = 2.0 * height * delta + vg->y1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
vg->x1 = 0;
|
video_viewport_get_scaled_integer(&vp,
|
||||||
vg->y1 = 0;
|
width, height,
|
||||||
vg->x2 = width;
|
video_driver_get_aspect_ratio(),
|
||||||
vg->y2 = height;
|
vg->keep_aspect,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
else if (vg->keep_aspect)
|
||||||
|
{
|
||||||
|
video_viewport_get_scaled_aspect(&vp, viewport_width, viewport_height, false);
|
||||||
|
}
|
||||||
|
vg->x1 = vp.x;
|
||||||
|
vg->y1 = vp.y;
|
||||||
|
vg->x2 = vp.width;
|
||||||
|
vg->y2 = vp.height;
|
||||||
|
|
||||||
vg->scissor[0] = vg->x1;
|
vg->scissor[0] = vg->x1;
|
||||||
vg->scissor[1] = vg->y1;
|
vg->scissor[1] = vg->y1;
|
||||||
|
|
|
@ -861,8 +861,9 @@ static void vita2d_update_viewport(vita_video_t* vita,
|
||||||
|
|
||||||
if (video_scale_integer)
|
if (video_scale_integer)
|
||||||
{
|
{
|
||||||
|
/* TODO: Does Vita use top-left or bottom-left origin? I'm assuming top left. */
|
||||||
video_viewport_get_scaled_integer(&vita->vp, temp_width,
|
video_viewport_get_scaled_integer(&vita->vp, temp_width,
|
||||||
temp_height, video_driver_get_aspect_ratio(), vita->keep_aspect);
|
temp_height, video_driver_get_aspect_ratio(), vita->keep_aspect, true);
|
||||||
width = vita->vp.width;
|
width = vita->vp.width;
|
||||||
height = vita->vp.height;
|
height = vita->vp.height;
|
||||||
}
|
}
|
||||||
|
@ -876,54 +877,16 @@ static void vita2d_update_viewport(vita_video_t* vita,
|
||||||
width = temp_height;
|
width = temp_height;
|
||||||
height = temp_width;
|
height = temp_width;
|
||||||
}
|
}
|
||||||
#if defined(HAVE_MENU)
|
video_viewport_get_scaled_aspect(&vita->vp, width, height, true);
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
if ( (vita->rotation == ORIENTATION_VERTICAL) ||
|
||||||
|
(vita->rotation == ORIENTATION_FLIPPED_ROTATED)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
x = video_info->custom_vp_x;
|
// swap x and y
|
||||||
y = video_info->custom_vp_y;
|
unsigned tmp = vita->vp.x;
|
||||||
width = video_info->custom_vp_width;
|
vita->vp.x = vita->vp.y;
|
||||||
height = video_info->custom_vp_height;
|
vita->vp.y = tmp;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if ((fabsf(device_aspect - desired_aspect) < 0.0001f))
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(width * (0.5f - delta));
|
|
||||||
width = (unsigned)roundf(2.0f * width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(height * (0.5f - delta));
|
|
||||||
height = (unsigned)roundf(2.0f * height * delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (vita->rotation == ORIENTATION_VERTICAL) ||
|
|
||||||
(vita->rotation == ORIENTATION_FLIPPED_ROTATED)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
x = (temp_width - width) * 0.5f;
|
|
||||||
y = (temp_height - height) * 0.5f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vita->vp.x = x;
|
|
||||||
vita->vp.y = y;
|
|
||||||
vita->vp.width = width;
|
|
||||||
vita->vp.height = height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -954,9 +917,10 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
|
||||||
|
|
||||||
if (video_scale_integer && !force_full)
|
if (video_scale_integer && !force_full)
|
||||||
{
|
{
|
||||||
|
/* TODO: Does Vita use top-left or bottom-left origin? I'm assuming top left. */
|
||||||
video_viewport_get_scaled_integer(&vita->vp,
|
video_viewport_get_scaled_integer(&vita->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(), vita->keep_aspect);
|
video_driver_get_aspect_ratio(), vita->keep_aspect, true);
|
||||||
viewport_width = vita->vp.width;
|
viewport_width = vita->vp.width;
|
||||||
viewport_height = vita->vp.height;
|
viewport_height = vita->vp.height;
|
||||||
}
|
}
|
||||||
|
@ -986,16 +950,19 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
|
||||||
}
|
}
|
||||||
else if (device_aspect > desired_aspect)
|
else if (device_aspect > desired_aspect)
|
||||||
{
|
{
|
||||||
|
float viewport_bias = settings->floats.video_viewport_bias_x;
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
delta = (desired_aspect / device_aspect - 1.0f)
|
||||||
/ 2.0f + 0.5f;
|
/ 2.0f + 0.5f;
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
x = (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* TODO: Does Vita use top-left or bottom-left origin? I'm assuming top left. */
|
||||||
|
float viewport_bias = settings->floats.video_viewport_bias_y;
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
delta = (device_aspect / desired_aspect - 1.0f)
|
||||||
/ 2.0f + 0.5f;
|
/ 2.0f + 0.5f;
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
y = (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3814,7 +3814,6 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
|
||||||
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
|
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
|
||||||
vk_t *vk = (vk_t*)data;
|
vk_t *vk = (vk_t*)data;
|
||||||
|
|
||||||
if (vk->ctx_driver->translate_aspect)
|
if (vk->ctx_driver->translate_aspect)
|
||||||
|
@ -3826,55 +3825,18 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
|
||||||
video_viewport_get_scaled_integer(&vk->vp,
|
video_viewport_get_scaled_integer(&vk->vp,
|
||||||
viewport_width, viewport_height,
|
viewport_width, viewport_height,
|
||||||
video_driver_get_aspect_ratio(),
|
video_driver_get_aspect_ratio(),
|
||||||
vk->flags & VK_FLAG_KEEP_ASPECT);
|
vk->flags & VK_FLAG_KEEP_ASPECT,
|
||||||
|
true);
|
||||||
|
vk->vp.x = MAX(vk->vp.x, 0);
|
||||||
|
vk->vp.y = MAX(vk->vp.y, 0);
|
||||||
viewport_width = vk->vp.width;
|
viewport_width = vk->vp.width;
|
||||||
viewport_height = vk->vp.height;
|
viewport_height = vk->vp.height;
|
||||||
}
|
}
|
||||||
else if ((vk->flags & VK_FLAG_KEEP_ASPECT) && !force_full)
|
else if ((vk->flags & VK_FLAG_KEEP_ASPECT) && !force_full)
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect2(&vk->vp, viewport_width, viewport_height, true, device_aspect, video_driver_get_aspect_ratio());
|
||||||
#if defined(HAVE_MENU)
|
viewport_width = vk->vp.width;
|
||||||
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
viewport_height = vk->vp.height;
|
||||||
{
|
|
||||||
video_viewport_t *custom_vp = &settings->video_viewport_custom;
|
|
||||||
/* Vulkan 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
|
|
||||||
{
|
|
||||||
float delta;
|
|
||||||
|
|
||||||
if (fabsf(device_aspect - desired_aspect) < 0.0001f)
|
|
||||||
{
|
|
||||||
/* If the aspect ratios of screen and desired aspect
|
|
||||||
* ratio are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
x = (int)roundf(viewport_width * (0.5f - delta));
|
|
||||||
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
|
||||||
/ 2.0f + 0.5f;
|
|
||||||
y = (int)roundf(viewport_height * (0.5f - delta));
|
|
||||||
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vk->vp.x = x;
|
|
||||||
vk->vp.y = y;
|
|
||||||
vk->vp.width = viewport_width;
|
|
||||||
vk->vp.height = viewport_height;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3884,12 +3846,6 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
|
||||||
vk->vp.height = viewport_height;
|
vk->vp.height = viewport_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RARCH_MOBILE)
|
|
||||||
/* In portrait mode, we want viewport to gravitate to top of screen. */
|
|
||||||
if (device_aspect < 1.0f)
|
|
||||||
vk->vp.y = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vulkan_set_projection(vk, &ortho, allow_rotate);
|
vulkan_set_projection(vk, &ortho, allow_rotate);
|
||||||
|
|
||||||
/* Set last backbuffer viewport. */
|
/* Set last backbuffer viewport. */
|
||||||
|
|
|
@ -599,9 +599,10 @@ static void xv_calc_out_rect(bool keep_aspect,
|
||||||
vp->full_width = vp_width;
|
vp->full_width = vp_width;
|
||||||
vp->full_height = vp_height;
|
vp->full_height = vp_height;
|
||||||
|
|
||||||
|
/* TODO: Does xvideo have its origin in top left or bottom-left? Assuming top left. */
|
||||||
if (scale_integer)
|
if (scale_integer)
|
||||||
video_viewport_get_scaled_integer(vp, vp_width, vp_height,
|
video_viewport_get_scaled_integer(vp, vp_width, vp_height,
|
||||||
video_driver_get_aspect_ratio(), keep_aspect);
|
video_driver_get_aspect_ratio(), keep_aspect, true);
|
||||||
else if (!keep_aspect)
|
else if (!keep_aspect)
|
||||||
{
|
{
|
||||||
vp->x = 0;
|
vp->x = 0;
|
||||||
|
@ -611,36 +612,7 @@ static void xv_calc_out_rect(bool keep_aspect,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
video_viewport_get_scaled_aspect(vp, vp_width, vp_height, true);
|
||||||
float device_aspect = (float)vp_width / vp_height;
|
|
||||||
|
|
||||||
/* If the aspect ratios of screen and desired aspect ratio
|
|
||||||
* are sufficiently equal (floating point stuff),
|
|
||||||
* assume they are actually equal.
|
|
||||||
*/
|
|
||||||
if (fabs(device_aspect - desired_aspect) < 0.0001)
|
|
||||||
{
|
|
||||||
vp->x = 0;
|
|
||||||
vp->y = 0;
|
|
||||||
vp->width = vp_width;
|
|
||||||
vp->height = vp_height;
|
|
||||||
}
|
|
||||||
else if (device_aspect > desired_aspect)
|
|
||||||
{
|
|
||||||
float delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
|
||||||
vp->x = vp_width * (0.5 - delta);
|
|
||||||
vp->y = 0;
|
|
||||||
vp->width = 2.0 * vp_width * delta;
|
|
||||||
vp->height = vp_height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5;
|
|
||||||
vp->x = 0;
|
|
||||||
vp->y = vp_height * (0.5 - delta);
|
|
||||||
vp->width = vp_width;
|
|
||||||
vp->height = 2.0 * vp_height * delta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1248,7 +1248,7 @@ void video_switch_refresh_rate_maybe(
|
||||||
unsigned video_bfi = settings->uints.video_black_frame_insertion;
|
unsigned video_bfi = settings->uints.video_black_frame_insertion;
|
||||||
unsigned shader_subframes = settings->uints.video_shader_subframes;
|
unsigned shader_subframes = settings->uints.video_shader_subframes;
|
||||||
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
||||||
bool exclusive_fullscreen = (video_st->flags | VIDEO_FLAG_FORCE_FULLSCREEN) || (
|
bool exclusive_fullscreen = (video_st->flags & VIDEO_FLAG_FORCE_FULLSCREEN) || (
|
||||||
settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen);
|
settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen);
|
||||||
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
|
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
|
||||||
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
|
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
|
||||||
|
@ -2044,39 +2044,28 @@ void video_driver_set_aspect_ratio(void)
|
||||||
video_st->poke->set_aspect_ratio(video_st->data, aspect_ratio_idx);
|
video_st->poke->set_aspect_ratio(video_st->data, aspect_ratio_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_update_viewport(
|
void video_viewport_get_scaled_aspect(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown) {
|
||||||
struct video_viewport* vp, bool force_full, bool keep_aspect)
|
float device_aspect = (float)viewport_width / viewport_height;
|
||||||
|
float desired_aspect = video_driver_get_aspect_ratio();
|
||||||
|
video_viewport_get_scaled_aspect2(vp, viewport_width, viewport_height, ydown, device_aspect, desired_aspect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void video_viewport_get_scaled_aspect2(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown, float device_aspect, float desired_aspect)
|
||||||
{
|
{
|
||||||
float device_aspect = (float)vp->full_width / vp->full_height;
|
settings_t *settings = config_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
int x = 0;
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
int y = 0;
|
||||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
|
||||||
video_driver_state_t *video_st = &video_driver_st;
|
|
||||||
float video_driver_aspect_ratio = video_st->aspect_ratio;
|
|
||||||
|
|
||||||
vp->x = 0;
|
|
||||||
vp->y = 0;
|
|
||||||
vp->width = vp->full_width;
|
|
||||||
vp->height = vp->full_height;
|
|
||||||
|
|
||||||
if (video_scale_integer && !force_full)
|
|
||||||
video_viewport_get_scaled_integer(
|
|
||||||
vp,
|
|
||||||
vp->full_width,
|
|
||||||
vp->full_height,
|
|
||||||
video_driver_aspect_ratio, keep_aspect);
|
|
||||||
else if (keep_aspect && !force_full)
|
|
||||||
{
|
|
||||||
float desired_aspect = video_driver_aspect_ratio;
|
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
#if defined(HAVE_MENU)
|
||||||
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||||
{
|
{
|
||||||
const struct video_viewport *custom_vp = &settings->video_viewport_custom;
|
video_viewport_t *custom_vp = &settings->video_viewport_custom;
|
||||||
vp->x = custom_vp->x;
|
x = custom_vp->x;
|
||||||
vp->y = custom_vp->y;
|
y = custom_vp->y - custom_vp->height;
|
||||||
vp->width = custom_vp->width;
|
if (!ydown)
|
||||||
vp->height = custom_vp->height;
|
y = vp->full_height - y;
|
||||||
|
viewport_width = custom_vp->width;
|
||||||
|
viewport_height = custom_vp->height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -2092,30 +2081,58 @@ void video_driver_update_viewport(
|
||||||
}
|
}
|
||||||
else if (device_aspect > desired_aspect)
|
else if (device_aspect > desired_aspect)
|
||||||
{
|
{
|
||||||
delta = (desired_aspect / device_aspect - 1.0f)
|
float viewport_bias = settings->floats.video_viewport_bias_x;
|
||||||
/ 2.0f + 0.5f;
|
#if defined(RARCH_MOBILE)
|
||||||
vp->x = (int)roundf(vp->full_width * (0.5f - delta));
|
if (device_aspect < 1.0f)
|
||||||
vp->width = (unsigned)roundf(2.0f * vp->full_width * delta);
|
viewport_bias = settings->floats.video_viewport_bias_portrait_x;
|
||||||
vp->y = 0;
|
#endif
|
||||||
vp->height = vp->full_height;
|
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
||||||
|
x = (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
|
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vp->x = 0;
|
float viewport_bias = settings->floats.video_viewport_bias_y;
|
||||||
vp->width = vp->full_width;
|
#if defined(RARCH_MOBILE)
|
||||||
delta = (device_aspect / desired_aspect - 1.0f)
|
if (device_aspect < 1.0f)
|
||||||
/ 2.0f + 0.5f;
|
viewport_bias = settings->floats.video_viewport_bias_portrait_y;
|
||||||
vp->y = (int)roundf(vp->full_height * (0.5f - delta));
|
#endif
|
||||||
vp->height = (unsigned)roundf(2.0f * vp->full_height * delta);
|
if (!ydown)
|
||||||
|
viewport_bias = 1.0 - viewport_bias;
|
||||||
|
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
||||||
|
y = (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
|
||||||
|
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
vp->x = x;
|
||||||
|
vp->y = y;
|
||||||
|
vp->width = viewport_width;
|
||||||
|
vp->height = viewport_height;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(RARCH_MOBILE)
|
void video_driver_update_viewport(
|
||||||
/* In portrait mode, we want viewport to gravitate to top of screen. */
|
struct video_viewport* vp, bool force_full, bool keep_aspect)
|
||||||
if (device_aspect < 1.0f)
|
{
|
||||||
vp->y = 0;
|
settings_t *settings = config_get_ptr();
|
||||||
#endif
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
|
video_driver_state_t *video_st = &video_driver_st;
|
||||||
|
float video_driver_aspect_ratio = video_st->aspect_ratio;
|
||||||
|
|
||||||
|
vp->x = 0;
|
||||||
|
vp->y = 0;
|
||||||
|
vp->width = vp->full_width;
|
||||||
|
vp->height = vp->full_height;
|
||||||
|
|
||||||
|
if (video_scale_integer && !force_full)
|
||||||
|
video_viewport_get_scaled_integer(
|
||||||
|
vp,
|
||||||
|
vp->full_width,
|
||||||
|
vp->full_height,
|
||||||
|
video_driver_aspect_ratio, keep_aspect, false);
|
||||||
|
else if (keep_aspect && !force_full)
|
||||||
|
{
|
||||||
|
video_viewport_get_scaled_aspect(vp, vp->full_width, vp->full_height, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_restore_cached(void *settings_data)
|
void video_driver_restore_cached(void *settings_data)
|
||||||
|
@ -2304,13 +2321,15 @@ bool video_driver_get_viewport_info(struct video_viewport *viewport)
|
||||||
* @height : Height.
|
* @height : Height.
|
||||||
* @aspect_ratio : Aspect ratio (in float).
|
* @aspect_ratio : Aspect ratio (in float).
|
||||||
* @keep_aspect : Preserve aspect ratio?
|
* @keep_aspect : Preserve aspect ratio?
|
||||||
|
* @ydown : Positive y points down?
|
||||||
*
|
*
|
||||||
* Gets viewport scaling dimensions based on
|
* Gets viewport scaling dimensions based on
|
||||||
* scaled integer aspect ratio.
|
* scaled integer aspect ratio.
|
||||||
**/
|
**/
|
||||||
void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
float aspect_ratio, bool keep_aspect)
|
float aspect_ratio, bool keep_aspect,
|
||||||
|
bool ydown)
|
||||||
{
|
{
|
||||||
int padding_x = 0;
|
int padding_x = 0;
|
||||||
int padding_y = 0;
|
int padding_y = 0;
|
||||||
|
@ -2318,7 +2337,6 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||||
video_driver_state_t *video_st = &video_driver_st;
|
video_driver_state_t *video_st = &video_driver_st;
|
||||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||||
bool overscale = settings->bools.video_scale_integer_overscale;
|
bool overscale = settings->bools.video_scale_integer_overscale;
|
||||||
|
|
||||||
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||||
{
|
{
|
||||||
struct video_viewport *custom_vp = &settings->video_viewport_custom;
|
struct video_viewport *custom_vp = &settings->video_viewport_custom;
|
||||||
|
@ -2333,12 +2351,24 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
float viewport_bias_x = settings->floats.video_viewport_bias_x;
|
||||||
|
float viewport_bias_y = settings->floats.video_viewport_bias_y;
|
||||||
unsigned base_width;
|
unsigned base_width;
|
||||||
/* Use system reported sizes as these define the
|
/* Use system reported sizes as these define the
|
||||||
* geometry for the "normal" case. */
|
* geometry for the "normal" case. */
|
||||||
unsigned base_height =
|
unsigned base_height =
|
||||||
video_st->av_info.geometry.base_height;
|
video_st->av_info.geometry.base_height;
|
||||||
unsigned int rotation = retroarch_get_rotation();
|
unsigned int rotation = retroarch_get_rotation();
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
if (aspect_ratio < 1.0f)
|
||||||
|
{
|
||||||
|
viewport_bias_x = settings->floats.video_viewport_bias_portrait_x;
|
||||||
|
viewport_bias_y = settings->floats.video_viewport_bias_portrait_y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!ydown)
|
||||||
|
viewport_bias_y = 1.0 - viewport_bias_y;
|
||||||
|
|
||||||
if (rotation % 2)
|
if (rotation % 2)
|
||||||
base_height = video_st->av_info.geometry.base_width;
|
base_height = video_st->av_info.geometry.base_width;
|
||||||
|
@ -2382,12 +2412,14 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||||
|
|
||||||
width -= padding_x;
|
width -= padding_x;
|
||||||
height -= padding_y;
|
height -= padding_y;
|
||||||
|
padding_x *= viewport_bias_x;
|
||||||
|
padding_y *= viewport_bias_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
vp->width = width;
|
vp->width = width;
|
||||||
vp->height = height;
|
vp->height = height;
|
||||||
vp->x = padding_x / 2;
|
vp->x = padding_x;
|
||||||
vp->y = padding_y / 2;
|
vp->y = padding_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_display_type_set(enum rarch_display_type type)
|
void video_driver_display_type_set(enum rarch_display_type type)
|
||||||
|
|
|
@ -991,18 +991,49 @@ void video_driver_menu_settings(void **list_data, void *list_info_data,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_viewport_get_scaled_integer:
|
* video_viewport_get_scaled_integer:
|
||||||
* @vp : Viewport handle
|
* @vp : Viewport handle.
|
||||||
* @width : Width.
|
* @width : Width.
|
||||||
* @height : Height.
|
* @height : Height.
|
||||||
* @aspect_ratio : Aspect ratio (in float).
|
* @aspect_ratio : Aspect ratio (in float).
|
||||||
* @keep_aspect : Preserve aspect ratio?
|
* @keep_aspect : Preserve aspect ratio?
|
||||||
|
* @ydown : Positive y goes "down".
|
||||||
*
|
*
|
||||||
* Gets viewport scaling dimensions based on
|
* Gets viewport scaling dimensions based on
|
||||||
* scaled integer aspect ratio.
|
* scaled integer aspect ratio.
|
||||||
**/
|
**/
|
||||||
void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
float aspect_ratio, bool keep_aspect);
|
float aspect_ratio, bool keep_aspect,
|
||||||
|
bool ydown);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_viewport_get_scaled_aspect:
|
||||||
|
* @vp : Viewport handle. Fields x, y, width, height will be written, and full_width or full_height might be read.
|
||||||
|
* @width : Viewport width.
|
||||||
|
* @height : Viewport height.
|
||||||
|
* @ydown : Positive y goes "down".
|
||||||
|
*
|
||||||
|
* Gets viewport scaling dimensions based on
|
||||||
|
* scaled non-integer aspect ratio.
|
||||||
|
**/
|
||||||
|
void video_viewport_get_scaled_aspect(struct video_viewport *vp,
|
||||||
|
unsigned width, unsigned height, bool ydown);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_viewport_get_scaled_aspect2:
|
||||||
|
* @vp : Viewport handle. Fields x, y, width, height will be written, and full_width or full_height might be read.
|
||||||
|
* @width : Viewport width.
|
||||||
|
* @height : Viewport height.
|
||||||
|
* @ydown : Positive y goes "down".
|
||||||
|
* @device_aspect : Device aspect ratio.
|
||||||
|
* @desired_aspect: Target aspect ratio.
|
||||||
|
*
|
||||||
|
* Gets viewport scaling dimensions based on
|
||||||
|
* scaled non-integer aspect ratio.
|
||||||
|
**/
|
||||||
|
void video_viewport_get_scaled_aspect2(struct video_viewport *vp,
|
||||||
|
unsigned width, unsigned height, bool ydown,
|
||||||
|
float device_aspect, float desired_aspect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_monitor_set_refresh_rate:
|
* video_monitor_set_refresh_rate:
|
||||||
|
|
|
@ -23,7 +23,9 @@ enum x11_mouse_btn_flags
|
||||||
X11_MOUSE_WU_BTN = (1 << 0),
|
X11_MOUSE_WU_BTN = (1 << 0),
|
||||||
X11_MOUSE_WD_BTN = (1 << 1),
|
X11_MOUSE_WD_BTN = (1 << 1),
|
||||||
X11_MOUSE_HWU_BTN = (1 << 2),
|
X11_MOUSE_HWU_BTN = (1 << 2),
|
||||||
X11_MOUSE_HWD_BTN = (1 << 3)
|
X11_MOUSE_HWD_BTN = (1 << 3),
|
||||||
|
X11_MOUSE_BTN_4 = (1 << 4),
|
||||||
|
X11_MOUSE_BTN_5 = (1 << 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO/FIXME - static globals */
|
/* TODO/FIXME - static globals */
|
||||||
|
@ -51,6 +53,13 @@ int16_t x_mouse_state_wheel(unsigned id)
|
||||||
ret = (g_x11_mouse_flags & X11_MOUSE_HWD_BTN);
|
ret = (g_x11_mouse_flags & X11_MOUSE_HWD_BTN);
|
||||||
g_x11_mouse_flags &= ~X11_MOUSE_HWD_BTN;
|
g_x11_mouse_flags &= ~X11_MOUSE_HWD_BTN;
|
||||||
break;
|
break;
|
||||||
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_4:
|
||||||
|
ret = (g_x11_mouse_flags & X11_MOUSE_BTN_4);
|
||||||
|
break;
|
||||||
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_5:
|
||||||
|
ret = (g_x11_mouse_flags & X11_MOUSE_BTN_5);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -74,5 +83,31 @@ void x_input_poll_wheel(XButtonEvent *event, bool latch)
|
||||||
/* Scroll wheel right == HORIZ_WHEELUP */
|
/* Scroll wheel right == HORIZ_WHEELUP */
|
||||||
g_x11_mouse_flags |= X11_MOUSE_HWU_BTN;
|
g_x11_mouse_flags |= X11_MOUSE_HWU_BTN;
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
/* Extra buttons are regular press-release events,
|
||||||
|
* while scroll wheels do not stay pressed. */
|
||||||
|
/* Mouse button 4 */
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case ButtonPress:
|
||||||
|
g_x11_mouse_flags |= X11_MOUSE_BTN_4;
|
||||||
|
break;
|
||||||
|
case ButtonRelease:
|
||||||
|
g_x11_mouse_flags &= ~X11_MOUSE_BTN_4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
/* Mouse button 5 */
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case ButtonPress:
|
||||||
|
g_x11_mouse_flags |= X11_MOUSE_BTN_5;
|
||||||
|
break;
|
||||||
|
case ButtonRelease:
|
||||||
|
g_x11_mouse_flags &= ~X11_MOUSE_BTN_5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,6 +875,14 @@ static INLINE void android_input_poll_event_type_keyboard(
|
||||||
mod |= RETROKMOD_CTRL;
|
mod |= RETROKMOD_CTRL;
|
||||||
if (meta & AMETA_SHIFT_ON)
|
if (meta & AMETA_SHIFT_ON)
|
||||||
mod |= RETROKMOD_SHIFT;
|
mod |= RETROKMOD_SHIFT;
|
||||||
|
if (meta & AMETA_CAPS_LOCK_ON)
|
||||||
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
|
if (meta & AMETA_NUM_LOCK_ON)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
|
if (meta & AMETA_SCROLL_LOCK_ON)
|
||||||
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (meta & AMETA_META_ON)
|
||||||
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
input_keyboard_event(keydown, keyboardcode,
|
input_keyboard_event(keydown, keyboardcode,
|
||||||
keyboardcode, mod, RETRO_DEVICE_KEYBOARD);
|
keyboardcode, mod, RETRO_DEVICE_KEYBOARD);
|
||||||
|
|
|
@ -199,6 +199,26 @@ static void *dinput_init(const char *joypad_driver)
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16_t dinput_get_active_keyboard_mods()
|
||||||
|
{
|
||||||
|
uint16_t mod = 0;
|
||||||
|
if (GetKeyState(VK_SHIFT) & 0x80)
|
||||||
|
mod |= RETROKMOD_SHIFT;
|
||||||
|
if (GetKeyState(VK_CONTROL) & 0x80)
|
||||||
|
mod |= RETROKMOD_CTRL;
|
||||||
|
if (GetKeyState(VK_MENU) & 0x80)
|
||||||
|
mod |= RETROKMOD_ALT;
|
||||||
|
if (GetKeyState(VK_CAPITAL) & 0x81)
|
||||||
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
|
if (GetKeyState(VK_SCROLL) & 0x81)
|
||||||
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 0x81)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
|
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
||||||
|
mod |= RETROKMOD_META;
|
||||||
|
return mod;
|
||||||
|
}
|
||||||
|
|
||||||
static void dinput_keyboard_mods(struct dinput_input *di, int mod)
|
static void dinput_keyboard_mods(struct dinput_input *di, int mod)
|
||||||
{
|
{
|
||||||
switch (mod)
|
switch (mod)
|
||||||
|
@ -212,7 +232,8 @@ static void dinput_keyboard_mods(struct dinput_input *di, int mod)
|
||||||
|| (!vk_shift_l && (di->flags & DINP_FLAG_SHIFT_L)))
|
|| (!vk_shift_l && (di->flags & DINP_FLAG_SHIFT_L)))
|
||||||
{
|
{
|
||||||
input_keyboard_event(vk_shift_l, RETROK_LSHIFT,
|
input_keyboard_event(vk_shift_l, RETROK_LSHIFT,
|
||||||
0, RETROKMOD_SHIFT, RETRO_DEVICE_KEYBOARD);
|
0, dinput_get_active_keyboard_mods() | RETROKMOD_SHIFT,
|
||||||
|
RETRO_DEVICE_KEYBOARD);
|
||||||
if (di->flags & DINP_FLAG_SHIFT_L)
|
if (di->flags & DINP_FLAG_SHIFT_L)
|
||||||
di->flags &= ~DINP_FLAG_SHIFT_L;
|
di->flags &= ~DINP_FLAG_SHIFT_L;
|
||||||
else
|
else
|
||||||
|
@ -223,7 +244,8 @@ static void dinput_keyboard_mods(struct dinput_input *di, int mod)
|
||||||
|| (!vk_shift_r && (di->flags & DINP_FLAG_SHIFT_R)))
|
|| (!vk_shift_r && (di->flags & DINP_FLAG_SHIFT_R)))
|
||||||
{
|
{
|
||||||
input_keyboard_event(vk_shift_r, RETROK_RSHIFT,
|
input_keyboard_event(vk_shift_r, RETROK_RSHIFT,
|
||||||
0, RETROKMOD_SHIFT, RETRO_DEVICE_KEYBOARD);
|
0, dinput_get_active_keyboard_mods() | RETROKMOD_SHIFT,
|
||||||
|
RETRO_DEVICE_KEYBOARD);
|
||||||
if (di->flags & DINP_FLAG_SHIFT_R)
|
if (di->flags & DINP_FLAG_SHIFT_R)
|
||||||
di->flags &= ~DINP_FLAG_SHIFT_R;
|
di->flags &= ~DINP_FLAG_SHIFT_R;
|
||||||
else
|
else
|
||||||
|
@ -246,7 +268,8 @@ static void dinput_keyboard_mods(struct dinput_input *di, int mod)
|
||||||
else if (!vk_alt_l && (di->flags & DINP_FLAG_ALT_L))
|
else if (!vk_alt_l && (di->flags & DINP_FLAG_ALT_L))
|
||||||
{
|
{
|
||||||
input_keyboard_event(vk_alt_l, RETROK_LALT,
|
input_keyboard_event(vk_alt_l, RETROK_LALT,
|
||||||
0, RETROKMOD_ALT, RETRO_DEVICE_KEYBOARD);
|
0, dinput_get_active_keyboard_mods() | RETROKMOD_ALT,
|
||||||
|
RETRO_DEVICE_KEYBOARD);
|
||||||
if (di->flags & DINP_FLAG_ALT_L)
|
if (di->flags & DINP_FLAG_ALT_L)
|
||||||
di->flags &= ~DINP_FLAG_ALT_L;
|
di->flags &= ~DINP_FLAG_ALT_L;
|
||||||
else
|
else
|
||||||
|
|
|
@ -442,6 +442,11 @@ static void sdl_input_poll(void *data)
|
||||||
if (event.key.keysym.mod & KMOD_CAPS)
|
if (event.key.keysym.mod & KMOD_CAPS)
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
|
|
||||||
|
/* KMOD_SCROLL was added in SDL 2.0.18, use the raw number
|
||||||
|
to stay backwards compatible with older versions */
|
||||||
|
if (event.key.keysym.mod & 0x8000 /*KMOD_SCROLL*/)
|
||||||
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
|
||||||
input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod,
|
input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod,
|
||||||
RETRO_DEVICE_KEYBOARD);
|
RETRO_DEVICE_KEYBOARD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,12 +210,20 @@ static void switch_input_poll(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
hidGetKeyboardStates(&kbd_state, 1);
|
hidGetKeyboardStates(&kbd_state, 1);
|
||||||
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftAlt) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightAlt))
|
if (kbd_state.modifiers & (HidKeyboardModifier_LeftAlt | HidKeyboardModifier_RightAlt))
|
||||||
mod |= RETROKMOD_ALT;
|
mod |= RETROKMOD_ALT;
|
||||||
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftControl) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightControl))
|
if (kbd_state.modifiers & HidKeyboardModifier_Control)
|
||||||
mod |= RETROKMOD_CTRL;
|
mod |= RETROKMOD_CTRL;
|
||||||
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftShift) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightShift))
|
if (kbd_state.modifiers & HidKeyboardModifier_Shift)
|
||||||
mod |= RETROKMOD_SHIFT;
|
mod |= RETROKMOD_SHIFT;
|
||||||
|
if (kbd_state.modifiers & HidKeyboardModifier_Gui)
|
||||||
|
mod |= RETROKMOD_META;
|
||||||
|
if (kbd_state.modifiers & HidKeyboardModifier_CapsLock)
|
||||||
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
|
if (kbd_state.modifiers & HidKeyboardModifier_ScrollLock)
|
||||||
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (kbd_state.modifiers & HidKeyboardModifier_NumLock)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
|
|
||||||
for (i = 0; i < SWITCH_NUM_SCANCODES; i++)
|
for (i = 0; i < SWITCH_NUM_SCANCODES; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -581,6 +581,8 @@ static LRESULT CALLBACK winraw_callback(
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
if (GetKeyState(VK_SCROLL) & 0x81)
|
if (GetKeyState(VK_SCROLL) & 0x81)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 0x81)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
||||||
|
|
|
@ -86,12 +86,8 @@ static bool x_mouse_button_pressed(
|
||||||
return x11->mouse_r;
|
return x11->mouse_r;
|
||||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||||
return x11->mouse_m;
|
return x11->mouse_m;
|
||||||
#if 0
|
|
||||||
case RETRO_DEVICE_ID_MOUSE_BUTTON_4:
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_4:
|
||||||
return x11->mouse_b4;
|
|
||||||
case RETRO_DEVICE_ID_MOUSE_BUTTON_5:
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_5:
|
||||||
return x11->mouse_b5;
|
|
||||||
#endif
|
|
||||||
case RETRO_DEVICE_ID_MOUSE_WHEELUP:
|
case RETRO_DEVICE_ID_MOUSE_WHEELUP:
|
||||||
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
||||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
|
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
|
||||||
|
@ -266,6 +262,8 @@ static int16_t x_input_state(
|
||||||
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
||||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
|
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
|
||||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
|
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
|
||||||
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_4:
|
||||||
|
case RETRO_DEVICE_ID_MOUSE_BUTTON_5:
|
||||||
return x_mouse_state_wheel(id);
|
return x_mouse_state_wheel(id);
|
||||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||||
return x11->mouse_m;
|
return x11->mouse_m;
|
||||||
|
@ -489,7 +487,8 @@ static void x_input_poll(void *data)
|
||||||
x11->mouse_l = mask & Button1Mask;
|
x11->mouse_l = mask & Button1Mask;
|
||||||
x11->mouse_m = mask & Button2Mask;
|
x11->mouse_m = mask & Button2Mask;
|
||||||
x11->mouse_r = mask & Button3Mask;
|
x11->mouse_r = mask & Button3Mask;
|
||||||
|
/* Buttons 4 and 5 are not returned here, so they are handled elsewhere. */
|
||||||
|
|
||||||
/* > Mouse pointer */
|
/* > Mouse pointer */
|
||||||
if (!x11->mouse_grabbed)
|
if (!x11->mouse_grabbed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3636,6 +3636,14 @@ MSG_HASH(
|
||||||
MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE,
|
MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE,
|
||||||
"cloud_sync_destructive"
|
"cloud_sync_destructive"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_SAVES,
|
||||||
|
"cloud_sync_sync_saves"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_CONFIGS,
|
||||||
|
"cloud_sync_sync_configs"
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER,
|
MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER,
|
||||||
"cloud_sync_driver"
|
"cloud_sync_driver"
|
||||||
|
@ -4126,6 +4134,24 @@ MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
||||||
"aspect_ratio_index"
|
"aspect_ratio_index"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
"video_viewport_bias_x"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
"video_viewport_bias_y"
|
||||||
|
)
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
"video_viewport_bias_portrait_x"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
"video_viewport_bias_portrait_y"
|
||||||
|
)
|
||||||
|
#endif
|
||||||
#if defined(DINGUX)
|
#if defined(DINGUX)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VIDEO_DINGUX_IPU_KEEP_ASPECT,
|
MENU_ENUM_LABEL_VIDEO_DINGUX_IPU_KEEP_ASPECT,
|
||||||
|
|
|
@ -1244,10 +1244,26 @@ MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_DESTRUCTIVE,
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_DESTRUCTIVE,
|
||||||
"Destructive Cloud Sync"
|
"Destructive Cloud Sync"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_SYNC_SAVES,
|
||||||
|
"Sync: Saves/States"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_SYNC_CONFIGS,
|
||||||
|
"Sync: Configuration Files"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_CLOUD_SYNC_SYNC_SAVES,
|
||||||
|
"When enabled, saves/states will be synced to cloud."
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_CLOUD_SYNC_SYNC_CONFIGS,
|
||||||
|
"When enabled, configuration files will be synced to cloud."
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_SUBLABEL_CLOUD_SYNC_DESTRUCTIVE,
|
MENU_ENUM_SUBLABEL_CLOUD_SYNC_DESTRUCTIVE,
|
||||||
"When disabled, files are moved to a backup folder before being overwritten or deleted."
|
"When disabled, files are moved to a backup folder before being overwritten or deleted."
|
||||||
)
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_DRIVER,
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_DRIVER,
|
||||||
"Cloud Sync Backend"
|
"Cloud Sync Backend"
|
||||||
|
@ -2599,6 +2615,56 @@ MSG_HASH(
|
||||||
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y,
|
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y,
|
||||||
"Custom viewport offset used for defining the Y-axis position of the viewport.\nThese are ignored if 'Integer Scale' is enabled."
|
"Custom viewport offset used for defining the Y-axis position of the viewport.\nThese are ignored if 'Integer Scale' is enabled."
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
"Viewport Anchor Bias X"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
"Viewport Anchor Bias X"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
"Viewport Anchor Bias Y"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
"Viewport Anchor Bias Y"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
"Custom viewport bias used to offset the viewport horizontally (if wider than content height). 0.0 means far left and 1.0 means far right."
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
"Custom viewport bias used to offset the viewport vertically (if taller than content height). 0.0 means top and 1.0 means bottom."
|
||||||
|
)
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
"Viewport Anchor Bias X (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
"Viewport Anchor Bias X (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
"Viewport Anchor Bias Y (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
"Viewport Anchor Bias Y (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
"Custom viewport bias used to offset the viewport horizontally (if wider than content height). 0.0 means far left and 1.0 means far right. (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
"Custom viewport bias used to offset the viewport vertically (if taller than content height). 0.0 means top and 1.0 means bottom. (Portrait Orientation)"
|
||||||
|
)
|
||||||
|
#endif
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH,
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH,
|
||||||
"Custom Aspect Ratio (Width)"
|
"Custom Aspect Ratio (Width)"
|
||||||
|
|
|
@ -51,6 +51,14 @@ or are directly to function */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Whether the code should be inline asm stored in .text, or the original
|
||||||
|
array buffer */
|
||||||
|
#ifndef LIBCO_STATIC_TEXT
|
||||||
|
#if defined(WIIU)
|
||||||
|
#define LIBCO_STATIC_TEXT 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LIBCO_PPC_ASM
|
#ifdef LIBCO_PPC_ASM
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -61,6 +69,225 @@ or are directly to function */
|
||||||
void co_swap_asm(cothread_t, cothread_t);
|
void co_swap_asm(cothread_t, cothread_t);
|
||||||
#define CO_SWAP_ASM(x, y) co_swap_asm(x, y)
|
#define CO_SWAP_ASM(x, y) co_swap_asm(x, y)
|
||||||
|
|
||||||
|
#elif LIBCO_STATIC_TEXT
|
||||||
|
|
||||||
|
asm(
|
||||||
|
".globl libco_ppc_code\n"
|
||||||
|
"libco_ppc_code:\n"
|
||||||
|
#if LIBCO_PPC64
|
||||||
|
"mfcr %r8\n"
|
||||||
|
"std %r1,40(%r4)\n"
|
||||||
|
"mflr %r9\n"
|
||||||
|
"std %r14,72(%r4)\n"
|
||||||
|
"std %r15,80(%r4)\n"
|
||||||
|
"std %r16,88(%r4)\n"
|
||||||
|
"std %r17,96(%r4)\n"
|
||||||
|
"std %r18,104(%r4)\n"
|
||||||
|
"std %r19,112(%r4)\n"
|
||||||
|
"std %r20,120(%r4)\n"
|
||||||
|
"std %r21,128(%r4)\n"
|
||||||
|
"std %r22,136(%r4)\n"
|
||||||
|
"std %r23,144(%r4)\n"
|
||||||
|
"std %r24,152(%r4)\n"
|
||||||
|
"std %r25,160(%r4)\n"
|
||||||
|
"std %r26,168(%r4)\n"
|
||||||
|
"std %r27,176(%r4)\n"
|
||||||
|
"std %r28,184(%r4)\n"
|
||||||
|
"std %r29,192(%r4)\n"
|
||||||
|
"std %r30,200(%r4)\n"
|
||||||
|
"std %r31,208(%r4)\n"
|
||||||
|
"std %r9,32(%r4)\n"
|
||||||
|
"ld %r7,32(%r3)\n"
|
||||||
|
"ld %r1,40(%r3)\n"
|
||||||
|
"bl 1f\n"
|
||||||
|
"trap\n"
|
||||||
|
"1:stw %r8,48(%r4)\n"
|
||||||
|
"lwz %r6,48(%r3)\n"
|
||||||
|
"mtctr %r7\n"
|
||||||
|
"ld %r14,72(%r3)\n"
|
||||||
|
"ld %r15,80(%r3)\n"
|
||||||
|
"ld %r16,88(%r3)\n"
|
||||||
|
"ld %r17,96(%r3)\n"
|
||||||
|
"ld %r18,104(%r3)\n"
|
||||||
|
"ld %r19,112(%r3)\n"
|
||||||
|
"ld %r20,120(%r3)\n"
|
||||||
|
"ld %r21,128(%r3)\n"
|
||||||
|
"ld %r22,136(%r3)\n"
|
||||||
|
"ld %r23,144(%r3)\n"
|
||||||
|
"ld %r24,152(%r3)\n"
|
||||||
|
"ld %r25,160(%r3)\n"
|
||||||
|
"ld %r26,168(%r3)\n"
|
||||||
|
"ld %r27,176(%r3)\n"
|
||||||
|
"ld %r28,184(%r3)\n"
|
||||||
|
"ld %r29,192(%r3)\n"
|
||||||
|
"ld %r30,200(%r3)\n"
|
||||||
|
"ld %r31,208(%r3)\n"
|
||||||
|
"mtcr %r6\n"
|
||||||
|
#else
|
||||||
|
"mfcr %r8\n"
|
||||||
|
"stw %r1,40(%r4)\n"
|
||||||
|
"mflr %r9\n"
|
||||||
|
"stw %r13,60(%r4)\n"
|
||||||
|
"stw %r14,64(%r4)\n"
|
||||||
|
"stw %r15,68(%r4)\n"
|
||||||
|
"stw %r16,72(%r4)\n"
|
||||||
|
"stw %r17,76(%r4)\n"
|
||||||
|
"stw %r18,80(%r4)\n"
|
||||||
|
"stw %r19,84(%r4)\n"
|
||||||
|
"stw %r20,88(%r4)\n"
|
||||||
|
"stw %r21,92(%r4)\n"
|
||||||
|
"stw %r22,96(%r4)\n"
|
||||||
|
"stw %r23,100(%r4)\n"
|
||||||
|
"stw %r24,104(%r4)\n"
|
||||||
|
"stw %r25,108(%r4)\n"
|
||||||
|
"stw %r26,112(%r4)\n"
|
||||||
|
"stw %r27,116(%r4)\n"
|
||||||
|
"stw %r28,120(%r4)\n"
|
||||||
|
"stw %r29,124(%r4)\n"
|
||||||
|
"stw %r30,128(%r4)\n"
|
||||||
|
"stw %r31,132(%r4)\n"
|
||||||
|
"stw %r9,32(%r4)\n"
|
||||||
|
"lwz %r7,32(%r3)\n"
|
||||||
|
"lwz %r1,40(%r3)\n"
|
||||||
|
"bl 1f\n"
|
||||||
|
"trap\n"
|
||||||
|
"1:stw %r8,48(%r4)\n"
|
||||||
|
"lwz %r6,48(%r3)\n"
|
||||||
|
"mtctr %r7\n"
|
||||||
|
"lwz %r13,60(%r3)\n"
|
||||||
|
"lwz %r14,64(%r3)\n"
|
||||||
|
"lwz %r15,68(%r3)\n"
|
||||||
|
"lwz %r16,72(%r3)\n"
|
||||||
|
"lwz %r17,76(%r3)\n"
|
||||||
|
"lwz %r18,80(%r3)\n"
|
||||||
|
"lwz %r19,84(%r3)\n"
|
||||||
|
"lwz %r20,88(%r3)\n"
|
||||||
|
"lwz %r21,92(%r3)\n"
|
||||||
|
"lwz %r22,96(%r3)\n"
|
||||||
|
"lwz %r23,100(%r3)\n"
|
||||||
|
"lwz %r24,104(%r3)\n"
|
||||||
|
"lwz %r25,108(%r3)\n"
|
||||||
|
"lwz %r26,112(%r3)\n"
|
||||||
|
"lwz %r27,116(%r3)\n"
|
||||||
|
"lwz %r28,120(%r3)\n"
|
||||||
|
"lwz %r29,124(%r3)\n"
|
||||||
|
"lwz %r30,128(%r3)\n"
|
||||||
|
"lwz %r31,132(%r3)\n"
|
||||||
|
"mtcr %r6\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LIBCO_PPC_NOFP
|
||||||
|
"stfd %f14,224(%r4)\n"
|
||||||
|
"stfd %f15,232(%r4)\n"
|
||||||
|
"stfd %f16,240(%r4)\n"
|
||||||
|
"stfd %f17,248(%r4)\n"
|
||||||
|
"stfd %f18,256(%r4)\n"
|
||||||
|
"stfd %f19,264(%r4)\n"
|
||||||
|
"stfd %f20,272(%r4)\n"
|
||||||
|
"stfd %f21,280(%r4)\n"
|
||||||
|
"stfd %f22,288(%r4)\n"
|
||||||
|
"stfd %f23,296(%r4)\n"
|
||||||
|
"stfd %f24,304(%r4)\n"
|
||||||
|
"stfd %f25,312(%r4)\n"
|
||||||
|
"stfd %f26,320(%r4)\n"
|
||||||
|
"stfd %f27,328(%r4)\n"
|
||||||
|
"stfd %f28,336(%r4)\n"
|
||||||
|
"stfd %f29,344(%r4)\n"
|
||||||
|
"stfd %f30,352(%r4)\n"
|
||||||
|
"stfd %f31,360(%r4)\n"
|
||||||
|
"lfd %f14,224(%r3)\n"
|
||||||
|
"lfd %f15,232(%r3)\n"
|
||||||
|
"lfd %f16,240(%r3)\n"
|
||||||
|
"lfd %f17,248(%r3)\n"
|
||||||
|
"lfd %f18,256(%r3)\n"
|
||||||
|
"lfd %f19,264(%r3)\n"
|
||||||
|
"lfd %f20,272(%r3)\n"
|
||||||
|
"lfd %f21,280(%r3)\n"
|
||||||
|
"lfd %f22,288(%r3)\n"
|
||||||
|
"lfd %f23,296(%r3)\n"
|
||||||
|
"lfd %f24,304(%r3)\n"
|
||||||
|
"lfd %f25,312(%r3)\n"
|
||||||
|
"lfd %f26,320(%r3)\n"
|
||||||
|
"lfd %f27,328(%r3)\n"
|
||||||
|
"lfd %f28,336(%r3)\n"
|
||||||
|
"lfd %f29,344(%r3)\n"
|
||||||
|
"lfd %f30,352(%r3)\n"
|
||||||
|
"lfd %f31,360(%r3)\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ALTIVEC__
|
||||||
|
"mfvrsave %r5\n"
|
||||||
|
"addi %r8,%r4,384\n"
|
||||||
|
"addi %r9,%r4,400\n"
|
||||||
|
"andi. %r0,%r5,4095\n"
|
||||||
|
"stw %r5,52(%r4)\n"
|
||||||
|
"beq- 2\n"
|
||||||
|
"stvx %v20,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"stvx %v21,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"stvx %v22,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"stvx %v23,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"stvx %v24,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"stvx %v25,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"stvx %v26,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"stvx %v27,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"stvx %v28,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"stvx %v29,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"stvx %v30,%r0,%r8\n"
|
||||||
|
"stvx %v31,%r0,%r9\n"
|
||||||
|
"2:lwz %r5,52(%r3)\n"
|
||||||
|
"addi %r8,%r3,384\n"
|
||||||
|
"addi %r9,%r3,400\n"
|
||||||
|
"andi. %r0,%r5,4095\n"
|
||||||
|
"mtvrsave %r5\n"
|
||||||
|
"beqctr \n"
|
||||||
|
"lvx %v20,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"lvx %v21,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"lvx %v22,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"lvx %v23,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"lvx %v24,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"lvx %v25,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"lvx %v26,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"lvx %v27,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"lvx %v28,%r0,%r8\n"
|
||||||
|
"addi %r8,%r8,32\n"
|
||||||
|
"lvx %v29,%r0,%r9\n"
|
||||||
|
"addi %r9,%r9,32\n"
|
||||||
|
"lvx %v30,%r0,%r8\n"
|
||||||
|
"lvx %v31,%r0,%r9\n"
|
||||||
|
#endif
|
||||||
|
"bctr"
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void libco_ppc_code(cothread_t, cothread_t);
|
||||||
|
|
||||||
|
#if LIBCO_PPCDESC
|
||||||
|
/* Function call goes through indirect descriptor */
|
||||||
|
#define CO_SWAP_ASM(x, y) \
|
||||||
|
((void (*)(cothread_t, cothread_t)) (uintptr_t) x)(x, y)
|
||||||
|
#else
|
||||||
|
/* Function call goes directly to code */
|
||||||
|
#define CO_SWAP_ASM(x, y) \
|
||||||
|
libco_ppc_code(x, y)
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Swap code is here in array. Please leave dieassembly comments,
|
/* Swap code is here in array. Please leave dieassembly comments,
|
||||||
|
@ -364,7 +591,7 @@ void co_delete(cothread_t t)
|
||||||
|
|
||||||
static void co_init_(void)
|
static void co_init_(void)
|
||||||
{
|
{
|
||||||
#if LIBCO_MPROTECT
|
#if LIBCO_MPROTECT && !LIBCO_STATIC_TEXT
|
||||||
/* TODO: pre- and post-pad PPC code so that this doesn't make other
|
/* TODO: pre- and post-pad PPC code so that this doesn't make other
|
||||||
data executable and writable */
|
data executable and writable */
|
||||||
long page_size = sysconf(_SC_PAGESIZE);
|
long page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
|
|
@ -257,6 +257,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_saving_settings_list, MENU_
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_settings_list, MENU_ENUM_SUBLABEL_CLOUD_SYNC_SETTINGS)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_settings_list, MENU_ENUM_SUBLABEL_CLOUD_SYNC_SETTINGS)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_enable, MENU_ENUM_SUBLABEL_CLOUD_SYNC_ENABLE)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_enable, MENU_ENUM_SUBLABEL_CLOUD_SYNC_ENABLE)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_destructive, MENU_ENUM_SUBLABEL_CLOUD_SYNC_DESTRUCTIVE)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_destructive, MENU_ENUM_SUBLABEL_CLOUD_SYNC_DESTRUCTIVE)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_sync_saves, MENU_ENUM_SUBLABEL_CLOUD_SYNC_SYNC_SAVES)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_sync_configs, MENU_ENUM_SUBLABEL_CLOUD_SYNC_SYNC_CONFIGS)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_driver, MENU_ENUM_SUBLABEL_CLOUD_SYNC_DRIVER)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_driver, MENU_ENUM_SUBLABEL_CLOUD_SYNC_DRIVER)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_url, MENU_ENUM_SUBLABEL_CLOUD_SYNC_URL)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_url, MENU_ENUM_SUBLABEL_CLOUD_SYNC_URL)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_username, MENU_ENUM_SUBLABEL_CLOUD_SYNC_USERNAME)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cloud_sync_username, MENU_ENUM_SUBLABEL_CLOUD_SYNC_USERNAME)
|
||||||
|
@ -1251,6 +1253,12 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_height,
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_width, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_width, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_X)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_Y)
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_portrait_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_portrait_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y)
|
||||||
|
#endif
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_use_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_use_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_custom_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_CUSTOM_MITM_SERVER)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_custom_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_CUSTOM_MITM_SERVER)
|
||||||
|
@ -2570,6 +2578,20 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||||
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO:
|
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_aspect_ratio);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_aspect_ratio);
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_x);
|
||||||
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_y);
|
||||||
|
break;
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_portrait_x);
|
||||||
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_portrait_y);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX:
|
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_aspect_ratio_index);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_aspect_ratio_index);
|
||||||
break;
|
break;
|
||||||
|
@ -5029,6 +5051,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||||
case MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE:
|
case MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_destructive);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_destructive);
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_SAVES:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_sync_saves);
|
||||||
|
break;
|
||||||
|
case MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_CONFIGS:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_sync_configs);
|
||||||
|
break;
|
||||||
case MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER:
|
case MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_driver);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_driver);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9801,6 +9801,24 @@ unsigned menu_displaylist_build_list(
|
||||||
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
PARSE_ONLY_BOOL, false) == 0)
|
PARSE_ONLY_BOOL, false) == 0)
|
||||||
count++;
|
count++;
|
||||||
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
PARSE_ONLY_FLOAT, false) == 0)
|
||||||
|
count++;
|
||||||
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
PARSE_ONLY_FLOAT, false) == 0)
|
||||||
|
count++;
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
PARSE_ONLY_FLOAT, false) == 0)
|
||||||
|
count++;
|
||||||
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
PARSE_ONLY_FLOAT, false) == 0)
|
||||||
|
count++;
|
||||||
|
#endif
|
||||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
||||||
PARSE_ONLY_UINT, false) == 0)
|
PARSE_ONLY_UINT, false) == 0)
|
||||||
|
@ -10690,12 +10708,14 @@ unsigned menu_displaylist_build_list(
|
||||||
case DISPLAYLIST_CLOUD_SYNC_SETTINGS_LIST:
|
case DISPLAYLIST_CLOUD_SYNC_SETTINGS_LIST:
|
||||||
{
|
{
|
||||||
menu_displaylist_build_info_t build_list[] = {
|
menu_displaylist_build_info_t build_list[] = {
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_ENABLE, PARSE_ONLY_BOOL },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_ENABLE, PARSE_ONLY_BOOL },
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE, PARSE_ONLY_BOOL },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_DESTRUCTIVE, PARSE_ONLY_BOOL },
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER, PARSE_ONLY_STRING_OPTIONS },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_SAVES, PARSE_ONLY_BOOL },
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_URL, PARSE_ONLY_STRING },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_CONFIGS, PARSE_ONLY_BOOL },
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_USERNAME, PARSE_ONLY_STRING },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER, PARSE_ONLY_STRING_OPTIONS },
|
||||||
{MENU_ENUM_LABEL_CLOUD_SYNC_PASSWORD, PARSE_ONLY_STRING },
|
{MENU_ENUM_LABEL_CLOUD_SYNC_URL, PARSE_ONLY_STRING },
|
||||||
|
{MENU_ENUM_LABEL_CLOUD_SYNC_USERNAME, PARSE_ONLY_STRING },
|
||||||
|
{MENU_ENUM_LABEL_CLOUD_SYNC_PASSWORD, PARSE_ONLY_STRING },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(build_list); i++)
|
for (i = 0; i < ARRAY_SIZE(build_list); i++)
|
||||||
|
|
|
@ -11830,6 +11830,36 @@ static bool setting_append_list(
|
||||||
general_read_handler,
|
general_read_handler,
|
||||||
SD_FLAG_NONE);
|
SD_FLAG_NONE);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
&settings->bools.cloud_sync_sync_saves,
|
||||||
|
MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_SAVES,
|
||||||
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_SYNC_SAVES,
|
||||||
|
false,
|
||||||
|
MENU_ENUM_LABEL_VALUE_OFF,
|
||||||
|
MENU_ENUM_LABEL_VALUE_ON,
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler,
|
||||||
|
SD_FLAG_NONE);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
&settings->bools.cloud_sync_sync_configs,
|
||||||
|
MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_CONFIGS,
|
||||||
|
MENU_ENUM_LABEL_VALUE_CLOUD_SYNC_SYNC_CONFIGS,
|
||||||
|
false,
|
||||||
|
MENU_ENUM_LABEL_VALUE_OFF,
|
||||||
|
MENU_ENUM_LABEL_VALUE_ON,
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler,
|
||||||
|
SD_FLAG_NONE);
|
||||||
|
|
||||||
CONFIG_STRING_OPTIONS(
|
CONFIG_STRING_OPTIONS(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
settings->arrays.cloud_sync_driver,
|
settings->arrays.cloud_sync_driver,
|
||||||
|
@ -12929,6 +12959,84 @@ static bool setting_append_list(
|
||||||
END_SUB_GROUP(list, list_info, parent_group);
|
END_SUB_GROUP(list, list_info, parent_group);
|
||||||
START_SUB_GROUP(list, list_info, "Aspect", &group_info, &subgroup_info, parent_group);
|
START_SUB_GROUP(list, list_info, "Aspect", &group_info, &subgroup_info, parent_group);
|
||||||
|
|
||||||
|
CONFIG_FLOAT(
|
||||||
|
list, list_info,
|
||||||
|
&settings->floats.video_viewport_bias_x,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_X,
|
||||||
|
DEFAULT_VIEWPORT_BIAS_X,
|
||||||
|
"%.2f",
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.05, true, true);
|
||||||
|
(*list)[list_info->index - 1].offset_by = 0;
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
|
||||||
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||||
|
|
||||||
|
CONFIG_FLOAT(
|
||||||
|
list, list_info,
|
||||||
|
&settings->floats.video_viewport_bias_y,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_Y,
|
||||||
|
DEFAULT_VIEWPORT_BIAS_Y,
|
||||||
|
"%.2f",
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.05, true, true);
|
||||||
|
(*list)[list_info->index - 1].offset_by = 0;
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
|
||||||
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||||
|
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
CONFIG_FLOAT(
|
||||||
|
list, list_info,
|
||||||
|
&settings->floats.video_viewport_bias_portrait_x,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
DEFAULT_VIEWPORT_BIAS_PORTRAIT_X,
|
||||||
|
"%.2f",
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.05, true, true);
|
||||||
|
(*list)[list_info->index - 1].offset_by = 0;
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
|
||||||
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||||
|
|
||||||
|
CONFIG_FLOAT(
|
||||||
|
list, list_info,
|
||||||
|
&settings->floats.video_viewport_bias_portrait_y,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y,
|
||||||
|
"%.2f",
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.05, true, true);
|
||||||
|
(*list)[list_info->index - 1].offset_by = 0;
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
|
||||||
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||||
|
#endif
|
||||||
|
|
||||||
CONFIG_UINT(
|
CONFIG_UINT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
&settings->uints.video_aspect_ratio_idx,
|
&settings->uints.video_aspect_ratio_idx,
|
||||||
|
|
|
@ -3230,6 +3230,8 @@ enum msg_hash_enums
|
||||||
MENU_LABEL(CLOUD_SYNC_SETTINGS),
|
MENU_LABEL(CLOUD_SYNC_SETTINGS),
|
||||||
MENU_LABEL(CLOUD_SYNC_ENABLE),
|
MENU_LABEL(CLOUD_SYNC_ENABLE),
|
||||||
MENU_LABEL(CLOUD_SYNC_DESTRUCTIVE),
|
MENU_LABEL(CLOUD_SYNC_DESTRUCTIVE),
|
||||||
|
MENU_LABEL(CLOUD_SYNC_SYNC_SAVES),
|
||||||
|
MENU_LABEL(CLOUD_SYNC_SYNC_CONFIGS),
|
||||||
MENU_LABEL(CLOUD_SYNC_DRIVER),
|
MENU_LABEL(CLOUD_SYNC_DRIVER),
|
||||||
MENU_LABEL(CLOUD_SYNC_URL),
|
MENU_LABEL(CLOUD_SYNC_URL),
|
||||||
MENU_LABEL(CLOUD_SYNC_USERNAME),
|
MENU_LABEL(CLOUD_SYNC_USERNAME),
|
||||||
|
@ -3385,6 +3387,12 @@ enum msg_hash_enums
|
||||||
MENU_LABEL(VIDEO_OVERSCAN_CORRECTION_TOP),
|
MENU_LABEL(VIDEO_OVERSCAN_CORRECTION_TOP),
|
||||||
MENU_LABEL(VIDEO_OVERSCAN_CORRECTION_BOTTOM),
|
MENU_LABEL(VIDEO_OVERSCAN_CORRECTION_BOTTOM),
|
||||||
MENU_LABEL(VIDEO_ASPECT_RATIO),
|
MENU_LABEL(VIDEO_ASPECT_RATIO),
|
||||||
|
MENU_LABEL(VIDEO_VIEWPORT_BIAS_X),
|
||||||
|
MENU_LABEL(VIDEO_VIEWPORT_BIAS_Y),
|
||||||
|
#if defined(RARCH_MOBILE)
|
||||||
|
MENU_LABEL(VIDEO_VIEWPORT_BIAS_PORTRAIT_X),
|
||||||
|
MENU_LABEL(VIDEO_VIEWPORT_BIAS_PORTRAIT_Y),
|
||||||
|
#endif
|
||||||
MENU_LABEL(VIDEO_FORCE_ASPECT),
|
MENU_LABEL(VIDEO_FORCE_ASPECT),
|
||||||
MENU_LABEL(VIDEO_ASPECT_RATIO_AUTO),
|
MENU_LABEL(VIDEO_ASPECT_RATIO_AUTO),
|
||||||
MENU_LABEL(VIDEO_ASPECT_RATIO_INDEX),
|
MENU_LABEL(VIDEO_ASPECT_RATIO_INDEX),
|
||||||
|
|
|
@ -302,23 +302,32 @@ static void task_cloud_sync_manifest_append_dir(file_list_t *manifest,
|
||||||
static struct string_list *task_cloud_sync_directory_map(void)
|
static struct string_list *task_cloud_sync_directory_map(void)
|
||||||
{
|
{
|
||||||
static struct string_list *list = NULL;
|
static struct string_list *list = NULL;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
if (!list)
|
if (!list)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr = {0};
|
union string_list_elem_attr attr = {0};
|
||||||
char dir[PATH_MAX_LENGTH];
|
char dir[PATH_MAX_LENGTH];
|
||||||
list = string_list_new();
|
list = string_list_new();
|
||||||
|
|
||||||
string_list_append(list, "config", attr);
|
if (settings->bools.cloud_sync_sync_configs)
|
||||||
fill_pathname_application_special(dir,
|
{
|
||||||
sizeof(dir), APPLICATION_SPECIAL_DIRECTORY_CONFIG);
|
string_list_append(list, "config", attr);
|
||||||
list->elems[list->size - 1].userdata = strdup(dir);
|
fill_pathname_application_special(dir,
|
||||||
|
sizeof(dir), APPLICATION_SPECIAL_DIRECTORY_CONFIG);
|
||||||
|
list->elems[list->size - 1].userdata = strdup(dir);
|
||||||
|
}
|
||||||
|
|
||||||
string_list_append(list, "saves", attr);
|
if (settings->bools.cloud_sync_sync_saves)
|
||||||
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVEFILE));
|
{
|
||||||
|
string_list_append(list, "saves", attr);
|
||||||
|
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVEFILE));
|
||||||
|
|
||||||
string_list_append(list, "states", attr);
|
string_list_append(list, "states", attr);
|
||||||
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVESTATE));
|
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVESTATE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,6 +636,8 @@ void App::OnAcceleratorKey(CoreDispatcher^ sender, AcceleratorKeyEventArgs^ args
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
if ((window->GetKeyState(VirtualKey::Scroll) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked)
|
if ((window->GetKeyState(VirtualKey::Scroll) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
if ((window->GetKeyState(VirtualKey::NumberKeyLock) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked)
|
||||||
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
if ((window->GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down ||
|
if ((window->GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down ||
|
||||||
(window->GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down)
|
(window->GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down)
|
||||||
mod |= RETROKMOD_META;
|
mod |= RETROKMOD_META;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user