psxbios: Merge upstream fix for Deliverevent in firstfile
[pcsx_rearmed.git] / libpcsxcore / psxbios.c
index 5bff23e..010a229 100644 (file)
@@ -1772,9 +1772,10 @@ void psxBios_StopPAD() { // 14
 #ifdef PSXBIOS_LOG
        PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x14]);
 #endif
-
+       if (pad_buf == 0){
        pad_buf1 = NULL;
        pad_buf2 = NULL;
+       }
        pc0 = ra;
 }
 
@@ -2109,15 +2110,16 @@ void psxBios_firstfile() { // 42
                pfile = ffile+5;
                nfile = 1;
                if (!strncmp(pa0, "bu00", 4)) {
+                       // firstfile() calls _card_read() internally, so deliver it's event
+                       DeliverEvent(0x11, 0x2);
                        bufile(1);
                } else if (!strncmp(pa0, "bu10", 4)) {
+                       // firstfile() calls _card_read() internally, so deliver it's event
+                       DeliverEvent(0x11, 0x2);
                        bufile(2);
                }
        }
 
-       // firstfile() calls _card_read() internally, so deliver it's event
-       DeliverEvent(0x11, 0x2);
-
        pc0 = ra;
 }