Rename overscan-related variables

- Rename overscan options to something more readable
- Fixes PSP overscan option logic where some places where the option is reversed
This commit is contained in:
negativeExponent
2020-10-02 19:24:00 +08:00
parent 47f84dea99
commit 6e1d873846

View File

@@ -69,10 +69,10 @@ static retro_input_state_t input_cb = NULL;
static retro_audio_sample_batch_t audio_batch_cb = NULL; static retro_audio_sample_batch_t audio_batch_cb = NULL;
retro_environment_t environ_cb = NULL; retro_environment_t environ_cb = NULL;
#ifdef PSP #ifdef PSP
static bool use_overscan; static bool crop_overscan;
#else #else
static bool overscan_h; static bool crop_overscan_h;
static bool overscan_v; static bool crop_overscan_v;
#endif #endif
static bool use_raw_palette; static bool use_raw_palette;
@@ -965,11 +965,11 @@ void retro_get_system_info(struct retro_system_info *info)
void retro_get_system_av_info(struct retro_system_av_info *info) void retro_get_system_av_info(struct retro_system_av_info *info)
{ {
#ifdef PSP #ifdef PSP
unsigned width = NES_WIDTH - (use_overscan ? 16 : 0); unsigned width = NES_WIDTH - (crop_overscan ? 16 : 0);
unsigned height = NES_HEIGHT - (use_overscan ? 16 : 0); unsigned height = NES_HEIGHT - (crop_overscan ? 16 : 0);
#else #else
unsigned width = NES_WIDTH - (overscan_h ? 16 : 0); unsigned width = NES_WIDTH - (crop_overscan_h ? 16 : 0);
unsigned height = NES_HEIGHT - (overscan_v ? 16 : 0); unsigned height = NES_HEIGHT - (crop_overscan_v ? 16 : 0);
#endif #endif
#ifdef HAVE_NTSC_FILTER #ifdef HAVE_NTSC_FILTER
info->geometry.base_width = (use_ntsc ? NES_NTSC_OUT_WIDTH(width) : width); info->geometry.base_width = (use_ntsc ? NES_NTSC_OUT_WIDTH(width) : width);
@@ -1325,10 +1325,10 @@ static void check_variables(bool startup)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{ {
bool newval = (!strcmp(var.value, "disabled")); bool newval = (!strcmp(var.value, "enabled"));
if (newval != use_overscan) if (newval != crop_overscan)
{ {
use_overscan = newval; crop_overscan = newval;
audio_video_updated = 1; audio_video_updated = 1;
} }
} }
@@ -1339,9 +1339,9 @@ static void check_variables(bool startup)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{ {
bool newval = (!strcmp(var.value, "enabled")); bool newval = (!strcmp(var.value, "enabled"));
if (newval != overscan_h) if (newval != crop_overscan_h)
{ {
overscan_h = newval; crop_overscan_h = newval;
audio_video_updated = 1; audio_video_updated = 1;
} }
} }
@@ -1351,9 +1351,9 @@ static void check_variables(bool startup)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{ {
bool newval = (!strcmp(var.value, "enabled")); bool newval = (!strcmp(var.value, "enabled"));
if (newval != overscan_v) if (newval != crop_overscan_v)
{ {
overscan_v = newval; crop_overscan_v = newval;
audio_video_updated = 1; audio_video_updated = 1;
} }
} }
@@ -1544,10 +1544,10 @@ void get_mouse_input(unsigned port, uint32_t *zapdata)
int min_width, min_height, max_width, max_height; int min_width, min_height, max_width, max_height;
#ifdef PSP #ifdef PSP
adjx = adjy = use_overscan ? 1 : 0; adjx = adjy = crop_overscan ? 1 : 0;
#else #else
adjx = overscan_h ? 1 : 0; adjx = crop_overscan_h ? 1 : 0;
adjy = overscan_v ? 1 : 0; adjy = crop_overscan_v ? 1 : 0;
#endif #endif
max_width = 256; max_width = 256;
max_height = 240; max_height = 240;
@@ -1780,7 +1780,7 @@ static void retro_run_blit(uint8_t *gfx)
unsigned pitch = 512; unsigned pitch = 512;
#ifdef PSP #ifdef PSP
if (!use_overscan) if (crop_overscan)
{ {
width -= 16; width -= 16;
height -= 16; height -= 16;
@@ -1796,10 +1796,10 @@ static void retro_run_blit(uint8_t *gfx)
* so we use GU_PSM_4444 ( 2 Bytes per pixel ) instead * so we use GU_PSM_4444 ( 2 Bytes per pixel ) instead
* with half the values for pitch / width / x offset * with half the values for pitch / width / x offset
*/ */
if (use_overscan) if (crop_overscan)
sceGuCopyImage(GU_PSM_4444, 0, 0, 128, 240, 128, XBuf, 0, 0, 128, texture_vram_p);
else
sceGuCopyImage(GU_PSM_4444, 4, 4, 120, 224, 128, XBuf, 0, 0, 128, texture_vram_p); sceGuCopyImage(GU_PSM_4444, 4, 4, 120, 224, 128, XBuf, 0, 0, 128, texture_vram_p);
else
sceGuCopyImage(GU_PSM_4444, 0, 0, 128, 240, 128, XBuf, 0, 0, 128, texture_vram_p);
sceGuTexSync(); sceGuTexSync();
sceGuTexImage(0, 256, 256, 256, texture_vram_p); sceGuTexImage(0, 256, 256, 256, texture_vram_p);
@@ -1832,10 +1832,10 @@ static void retro_run_blit(uint8_t *gfx)
ps2->coreTexture->PSM = GS_PSM_T8; ps2->coreTexture->PSM = GS_PSM_T8;
ps2->coreTexture->ClutPSM = GS_PSM_CT16; ps2->coreTexture->ClutPSM = GS_PSM_CT16;
ps2->coreTexture->Filter = GS_FILTER_LINEAR; ps2->coreTexture->Filter = GS_FILTER_LINEAR;
ps2->padding = (struct retro_hw_ps2_insets){ overscan_v ? 8.0f : 0.0f, ps2->padding = (struct retro_hw_ps2_insets){ crop_overscan_v ? 8.0f : 0.0f,
overscan_h ? 8.0f : 0.0f, crop_overscan_h ? 8.0f : 0.0f,
overscan_v ? 8.0f : 0.0f, crop_overscan_v ? 8.0f : 0.0f,
overscan_h ? 8.0f : 0.0f}; crop_overscan_h ? 8.0f : 0.0f};
} }
ps2->coreTexture->Clut = (u32*)retro_palette; ps2->coreTexture->Clut = (u32*)retro_palette;
@@ -1854,14 +1854,14 @@ static void retro_run_blit(uint8_t *gfx)
NES_WIDTH, burst_phase, NES_WIDTH, NES_HEIGHT, NES_WIDTH, burst_phase, NES_WIDTH, NES_HEIGHT,
ntsc_video_out, NES_NTSC_WIDTH * sizeof(uint16)); ntsc_video_out, NES_NTSC_WIDTH * sizeof(uint16));
width = NES_WIDTH - (overscan_h ? 16 : 0); width = NES_WIDTH - (crop_overscan_h ? 16 : 0);
width = NES_NTSC_OUT_WIDTH(width); width = NES_NTSC_OUT_WIDTH(width);
height = NES_HEIGHT - (overscan_v ? 16 : 0); height = NES_HEIGHT - (crop_overscan_v ? 16 : 0);
pitch = width * sizeof(uint16_t); pitch = width * sizeof(uint16_t);
{ {
int32_t h_offset = overscan_h ? NES_NTSC_OUT_WIDTH(8) : 0; int32_t h_offset = crop_overscan_h ? NES_NTSC_OUT_WIDTH(8) : 0;
int32_t v_offset = overscan_v ? 8 : 0; int32_t v_offset = crop_overscan_v ? 8 : 0;
const uint16_t *in = ntsc_video_out + h_offset + NES_NTSC_WIDTH * v_offset; const uint16_t *in = ntsc_video_out + h_offset + NES_NTSC_WIDTH * v_offset;
uint16_t *out = fceu_video_out; uint16_t *out = fceu_video_out;
@@ -1877,11 +1877,11 @@ static void retro_run_blit(uint8_t *gfx)
else else
#endif /* HAVE_NTSC_FILTER */ #endif /* HAVE_NTSC_FILTER */
{ {
incr += (overscan_h ? 16 : 0); incr += (crop_overscan_h ? 16 : 0);
width -= (overscan_h ? 16 : 0); width -= (crop_overscan_h ? 16 : 0);
height -= (overscan_v ? 16 : 0); height -= (crop_overscan_v ? 16 : 0);
pitch -= (overscan_h ? 32 : 0); pitch -= (crop_overscan_h ? 32 : 0);
gfx += (overscan_v ? ((overscan_h ? 8 : 0) + 256 * 8) : (overscan_h ? 8 : 0)); gfx += (crop_overscan_v ? ((crop_overscan_h ? 8 : 0) + 256 * 8) : (crop_overscan_h ? 8 : 0));
if (use_raw_palette) if (use_raw_palette)
{ {