cd: switch to CD drive emu code from genplus

same license, much cleaner code
This commit is contained in:
notaz 2013-10-06 21:08:07 +03:00
parent 3f23709ef3
commit 274fcc35aa
25 changed files with 1798 additions and 1824 deletions

View file

@ -520,9 +520,6 @@ Homepage: http://www.mame.net/
Eke
CD graphics processor and CD controller implementation (from Genesis Plus GX)
Stephane Dallongeville
Gens, MD/Mega CD/32X emulator. Some Sega CD code is based on this emu.
#ifdef PSP
people @ ps2dev.org forums / PSPSDK crew
@ -537,6 +534,7 @@ Additional thanks
* Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful
info about genesis hardware.
* Steve Snake for all that he has done for Genesis emulation scene.
* Stephane Dallongeville for writing Gens and making it open source.
* Tasco Deluxe for his reverse engineering work on SVP and some mappers.
* Bart Trzynadlowski for his SSFII and 68000 docs.
* Haze for his research (http://haze.mameworld.info).

View file

@ -93,9 +93,9 @@ DEFINES += NO_SMS
endif
# CD
SRCS_COMMON += $(R)pico/cd/mcd.c $(R)pico/cd/memory.c $(R)pico/cd/sek.c \
$(R)pico/cd/cdc.c $(R)pico/cd/cd_sys.c $(R)pico/cd/cd_file.c \
$(R)pico/cd/cdc.c $(R)pico/cd/cdd.c $(R)pico/cd/cd_image.c \
$(R)pico/cd/cue.c $(R)pico/cd/gfx.c $(R)pico/cd/gfx_dma.c \
$(R)pico/cd/misc.c $(R)pico/cd/pcm.c $(R)pico/cd/buffering.c
$(R)pico/cd/misc.c $(R)pico/cd/pcm.c
# 32X
ifneq "$(no_32x)" "1"
SRCS_COMMON += $(R)pico/32x/32x.c $(R)pico/32x/memory.c $(R)pico/32x/draw.c \

View file

@ -308,11 +308,6 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
return 0;
return 1;
case MA_CDOPT_READAHEAD:
if (strcasecmp(var, "ReadAhead buffer") != 0) return 0;
PicoCDBuffers = atoi(val) / 2;
return 1;
case MA_32XOPT_MSH2_CYCLES:
currentConfig.msh2_khz = atoi(val);
Pico32xSetClocks(currentConfig.msh2_khz * 1000, 0);

View file

@ -530,19 +530,20 @@ out:
int emu_swap_cd(const char *fname)
{
cd_img_type cd_type;
enum cd_img_type cd_type;
int ret = -1;
cd_type = PicoCdCheck(fname, NULL);
if (cd_type != CIT_NOT_CD)
ret = Insert_CD(fname, cd_type);
ret = cdd_load(fname, cd_type);
if (ret != 0) {
menu_update_msg("Load failed, invalid CD image?");
return 0;
}
strncpy(rom_fname_loaded, fname, sizeof(rom_fname_loaded)-1);
rom_fname_loaded[sizeof(rom_fname_loaded)-1] = 0;
rom_fname_loaded[sizeof(rom_fname_loaded) - 1] = 0;
return 1;
}
@ -606,7 +607,6 @@ void emu_set_defconfig(void)
PsndRate = currentConfig.s_PsndRate;
PicoRegionOverride = currentConfig.s_PicoRegion;
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
}
int emu_read_config(const char *rom_fname, int no_defaults)
@ -1336,10 +1336,6 @@ void emu_loop(void)
PicoLoopPrepare();
// prepare CD buffer
if (PicoAHW & PAHW_MCD)
PicoCDBufferInit();
plat_video_loop_prepare();
emu_loop_prep();
pemu_sound_start();
@ -1501,10 +1497,4 @@ void emu_loop(void)
pemu_loop_end();
emu_sound_stop();
// pemu_loop_end() might want to do 1 frame for bg image,
// so free CD buffer here
if (PicoAHW & PAHW_MCD)
PicoCDBufferFree();
}

View file

@ -395,31 +395,6 @@ static int menu_loop_keyconfig(int id, int keys)
// ------------ SCD options menu ------------
static const char *mgn_cdopt_ra(int id, int *offs)
{
*offs = -5;
if (PicoCDBuffers <= 0)
return " OFF";
sprintf(static_buff, "%5iK", PicoCDBuffers * 2);
return static_buff;
}
static int mh_cdopt_ra(int id, int keys)
{
if (keys & PBTN_LEFT) {
PicoCDBuffers >>= 1;
if (PicoCDBuffers < 2)
PicoCDBuffers = 0;
} else {
if (PicoCDBuffers <= 0)
PicoCDBuffers = 1;
PicoCDBuffers <<= 1;
if (PicoCDBuffers > 8*1024)
PicoCDBuffers = 8*1024; // 16M
}
return 0;
}
static const char h_cdleds[] = "Show power/CD LEDs of emulated console";
static const char h_cdda[] = "Play audio tracks from mp3s/wavs/bins";
static const char h_cdpcm[] = "Emulate PCM audio chip for effects/voices/music";
@ -435,7 +410,6 @@ static menu_entry e_menu_cd_options[] =
mee_onoff_h("CD LEDs", MA_CDOPT_LEDS, currentConfig.EmuOpt, EOPT_EN_CD_LEDS, h_cdleds),
mee_onoff_h("CDDA audio", MA_CDOPT_CDDA, PicoOpt, POPT_EN_MCD_CDDA, h_cdda),
mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoOpt, POPT_EN_MCD_PCM, h_cdpcm),
mee_cust ("ReadAhead buffer", MA_CDOPT_READAHEAD, mh_cdopt_ra, mgn_cdopt_ra),
mee_onoff_h("SaveRAM cart", MA_CDOPT_SAVERAM, PicoOpt, POPT_EN_MCD_RAMCART, h_srcart),
mee_onoff_h("Scale/Rot. fx (slow)", MA_CDOPT_SCALEROT_CHIP, PicoOpt, POPT_EN_MCD_GFX, h_scfx),
mee_end,
@ -1045,7 +1019,7 @@ static int main_menu_handler(int id, int keys)
break;
case MA_MAIN_CHANGE_CD:
if (PicoAHW & PAHW_MCD) {
if (!Stop_CD())
if (!cdd_unload())
menu_loop_tray();
return 1;
}

View file

@ -500,7 +500,7 @@ static unsigned int disk_get_image_index(void)
static bool disk_set_image_index(unsigned int index)
{
cd_img_type cd_type;
enum cd_img_type cd_type;
int ret;
if (index >= sizeof(disks) / sizeof(disks[0]))
@ -521,7 +521,7 @@ static bool disk_set_image_index(unsigned int index)
ret = -1;
cd_type = PicoCdCheck(disks[index].fname, NULL);
if (cd_type != CIT_NOT_CD)
ret = Insert_CD(disks[index].fname, cd_type);
ret = cdd_load(disks[index].fname, cd_type);
if (ret != 0) {
lprintf("Load failed, invalid CD image?\n");
return 0;
@ -882,7 +882,6 @@ void retro_init(void)
#endif
PsndRate = 44100;
PicoAutoRgnOrder = 0x184; // US, EU, JP
PicoCDBuffers = 0;
vout_width = 320;
vout_height = 240;