Play-/Source/ISO9660/VolumeDescriptor.cpp

51 lines
966 B
C++
Raw Normal View History

#include <string.h>
#include <stdexcept>
#include "VolumeDescriptor.h"
using namespace ISO9660;
2014-07-12 21:59:58 -04:00
CVolumeDescriptor::CVolumeDescriptor(Framework::CStream* stream)
{
2014-07-12 21:59:58 -04:00
//Starts at LBA 16
stream->Seek(0x8000, Framework::STREAM_SEEK_SET);
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.");
}
2014-07-12 21:59:58 -04:00
stream->Read(m_stdId, 5);
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.");
}
2014-07-12 21:59:58 -04:00
stream->Seek(34, Framework::STREAM_SEEK_CUR);
2014-07-12 21:59:58 -04:00
stream->Read(m_volumeId, 32);
m_volumeId[32] = 0x00;
2014-07-12 21:59:58 -04:00
stream->Seek(68, Framework::STREAM_SEEK_CUR);
2014-07-12 21:59:58 -04:00
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;
}