Fixed background color in mario 1 (mirroring issue), Temp fix for colors in general (R & B were inverted)

This commit is contained in:
Souryo 2014-06-19 08:03:08 -04:00
parent e49286e42b
commit 31f9116b60
2 changed files with 9 additions and 3 deletions

View File

@ -121,6 +121,9 @@ uint8_t MemoryManager::ReadVRAM(uint16_t addr)
} else {
if(addr >= 0x3F00) {
addr &= 0x3F1F;
if(addr == 0x3F10 || addr == 0x3F14 || addr == 0x3F18 || addr == 0x3F1C) {
addr &= ~0x0010;
}
}
return _videoRAM[addr & 0x3FFF];
}
@ -134,6 +137,9 @@ void MemoryManager::WriteVRAM(uint16_t addr, uint8_t value)
} else {
if(addr >= 0x3F00) {
addr &= 0x3F1F;
if(addr == 0x3F10 || addr == 0x3F14 || addr == 0x3F18 || addr == 0x3F1C) {
addr &= ~0x0010;
}
//std::cout << "palette:" << std::hex << (short)addr << " = " << (short)value << std::endl;
}
if(addr == 0x2000) {

View File

@ -301,7 +301,8 @@ void PPU::DrawPixel()
//p->palettebuffer[fbRow].color = PPU_PALETTE_RGB[palette % 64];
uint32_t bufferPosition = _scanline * 256 + _cycle;
((uint32_t*)_outputBuffer)[bufferPosition] = PPU_PALETTE_RGB[palette % 64] | (0xFF << 24);
uint32_t paletteColor = PPU_PALETTE_RGB[palette % 64];
((uint32_t*)_outputBuffer)[bufferPosition] = (paletteColor & 0xFF00) | ((paletteColor & 0xFF) << 16) | ((paletteColor & 0xFF0000) >> 16) | (0xFF << 24);
//p->palettebuffer[fbRow].value = pixel;
//p->palettebuffer[fbRow].pindex = -1;
}
@ -315,8 +316,7 @@ void PPU::ProcessVisibleScanline()
LoadShiftRegisters();
LoadTileInfo();
}
if(_cycle > 0 && _cycle <= 255) {
DrawPixel();
}