[Core/CD] added setting to enable/disable CD access time simulation

This commit is contained in:
ekeeke 2022-05-01 15:47:18 +02:00
parent f43a4a7312
commit e366ca817f
21 changed files with 101 additions and 58 deletions

View File

@ -18,6 +18,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* added optional CHD file support
* added CDC & GFX register polling detection / synchronization
* added configurable CD-DA and PCM outputs mixing volume
* added setting to enable/disable CD access time simulation
* improved Timer interrupt timings and CDD interrupt accuracy (fixes audio stutters during Popful Mail FMV)
* improved CDC emulation (fixes random freezes during Jeopardy & ESPN Sunday Night NFL intro)
* improved emulation of mirrored memory areas

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2021 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2022 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -2071,7 +2071,8 @@ void cdd_process(void)
/* Fixes a few games hanging because they expect data to be read with some delay */
/* Wolf Team games (Annet Futatabi, Aisle Lord, Cobra Command, Earnest Evans, Road Avenger & Time Gal) need at least 11 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 11 is OK) */
cdd.latency = 11;
/* By default, at least one interrupt latency is required by current emulation model (BIOS hangs otherwise) */
cdd.latency = 1 + 10*config.cd_latency;
}
/* CD drive seek time */
@ -2081,11 +2082,11 @@ void cdd_process(void)
/* be enough delayed to start in sync with intro sequence, as compared with real hardware recording). */
if (lba > cdd.lba)
{
cdd.latency += (((lba - cdd.lba) * 120) / 270000);
cdd.latency += (((lba - cdd.lba) * 120 * config.cd_latency) / 270000);
}
else
{
cdd.latency += (((cdd.lba - lba) * 120) / 270000);
cdd.latency += (((cdd.lba - lba) * 120 * config.cd_latency) / 270000);
}
/* update current LBA */
@ -2148,11 +2149,11 @@ void cdd_process(void)
/* seeking from 00:05:63 to 24:03:19, Panic! when seeking from 00:05:60 to 24:06:07) */
if (lba > cdd.lba)
{
cdd.latency = ((lba - cdd.lba) * 120) / 270000;
cdd.latency = ((lba - cdd.lba) * 120 * config.cd_latency) / 270000;
}
else
{
cdd.latency = ((cdd.lba - lba) * 120) / 270000;
cdd.latency = ((cdd.lba - lba) * 120 * config.cd_latency) / 270000;
}
/* update current LBA */

View File

@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2021 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2022 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:

View File

@ -66,13 +66,14 @@ void set_config_defaults(void)
config.bios = 0;
config.lock_on = 0; /* = OFF (or TYPE_SK, TYPE_GG & TYPE_AR) */
config.add_on = 0; /* = HW_ADDON_AUTO (or HW_ADDON_MEGACD, HW_ADDON_MEGASD & HW_ADDON_NONE) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
config.cd_latency = 1;
/* display options */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
config.gcw0_fullscreen = 1; /* 1 = use IPU scaling */
config.keepaspectratio = 1; /* 1 = aspect ratio correct with black bars, 0 = fullscreen without correct aspect ratio */
config.gg_scanlines = 1; /* 1 = use scanlines on Game Gear */

View File

