| View previous topic :: View next topic |
| Author |
Message |
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Sat Nov 26, 2005 12:47 am Post subject: Problem with cdRead() |
|
|
I've encountered a problem with cdRead(). When I try to read a non-existing sector, cdRead() returns 1 (OK) instead of 0 (error).
Example:
| Code: | void readtest()
{
int ret;
u8 buf[2048];
CdvdReadMode_t mode;
memset(buf, 0, sizeof(buf));
mode.retries = 10;
mode.sectorType = CDVD_SECTOR_2048;
mode.readSpeed = CDVD_SPIN_NORMAL;
cdInit(0);
printf("Reading data from disc... ");
ret = cdRead(-1, 1, buf, &mode); // read the sector at LBA (-1)
cdSync(0); // blocking
if (!ret) printf("Failed.\n");
else printf("OK.\n");
}
|
And the output is: "Reading data from disc... OK."
I don't know why it acts like that.
Also, does anybody know how to get the total number of sectors on a disc? I guess this information is stored in the TOC, but where? |
|
| Back to top |
|
 |
evilo

Joined: 22 Apr 2004 Posts: 230
|
Posted: Sat Nov 26, 2005 1:21 am Post subject: |
|
|
the TOC is a special area that cannot be read with the CdRead() function.
However, you can use the CdGetToc() function (seeing the function name, I don't think you need further information on it).
if you want some examples of usage, just check the sdk sources (audsrv for i.e.). |
|
| Back to top |
|
 |
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Tue Dec 06, 2005 7:35 pm Post subject: |
|
|
I know how to read the TOC, I just can't find any information on how it is organized?
Also, what is its exact size? In libcdvd.h it says:
| Code: | // get toc from inserted disc
//
// args: buffer to hold toc (1024 or 2064 bytes?)
// returns: 1 if successful
// 0 otherwise
s32 cdGetToc(u8 *toc);
|
Any help would be appreciated. |
|
| Back to top |
|
 |
|