foxygit / fake-08-xbox360 Log in
commit 7b49a468036da20ab30f28c96c3531764e192b7c
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Wed Jun 23 17:18:57 2021 -0600
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Wed Jun 23 17:18:57 2021 -0600

    Fix for color bitmask
---
 source/graphics.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/graphics.cpp b/source/graphics.cpp
index 2378e2c..4f3c3de 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -410,7 +410,7 @@ void Graphics::_setPixelFromSprite(int x, int y, uint8_t col) {
 	uint8_t writeMask = _memory->hwState.colorBitmask & 15;
 	uint8_t readMask = _memory->hwState.colorBitmask >> 4;
     uint8_t source = pget(x, y);
-    col = (col & writeMask) | (source & ~writeMask & readMask);
+    col = (source & ~writeMask) | (col & writeMask & readMask);

 	setPixelNibble(x, y, col, _memory->screenBuffer);
 }
@@ -449,7 +449,7 @@ void Graphics::_setPixelFromPen(int x, int y) {
 	uint8_t writeMask = _memory->hwState.colorBitmask & 15;
 	uint8_t readMask = _memory->hwState.colorBitmask >> 4;
     uint8_t source = pget(x, y);
-    finalC = (finalC & writeMask) | (source & ~writeMask & readMask);
+    finalC = (source & ~writeMask) | (finalC & writeMask & readMask);

 	setPixelNibble(x, y, finalC, _memory->screenBuffer);
 }