@ -23,6 +23,7 @@ typedef struct
uint8 hq_psg;
uint8 ym2612;
uint8 ym2413;
uint8 cd_latency;
int16 psg_preamp;
int16 fm_preamp;
int16 cdda_volume;

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX configuration file support
*
* Copyright Eke-Eke (2007-2021)
* Copyright Eke-Eke (2007-2022)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -126,6 +126,7 @@ void config_default(void)
config.lock_on = 0;
config.add_on = HW_ADDON_AUTO;
config.hot_swap = 0;
config.cd_latency = 1;
/* video options */
config.xshift = 0;

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX configuration file support
*
* Copyright Eke-Eke (2007-2021)
* Copyright Eke-Eke (2007-2022)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -87,6 +87,7 @@ typedef struct
uint8 bilinear;
uint8 vfilter;
uint8 aspect;
uint8 cd_latency;
int16 xshift;
int16 yshift;
int16 xscale;

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX menu
*
* Copyright Eke-Eke (2009-2021)
* Copyright Eke-Eke (2009-2022)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -381,12 +381,13 @@ static gui_item items_rompaths[] =
static gui_item items_system[] =
{
{NULL,NULL,"System: MEGA DRIVE/GENESIS", "Select system hardware model", 56,132,276,48},
{NULL,NULL,"Region: JAPAN", "Select system region", 56,132,276,48},
{NULL,NULL,"Region: JAPAN", "Select system region", 56,132,276,48},
{NULL,NULL,"VDP Mode: AUTO", "Select VDP mode", 56,132,276,48},
{NULL,NULL,"System Clock: AUTO", "Select master clock frequency", 56,132,276,48},
{NULL,NULL,"System Boot: BIOS->CART", "Select system booting method", 56,132,276,48},
{NULL,NULL,"System Lockups: OFF", "Enable/Disable original system lockups", 56,132,276,48},
{NULL,NULL,"68k Address Error: OFF", "Enable/Disable 68k address error exceptions", 56,132,276,48},
{NULL,NULL,"CD Access Time: OFF", "Enable/Disable CD read/seek latency", 56,132,276,48},
{NULL,NULL,"CD Add-on: MEGA/SEGA CD", "Select cartridge mode CD hardware add-on", 56,132,276,48},
{NULL,NULL,"Lock-On: SONIC&KNUCKLES", "Select Lock-On cartridge type", 56,132,276,48},
{NULL,NULL,"Cartridge Swap: OFF", "Enable/Disable cartridge hot swap", 56,132,276,48},
@ -1333,35 +1334,36 @@ static void systemmenu ()
sprintf (items[4].text, "System Boot: %s", (config.bios & 1) ? ((config.bios & 2) ? "BIOS->CART" : "BIOS ONLY") : "CART");
sprintf (items[5].text, "System Lockups: %s", config.force_dtack ? "OFF" : "ON");
sprintf (items[6].text, "68k Address Error: %s", config.addr_error ? "ON" : "OFF");
sprintf (items[7].text, "CD Access Time: %s", config.cd_latency ? "ON" : "OFF");
if (config.add_on == HW_ADDON_AUTO)
sprintf (items[7].text, "CD Add-on: AUTO");
sprintf (items[8].text, "CD Add-on: AUTO");
else if (config.add_on == HW_ADDON_MEGACD)
sprintf (items[7].text, "CD Add-on: MEGA/SEGA CD");
sprintf (items[8].text, "CD Add-on: MEGA/SEGA CD");
else if (config.add_on == HW_ADDON_MEGASD)
sprintf (items[7].text, "CD Add-on: MEGASD");
sprintf (items[8].text, "CD Add-on: MEGASD");
else
sprintf (items[7].text, "CD Add-on: NONE");
sprintf (items[8].text, "CD Add-on: NONE");
if (config.lock_on == TYPE_GG)
sprintf (items[8].text, "Lock-On: GAME GENIE");
sprintf (items[9].text, "Lock-On: GAME GENIE");
else if (config.lock_on == TYPE_AR)
sprintf (items[8].text, "Lock-On: ACTION REPLAY");
sprintf (items[9].text, "Lock-On: ACTION REPLAY");
else if (config.lock_on == TYPE_SK)
sprintf (items[8].text, "Lock-On: SONIC&KNUCKLES");
sprintf (items[9].text, "Lock-On: SONIC&KNUCKLES");
else
sprintf (items[8].text, "Lock-On: OFF");
sprintf (items[9].text, "Lock-On: OFF");
sprintf (items[9].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
sprintf (items[10].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
if (svp)
{
sprintf (items[11].text, "SVP Cycles: %d", SVP_cycles);
m->max_items = 12;
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles);
m->max_items = 13;
}
else
{
m->max_items = 11;
m->max_items = 12;
}
GUI_InitMenu(m);
@ -1552,31 +1554,38 @@ static void systemmenu ()
break;
}
case 7: /*** CD add-on ***/
case 7: /*** CD Access Time ***/
{
config.add_on = (config.add_on + 1) % (HW_ADDON_NONE + 1);
if (config.add_on == HW_ADDON_AUTO)
sprintf (items[7].text, "CD Add-on: AUTO");
else if (config.add_on == HW_ADDON_MEGACD)
sprintf (items[7].text, "CD Add-on: MEGA/SEGA CD");
else if (config.add_on == HW_ADDON_MEGASD)
sprintf (items[7].text, "CD Add-on: MEGASD");
else
sprintf (items[7].text, "CD Add-on: NONE");
config.cd_latency ^= 1;
sprintf (items[7].text, "CD Access Time: %s", config.cd_latency ? "ON" : "OFF");
break;
}
case 8: /*** Cart Lock-On ***/
case 8: /*** CD add-on ***/
{
config.add_on = (config.add_on + 1) % (HW_ADDON_NONE + 1);
if (config.add_on == HW_ADDON_AUTO)
sprintf (items[8].text, "CD Add-on: AUTO");
else if (config.add_on == HW_ADDON_MEGACD)
sprintf (items[8].text, "CD Add-on: MEGA/SEGA CD");
else if (config.add_on == HW_ADDON_MEGASD)
sprintf (items[8].text, "CD Add-on: MEGASD");
else
sprintf (items[8].text, "CD Add-on: NONE");
break;
}
case 9: /*** Cart Lock-On ***/
{
config.lock_on = (config.lock_on + 1) % (TYPE_SK + 1);
if (config.lock_on == TYPE_GG)
sprintf (items[8].text, "Lock-On: GAME GENIE");
sprintf (items[9].text, "Lock-On: GAME GENIE");
else if (config.lock_on == TYPE_AR)
sprintf (items[8].text, "Lock-On: ACTION REPLAY");
sprintf (items[9].text, "Lock-On: ACTION REPLAY");
else if (config.lock_on == TYPE_SK)
sprintf (items[8].text, "Lock-On: SONIC&KNUCKLES");
sprintf (items[9].text, "Lock-On: SONIC&KNUCKLES");
else
sprintf (items[8].text, "Lock-On: OFF");
sprintf (items[9].text, "Lock-On: OFF");
if ((system_hw == SYSTEM_MD) || (system_hw == SYSTEM_PICO))
{
@ -1610,14 +1619,14 @@ static void systemmenu ()
break;
}
case 9: /*** Cartridge Hot Swap ***/
case 10: /*** Cartridge Hot Swap ***/
{
config.hot_swap ^= 1;
sprintf (items[9].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
sprintf (items[10].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
break;
}
case 10: /*** System ROM paths ***/
case 11: /*** System ROM paths ***/
{
GUI_DeleteMenu(m);
rompathmenu();
@ -1625,10 +1634,10 @@ static void systemmenu ()
break;
}
case 11: /*** SVP cycles per line ***/
case 12: /*** SVP cycles per line ***/
{
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
sprintf (items[11].text, "SVP Cycles: %d", SVP_cycles);
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles);
break;
}

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX menus
*
* Copyright Eke-Eke (2009-2021)
* Copyright Eke-Eke (2009-2022)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX libretro port
*
* Copyright Eke-Eke (2007-2021)
* Copyright Eke-Eke (2007-2022)
*
* Copyright Daniel De Matteis (2012-2016)
*
@ -1450,6 +1450,15 @@ static void check_variables(bool first_run)
m68k.aerr_enabled = config.addr_error = 0;
}
var.key = "genesis_plus_gx_cd_latency";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
if (!var.value || !strcmp(var.value, "enabled"))
config.cd_latency = 1;
else
config.cd_latency = 0;
}
var.key = "genesis_plus_gx_add_on";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{

View File

@ -829,6 +829,20 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"enabled"
},
{
"genesis_plus_gx_cd_latency",
"CD access time",
NULL,
"Simulate original CD hardware latency when initiating a read or seeking to a specific location on loaded disc. This is required by a few CD games that crash if CD data is available too soon and also fixes CD audio desync issues in some games. Disabling this can be useful with MSU-MD games as it makes CD audio tracks loops more seamless.",
NULL,
"hacks",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL },
},
"enabled"
},
#ifdef USE_PER_SOUND_CHANNELS_CONFIG
{
"genesis_plus_gx_show_advanced_audio_settings",

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX libretro port
*
* Copyright Eke-Eke (2007-2021)
* Copyright Eke-Eke (2007-2022)
*
* Copyright Daniel De Matteis (2012-2016)
*
@ -133,6 +133,7 @@ typedef struct
uint8 gun_cursor;
uint32 overclock;
uint8 no_sprite_limit;
uint8 cd_latency;
#ifdef USE_PER_SOUND_CHANNELS_CONFIG
unsigned int psg_ch_volumes[4];
int32 md_ch_volumes[6];

View File

@ -35,13 +35,14 @@ void set_config_defaults(void)
config.bios = 0;
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
config.add_on = 0; /* = HW_ADDON_AUTO (or HW_ADDON_MEGACD, HW_ADDON_MEGASD & HW_ADDON_NONE) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
config.cd_latency = 1;
/* display options */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
/* controllers options */
input.system[0] = SYSTEM_GAMEPAD;

View File

@ -22,6 +22,7 @@ typedef struct
uint8 hq_psg;
uint8 ym2612;
uint8 ym2413;
uint8 cd_latency;
int16 psg_preamp;
int16 fm_preamp;
int16 cdda_volume;

View File

@ -38,13 +38,14 @@ void set_config_defaults(void)
config.bios = 0;
config.lock_on = 0; /* = OFF (or TYPE_SK, TYPE_GG & TYPE_AR) */
config.add_on = 0; /* = HW_ADDON_AUTO (or HW_ADDON_MEGACD, HW_ADDON_MEGASD & HW_ADDON_ONE) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
config.cd_latency = 1;
/* display options */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
/* controllers options */
input.system[0] = SYSTEM_GAMEPAD;

View File

@ -22,6 +22,7 @@ typedef struct
uint8 ym2413;
uint8 ym3438;
uint8 opll;
uint8 cd_latency;
int16 psg_preamp;
int16 fm_preamp;
int16 cdda_volume;