mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
core, groundwork for chd support
still needs some scrutiny, and build integration is missing
This commit is contained in:
parent
4da84f9454
commit
15ca715228
18 changed files with 411 additions and 100 deletions
|
@ -9,7 +9,7 @@
|
|||
#include "../pico_int.h"
|
||||
#include "genplus_macros.h"
|
||||
#include "cdd.h"
|
||||
#include "cue.h"
|
||||
#include "cd_parse.h"
|
||||
|
||||
#ifdef USE_LIBRETRO_VFS
|
||||
#include "file_stream_transforms.h"
|
||||
|
@ -90,7 +90,7 @@ int load_cd_image(const char *cd_img_name, int *type)
|
|||
int iso_name_len, missed, cd_img_sectors;
|
||||
char tmp_name[256], tmp_ext[10], tmp_ext_u[10];
|
||||
track_t *tracks = cdd.toc.tracks;
|
||||
cue_data_t *cue_data = NULL;
|
||||
cd_data_t *cue_data = NULL;
|
||||
pm_file *pmf;
|
||||
|
||||
if (PicoCDLoadProgressCB != NULL)
|
||||
|
@ -103,16 +103,21 @@ int load_cd_image(const char *cd_img_name, int *type)
|
|||
if (cue_data != NULL) {
|
||||
cd_img_name = cue_data->tracks[1].fname;
|
||||
*type = cue_data->tracks[1].type;
|
||||
} else {
|
||||
cue_data = chd_parse(cd_img_name);
|
||||
if (cue_data != NULL)
|
||||
*type = cue_data->tracks[1].type;
|
||||
}
|
||||
|
||||
pmf = pm_open(cd_img_name);
|
||||
if (pmf == NULL)
|
||||
{
|
||||
if (cue_data != NULL)
|
||||
cue_destroy(cue_data);
|
||||
cdparse_destroy(cue_data);
|
||||
return -1;
|
||||
}
|
||||
tracks[0].fd = pmf;
|
||||
tracks[0].fname = strdup(cd_img_name);
|
||||
|
||||
if (*type == CT_ISO)
|
||||
cd_img_sectors = pmf->size >>= 11; // size in sectors
|
||||
|
@ -131,7 +136,7 @@ int load_cd_image(const char *cd_img_name, int *type)
|
|||
|
||||
if (cue_data != NULL)
|
||||
{
|
||||
if (cue_data->tracks[2].fname == NULL) {
|
||||
if (cue_data->track_count > 1 && cue_data->tracks[2].fname == NULL) {
|
||||
// NULL fname means track2 is in same file as track1
|
||||
lba = tracks[0].end = cue_data->tracks[2].sector_offset;
|
||||
}
|
||||
|
@ -157,6 +162,7 @@ int load_cd_image(const char *cd_img_name, int *type)
|
|||
{
|
||||
// assume raw, ignore header for wav..
|
||||
tracks[index].fd = f;
|
||||
tracks[index].fname = strdup(cue_data->tracks[n].fname);
|
||||
tracks[index].offset = cue_data->tracks[n].sector_offset;
|
||||
length = f->size / 2352;
|
||||
}
|
||||
|
@ -189,8 +195,8 @@ int load_cd_image(const char *cd_img_name, int *type)
|
|||
tracks[index].end = lba;
|
||||
|
||||
sprintf_lba(tmp_ext, sizeof(tmp_ext), tracks[index].start);
|
||||
elprintf(EL_STATUS, "Track %2i: %s %9i AUDIO %s",
|
||||
n, tmp_ext, length, cue_data->tracks[n].fname);
|
||||
elprintf(EL_STATUS, "Track %2i: %s %9i AUDIO %s", n, tmp_ext, length,
|
||||
cue_data->tracks[n].fname ? cue_data->tracks[n].fname : "");
|
||||
}
|
||||
goto finish;
|
||||
}
|
||||
|
@ -269,7 +275,7 @@ finish:
|
|||
PicoCDLoadProgressCB(cd_img_name, 100);
|
||||
|
||||
if (cue_data != NULL)
|
||||
cue_destroy(cue_data);
|
||||
cdparse_destroy(cue_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue