cdrom: new hacks for bios slowboot master github/master
authornotaz <notasas@gmail.com>
Sat, 13 Dec 2025 22:24:48 +0000 (00:24 +0200)
committernotaz <notasas@gmail.com>
Sun, 14 Dec 2025 00:21:07 +0000 (02:21 +0200)
libretro/pcsx_rearmed#897

frontend/libretro.c
frontend/libretro_core_options.h
frontend/menu.c
libpcsxcore/cdrom.c
libpcsxcore/psxcommon.h

index 407253e..12119ee 100644 (file)
@@ -2878,6 +2878,8 @@ static void update_variables(bool in_flight)
          Config.SlowBoot = 0;
          if (strcmp(var.value, "enabled") == 0)
             Config.SlowBoot = 1;
+         else if (strcmp(var.value, "enabled_no_pcsx") == 0)
+            Config.SlowBoot = 2;
       }
    }
 
index 0fd5c17..dc272d9 100644 (file)
@@ -145,6 +145,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
       {
          { "disabled", NULL },
          { "enabled",  NULL },
+         { "enabled_no_pcsx", "ON, w/o PCSXtm" },
          { NULL, NULL },
       },
       "disabled",
index 9717845..18377e2 100644 (file)
@@ -1535,6 +1535,7 @@ static int menu_loop_plugin_spu(int id, int keys)
 }
 
 static const char *men_gpu_dithering[] = { "OFF", "ON", "Force", NULL };
+static const char *men_bios_boot[] = { "OFF", "ON", "ON w/o PCSX", NULL };
 
 static const char h_bios[]       = "HLE is simulated BIOS. BIOS selection is saved in\n"
                                   "savestates and can't be changed there. Must save\n"
@@ -1596,9 +1597,12 @@ static int menu_loop_pluginsel_options(int id, int keys)
        return 0;
 }
 
+static int slowboot_sel;
+
 static menu_entry e_menu_plugin_options[] =
 {
        mee_enum_h    ("BIOS",                          0, bios_sel, bioses, h_bios),
+       mee_enum      ("BIOS logo (slow boot)",         0, slowboot_sel, men_bios_boot),
        mee_enum      ("GPU Dithering",                 0, pl_rearmed_cbs.dithering, men_gpu_dithering),
        mee_enum_h    ("GPU plugin",                    0, gpu_plugsel, gpu_plugins, h_plugin_gpu),
        mee_enum_h    ("SPU plugin",                    0, spu_plugsel, spu_plugins, h_plugin_spu),
@@ -1612,7 +1616,9 @@ static menu_entry e_menu_main2[];
 static int menu_loop_plugin_options(int id, int keys)
 {
        static int sel = 0;
+       slowboot_sel = Config.SlowBoot;
        me_loop(e_menu_plugin_options, &sel);
+       Config.SlowBoot = slowboot_sel;
 
        // sync BIOS/plugins
        snprintf(Config.Bios, sizeof(Config.Bios), "%s", bioses[bios_sel]);
@@ -2135,7 +2141,7 @@ static int run_bios(void)
        ready_to_go = 0;
        if (reload_plugins(NULL) != 0)
                return -1;
-       Config.SlowBoot = 1;
+       Config.SlowBoot = 2;
        SysReset();
        Config.SlowBoot = origSlowBoot;
 
index 6014db5..ed2a1cd 100644 (file)
@@ -1211,8 +1211,20 @@ void cdrInterrupt(void) {
                        CDR_LOG_I("CdlID: %02x %02x %02x %02x\n", cdr.Result[0],
                                cdr.Result[1], cdr.Result[2], cdr.Result[3]);
 
-                       /* This adds the string "PCSX" in Playstation bios boot screen */
-                       memcpy((char *)&cdr.Result[4], "PCSX", 4);
+                       /* 4-char string in Playstation bios boot screen */
+                       if (Config.SlowBoot == 1)
+                               memcpy(&cdr.Result[4], "PCSX", 4);
+                       else {
+                               cdr.Result[4] = 'S';
+                               cdr.Result[5] = 'C';
+                               cdr.Result[6] = 'E';
+                               if (Config.PsxType == PSX_TYPE_PAL)
+                                       cdr.Result[7] = 'E';
+                               else if (CdromId[2] == 'P' || CdromId[2] == 'p')
+                                       cdr.Result[7] = 'I';
+                               else
+                                       cdr.Result[7] = 'A';
+                       }
                        IrqStat = Complete;
                        break;
 
@@ -1236,6 +1248,13 @@ void cdrInterrupt(void) {
                case CdlReadToc + CMD_WHILE_NOT_READY:
                        cdr.LocL[0] = LOCL_INVALID;
                        second_resp_time = cdReadTime * 180 / 4;
+                       if (!Config.HLE && Config.SlowBoot) {
+                               // hack: compensate cdrom being emulated too fast
+                               // and bios finishing before the reverb decays
+                               second_resp_time += cdReadTime * 75*2;
+                               if ((psxRegs.pc >> 28) == 0x0b)
+                                       second_resp_time += cdReadTime * 75*3;
+                       }
                        start_rotating = 1;
                        break;
 
index 53c23f1..22574f8 100644 (file)
@@ -132,7 +132,7 @@ typedef struct {
        boolean Cdda;
        boolean CHD_Precache; /* loads disk image into memory, works with CHD only. */
        boolean HLE;
-       boolean SlowBoot;
+       uint8_t SlowBoot; // 0 = off, 1 = on, 2 = on, no PCSX 'ad'
        boolean Debug;
        boolean PsxOut;
        boolean icache_emulation;