2014-04-06 13:11:19 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2014 David Quintana [gigaherz]
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
#ifndef __CDVD_H__
|
|
|
|
#define __CDVD_H__
|
|
|
|
|
2016-02-26 11:05:50 +00:00
|
|
|
#define _WIN32_WINNT 0x0600
|
2010-04-24 21:37:39 +00:00
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define CDVDdefs
|
|
|
|
#include <PS2Edefs.h>
|
|
|
|
|
2016-09-19 23:40:45 +00:00
|
|
|
struct track
|
2010-04-24 21:37:39 +00:00
|
|
|
{
|
2016-09-19 17:24:54 +00:00
|
|
|
u32 start_lba;
|
|
|
|
u32 length;
|
2016-09-19 23:40:45 +00:00
|
|
|
u8 type;
|
|
|
|
};
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 23:40:45 +00:00
|
|
|
extern u8 strack;
|
|
|
|
extern u8 etrack;
|
2010-04-24 21:37:39 +00:00
|
|
|
extern track tracks[100];
|
|
|
|
|
|
|
|
extern int curDiskType;
|
|
|
|
extern int curTrayStatus;
|
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
typedef struct _toc_entry
|
|
|
|
{
|
2010-04-24 21:37:39 +00:00
|
|
|
UCHAR SessionNumber;
|
2016-09-19 17:24:54 +00:00
|
|
|
UCHAR Control : 4;
|
|
|
|
UCHAR Adr : 4;
|
2010-04-24 21:37:39 +00:00
|
|
|
UCHAR Reserved1;
|
|
|
|
UCHAR Point;
|
|
|
|
UCHAR MsfExtra[3];
|
|
|
|
UCHAR Zero;
|
|
|
|
UCHAR Msf[3];
|
|
|
|
} toc_entry;
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
typedef struct _toc_data
|
2010-04-24 21:37:39 +00:00
|
|
|
{
|
|
|
|
UCHAR Length[2];
|
|
|
|
UCHAR FirstCompleteSession;
|
|
|
|
UCHAR LastCompleteSession;
|
|
|
|
|
|
|
|
toc_entry Descriptors[255];
|
|
|
|
} toc_data;
|
|
|
|
|
|
|
|
extern toc_data cdtoc;
|
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
class IOCtlSrc
|
2010-04-24 21:37:39 +00:00
|
|
|
{
|
2016-09-19 17:24:54 +00:00
|
|
|
IOCtlSrc(IOCtlSrc &);
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
HANDLE device;
|
|
|
|
bool OpenOK;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
char sectorbuffer[32 * 2048];
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
char fName[256];
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
DWORD sessID;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
bool tocCached;
|
|
|
|
char tocCacheData[2048];
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
bool mediaTypeCached;
|
|
|
|
int mediaType;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
bool discSizeCached;
|
|
|
|
s32 discSize;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
bool layerBreakCached;
|
|
|
|
s32 layerBreak;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
public:
|
2016-09-19 17:24:54 +00:00
|
|
|
IOCtlSrc(const char *fileName);
|
2016-09-21 18:00:07 +00:00
|
|
|
~IOCtlSrc();
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
s32 GetSectorCount();
|
|
|
|
s32 ReadTOC(char *toc, int size);
|
|
|
|
s32 ReadSectors2048(u32 sector, u32 count, char *buffer);
|
|
|
|
s32 ReadSectors2352(u32 sector, u32 count, char *buffer);
|
|
|
|
s32 GetLayerBreakAddress();
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
s32 GetMediaType();
|
|
|
|
void SetSpindleSpeed(bool restore_defaults);
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
s32 IsOK();
|
|
|
|
s32 Reopen();
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
s32 DiscChanged();
|
2010-04-24 21:37:39 +00:00
|
|
|
};
|
|
|
|
|
2016-09-21 18:00:07 +00:00
|
|
|
extern IOCtlSrc *src;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
void configure();
|
|
|
|
|
|
|
|
extern char source_drive;
|
|
|
|
|
|
|
|
extern HINSTANCE hinst;
|
|
|
|
|
2016-09-19 17:24:54 +00:00
|
|
|
#define MSF_TO_LBA(m, s, f) ((m * 60 + s) * 75 + f - 150)
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings();
|
2016-09-19 17:24:54 +00:00
|
|
|
void CfgSetSettingsDir(const char *dir);
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2014-07-15 21:06:49 +00:00
|
|
|
extern bool cdvd_is_open;
|
|
|
|
extern bool cdvdKeepAlive_is_open;
|
|
|
|
extern bool disc_has_changed;
|
|
|
|
extern bool weAreInNewDiskCB;
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
extern void (*newDiscCB)();
|
|
|
|
|
|
|
|
s32 cdvdStartThread();
|
|
|
|
void cdvdStopThread();
|
|
|
|
s32 cdvdRequestSector(u32 sector, s32 mode);
|
|
|
|
s32 cdvdRequestComplete();
|
2016-09-19 17:24:54 +00:00
|
|
|
char *cdvdGetSector(s32 sector, s32 mode);
|
2010-04-24 21:37:39 +00:00
|
|
|
s32 cdvdDirectReadSector(s32 first, s32 mode, char *buffer);
|
|
|
|
s32 cdvdGetMediaType();
|
|
|
|
s32 cdvdRefreshData();
|
|
|
|
s32 cdvdParseTOC();
|
|
|
|
|
|
|
|
#endif /* __CDVD_H__ */
|