shithub: riscv

Download patch

ref: eff2a40c163933b65f016c1a154aa77dacaaef09
parent: feb92fedb1eb041465a4185a114b3441e70cc132
parent: 5a34ad16cd040d163b50dcf7c070968dbd55ac43
author: cinap_lenrek <[email protected]>
date: Sat Mar 28 10:12:35 EDT 2015

merge

--- a/sys/src/games/gba/apu.c
+++ b/sys/src/games/gba/apu.c
@@ -209,7 +209,7 @@
 	s16int s[2];
 	int i;
 	
-	addevent(&evsamp, sratediv + evsamp.time);
+	addevent(&evsamp, sratediv);
 	
 	if(--envctr == 0){
 		envctr = envrel;
--- a/sys/src/games/gba/ev.c
+++ b/sys/src/games/gba/ev.c
@@ -185,9 +185,11 @@
 	Timer *t;
 	u32int v;
 	int to;
+	ulong clock0;
 	
 	t = aux;
-	t->clock = clock + t->time & -(1 << t->sh);
+	clock0 = clock + t->time;
+	t->clock = clock0 & -(1 << t->sh);
 	t->val = -t->time >> t->sh;
 	do{
 		to = 0;
@@ -196,7 +198,7 @@
 			to++;
 		}while(v >= 0x10000);
 		if(t == aux)
-			addevent(t, (0x10000 - t->val << t->sh) + (-clock & (1 << t->sh) - 1));
+			addevent(t, (0x10000 - t->val << t->sh) + (-clock0 & (1 << t->sh) - 1));
 		if((*t->cnt & TIMERIRQ) != 0)
 			setif(IRQTIM0 << t->i);
 		if(t->snd)
--- a/sys/src/games/gba/ppu.c
+++ b/sys/src/games/gba/ppu.c
@@ -733,7 +733,7 @@
 	stat = reg[DISPSTAT];
 	if(hblank){
 		hblclock = clock + evhblank.time;
-		addevent(&evhblank, 240*4 + evhblank.time);
+		addevent(&evhblank, 240*4);
 		hblank = 0;
 		ppux0 = 0;
 		memset(pixpri, VACANT, sizeof(pixpri));
@@ -755,7 +755,7 @@
 	}else{
 		syncppu(240);
 		linecopy();
-		addevent(&evhblank, 68*4 + evhblank.time);
+		addevent(&evhblank, 68*4);
 		hblank = 1;
 		if((stat & IRQHBLEN) != 0)
 			setif(IRQHBL);