summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-04 00:57:34 +0000
committerpixel <pixel>2003-12-04 00:57:34 +0000
commitf66e6dc084e365983de8dd29b3e83d515bc2f895 (patch)
tree8671ae5ebb6d2d65fc24eeb626ab12d7d2da2241 /includes
parent6741207a4acd174f12bad340be34ca1275a5e6cd (diff)
Completed the isobuilder class, and fixed stuff in the other iso code.
Diffstat (limited to 'includes')
-rw-r--r--includes/cdabstract.h2
-rw-r--r--includes/cdreader.h18
-rw-r--r--includes/cdutils.h41
-rw-r--r--includes/isobuilder.h77
-rw-r--r--includes/yazedc.h1
5 files changed, 125 insertions, 14 deletions
diff --git a/includes/cdabstract.h b/includes/cdabstract.h
index 60061d4..7897bf9 100644
--- a/includes/cdabstract.h
+++ b/includes/cdabstract.h
@@ -31,7 +31,7 @@ class cdabstract : public Base {
static Handle * open_cd(const String &);
static bool canprobe();
static std::vector<String> probe() throw (GeneralException);
-#if defined (_MSC_VER) || defined (__MINGW32__)
+#ifdef _WIN32
protected:
static HANDLE OpenIOCTLFile(char cLetter);
static void GetIOCTLAdapter(HANDLE hF, int * iDA, int * iDT, int * iDL);
diff --git a/includes/cdreader.h b/includes/cdreader.h
index 6e952bb..4be3344 100644
--- a/includes/cdreader.h
+++ b/includes/cdreader.h
@@ -11,7 +11,7 @@ class cdreader : public Handle {
public:
cdreader(const String &) throw (GeneralException);
cdreader(const cdreader &);
- virtual ~cdreader() {}
+ virtual ~cdreader();
virtual bool CanWrite() const;
virtual bool CanRead() const;
virtual bool CanSeek() const;
@@ -22,12 +22,24 @@ class cdreader : public Handle {
virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException);
virtual String GetName() const;
virtual ssize_t GetSize() const;
- virtual void getsector(void *, int = -1) throw (GeneralException);
- virtual void sectorseek(int);
+ void fetchsector(void *, int = -1);
+ void getsector(void *, int = -1, int = 1) throw (GeneralException);
+ void sectorseek(int);
private:
+ struct cachedsector {
+ Byte sector[2352];
+ cachedsector * next, * prev;
+ int n;
+ };
String n;
int sector;
+ cachedsector * head, * tail, * sectors[400000];
+ int nsectors;
+
+ void removetail();
+ void actualize(cachedsector * s);
+ void introduce(Byte * datas, int n);
};
#endif
diff --git a/includes/cdutils.h b/includes/cdutils.h
index 12746dd..cf1af4a 100644
--- a/includes/cdutils.h
+++ b/includes/cdutils.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: cdutils.h,v 1.11 2003-11-25 01:55:45 pixel Exp $ */
+/* $Id: cdutils.h,v 1.12 2003-12-04 00:57:35 pixel Exp $ */
#ifndef __CDUTILS_H__
#define __CDUTILS_H__
@@ -71,14 +71,13 @@ class cdutils : public Base {
char id[1];
} PACKED;
-
- struct DirEntry rootDir;
+ struct DirEntry * rootDir;
Handle * open_ppf(String ppf, String comment) throw(GeneralException);
void close_ppf() throw(GeneralException);
void set_iso_w(Handle *);
- unsigned short int swap_word(unsigned short int i);
- unsigned long int swap_dword(unsigned long int i);
+ static unsigned short int swap_word(unsigned short int i);
+ static unsigned long int swap_dword(unsigned long int i);
int guess_type(int number = -1);
void sector_seek(long sector);
long read_sector(Byte * buffer, int type, int number = -1);
@@ -93,16 +92,18 @@ class cdutils : public Base {
int show_pt_infos();
struct DirEntry find_path(String path);
struct DirEntry find_parent(String path);
+ struct DirEntry * find_path(Byte ** buffer, String path);
+ struct DirEntry * find_parent(Byte ** buffer, String path);
void show_head_entry(void);
int show_entry(struct DirEntry * dir);
int show_dir(struct DirEntry * dir);
struct DirEntry find_dir_entry(struct DirEntry * dir, String name);
struct DirEntry * find_dir_entry(Byte ** buffer, struct DirEntry * dir, String name);
- unsigned char from_BCD(unsigned char x);
- unsigned char to_BCD(unsigned char x);
- bool is_valid_BCD(unsigned char x);
- unsigned long from_MSF(unsigned long msf, unsigned long start = 150);
- unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150);
+ static unsigned char from_BCD(unsigned char x);
+ static unsigned char to_BCD(unsigned char x);
+ static bool is_valid_BCD(unsigned char x);
+ static unsigned long from_MSF(unsigned long msf, unsigned long start = 150);
+ static unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150);
private:
void write_ppf(Byte * old_sec, Byte * new_sec, int sec_num);
String format_date(String input);
@@ -112,4 +113,24 @@ class cdutils : public Base {
int pt1, pt2, snum, ptl, root;
};
+class cdfile : public Handle {
+ public:
+ cdfile(cdutils *, const cdutils::DirEntry *, int = GUESS);
+ cdfile(cdutils *, int sector, ssize_t = -1, int = GUESS);
+ virtual ~cdfile();
+ virtual ssize_t read(void *buf, size_t count) throw (GeneralException);
+ virtual bool CanRead() const;
+ virtual String GetName() const;
+ virtual bool CanWatch() const;
+ virtual ssize_t GetSize() const;
+ virtual bool CanSeek() const;
+ virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException);
+ private:
+ cdutils * cd;
+ int sector, mode;
+ size_t size;
+ String name;
+ cdutils::DirEntry * dir;
+};
+
#endif
diff --git a/includes/isobuilder.h b/includes/isobuilder.h
new file mode 100644
index 0000000..bbbe6bf
--- /dev/null
+++ b/includes/isobuilder.h
@@ -0,0 +1,77 @@
+#ifndef __ISOBUILDER_H__
+#define __ISOBUILDER_H__
+
+#include <Handle.h>
+#include "cdutils.h"
+#include "yazedc.h"
+
+class isobuilder : public Base {
+ public:
+ struct Date {
+ int year, month, day, hour, minute, second, hundredths, offset;
+ void dump(Byte * datas);
+ Date(int = 0);
+ Date(Byte * datas);
+ };
+ struct PVD {
+ String sysid, volid;
+ String volsetid, pubid, prepid, appid;
+ String copyright, abstract, biblio;
+ Date volcreat, modif, volexp, voleff;
+ Byte appdata[512];
+ };
+ class DirTree : public Base {
+ public:
+ DirTree(DirTree * father, bool dir = true);
+ virtual ~DirTree();
+ void fromdir(cdutils::DirEntry *);
+ void dumpdirs(isobuilder *) throw (GeneralException);
+ int buildpath(Byte * datas, int size, bool bigendian = false) throw (GeneralException);
+ void setbasicsxa();
+ int sector;
+ int size;
+ bool hidden;
+ String name;
+ Date creation;
+ bool have_xa, xa_dir, xa_audio, xa_str, xa_xa, xa_form1;
+ int buildentry(Byte * buffer, int spaceleft, bool put_xa = true);
+ int mode;
+ private:
+ DirTree * father, * child, * brother;
+ bool dir;
+ int node;
+ int numerate(int);
+ };
+ isobuilder(Handle * w, int mode = MODE2_FORM1);
+ ~isobuilder();
+ void foreword(Handle * forewords, int mode = MODE_RAW);
+ void foreword(Byte * forewords, int mode = MODE_RAW);
+ int getdispsect();
+ int putfile(Handle * file, int mode = -1, int n = -1);
+ void putdatas(Byte * datas, size_t size, int mode = -1, int n = -1);
+ void createsector(Byte * datas, int type = -1, int n = -1);
+ void setEOF();
+ void clearEOF();
+ DirTree * setbasics(PVD pvd, int rootsize = 1, int ptsize = 1, int nvd = 1) throw (GeneralException);
+ DirTree * createdir(DirTree *, const String & _name, int size = 1, cdutils::DirEntry * = 0, int mode = MODE2_FORM1) throw (GeneralException);
+ DirTree * createfile(DirTree *, Handle * file, const String & _name, cdutils::DirEntry * = 0, int mode = MODE2_FORM1) throw (GeneralException);
+ void copydir(DirTree *, const String & _name, cdutils *, cdutils::DirEntry *, int mode = MODE2_FORM1);
+ static PVD createpvd(Handle *);
+ static PVD createpvd(cdutils *);
+ static PVD createpvd(Byte *);
+ void close(Handle * cue = 0, int mode = -1) throw (GeneralException);
+ private:
+ Handle * w;
+ int sector, nsectors;
+ int sub_EOF, sub_EOR;
+ bool basics;
+ PVD pvd;
+ int rootsize, ptsize, nvd, ptsect, rootsect;
+ int lastdispsect;
+ DirTree * root;
+ yazedc yazedc_o;
+ bool closed;
+ int dmode;
+};
+
+#endif
diff --git a/includes/yazedc.h b/includes/yazedc.h
index 298c0eb..87f026c 100644
--- a/includes/yazedc.h
+++ b/includes/yazedc.h
@@ -21,6 +21,7 @@
*/
#ifndef __YAZEDC_H__
+#define __YAZEDC_H__
#include "Exceptions.h"