shithub: riscv

Download patch

ref: d65589c29941b16a5239f6f2e9c8f6fea5c863a2
parent: 080a7b01bfa0fb89951cf4e30070dc7665992c90
author: qwx <qwx@sciops.net>
date: Sat Jan 21 13:13:10 EST 2023

games/dmid: update for opl3 streaming

--- a/sys/src/games/dmid.c
+++ b/sys/src/games/dmid.c
@@ -450,24 +450,6 @@
 }
 
 void
-tproc(void *)
-{
-	uvlong t, Δt;
-	uchar u[4];
-	Trk x;
-
-	x.e = u + sizeof u;
-	t = nsec();
-	for(;;){
-		putcmd(0, 0, 1);
-		t += 10000000 / (Rate / 100);
-		Δt = (t - nsec()) / 1000000;
-		if(Δt > 0)
-			sleep(Δt);
-	}
-}
-
-void
 readinst(char *file)
 {
 	int n;
@@ -581,14 +563,11 @@
 	putcmd(Rop3, 1, 0);
 	trace = debug;
 	if(stream){
-		if(proccreate(tproc, nil, mainstacksize) < 0)
-			sysfatal("proccreate: %r");
 		for(;;){
 			getvar(nil);
 			if(ev(nil, 0) < 0)
-				break;
+				threadexits(nil);
 		}
-		threadexitsall(n < 0 ? "read: %r" : nil);
 	}
 	for(end=0; !end;){
 		end = 1;