Minor code conformity cleanups and svn properties settings for new cdvd code.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1504 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-13 13:09:27 +00:00
parent 31869753a0
commit b8b7e8d14d
5 changed files with 1110 additions and 1111 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,22 +19,23 @@
#ifndef __CDVD_ACCESS_H__
#define __CDVD_ACCESS_H__
s32 DoCDVDinit();
s32 DoCDVDopen(const char* pTitleFilename);
void DoCDVDclose();
void DoCDVDshutdown();
s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode);
s32 DoCDVDreadTrack(u32 lsn, int mode);
s32 DoCDVDgetBuffer(u8* buffer);
s32 DoCDVDreadSubQ(u32 lsn, cdvdSubQ* subq);
s32 DoCDVDgetTN(cdvdTN *Buffer);
s32 DoCDVDgetTD(u8 Track, cdvdTD *Buffer);
s32 DoCDVDgetTOC(void* toc);
s32 DoCDVDgetDiskType();
s32 DoCDVDgetTrayStatus();
s32 DoCDVDctrlTrayOpen();
s32 DoCDVDctrlTrayClose();
void DoCDVDnewDiskCB(void (*callback)());
s32 DoCDVDdetectDiskType();
void DoCDVDresetDiskTypeCache();
extern s32 DoCDVDinit();
extern s32 DoCDVDopen(const char* pTitleFilename);
extern void DoCDVDclose();
extern void DoCDVDshutdown();
extern s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode);
extern s32 DoCDVDreadTrack(u32 lsn, int mode);
extern s32 DoCDVDgetBuffer(u8* buffer);
extern s32 DoCDVDreadSubQ(u32 lsn, cdvdSubQ* subq);
extern s32 DoCDVDgetTN(cdvdTN *Buffer);
extern s32 DoCDVDgetTD(u8 Track, cdvdTD *Buffer);
extern s32 DoCDVDgetTOC(void* toc);
extern s32 DoCDVDgetDiskType();
extern s32 DoCDVDgetTrayStatus();
extern s32 DoCDVDctrlTrayOpen();
extern s32 DoCDVDctrlTrayClose();
extern void DoCDVDnewDiskCB(void (*callback)());
extern s32 DoCDVDdetectDiskType();
extern void DoCDVDresetDiskTypeCache();
#endif /* __CDVD_H__ */

View File

