diff options
author | Pixel <Pixel> | 2002-08-25 18:37:36 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-08-25 18:37:36 +0000 |
commit | e2abcc08b4362b4d3769119d302b13409162d607 (patch) | |
tree | 1e835ec0e4b4b3857bbe5ebe3061679fbe2f367b | |
parent | b418ce925762c671d78799a2ec34fedcc968cf57 (diff) |
CD Reading working?
-rw-r--r-- | cd-tool.cpp | 13 | ||||
-rw-r--r-- | includes/cdreader.h | 10 | ||||
-rw-r--r-- | lib/cdreader.cpp | 8 |
3 files changed, 18 insertions, 13 deletions
diff --git a/cd-tool.cpp b/cd-tool.cpp index 9f10eaa..8a6b9c7 100644 --- a/cd-tool.cpp +++ b/cd-tool.cpp @@ -27,6 +27,7 @@ #include <unistd.h> #include "Input.h" #include "Output.h" +#include "cdreader.h" #include "cdutils.h" #include "generic.h" @@ -57,7 +58,7 @@ void showhelp(void) { "\n"); } -int main(int argc, char ** argv) { +int Main(int argc, char ** argv) { int type = GUESS, c, size, force = 0, sector; Handle * iso_r, * iso_w = 0; char * ppf = 0, * iso_name = 0, * arg1 = 0, * arg2 = 0, * f; @@ -97,7 +98,7 @@ int main(int argc, char ** argv) { exit(-1); } - iso_r = new Input(iso_name); + iso_r = new cdreader(iso_name); get_iso_infos(iso_r); @@ -293,3 +294,11 @@ int main(int argc, char ** argv) { exit(0); } +int main(int argc, char ** argv) { + try { + Main(argc, argv); + } + catch (GeneralException e) { + fprintf(stderr, "%s\n", e.GetMsg()); + } +} diff --git a/includes/cdreader.h b/includes/cdreader.h index b409c33..3991225 100644 --- a/includes/cdreader.h +++ b/includes/cdreader.h @@ -27,16 +27,6 @@ class cdreader : public Handle { int sector; }; -class Stdin_t : public cdreader { - public: - Stdin_t(); - virtual ~Stdin_t() {} - virtual bool CanSeek(); - virtual String GetName(); -}; - -extern Stdin_t Stdin; - #else #error This only works with a C++ compiler #endif diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp index a501b6d..5363251 100644 --- a/lib/cdreader.cpp +++ b/lib/cdreader.cpp @@ -96,16 +96,22 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) { struct cdrom_msf * msf = (struct cdrom_msf *) buf; if (sec >= 0) sector = sec; + + fprintf(stderr, "Reading sector %i\n", sector); + sector += 150; + msf->cdmsf_min0 = sector /CD_SECS /CD_FRAMES; msf->cdmsf_sec0 = (sector /CD_FRAMES)%CD_SECS; msf->cdmsf_frame0= sector %CD_FRAMES; msf->cdmsf_min1 = (sector+1)/CD_SECS /CD_FRAMES; msf->cdmsf_sec1 = ((sector+1)/CD_FRAMES)%CD_SECS; msf->cdmsf_frame1= (sector+1)%CD_FRAMES; + + sector -= 150; if (ioctl(GetHandle(), CDROMREADRAW, buf) < 0) { - throw GeneralException(String("unable to read cd sector: ") + strerror(errno)); + throw GeneralException(String("unable to read cd sector ") + sector + ": " + strerror(errno)); } sector++; |