/* Mednafen - Multi-system Emulator1*2* This program is free software; you can redistribute it and/or modify3* it under the terms of the GNU General Public License as published by4* the Free Software Foundation; either version 2 of the License, or5* (at your option) any later version.6*7* This program is distributed in the hope that it will be useful,8* but WITHOUT ANY WARRANTY; without even the implied warranty of9* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10* GNU General Public License for more details.11*12* You should have received a copy of the GNU General Public License13* along with this program; if not, write to the Free Software14* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA15*/1617#ifndef __MDFN_CDROM_CDROMIF_H18#define __MDFN_CDROM_CDROMIF_H1920#include "CDUtility.h"21#include "stream.h"2223#include <queue>2425typedef CDUtility::TOC CD_TOC;2627class CDIF28{29public:3031CDIF();32virtual ~CDIF();3334static const int32 LBA_Read_Minimum = -150;35static const int32 LBA_Read_Maximum = 449849; // 100 * 75 * 60 - 150 - 13637inline void ReadTOC(CDUtility::TOC *read_target)38{39*read_target = disc_toc;40}4142virtual void HintReadSector(int32 lba) = 0;43virtual bool ReadRawSector(uint8 *buf, int32 lba) = 0; // Reads 2352+96 bytes of data into buf.44virtual bool ReadRawSectorPWOnly(uint8* pwbuf, int32 lba, bool hint_fullread) = 0; // Reads 96 bytes(of raw subchannel PW data) into pwbuf.4546// Call for mode 1 or mode 2 form 1 only.47bool ValidateRawSector(uint8 *buf);4849// Utility/Wrapped functions50// Reads mode 1 and mode2 form 1 sectors(2048 bytes per sector returned)51// Will return the type(1, 2) of the first sector read to the buffer supplied, 0 on error52int ReadSector(uint8* buf, int32 lba, uint32 sector_count, bool suppress_uncorrectable_message = false);5354// For Mode 1, or Mode 2 Form 1.55// No reference counting or whatever is done, so if you destroy the CDIF object before you destroy the returned Stream, things will go BOOM.56Stream *MakeStream(int32 lba, uint32 sector_count);5758protected:59bool UnrecoverableError;60CDUtility::TOC disc_toc;61};6263CDIF *CDIF_Open(const std::string& path, bool image_memcache);6465#endif666768