mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-05 02:15:07 +01:00
Merge git://github.com/ekeeke/Genesis-Plus-GX
This commit is contained in:
commit
4e3718f10b
@ -920,6 +920,9 @@ void cdd_update(void)
|
|||||||
}
|
}
|
||||||
else if (cdd.toc.tracks[cdd.index].fd)
|
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)
|
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);
|
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 */
|
case 0x02: /* Read TOC */
|
||||||
{
|
{
|
||||||
/* Infos automatically retrieved by CDD processor from Q-Channel */
|
/* Infos automatically retrieved by CDD processor from Q-Channel */
|
||||||
/* commands 0x00-0x02: from current block Q-Channel data field */
|
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
|
||||||
/* commands 0x03-0x05: from Lead-In area Q-Channel data field */
|
|
||||||
switch (scd.regs[0x44>>1].byte.l)
|
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;
|
int lba = cdd.lba + 150;
|
||||||
scd.regs[0x38>>1].w = cdd.status << 8;
|
scd.regs[0x38>>1].w = cdd.status << 8;
|
||||||
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||||
scd.regs[0x3c>>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[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;
|
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;
|
int lba = cdd.lba - cdd.toc.tracks[cdd.index].start;
|
||||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x01;
|
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x01;
|
||||||
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||||
scd.regs[0x3c>>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[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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x02: /* Current track */
|
case 0x02: /* Current Track Number */
|
||||||
{
|
{
|
||||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x02;
|
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[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A;
|
||||||
scd.regs[0x3c>>1].w = 0x0000;
|
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;
|
scd.regs[0x40>>1].byte.h = 0x00;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1008,17 +1010,17 @@ void cdd_process(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x04: /* Number of tracks */
|
case 0x04: /* First & Last Track Numbers */
|
||||||
{
|
{
|
||||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x04;
|
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x04;
|
||||||
scd.regs[0x3a>>1].w = 0x0001;
|
scd.regs[0x3a>>1].w = 0x0001;
|
||||||
scd.regs[0x3c>>1].w = lut_BCD_16[cdd.toc.last];
|
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[0x3e>>1].w = 0x0000; /* Drive Version (?) in RS6-RS7 */
|
||||||
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 */
|
scd.regs[0x40>>1].byte.h = 0x00; /* Lead-In flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
|
||||||
break;
|
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 track = scd.regs[0x46>>1].byte.h * 10 + scd.regs[0x46>>1].byte.l;
|
||||||
int lba = cdd.toc.tracks[track-1].start + 150;
|
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[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||||
scd.regs[0x3c>>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[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)
|
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;
|
scd.regs[0x3e>>1].byte.h |= 0x08;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#define CD_END 0x0C
|
#define CD_END 0x0C
|
||||||
|
|
||||||
/* CD blocks scanning speed */
|
/* CD blocks scanning speed */
|
||||||
#define CD_SCAN_SPEED 10
|
#define CD_SCAN_SPEED 30
|
||||||
|
|
||||||
#define CD_MAX_TRACKS 100
|
#define CD_MAX_TRACKS 100
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ int ParseDirectory(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int LoadFile(int selection)
|
int LoadFile(int selection)
|
||||||
{
|
{
|
||||||
int size = 0, reload, filetype;
|
int size, cd_mode1, filetype;
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
|
|
||||||
/* file path */
|
/* file path */
|
||||||
@ -270,33 +270,33 @@ int LoadFile(int selection)
|
|||||||
/* open message box */
|
/* open message box */
|
||||||
GUI_MsgBoxOpen("Information", "Loading game...", 1);
|
GUI_MsgBoxOpen("Information", "Loading game...", 1);
|
||||||
|
|
||||||
/* by default, update loaded game informations */
|
/* no cartridge or CD game loaded */
|
||||||
reload = 1;
|
size = cd_mode1 = 0;
|
||||||
|
|
||||||
/* check if virtual CD tray was open */
|
/* check if virtual CD tray was open */
|
||||||
if ((system_hw == SYSTEM_MCD) && (cdd.status == CD_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));
|
size = cdd_load(filename, (char *)(cdc.ram));
|
||||||
|
|
||||||
/* Mode 1 cartridge loaded ? */
|
/* check if a cartridge is currently loaded */
|
||||||
if (scd.cartridge.boot)
|
if (scd.cartridge.boot)
|
||||||
{
|
{
|
||||||
/* loaded ROM file infos should not be modified */
|
/* CD Mode 1 */
|
||||||
reload = 0;
|
cd_mode1 = size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* update CD header informations */
|
/* update game informations from CD image file header */
|
||||||
getrominfo((char *)(cdc.ram));
|
getrominfo((char *)(cdc.ram));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no CD image file swapped */
|
/* no CD image file loaded */
|
||||||
if (!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
/* close CD tray to force system reset */
|
/* close CD tray to force system reset */
|
||||||
cdd.status = CD_STOP;
|
cdd.status = NO_DISC;
|
||||||
|
|
||||||
/* load game file */
|
/* load game file */
|
||||||
size = load_rom(filename);
|
size = load_rom(filename);
|
||||||
@ -304,13 +304,18 @@ int LoadFile(int selection)
|
|||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
/* check if loaded game has changed */
|
/* do not update game basename if a CD was loaded with a cartridge (Mode 1) */
|
||||||
if (reload)
|
if (cd_mode1)
|
||||||
|
{
|
||||||
|
/* add CD image file to history list */
|
||||||
|
filetype = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* auto-save previous game state */
|
/* auto-save previous game state */
|
||||||
slot_autosave(config.s_default,config.s_device);
|
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)
|
if (romtype & SYSTEM_SMS)
|
||||||
{
|
{
|
||||||
/* Master System ROM file */
|
/* Master System ROM file */
|
||||||
|
Loading…
Reference in New Issue
Block a user