2013-12-19 17:10:14 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2021-09-30 12:24:17 +00:00
|
|
|
extern Disc* disc;
|
2019-07-30 17:04:51 +00:00
|
|
|
|
|
|
|
u32 libGDR_GetTrackNumber(u32 sector, u32& elapsed)
|
|
|
|
{
|
2020-01-30 17:59:26 +00:00
|
|
|
if (disc != NULL)
|
|
|
|
{
|
2020-03-29 18:58:49 +00:00
|
|
|
for (size_t i = 0; i < disc->tracks.size(); i++)
|
2020-01-30 17:59:26 +00:00
|
|
|
if (disc->tracks[i].StartFAD <= sector && (sector <= disc->tracks[i].EndFAD || disc->tracks[i].EndFAD == 0))
|
|
|
|
{
|
|
|
|
elapsed = sector - disc->tracks[i].StartFAD;
|
|
|
|
return i + 1;
|
|
|
|
}
|
|
|
|
}
|
2019-07-30 17:04:51 +00:00
|
|
|
elapsed = 0;
|
|
|
|
return 0xAA;
|
|
|
|
}
|
|
|
|
|
2019-07-31 20:08:56 +00:00
|
|
|
bool libGDR_GetTrack(u32 track_num, u32& start_fad, u32& end_fad)
|
|
|
|
{
|
|
|
|
if (track_num == 0 || track_num > disc->tracks.size())
|
|
|
|
return false;
|
|
|
|
start_fad = disc->tracks[track_num - 1].StartFAD;
|
|
|
|
end_fad = disc->tracks[track_num - 1].EndFAD;
|
|
|
|
if (end_fad == 0)
|
|
|
|
{
|
|
|
|
if (track_num == disc->tracks.size())
|
|
|
|
end_fad = disc->LeadOut.StartFAD - 1;
|
|
|
|
else
|
|
|
|
end_fad = disc->tracks[track_num].StartFAD - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|