mirror of https://github.com/bsnes-emu/bsnes.git
Mosaic cleanups.
This commit is contained in:
parent
fb463d34ef
commit
702977f0b9
|
@ -33,7 +33,7 @@ auto PPU::Line::renderBackground(PPU::IO::Background& self, uint8 source) -> voi
|
|||
hscroll <<= 1;
|
||||
if(io.interlace) {
|
||||
y = y << 1 | field();
|
||||
if(self.mosaicEnable) y -= io.mosaic.size - io.mosaic.counter + ppu.field();
|
||||
if(self.mosaicEnable) y -= io.mosaic.size - io.mosaic.counter + field();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -248,14 +248,13 @@ auto PPU::writeIO(uint address, uint8 data) -> void {
|
|||
}
|
||||
|
||||
case 0x2106: { //MOSAIC
|
||||
bool enable = io.bg1.mosaicEnable || io.bg2.mosaicEnable || io.bg3.mosaicEnable || io.bg4.mosaicEnable;
|
||||
bool mosaicEnable = io.bg1.mosaicEnable || io.bg2.mosaicEnable || io.bg3.mosaicEnable || io.bg4.mosaicEnable;
|
||||
io.bg1.mosaicEnable = data >> 0 & 1;
|
||||
io.bg2.mosaicEnable = data >> 1 & 1;
|
||||
io.bg3.mosaicEnable = data >> 2 & 1;
|
||||
io.bg4.mosaicEnable = data >> 3 & 1;
|
||||
io.mosaic.enable = data >> 0 & 15;
|
||||
io.mosaic.size = (data >> 4 & 15) + 1;
|
||||
if(!enable && (data >> 0 & 15)) {
|
||||
if(!mosaicEnable && (data >> 0 & 15)) {
|
||||
//mosaic vcounter is reloaded when mosaic becomes enabled
|
||||
io.mosaic.counter = io.mosaic.size + 1;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,6 @@ auto PPU::Line::flush() -> void {
|
|||
|
||||
auto PPU::Line::cache() -> void {
|
||||
uint y = ppu.vcounter();
|
||||
if(y == 1) {
|
||||
ppu.io.mosaic.counter = ppu.io.mosaic.enable ? ppu.io.mosaic.size + 1 : 0;
|
||||
}
|
||||
if(ppu.io.mosaic.counter && !--ppu.io.mosaic.counter) {
|
||||
ppu.io.mosaic.counter = ppu.io.mosaic.enable ? ppu.io.mosaic.size + 0 : 0;
|
||||
}
|
||||
if(ppu.io.displayDisable || y >= ppu.vdisp()) {
|
||||
io.displayDisable = true;
|
||||
} else {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
auto PPU::Line::renderMode7(PPU::IO::Background& self, uint8 source) -> void {
|
||||
//HD mode 7 support
|
||||
if(!ppu.hdMosaic() || !self.mosaicEnable || !io.mosaic.size) {
|
||||
if(!ppu.hdMosaic() || !self.mosaicEnable || io.mosaic.size == 1) {
|
||||
if(ppu.hdScale() > 1) return renderMode7HD(self, source);
|
||||
}
|
||||
|
||||
int Y = this->y;
|
||||
if(self.mosaicEnable) Y -= io.mosaic.size - io.mosaic.counter;
|
||||
int y = !io.mode7.vflip ? Y : 255 - Y;
|
||||
if(self.mosaicEnable) y -= io.mosaic.size - io.mosaic.counter;
|
||||
|
||||
int a = (int16)io.mode7.a;
|
||||
int b = (int16)io.mode7.b;
|
||||
|
|
|
@ -85,6 +85,13 @@ auto PPU::main() -> void {
|
|||
uint y = vcounter();
|
||||
if(y >= 1 && y <= 239) {
|
||||
step(renderCycle());
|
||||
bool mosaicEnable = io.bg1.mosaicEnable || io.bg2.mosaicEnable || io.bg3.mosaicEnable || io.bg4.mosaicEnable;
|
||||
if(y == 1) {
|
||||
io.mosaic.counter = mosaicEnable ? io.mosaic.size + 1 : 0;
|
||||
}
|
||||
if(io.mosaic.counter && !--io.mosaic.counter) {
|
||||
io.mosaic.counter = mosaicEnable ? io.mosaic.size + 0 : 0;
|
||||
}
|
||||
lines[y].cache();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ public:
|
|||
//serialization.cpp
|
||||
auto serialize(serializer&) -> void;
|
||||
|
||||
uint8 enable = 0;
|
||||
uint8 size = 1;
|
||||
uint8 counter = 0;
|
||||
} mosaic;
|
||||
|
|
|
@ -69,7 +69,6 @@ auto PPU::IO::serialize(serializer& s) -> void {
|
|||
}
|
||||
|
||||
auto PPU::IO::Mosaic::serialize(serializer& s) -> void {
|
||||
s.integer(enable);
|
||||
s.integer(size);
|
||||
s.integer(counter);
|
||||
}
|
||||
|
|
|
@ -262,15 +262,16 @@ auto PPU::writeIO(uint addr, uint8 data) -> void {
|
|||
|
||||
//MOSAIC
|
||||
case 0x2106: {
|
||||
if(!mosaic.enable() && (data >> 0 & 15)) {
|
||||
//mosaic vcounter is reloaded when mosaic becomes enabled
|
||||
mosaic.vcounter = (data >> 4 & 15) + 2;
|
||||
}
|
||||
bool mosaicEnable = mosaic.enable();
|
||||
bg1.mosaic.enable = data >> 0 & 1;
|
||||
bg2.mosaic.enable = data >> 1 & 1;
|
||||
bg3.mosaic.enable = data >> 2 & 1;
|
||||
bg4.mosaic.enable = data >> 3 & 1;
|
||||
mosaic.size = (data >> 4 & 15) + 1;
|
||||
if(!mosaicEnable && mosaic.enable()) {
|
||||
//mosaic vcounter is reloaded when mosaic becomes enabled
|
||||
mosaic.vcounter = mosaic.size + 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue