From 8871e4ca37ae147715dc957904686dd4add82d77 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 2 Nov 2005 21:34:01 +0000 Subject: Adding DVD support, and updating zlib. --- includes/cdutils.h | 18 +++++++++++----- includes/dvdabstract.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ includes/isobuilder.h | 12 +++++------ 3 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 includes/dvdabstract.h (limited to 'includes') diff --git a/includes/cdutils.h b/includes/cdutils.h index 3e11ca2..c463908 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.18 2004-11-27 21:47:53 pixel Exp $ */ +/* $Id: cdutils.h,v 1.19 2005-11-02 21:34:02 pixel Exp $ */ #ifndef __CDUTILS_H__ #define __CDUTILS_H__ @@ -76,15 +76,23 @@ class cdutils : public Base { Handle * open_ppf(String ppf, String comment) throw(GeneralException); void close_ppf() throw(GeneralException); void set_iso_w(Handle *); - static unsigned short int swap_word(unsigned short int i); - static unsigned long int swap_dword(unsigned long int i); + static Uint16 swap_word(Uint16 i); + static Uint32 swap_dword(Uint32 i); + static Uint16 from_LE16(Uint16 i); + static Uint32 from_LE32(Uint32 i); + static Uint16 from_BE16(Uint16 i); + static Uint32 from_BE32(Uint32 i); + static Uint16 to_LE16(Uint16 i) { return from_LE16(i); } + static Uint32 to_LE32(Uint32 i) { return from_LE32(i); } + static Uint16 to_BE16(Uint16 i) { return from_BE16(i); } + static Uint32 to_BE32(Uint32 i) { return from_BE32(i); } int guess_type(int number = -1); void sector_seek(long sector); long read_sector(Byte * buffer, int type = GUESS, int number = -1); - void read_datas(Byte * buffer, long size, int type = GUESS, int number = -1); + void read_data(Byte * buffer, long size, int type = GUESS, int number = -1); void read_file(Handle * Handle, long size, int type = GUESS, int number = -1); void write_sector(Byte * buffer, int type = GUESS, int number = -1) throw (GeneralException); - void write_datas(Byte * buffer, long size, int type = GUESS, int number = -1); + void write_data(Byte * buffer, long size, int type = GUESS, int number = -1); void write_file(Handle * Handle, long size = -1, int type = GUESS, int number = -1); void create_sector(int type, int number, bool eof = false) throw (GeneralException); int get_iso_infos(); diff --git a/includes/dvdabstract.h b/includes/dvdabstract.h new file mode 100644 index 0000000..f11f5f6 --- /dev/null +++ b/includes/dvdabstract.h @@ -0,0 +1,56 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: dvdabstract.h,v 1.1 2005-11-02 21:34:02 pixel Exp $ */ + +#ifndef __DVDABSTRACT_H__ +#define __DVDABSTRACT_H__ + +#include +#include +#include + +class dvdabstract : public Handle { + public: + dvdabstract(Handle * h, int = MODE2_FORM1); + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + virtual off_t tell() const; + virtual ssize_t read(void * buf, size_t count) throw (GeneralException); + virtual ssize_t write(const void * buf, size_t count) throw (GeneralException); + + virtual bool CanRead() const { return r->CanRead(); } + virtual bool CanWrite() const { return r->CanWrite(); } + virtual bool CanSeek() const { return true; } + virtual String GetName() const { return "DVD abstraction of " + r->GetName(); } + virtual time_t GetModif() const { return r->GetModif(); } + virtual bool CanWatch() const { return false; } + virtual void Flush() { r->Flush(); } + virtual void SetZ(int = 9) throw (GeneralException) { throw GeneralException("Can't SetZ() a dvdabstract."); } + virtual int Dup() const throw (GeneralException) { throw GeneralException("Can't Dup() a dvdabstract."); } + + private: + Handle * r; + off_t v; + int m; + + void write_sector(const char * buf, int sector) throw (GeneralException); + void read_sector(char * buf, int sector); +}; + +#endif diff --git a/includes/isobuilder.h b/includes/isobuilder.h index c01406b..7f86f05 100644 --- a/includes/isobuilder.h +++ b/includes/isobuilder.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: isobuilder.h,v 1.12 2004-12-17 11:48:41 pixel Exp $ */ +/* $Id: isobuilder.h,v 1.13 2005-11-02 21:34:02 pixel Exp $ */ #ifndef __ISOBUILDER_H__ #define __ISOBUILDER_H__ @@ -30,9 +30,9 @@ class isobuilder : public Base { public: struct Date { int year, month, day, hour, minute, second, hundredths, offset; - void dump(Byte * datas); + void dump(Byte * data); Date(int = 0); - Date(Byte * datas); + Date(Byte * data); }; struct PVD { String sysid, volid; @@ -47,7 +47,7 @@ class isobuilder : public Base { virtual ~DirTree(); void fromdir(cdutils::DirEntry *); void dumpdirs(isobuilder *) throw (GeneralException); - int buildpath(Byte * datas, int size, bool bigendian = false) throw (GeneralException); + int buildpath(Byte * data, int size, bool bigendian = false) throw (GeneralException); bool isdir(); void setbasicsxa(); int sector; @@ -76,8 +76,8 @@ class isobuilder : public Base { void foreword(Byte * forewords, int mode = MODE_RAW); int getdispsect(); int putfile(Handle * file, int mode = -1, int sector = -1); - int putdatas(Byte * datas, size_t size, int mode = -1, int sector = -1); - int createsector(Byte * datas, int mode = -1, int sector = -1, int FN = -1, int CN = -1, int SM = -1, int CI = -1); + int putdata(Byte * data, size_t size, int mode = -1, int sector = -1); + int createsector(Byte * data, int mode = -1, int sector = -1, int FN = -1, int CN = -1, int SM = -1, int CI = -1); int createsector(Handle * file, int mode = -1, int sector = -1, int FN = -1, int CN = -1, int SM = -1, int CI = -1); void setEOF(); void clearEOF(); -- cgit v1.2.3