shithub: riscv

Download patch

ref: 74778941ed75b0a548d6f00e825d6d56bb5722d8
parent: 744f038e86aef8f30b3c7abead3be5d30e163a2c
author: aiju <devnull@localhost>
date: Sat Mar 15 18:27:14 EDT 2014

games/snes: small mode 7 fix

--- a/sys/src/games/snes/ppu.c
+++ b/sys/src/games/snes/ppu.c
@@ -366,8 +366,11 @@
 		if(p->msz != 1)
 			y -= y % p->msz;
 	}
-	if(n == 1 && (reg[MOSAIC] & 2) != 0)
-		p->msz = (reg[MOSAIC] >> 4) + 1;
+	if(n == 1)
+		if((reg[MOSAIC] & 2) != 0)
+			p->msz = (reg[MOSAIC] >> 4) + 1;
+		else
+			p->msz = 1;
 	if((m & 2) != 0)
 		y = 255 - y;
 	p->x = b7->x0 + ((m7[M7B] * y) & ~63);
@@ -412,12 +415,13 @@
 		if(++p->mx == p->msz)
 			p->mx = 0;
 	}
-	if(n == 1)
-		if((v & 0x80) != 0)
-			pixel(1, v & 0x7f, 0x71);
-		else
-			pixel(1, v, 0x11);
-	else
+	if(n == 1){
+		if((v & 0x7f) != 0)
+			if((v & 0x80) != 0)
+				pixel(1, v & 0x7f, 0x71);
+			else
+				pixel(1, v, 0x11);
+	}else if(v != 0)
 		pixel(0, v, 0x40);
 	if((m & 1) != 0){
 		p->x -= m7[M7A];