shithub: riscv

Download patch

ref: 5b7ebd7be30cbd89fbfd6fdeb85bd84c1ac61f86
parent: da62091c0765ca8994d558f1339dad7c2223a95e
author: aiju <devnull@localhost>
date: Wed Mar 19 05:04:25 EDT 2014

games/snes: fixed large sprite scrolling bug

--- a/sys/src/games/snes/ppu.c
+++ b/sys/src/games/snes/ppu.c
@@ -616,6 +616,14 @@
 			a = sp->t0 | (dy & 7) << 1;
 			if(dy >= 8)
 				a += (dy & ~7) << 6;
+			if(sp->x < 0 && (i = (-sp->x >> 3)) != 0){
+				if((sp->c & 0x40) != 0)
+					a -= i << 5;
+				else
+					a += i << 5;
+				nt -= i;
+				tp->sx += i << 3;
+			}
 			if((sp->c & 0x40) != 0){
 				a += sp->sx * 4;
 				for(i = 0; i < nt; i++){
@@ -642,6 +650,11 @@
 					}else
 						over |= 0x80;
 				}
+			if(sp->x < 0 && (i = (-sp->x) & 7) != 0)
+				if((sp->c & 0x40) != 0)
+					*tp->ch >>= i;
+				else
+					*tp->ch <<= i;
 		}
 		reg[0x213e] = over;
 	}