Play-/Source/ISO9660/VolumeDescriptor.cpp

53 lines
1 KiB
C++
Raw Normal View History

#include <string.h>
#include <stdexcept>
#include "VolumeDescriptor.h"
#include "File.h"
#define VOLUME_DESCRIPTOR_LBA 16ULL
using namespace ISO9660;
CVolumeDescriptor::CVolumeDescriptor(CBlockProvider* blockProvider)
{
CFile stream(blockProvider, VOLUME_DESCRIPTOR_LBA * CBlockProvider::BLOCKSIZE);
2018-04-30 21:01:23 +01:00
stream.Read(&m_type, 1);
2014-07-12 21:59:58 -04:00
if(m_type != 0x01)
{
throw std::runtime_error("Invalid ISO9660 Volume Descriptor.");
}
stream.Read(m_stdId, 5);
2014-07-12 21:59:58 -04:00
m_stdId[5] = 0x00;
2014-07-12 21:59:58 -04:00
if(strcmp(m_stdId, "CD001"))
{
throw std::runtime_error("Invalid ISO9660 Volume Descriptor.");
}
stream.Seek(34, Framework::STREAM_SEEK_CUR);
stream.Read(m_volumeId, 32);
2014-07-12 21:59:58 -04:00
m_volumeId[32] = 0x00;
stream.Seek(68, Framework::STREAM_SEEK_CUR);
stream.Read(&m_LPathTableAddress, 4);
stream.Read(&m_MPathTableAddress, 4);
}
CVolumeDescriptor::~CVolumeDescriptor()
{
}
uint32 CVolumeDescriptor::GetLPathTableAddress() const
{
2014-07-12 21:59:58 -04:00
return m_LPathTableAddress;
}
uint32 CVolumeDescriptor::GetMPathTableAddress() const
{
2014-07-12 21:59:58 -04:00
return m_MPathTableAddress;
}