shithub: psxe

Download patch

ref: 9ad77e42f45c23eb0ce722df7c5cd45b882a57d5
parent: b33d776451632990b42b5ab3b43888427685eef3
author: allkern <aurealinbox@gmail.com>
date: Fri May 10 18:54:13 EDT 2024

More assorted fixes

--- a/psx/dev/cdrom.c
+++ b/psx/dev/cdrom.c
@@ -806,6 +806,11 @@
 void cdrom_cmd_setmode(psx_cdrom_t* cdrom) {
     cdrom->delayed_command = CDL_NONE;
 
+    // Not doing this fixes a graphical issue in
+    // Castlevania - Symphony of the Night, but breaks
+    // Road Rash.
+    // cdrom->ongoing_read_command = CDL_NONE;
+
     switch (cdrom->state) {
         case CD_STATE_RECV_CMD: {
             if (cdrom->pfifo_index != 1) {
@@ -825,7 +830,7 @@
             cdrom->mode = PFIFO_POP;
 
             if ((cdrom->mode & MODE_SPEED) != prev_speed)
-                cdrom->spin_delay = DELAY_1MS * 650;
+                cdrom->spin_delay = 0; // DELAY_1MS * 650;
 
             cdrom->irq_delay = DELAY_1MS;
             cdrom->delayed_command = CDL_SETMODE;
@@ -842,6 +847,8 @@
                 cdrom->irq_delay = DELAY_1MS;
                 cdrom->delayed_command = cdrom->ongoing_read_command;
                 cdrom->state = CD_STATE_SEND_RESP2;
+
+                return;
             }
 
             cdrom->state = CD_STATE_RECV_CMD;
--- a/psx/input/sda.c
+++ b/psx/input/sda.c
@@ -100,8 +100,12 @@
     if (data == PSXI_SW_SDA_ANALOG) {
         sda->sa_mode ^= 1;
 
-        sda->prev_model = sda->model;
-        sda->model = sda->sa_mode ? SDA_MODEL_ANALOG_STICK : sda->prev_model;
+        if (sda->sa_mode) {
+            sda->prev_model = sda->model;
+            sda->model = SDA_MODEL_ANALOG_STICK;
+        } else {
+            sda->model = sda->prev_model;
+        }
 
         printf("sda: Switched to %s mode\n", sda->sa_mode ? "analog" : "digital");
 
--