Merge git://github.com/ekeeke/Genesis-Plus-GX

This commit is contained in:
twinaphex 2012-10-26 18:34:22 +02:00
commit 4e3718f10b
3 changed files with 35 additions and 28 deletions

View File

@ -920,6 +920,9 @@ void cdd_update(void)
}
else if (cdd.toc.tracks[cdd.index].fd)
{
/* AUDIO track playing */
scd.regs[0x36>>1].byte.h = 0x00;
if (cdd.lba < cdd.toc.tracks[cdd.index].start)
{
fseek(cdd.toc.tracks[cdd.index].fd, (cdd.toc.tracks[cdd.index].start * 2352) - cdd.toc.tracks[cdd.index].offset, SEEK_SET);
@ -961,38 +964,37 @@ void cdd_process(void)
case 0x02: /* Read TOC */
{
/* Infos automatically retrieved by CDD processor from Q-Channel */
/* commands 0x00-0x02: from current block Q-Channel data field */
/* commands 0x03-0x05: from Lead-In area Q-Channel data field */
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
switch (scd.regs[0x44>>1].byte.l)
{
case 0x00: /* Absolute position (MM:SS:FF) */
case 0x00: /* Current Absolute Time (MM:SS:FF) */
{
int lba = cdd.lba + 150;
scd.regs[0x38>>1].w = cdd.status << 8;
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 (note: bit 1 is checked by BIOS) */
scd.regs[0x40>>1].byte.h = cdd.index ? 0x00 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
break;
}
case 0x01: /* Track relative position (MM:SS:FF) */
case 0x01: /* Current Track Relative Time (MM:SS:FF) */
{
int lba = cdd.lba - cdd.toc.tracks[cdd.index].start;
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x01;
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 */
scd.regs[0x40>>1].byte.h = cdd.index ? 0x00 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
break;
}
case 0x02: /* Current track */
case 0x02: /* Current Track Number */
{
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x02;
scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; /* TODO: check what is returned in RS6 */
scd.regs[0x3e>>1].w = 0x0000; /* Disk Control Code (?) in RS6 */
scd.regs[0x40>>1].byte.h = 0x00;
break;
}
@ -1008,17 +1010,17 @@ void cdd_process(void)
break;
}
case 0x04: /* Number of tracks */
case 0x04: /* First & Last Track Numbers */
{
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x04;
scd.regs[0x3a>>1].w = 0x0001;
scd.regs[0x3c>>1].w = lut_BCD_16[cdd.toc.last];
scd.regs[0x3e>>1].w = 0x0000; /* TODO: check what is returned in RS6-RS7 */
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 */
scd.regs[0x3e>>1].w = 0x0000; /* Drive Version (?) in RS6-RS7 */
scd.regs[0x40>>1].byte.h = 0x00; /* Lead-In flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
break;
}
case 0x05: /* Track start (MM:SS:FF) */
case 0x05: /* Track Start Time (MM:SS:FF) */
{
int track = scd.regs[0x46>>1].byte.h * 10 + scd.regs[0x46>>1].byte.l;
int lba = cdd.toc.tracks[track-1].start + 150;
@ -1026,10 +1028,10 @@ void cdd_process(void)
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
scd.regs[0x40>>1].byte.h = track % 10;
scd.regs[0x40>>1].byte.h = track % 10; /* Track Number (low digit) */
if (track == 1)
{
/* RS6 bit 3 is set for DATA track */
/* RS6 bit 3 is set for the first (DATA) track */
scd.regs[0x3e>>1].byte.h |= 0x08;
}
break;

View File

@ -53,7 +53,7 @@
#define CD_END 0x0C
/* CD blocks scanning speed */
#define CD_SCAN_SPEED 10
#define CD_SCAN_SPEED 30
#define CD_MAX_TRACKS 100

View File

@ -246,7 +246,7 @@ int ParseDirectory(void)
****************************************************************************/
int LoadFile(int selection)
{
int size = 0, reload, filetype;
int size, cd_mode1, filetype;
char filename[MAXPATHLEN];
/* file path */
@ -270,33 +270,33 @@ int LoadFile(int selection)
/* open message box */
GUI_MsgBoxOpen("Information", "Loading game...", 1);
/* by default, update loaded game informations */
reload = 1;
/* no cartridge or CD game loaded */
size = cd_mode1 = 0;
/* check if virtual CD tray was open */
if ((system_hw == SYSTEM_MCD) && (cdd.status == CD_OPEN))
{
/* swap CD image file without changing region, system,... */
/* swap CD image file in (without changing region, system,...) */
size = cdd_load(filename, (char *)(cdc.ram));
/* Mode 1 cartridge loaded ? */
/* check if a cartridge is currently loaded */
if (scd.cartridge.boot)
{
/* loaded ROM file infos should not be modified */
reload = 0;
/* CD Mode 1 */
cd_mode1 = size;
}
else
{
/* update CD header informations */
/* update game informations from CD image file header */
getrominfo((char *)(cdc.ram));
}
}
/* no CD image file swapped */
/* no CD image file loaded */
if (!size)
{
/* close CD tray to force system reset */
cdd.status = CD_STOP;
cdd.status = NO_DISC;
/* load game file */
size = load_rom(filename);
@ -304,13 +304,18 @@ int LoadFile(int selection)
if (size > 0)
{
/* check if loaded game has changed */
if (reload)
/* do not update game basename if a CD was loaded with a cartridge (Mode 1) */
if (cd_mode1)
{
/* add CD image file to history list */
filetype = 1;
}
else
{
/* auto-save previous game state */
slot_autosave(config.s_default,config.s_device);
/* update pathname for screenshot, save & cheat files */
/* update game basename (for screenshot, save & cheat files) */
if (romtype & SYSTEM_SMS)
{
/* Master System ROM file */