From 50b13be9826da8433b39bd7d02cce2422f91cf0c Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 18 Jul 2012 23:49:47 +0300 Subject: [PATCH] cdrom: mask selector bits correctly --- libpcsxcore/cdrom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index fa0e6a9f..87855985 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1450,7 +1450,7 @@ void cdrWrite0(unsigned char rt) { #ifdef CDR_LOG CDR_LOG("cdrWrite0() Log: CD0 write: %x\n", rt); #endif - cdr.Ctrl = rt | (cdr.Ctrl & ~0x3); + cdr.Ctrl = (rt & 3) | (cdr.Ctrl & ~3); if (rt == 0) { cdr.ParamP = 0; @@ -1506,7 +1506,7 @@ void cdrWrite1(unsigned char rt) { } #endif - if (cdr.Ctrl & 0x1) return; + if (cdr.Ctrl & 0x3) return; switch (cdr.Cmd) { case CdlSync: @@ -1861,7 +1861,7 @@ void cdrWrite2(unsigned char rt) { cdr.Reg2 = rt; break; } - } else if (!(cdr.Ctrl & 0x1) && cdr.ParamP < 8) { + } else if (!(cdr.Ctrl & 0x3) && cdr.ParamP < 8) { cdr.Param[cdr.ParamP++] = rt; cdr.ParamC++; } @@ -1914,7 +1914,7 @@ void cdrWrite3(unsigned char rt) { } - if (rt == 0x07 && cdr.Ctrl & 0x1) { + if (rt == 0x07 && (cdr.Ctrl & 3) == 1) { cdr.Stat = 0; if (cdr.Irq == 0xff) { @@ -1939,7 +1939,7 @@ void cdrWrite3(unsigned char rt) { return; } - if (rt == 0x80 && !(cdr.Ctrl & 0x1) && cdr.Readed == 0) { + if (rt == 0x80 && !(cdr.Ctrl & 0x3) && cdr.Readed == 0) { cdr.Readed = 1; cdr.pTransfer = cdr.Transfer; -- 2.39.5