mirror of https://github.com/stella-emu/stella.git
libretro: crop horizontal overscan option
This commit is contained in:
parent
04304fce32
commit
e428768307
|
@ -250,16 +250,15 @@ size_t StellaLIBRETRO::getStateSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
float StellaLIBRETRO::getVideoAspect()
|
float StellaLIBRETRO::getVideoAspectPar()
|
||||||
{
|
{
|
||||||
uInt32 width = myOSystem->console().tia().width() * 2;
|
|
||||||
float par;
|
float par;
|
||||||
|
|
||||||
if (getVideoNTSC())
|
if (getVideoNTSC())
|
||||||
{
|
{
|
||||||
if (!video_aspect_ntsc)
|
if (!video_aspect_ntsc)
|
||||||
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
|
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
|
||||||
par = (6.1363635f / 3.579545454f) / 2;
|
par = (6.1363635f / 3.579545454f) / 2.0;
|
||||||
else
|
else
|
||||||
par = video_aspect_ntsc / 100.0;
|
par = video_aspect_ntsc / 100.0;
|
||||||
}
|
}
|
||||||
|
@ -267,13 +266,21 @@ float StellaLIBRETRO::getVideoAspect()
|
||||||
{
|
{
|
||||||
if (!video_aspect_pal)
|
if (!video_aspect_pal)
|
||||||
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
|
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
|
||||||
par = (7.3750000f / (4.43361875f * 4/5)) / 2;
|
par = (7.3750000f / (4.43361875f * 4.0f / 5.0f)) / 2.0f;
|
||||||
else
|
else
|
||||||
par = video_aspect_pal / 100.0;
|
par = video_aspect_pal / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return par;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
float StellaLIBRETRO::getVideoAspect()
|
||||||
|
{
|
||||||
|
uInt32 width = myOSystem->console().tia().width() * 2;
|
||||||
|
|
||||||
// display aspect ratio
|
// display aspect ratio
|
||||||
return (width * par) / getVideoHeight();
|
return (width * getVideoAspectPar()) / getVideoHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -69,6 +69,7 @@ class StellaLIBRETRO
|
||||||
|
|
||||||
bool getConsoleNTSC() { return console_timing == ConsoleTiming::ntsc; }
|
bool getConsoleNTSC() { return console_timing == ConsoleTiming::ntsc; }
|
||||||
|
|
||||||
|
float getVideoAspectPar();
|
||||||
float getVideoAspect();
|
float getVideoAspect();
|
||||||
bool getVideoNTSC();
|
bool getVideoNTSC();
|
||||||
float getVideoRate() { return getVideoNTSC() ? 60.0 : 50.0; }
|
float getVideoRate() { return getVideoNTSC() ? 60.0 : 50.0; }
|
||||||
|
|
|
@ -33,6 +33,7 @@ static int setting_ntsc, setting_pal;
|
||||||
static int setting_stereo, setting_filter, setting_palette;
|
static int setting_stereo, setting_filter, setting_palette;
|
||||||
static int setting_phosphor, setting_console, setting_phosphor_blend;
|
static int setting_phosphor, setting_console, setting_phosphor_blend;
|
||||||
static int stella_paddle_joypad_sensitivity;
|
static int stella_paddle_joypad_sensitivity;
|
||||||
|
static int setting_crop_hoverscan, crop_left;
|
||||||
|
|
||||||
static bool system_reset;
|
static bool system_reset;
|
||||||
|
|
||||||
|
@ -166,7 +167,7 @@ static void update_variables(bool init = false)
|
||||||
#define RETRO_GET(x) \
|
#define RETRO_GET(x) \
|
||||||
var.key = x; \
|
var.key = x; \
|
||||||
var.value = NULL; \
|
var.value = NULL; \
|
||||||
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||||
|
|
||||||
RETRO_GET("stella_filter")
|
RETRO_GET("stella_filter")
|
||||||
{
|
{
|
||||||
|
@ -187,6 +188,13 @@ static void update_variables(bool init = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RETRO_GET("stella_crop_hoverscan")
|
||||||
|
{
|
||||||
|
setting_crop_hoverscan = !strcmp(var.value, "enabled");
|
||||||
|
|
||||||
|
geometry_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
RETRO_GET("stella_ntsc_aspect")
|
RETRO_GET("stella_ntsc_aspect")
|
||||||
{
|
{
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
@ -317,6 +325,8 @@ static void update_variables(bool init = false)
|
||||||
|
|
||||||
if(!init && !system_reset)
|
if(!init && !system_reset)
|
||||||
{
|
{
|
||||||
|
crop_left = setting_crop_hoverscan ? (stella.getVideoZoom() == 2 ? 25 : 8) : 0;
|
||||||
|
|
||||||
if(geometry_update) update_geometry();
|
if(geometry_update) update_geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,21 +339,22 @@ static bool reset_system()
|
||||||
// clean restart
|
// clean restart
|
||||||
stella.destroy();
|
stella.destroy();
|
||||||
|
|
||||||
// apply libretro settings first
|
// apply pre-boot settings first
|
||||||
update_variables(true);
|
update_variables(true);
|
||||||
|
|
||||||
// start system
|
// start system
|
||||||
if(!stella.create(log_cb ? true : false)) return false;
|
if(!stella.create(log_cb ? true : false)) return false;
|
||||||
|
|
||||||
// reset libretro window
|
|
||||||
update_geometry();
|
|
||||||
|
|
||||||
// get auto-detect controllers
|
// get auto-detect controllers
|
||||||
input_type[0] = stella.getLeftControllerType();
|
input_type[0] = stella.getLeftControllerType();
|
||||||
input_type[1] = stella.getRightControllerType();
|
input_type[1] = stella.getRightControllerType();
|
||||||
stella.setPaddleJoypadSensitivity(stella_paddle_joypad_sensitivity);
|
stella.setPaddleJoypadSensitivity(stella_paddle_joypad_sensitivity);
|
||||||
|
|
||||||
system_reset = false;
|
system_reset = false;
|
||||||
|
|
||||||
|
// reset libretro window, apply post-boot settings
|
||||||
|
update_variables(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,13 +400,13 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||||
info->timing.fps = stella.getVideoRate();
|
info->timing.fps = stella.getVideoRate();
|
||||||
info->timing.sample_rate = stella.getAudioRate();
|
info->timing.sample_rate = stella.getAudioRate();
|
||||||
|
|
||||||
info->geometry.base_width = stella.getRenderWidth();
|
info->geometry.base_width = stella.getRenderWidth() - crop_left * (stella.getVideoZoom() == 1 ? 2 : 1);
|
||||||
info->geometry.base_height = stella.getRenderHeight();
|
info->geometry.base_height = stella.getRenderHeight();
|
||||||
|
|
||||||
info->geometry.max_width = stella.getVideoWidthMax();
|
info->geometry.max_width = stella.getVideoWidthMax();
|
||||||
info->geometry.max_height = stella.getVideoHeightMax();
|
info->geometry.max_height = stella.getVideoHeightMax();
|
||||||
|
|
||||||
info->geometry.aspect_ratio = stella.getVideoAspect();
|
info->geometry.aspect_ratio = stella.getVideoAspectPar() * (float) info->geometry.base_width / (float) info->geometry.base_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -439,6 +450,7 @@ void retro_set_environment(retro_environment_t cb)
|
||||||
{ "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted" },
|
{ "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted" },
|
||||||
{ "stella_ntsc_aspect", "NTSC aspect %; par|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85" },
|
{ "stella_ntsc_aspect", "NTSC aspect %; par|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85" },
|
||||||
{ "stella_pal_aspect", "PAL aspect %; par|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103" },
|
{ "stella_pal_aspect", "PAL aspect %; par|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103" },
|
||||||
|
{ "stella_crop_hoverscan", "Crop horizontal overscan; disabled|enabled" },
|
||||||
{ "stella_stereo", "Stereo sound; auto|off|on" },
|
{ "stella_stereo", "Stereo sound; auto|off|on" },
|
||||||
{ "stella_palette", "Palette colors; standard|z26" },
|
{ "stella_palette", "Palette colors; standard|z26" },
|
||||||
{ "stella_phosphor", "Phosphor mode; auto|off|on" },
|
{ "stella_phosphor", "Phosphor mode; auto|off|on" },
|
||||||
|
@ -560,7 +572,7 @@ void retro_run()
|
||||||
//printf("retro_run - %d %d %d - %d\n", stella.getVideoWidth(), stella.getVideoHeight(), stella.getVideoPitch(), stella.getAudioSize() );
|
//printf("retro_run - %d %d %d - %d\n", stella.getVideoWidth(), stella.getVideoHeight(), stella.getVideoPitch(), stella.getAudioSize() );
|
||||||
|
|
||||||
if(stella.getVideoReady())
|
if(stella.getVideoReady())
|
||||||
video_cb(stella.getVideoBuffer(), stella.getVideoWidth(), stella.getVideoHeight(), stella.getVideoPitch());
|
video_cb(reinterpret_cast<uInt32*>(stella.getVideoBuffer()) + crop_left, stella.getVideoWidth() - crop_left, stella.getVideoHeight(), stella.getVideoPitch());
|
||||||
|
|
||||||
if(stella.getAudioReady())
|
if(stella.getAudioReady())
|
||||||
audio_batch_cb(stella.getAudioBuffer(), stella.getAudioSize());
|
audio_batch_cb(stella.getAudioBuffer(), stella.getAudioSize());
|
||||||
|
|
Loading…
Reference in New Issue