Skip to content

Commit 441de3b

Browse files
committed
don't over-stretch lowres lines during frameskip
fixes #92
1 parent 166dabd commit 441de3b

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

bsnes/snes/alt/ppu-compatibility/ppu.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
6666
void layer_enable(unsigned layer, unsigned priority, bool enable);
6767
unsigned frameskip;
6868
unsigned framecounter;
69+
bool frame_skipped() const { return framecounter > 0; }
6970
unsigned get_frameskip() const { return frameskip; }
7071
void set_frameskip(unsigned frameskip);
7172

bsnes/snes/alt/ppu-performance/ppu.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
1919
void frame();
2020

2121
void layer_enable(unsigned layer, unsigned priority, bool enable);
22+
bool frame_skipped() const { return display.framecounter > 0; }
2223
unsigned get_frameskip() const { return display.frameskip; }
2324
void set_frameskip(unsigned frameskip);
2425

bsnes/snes/ppu/ppu.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
1717
void reset();
1818

1919
void layer_enable(unsigned, unsigned, bool) {}
20+
bool frame_skipped() const { return false; }
2021
unsigned get_frameskip() const { return 0; }
2122
void set_frameskip(unsigned) {}
2223

bsnes/snes/video/video.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ void Video::update() {
6060

6161
if(frame_hires) {
6262
width <<= 1;
63-
//normalize line widths
64-
for(unsigned y = 0; y < 240; y++) {
65-
if(line_width[y] == 512) continue;
66-
uint16_t *buffer = data + y * 1024;
67-
for(signed x = 255; x >= 0; x--) {
68-
buffer[(x * 2) + 0] = buffer[(x * 2) + 1] = buffer[x];
63+
if(!ppu.frame_skipped()) {
64+
//normalize line widths
65+
for(unsigned y = 0; y < 240; y++) {
66+
if(line_width[y] == 512) continue;
67+
uint16_t *buffer = data + y * 1024;
68+
for(signed x = 255; x >= 0; x--) {
69+
buffer[(x * 2) + 0] = buffer[(x * 2) + 1] = buffer[x];
70+
}
6971
}
7072
}
7173
}

bsnes/ui-qt/input/userinterface-emulationspeed.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct Speedup : HotkeyInput {
5656

5757
void pressed() {
5858
if(SNES::PPU::SupportsFrameSkip) {
59-
frameskip = SNES::ppu.get_frameskip();
59+
frameskip = SNES::ppu.get_frameskip();
6060
SNES::ppu.set_frameskip(9);
6161
}
6262

0 commit comments

Comments
 (0)