1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
21 #include "StringUtil.h"
22 #include "FileMonitor.h"
26 CVolumeGC::CVolumeGC(IBlobReader
* _pReader
)
30 CVolumeGC::~CVolumeGC()
33 m_pReader
= NULL
; // I don't think this makes any difference, but anyway
36 bool CVolumeGC::Read(u64 _Offset
, u64 _Length
, u8
* _pBuffer
) const
38 if (m_pReader
== NULL
)
41 FileMon::FindFilename(_Offset
);
43 return m_pReader
->Read(_Offset
, _Length
, _pBuffer
);
46 bool CVolumeGC::RAWRead( u64 _Offset
, u64 _Length
, u8
* _pBuffer
) const
51 std::string
CVolumeGC::GetUniqueID() const
53 static const std::string
NO_UID("NO_UID");
54 if (m_pReader
== NULL
)
58 if (!Read(0, sizeof(id
), reinterpret_cast<u8
*>(id
)))
60 PanicAlert("Failed to read unique ID from disc image");
64 return std::string(id
, sizeof(id
));
67 IVolume::ECountry
CVolumeGC::GetCountry() const
70 return COUNTRY_UNKNOWN
;
73 m_pReader
->Read(3, 1, &CountryCode
);
75 return CountrySwitch(CountryCode
);
78 std::string
CVolumeGC::GetMakerID() const
80 if (m_pReader
== NULL
)
84 if (!Read(0x4, 0x2, (u8
*)&makerID
))
91 std::string
CVolumeGC::GetName() const
93 if (m_pReader
== NULL
)
97 if (!Read(0x20, 0x60, (u8
*)&name
))
103 u32
CVolumeGC::GetFSTSize() const
105 if (m_pReader
== NULL
)
109 if (!Read(0x428, 0x4, (u8
*)&size
))
112 return Common::swap32(size
);
115 std::string
CVolumeGC::GetApploaderDate() const
117 if (m_pReader
== NULL
)
118 return std::string();
121 if (!Read(0x2440, 0x10, (u8
*)&date
))
122 return std::string();
123 // Should be 0 already, but just in case
129 u64
CVolumeGC::GetSize() const
132 return (size_t)m_pReader
->GetDataSize();