@ -1,426 +1,426 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
* Modified by Florin for PCSX2 emu
* Fixed CdRead by linuzappz
*/
#include "PrecompiledHeader.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "CDVDisoReader.h"
bool loadFromISO=false;
char isoFileName[256];
u8 *pbuffer;
int cdtype;
int psize;
isoFile *iso;
FILE *cdvdLog = NULL;
u8 cdbuffer[2352] = {0};
s32 msf_to_lba(u8 m, u8 s, u8 f)
{
u32 lsn;
lsn = f;
lsn += (s - 2) * 75;
lsn += m * 75 * 60;
return lsn;
}
void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
{
lba += 150;
*m = lba / (60 * 75);
*s = (lba / 75) % 60;
*f = lba % 75;
}
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#ifdef PCSX2_DEBUG
void __Log(char *fmt, ...)
{
va_list list;
if (cdvdLog == NULL) return;
va_start(list, fmt);
vfprintf(cdvdLog, fmt, list);
va_end(list);
}
#else
#define __Log 0&&
#endif
s32 ISOinit()
{
#ifdef PCSX2_DEBUG
cdvdLog = fopen("logs/cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
cdvdLog = fopen("cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
Console::Error("Can't create cdvdLog.txt");
return -1;
}
}
setvbuf(cdvdLog, NULL, _IONBF, 0);
CDVD_LOG("CDVDinit\n");
#endif
return 0;
}
void ISOshutdown()
{
#ifdef CDVD_LOG
if (cdvdLog != NULL) fclose(cdvdLog);
#endif
}
s32 ISOopen(const char* pTitle)
{
//if (pTitle != NULL) strcpy(isoFileName, pTitle);
iso = isoOpen(isoFileName);
if (iso == NULL)
{
Console::Error("Error loading %s\n", params isoFileName);
return -1;
}
if (iso->type == ISOTYPE_DVD)
cdtype = CDVD_TYPE_PS2DVD;
else if (iso->type == ISOTYPE_AUDIO)
cdtype = CDVD_TYPE_CDDA;
else
cdtype = CDVD_TYPE_PS2CD;
return 0;
}
void ISOclose()
{
isoClose(iso);
}
s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq)
{
// fake it
u8 min, sec, frm;
subq->ctrl = 4;
subq->mode = 1;
subq->trackNum = itob(1);
subq->trackIndex = itob(1);
lba_to_msf(lsn, &min, &sec, &frm);
subq->trackM = itob(min);
subq->trackS = itob(sec);
subq->trackF = itob(frm);
subq->pad = 0;
lba_to_msf(lsn + (2*75), &min, &sec, &frm);
subq->discM = itob(min);
subq->discS = itob(sec);
subq->discF = itob(frm);
return 0;
}
s32 ISOgetTN(cdvdTN *Buffer)
{
Buffer->strack = 1;
Buffer->etrack = 1;
return 0;
}
s32 ISOgetTD(u8 Track, cdvdTD *Buffer)
{
if (Track == 0)
{
Buffer->lsn = iso->blocks;
}
else
{
Buffer->type = CDVD_MODE1_TRACK;
Buffer->lsn = 0;
}
return 0;
}
static s32 layer1start = -1;
s32 ISOgetTOC(void* toc)
{
u8 type = CDVDgetDiskType();
u8* tocBuff = (u8*)toc;
//__Log("CDVDgetTOC\n");
if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD)
{
// get dvd structure format
// scsi command 0x43
memset(tocBuff, 0, 2048);
if (layer1start != -2 && iso->blocks >= 0x300000)
{
int off = iso->blockofs;
u8* tempbuffer;
// dual sided
tocBuff[ 0] = 0x24;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x41;
tocBuff[ 5] = 0x95;
tocBuff[14] = 0x60; // dual sided, ptp
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
// search for it
if (layer1start == -1)
{
printf("CDVD: searching for layer1...");
tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW);
for (layer1start = (iso->blocks / 2 - 0x10) & ~0xf; layer1start < 0x200010; layer1start += 16)
{
isoReadBlock(iso, tempbuffer, layer1start);
// CD001
if (tempbuffer[off+1] == 0x43 && tempbuffer[off+2] == 0x44 && tempbuffer[off+3] == 0x30 && tempbuffer[off+4] == 0x30 && tempbuffer[off+5] == 0x31)
break;
}
free(tempbuffer);
if (layer1start == 0x200010)
{
printf("Couldn't find second layer on dual layer... ignoring\n");
// fake it
tocBuff[ 0] = 0x04;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x86;
tocBuff[ 5] = 0x72;
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
layer1start = -2;
return 0;
}
printf("found at 0x%8.8x\n", layer1start);
layer1start = layer1start + 0x30000 - 1;
}
tocBuff[20] = layer1start >> 24;
tocBuff[21] = (layer1start >> 16) & 0xff;
tocBuff[22] = (layer1start >> 8) & 0xff;
tocBuff[23] = (layer1start >> 0) & 0xff;
}
else
{
// fake it
tocBuff[ 0] = 0x04;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x86;
tocBuff[ 5] = 0x72;
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
}
}
else if ((type == CDVD_TYPE_CDDA) || (type == CDVD_TYPE_PS2CDDA) ||
(type == CDVD_TYPE_PS2CD) || (type == CDVD_TYPE_PSCDDA) || (type == CDVD_TYPE_PSCD))
{
// cd toc
// (could be replaced by 1 command that reads the full toc)
u8 min, sec, frm;
s32 i, err;
cdvdTN diskInfo;
cdvdTD trackInfo;
memset(tocBuff, 0, 1024);
if (CDVDgetTN(&diskInfo) == -1)
{
diskInfo.etrack = 0;
diskInfo.strack = 1;
}
if (CDVDgetTD(0, &trackInfo) == -1) trackInfo.lsn = 0;
tocBuff[0] = 0x41;
tocBuff[1] = 0x00;
//Number of FirstTrack
tocBuff[2] = 0xA0;
tocBuff[7] = itob(diskInfo.strack);
//Number of LastTrack
tocBuff[12] = 0xA1;
tocBuff[17] = itob(diskInfo.etrack);
//DiskLength
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[22] = 0xA2;
tocBuff[27] = itob(min);
tocBuff[28] = itob(sec);
for (i = diskInfo.strack; i <= diskInfo.etrack; i++)
{
err = CDVDgetTD(i, &trackInfo);
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[i*10+30] = trackInfo.type;
tocBuff[i*10+32] = err == -1 ? 0 : itob(i); //number
tocBuff[i*10+37] = itob(min);
tocBuff[i*10+38] = itob(sec);
tocBuff[i*10+39] = itob(frm);
}
}
else
return -1;
return 0;
}
s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
{
int _lsn = lsn;
if (_lsn < 0)
lsn = iso->blocks + _lsn;
if(lsn > iso->blocks)
return -1;
if(mode == CDVD_MODE_2352)
{
isoReadBlock(iso, tempbuffer, lsn);
return 0;
}
isoReadBlock(iso, cdbuffer + iso->blockofs, lsn);
pbuffer = cdbuffer;
switch (mode)
{
case CDVD_MODE_2352:
psize = 2352;
break;
case CDVD_MODE_2340:
pbuffer += 12;
psize = 2340;
break;
case CDVD_MODE_2328:
pbuffer += 24;
psize = 2328;
break;
case CDVD_MODE_2048:
pbuffer += 24;
psize = 2048;
break;
}
memcpy_fast(tempbuffer,pbuffer,psize);
return 0;
}
s32 ISOreadTrack(u32 lsn, int mode)
{
int _lsn = lsn;
if (_lsn < 0)
lsn = iso->blocks + _lsn;
if(lsn > iso->blocks)
return -1;
isoReadBlock(iso, cdbuffer + iso->blockofs, lsn);
pbuffer = cdbuffer;
switch (mode)
{
case CDVD_MODE_2352:
psize = 2352;
break;
case CDVD_MODE_2340:
pbuffer += 12;
psize = 2340;
break;
case CDVD_MODE_2328:
pbuffer += 24;
psize = 2328;
break;
case CDVD_MODE_2048:
pbuffer += 24;
psize = 2048;
break;
}
return 0;
}
s32 ISOgetBuffer(u8* buffer)
{
memcpy_fast(buffer,pbuffer,psize);
return 0;
}
s32 ISOgetDiskType()
{
return cdtype;
}
s32 ISOgetTrayStatus()
{
return CDVD_TRAY_CLOSE;
}
s32 ISOctrlTrayOpen()
{
return 0;
}
s32 ISOctrlTrayClose()
{
return 0;
}
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Original code from libcdvd by Hiryu & Sjeep (C) 2002
* Modified by Florin for PCSX2 emu
* Fixed CdRead by linuzappz
*/
#include "PrecompiledHeader.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "CDVDisoReader.h"
bool loadFromISO=false;
char isoFileName[256];
u8 *pbuffer;
int cdtype;
int psize;
isoFile *iso;
FILE *cdvdLog = NULL;
u8 cdbuffer[2352] = {0};
s32 msf_to_lba(u8 m, u8 s, u8 f)
{
u32 lsn;
lsn = f;
lsn += (s - 2) * 75;
lsn += m * 75 * 60;
return lsn;
}
void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
{
lba += 150;
*m = lba / (60 * 75);
*s = (lba / 75) % 60;
*f = lba % 75;
}
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#ifdef PCSX2_DEBUG
void __Log(char *fmt, ...)
{
va_list list;
if (cdvdLog == NULL) return;
va_start(list, fmt);
vfprintf(cdvdLog, fmt, list);
va_end(list);
}
#else
#define __Log 0&&
#endif
s32 ISOinit()
{
#ifdef PCSX2_DEBUG
cdvdLog = fopen("logs/cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
cdvdLog = fopen("cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
Console::Error("Can't create cdvdLog.txt");
return -1;
}
}
setvbuf(cdvdLog, NULL, _IONBF, 0);
CDVD_LOG("CDVDinit\n");
#endif
return 0;
}
void ISOshutdown()
{
#ifdef CDVD_LOG
if (cdvdLog != NULL) fclose(cdvdLog);
#endif
}
s32 ISOopen(const char* pTitle)
{
//if (pTitle != NULL) strcpy(isoFileName, pTitle);
iso = isoOpen(isoFileName);
if (iso == NULL)
{
Console::Error("Error loading %s\n", params isoFileName);
return -1;
}
if (iso->type == ISOTYPE_DVD)
cdtype = CDVD_TYPE_PS2DVD;
else if (iso->type == ISOTYPE_AUDIO)
cdtype = CDVD_TYPE_CDDA;
else
cdtype = CDVD_TYPE_PS2CD;
return 0;
}
void ISOclose()
{
isoClose(iso);
}
s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq)
{
// fake it
u8 min, sec, frm;
subq->ctrl = 4;
subq->mode = 1;
subq->trackNum = itob(1);
subq->trackIndex = itob(1);
lba_to_msf(lsn, &min, &sec, &frm);
subq->trackM = itob(min);
subq->trackS = itob(sec);
subq->trackF = itob(frm);
subq->pad = 0;
lba_to_msf(lsn + (2*75), &min, &sec, &frm);
subq->discM = itob(min);
subq->discS = itob(sec);
subq->discF = itob(frm);
return 0;
}
s32 ISOgetTN(cdvdTN *Buffer)
{
Buffer->strack = 1;
Buffer->etrack = 1;
return 0;
}
s32 ISOgetTD(u8 Track, cdvdTD *Buffer)
{
if (Track == 0)
{
Buffer->lsn = iso->blocks;
}
else
{
Buffer->type = CDVD_MODE1_TRACK;
Buffer->lsn = 0;
}
return 0;
}
static s32 layer1start = -1;
s32 ISOgetTOC(void* toc)
{
u8 type = CDVDgetDiskType();
u8* tocBuff = (u8*)toc;
//__Log("CDVDgetTOC\n");
if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD)
{
// get dvd structure format
// scsi command 0x43
memset(tocBuff, 0, 2048);
if (layer1start != -2 && iso->blocks >= 0x300000)
{
int off = iso->blockofs;
u8* tempbuffer;
// dual sided
tocBuff[ 0] = 0x24;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x41;
tocBuff[ 5] = 0x95;
tocBuff[14] = 0x60; // dual sided, ptp
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
// search for it
if (layer1start == -1)
{
printf("CDVD: searching for layer1...");
tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW);
for (layer1start = (iso->blocks / 2 - 0x10) & ~0xf; layer1start < 0x200010; layer1start += 16)
{
isoReadBlock(iso, tempbuffer, layer1start);
// CD001
if (tempbuffer[off+1] == 0x43 && tempbuffer[off+2] == 0x44 && tempbuffer[off+3] == 0x30 && tempbuffer[off+4] == 0x30 && tempbuffer[off+5] == 0x31)
break;
}
free(tempbuffer);
if (layer1start == 0x200010)
{
printf("Couldn't find second layer on dual layer... ignoring\n");
// fake it
tocBuff[ 0] = 0x04;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x86;
tocBuff[ 5] = 0x72;
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
layer1start = -2;
return 0;
}
printf("found at 0x%8.8x\n", layer1start);
layer1start = layer1start + 0x30000 - 1;
}
tocBuff[20] = layer1start >> 24;
tocBuff[21] = (layer1start >> 16) & 0xff;
tocBuff[22] = (layer1start >> 8) & 0xff;
tocBuff[23] = (layer1start >> 0) & 0xff;
}
else
{
// fake it
tocBuff[ 0] = 0x04;
tocBuff[ 1] = 0x02;
tocBuff[ 2] = 0xF2;
tocBuff[ 3] = 0x00;
tocBuff[ 4] = 0x86;
tocBuff[ 5] = 0x72;
tocBuff[16] = 0x00;
tocBuff[17] = 0x03;
tocBuff[18] = 0x00;
tocBuff[19] = 0x00;
}
}
else if ((type == CDVD_TYPE_CDDA) || (type == CDVD_TYPE_PS2CDDA) ||
(type == CDVD_TYPE_PS2CD) || (type == CDVD_TYPE_PSCDDA) || (type == CDVD_TYPE_PSCD))
{
// cd toc
// (could be replaced by 1 command that reads the full toc)
u8 min, sec, frm;
s32 i, err;
cdvdTN diskInfo;
cdvdTD trackInfo;
memset(tocBuff, 0, 1024);
if (CDVDgetTN(&diskInfo) == -1)
{
diskInfo.etrack = 0;
diskInfo.strack = 1;
}
if (CDVDgetTD(0, &trackInfo) == -1) trackInfo.lsn = 0;
tocBuff[0] = 0x41;
tocBuff[1] = 0x00;
//Number of FirstTrack
tocBuff[2] = 0xA0;
tocBuff[7] = itob(diskInfo.strack);
//Number of LastTrack
tocBuff[12] = 0xA1;
tocBuff[17] = itob(diskInfo.etrack);
//DiskLength
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[22] = 0xA2;
tocBuff[27] = itob(min);
tocBuff[28] = itob(sec);
for (i = diskInfo.strack; i <= diskInfo.etrack; i++)
{
err = CDVDgetTD(i, &trackInfo);
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[i*10+30] = trackInfo.type;
tocBuff[i*10+32] = err == -1 ? 0 : itob(i); //number
tocBuff[i*10+37] = itob(min);
tocBuff[i*10+38] = itob(sec);
tocBuff[i*10+39] = itob(frm);
}
}
else
return -1;
return 0;
}
s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
{
int _lsn = lsn;
if (_lsn < 0)
lsn = iso->blocks + _lsn;
if(lsn > iso->blocks)
return -1;
if(mode == CDVD_MODE_2352)
{
isoReadBlock(iso, tempbuffer, lsn);
return 0;
}
isoReadBlock(iso, cdbuffer + iso->blockofs, lsn);
pbuffer = cdbuffer;
switch (mode)
{
case CDVD_MODE_2352:
psize = 2352;
break;
case CDVD_MODE_2340:
pbuffer += 12;
psize = 2340;
break;
case CDVD_MODE_2328:
pbuffer += 24;
psize = 2328;
break;
case CDVD_MODE_2048:
pbuffer += 24;
psize = 2048;
break;
}
memcpy_fast(tempbuffer,pbuffer,psize);
return 0;
}
s32 ISOreadTrack(u32 lsn, int mode)
{
int _lsn = lsn;
if (_lsn < 0)
lsn = iso->blocks + _lsn;
if(lsn > iso->blocks)
return -1;
isoReadBlock(iso, cdbuffer + iso->blockofs, lsn);
pbuffer = cdbuffer;
switch (mode)
{
case CDVD_MODE_2352:
psize = 2352;
break;
case CDVD_MODE_2340:
pbuffer += 12;
psize = 2340;
break;
case CDVD_MODE_2328:
pbuffer += 24;
psize = 2328;
break;
case CDVD_MODE_2048:
pbuffer += 24;
psize = 2048;
break;
}
return 0;
}
s32 ISOgetBuffer(u8* buffer)
{
memcpy_fast(buffer,pbuffer,psize);
return 0;
}
s32 ISOgetDiskType()
{
return cdtype;
}
s32 ISOgetTrayStatus()
{
return CDVD_TRAY_CLOSE;
}
s32 ISOctrlTrayOpen()
{
return 0;
}
s32 ISOctrlTrayClose()
{
return 0;
}

