Color borders exclusive to NTSC machines

This commit is contained in:
Persune 2022-09-14 13:19:47 +08:00
parent 17e77e2df6
commit a9a6d0b959
No known key found for this signature in database
GPG key ID: 19B8E06A64948FF6
4 changed files with 12 additions and 11 deletions

View file

@ -56,11 +56,12 @@ void NtscFilter::OnBeforeApplyFilter()
}
if (_console->GetModel() == NesModel::NTSC) {
_ntsc_bg = _console->GetPpu()->GetCurrentBgColor();
// BG color borders on NTSC machines
_ntsc_border = _console->GetPpu()->GetCurrentBgColor();
}
else {
// black borders on PAL machines
_ntsc_bg = 15;
// black borders on other machines
_ntsc_border = 15;
}
PictureSettings pictureSettings = _console->GetSettings()->GetPictureSettings();
@ -131,7 +132,7 @@ void NtscFilter::OnBeforeApplyFilter()
void NtscFilter::ApplyFilter(uint16_t *ppuOutputBuffer)
{
nes_ntsc_blit(&_ntscData, ppuOutputBuffer, _ntsc_bg, PPU::ScreenWidth, IsOddFrame() ? 0 : 1, PPU::ScreenWidth, 240, _ntscBuffer, NES_NTSC_OUT_WIDTH(PPU::ScreenWidth)*4);
nes_ntsc_blit(&_ntscData, ppuOutputBuffer, _ntsc_border, PPU::ScreenWidth, IsOddFrame() ? 0 : 1, PPU::ScreenWidth, 240, _ntscBuffer, NES_NTSC_OUT_WIDTH(PPU::ScreenWidth)*4);
GenerateArgbFrame(_ntscBuffer);
}

View file

@ -14,7 +14,7 @@ private:
bool _useExternalPalette = true;
uint8_t _palette[512 * 3];
uint32_t* _ntscBuffer;
uint16_t _ntsc_bg;
uint16_t _ntsc_border;
void GenerateArgbFrame(uint32_t *outputBuffer);

View file

@ -235,7 +235,7 @@ void nes_ntsc_init( nes_ntsc_t* ntsc, nes_ntsc_setup_t const* setup )
#ifndef NES_NTSC_NO_BLITTERS
void nes_ntsc_blit( nes_ntsc_t const* ntsc, NES_NTSC_IN_T const* input, NES_NTSC_IN_T ntsc_bg, long in_row_width,
void nes_ntsc_blit( nes_ntsc_t const* ntsc, NES_NTSC_IN_T const* input, NES_NTSC_IN_T ntsc_border, long in_row_width,
int burst_phase, int in_width, int in_height, void* rgb_out, long out_pitch )
{
int chunk_count = (in_width - 1) / nes_ntsc_in_chunk;
@ -243,7 +243,7 @@ void nes_ntsc_blit( nes_ntsc_t const* ntsc, NES_NTSC_IN_T const* input, NES_NTSC
{
NES_NTSC_IN_T const* line_in = input;
NES_NTSC_BEGIN_ROW( ntsc, burst_phase,
ntsc_bg, ntsc_bg, NES_NTSC_ADJ_IN( *line_in ) );
ntsc_border, ntsc_border, NES_NTSC_ADJ_IN( *line_in ) );
nes_ntsc_out_t* restrict line_out = (nes_ntsc_out_t*) rgb_out;
int n;
++line_in;
@ -269,15 +269,15 @@ void nes_ntsc_blit( nes_ntsc_t const* ntsc, NES_NTSC_IN_T const* input, NES_NTSC
}
/* finish final pixels */
NES_NTSC_COLOR_IN( 0, ntsc_bg);
NES_NTSC_COLOR_IN( 0, ntsc_border);
NES_NTSC_RGB_OUT( 0, line_out [0], NES_NTSC_OUT_DEPTH );
NES_NTSC_RGB_OUT( 1, line_out [1], NES_NTSC_OUT_DEPTH );
NES_NTSC_COLOR_IN( 1, ntsc_bg);
NES_NTSC_COLOR_IN( 1, ntsc_border);
NES_NTSC_RGB_OUT( 2, line_out [2], NES_NTSC_OUT_DEPTH );
NES_NTSC_RGB_OUT( 3, line_out [3], NES_NTSC_OUT_DEPTH );
NES_NTSC_COLOR_IN( 2, ntsc_bg);
NES_NTSC_COLOR_IN( 2, ntsc_border);
NES_NTSC_RGB_OUT( 4, line_out [4], NES_NTSC_OUT_DEPTH );
NES_NTSC_RGB_OUT( 5, line_out [5], NES_NTSC_OUT_DEPTH );
NES_NTSC_RGB_OUT( 6, line_out [6], NES_NTSC_OUT_DEPTH );

View file

@ -68,7 +68,7 @@ In_row_width is the number of pixels to get to the next input row. Out_pitch
is the number of *bytes* to get to the next output row. Output pixel format
is set by NES_NTSC_OUT_DEPTH (defaults to 16-bit RGB). */
EXPORT void nes_ntsc_blit( nes_ntsc_t const* ntsc, NES_NTSC_IN_T const* nes_in,
NES_NTSC_IN_T ntsc_bg, long in_row_width, int burst_phase, int in_width,
NES_NTSC_IN_T ntsc_border, long in_row_width, int burst_phase, int in_width,
int in_height, void* rgb_out, long out_pitch );
/* Number of output pixels written by blitter for given input width. Width might