From: notaz Date: Sat, 13 Dec 2025 22:24:48 +0000 (+0200) Subject: cdrom: new hacks for bios slowboot X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f8f99f573daaa15229b2a19bfc7bac9cd4c5ccb;p=pcsx_rearmed.git cdrom: new hacks for bios slowboot libretro/pcsx_rearmed#897 --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 407253e3..12119eeb 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -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; } } diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 0fd5c177..dc272d9f 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -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", diff --git a/frontend/menu.c b/frontend/menu.c index 9717845e..18377e21 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -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; diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 6014db59..ed2a1cdd 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -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; diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index 53c23f16..22574f80 100644 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -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;