core, groundwork for chd support

still needs some scrutiny, and build integration is missing
This commit is contained in:
kub 2021-03-04 20:48:02 +01:00
parent 4da84f9454
commit 15ca715228
18 changed files with 411 additions and 100 deletions

View file

@ -99,7 +99,7 @@ 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/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/cd_parse.c $(R)pico/cd/gfx.c $(R)pico/cd/gfx_dma.c \
$(R)pico/cd/misc.c $(R)pico/cd/pcm.c
# 32X
ifneq "$(no_32x)" "1"

View file

@ -539,11 +539,11 @@ out:
int emu_swap_cd(const char *fname)
{
enum cd_img_type cd_type;
enum cd_track_type cd_type;
int ret = -1;
cd_type = PicoCdCheck(fname, NULL);
if (cd_type != CIT_NOT_CD)
if (cd_type != CT_UNKNOWN)
ret = cdd_load(fname, cd_type);
if (ret != 0) {
menu_update_msg("Load failed, invalid CD image?");

View file

@ -40,7 +40,7 @@
static const char *rom_exts[] = {
"zip",
"bin", "smd", "gen", "md",
"iso", "cso", "cue",
"iso", "cso", "cue", "chd",
"32x",
"sms",
NULL

View file

@ -1577,9 +1577,9 @@ int menu_loop_tray(void)
selfname = romsel_loop(curr_path);
if (selfname) {
int ret = -1;
cd_img_type cd_type;
cd_track_type cd_type;
cd_type = emu_cdCheck(NULL, romFileName);
if (cd_type != CIT_NOT_CD)
if (cd_type >= 0 && cd_type != CT_UNKNOWN)
ret = Insert_CD(romFileName, cd_type);
if (ret != 0) {
sprintf(menuErrorMsg, "Load failed, invalid CD image?");

View file

@ -749,7 +749,7 @@ void retro_get_system_info(struct retro_system_info *info)
#define _GIT_VERSION "-" GIT_VERSION
#endif
info->library_version = VERSION _GIT_VERSION;
info->valid_extensions = "bin|gen|smd|md|32x|cue|iso|sms";
info->valid_extensions = "bin|gen|smd|md|32x|cue|iso|chd|sms";
info->need_fullpath = true;
}
@ -1002,7 +1002,7 @@ static unsigned int disk_get_image_index(void)
static bool disk_set_image_index(unsigned int index)
{
enum cd_img_type cd_type;
enum cd_track_type cd_type;
int ret;
if (index >= sizeof(disks) / sizeof(disks[0]))
@ -1024,7 +1024,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)
if (cd_type >= 0 && cd_type != CT_UNKNOWN)
ret = cdd_load(disks[index].fname, cd_type);
if (ret != 0) {
if (log_cb)

View file

@ -30,7 +30,6 @@
#include <pico/pico_int.h>
#include <pico/cd/genplus_macros.h>
#include <pico/cd/cdd.h>
#include <pico/cd/cue.h>
#define OSD_FPS_X 432
@ -744,23 +743,10 @@ void emu_handle_resume(void)
// reopen first CD track
if (cdd.toc.tracks[0].fd != NULL)
{
const char *fname = rom_fname_reload;
int len = strlen(rom_fname_reload);
cue_data_t *cue_data = NULL;
if (len > 4 && strcasecmp(fname + len - 4, ".cue") == 0)
{
cue_data = cue_parse(rom_fname_reload);
if (cue_data != NULL)
fname = cue_data->tracks[1].fname;
}
lprintf("emu_HandleResume: reopen %s\n", fname);
lprintf("emu_HandleResume: reopen %s\n", cdd.toc.tracks[0].fname);
pm_close(cdd.toc.tracks[0].fd);
cdd.toc.tracks[0].fd = pm_open(fname);
cdd.toc.tracks[0].fd = pm_open(cdd.toc.tracks[0].fname);
lprintf("reopen %s\n", cdd.toc.tracks[0].fd != NULL ? "ok" : "failed");
if (cue_data != NULL) cue_destroy(cue_data);
}
mp3_reopen_file();