/[pcsx2_0.9.7]/trunk/pcsx2/CDVD/IsoFS/IsoFile.h
ViewVC logotype

Contents of /trunk/pcsx2/CDVD/IsoFS/IsoFile.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years, 7 months ago) by william
File MIME type: text/plain
File size: 1867 byte(s)
committing r3113 initial commit again...
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #pragma once
17
18 #include "IsoFileDescriptor.h"
19 #include "SectorSource.h"
20
21 class IsoFile
22 {
23 public:
24 static const int sectorLength = 2048;
25
26 protected:
27 SectorSource& internalReader;
28 IsoFileDescriptor fileEntry;
29
30 u32 currentOffset;
31 u32 maxOffset;
32
33 int currentSectorNumber;
34 u8 currentSector[sectorLength];
35 int sectorOffset;
36
37 public:
38 IsoFile(const IsoDirectory& dir, const wxString& filename);
39 IsoFile(SectorSource& reader, const wxString& filename);
40 IsoFile(SectorSource& reader, const IsoFileDescriptor& fileEntry);
41 virtual ~IsoFile() throw();
42
43 u32 seek(u32 absoffset);
44 u32 seek(s64 offset, wxSeekMode ref_position);
45 void reset();
46
47 s32 skip(s32 n);
48 u32 getSeekPos() const;
49 u32 getLength();
50 bool eof() const;
51
52 const IsoFileDescriptor& getEntry();
53
54 u8 readByte();
55 s32 read(void* dest, s32 len);
56 std::string readLine();
57
58 // Tool to read a specific value type, including structs.
59 template< class T >
60 T read()
61 {
62 if(sizeof(T)==1)
63 return (T)readByte();
64 else
65 {
66 T t;
67 read((u8*)&t,sizeof(t));
68 return t;
69 }
70 }
71
72 protected:
73 void makeDataAvailable();
74 int internalRead(void* dest, int off, int len);
75 void Init();
76 };

  ViewVC Help
Powered by ViewVC 1.1.22