(RARCH_CONSOLE) add core resolution (use aspect ratio provided by the emulation core)

This commit is contained in:
Toad King 2012-08-19 21:08:36 -04:00
parent 640d63d67c
commit fda2dff40c
8 changed files with 49 additions and 22 deletions

View File

@ -46,6 +46,7 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "30:17", 1.7647f },
{ "32:9", 3.5555f },
{ "Auto", 1.0f },
{ "Core Provided", 1.0f },
{ "Custom", 0.0f }
};
@ -76,7 +77,19 @@ void rarch_set_auto_viewport(unsigned width, unsigned height)
aspect_y = height / highest;
snprintf(aspectratio_lut[ASPECT_RATIO_AUTO].name, sizeof(aspectratio_lut[ASPECT_RATIO_AUTO].name), "%d:%d (Auto)", aspect_x, aspect_y);
aspectratio_lut[ASPECT_RATIO_AUTO].value = (int)aspect_x / (int)aspect_y;
aspectratio_lut[ASPECT_RATIO_AUTO].value = (float) aspect_x / aspect_y;
}
void rarch_set_core_viewport()
{
struct retro_system_av_info info;
retro_get_system_av_info(&info);
// fallback to 1:1 pixel ratio if none provided
if (info.geometry.aspect_ratio == 0.0)
aspectratio_lut[ASPECT_RATIO_CORE].value = (float) info.geometry.base_width / info.geometry.base_height;
else
aspectratio_lut[ASPECT_RATIO_CORE].value = info.geometry.aspect_ratio;
}
#if defined(HAVE_HLSL) || defined(HAVE_CG) || defined(HAVE_GLSL)

View File

@ -58,6 +58,7 @@ enum aspect_ratio
ASPECT_RATIO_30_17,
ASPECT_RATIO_32_9,
ASPECT_RATIO_AUTO,
ASPECT_RATIO_CORE,
ASPECT_RATIO_CUSTOM,
ASPECT_RATIO_END,
@ -101,6 +102,7 @@ struct aspect_ratio_elem
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
extern void rarch_set_core_viewport();
extern void rarch_load_shader(unsigned slot, const char *path);
#endif

View File

@ -355,6 +355,8 @@ void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
if (g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
else if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
rarch_set_core_viewport();
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;

View File

@ -158,6 +158,8 @@ void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
else if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
rarch_set_core_viewport();
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;

View File

@ -377,6 +377,10 @@ begin_loop:
bool repeat = false;
input_gx.poll(NULL);
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
rarch_set_core_viewport();
audio_start_func();
do{

View File

@ -92,6 +92,8 @@ void gx_set_aspect_ratio(void *data, unsigned aspectratio_idx)
if (g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
else if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
rarch_set_core_viewport();
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;

View File

@ -317,6 +317,7 @@ begin_loop:
input_ps3.poll(NULL);
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
rarch_set_core_viewport();
do{
repeat = rarch_main_iterate();

View File

@ -188,6 +188,7 @@ begin_loop:
input_xinput.poll(NULL);
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
rarch_set_core_viewport();
do{
repeat = rarch_main_iterate();