View File

@ -1,70 +1,64 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __CDVD_ISO_READER_H__
#define __CDVD_ISO_READER_H__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include "IopCommon.h"
#include "IsoFStools.h"
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __CDVD_ISO_READER_H__
#define __CDVD_ISO_READER_H__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#include <stdio.h>
#include "IopCommon.h"
#include "IsoFStools.h"
#include "IsoFileFormats.h"
#define CDVD_LOG __Log
#ifndef MAX_PATH
#define MAX_PATH 255
#endif
extern FILE *cdvdLog;
void __Log(char *fmt, ...);
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
extern char isoFileName[256];
//extern isoFile *blockDumpFile;
extern isoFile *iso;
s32 ISOinit();
void ISOshutdown();
s32 ISOopen(const char* pTitle);
void ISOclose();
s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq);
s32 ISOgetTN(cdvdTN *Buffer);
s32 ISOgetTD(u8 tn, cdvdTD *Buffer);
s32 ISOgetDiskType();
s32 ISOgetTrayStatus();
s32 ISOctrlTrayOpen();
s32 ISOctrlTrayClose();
s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode);
s32 ISOgetTOC(void* toc);
s32 ISOreadTrack(u32 lsn, int mode);
s32 ISOgetBuffer(u8* buffer);
#define CDVD_LOG __Log
#ifndef MAX_PATH
#define MAX_PATH 255
#endif
extern FILE *cdvdLog;
void __Log(char *fmt, ...);
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
extern char isoFileName[256];
extern isoFile *iso;
extern s32 ISOinit();
extern void ISOshutdown();
extern s32 ISOopen(const char* pTitle);
extern void ISOclose();
extern s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq);
extern s32 ISOgetTN(cdvdTN *Buffer);
extern s32 ISOgetTD(u8 tn, cdvdTD *Buffer);
extern s32 ISOgetDiskType();
extern s32 ISOgetTrayStatus();
extern s32 ISOctrlTrayOpen();
extern s32 ISOctrlTrayClose();
extern s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode);
extern s32 ISOgetTOC(void* toc);
extern s32 ISOreadTrack(u32 lsn, int mode);
extern s32 ISOgetBuffer(u8* buffer);
#endif

