2 * FryingPan - Amiga CD/DVD Recording Software (User Interface and supporting Libraries only)
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <libclass/dos.h>
22 #include <libclass/exec.h>
23 #include <libclass/utility.h>
25 #define MKID(a,b,c,d) (((a&255)<<24)|((b&255)<<16)|((c&255)<<8)|(d&255))
26 #define ID_CD00 MKID('C','D','0','0')
29 IFileReader
*rISOData::openRead(const char* sFile
, EDtError
&rc
)
32 if (true == checkFile(sFile
, rc
))
34 pSkel
= new rISOData(sFile
, rc
);
39 rISOData::rISOData(const char *sName
, EDtError
&rc
)
40 : FileReader(sName
, rc
)
46 setLittleEndian(true); // so it is not touched
51 uint8
*ut
= new uint8
[4096];
54 fh
= DOS
->Open((char*)sName
, MODE_OLDFILE
);
55 // seek to primary vol descriptor + volume space size + MSB data
57 for (int i
=0; i
<9; i
++)
58 DOS
->Read(fh
, ut
, 4096);
60 sz
= (ut
[84] << 24) | (ut
[85] << 16) | (ut
[86] << 8) | ut
[87];
65 setDataSize(sz
<< 11);
69 bool rISOData::checkFile(const char* sFileName
, EDtError
&rc
)
74 rc
= DT_UnableToOpenFile
;
76 fh
= DOS
->Open(const_cast<char*>(sFileName
), MODE_OLDFILE
);
80 uint8
*ut
= new uint8
[4096];
82 for (int i
=0; i
<9; i
++)
84 if (DOS
->Read(fh
, ut
, 4096) < 4096)
92 rc
= DT_FileMalformed
;
108 rc
= DT_InvalidFormat
;
116 const char *rISOData::static_getName()
118 return "ISO Disc Image Reader";
121 bool rISOData::static_isAudio()
126 bool rISOData::static_isData()
131 bool rISOData::static_isSession()
136 bool rISOData::isAudio()
138 return static_isAudio();
141 bool rISOData::isData()
143 return static_isData();
146 const char *rISOData::getName()
148 return static_getName();