2 Commits

11 changed files with 94 additions and 62 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7.4.4</string>
<string>1.7.4.5</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
-11
View File
@@ -394,17 +394,6 @@ void md_cart_init(void)
if (strstr(rominfo.international,"Virtua Racing"))
{
svp_init();
m68k.memory_map[0x30].base = svp->dram;
m68k.memory_map[0x30].read16 = NULL;
m68k.memory_map[0x30].write16 = svp_write_dram;
m68k.memory_map[0x31].base = svp->dram + 0x10000;
m68k.memory_map[0x31].read16 = NULL;
m68k.memory_map[0x31].write16 = svp_write_dram;
m68k.memory_map[0x39].read16 = svp_read_cell_1;
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
}
/**********************************************
+3 -3
View File
@@ -76,9 +76,9 @@ typedef struct
/* Cartridge type */
typedef struct
{
uint8 *base; /* ROM base (saved for OS/Cartridge ROM swap) */
uint32 romsize; /* ROM size */
uint32 mask; /* ROM mask */
uint8 *base; /* ROM base (saved for OS/Cartridge ROM swap) */
uint32 romsize; /* ROM size */
uint32 mask; /* ROM mask */
uint8 special; /* custom external hardware (Lock-On, J-Cart, 3-D glasses, Terebi Oekaki,...) */
cart_hw_t hw; /* cartridge internal hardware */
uint8 rom[MAXROMSIZE]; /* ROM area */
+58 -22
View File
@@ -12,12 +12,69 @@
#include "shared.h"
svp_t *svp = NULL;
svp_t *svp;
static void svp_write_dram(uint32 address, uint32 data)
{
*(uint16 *)(svp->dram + (address & 0x1fffe)) = data;
if (data)
{
if (address == 0x30fe06) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06;
else if (address == 0x30fe08) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08;
}
}
static uint32 svp_read_cell_1(uint32 address)
{
address = (address & 0xe002) | ((address & 0x7c) << 6) | ((address & 0x1f80) >> 5);
return *(uint16 *)(svp->dram + address);
}
static uint32 svp_read_cell_2(uint32 address)
{
address = (address & 0xf002) | ((address & 0x3c) << 6) | ((address & 0xfc0) >> 4);
return *(uint16 *)(svp->dram + address);
}
static uint32 svp_read_cell_byte(uint32 address)
{
uint16 data = m68k.memory_map[address >> 16].read16(address);
if (address & 0x01)
{
return (data & 0xff);
}
return (data >> 8);
}
void svp_init(void)
{
svp = (void *) ((char *)cart.rom + 0x200000);
memset(svp, 0, sizeof(*svp));
m68k.memory_map[0x30].base = svp->dram;
m68k.memory_map[0x30].read8 = NULL;
m68k.memory_map[0x30].read16 = NULL;
m68k.memory_map[0x30].write8 = NULL;
m68k.memory_map[0x30].write16 = svp_write_dram;
zbank_memory_map[0x30].read = NULL;
zbank_memory_map[0x30].write = NULL;
m68k.memory_map[0x31].base = svp->dram + 0x10000;
m68k.memory_map[0x31].read8 = NULL;
m68k.memory_map[0x31].read16 = NULL;
m68k.memory_map[0x31].write8 = NULL;
m68k.memory_map[0x31].write16 = NULL;
zbank_memory_map[0x31].read = NULL;
zbank_memory_map[0x31].write = NULL;
m68k.memory_map[0x39].read8 = svp_read_cell_byte;
m68k.memory_map[0x39].read16 = svp_read_cell_1;
zbank_memory_map[0x39].read = svp_read_cell_byte;
m68k.memory_map[0x3a].read8 = svp_read_cell_byte;
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
zbank_memory_map[0x3a].read = svp_read_cell_byte;
}
void svp_reset(void)
@@ -26,24 +83,3 @@ void svp_reset(void)
ssp1601_reset(&svp->ssp1601);
}
void svp_write_dram(uint32 address, uint32 data)
{
*(uint16 *)(svp->dram + (address & 0x1fffe)) = data;
if ((address == 0x30fe06) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06;
if ((address == 0x30fe08) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08;
}
uint32 svp_read_cell_1(uint32 address)
{
address >>= 1;
address = (address & 0x7001) | ((address & 0x3e) << 6) | ((address & 0xfc0) >> 5);
return *(uint16 *)(svp->dram + (address & 0x1fffe));
}
uint32 svp_read_cell_2(uint32 address)
{
address >>= 1;
address = (address & 0x7801) | ((address & 0x1e) << 6) | ((address & 0x7e0) >> 4);
return *(uint16 *)(svp->dram + (address & 0x1fffe));
}
-3
View File
@@ -26,8 +26,5 @@ extern svp_t *svp;
extern void svp_init(void);
extern void svp_reset(void);
extern void svp_write_dram(uint32 address, uint32 data);
extern uint32 svp_read_cell_1(uint32 address);
extern uint32 svp_read_cell_2(uint32 address);
#endif
+9 -9
View File
@@ -1444,8 +1444,8 @@ void cdd_process(void)
/* unless RS1 indicated invalid track infos */
if (scd.regs[0x38>>1].byte.l == 0x0f)
{
/* and SEEK has ended */
if (cdd.status != CD_SEEK)
/* and drive is now ready */
if (!cdd.latency)
{
/* then return valid track infos, e.g current track number in RS2-RS3 (fixes Lunar - The Silver Star) */
scd.regs[0x38>>1].byte.l = 0x02;
@@ -1568,7 +1568,7 @@ void cdd_process(void)
/* CD drive latency */
if (!cdd.latency)
{
/* Fixes a few games hanging during intro because they expect data to be read with some delay */
/* Fixes a few games hanging because they expect data to be read with some delay */
/* Radical Rex needs at least one interrupt delay */
/* Wolf Team games (Anet Futatabi, Cobra Command, Earnest Evans, Road Avenger & Time Gal) need at least 10 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 10 is OK) */
@@ -1655,13 +1655,13 @@ void cdd_process(void)
/* update status */
cdd.status = CD_PLAY;
/* return track index in RS2-RS3 */
scd.regs[0x38>>1].w = (CD_PLAY << 8) | 0x02;
scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[index + 1] : 0x0A0A;
/* RS1=0xf to invalidate track infos in RS2-RS8 until drive is ready (fixes Snatcher Act 2 start cutscene) */
scd.regs[0x38>>1].w = (CD_PLAY << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].byte.h = 0x00;
break;
scd.regs[0x40>>1].w = ~(CD_PLAY + 0xf) & 0x0f;
return;
}
case 0x04: /* Seek */
@@ -1753,7 +1753,7 @@ void cdd_process(void)
/* update status */
cdd.status = CD_SEEK;
/* unknown RS1-RS8 values (returning 0xF in RS1 invalidates track infos in RS2-RS8 and fixes Final Fight CD intro when seek time is emulated) */
/* RS1=0xf to invalidate track infos in RS2-RS8 while seeking (fixes Final Fight CD intro when seek time is emulated) */
scd.regs[0x38>>1].w = (CD_SEEK << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
+3
View File
@@ -1506,6 +1506,9 @@ void scd_init(void)
cdc_init();
gfx_init();
/* Initialize CD hardware master clock count per scanline */
scd.cycles_per_line = (uint32) (MCYCLES_PER_LINE * ((float)SCD_CLOCK / (float)system_clock));
/* Clear RAM */
memset(scd.prg_ram, 0x00, sizeof(scd.prg_ram));
memset(scd.word_ram, 0x00, sizeof(scd.word_ram));
-6
View File
@@ -1105,12 +1105,6 @@ void get_region(char *romheader)
/* force PAL/NTSC master clock if requested */
if (config.master_clock == 1) system_clock = MCLOCK_NTSC;
else if (config.master_clock == 2) system_clock = MCLOCK_PAL;
/* reinitialize CD unit master clock count per scanline */
if (system_hw == SYSTEM_MCD)
{
scd.cycles_per_line = (uint32) (MCYCLES_PER_LINE * ((float)SCD_CLOCK / (float)system_clock));
}
}
/****************************************************************************
+17 -4
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -420,6 +420,19 @@ unsigned int ctrl_io_read_byte(unsigned int address)
case 0x44: /* RADICA */
case 0x50: /* SVP */
{
if ((address & 0xFC) == 0x00)
{
unsigned int data = svp->ssp1601.gr[SSP_XST].byte.h;
return (address & 1) ? (data & 0xFF) : (data >> 8);
}
if ((address & 0xFE) == 0x04)
{
unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h;
svp->ssp1601.gr[SSP_PM0].byte.h &= ~1;
return (address & 1) ? (data & 0xFF) : (data >> 8);
}
return m68k_read_bus_8(address);
}
@@ -536,12 +549,12 @@ unsigned int ctrl_io_read_word(unsigned int address)
case 0x50: /* SVP */
{
if ((address & 0xFD) == 0)
if ((address & 0xFC) == 0x00)
{
return svp->ssp1601.gr[SSP_XST].byte.h;
}
if ((address & 0xFF) == 4)
if ((address & 0xFE) == 0x04)
{
unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h;
svp->ssp1601.gr[SSP_PM0].byte.h &= ~1;
+2 -2
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+1 -1
View File
@@ -139,7 +139,7 @@ void audio_set_rate(int samplerate, double framerate)
if (system_hw == SYSTEM_MCD)
{
/* number of SCD master clocks run per second */
mclk = framerate ? (SCYCLES_PER_LINE * (vdp_pal ? 313 : 262) * framerate) : SCD_CLOCK;
mclk = (mclk / system_clock) * SCD_CLOCK;
/* PCM core */
pcm_init(mclk, samplerate);