Skip to content

Commit

Permalink
mcd, fix data track for MSU/MD+
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Oct 20, 2024
1 parent d7e18f8 commit f6043d9
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions pico/cd/cdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,20 @@ int cdd_load(const char *filename, int type)
if (ret != 0)
return ret;

if (type == CT_ISO) {
/* ISO format (2048 bytes data blocks) */
cdd.sectorSize = 2048;
} else {
/* audio or BIN format (2352 bytes data blocks) */
cdd.sectorSize = 2352;
}

/* read first 16 bytes */
pm_read(header, 0x10, cdd.toc.tracks[0].fd);

/* look for valid CD image ID string */
if (memcmp("SEGADISCSYSTEM", header, 14))
{
if (!Pico.romsize && memcmp("SEGADISCSYSTEM", header, 14))
{
/* if not found, read next 16 bytes */
pm_read(header, 0x10, cdd.toc.tracks[0].fd);

Expand All @@ -332,27 +340,16 @@ int cdd_load(const char *filename, int type)
elprintf(EL_STATUS|EL_ANOMALY, "cd: bad cd image?");
/* assume bin without security code */
}

/* BIN format (2352 bytes data blocks) */
cdd.sectorSize = 2352;
}
else
{
/* ISO format (2048 bytes data blocks) */
cdd.sectorSize = 2048;
}

ret = (type == CT_ISO ? 2048 : 2352);
if (ret != cdd.sectorSize)
elprintf(EL_STATUS|EL_ANOMALY, "cd: type detection mismatch");
pm_sectorsize(cdd.sectorSize, cdd.toc.tracks[0].fd);

/* read CD image header + security code */
pm_read(header + 0x10, 0x200, cdd.toc.tracks[0].fd);

/* Simulate audio tracks if none found */
if (cdd.toc.last == 1)
if (!Pico.romsize && cdd.toc.last == 1)
{
/* read CD image header + security code */
pm_read(header + 0x10, 0x200, cdd.toc.tracks[0].fd);

/* Some games require exact TOC infos */
if (strstr(header + 0x180,"T-95035") != NULL)
{
Expand Down

2 comments on commit f6043d9

@andres0021
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi friend, a question. I wanted to ask you, do you think you can make a GBA emulator for PS2? Currently there is none that is very functional, they have several errors. And your PicoDrive emulator is perfect. I hope you can answer the question, greetings!

@irixxxx
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not finally decided where I turn my interest next, but it won't probably be a Nintendo device, them being far too agressive for my liking. I'm currently thinking about some recompiler infrastructure to make it much easier to write a frontend for other CPUs. But that's still in pretty early design stages.

Please sign in to comment.