cdrom: reset cmd buffer when cmd is accepted
authornotaz <notasas@gmail.com>
Wed, 18 Jul 2012 20:54:02 +0000 (23:54 +0300)
committernotaz <notasas@gmail.com>
Wed, 18 Jul 2012 21:20:13 +0000 (00:20 +0300)
wrong but hopefully not as much as it was

libpcsxcore/cdrom.c

index 8785598..297c8ae 100644 (file)
@@ -1264,6 +1264,9 @@ void cdrInterrupt() {
 
        Check_Shell( Irq );
 
+       cdr.ParamP = 0;
+       cdr.ParamC = 0;
+
        if (cdr.Stat != NoIntr && cdr.Reg2 != 0x18) {
                psxHu32ref(0x1070) |= SWAP32((u32)0x4);
        }
@@ -1451,12 +1454,6 @@ void cdrWrite0(unsigned char rt) {
        CDR_LOG("cdrWrite0() Log: CD0 write: %x\n", rt);
 #endif
        cdr.Ctrl = (rt & 3) | (cdr.Ctrl & ~3);
-
-       if (rt == 0) {
-               cdr.ParamP = 0;
-               cdr.ParamC = 0;
-               cdr.ResultReady = 0;
-       }
 }
 
 unsigned char cdrRead1(void) {
@@ -1508,6 +1505,8 @@ void cdrWrite1(unsigned char rt) {
 
        if (cdr.Ctrl & 0x3) return;
 
+       cdr.ResultReady = 0;
+
        switch (cdr.Cmd) {
        case CdlSync:
                cdr.Ctrl |= 0x80;
@@ -1809,6 +1808,8 @@ void cdrWrite1(unsigned char rt) {
                break;
 
        default:
+               cdr.ParamP = 0;
+               cdr.ParamC = 0;
 #ifdef CDR_LOG
                CDR_LOG("cdrWrite1() Log: Unknown command: %x\n", cdr.Cmd);
 #endif