View File

@ -1,68 +1,68 @@
#ifndef __LIBISO_H__
#define __LIBISO_H__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#define ISOTYPE_ILLEGAL 0
#define ISOTYPE_CD 1
#define ISOTYPE_DVD 2
#define ISOTYPE_AUDIO 3
#define ISOTYPE_DVDDL 4
#define ISOFLAGS_Z 0x0001
#define ISOFLAGS_Z2 0x0002
#define ISOFLAGS_BLOCKDUMP 0x0004
#define ISOFLAGS_MULTI 0x0008
#define ISOFLAGS_BZ2 0x0010
#define CD_FRAMESIZE_RAW 2352
#define DATA_SIZE (CD_FRAMESIZE_RAW-12)
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
typedef struct
{
u32 slsn;
u32 elsn;
void *handle;
} _multih;
typedef struct
{
char filename[256];
u32 type;
u32 flags;
u32 offset;
u32 blockofs;
u32 blocksize;
u32 blocks;
void *handle;
void *htable;
char *Ztable;
u32 *dtable;
int dtablesize;
_multih multih[8];
int buflsn;
u8 *buffer;
} isoFile;
isoFile *isoOpen(const char *filename);
isoFile *isoCreate(const char *filename, int mode);
int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks);
int isoDetect(isoFile *iso);
int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
void isoClose(isoFile *iso);
void *_openfile(const char *filename, int flags);
u64 _tellfile(void *handle);
int _seekfile(void *handle, u64 offset, int whence);
int _readfile(void *handle, void *dst, int size);
int _writefile(void *handle, void *src, int size);
void _closefile(void *handle);
#endif /* __LIBISO_H__ */
#ifndef __LIBISO_H__
#define __LIBISO_H__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#define ISOTYPE_ILLEGAL 0
#define ISOTYPE_CD 1
#define ISOTYPE_DVD 2
#define ISOTYPE_AUDIO 3
#define ISOTYPE_DVDDL 4
#define ISOFLAGS_Z 0x0001
#define ISOFLAGS_Z2 0x0002
#define ISOFLAGS_BLOCKDUMP 0x0004
#define ISOFLAGS_MULTI 0x0008
#define ISOFLAGS_BZ2 0x0010
#define CD_FRAMESIZE_RAW 2352
#define DATA_SIZE (CD_FRAMESIZE_RAW-12)
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
typedef struct
{
u32 slsn;
u32 elsn;
void *handle;
} _multih;
typedef struct
{
char filename[256];
u32 type;
u32 flags;
u32 offset;
u32 blockofs;
u32 blocksize;
u32 blocks;
void *handle;
void *htable;
char *Ztable;
u32 *dtable;
int dtablesize;
_multih multih[8];
int buflsn;
u8 *buffer;
} isoFile;
isoFile *isoOpen(const char *filename);
isoFile *isoCreate(const char *filename, int mode);
int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks);
int isoDetect(isoFile *iso);
int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
void isoClose(isoFile *iso);
void *_openfile(const char *filename, int flags);
u64 _tellfile(void *handle);
int _seekfile(void *handle, u64 offset, int whence);
int _readfile(void *handle, void *dst, int size);
int _writefile(void *handle, void *src, int size);
void _closefile(void *handle);
#endif /* __LIBISO_H__ */