Merge pull request #43 from Monroe88/patch-1

Aspect ratio and overscan changes
This commit is contained in:
Twinaphex
2016-08-12 03:22:41 +02:00
committed by GitHub

View File

@@ -26,6 +26,9 @@
#include "libretro-common/include/streams/memory_stream.h"
#define NES_8_7_PAR (width * (8.0 / 7.0)) / height
#define NES_4_3 4.0 / 3.0
#if defined(_3DS)
void* linearMemAlign(size_t size, size_t alignment);
void linearFree(void* mem);
@@ -38,6 +41,7 @@ static retro_audio_sample_batch_t audio_batch_cb = NULL;
static retro_environment_t environ_cb = NULL;
static bool use_overscan;
static bool use_raw_palette;
static bool use_par;
/* emulator-specific variables */
@@ -548,6 +552,8 @@ void retro_set_environment(retro_environment_t cb)
{ "fceumm_palette", "Color Palette; asqrealc|loopy|quor|chris|matt|pasofami|crashman|mess|zaphod-cv|zaphod-smb|vs-drmar|vs-cv|vs-smb|nintendo-vc|yuv-v3|unsaturated-v5|sony-cxa2025as-us|pal|raw" },
{ "fceumm_nospritelimit", "No Sprite Limit; disabled|enabled" },
{ "fceumm_overclocking", "Overclocking; disabled|2x" },
{ "fceumm_overscan", "Crop Overscan; enabled|disabled" },
{ "fceumm_aspect", "Core-provided aspect ratio; 8:7 PAR|4:3" },
{ NULL, NULL },
};
@@ -572,7 +578,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.base_height = height;
info->geometry.max_width = width;
info->geometry.max_height = height;
info->geometry.aspect_ratio = 4.0 / 3.0;
info->geometry.aspect_ratio = use_par ? NES_8_7_PAR : NES_4_3;
info->timing.sample_rate = 32050.0;
if (FSettings.PAL)
info->timing.fps = 838977920.0/16777215.0;
@@ -689,6 +695,8 @@ static void check_variables(void)
{
static int overclock_state = -1;
struct retro_variable var = {0};
struct retro_system_av_info av_info;
bool geometry_update = false;
var.key = "fceumm_palette";
@@ -780,6 +788,36 @@ static void check_variables(void)
FCEU_InitVirtualVideo();
}
}
var.key = "fceumm_overscan";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bool newval = (!strcmp(var.value, "disabled"));
if (newval != use_overscan)
{
use_overscan = newval;
geometry_update = true;
}
}
var.key = "fceumm_aspect";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bool newval = (!strcmp(var.value, "8:7 PAR"));
if (newval != use_par)
{
use_par = newval;
geometry_update = true;
}
}
if (geometry_update)
{
retro_get_system_av_info(&av_info);
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
}
}
/*
@@ -1424,9 +1462,6 @@ bool retro_load_game(const struct retro_game_info *game)
FCEUD_SoundToggle();
check_variables();
if (!environ_cb(RETRO_ENVIRONMENT_GET_OVERSCAN, &use_overscan))
use_overscan = true;
FCEUI_DisableFourScore(1);
for (i = 0; i < fourscore_len; i++)