Skip to content

Commit

Permalink
sfc: don't line-double non-interlaced content
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeUsher committed Jan 27, 2025
1 parent 2d714d1 commit 4c367fd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ares/sfc/ppu-performance/dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ auto PPU::DAC::render() -> void {
auto vcounter = self.vcounter();
auto output = (n32*)self.screen->pixels().data();

//PAL systems have additional vertical border
if(Region::PAL()) output += 40 * 564;

if(!self.state.overscan) vcounter += 8;
if(vcounter < 240) {
output += vcounter * 2 * 564;
auto yScale = self.interlace() ? 2 : 1;
output += vcounter * yScale * 564;
//PAL systems have additional vertical border
if(Region::PAL()) output += (20 * yScale) * 564;
if(self.interlace() && self.field()) output += 564;

//Offset for horizontal border
Expand Down
12 changes: 7 additions & 5 deletions ares/sfc/ppu-performance/ppu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ auto PPU::main() -> void {
}

if(vcounter() == 240) {
if(state.interlace == 0) screen->setProgressive(1);
if(state.interlace == 0) screen->setProgressive(0);
if(state.interlace == 1) screen->setInterlace(field());
auto yScale = state.interlace ? 2 : 1;
screen->setScale(0.5, 1.0 / yScale);

if(screen->overscan()) {
screen->setSize(564, height() * 2);
screen->setViewport(0, 0, 564, height() * 2);
screen->setSize(564, height() * yScale);
screen->setViewport(0, 0, 564, height() * yScale);
} else {
int x = 26;
int y = 18;
Expand All @@ -105,8 +107,8 @@ auto PPU::main() -> void {
}
}

screen->setSize(w, h * 2);
screen->setViewport(x, y, w, h * 2);
screen->setSize(w, h * yScale);
screen->setViewport(x, y, w, h * yScale);
}

screen->frame();
Expand Down
5 changes: 3 additions & 2 deletions ares/sfc/ppu/dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ auto PPU::DAC::scanline() -> void {
auto output = self.screen->pixels().data();
if(!self.overscan()) vcounter += 8;
if(vcounter < 240) {
line = output + vcounter * 2 * 564;
auto yScale = self.interlace() ? 2 : 1;
line = output + vcounter * yScale * 564;
//PAL systems have additional vertical border
if(Region::PAL()) line += 40 * 564;
if(Region::PAL()) line += (20 * yScale) * 564;
if(self.interlace() && self.field()) line += 564;

//Offset for horizontal border
Expand Down
12 changes: 7 additions & 5 deletions ares/sfc/ppu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ auto PPU::main() -> void {
dac.scanline();

if(vcounter() == 240) {
if(state.interlace == 0) screen->setProgressive(1);
if(state.interlace == 0) screen->setProgressive(0);
if(state.interlace == 1) screen->setInterlace(field());
auto yScale = state.interlace ? 2 : 1;
screen->setScale(0.5, 1.0 / yScale);

if(screen->overscan()) {
screen->setSize(564, height() * 2);
screen->setViewport(0, 0, 564, height() * 2);
screen->setSize(564, height() * yScale);
screen->setViewport(0, 0, 564, height() * yScale);
} else {
int x = 26;
int y = 18;
Expand All @@ -42,8 +44,8 @@ auto PPU::main() -> void {
}
}

screen->setSize(w, h * 2);
screen->setViewport(x, y, w, h * 2);
screen->setSize(w, h * yScale);
screen->setViewport(x, y, w, h * yScale);
}

screen->frame();
Expand Down

0 comments on commit 4c367fd

Please sign in to comment.