Skip to content

Commit

Permalink
don't over-stretch lowres lines during frameskip
Browse files Browse the repository at this point in the history
fixes #92
  • Loading branch information
devinacker committed Dec 18, 2016
1 parent 166dabd commit 441de3b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions bsnes/snes/alt/ppu-compatibility/ppu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
void layer_enable(unsigned layer, unsigned priority, bool enable);
unsigned frameskip;
unsigned framecounter;
bool frame_skipped() const { return framecounter > 0; }
unsigned get_frameskip() const { return frameskip; }
void set_frameskip(unsigned frameskip);

Expand Down
1 change: 1 addition & 0 deletions bsnes/snes/alt/ppu-performance/ppu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
void frame();

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

Expand Down
1 change: 1 addition & 0 deletions bsnes/snes/ppu/ppu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PPU : public Processor, public PPUcounter, public MMIO {
void reset();

void layer_enable(unsigned, unsigned, bool) {}
bool frame_skipped() const { return false; }
unsigned get_frameskip() const { return 0; }
void set_frameskip(unsigned) {}

Expand Down
14 changes: 8 additions & 6 deletions bsnes/snes/video/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ void Video::update() {

if(frame_hires) {
width <<= 1;
//normalize line widths
for(unsigned y = 0; y < 240; y++) {
if(line_width[y] == 512) continue;
uint16_t *buffer = data + y * 1024;
for(signed x = 255; x >= 0; x--) {
buffer[(x * 2) + 0] = buffer[(x * 2) + 1] = buffer[x];
if(!ppu.frame_skipped()) {
//normalize line widths
for(unsigned y = 0; y < 240; y++) {
if(line_width[y] == 512) continue;
uint16_t *buffer = data + y * 1024;
for(signed x = 255; x >= 0; x--) {
buffer[(x * 2) + 0] = buffer[(x * 2) + 1] = buffer[x];
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bsnes/ui-qt/input/userinterface-emulationspeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct Speedup : HotkeyInput {

void pressed() {
if(SNES::PPU::SupportsFrameSkip) {
frameskip = SNES::ppu.get_frameskip();
frameskip = SNES::ppu.get_frameskip();
SNES::ppu.set_frameskip(9);
}

Expand Down

0 comments on commit 441de3b

Please sign in to comment.