diff options
Diffstat (limited to 'cdutils.cpp')
-rw-r--r-- | cdutils.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cdutils.cpp b/cdutils.cpp index d697b52..bba473a 100644 --- a/cdutils.cpp +++ b/cdutils.cpp @@ -34,7 +34,7 @@ char * sec_modes[5] = {"MODE 0 (no mode)", "MODE 1", "MODE 2", "MODE 2 FORM 1", struct DirEntry rootDir; unsigned char from_BCD(unsigned char x) { - return ((x & 0xff) + ((x & 0xff00) >> 4) * 10); + return ((x & 0xf) + ((x & 0xf0) >> 4) * 10); } unsigned char to_BCD(unsigned char x) { @@ -45,13 +45,17 @@ int is_valid_BCD(unsigned char x) { return (((x & 15) < 10) && ((x >> 4) < 10)); } +unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start) { + return (from_BCD(m) * 60 + from_BCD(s)) * 75 + from_BCD(f) - start; +} + unsigned long from_MSF(unsigned long msf, unsigned long start) { unsigned char - f = from_BCD(msf & 0xff), - s = from_BCD((msf >> 8) & 0xff), - m = from_BCD((msf >> 16) & 0xff); + f = msf & 0xff, + s = (msf >> 8) & 0xff, + m = (msf >> 16) & 0xff; - return (m * 60 + s) * 75 + f - start; + return from_MSF(m, s, f, start); } FILE * open_ppf(char * ppf, FILE * iso, char * comment) { |