mirror of https://github.com/PCSX2/pcsx2.git
CDVDisoEFP: I'm not sure what happened in the mists of time to this folder that caused all the source code in it to have the lines all become double-spaced and unreadable... Got rid of all the extra blank lines, and reformated.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@559 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
34a0b82986
commit
18917ebc21
File diff suppressed because it is too large
Load Diff
|
@ -1,92 +1,40 @@
|
|||
/* CD.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __CD_H__
|
||||
|
||||
#define __CD_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#define __LINUX__
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Functions
|
||||
|
||||
|
||||
|
||||
extern void InitCDInfo();
|
||||
|
||||
extern s32 CDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 CDgetBufferOffset();
|
||||
|
||||
extern s32 CDreadSubQ(u32 lsn, cdvdSubQ *subq);
|
||||
|
||||
extern s32 CDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 CDgetDiskType(s32 ioctldisktype);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __CD_H__ */
|
||||
|
||||
|
|
|
@ -17,10 +17,7 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#ifndef __LINUX__
|
||||
#ifdef __linux__
|
||||
#define __LINUX__
|
||||
|
@ -28,7 +25,6 @@
|
|||
#endif /* No __LINUX__ */
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "actualfile.h"
|
||||
#include "isofile.h"
|
||||
|
@ -36,415 +32,384 @@
|
|||
#include "convert.h"
|
||||
#include "version.h"
|
||||
#include "CDVDiso.h"
|
||||
|
||||
|
||||
struct IsoFile *isofile;
|
||||
char isobuffer[2448];
|
||||
char isocdcheck[2448];
|
||||
int isomode;
|
||||
int deviceopencount; // 0 = Closed, 1+ = Open
|
||||
|
||||
|
||||
char* CALLBACK PS2EgetLibName() {
|
||||
return(libname);
|
||||
char* CALLBACK PS2EgetLibName()
|
||||
{
|
||||
return(libname);
|
||||
} // END PS2EgetLibName()
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibType() {
|
||||
return(PS2E_LT_CDVD);
|
||||
u32 CALLBACK PS2EgetLibType()
|
||||
{
|
||||
return(PS2E_LT_CDVD);
|
||||
} // END PS2getLibType()
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
|
||||
return((version << 16) | (revision << 8) | build);
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type)
|
||||
{
|
||||
return((version << 16) | (revision << 8) | build);
|
||||
}
|
||||
s32 CALLBACK CDVDinit()
|
||||
{
|
||||
int i;
|
||||
|
||||
InitLog();
|
||||
if (OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
s32 CALLBACK CDVDinit() {
|
||||
int i;
|
||||
|
||||
InitLog();
|
||||
if(OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf();
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
deviceopencount = 0;
|
||||
|
||||
InitConf();
|
||||
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
deviceopencount = 0;
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
} // END CDVDinit()
|
||||
|
||||
|
||||
void CALLBACK CDVDshutdown() {
|
||||
void CALLBACK CDVDshutdown()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
isofile = IsoFileClose(isofile);
|
||||
CloseLog();
|
||||
isofile = IsoFileClose(isofile);
|
||||
CloseLog();
|
||||
} // END CDVDshutdown()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename) {
|
||||
int retval;
|
||||
int i;
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename)
|
||||
{
|
||||
int retval;
|
||||
int i;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
LoadConf();
|
||||
|
||||
if( pTitleFilename != NULL ) strcpy(conf.isoname, pTitleFilename);
|
||||
|
||||
if((conf.isoname[0] == 0) ||
|
||||
((conf.startconfigure != 0) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0))) {
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if(isofile == NULL) {
|
||||
LoadConf();
|
||||
if (pTitleFilename != NULL) strcpy(conf.isoname, pTitleFilename);
|
||||
if ((conf.isoname[0] == 0) ||
|
||||
((conf.startconfigure != 0) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0)))
|
||||
{
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Taken out for "NULL" device simulation
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if(retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if(retval != 0) return(-1);
|
||||
|
||||
if(deviceopencount > 0) {
|
||||
i = 0;
|
||||
while((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if(i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
|
||||
return(0);
|
||||
// return(-1); // Taken out for "NULL" device simulation
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDopen()
|
||||
|
||||
|
||||
void CALLBACK CDVDclose() {
|
||||
void CALLBACK CDVDclose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) {
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while ((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn))
|
||||
{
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Loop through tracks searching for lsn track
|
||||
i--;
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) return(-1);
|
||||
subq->ctrl = 4;
|
||||
subq->mode = 1;
|
||||
subq->trackNum = HEXTOBCD(i);
|
||||
subq->trackIndex = HEXTOBCD(i);
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
LBAtoMSF(lsn - tracklsn, temptime);
|
||||
subq->trackM = HEXTOBCD(temptime[0]);
|
||||
subq->trackS = HEXTOBCD(temptime[1]);
|
||||
subq->trackF = HEXTOBCD(temptime[2]);
|
||||
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn)) {
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Loop through tracks searching for lsn track
|
||||
i--;
|
||||
subq->pad = 0;
|
||||
|
||||
subq->ctrl = 4;
|
||||
subq->mode = 1;
|
||||
subq->trackNum = HEXTOBCD(i);
|
||||
subq->trackIndex = HEXTOBCD(i);
|
||||
|
||||
LBAtoMSF(lsn - tracklsn, temptime);
|
||||
subq->trackM = HEXTOBCD(temptime[0]);
|
||||
subq->trackS = HEXTOBCD(temptime[1]);
|
||||
subq->trackF = HEXTOBCD(temptime[2]);
|
||||
|
||||
subq->pad = 0;
|
||||
|
||||
// lba_to_msf(lsn + (2*75), &min, &sec, &frm);
|
||||
LBAtoMSF(lsn, temptime);
|
||||
subq->discM = HEXTOBCD(temptime[0]);
|
||||
subq->discS = HEXTOBCD(temptime[1]);
|
||||
subq->discF = HEXTOBCD(temptime[2]);
|
||||
// lba_to_msf(lsn + (2*75), &min, &sec, &frm);
|
||||
LBAtoMSF(lsn, temptime);
|
||||
subq->discM = HEXTOBCD(temptime[0]);
|
||||
subq->discS = HEXTOBCD(temptime[1]);
|
||||
subq->discF = HEXTOBCD(temptime[2]);
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
} // END CDVDreadSubQ()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) {
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) return(-1);
|
||||
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer)
|
||||
{
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTN()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
} else {
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
|
||||
return(0);
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTN()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer) {
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) return(-1);
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer)
|
||||
{
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
actualtrack = track;
|
||||
if(actualtrack == 0xaa) actualtrack = 0;
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
if (actualtrack <= 1) {
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
} else {
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} else {
|
||||
if (actualtrack == 0) {
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} else {
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
|
||||
return(0);
|
||||
actualtrack = track;
|
||||
if (actualtrack == 0xaa) actualtrack = 0;
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
if (actualtrack <= 1)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actualtrack == 0)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTD()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc) {
|
||||
int i;
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) return(-1);
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc)
|
||||
{
|
||||
int i;
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
for(i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
for (i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) {
|
||||
int retval;
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
return(-1);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
int retval;
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(-1);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if(retval != 0) {
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if(retval != 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
|
||||
isomode = mode;
|
||||
return(0);
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
isomode = mode;
|
||||
return(0);
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer() {
|
||||
int offset;
|
||||
|
||||
if(isofile == NULL) return(NULL);
|
||||
if(deviceopencount > 0) return(NULL);
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer()
|
||||
{
|
||||
int offset;
|
||||
if (isofile == NULL) return(NULL);
|
||||
if (deviceopencount > 0) return(NULL);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
offset = 0;
|
||||
switch(isomode) {
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
|
||||
if(offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
|
||||
return(isobuffer + offset);
|
||||
offset = 0;
|
||||
switch (isomode)
|
||||
{
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
if (offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
return(isobuffer + offset);
|
||||
} // END CDVDgetBuffer()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetDiskType() {
|
||||
s32 CALLBACK CDVDgetDiskType()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
if (isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
|
||||
return(isofile->cdvdtype);
|
||||
return(isofile->cdvdtype);
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTrayStatus() {
|
||||
s32 CALLBACK CDVDgetTrayStatus()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if(deviceopencount > 30) {
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
if (isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if (deviceopencount > 30)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
} // END CDVDgetTrayStatus()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayOpen() {
|
||||
int i;
|
||||
s32 CALLBACK CDVDctrlTrayOpen()
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
// Close()
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
// Close()
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
|
||||
// and re-Open()
|
||||
if((conf.isoname[0] == 0) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0))) {
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if(isofile == NULL) {
|
||||
// and re-Open()
|
||||
if ((conf.isoname[0] == 0) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0)))
|
||||
{
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
|
||||
if(deviceopencount > 0) {
|
||||
i = 0;
|
||||
while((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if(i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose() {
|
||||
s32 CALLBACK CDVDctrlTrayClose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(0);
|
||||
return(0);
|
||||
} // END CDVDctrlTrayClose()
|
||||
|
||||
|
||||
void CALLBACK CDVDconfigure() {
|
||||
ExecCfg("configure");
|
||||
void CALLBACK CDVDconfigure()
|
||||
{
|
||||
ExecCfg("configure");
|
||||
} // END CDVDconfigure()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDtest() {
|
||||
s32 CALLBACK CDVDtest()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf(); // Odd... hasn't CDVDinit been called yet?
|
||||
LoadConf();
|
||||
InitConf(); // Odd... hasn't CDVDinit been called yet?
|
||||
LoadConf();
|
||||
|
||||
if(conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if(IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
if (conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if (IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
} // END CDVDtest()
|
||||
|
||||
|
||||
void CALLBACK CDVDabout() {
|
||||
ExecCfg("about");
|
||||
void CALLBACK CDVDabout()
|
||||
{
|
||||
ExecCfg("about");
|
||||
} // END CDVDabout()
|
||||
|
||||
|
|
|
@ -1,58 +1,26 @@
|
|||
/* CDVDiso.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CDVDISO_H
|
||||
|
||||
#define CDVDISO_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CDVDISO_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,90 +1,39 @@
|
|||
/* DVD.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DVD_H__
|
||||
|
||||
#define __DVD_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#define __LINUX__
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Functions
|
||||
|
||||
|
||||
|
||||
extern void HexDump(u8 *strptr, u8 count);
|
||||
|
||||
extern void InitDVDInfo();
|
||||
|
||||
extern s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DVDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DVDgetDiskType(s32 ioctldisktype);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DVD_H__ */
|
||||
|
||||
|
|
|
@ -1,212 +1,109 @@
|
|||
/* aboutbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include "aboutbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct AboutBoxData aboutbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint AboutBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
if(aboutbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(aboutbox.window);
|
||||
|
||||
aboutbox.window = NULL;
|
||||
|
||||
} // ENDIF- Do we have an About Box still?
|
||||
|
||||
|
||||
|
||||
gtk_main_quit();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // END AboutBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void AboutBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *container;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
char templine[256];
|
||||
|
||||
|
||||
|
||||
aboutbox.window = NULL;
|
||||
|
||||
aboutbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(aboutbox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(aboutbox.window), "About CDVDisoEFP");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(aboutbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
gtk_window_set_modal(GTK_WINDOW(aboutbox.window), TRUE);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(aboutbox.window), FALSE);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(aboutbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(aboutbox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
sprintf(templine, "%s v%i.%i", libname, revision, build);
|
||||
|
||||
item = gtk_label_new(templine);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("Current Author: efp");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("Original code by: linuzappz & shadow");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
container = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), container, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(container);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Ok");
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(container), item);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
container = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
gtk_widget_show(aboutbox.window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
} // END AboutDisplay()
|
||||
|
||||
/* aboutbox.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
#include "version.h"
|
||||
#include "aboutbox.h"
|
||||
|
||||
|
||||
struct AboutBoxData aboutbox;
|
||||
|
||||
|
||||
gint AboutBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
if (aboutbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(aboutbox.window);
|
||||
aboutbox.window = NULL;
|
||||
} // ENDIF- Do we have an About Box still?
|
||||
|
||||
gtk_main_quit();
|
||||
return(TRUE);
|
||||
} // END AboutBoxCancelEvent()
|
||||
|
||||
|
||||
void AboutBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *container;
|
||||
GtkWidget *vbox1;
|
||||
char templine[256];
|
||||
|
||||
aboutbox.window = NULL;
|
||||
aboutbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(aboutbox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(aboutbox.window), "About CDVDisoEFP");
|
||||
gtk_window_set_position(GTK_WINDOW(aboutbox.window), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_modal(GTK_WINDOW(aboutbox.window), TRUE);
|
||||
gtk_window_set_resizable(GTK_WINDOW(aboutbox.window), FALSE);
|
||||
|
||||
g_signal_connect(G_OBJECT(aboutbox.window), "delete_event",
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(aboutbox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
sprintf(templine, "%s v%i.%i", libname, revision, build);
|
||||
item = gtk_label_new(templine);
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
item = gtk_label_new("Current Author: efp");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
item = gtk_label_new("Original code by: linuzappz & shadow");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
container = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), container, TRUE, TRUE, 0);
|
||||
gtk_widget_show(container);
|
||||
|
||||
item = gtk_button_new_with_label("Ok");
|
||||
gtk_container_add(GTK_CONTAINER(container), item);
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
container = NULL;
|
||||
vbox1 = NULL;
|
||||
|
||||
gtk_widget_show(aboutbox.window);
|
||||
gtk_main();
|
||||
} // END AboutDisplay()
|
||||
|
|
|
@ -1,78 +1,34 @@
|
|||
/* aboutbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ABOUTBOX_H
|
||||
|
||||
#define ABOUTBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct AboutBoxData {
|
||||
|
||||
GtkWidget *window; // GtkWindow - About Box
|
||||
|
||||
struct AboutBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow - About Box
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct AboutBoxData aboutbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void AboutBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ABOUTBOX_H */
|
||||
|
||||
|
|
|
@ -1,444 +1,238 @@
|
|||
/* actualfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <fcntl.h> // open()
|
||||
|
||||
#include <stdio.h> // rename()
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <sys/stat.h> // stat64(), open(), fstat()
|
||||
|
||||
#include <sys/types.h> // stat64(), open(), fstat(), lseek64()
|
||||
|
||||
#include <unistd.h> // stat64(), fstat(), lseek64(), read(), close(), write()
|
||||
|
||||
// unlink()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int IsActualFile(const char *filename) {
|
||||
|
||||
int retval;
|
||||
|
||||
struct stat64 filestat;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = stat64(filename, &filestat);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error retrieving stats on %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1); // Name doesn't exist.
|
||||
|
||||
} // ENDIF- Trouble getting stat on a file?
|
||||
|
||||
|
||||
|
||||
if(S_ISREG(filestat.st_mode) == 0) return(-2); // Not a regular file.
|
||||
|
||||
return(0); // Yep, that's a file.
|
||||
|
||||
} // END IsActualFile()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileDelete(const char *filename) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
unlink(filename);
|
||||
|
||||
} // END ActualFileDelete()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRename(%s->%s)", origname, newname);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
rename(origname, newname);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileRename()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename) {
|
||||
|
||||
int newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
newhandle = open(filename, O_RDONLY | O_LARGEFILE);
|
||||
|
||||
if((newhandle < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s\n", filename);
|
||||
|
||||
PrintLog("CDVDiso file: (%i) %i:%s\n", newhandle, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle) {
|
||||
|
||||
int retval;
|
||||
|
||||
struct stat64 filestat;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSize()\n");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = fstat64(handle, &filestat);
|
||||
|
||||
if((retval < 0) || (errno != 0)) return(-1); // Name doesn't exist.
|
||||
|
||||
return(filestat.st_size);
|
||||
|
||||
} // END ActualFileSize()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position) {
|
||||
|
||||
off64_t moved;
|
||||
|
||||
|
||||
|
||||
if(handle < 0) return(-1);
|
||||
|
||||
if(position < 0) return(-1); // Maybe... position = 0?
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%lli)", position);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
moved = lseek64(handle, position, SEEK_SET);
|
||||
|
||||
if(errno != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error on seek (%lli)", position);
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END ActualFileSeek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
if(handle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = read(handle, buffer, bytes);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error reading from file!");
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(retval); // Send back how many bytes read
|
||||
|
||||
} // END ActualFileRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle) {
|
||||
|
||||
if(handle < 0) return;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
close(handle);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileClose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename) {
|
||||
|
||||
int newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
newhandle = open(filename, O_WRONLY | O_CREAT | O_LARGEFILE, 0644);
|
||||
|
||||
if((newhandle < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: (%i) %i:%s", newhandle, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
if(handle < 0) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = write(handle, buffer, bytes);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(retval); // Send back how many bytes written
|
||||
|
||||
} // END ActualFileWrite()
|
||||
|
||||
/* actualfile.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <fcntl.h> // open()
|
||||
#include <stdio.h> // rename()
|
||||
#include <string.h> // strerror()
|
||||
#include <sys/stat.h> // stat64(), open(), fstat()
|
||||
#include <sys/types.h> // stat64(), open(), fstat(), lseek64()
|
||||
#include <unistd.h> // stat64(), fstat(), lseek64(), read(), close(), write()
|
||||
// unlink()
|
||||
|
||||
#include "logfile.h"
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
int IsActualFile(const char *filename)
|
||||
{
|
||||
int retval;
|
||||
struct stat64 filestat;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
retval = stat64(filename, &filestat);
|
||||
if ((retval < 0) || (errno != 0))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error retrieving stats on %s", filename);
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
return(-1); // Name doesn't exist.
|
||||
} // ENDIF- Trouble getting stat on a file?
|
||||
|
||||
if (S_ISREG(filestat.st_mode) == 0) return(-2); // Not a regular file.
|
||||
return(0); // Yep, that's a file.
|
||||
} // END IsActualFile()
|
||||
|
||||
|
||||
void ActualFileDelete(const char *filename)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
unlink(filename);
|
||||
} // END ActualFileDelete()
|
||||
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileRename(%s->%s)", origname, newname);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
rename(origname, newname);
|
||||
return;
|
||||
} // END ActualFileRename()
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename)
|
||||
{
|
||||
int newhandle;
|
||||
|
||||
if (filename == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
newhandle = open(filename, O_RDONLY | O_LARGEFILE);
|
||||
if ((newhandle < 0) || (errno != 0))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error opening file %s\n", filename);
|
||||
PrintLog("CDVDiso file: (%i) %i:%s\n", newhandle, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(newhandle);
|
||||
} // END ActualFileOpenForRead()
|
||||
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle)
|
||||
{
|
||||
int retval;
|
||||
struct stat64 filestat;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileSize()\n");
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
retval = fstat64(handle, &filestat);
|
||||
if ((retval < 0) || (errno != 0)) return(-1); // Name doesn't exist.
|
||||
return(filestat.st_size);
|
||||
} // END ActualFileSize()
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position)
|
||||
{
|
||||
off64_t moved;
|
||||
|
||||
if (handle < 0) return(-1);
|
||||
if (position < 0) return(-1); // Maybe... position = 0?
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%lli)", position);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
moved = lseek64(handle, position, SEEK_SET);
|
||||
if (errno != 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error on seek (%lli)", position);
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(0);
|
||||
} // END ActualFileSeek()
|
||||
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (handle == ACTUALHANDLENULL) return(-1);
|
||||
if (bytes < 1) return(-1);
|
||||
if (buffer == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
retval = read(handle, buffer, bytes);
|
||||
if ((retval < 0) || (errno != 0))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error reading from file!");
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
// return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(retval); // Send back how many bytes read
|
||||
} // END ActualFileRead()
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle)
|
||||
{
|
||||
if (handle < 0) return;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
close(handle);
|
||||
return;
|
||||
} // END ActualFileClose()
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename)
|
||||
{
|
||||
int newhandle;
|
||||
|
||||
if (filename == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
newhandle = open(filename, O_WRONLY | O_CREAT | O_LARGEFILE, 0644);
|
||||
if ((newhandle < 0) || (errno != 0))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
PrintLog("CDVDiso file: (%i) %i:%s", newhandle, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(newhandle);
|
||||
} // END ActualFileOpenForWrite()
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (handle < 0) return(-1);
|
||||
if (bytes < 1) return(-1);
|
||||
if (buffer == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
errno = 0;
|
||||
retval = write(handle, buffer, bytes);
|
||||
if ((retval < 0) || (errno != 0))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
// return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(retval); // Send back how many bytes written
|
||||
} // END ActualFileWrite()
|
||||
|
|
|
@ -1,100 +1,45 @@
|
|||
/* actualfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ACTUALFILE_H
|
||||
|
||||
#define ACTUALFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ACTUALHANDLE int
|
||||
|
||||
#define ACTUALHANDLENULL -1
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
// #define VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int IsActualFile(const char *filename);
|
||||
|
||||
extern void ActualFileDelete(const char *filename);
|
||||
|
||||
extern void ActualFileRename(const char *origname, const char *newname);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForRead(const char *filename);
|
||||
|
||||
extern off64_t ActualFileSize(ACTUALHANDLE handle);
|
||||
|
||||
extern int ActualFileSeek(ACTUALHANDLE handle, off64_t position);
|
||||
|
||||
extern int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
extern void ActualFileClose(ACTUALHANDLE handle);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForWrite(const char *filename);
|
||||
|
||||
extern int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ACTUALFILE_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,48 +1,30 @@
|
|||
/* comparisondummy.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ConversionBoxRefocus() { return; }
|
||||
|
||||
|
||||
|
||||
void DeviceBoxRefocus() { return; }
|
||||
|
||||
/* comparisondummy.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
void ConversionBoxRefocus()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void DeviceBoxRefocus()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,408 +1,204 @@
|
|||
/* conf.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <stdlib.h> // getenv()
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <sys/stat.h> // mkdir(), stat()
|
||||
|
||||
#include <sys/types.h> // mkdir(), stat()
|
||||
|
||||
#include <unistd.h> // stat()
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "../PS2Edefs.h"
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "../ini.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char *cfgname[] = { \
|
||||
|
||||
"./cfg/cfgCDVDisoEFP", \
|
||||
|
||||
"../cfg/cfgCDVDisoEFP", \
|
||||
|
||||
"./cfgCDVDisoEFP", \
|
||||
|
||||
"../cfgCDVDisoEFP", \
|
||||
|
||||
"./plugins/cfgCDVDisoEFP", \
|
||||
|
||||
"../plugins/cfgCDVDisoEFP", \
|
||||
|
||||
NULL };
|
||||
|
||||
|
||||
"./cfg/cfgCDVDisoEFP", \
|
||||
"../cfg/cfgCDVDisoEFP", \
|
||||
"./cfgCDVDisoEFP", \
|
||||
"../cfgCDVDisoEFP", \
|
||||
"./plugins/cfgCDVDisoEFP", \
|
||||
"../plugins/cfgCDVDisoEFP", \
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *confnames[] = { "IsoFile", "CdDev", NULL };
|
||||
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
|
||||
const char defaulthome[] = "../inis";
|
||||
|
||||
const char defaultdirectory[] = ".PS2E";
|
||||
|
||||
const char defaultfile[] = "CDVDisoEFP.ini";
|
||||
|
||||
|
||||
|
||||
char confdirname[256];
|
||||
|
||||
char conffilename[256];
|
||||
|
||||
|
||||
|
||||
CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ExecCfg(char *arg) {
|
||||
|
||||
int nameptr;
|
||||
|
||||
struct stat filestat;
|
||||
|
||||
char templine[256];
|
||||
|
||||
|
||||
|
||||
void ExecCfg(char *arg)
|
||||
{
|
||||
int nameptr;
|
||||
struct stat filestat;
|
||||
char templine[256];
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVDiso interface: ExecCfg(%s)", arg);
|
||||
|
||||
PrintLog("CDVDiso interface: ExecCfg(%s)", arg);
|
||||
#endif /* VERBOSE FUNCTION_CONF */
|
||||
errno = 0;
|
||||
nameptr = 0;
|
||||
while ((cfgname[nameptr] != NULL) &&
|
||||
(stat(cfgname[nameptr], &filestat) == -1)) nameptr++;
|
||||
errno = 0;
|
||||
|
||||
errno = 0;
|
||||
|
||||
nameptr = 0;
|
||||
|
||||
while((cfgname[nameptr] != NULL) &&
|
||||
|
||||
(stat(cfgname[nameptr], &filestat) == -1)) nameptr++;
|
||||
|
||||
errno = 0;
|
||||
|
||||
|
||||
|
||||
if(cfgname[nameptr] == NULL) {
|
||||
|
||||
if (cfgname[nameptr] == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVDiso interface: Couldn't find configuration program!");
|
||||
|
||||
PrintLog("CDVDiso interface: Couldn't find configuration program!");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Did not find the executable?
|
||||
|
||||
|
||||
|
||||
sprintf(templine, "%s %s", cfgname[nameptr], arg);
|
||||
|
||||
system(templine);
|
||||
|
||||
return;
|
||||
} // ENDIF- Did not find the executable?
|
||||
sprintf(templine, "%s %s", cfgname[nameptr], arg);
|
||||
system(templine);
|
||||
} // END ExecCfg()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitConf() {
|
||||
|
||||
int i;
|
||||
|
||||
int pos;
|
||||
|
||||
char *envptr;
|
||||
|
||||
|
||||
|
||||
void InitConf()
|
||||
{
|
||||
int i;
|
||||
int pos;
|
||||
char *envptr;
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
conf.isoname[0] = 0; // Empty the iso name
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 255) && defaultdevice[i] != 0) {
|
||||
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
|
||||
|
||||
// Locating directory and file positions
|
||||
|
||||
pos = 0;
|
||||
|
||||
envptr = getenv("HOME");
|
||||
|
||||
if(envptr == NULL) {
|
||||
|
||||
// = <Default Home>
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaulthome[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaulthome[i];
|
||||
|
||||
conffilename[pos] = defaulthome[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// = <Env Home>/<Default Directory>
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (*(envptr + i) != 0)) {
|
||||
|
||||
confdirname[pos] = *(envptr + i);
|
||||
|
||||
conffilename[pos] = *(envptr + i);
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying home directory info in
|
||||
|
||||
|
||||
|
||||
if(confdirname[pos-1] != '/') {
|
||||
|
||||
confdirname[pos] = '/';
|
||||
|
||||
conffilename[pos] = '/';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultdirectory[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
|
||||
|
||||
// += /<Config File Name>
|
||||
|
||||
if(conffilename[pos-1] != '/') {
|
||||
|
||||
conffilename[pos] = '/';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultfile[i] != 0)) {
|
||||
|
||||
conffilename[pos] = defaultfile[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
|
||||
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
|
||||
|
||||
|
||||
conf.isoname[0] = 0; // Empty the iso name
|
||||
i = 0;
|
||||
while ((i < 255) && defaultdevice[i] != 0)
|
||||
{
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
i++;
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
// Locating directory and file positions
|
||||
pos = 0;
|
||||
envptr = getenv("HOME");
|
||||
if (envptr == NULL)
|
||||
{
|
||||
// = <Default Home>
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaulthome[i] != 0))
|
||||
{
|
||||
confdirname[pos] = defaulthome[i];
|
||||
conffilename[pos] = defaulthome[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
}
|
||||
else
|
||||
{
|
||||
// = <Env Home>/<Default Directory>
|
||||
i = 0;
|
||||
while ((pos < 253) && (*(envptr + i) != 0))
|
||||
{
|
||||
confdirname[pos] = *(envptr + i);
|
||||
conffilename[pos] = *(envptr + i);
|
||||
pos++;
|
||||
i++;
|
||||
} // ENDWHILE- copying home directory info in
|
||||
if (confdirname[pos-1] != '/')
|
||||
{
|
||||
confdirname[pos] = '/';
|
||||
conffilename[pos] = '/';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaultdirectory[i] != 0))
|
||||
{
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
// += /<Config File Name>
|
||||
if (conffilename[pos-1] != '/')
|
||||
{
|
||||
conffilename[pos] = '/';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaultfile[i] != 0))
|
||||
{
|
||||
conffilename[pos] = defaultfile[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: Directory: %s\n", confdirname);
|
||||
|
||||
PrintLog("CDVD config: File: %s\n", conffilename);
|
||||
|
||||
PrintLog("CDVD config: Directory: %s\n", confdirname);
|
||||
PrintLog("CDVD config: File: %s\n", conffilename);
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
} // END InitConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void LoadConf() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
void LoadConf()
|
||||
{
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: LoadConf()\n");
|
||||
|
||||
PrintLog("CDVD config: LoadConf()\n");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
retval = INILoadString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.isoname, "[Put an Image Name here]");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.devicename, "/dev/dvd");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnStart", &conf.startconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.startconfigure = 0; // False
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
sprintf(conf.isoname, "[Put an Image Name here]");
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
sprintf(conf.devicename, "/dev/dvd");
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnStart", &conf.startconfigure);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
conf.startconfigure = 0; // False
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnRestart", &conf.restartconfigure);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
conf.restartconfigure = 1; // True
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnRestart", &conf.restartconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.restartconfigure = 1; // True
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
} // END LoadConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SaveConf() {
|
||||
|
||||
void SaveConf()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: SaveConf()\n");
|
||||
|
||||
PrintLog("CDVD config: SaveConf()\n");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
mkdir(confdirname, 0755);
|
||||
|
||||
|
||||
mkdir(confdirname, 0755);
|
||||
|
||||
|
||||
|
||||
INISaveString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnStart", conf.startconfigure);
|
||||
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnRestart", conf.restartconfigure);
|
||||
|
||||
INISaveString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnStart", conf.startconfigure);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnRestart", conf.restartconfigure);
|
||||
} // END SaveConf()
|
||||
|
||||
|
|
|
@ -1,54 +1,55 @@
|
|||
/* conf.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#ifndef CONF_H
|
||||
#define CONF_H
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
#define VERBOSE_FUNCTION_CONF
|
||||
|
||||
|
||||
// Configuration Data
|
||||
|
||||
typedef struct {
|
||||
u8 isoname[256];
|
||||
u8 devicename[256];
|
||||
unsigned int startconfigure;
|
||||
unsigned int restartconfigure;
|
||||
} CDVDconf;
|
||||
extern CDVDconf conf;
|
||||
|
||||
#define DEFAULT_DEVICE "K:\\"
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
extern void InitConf();
|
||||
extern void LoadConf();
|
||||
extern void SaveConf();
|
||||
|
||||
extern void ExecCfg(char *arg);
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
||||
/* conf.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#ifndef CONF_H
|
||||
#define CONF_H
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
#define VERBOSE_FUNCTION_CONF
|
||||
|
||||
|
||||
// Configuration Data
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 isoname[256];
|
||||
u8 devicename[256];
|
||||
unsigned int startconfigure;
|
||||
unsigned int restartconfigure;
|
||||
} CDVDconf;
|
||||
extern CDVDconf conf;
|
||||
|
||||
#define DEFAULT_DEVICE "K:\\"
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
extern void InitConf();
|
||||
extern void LoadConf();
|
||||
extern void SaveConf();
|
||||
|
||||
extern void ExecCfg(char *arg);
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,94 +1,44 @@
|
|||
/* conversionbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CONVERSIONBOX_H
|
||||
|
||||
#define CONVERSIONBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ConversionBoxData {
|
||||
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
GtkWidget *file; // GtkEntry
|
||||
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
|
||||
struct ConversionBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct ConversionBoxData conversionbox;
|
||||
|
||||
|
||||
|
||||
extern void ConversionBoxDestroy();
|
||||
|
||||
extern void ConversionBoxRefocus();
|
||||
|
||||
extern void ConversionBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONVERSIONBOX_H */
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <fcntl.h> // open()
|
||||
#include <stddef.h> // NULL
|
||||
|
@ -28,391 +27,389 @@
|
|||
#include <sys/types.h> // open()
|
||||
#include <time.h> // time_t, time(), struct timeval
|
||||
#include <unistd.h> // close(), select()
|
||||
|
||||
#include <linux/cdrom.h> // CD/DVD based ioctl() and defines.
|
||||
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "CD.h"
|
||||
#include "DVD.h"
|
||||
#include "device.h"
|
||||
|
||||
|
||||
// Globals
|
||||
|
||||
int devicehandle; // File Handle for the device/drive
|
||||
s32 devicecapability; // Capability Flags
|
||||
time_t lasttime; // Time marker (in case something gets called too often)
|
||||
s32 traystatus; // Is the CD/DVD tray open?
|
||||
|
||||
s32 disctype; // Type of disc in drive (Video DVD, PSX CD, etc.)
|
||||
u8 tocbuffer[2048];
|
||||
|
||||
|
||||
void DeviceInit() {
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
lasttime = time(NULL);
|
||||
|
||||
InitDisc();
|
||||
void DeviceInit()
|
||||
{
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
lasttime = time(NULL);
|
||||
InitDisc();
|
||||
} // END DeviceInit()
|
||||
|
||||
|
||||
// Called by DeviceOpen(), DeviceGetDiskType()
|
||||
void InitDisc() {
|
||||
int i;
|
||||
|
||||
void InitDisc()
|
||||
{
|
||||
int i;
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: InitDisc()");
|
||||
PrintLog("CDVD device: InitDisc()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
if ((disctype == CDVD_TYPE_PS2DVD) ||
|
||||
(disctype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
InitDVDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) ||
|
||||
(disctype == CDVD_TYPE_DVDV)) {
|
||||
InitDVDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
if ((disctype == CDVD_TYPE_PS2CD) ||
|
||||
(disctype == CDVD_TYPE_PS2CDDA) ||
|
||||
(disctype == CDVD_TYPE_PSCD) ||
|
||||
(disctype == CDVD_TYPE_PSCDDA) ||
|
||||
(disctype == CDVD_TYPE_CDDA))
|
||||
{
|
||||
InitCDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2CD) ||
|
||||
(disctype == CDVD_TYPE_PS2CDDA) ||
|
||||
(disctype == CDVD_TYPE_PSCD) ||
|
||||
(disctype == CDVD_TYPE_PSCDDA) ||
|
||||
(disctype == CDVD_TYPE_CDDA)) {
|
||||
InitCDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
|
||||
disctype = CDVD_TYPE_NODISC;
|
||||
for(i = 0; i > sizeof(tocbuffer); i++) tocbuffer[i] = 0x00;
|
||||
disctype = CDVD_TYPE_NODISC;
|
||||
for (i = 0; i > sizeof(tocbuffer); i++) tocbuffer[i] = 0x00;
|
||||
} // END InitDisc()
|
||||
|
||||
|
||||
s32 DiscInserted() {
|
||||
if(devicehandle == -1) return(-1);
|
||||
if(traystatus == CDVD_TRAY_OPEN) return(-1);
|
||||
if(disctype == CDVD_TYPE_ILLEGAL) return(-1);
|
||||
// if(disctype == CDVD_TYPE_UNKNOWN) return(-1); // Hmm. Let this one through?
|
||||
if(disctype == CDVD_TYPE_DETCTDVDD) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCTDVDS) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCTCD) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCT) return(-1);
|
||||
if(disctype == CDVD_TYPE_NODISC) return(-1);
|
||||
|
||||
s32 DiscInserted()
|
||||
{
|
||||
if (devicehandle == -1) return(-1);
|
||||
if (traystatus == CDVD_TRAY_OPEN) return(-1);
|
||||
if (disctype == CDVD_TYPE_ILLEGAL) return(-1);
|
||||
// if(disctype == CDVD_TYPE_UNKNOWN) return(-1); // Hmm. Let this one through?
|
||||
if (disctype == CDVD_TYPE_DETCTDVDD) return(-1);
|
||||
if (disctype == CDVD_TYPE_DETCTDVDS) return(-1);
|
||||
if (disctype == CDVD_TYPE_DETCTCD) return(-1);
|
||||
if (disctype == CDVD_TYPE_DETCT) return(-1);
|
||||
if (disctype == CDVD_TYPE_NODISC) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DiscInserted()");
|
||||
PrintLog("CDVD device: DiscInserted()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
} // END DiscInserted()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus() and CDVDopen()
|
||||
s32 DeviceOpen() {
|
||||
// s32 s32result;
|
||||
s32 DeviceOpen()
|
||||
{
|
||||
// s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle != -1) {
|
||||
if (devicehandle != -1)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
PrintLog("CDVD device: Device already open!");
|
||||
PrintLog("CDVD device: Device already open!");
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
return(0);
|
||||
} // ENDIF- Is the CD/DVD already in use? That's fine.
|
||||
|
||||
return(0);
|
||||
} // ENDIF- Is the CD/DVD already in use? That's fine.
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceOpen()");
|
||||
PrintLog("CDVD device: DeviceOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
// InitConf();
|
||||
// LoadConf(); // Should be done once before making this call
|
||||
|
||||
// InitConf();
|
||||
// LoadConf(); // Should be done once before making this call
|
||||
|
||||
devicehandle = open(conf.devicename, O_RDONLY | O_NONBLOCK);
|
||||
if(devicehandle == -1) {
|
||||
devicehandle = open(conf.devicename, O_RDONLY | O_NONBLOCK);
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Error opening device: %i:%s", errno, strerror(errno));
|
||||
PrintLog("CDVD device: Error opening device: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Failed to open device? Abort
|
||||
return(-1);
|
||||
} // ENDIF- Failed to open device? Abort
|
||||
|
||||
// Note: Hmm. Need a minimum capability in case this fails?
|
||||
devicecapability = ioctl(devicehandle, CDROM_GET_CAPABILITY);
|
||||
if(errno != 0) {
|
||||
// Note: Hmm. Need a minimum capability in case this fails?
|
||||
devicecapability = ioctl(devicehandle, CDROM_GET_CAPABILITY);
|
||||
if (errno != 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Error getting device capabilities: %i:%s", errno, strerror(errno));
|
||||
PrintLog("CDVD device: Error getting device capabilities: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return(-1);
|
||||
} // ENDIF- Can't read drive capabilities? Close and Abort.
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return(-1);
|
||||
} // ENDIF- Can't read drive capabilities? Close and Abort.
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD device: Device Type(s)");
|
||||
if(devicecapability < CDC_CD_R) PrintLog("CDVD device: CD");
|
||||
if(devicecapability & CDC_CD_R) PrintLog("CDVD device: CD-R");
|
||||
if(devicecapability & CDC_CD_RW) PrintLog("CDVD device: CD-RW");
|
||||
if(devicecapability & CDC_DVD) PrintLog("CDVD device: DVD");
|
||||
if(devicecapability & CDC_DVD_R) PrintLog("CDVD device: DVD-R");
|
||||
if(devicecapability & CDC_DVD_RAM) PrintLog("CDVD device: DVD-RAM");
|
||||
PrintLog("CDVD device: Device Type(s)");
|
||||
if (devicecapability < CDC_CD_R) PrintLog("CDVD device: CD");
|
||||
if (devicecapability & CDC_CD_R) PrintLog("CDVD device: CD-R");
|
||||
if (devicecapability & CDC_CD_RW) PrintLog("CDVD device: CD-RW");
|
||||
if (devicecapability & CDC_DVD) PrintLog("CDVD device: DVD");
|
||||
if (devicecapability & CDC_DVD_R) PrintLog("CDVD device: DVD-R");
|
||||
if (devicecapability & CDC_DVD_RAM) PrintLog("CDVD device: DVD-RAM");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD device: Device Capabilities:");
|
||||
if(devicecapability & CDC_CLOSE_TRAY) PrintLog("CDVD device: Can close a tray");
|
||||
if(devicecapability & CDC_OPEN_TRAY) PrintLog("CDVD device: Can open a tray");
|
||||
// if(devicecapability & CDC_LOCK) PrintLog("CDVD device: Can lock the drive door");
|
||||
if(devicecapability & CDC_SELECT_SPEED) PrintLog("CDVD device: Can change spin speed");
|
||||
// if(devicecapability & CDC_SELECT_DISC) PrintLog("CDVD device: Can change disks (multi-disk tray)");
|
||||
// if(devicecapability & CDC_MULTI_SESSION) PrintLog("CDVD device: Can read multi-session disks");
|
||||
// if(devicecapability & CDC_MCN) PrintLog("CDVD device: Can read Medium Catalog Numbers (maybe)");
|
||||
if(devicecapability & CDC_MEDIA_CHANGED) PrintLog("CDVD device: Can tell if the disc was changed");
|
||||
if(devicecapability & CDC_PLAY_AUDIO) PrintLog("CDVD device: Can play audio disks");
|
||||
// if(devicecapability & CDC_RESET) PrintLog("CDVD device: Can reset the device");
|
||||
//if(devicecapability & CDC_IOCTLS) PrintLog("CDVD device: Odd IOCTLs. Not sure of compatability");
|
||||
if(devicecapability & CDC_DRIVE_STATUS) PrintLog("CDVD device: Can monitor the drive tray");
|
||||
PrintLog("CDVD device: Device Capabilities:");
|
||||
if (devicecapability & CDC_CLOSE_TRAY) PrintLog("CDVD device: Can close a tray");
|
||||
if (devicecapability & CDC_OPEN_TRAY) PrintLog("CDVD device: Can open a tray");
|
||||
// if(devicecapability & CDC_LOCK) PrintLog("CDVD device: Can lock the drive door");
|
||||
if (devicecapability & CDC_SELECT_SPEED) PrintLog("CDVD device: Can change spin speed");
|
||||
// if(devicecapability & CDC_SELECT_DISC) PrintLog("CDVD device: Can change disks (multi-disk tray)");
|
||||
// if(devicecapability & CDC_MULTI_SESSION) PrintLog("CDVD device: Can read multi-session disks");
|
||||
// if(devicecapability & CDC_MCN) PrintLog("CDVD device: Can read Medium Catalog Numbers (maybe)");
|
||||
if (devicecapability & CDC_MEDIA_CHANGED) PrintLog("CDVD device: Can tell if the disc was changed");
|
||||
if (devicecapability & CDC_PLAY_AUDIO) PrintLog("CDVD device: Can play audio disks");
|
||||
// if(devicecapability & CDC_RESET) PrintLog("CDVD device: Can reset the device");
|
||||
//if(devicecapability & CDC_IOCTLS) PrintLog("CDVD device: Odd IOCTLs. Not sure of compatability");
|
||||
if (devicecapability & CDC_DRIVE_STATUS) PrintLog("CDVD device: Can monitor the drive tray");
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
////// Should be called after an open (instead of inside of one)
|
||||
// InitDisc();
|
||||
// traystatus = CDVD_TRAY_OPEN; // Start with Tray Open
|
||||
// DeviceTrayStatus(); // Now find out for sure.
|
||||
|
||||
return(0); // Device opened and ready for use.
|
||||
////// Should be called after an open (instead of inside of one)
|
||||
// InitDisc();
|
||||
// traystatus = CDVD_TRAY_OPEN; // Start with Tray Open
|
||||
// DeviceTrayStatus(); // Now find out for sure.
|
||||
return(0); // Device opened and ready for use.
|
||||
} // END DeviceOpen()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus(), CDVDclose(), and CDVDshutdown()
|
||||
void DeviceClose() {
|
||||
// s32 s32result;
|
||||
int zerospeed;
|
||||
|
||||
zerospeed = 0;
|
||||
void DeviceClose()
|
||||
{
|
||||
// s32 s32result;
|
||||
int zerospeed;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
zerospeed = 0;
|
||||
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: Device already closed");
|
||||
PrintLog("CDVD device: Device already closed");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
return;
|
||||
} // ENDIF- Device already closed? Ok.
|
||||
|
||||
return;
|
||||
} // ENDIF- Device already closed? Ok.
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceClose()");
|
||||
PrintLog("CDVD device: DeviceClose()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
InitDisc();
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return;
|
||||
InitDisc();
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return;
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
s32 s32result;
|
||||
|
||||
s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer)
|
||||
{
|
||||
s32 s32result;
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceReadTrack(%i)", lsn);
|
||||
PrintLog("CDVD device: DeviceReadTrack(%i)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
// Get that data
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
s32result = DVDreadTrack(lsn, mode, buffer);
|
||||
} else {
|
||||
s32result = CDreadTrack(lsn, mode, buffer);
|
||||
} //ENDIF- Read a DVD sector or a CD sector?
|
||||
|
||||
return(s32result);
|
||||
if (DiscInserted() == -1) return(-1);
|
||||
// Get that data
|
||||
if ((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
s32result = DVDreadTrack(lsn, mode, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
s32result = CDreadTrack(lsn, mode, buffer);
|
||||
} //ENDIF- Read a DVD sector or a CD sector?
|
||||
return(s32result);
|
||||
} // END DeviceReadTrack()
|
||||
|
||||
|
||||
s32 DeviceBufferOffset() {
|
||||
s32 DeviceBufferOffset()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceBufferOffset()");
|
||||
PrintLog("CDVD device: DeviceBufferOffset()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(0);
|
||||
} else {
|
||||
return(CDgetBufferOffset());
|
||||
} // ENDIF- Is this a DVD?
|
||||
if (DiscInserted() == -1) return(-1);
|
||||
if ((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(CDgetBufferOffset());
|
||||
} // ENDIF- Is this a DVD?
|
||||
} // END DeviceBufferOffset()
|
||||
|
||||
|
||||
s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd) {
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(DVDgetTD(track, cdvdtd));
|
||||
} else {
|
||||
return(CDgetTD(track, cdvdtd));
|
||||
} // ENDIF- Is this a DVD?
|
||||
s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd)
|
||||
{
|
||||
if (DiscInserted() == -1) return(-1);
|
||||
if ((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(DVDgetTD(track, cdvdtd));
|
||||
}
|
||||
else
|
||||
{
|
||||
return(CDgetTD(track, cdvdtd));
|
||||
} // ENDIF- Is this a DVD?
|
||||
} // END DeviceGetTD()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus()
|
||||
s32 DeviceGetDiskType() {
|
||||
s32 s32result;
|
||||
s32 ioctldisktype;
|
||||
|
||||
errno = 0;
|
||||
s32 DeviceGetDiskType()
|
||||
{
|
||||
s32 s32result;
|
||||
s32 ioctldisktype;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
errno = 0;
|
||||
|
||||
if(traystatus == CDVD_TRAY_OPEN) {
|
||||
return(disctype);
|
||||
} // ENDIF- Is the device tray open? No disc to check yet.
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if(disctype != CDVD_TYPE_NODISC) {
|
||||
return(disctype);
|
||||
} // ENDIF- Already checked? Drive still closed? Disc hasn't changed.
|
||||
if (traystatus == CDVD_TRAY_OPEN)
|
||||
{
|
||||
return(disctype);
|
||||
} // ENDIF- Is the device tray open? No disc to check yet.
|
||||
|
||||
if (disctype != CDVD_TYPE_NODISC)
|
||||
{
|
||||
return(disctype);
|
||||
} // ENDIF- Already checked? Drive still closed? Disc hasn't changed.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceGetDiskType()");
|
||||
PrintLog("CDVD device: DeviceGetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
disctype = CDVD_TYPE_DETCT;
|
||||
|
||||
ioctldisktype = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if(errno != 0) {
|
||||
disctype = CDVD_TYPE_DETCT;
|
||||
ioctldisktype = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if (errno != 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble reading Disc Type!");
|
||||
PrintLog("CDVD device: Error: %i:%s", errno, strerror(errno));
|
||||
PrintLog("CDVD device: Trouble reading Disc Type!");
|
||||
PrintLog("CDVD device: Error: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
disctype = CDVD_TYPE_UNKNOWN;
|
||||
return(disctype);
|
||||
} // ENDIF- Trouble probing for a disc?
|
||||
disctype = CDVD_TYPE_UNKNOWN;
|
||||
return(disctype);
|
||||
} // ENDIF- Trouble probing for a disc?
|
||||
s32result = DVDgetDiskType(ioctldisktype);
|
||||
if (s32result != -1)
|
||||
{
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
|
||||
s32result = DVDgetDiskType(ioctldisktype);
|
||||
if(s32result != -1) {
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
|
||||
s32result = CDgetDiskType(ioctldisktype);
|
||||
if(s32result != -1) {
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
|
||||
disctype = CDVD_TYPE_UNKNOWN; // Not a CD? Not a DVD? Is is peanut butter?
|
||||
return(disctype);
|
||||
s32result = CDgetDiskType(ioctldisktype);
|
||||
if (s32result != -1)
|
||||
{
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
disctype = CDVD_TYPE_UNKNOWN; // Not a CD? Not a DVD? Is is peanut butter?
|
||||
return(disctype);
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
// Called by PollLoop() and CDVDgetTrayStatus()
|
||||
s32 DeviceTrayStatus() {
|
||||
s32 s32result;
|
||||
s32 DeviceTrayStatus()
|
||||
{
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayStatus()");
|
||||
PrintLog("CDVD device: DeviceTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_DRIVE_STATUS) != 0) {
|
||||
s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS);
|
||||
if(s32result < 0) {
|
||||
if ((devicecapability & CDC_DRIVE_STATUS) != 0)
|
||||
{
|
||||
s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS);
|
||||
if (s32result < 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble reading Drive Status!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
PrintLog("CDVD device: Trouble reading Drive Status!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Failure to get status? Assume it's open.
|
||||
errno = 0;
|
||||
|
||||
} else {
|
||||
s32result = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if(errno != 0) {
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Failure to get status? Assume it's open.
|
||||
errno = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
s32result = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if (errno != 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble detecting Disc Status presense!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
PrintLog("CDVD device: Trouble detecting Disc Status presense!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
errno = 0;
|
||||
} // ENDIF- Trouble?
|
||||
if(s32result == CDS_NO_DISC) {
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Is there no disc in the device? Guess the tray is open
|
||||
} // ENDIF- Can we poll the tray directly? (Or look at disc status instead?)
|
||||
|
||||
if(s32result == CDS_TRAY_OPEN) {
|
||||
traystatus = CDVD_TRAY_OPEN;
|
||||
if(disctype != CDVD_TYPE_NODISC) {
|
||||
DeviceClose(); // Kind of severe way of flushing all buffers.
|
||||
DeviceOpen();
|
||||
InitDisc();
|
||||
} // ENDIF- Tray just opened... clear disc info
|
||||
} else {
|
||||
traystatus = CDVD_TRAY_CLOSE;
|
||||
if(disctype == CDVD_TYPE_NODISC) {
|
||||
DeviceGetDiskType();
|
||||
} // ENDIF- Tray just closed? Get disc information
|
||||
} // ENDIF- Do we detect an open tray?
|
||||
return(traystatus);
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
errno = 0;
|
||||
} // ENDIF- Trouble?
|
||||
if (s32result == CDS_NO_DISC)
|
||||
{
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Is there no disc in the device? Guess the tray is open
|
||||
} // ENDIF- Can we poll the tray directly? (Or look at disc status instead?)
|
||||
if (s32result == CDS_TRAY_OPEN)
|
||||
{
|
||||
traystatus = CDVD_TRAY_OPEN;
|
||||
if (disctype != CDVD_TYPE_NODISC)
|
||||
{
|
||||
DeviceClose(); // Kind of severe way of flushing all buffers.
|
||||
DeviceOpen();
|
||||
InitDisc();
|
||||
} // ENDIF- Tray just opened... clear disc info
|
||||
}
|
||||
else
|
||||
{
|
||||
traystatus = CDVD_TRAY_CLOSE;
|
||||
if (disctype == CDVD_TYPE_NODISC)
|
||||
{
|
||||
DeviceGetDiskType();
|
||||
} // ENDIF- Tray just closed? Get disc information
|
||||
} // ENDIF- Do we detect an open tray?
|
||||
return(traystatus);
|
||||
} // END CDVD_getTrayStatus()
|
||||
s32 DeviceTrayOpen()
|
||||
{
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
s32 DeviceTrayOpen() {
|
||||
s32 s32result;
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_OPEN_TRAY) == 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Don't have open capability? Error out.
|
||||
|
||||
// Tray already open? Exit.
|
||||
if(traystatus == CDVD_TRAY_OPEN) return(0);
|
||||
if ((devicecapability & CDC_OPEN_TRAY) == 0)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Don't have open capability? Error out.
|
||||
|
||||
// Tray already open? Exit.
|
||||
if (traystatus == CDVD_TRAY_OPEN) return(0);
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayOpen()");
|
||||
PrintLog("CDVD device: DeviceTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMEJECT);
|
||||
s32result = ioctl(devicehandle, CDROMEJECT);
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
PrintLog("CDVD device: Could not open the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
if ((s32result != 0) || (errno != 0))
|
||||
{
|
||||
PrintLog("CDVD device: Could not open the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(s32result);
|
||||
return(s32result);
|
||||
} // END DeviceTrayOpen()
|
||||
|
||||
|
||||
s32 DeviceTrayClose() {
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_CLOSE_TRAY) == 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Don't have close capability? Error out.
|
||||
|
||||
// Tray already closed? Exit.
|
||||
if(traystatus == CDVD_TRAY_CLOSE) return(0);
|
||||
|
||||
s32 DeviceTrayClose()
|
||||
{
|
||||
s32 s32result;
|
||||
errno = 0;
|
||||
if (devicehandle == -1)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
if ((devicecapability & CDC_CLOSE_TRAY) == 0)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Don't have close capability? Error out.
|
||||
// Tray already closed? Exit.
|
||||
if (traystatus == CDVD_TRAY_CLOSE) return(0);
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayClose()");
|
||||
PrintLog("CDVD device: DeviceTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMCLOSETRAY);
|
||||
s32result = ioctl(devicehandle, CDROMCLOSETRAY);
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
PrintLog("CDVD device: Could not close the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
if ((s32result != 0) || (errno != 0))
|
||||
{
|
||||
PrintLog("CDVD device: Could not close the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(s32result);
|
||||
return(s32result);
|
||||
} // END DeviceTrayClose()
|
||||
|
|
|
@ -1,138 +1,60 @@
|
|||
/* device.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DEVICE_H__
|
||||
|
||||
#define __DEVICE_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <time.h> // time_t
|
||||
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#define __LINUX__
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
// #define VERBOSE_WARNINGS
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Device Data
|
||||
|
||||
|
||||
|
||||
extern int devicehandle;
|
||||
|
||||
extern s32 devicecapability; // Need to export?
|
||||
|
||||
|
||||
|
||||
extern time_t lasttime;
|
||||
|
||||
extern s32 traystatus;
|
||||
|
||||
extern s32 disctype;
|
||||
|
||||
extern u8 tocbuffer[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Device Functions
|
||||
|
||||
|
||||
|
||||
extern void DeviceInit();
|
||||
|
||||
extern void InitDisc();
|
||||
|
||||
extern s32 DiscInserted();
|
||||
|
||||
extern s32 DeviceOpen();
|
||||
|
||||
extern void DeviceClose();
|
||||
|
||||
extern s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DeviceBufferOffset();
|
||||
|
||||
extern s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DeviceGetDiskType();
|
||||
|
||||
extern s32 DeviceTrayStatus();
|
||||
|
||||
extern s32 DeviceTrayOpen();
|
||||
|
||||
extern s32 DeviceTrayClose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DEVICE_H__ */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,100 +1,47 @@
|
|||
/* devicebox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef DEVICEBOX_H
|
||||
|
||||
#define DEVICEBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct DeviceBoxData {
|
||||
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
GtkWidget *device; // GtkEntry
|
||||
|
||||
GtkWidget *devicedesc; // GtkLabel
|
||||
|
||||
GtkWidget *file; // GtkEntry
|
||||
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
|
||||
struct DeviceBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *device; // GtkEntry
|
||||
GtkWidget *devicedesc; // GtkLabel
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct DeviceBoxData devicebox;
|
||||
|
||||
|
||||
|
||||
extern void DeviceBoxDestroy();
|
||||
|
||||
// extern void DeviceBoxUnfocus();
|
||||
|
||||
extern void DeviceBoxRefocus();
|
||||
|
||||
extern void DeviceBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* DEVICEBOX_H */
|
||||
|
||||
|
|
|
@ -1,134 +1,71 @@
|
|||
/* interface.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcmp()
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
|
||||
#include <gtk/gtkwidget.h> // gtk_widget_show_all()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "aboutbox.h"
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
#include "devicebox.h"
|
||||
|
||||
#include "selectionbox.h"
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
#include "messagebox.h"
|
||||
|
||||
#include "conversionbox.h"
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if(argc != 2) return(1);
|
||||
|
||||
|
||||
|
||||
gtk_init(NULL, NULL);
|
||||
|
||||
|
||||
|
||||
if(!strcmp(argv[1], "about")) {
|
||||
|
||||
AboutBoxDisplay();
|
||||
|
||||
return(0);
|
||||
|
||||
} else if (!strcmp(argv[1], "configure")) {
|
||||
|
||||
OpenLog();
|
||||
|
||||
InitConf();
|
||||
|
||||
LoadConf();
|
||||
|
||||
MainBoxDisplay();
|
||||
|
||||
DeviceBoxDisplay();
|
||||
|
||||
ConversionBoxDisplay();
|
||||
|
||||
ProgressBoxDisplay();
|
||||
|
||||
MessageBoxDisplay();
|
||||
|
||||
SelectionBoxDisplay();
|
||||
|
||||
|
||||
|
||||
gtk_widget_show_all(mainbox.window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
CloseLog();
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDLONGIF- Which display would you like to see?
|
||||
|
||||
|
||||
|
||||
return(1); // No Displays chosen? Abort!
|
||||
|
||||
} // END main()
|
||||
|
||||
/* interface.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <string.h> // strcmp()
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkwidget.h> // gtk_widget_show_all()
|
||||
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "aboutbox.h"
|
||||
#include "mainbox.h"
|
||||
#include "devicebox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
#include "conversionbox.h"
|
||||
#include "interface.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2) return(1);
|
||||
|
||||
gtk_init(NULL, NULL);
|
||||
|
||||
if (!strcmp(argv[1], "about"))
|
||||
{
|
||||
AboutBoxDisplay();
|
||||
return(0);
|
||||
}
|
||||
else if (!strcmp(argv[1], "configure"))
|
||||
{
|
||||
OpenLog();
|
||||
InitConf();
|
||||
LoadConf();
|
||||
MainBoxDisplay();
|
||||
DeviceBoxDisplay();
|
||||
ConversionBoxDisplay();
|
||||
ProgressBoxDisplay();
|
||||
MessageBoxDisplay();
|
||||
SelectionBoxDisplay();
|
||||
|
||||
gtk_widget_show_all(mainbox.window);
|
||||
gtk_main();
|
||||
CloseLog();
|
||||
return(0);
|
||||
} // ENDLONGIF- Which display would you like to see?
|
||||
|
||||
return(1); // No Displays chosen? Abort!
|
||||
} // END main()
|
||||
|
|
|
@ -1,58 +1,26 @@
|
|||
/* interface.h
|
||||
|
||||
* Copyright (C) 2002-2004 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef INTERFACE_H
|
||||
|
||||
#define INTERFACE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Place holder... for now
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INTERFACE_H */
|
||||
|
||||
|
|
|
@ -1,180 +1,83 @@
|
|||
/* logfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <fcntl.h> // open
|
||||
|
||||
#include <stdio.h> // vsprintf()
|
||||
|
||||
#include <stdarg.h> // va_start(), va_end(), vsprintf()
|
||||
|
||||
#include <sys/stat.h> // mkdir(), open()
|
||||
|
||||
#include <sys/types.h> // mkdir(), open()
|
||||
|
||||
#include <unistd.h> // close(), write(), unlink()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int logfile;
|
||||
|
||||
char logfiletemp[2048];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
void InitLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
mkdir("./logs", 0755);
|
||||
|
||||
|
||||
|
||||
unlink("./logs/CDVDlog.txt");
|
||||
|
||||
mkdir("./logs", 0755);
|
||||
unlink("./logs/CDVDlog.txt");
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END InitLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int OpenLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
int OpenLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
logfile = -1;
|
||||
|
||||
logfile = open("./logs/CDVDlog.txt", O_WRONLY | O_CREAT | O_APPEND, 0755);
|
||||
|
||||
if(logfile == -1) return(-1);
|
||||
|
||||
logfile = -1;
|
||||
logfile = open("./logs/CDVDlog.txt", O_WRONLY | O_CREAT | O_APPEND, 0755);
|
||||
if (logfile == -1) return(-1);
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
return(0);
|
||||
} // END OpenLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CloseLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
void CloseLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
if(logfile != -1) {
|
||||
|
||||
close(logfile);
|
||||
|
||||
logfile = -1;
|
||||
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
|
||||
if (logfile != -1)
|
||||
{
|
||||
close(logfile);
|
||||
logfile = -1;
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END CloseLog()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void PrintLog(const char *fmt, ...) {
|
||||
|
||||
// Token comment line
|
||||
|
||||
void PrintLog(const char *fmt, ...)
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
va_list list;
|
||||
|
||||
int len;
|
||||
|
||||
|
||||
|
||||
if(logfile == -1) return; // Log file not open.
|
||||
|
||||
|
||||
|
||||
va_start(list, fmt);
|
||||
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
|
||||
|
||||
len = 0;
|
||||
|
||||
while((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
|
||||
|
||||
|
||||
write(logfile, logfiletemp, len);
|
||||
|
||||
write(logfile, "\r\n", 2); // ... and write out your own.
|
||||
|
||||
va_list list;
|
||||
int len;
|
||||
if (logfile == -1) return; // Log file not open.
|
||||
va_start(list, fmt);
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
va_end(list);
|
||||
len = 0;
|
||||
while ((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
if ((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
if ((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
write(logfile, logfiletemp, len);
|
||||
write(logfile, "\r\n", 2); // ... and write out your own.
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END PrintLog()
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
/* logfile.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOGFILE_H
|
||||
#define LOGFILE_H
|
||||
|
||||
|
||||
#define VERBOSE_LOGFILE
|
||||
|
||||
|
||||
extern void InitLog();
|
||||
extern int OpenLog();
|
||||
extern void CloseLog();
|
||||
extern void PrintLog(const char *format, ...);
|
||||
|
||||
|
||||
#endif /* LOGFILE_H */
|
||||
/* logfile.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOGFILE_H
|
||||
#define LOGFILE_H
|
||||
|
||||
|
||||
#define VERBOSE_LOGFILE
|
||||
|
||||
|
||||
extern void InitLog();
|
||||
extern int OpenLog();
|
||||
extern void CloseLog();
|
||||
extern void PrintLog(const char *format, ...);
|
||||
|
||||
|
||||
#endif /* LOGFILE_H */
|
||||
|
|
|
@ -1,648 +1,317 @@
|
|||
/* mainbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcpy()
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
|
||||
#include <gtk/gtkcheckbutton.h> // gtk_check_button_new_with_label()
|
||||
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
|
||||
#include <gtk/gtkentry.h> // gtk_entry_new()
|
||||
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
|
||||
#include <gtk/gtktogglebutton.h> // gtk_toggle_button_set_active(), (_get_)
|
||||
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
|
||||
// #include "imagetype.h" // imagedata[].name
|
||||
|
||||
#include "multifile.h" // multinames[]
|
||||
|
||||
#include "tablerebuild.h" // IsoTableRebuild()
|
||||
|
||||
#include "devicebox.h"
|
||||
|
||||
#include "conversionbox.h"
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
#include "messagebox.h"
|
||||
|
||||
#include "selectionbox.h"
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct MainBoxData mainbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDestroy() {
|
||||
|
||||
if(mainbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(mainbox.window);
|
||||
|
||||
mainbox.window = NULL;
|
||||
|
||||
mainbox.file = NULL;
|
||||
|
||||
mainbox.selectbutton = NULL;
|
||||
|
||||
mainbox.desc = NULL;
|
||||
|
||||
mainbox.startcheck = NULL;
|
||||
|
||||
mainbox.restartcheck = NULL;
|
||||
|
||||
mainbox.okbutton = NULL;
|
||||
|
||||
mainbox.devbutton = NULL;
|
||||
|
||||
mainbox.convbutton = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
void MainBoxDestroy()
|
||||
{
|
||||
if (mainbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(mainbox.window);
|
||||
mainbox.window = NULL;
|
||||
mainbox.file = NULL;
|
||||
mainbox.selectbutton = NULL;
|
||||
mainbox.desc = NULL;
|
||||
mainbox.startcheck = NULL;
|
||||
mainbox.restartcheck = NULL;
|
||||
mainbox.okbutton = NULL;
|
||||
mainbox.devbutton = NULL;
|
||||
mainbox.convbutton = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxUnfocus() {
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.file, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, FALSE);
|
||||
|
||||
gtk_window_iconify(GTK_WINDOW(mainbox.window));
|
||||
|
||||
void MainBoxUnfocus()
|
||||
{
|
||||
gtk_widget_set_sensitive(mainbox.file, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, FALSE);
|
||||
gtk_window_iconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxUnfocus()
|
||||
|
||||
gint MainBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Image file?
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
|
||||
|
||||
gint MainBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
int returnval;
|
||||
|
||||
char templine[256];
|
||||
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
|
||||
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
|
||||
if(returnval == -1) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: ---");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
|
||||
|
||||
if(returnval == -2) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a file");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
|
||||
|
||||
if(returnval == -3) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a valid image file");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not an Image file?
|
||||
|
||||
|
||||
|
||||
if(returnval == -4) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Missing Table File (will rebuild)");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
|
||||
multinames[tempfile->multi],
|
||||
|
||||
tempfile->imagename,
|
||||
|
||||
compressdesc[tempfile->compress]);
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), templine);
|
||||
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
void MainBoxRefocus()
|
||||
{
|
||||
GdkEvent event;
|
||||
|
||||
MainBoxFileEvent(NULL, event, NULL);
|
||||
|
||||
|
||||
|
||||
void MainBoxRefocus() {
|
||||
|
||||
GdkEvent event;
|
||||
|
||||
|
||||
|
||||
MainBoxFileEvent(NULL, event, NULL);
|
||||
|
||||
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.file, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
|
||||
|
||||
gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
|
||||
|
||||
gtk_window_deiconify(GTK_WINDOW(mainbox.window));
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.file, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
|
||||
gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
|
||||
gtk_window_deiconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
gint MainBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
mainbox.stop = 1; // Halt all long processess...
|
||||
MessageBoxDestroy();
|
||||
SelectionBoxDestroy();
|
||||
ProgressBoxDestroy();
|
||||
ConversionBoxDestroy();
|
||||
DeviceBoxDestroy();
|
||||
MainBoxDestroy();
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
mainbox.stop = 1; // Halt all long processess...
|
||||
|
||||
|
||||
|
||||
MessageBoxDestroy();
|
||||
|
||||
SelectionBoxDestroy();
|
||||
|
||||
ProgressBoxDestroy();
|
||||
|
||||
ConversionBoxDestroy();
|
||||
|
||||
DeviceBoxDestroy();
|
||||
|
||||
MainBoxDestroy();
|
||||
|
||||
|
||||
|
||||
gtk_main_quit();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gtk_main_quit();
|
||||
return(TRUE);
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
const char *tempisoname;
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
tempisoname = gtk_entry_get_text(GTK_ENTRY(mainbox.file));
|
||||
if (*(tempisoname) != 0)
|
||||
{
|
||||
if (IsIsoFile(tempisoname) == -4)
|
||||
{
|
||||
IsoTableRebuild(tempisoname);
|
||||
MainBoxRefocus();
|
||||
return(TRUE);
|
||||
} // ENDIF- Do we need to rebuild an image file's index before using it?
|
||||
|
||||
if (IsIsoFile(tempisoname) < 0)
|
||||
{
|
||||
tempisoname = NULL;
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Not a Valid Image File.", 1);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
} // ENDIF- Is there an ISO file to check out?
|
||||
|
||||
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
const char *tempisoname;
|
||||
|
||||
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
tempisoname = gtk_entry_get_text(GTK_ENTRY(mainbox.file));
|
||||
|
||||
if(*(tempisoname) != 0) {
|
||||
|
||||
if(IsIsoFile(tempisoname) == -4) {
|
||||
|
||||
IsoTableRebuild(tempisoname);
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Do we need to rebuild an image file's index before using it?
|
||||
|
||||
|
||||
|
||||
if(IsIsoFile(tempisoname) < 0) {
|
||||
|
||||
tempisoname = NULL;
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
MessageBoxShow("Not a Valid Image File.", 1);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
|
||||
} // ENDIF- Is there an ISO file to check out?
|
||||
|
||||
|
||||
|
||||
strcpy(conf.isoname, tempisoname);
|
||||
|
||||
tempisoname = NULL;
|
||||
|
||||
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.startcheck)) == FALSE) {
|
||||
|
||||
conf.startconfigure = 0; // FALSE
|
||||
|
||||
} else {
|
||||
|
||||
conf.startconfigure = 1; // TRUE
|
||||
|
||||
} // ENDIF- Was this check button turned off?
|
||||
|
||||
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck)) == FALSE) {
|
||||
|
||||
conf.restartconfigure = 0; // FALSE
|
||||
|
||||
} else {
|
||||
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
|
||||
} // ENDIF- Was this check button turned off?
|
||||
|
||||
|
||||
|
||||
SaveConf();
|
||||
|
||||
|
||||
|
||||
MainBoxCancelEvent(widget, event, data);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
strcpy(conf.isoname, tempisoname);
|
||||
tempisoname = NULL;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.startcheck)) == FALSE)
|
||||
{
|
||||
conf.startconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.startconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this check button turned off?
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck)) == FALSE)
|
||||
{
|
||||
conf.restartconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this check button turned off?
|
||||
SaveConf();
|
||||
MainBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END MainBoxOKEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
|
||||
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
|
||||
selectionbox.wherefrom = 1; // From the Main Window
|
||||
|
||||
SelectionBoxRefocus();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gint MainBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
selectionbox.wherefrom = 1; // From the Main Window
|
||||
SelectionBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
gint MainBoxDeviceEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxDeviceEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
|
||||
gtk_window_set_focus(GTK_WINDOW(devicebox.window), devicebox.file);
|
||||
|
||||
gtk_widget_show_all(devicebox.window);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
gtk_window_set_focus(GTK_WINDOW(devicebox.window), devicebox.file);
|
||||
gtk_widget_show_all(devicebox.window);
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxConversionEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
|
||||
gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
|
||||
|
||||
gtk_widget_show_all(conversionbox.window);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gint MainBoxConversionEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
|
||||
gtk_widget_show_all(conversionbox.window);
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *hbox1;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
|
||||
|
||||
mainbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(mainbox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(mainbox.window), "CDVDisoEFP Configuration");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(mainbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mainbox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbox_new(FALSE, 10);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("Iso File:");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
mainbox.file = gtk_entry_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.file, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.file);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.file), "changed",
|
||||
|
||||
G_CALLBACK(MainBoxFileEvent), NULL);
|
||||
|
||||
|
||||
|
||||
mainbox.selectbutton = gtk_button_new_with_label("Browse");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.selectbutton, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.selectbutton);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.selectbutton), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxBrowseEvent), NULL);
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
mainbox.desc = gtk_label_new("File Type: ---");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.desc, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.desc);
|
||||
|
||||
|
||||
|
||||
// hbox1 = gtk_hbox_new(FALSE, 10);
|
||||
|
||||
// gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
// gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
mainbox.startcheck = gtk_check_button_new_with_label("Show Configure screen when starting emulation");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.startcheck, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.startcheck);
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), FALSE);
|
||||
|
||||
if(conf.startconfigure != 0) {
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), TRUE);
|
||||
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
|
||||
|
||||
|
||||
mainbox.restartcheck = gtk_check_button_new_with_label("Show Configure screen when restarting emulation");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.restartcheck, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.restartcheck);
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), FALSE);
|
||||
|
||||
if(conf.restartconfigure != 0) {
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), TRUE);
|
||||
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
mainbox.okbutton = gtk_button_new_with_label("Ok");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.okbutton, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.okbutton);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.okbutton), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxOKEvent), NULL);
|
||||
|
||||
|
||||
|
||||
mainbox.devbutton = gtk_button_new_with_label("Get from Disc");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.devbutton, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.devbutton);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.devbutton), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxDeviceEvent), NULL);
|
||||
|
||||
|
||||
|
||||
mainbox.convbutton = gtk_button_new_with_label("Convert");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.convbutton, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.convbutton);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.convbutton), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxConversionEvent), NULL);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
// We held off setting the name until now... so description would show.
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file), conf.isoname);
|
||||
|
||||
void MainBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
|
||||
mainbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(mainbox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(mainbox.window), "CDVDisoEFP Configuration");
|
||||
gtk_window_set_position(GTK_WINDOW(mainbox.window), GTK_WIN_POS_CENTER);
|
||||
g_signal_connect(G_OBJECT(mainbox.window), "delete_event",
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(mainbox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
hbox1 = gtk_hbox_new(FALSE, 10);
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
item = gtk_label_new("Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
mainbox.file = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.file, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.file);
|
||||
g_signal_connect(G_OBJECT(mainbox.file), "changed",
|
||||
G_CALLBACK(MainBoxFileEvent), NULL);
|
||||
|
||||
mainbox.selectbutton = gtk_button_new_with_label("Browse");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.selectbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.selectbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.selectbutton), "clicked",
|
||||
G_CALLBACK(MainBoxBrowseEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
mainbox.desc = gtk_label_new("File Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.desc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.desc);
|
||||
// hbox1 = gtk_hbox_new(FALSE, 10);
|
||||
// gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
// gtk_widget_show(hbox1);
|
||||
mainbox.startcheck = gtk_check_button_new_with_label("Show Configure screen when starting emulation");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.startcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.startcheck);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), FALSE);
|
||||
if (conf.startconfigure != 0)
|
||||
{
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), TRUE);
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
mainbox.restartcheck = gtk_check_button_new_with_label("Show Configure screen when restarting emulation");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.restartcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.restartcheck);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), FALSE);
|
||||
if (conf.restartconfigure != 0)
|
||||
{
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), TRUE);
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
mainbox.okbutton = gtk_button_new_with_label("Ok");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.okbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.okbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.okbutton), "clicked",
|
||||
G_CALLBACK(MainBoxOKEvent), NULL);
|
||||
mainbox.devbutton = gtk_button_new_with_label("Get from Disc");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.devbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.devbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.devbutton), "clicked",
|
||||
G_CALLBACK(MainBoxDeviceEvent), NULL);
|
||||
mainbox.convbutton = gtk_button_new_with_label("Convert");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.convbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.convbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.convbutton), "clicked",
|
||||
G_CALLBACK(MainBoxConversionEvent), NULL);
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
|
||||
// We held off setting the name until now... so description would show.
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file), conf.isoname);
|
||||
} // END MainBoxDisplay()
|
||||
|
||||
|
|
|
@ -1,50 +1,51 @@
|
|||
/* mainbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MAINBOX_H
|
||||
#define MAINBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct MainBoxData {
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *desc; // GtkLabel
|
||||
GtkWidget *startcheck; // GtkCheckBox
|
||||
GtkWidget *restartcheck; // GtkCheckBox
|
||||
GtkWidget *devbutton; // GtkButton
|
||||
GtkWidget *convbutton; // GtkButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
// Leaving the Cancel button unblocked... for emergency shutdown
|
||||
|
||||
int stop; // Variable signal to stop long processes
|
||||
};
|
||||
|
||||
extern struct MainBoxData mainbox;
|
||||
|
||||
extern void MainBoxRefocus();
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
/* mainbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MAINBOX_H
|
||||
#define MAINBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct MainBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *desc; // GtkLabel
|
||||
GtkWidget *startcheck; // GtkCheckBox
|
||||
GtkWidget *restartcheck; // GtkCheckBox
|
||||
GtkWidget *devbutton; // GtkButton
|
||||
GtkWidget *convbutton; // GtkButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
// Leaving the Cancel button unblocked... for emergency shutdown
|
||||
|
||||
int stop; // Variable signal to stop long processes
|
||||
};
|
||||
|
||||
extern struct MainBoxData mainbox;
|
||||
|
||||
extern void MainBoxRefocus();
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
|
|
@ -1,226 +1,108 @@
|
|||
/* messagebox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
#include "devicebox.h"
|
||||
|
||||
#include "conversionbox.h"
|
||||
|
||||
#include "messagebox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct MessageBoxData messagebox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MessageBoxDestroy() {
|
||||
|
||||
if(messagebox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(messagebox.window);
|
||||
|
||||
messagebox.window = NULL;
|
||||
|
||||
messagebox.desc = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
void MessageBoxDestroy()
|
||||
{
|
||||
if (messagebox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(messagebox.window);
|
||||
messagebox.window = NULL;
|
||||
messagebox.desc = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MessageBoxDestroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MessageBoxShow(char *message, int wherefrom) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(messagebox.desc), message);
|
||||
|
||||
messagebox.wherefrom = wherefrom;
|
||||
|
||||
|
||||
|
||||
gtk_widget_show_all(messagebox.window);
|
||||
|
||||
gtk_window_deiconify(GTK_WINDOW(messagebox.window));
|
||||
|
||||
void MessageBoxShow(char *message, int wherefrom)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(messagebox.desc), message);
|
||||
messagebox.wherefrom = wherefrom;
|
||||
gtk_widget_show_all(messagebox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(messagebox.window));
|
||||
} // END MessageBox()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MessageBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
gtk_widget_hide(messagebox.window);
|
||||
|
||||
|
||||
|
||||
switch(messagebox.wherefrom) {
|
||||
|
||||
case 1:
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
DeviceBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
ConversionBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Whose window do I get to re-focus when this is done?
|
||||
|
||||
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gint MessageBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
gtk_widget_hide(messagebox.window);
|
||||
switch (messagebox.wherefrom)
|
||||
{
|
||||
case 1:
|
||||
MainBoxRefocus();
|
||||
break;
|
||||
case 2:
|
||||
DeviceBoxRefocus();
|
||||
break;
|
||||
case 3:
|
||||
ConversionBoxRefocus();
|
||||
break;
|
||||
} // ENDSWITCH- Whose window do I get to re-focus when this is done?
|
||||
return(TRUE);
|
||||
} // END MessageBoxCancelEvent()
|
||||
|
||||
void MessageBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
|
||||
messagebox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(messagebox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(messagebox.window), "CDVDisoEFP");
|
||||
gtk_window_set_position(GTK_WINDOW(messagebox.window), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(messagebox.window), FALSE);
|
||||
|
||||
g_signal_connect(G_OBJECT(messagebox.window), "delete_event",
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(messagebox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
messagebox.desc = gtk_label_new("Hi There!\r\nHow are you doing?");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), messagebox.desc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(messagebox.desc);
|
||||
|
||||
void MessageBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *hbox1;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
|
||||
|
||||
messagebox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(messagebox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(messagebox.window), "CDVDisoEFP");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(messagebox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(messagebox.window), FALSE);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(messagebox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(messagebox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
messagebox.desc = gtk_label_new("Hi There!\r\nHow are you doing?");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), messagebox.desc, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(messagebox.desc);
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
} // END MessageBoxDisplay()
|
||||
|
||||
|
|
|
@ -1,43 +1,44 @@
|
|||
/* messagebox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MESSAGEBOX_H
|
||||
#define MESSAGEBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct MessageBoxData {
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel
|
||||
|
||||
int wherefrom; // Whom do I refocus when the message is read?
|
||||
};
|
||||
|
||||
extern struct MessageBoxData messagebox;
|
||||
|
||||
extern void MessageBoxDestroy();
|
||||
extern void MessageBoxShow(char *message, int wherefrom);
|
||||
extern void MessageBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MESSAGEBOX_H */
|
||||
/* messagebox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MESSAGEBOX_H
|
||||
#define MESSAGEBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct MessageBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel
|
||||
|
||||
int wherefrom; // Whom do I refocus when the message is read?
|
||||
};
|
||||
|
||||
extern struct MessageBoxData messagebox;
|
||||
|
||||
extern void MessageBoxDestroy();
|
||||
extern void MessageBoxShow(char *message, int wherefrom);
|
||||
extern void MessageBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MESSAGEBOX_H */
|
||||
|
|
|
@ -1,288 +1,134 @@
|
|||
/* progressbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
|
||||
#include <gtk/gtkmain.h> // gtk_main_iteration(), gtk_events_pending()
|
||||
|
||||
#include <gtk/gtkprogressbar.h> // gtk_progress_bar_new()
|
||||
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ProgressBoxData progressbox;
|
||||
|
||||
char progressboxline[256];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxDestroy() {
|
||||
|
||||
if(progressbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(progressbox.window);
|
||||
|
||||
progressbox.window = NULL;
|
||||
|
||||
progressbox.desc = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
void ProgressBoxDestroy()
|
||||
{
|
||||
if (progressbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(progressbox.window);
|
||||
progressbox.window = NULL;
|
||||
progressbox.desc = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END ProgressBoxDestroy()
|
||||
|
||||
void ProgressBoxStart(char *description, off64_t maximum)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(progressbox.desc), description);
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxStart(char *description, off64_t maximum) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(progressbox.desc), description);
|
||||
|
||||
|
||||
|
||||
progressbox.max = maximum;
|
||||
|
||||
progressbox.gmax = maximum;
|
||||
|
||||
progressbox.lastpct = 100;
|
||||
|
||||
progressbox.stop = 0;
|
||||
|
||||
|
||||
|
||||
ProgressBoxTick(0);
|
||||
|
||||
gtk_widget_show_all(progressbox.window);
|
||||
|
||||
gtk_window_deiconify(GTK_WINDOW(progressbox.window));
|
||||
|
||||
progressbox.max = maximum;
|
||||
progressbox.gmax = maximum;
|
||||
progressbox.lastpct = 100;
|
||||
progressbox.stop = 0;
|
||||
ProgressBoxTick(0);
|
||||
gtk_widget_show_all(progressbox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(progressbox.window));
|
||||
} // END ProgressBoxStart()
|
||||
|
||||
void ProgressBoxTick(off64_t current)
|
||||
{
|
||||
gdouble gcur;
|
||||
off64_t thispct;
|
||||
gcur = current;
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbox.bar),
|
||||
gcur / progressbox.gmax);
|
||||
sprintf(progressboxline, "%llu of %llu", current, progressbox.max);
|
||||
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbox.bar), progressboxline);
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxTick(off64_t current) {
|
||||
|
||||
gdouble gcur;
|
||||
|
||||
off64_t thispct;
|
||||
|
||||
|
||||
|
||||
gcur = current;
|
||||
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbox.bar),
|
||||
|
||||
gcur / progressbox.gmax);
|
||||
|
||||
|
||||
|
||||
sprintf(progressboxline, "%llu of %llu", current, progressbox.max);
|
||||
|
||||
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbox.bar), progressboxline);
|
||||
|
||||
|
||||
|
||||
if(progressbox.max >= 100) {
|
||||
|
||||
thispct = current / ( progressbox.max / 100 );
|
||||
|
||||
if(thispct != progressbox.lastpct) {
|
||||
|
||||
sprintf(progressboxline, "%llu%% CDVDisoEFP Progress", thispct);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), progressboxline);
|
||||
|
||||
progressbox.lastpct = thispct;
|
||||
|
||||
} // ENDIF- Change in percentage? (Avoiding title flicker)
|
||||
|
||||
} // ENDIF- Our maximum # over 100? (Avoiding divide-by-zero error)
|
||||
|
||||
|
||||
|
||||
while(gtk_events_pending()) gtk_main_iteration(); // Give time for window to redraw.
|
||||
|
||||
if (progressbox.max >= 100)
|
||||
{
|
||||
thispct = current / (progressbox.max / 100);
|
||||
if (thispct != progressbox.lastpct)
|
||||
{
|
||||
sprintf(progressboxline, "%llu%% CDVDisoEFP Progress", thispct);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), progressboxline);
|
||||
progressbox.lastpct = thispct;
|
||||
} // ENDIF- Change in percentage? (Avoiding title flicker)
|
||||
} // ENDIF- Our maximum # over 100? (Avoiding divide-by-zero error)
|
||||
while (gtk_events_pending()) gtk_main_iteration(); // Give time for window to redraw.
|
||||
} // END ProgressBoxTick()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxStop() {
|
||||
|
||||
gtk_widget_hide(progressbox.window);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
|
||||
void ProgressBoxStop()
|
||||
{
|
||||
gtk_widget_hide(progressbox.window);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
} // END ProgressBoxStop()
|
||||
|
||||
gint ProgressBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
progressbox.stop = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
gint ProgressBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
progressbox.stop = 1;
|
||||
|
||||
|
||||
|
||||
return(TRUE);
|
||||
|
||||
return(TRUE);
|
||||
} // END ProgressBoxCancelEvent()
|
||||
|
||||
void ProgressBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
progressbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(progressbox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
gtk_window_set_position(GTK_WINDOW(progressbox.window), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(progressbox.window), FALSE);
|
||||
g_signal_connect(G_OBJECT(progressbox.window), "delete_event",
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *hbox1;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
|
||||
|
||||
progressbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(progressbox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(progressbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(progressbox.window), FALSE);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(progressbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(progressbox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
progressbox.desc = gtk_label_new("Twiddling Thumbs");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.desc, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(progressbox.desc);
|
||||
|
||||
|
||||
|
||||
progressbox.bar = gtk_progress_bar_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.bar, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(progressbox.bar);
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(progressbox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
progressbox.desc = gtk_label_new("Twiddling Thumbs");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.desc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(progressbox.desc);
|
||||
progressbox.bar = gtk_progress_bar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.bar, FALSE, FALSE, 0);
|
||||
gtk_widget_show(progressbox.bar);
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
} // END ProgressBoxDisplay()
|
||||
|
||||
|
|
|
@ -1,55 +1,56 @@
|
|||
/* progressbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PROGRESSBOX_H
|
||||
#define PROGRESSBOX_H
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
#include <gtk/gtkwidget.h> // GtkWidget
|
||||
|
||||
|
||||
extern const char *compressnames[];
|
||||
|
||||
struct ProgressBoxData {
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel - What are we showing progress on?
|
||||
GtkWidget *bar; // GtkProgressBar
|
||||
|
||||
off64_t max;
|
||||
gdouble gmax;
|
||||
off64_t lastpct;
|
||||
|
||||
int stop; // Someone pressed the Stop button
|
||||
};
|
||||
|
||||
extern struct ProgressBoxData progressbox;
|
||||
|
||||
|
||||
extern void ProgressBoxStart(char *description, off64_t maximum);
|
||||
extern void ProgressBoxTick(off64_t current);
|
||||
extern void ProgressBoxStop();
|
||||
extern void ProgressBoxDestroy();
|
||||
extern void ProgressBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
/* progressbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PROGRESSBOX_H
|
||||
#define PROGRESSBOX_H
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
#include <gtk/gtkwidget.h> // GtkWidget
|
||||
|
||||
|
||||
extern const char *compressnames[];
|
||||
|
||||
struct ProgressBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel - What are we showing progress on?
|
||||
GtkWidget *bar; // GtkProgressBar
|
||||
|
||||
off64_t max;
|
||||
gdouble gmax;
|
||||
off64_t lastpct;
|
||||
|
||||
int stop; // Someone pressed the Stop button
|
||||
};
|
||||
|
||||
extern struct ProgressBoxData progressbox;
|
||||
|
||||
|
||||
extern void ProgressBoxStart(char *description, off64_t maximum);
|
||||
extern void ProgressBoxTick(off64_t current);
|
||||
extern void ProgressBoxStop();
|
||||
extern void ProgressBoxDestroy();
|
||||
extern void ProgressBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
|
|
@ -1,204 +1,99 @@
|
|||
/* selectionbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include <glib-object.h> // g_signal_connect()
|
||||
|
||||
#include <gtk/gtkentry.h> // gtk_entry_set_text()
|
||||
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_new()
|
||||
|
||||
|
||||
|
||||
#include "devicebox.h"
|
||||
|
||||
#include "conversionbox.h"
|
||||
|
||||
#include "selectionbox.h"
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct SelectionBoxData selectionbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SelectionBoxDestroy() {
|
||||
|
||||
if(selectionbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(selectionbox.window);
|
||||
|
||||
selectionbox.window = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
void SelectionBoxDestroy()
|
||||
{
|
||||
if (selectionbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(selectionbox.window);
|
||||
selectionbox.window = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END SelectionBoxDestroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SelectionBoxRefresh() {
|
||||
|
||||
void SelectionBoxRefresh()
|
||||
{
|
||||
} // END SelectionBoxRefresh()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SelectionBoxUnfocus() {
|
||||
|
||||
gtk_widget_hide(selectionbox.window);
|
||||
|
||||
void SelectionBoxUnfocus()
|
||||
{
|
||||
gtk_widget_hide(selectionbox.window);
|
||||
} // END SelectionBoxUnfocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SelectionBoxRefocus() {
|
||||
|
||||
gtk_widget_show(selectionbox.window);
|
||||
|
||||
void SelectionBoxRefocus()
|
||||
{
|
||||
gtk_widget_show(selectionbox.window);
|
||||
} // END SelectionBoxRefocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint SelectionBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
SelectionBoxUnfocus();
|
||||
|
||||
switch(selectionbox.wherefrom) {
|
||||
|
||||
case 1:
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file),
|
||||
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
|
||||
DeviceBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
|
||||
ConversionBoxRefocus();
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH wherefrom- What Box called us?
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gint SelectionBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
SelectionBoxUnfocus();
|
||||
switch (selectionbox.wherefrom)
|
||||
{
|
||||
case 1:
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
MainBoxRefocus();
|
||||
break;
|
||||
case 2:
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
DeviceBoxRefocus();
|
||||
break;
|
||||
case 3:
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
ConversionBoxRefocus();
|
||||
break;
|
||||
} // ENDSWITCH wherefrom- What Box called us?
|
||||
return(TRUE);
|
||||
} // END SelectionBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint SelectionBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
// Validate listed file(?)
|
||||
|
||||
|
||||
|
||||
// Transfer file name to calling window?
|
||||
|
||||
|
||||
|
||||
SelectionBoxCancelEvent(widget, event, data);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
gint SelectionBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
// Validate listed file(?)
|
||||
// Transfer file name to calling window?
|
||||
SelectionBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END SelectionBoxOKEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SelectionBoxDisplay() {
|
||||
|
||||
selectionbox.window = gtk_file_selection_new("Select an ISO file");
|
||||
|
||||
g_signal_connect(G_OBJECT(selectionbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->ok_button),
|
||||
|
||||
"clicked", G_CALLBACK(SelectionBoxOKEvent), NULL);
|
||||
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->cancel_button),
|
||||
|
||||
"clicked", G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
selectionbox.wherefrom = 0; // Called by no one... yet.
|
||||
|
||||
void SelectionBoxDisplay()
|
||||
{
|
||||
selectionbox.window = gtk_file_selection_new("Select an ISO file");
|
||||
g_signal_connect(G_OBJECT(selectionbox.window), "delete_event",
|
||||
G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->ok_button),
|
||||
"clicked", G_CALLBACK(SelectionBoxOKEvent), NULL);
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->cancel_button),
|
||||
"clicked", G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
selectionbox.wherefrom = 0; // Called by no one... yet.
|
||||
} // END SelectionBoxDisplay()
|
||||
|
||||
|
|
|
@ -1,46 +1,47 @@
|
|||
/* selectionbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SELECTIONBOX_H
|
||||
#define SELECTIONBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct SelectionBoxData {
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
int wherefrom; // Which box called you?
|
||||
// 1 = MainBox
|
||||
// 2 = DeviceBox
|
||||
// 3 = ConversionBox
|
||||
};
|
||||
|
||||
extern struct SelectionBoxData selectionbox;
|
||||
|
||||
|
||||
extern void SelectionBoxDestroy();
|
||||
extern void SelectionBoxRefocus();
|
||||
extern void SelectionBoxDisplay();
|
||||
|
||||
|
||||
#endif /* SELECTIONBOX_H */
|
||||
/* selectionbox.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SELECTIONBOX_H
|
||||
#define SELECTIONBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct SelectionBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
int wherefrom; // Which box called you?
|
||||
// 1 = MainBox
|
||||
// 2 = DeviceBox
|
||||
// 3 = ConversionBox
|
||||
};
|
||||
|
||||
extern struct SelectionBoxData selectionbox;
|
||||
|
||||
|
||||
extern void SelectionBoxDestroy();
|
||||
extern void SelectionBoxRefocus();
|
||||
extern void SelectionBoxDisplay();
|
||||
|
||||
|
||||
#endif /* SELECTIONBOX_H */
|
||||
|
|
|
@ -1,380 +1,190 @@
|
|||
/* tablerebuild.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <stdlib.h> // malloc()
|
||||
|
||||
|
||||
|
||||
// #include <gtk/gtkmain.h> // gtk_main_iteration()
|
||||
|
||||
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "multifile.h"
|
||||
|
||||
#include "isocompress.h" // CompressClose()
|
||||
|
||||
#include "gzipv1.h"
|
||||
|
||||
#include "gzipv2.h"
|
||||
|
||||
#include "bzip2v2.h"
|
||||
|
||||
#include "bzip2v3.h"
|
||||
|
||||
#include "actualfile.h" // ACTUALHANDLENULL
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void IsoTableRebuild(const char *filename) {
|
||||
|
||||
struct IsoFile *datafile;
|
||||
|
||||
struct IsoFile *tablefile;
|
||||
|
||||
int retval;
|
||||
|
||||
char tempblock[65536];
|
||||
|
||||
int stop;
|
||||
|
||||
|
||||
|
||||
struct TableData table;
|
||||
|
||||
|
||||
|
||||
datafile = IsoFileOpenForRead(filename);
|
||||
|
||||
|
||||
|
||||
// Note: This is the start of the "Multifile" process. It's commented
|
||||
|
||||
// out so at least we can rebuild 1 part of a multifile at a time.
|
||||
|
||||
// IsoNameStripExt(datafile);
|
||||
|
||||
// IsoNameStripMulti(datafile);
|
||||
|
||||
|
||||
|
||||
// Prep tablefile to hold ONLY a table (no data)
|
||||
|
||||
tablefile = (struct IsoFile *) malloc(sizeof(struct IsoFile));
|
||||
|
||||
if(tablefile == NULL) {
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Failed to allocate? Abort.
|
||||
|
||||
|
||||
|
||||
tablefile->sectorpos = 0;
|
||||
|
||||
tablefile->openforread = 0;
|
||||
|
||||
tablefile->filebytepos = 0;
|
||||
|
||||
tablefile->filebytesize = 0;
|
||||
|
||||
tablefile->filesectorpos = 0;
|
||||
|
||||
tablefile->filesectorsize = 0;
|
||||
|
||||
tablefile->handle = ACTUALHANDLENULL;
|
||||
|
||||
|
||||
|
||||
tablefile->namepos = 0;
|
||||
|
||||
while((tablefile->namepos < 255) &&
|
||||
|
||||
(*(filename + tablefile->namepos) != 0)) {
|
||||
|
||||
tablefile->name[tablefile->namepos] = *(filename + tablefile->namepos);
|
||||
|
||||
tablefile->namepos++;
|
||||
|
||||
} // ENDWHILE- Copying file name into tablefile
|
||||
|
||||
tablefile->name[tablefile->namepos] = 0; // And 0-terminate.
|
||||
|
||||
|
||||
|
||||
tablefile->imageheader = datafile->imageheader;
|
||||
|
||||
tablefile->blocksize = datafile->blocksize;
|
||||
|
||||
tablefile->blockoffset = datafile->blockoffset;
|
||||
|
||||
tablefile->cdvdtype = 0; // Not important right now.
|
||||
|
||||
|
||||
|
||||
tablefile->compress = datafile->compress;
|
||||
|
||||
tablefile->compresspos = datafile->compresspos;
|
||||
|
||||
tablefile->numsectors = datafile->numsectors;
|
||||
|
||||
tablefile->tabledata = NULL;
|
||||
|
||||
|
||||
|
||||
switch(tablefile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Which table are we writing out?
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Failed to open table file? Abort
|
||||
|
||||
|
||||
|
||||
sprintf(tempblock, "Rebuilding table for %s", datafile->name);
|
||||
|
||||
ProgressBoxStart(tempblock, datafile->filebytesize);
|
||||
|
||||
|
||||
|
||||
stop = 0;
|
||||
|
||||
mainbox.stop = 0;
|
||||
|
||||
progressbox.stop = 0;
|
||||
|
||||
while((stop == 0) && (datafile->filebytepos < datafile->filebytesize)) {
|
||||
|
||||
switch(datafile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Scanning for the next complete compressed block
|
||||
|
||||
|
||||
|
||||
if(retval <= 0) {
|
||||
|
||||
void IsoTableRebuild(const char *filename)
|
||||
{
|
||||
struct IsoFile *datafile;
|
||||
struct IsoFile *tablefile;
|
||||
int retval;
|
||||
char tempblock[65536];
|
||||
int stop;
|
||||
struct TableData table;
|
||||
datafile = IsoFileOpenForRead(filename);
|
||||
// Note: This is the start of the "Multifile" process. It's commented
|
||||
// out so at least we can rebuild 1 part of a multifile at a time.
|
||||
// IsoNameStripExt(datafile);
|
||||
// IsoNameStripMulti(datafile);
|
||||
|
||||
// Prep tablefile to hold ONLY a table (no data)
|
||||
tablefile = (struct IsoFile *) malloc(sizeof(struct IsoFile));
|
||||
if (tablefile == NULL)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to allocate? Abort.
|
||||
tablefile->sectorpos = 0;
|
||||
tablefile->openforread = 0;
|
||||
tablefile->filebytepos = 0;
|
||||
tablefile->filebytesize = 0;
|
||||
tablefile->filesectorpos = 0;
|
||||
tablefile->filesectorsize = 0;
|
||||
tablefile->handle = ACTUALHANDLENULL;
|
||||
tablefile->namepos = 0;
|
||||
while ((tablefile->namepos < 255) &&
|
||||
(*(filename + tablefile->namepos) != 0))
|
||||
{
|
||||
tablefile->name[tablefile->namepos] = *(filename + tablefile->namepos);
|
||||
tablefile->namepos++;
|
||||
} // ENDWHILE- Copying file name into tablefile
|
||||
tablefile->name[tablefile->namepos] = 0; // And 0-terminate.
|
||||
tablefile->imageheader = datafile->imageheader;
|
||||
tablefile->blocksize = datafile->blocksize;
|
||||
tablefile->blockoffset = datafile->blockoffset;
|
||||
tablefile->cdvdtype = 0; // Not important right now.
|
||||
|
||||
tablefile->compress = datafile->compress;
|
||||
tablefile->compresspos = datafile->compresspos;
|
||||
tablefile->numsectors = datafile->numsectors;
|
||||
tablefile->tabledata = NULL;
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3OpenTableForWrite(tablefile);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Which table are we writing out?
|
||||
if (retval < 0)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to open table file? Abort
|
||||
|
||||
sprintf(tempblock, "Rebuilding table for %s", datafile->name);
|
||||
ProgressBoxStart(tempblock, datafile->filebytesize);
|
||||
stop = 0;
|
||||
mainbox.stop = 0;
|
||||
progressbox.stop = 0;
|
||||
while ((stop == 0) && (datafile->filebytepos < datafile->filebytesize))
|
||||
{
|
||||
switch (datafile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3Read(datafile, 0, tempblock);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Scanning for the next complete compressed block
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
#ifdef FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
PrintLog("CDVDiso rebuild: failed to decompress - data corrupt");
|
||||
|
||||
PrintLog("CDVDiso rebuild: failed to decompress - data corrupt");
|
||||
#endif /* FUNCTION_WARNING_TABLEREBUILD */
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
table.offset = datafile->filebytepos - retval;
|
||||
table.size = retval;
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1WriteTable(tablefile, table);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3WriteTable(tablefile, table);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Writing out the relavent table facts
|
||||
if (retval < 0) stop = 1;
|
||||
} // ENDIF- Do we have a valid record to write an entry for?
|
||||
ProgressBoxTick(datafile->filebytepos);
|
||||
// while(gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
stop = 1;
|
||||
if (mainbox.stop != 0) stop = 2;
|
||||
if (progressbox.stop != 0) stop = 2;
|
||||
} // ENDWHILE- Read in the data file and writing a table, 1 block at a time
|
||||
|
||||
} else {
|
||||
|
||||
table.offset = datafile->filebytepos - retval;
|
||||
|
||||
table.size = retval;
|
||||
|
||||
switch(tablefile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Writing out the relavent table facts
|
||||
|
||||
if(retval < 0) stop = 1;
|
||||
|
||||
} // ENDIF- Do we have a valid record to write an entry for?
|
||||
|
||||
|
||||
|
||||
ProgressBoxTick(datafile->filebytepos);
|
||||
|
||||
// while(gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
|
||||
|
||||
if(mainbox.stop != 0) stop = 2;
|
||||
|
||||
if(progressbox.stop != 0) stop = 2;
|
||||
|
||||
} // ENDWHILE- Read in the data file and writing a table, 1 block at a time
|
||||
|
||||
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
|
||||
|
||||
CompressClose(tablefile); // Guarentee the table is flushed and closed.
|
||||
|
||||
if(stop != 0) {
|
||||
|
||||
ActualFileDelete(tablefile->tablename);
|
||||
|
||||
} // ENDIF- Aborted or trouble? Delete the table file
|
||||
|
||||
tablefile = IsoFileClose(tablefile);
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
|
||||
|
||||
return;
|
||||
ProgressBoxStop();
|
||||
|
||||
CompressClose(tablefile); // Guarentee the table is flushed and closed.
|
||||
if (stop != 0)
|
||||
{
|
||||
ActualFileDelete(tablefile->tablename);
|
||||
} // ENDIF- Aborted or trouble? Delete the table file
|
||||
tablefile = IsoFileClose(tablefile);
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // END IsoTableRebuild()
|
||||
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
/* tablerebuild.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TABLEREBUILD_H
|
||||
#define TABLEREBUILD_H
|
||||
|
||||
|
||||
// #define FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
|
||||
extern void IsoTableRebuild(const char *filename);
|
||||
|
||||
|
||||
#endif /* TABLEREBUILD_H */
|
||||
/* tablerebuild.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TABLEREBUILD_H
|
||||
#define TABLEREBUILD_H
|
||||
|
||||
|
||||
// #define FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
|
||||
extern void IsoTableRebuild(const char *filename);
|
||||
|
||||
|
||||
#endif /* TABLEREBUILD_H */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Notes:
|
||||
Notes:
|
||||
* Since this is still beta things may change.
|
||||
|
||||
* OSflags:
|
||||
|
@ -23,23 +23,17 @@
|
|||
|
||||
* reserved keys:
|
||||
F1 to F10 are reserved for the emulator
|
||||
|
||||
* plugins should NOT change the current
|
||||
* plugins should NOT change the current
|
||||
working directory.
|
||||
(on win32, add flag OFN_NOCHANGEDIR for
|
||||
GetOpenFileName)
|
||||
|
||||
*/
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
#ifdef __LINUX__
|
||||
#define CALLBACK
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* common defines */
|
||||
#ifndef C_ASSERT
|
||||
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
|
||||
|
@ -71,42 +65,37 @@
|
|||
#define PS2E_FW_VERSION 0x0002
|
||||
#define PS2E_SIO_VERSION 0x0001
|
||||
#ifdef COMMONdefs
|
||||
|
||||
u32 CALLBACK PS2EgetLibType(void);
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type);
|
||||
char* CALLBACK PS2EgetLibName(void);
|
||||
|
||||
#endif
|
||||
|
||||
// key values:
|
||||
/* key values must be OS dependant:
|
||||
win32: the VK_XXX will be used (WinUser)
|
||||
linux: the XK_XXX will be used (XFree86)
|
||||
*/
|
||||
|
||||
// event values:
|
||||
#define KEYPRESS 1
|
||||
#define KEYRELEASE 2
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u32 key;
|
||||
u32 event;
|
||||
} keyEvent;
|
||||
|
||||
// for 64bit compilers
|
||||
typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
|
||||
|
||||
// plugin types
|
||||
#define SIO_TYPE_PAD 0x00000001
|
||||
#define SIO_TYPE_MTAP 0x00000004
|
||||
#define SIO_TYPE_RM 0x00000040
|
||||
#define SIO_TYPE_MC 0x00000100
|
||||
|
||||
typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
|
||||
|
||||
typedef struct {
|
||||
u8 ctrl:4; // control and mode bits
|
||||
u8 mode:4; // control and mode bits
|
||||
typedef struct
|
||||
{
|
||||
u8 ctrl:
|
||||
4; // control and mode bits
|
||||
u8 mode:
|
||||
4; // control and mode bits
|
||||
u8 trackNum; // current track number (1 to 99)
|
||||
u8 trackIndex; // current index within track (0 to 99)
|
||||
u8 trackM; // current minute location on the disc (BCD encoded)
|
||||
|
@ -117,17 +106,16 @@ typedef struct {
|
|||
u8 discS; // current sector offset from first track (BCD encoded)
|
||||
u8 discF; // current frame offset from first track (BCD encoded)
|
||||
} cdvdSubQ;
|
||||
|
||||
typedef struct { // NOT bcd coded
|
||||
typedef struct // NOT bcd coded
|
||||
{
|
||||
u32 lsn;
|
||||
u8 type;
|
||||
} cdvdTD;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u8 strack; //number of the first track (usually 1)
|
||||
u8 etrack; //number of the last track
|
||||
} cdvdTN;
|
||||
|
||||
// CDVDreadTrack mode values:
|
||||
#define CDVD_MODE_2352 0 // full 2352 bytes
|
||||
#define CDVD_MODE_2340 1 // skip sync (12) bytes
|
||||
|
@ -159,43 +147,36 @@ typedef struct {
|
|||
#define CDVD_AUDIO_TRACK 0x01
|
||||
#define CDVD_MODE1_TRACK 0x41
|
||||
#define CDVD_MODE2_TRACK 0x61
|
||||
|
||||
#define CDVD_AUDIO_MASK 0x00
|
||||
#define CDVD_DATA_MASK 0x40
|
||||
// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel)
|
||||
|
||||
typedef void (*DEV9callback)(int cycles);
|
||||
typedef int (*DEV9handler)(void);
|
||||
typedef int (*DEV9handler)(void);
|
||||
|
||||
typedef void (*USBcallback)(int cycles);
|
||||
typedef int (*USBhandler)(void);
|
||||
|
||||
typedef int (*USBhandler)(void);
|
||||
// freeze modes:
|
||||
#define FREEZE_LOAD 0
|
||||
#define FREEZE_SAVE 1
|
||||
#define FREEZE_SIZE 2
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char name[8];
|
||||
void *common;
|
||||
} GSdriverInfo;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef struct { // unsupported values must be set to zero
|
||||
typedef struct // unsupported values must be set to zero
|
||||
{
|
||||
HWND hWnd;
|
||||
HMENU hMenu;
|
||||
HWND hStatusWnd;
|
||||
} winInfo;
|
||||
#endif
|
||||
|
||||
/* GS plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef GSdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK GSinit();
|
||||
s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread);
|
||||
void CALLBACK GSclose();
|
||||
|
@ -207,9 +188,7 @@ void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
|
|||
void CALLBACK GSgifSoftReset(u32 mask);
|
||||
void CALLBACK GSreadFIFO(off64_t *mem);
|
||||
void CALLBACK GSreadFIFO2(off64_t *mem, int qwc);
|
||||
|
||||
// extended funcs
|
||||
|
||||
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev);
|
||||
void CALLBACK GSchangeSaveState(int, const char* filename);
|
||||
|
@ -219,10 +198,8 @@ void CALLBACK GSirqCallback(void (*callback)());
|
|||
void CALLBACK GSprintf(int timeout, char *fmt, ...);
|
||||
void CALLBACK GSsetBaseMem(void*);
|
||||
void CALLBACK GSsetGameCRC(int);
|
||||
|
||||
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
||||
void CALLBACK GSsetFrameSkip(int frameskip);
|
||||
|
||||
void CALLBACK GSreset();
|
||||
void CALLBACK GSwriteCSR(u32 value);
|
||||
void CALLBACK GSgetDriverInfo(GSdriverInfo *info);
|
||||
|
@ -233,17 +210,12 @@ s32 CALLBACK GSfreeze(int mode, freezeData *data);
|
|||
void CALLBACK GSconfigure();
|
||||
void CALLBACK GSabout();
|
||||
s32 CALLBACK GStest();
|
||||
|
||||
#endif
|
||||
|
||||
/* PAD plugin API -=[ OBSOLETE ]=- */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef PADdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK PADinit(u32 flags);
|
||||
s32 CALLBACK PADopen(void *pDsp);
|
||||
void CALLBACK PADclose();
|
||||
|
@ -263,17 +235,12 @@ void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
|
|||
void CALLBACK PADconfigure();
|
||||
void CALLBACK PADabout();
|
||||
s32 CALLBACK PADtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SIO plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SIOdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
s32 CALLBACK SIOopen(void *pDsp);
|
||||
void CALLBACK SIOclose();
|
||||
|
@ -282,23 +249,16 @@ u8 CALLBACK SIOstartPoll(u8 value);
|
|||
u8 CALLBACK SIOpoll(u8 value);
|
||||
// returns: SIO_TYPE_{PAD,MTAP,RM,MC}
|
||||
u32 CALLBACK SIOquery();
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK SIOconfigure();
|
||||
void CALLBACK SIOabout();
|
||||
s32 CALLBACK SIOtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SPU2 plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SPU2defs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SPU2init();
|
||||
s32 CALLBACK SPU2open(void *pDsp);
|
||||
void CALLBACK SPU2close();
|
||||
|
@ -312,32 +272,25 @@ void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
|
|||
void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2interruptDMA7();
|
||||
u32 CALLBACK SPU2ReadMemAddr(int core);
|
||||
void CALLBACK SPU2WriteMemAddr(int core,u32 value);
|
||||
void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
void CALLBACK SPU2WriteMemAddr(int core, u32 value);
|
||||
void CALLBACK SPU2irqCallback(void (*SPU2callback)(), void (*DMA4callback)(), void (*DMA7callback)());
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK SPU2async(u32 cycles);
|
||||
s32 CALLBACK SPU2freeze(int mode, freezeData *data);
|
||||
void CALLBACK SPU2configure();
|
||||
void CALLBACK SPU2about();
|
||||
s32 CALLBACK SPU2test();
|
||||
|
||||
#endif
|
||||
|
||||
/* CDVD plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef CDVDdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK CDVDinit();
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename);
|
||||
void CALLBACK CDVDclose();
|
||||
void CALLBACK CDVDshutdown();
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
u8* CALLBACK CDVDgetBuffer();
|
||||
|
||||
|
@ -349,9 +302,7 @@ s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
|
|||
s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
|
||||
s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
|
||||
s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK CDVDconfigure();
|
||||
void CALLBACK CDVDabout();
|
||||
s32 CALLBACK CDVDtest();
|
||||
|
@ -385,9 +336,7 @@ void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
|
|||
// if callback returns 1 the irq is triggered, else not
|
||||
void CALLBACK DEV9irqCallback(DEV9callback callback);
|
||||
DEV9handler CALLBACK DEV9irqHandler(void);
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK DEV9freeze(int mode, freezeData *data);
|
||||
void CALLBACK DEV9configure();
|
||||
void CALLBACK DEV9about();
|
||||
|
@ -425,16 +374,12 @@ s32 CALLBACK USBfreeze(int mode, freezeData *data);
|
|||
void CALLBACK USBconfigure();
|
||||
void CALLBACK USBabout();
|
||||
s32 CALLBACK USBtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* FW plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef FWdefs
|
||||
// basic funcs
|
||||
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
s32 CALLBACK FWinit();
|
||||
|
@ -444,27 +389,22 @@ void CALLBACK FWshutdown();
|
|||
u32 CALLBACK FWread32(u32 addr);
|
||||
void CALLBACK FWwrite32(u32 addr, u32 value);
|
||||
void CALLBACK FWirqCallback(void (*callback)());
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK FWfreeze(int mode, freezeData *data);
|
||||
void CALLBACK FWconfigure();
|
||||
void CALLBACK FWabout();
|
||||
s32 CALLBACK FWtest();
|
||||
#endif
|
||||
|
||||
// might be useful for emulators
|
||||
#ifdef PLUGINtypedefs
|
||||
|
||||
typedef u32 (CALLBACK* _PS2EgetLibType)(void);
|
||||
typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
|
||||
typedef u32(CALLBACK* _PS2EgetLibType)(void);
|
||||
typedef u32(CALLBACK* _PS2EgetLibVersion2)(u32 type);
|
||||
typedef char*(CALLBACK* _PS2EgetLibName)(void);
|
||||
|
||||
// GS
|
||||
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _GSinit)();
|
||||
typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
|
||||
typedef s32(CALLBACK* _GSinit)();
|
||||
typedef s32(CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
|
||||
typedef void (CALLBACK* _GSclose)();
|
||||
typedef void (CALLBACK* _GSshutdown)();
|
||||
typedef void (CALLBACK* _GSvsync)(int field);
|
||||
|
@ -474,7 +414,6 @@ typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
|
|||
typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
|
||||
typedef void (CALLBACK* _GSreadFIFO)(off64_t *pMem);
|
||||
typedef void (CALLBACK* _GSreadFIFO2)(off64_t *pMem, int qwc);
|
||||
|
||||
typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev);
|
||||
typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
|
||||
typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
|
||||
|
@ -486,147 +425,139 @@ typedef void (CALLBACK* _GSreset)();
|
|||
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
|
||||
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
|
||||
#ifdef _WIN32
|
||||
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
|
||||
typedef s32(CALLBACK* _GSsetWindowInfo)(winInfo *info);
|
||||
#endif
|
||||
typedef void (CALLBACK* _GSmakeSnapshot)(char *path);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int);
|
||||
typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data);
|
||||
typedef s32(CALLBACK* _GSfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _GSconfigure)();
|
||||
typedef s32 (CALLBACK* _GStest)();
|
||||
typedef s32(CALLBACK* _GStest)();
|
||||
typedef void (CALLBACK* _GSabout)();
|
||||
|
||||
// PAD
|
||||
typedef s32 (CALLBACK* _PADinit)(u32 flags);
|
||||
typedef s32 (CALLBACK* _PADopen)(void *pDsp);
|
||||
typedef s32(CALLBACK* _PADinit)(u32 flags);
|
||||
typedef s32(CALLBACK* _PADopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _PADclose)();
|
||||
typedef void (CALLBACK* _PADshutdown)();
|
||||
typedef keyEvent* (CALLBACK* _PADkeyEvent)();
|
||||
typedef u8 (CALLBACK* _PADstartPoll)(int pad);
|
||||
typedef u8 (CALLBACK* _PADpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _PADquery)();
|
||||
|
||||
typedef keyEvent*(CALLBACK* _PADkeyEvent)();
|
||||
typedef u8(CALLBACK* _PADstartPoll)(int pad);
|
||||
typedef u8(CALLBACK* _PADpoll)(u8 value);
|
||||
typedef u32(CALLBACK* _PADquery)();
|
||||
typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
|
||||
typedef void (CALLBACK* _PADconfigure)();
|
||||
typedef s32 (CALLBACK* _PADtest)();
|
||||
typedef s32(CALLBACK* _PADtest)();
|
||||
typedef void (CALLBACK* _PADabout)();
|
||||
|
||||
// SIO
|
||||
typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
typedef s32 (CALLBACK* _SIOopen)(void *pDsp);
|
||||
typedef s32(CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
typedef s32(CALLBACK* _SIOopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _SIOclose)();
|
||||
typedef void (CALLBACK* _SIOshutdown)();
|
||||
typedef u8 (CALLBACK* _SIOstartPoll)(u8 value);
|
||||
typedef u8 (CALLBACK* _SIOpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _SIOquery)();
|
||||
typedef u8(CALLBACK* _SIOstartPoll)(u8 value);
|
||||
typedef u8(CALLBACK* _SIOpoll)(u8 value);
|
||||
typedef u32(CALLBACK* _SIOquery)();
|
||||
|
||||
typedef void (CALLBACK* _SIOconfigure)();
|
||||
typedef s32 (CALLBACK* _SIOtest)();
|
||||
typedef s32(CALLBACK* _SIOtest)();
|
||||
typedef void (CALLBACK* _SIOabout)();
|
||||
|
||||
// SPU2
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _SPU2init)();
|
||||
typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
|
||||
typedef s32(CALLBACK* _SPU2init)();
|
||||
typedef s32(CALLBACK* _SPU2open)(void *pDsp);
|
||||
typedef void (CALLBACK* _SPU2close)();
|
||||
typedef void (CALLBACK* _SPU2shutdown)();
|
||||
typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
|
||||
typedef u16 (CALLBACK* _SPU2read)(u32 mem);
|
||||
typedef u16(CALLBACK* _SPU2read)(u32 mem);
|
||||
typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA4)();
|
||||
typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA7)();
|
||||
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
|
||||
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
|
||||
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(), void (*DMA4callback)(), void (*DMA7callback)());
|
||||
typedef u32(CALLBACK* _SPU2ReadMemAddr)(int core);
|
||||
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core, u32 value);
|
||||
typedef void (CALLBACK* _SPU2async)(u32 cycles);
|
||||
typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data);
|
||||
typedef s32(CALLBACK* _SPU2freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _SPU2configure)();
|
||||
typedef s32 (CALLBACK* _SPU2test)();
|
||||
typedef s32(CALLBACK* _SPU2test)();
|
||||
typedef void (CALLBACK* _SPU2about)();
|
||||
|
||||
// CDVD
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _CDVDinit)();
|
||||
typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
|
||||
typedef s32(CALLBACK* _CDVDinit)();
|
||||
typedef s32(CALLBACK* _CDVDopen)(const char* pTitleFilename);
|
||||
typedef void (CALLBACK* _CDVDclose)();
|
||||
typedef void (CALLBACK* _CDVDshutdown)();
|
||||
typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
|
||||
typedef u8* (CALLBACK* _CDVDgetBuffer)();
|
||||
typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
|
||||
typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
|
||||
typedef s32 (CALLBACK* _CDVDgetDiskType)();
|
||||
typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
||||
typedef s32(CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
|
||||
typedef u8*(CALLBACK* _CDVDgetBuffer)();
|
||||
typedef s32(CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
|
||||
typedef s32(CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
|
||||
typedef s32(CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
|
||||
typedef s32(CALLBACK* _CDVDgetTOC)(void* toc);
|
||||
typedef s32(CALLBACK* _CDVDgetDiskType)();
|
||||
typedef s32(CALLBACK* _CDVDgetTrayStatus)();
|
||||
typedef s32(CALLBACK* _CDVDctrlTrayOpen)();
|
||||
typedef s32(CALLBACK* _CDVDctrlTrayClose)();
|
||||
|
||||
typedef void (CALLBACK* _CDVDconfigure)();
|
||||
typedef s32 (CALLBACK* _CDVDtest)();
|
||||
typedef s32(CALLBACK* _CDVDtest)();
|
||||
typedef void (CALLBACK* _CDVDabout)();
|
||||
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
||||
|
||||
// DEV9
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _DEV9init)();
|
||||
typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
|
||||
typedef s32(CALLBACK* _DEV9init)();
|
||||
typedef s32(CALLBACK* _DEV9open)(void *pDsp);
|
||||
typedef void (CALLBACK* _DEV9close)();
|
||||
typedef void (CALLBACK* _DEV9shutdown)();
|
||||
typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
|
||||
typedef u8(CALLBACK* _DEV9read8)(u32 mem);
|
||||
typedef u16(CALLBACK* _DEV9read16)(u32 mem);
|
||||
typedef u32(CALLBACK* _DEV9read32)(u32 mem);
|
||||
typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
|
||||
typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
|
||||
|
||||
typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data);
|
||||
typedef DEV9handler(CALLBACK* _DEV9irqHandler)(void);
|
||||
typedef s32(CALLBACK* _DEV9freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _DEV9configure)();
|
||||
typedef s32 (CALLBACK* _DEV9test)();
|
||||
typedef s32(CALLBACK* _DEV9test)();
|
||||
typedef void (CALLBACK* _DEV9about)();
|
||||
|
||||
// USB
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _USBinit)();
|
||||
typedef s32 (CALLBACK* _USBopen)(void *pDsp);
|
||||
typedef s32(CALLBACK* _USBinit)();
|
||||
typedef s32(CALLBACK* _USBopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _USBclose)();
|
||||
typedef void (CALLBACK* _USBshutdown)();
|
||||
typedef u8 (CALLBACK* _USBread8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _USBread16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _USBread32)(u32 mem);
|
||||
typedef u8(CALLBACK* _USBread8)(u32 mem);
|
||||
typedef u16(CALLBACK* _USBread16)(u32 mem);
|
||||
typedef u32(CALLBACK* _USBread32)(u32 mem);
|
||||
typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
|
||||
typedef USBhandler (CALLBACK* _USBirqHandler)(void);
|
||||
typedef USBhandler(CALLBACK* _USBirqHandler)(void);
|
||||
typedef void (CALLBACK* _USBsetRAM)(void *mem);
|
||||
|
||||
typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data);
|
||||
typedef s32(CALLBACK* _USBfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _USBconfigure)();
|
||||
typedef s32 (CALLBACK* _USBtest)();
|
||||
typedef s32(CALLBACK* _USBtest)();
|
||||
typedef void (CALLBACK* _USBabout)();
|
||||
|
||||
//FW
|
||||
typedef s32 (CALLBACK* _FWinit)();
|
||||
typedef s32 (CALLBACK* _FWopen)(void *pDsp);
|
||||
typedef s32(CALLBACK* _FWinit)();
|
||||
typedef s32(CALLBACK* _FWopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _FWclose)();
|
||||
typedef void (CALLBACK* _FWshutdown)();
|
||||
typedef u32 (CALLBACK* _FWread32)(u32 mem);
|
||||
typedef u32(CALLBACK* _FWread32)(u32 mem);
|
||||
typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
|
||||
|
||||
typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data);
|
||||
typedef s32(CALLBACK* _FWfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _FWconfigure)();
|
||||
typedef s32 (CALLBACK* _FWtest)();
|
||||
typedef s32(CALLBACK* _FWtest)();
|
||||
typedef void (CALLBACK* _FWabout)();
|
||||
|
||||
#endif
|
||||
|
@ -645,7 +576,6 @@ _GSgifTransfer3 GSgifTransfer3;
|
|||
_GSgifSoftReset GSgifSoftReset;
|
||||
_GSreadFIFO GSreadFIFO;
|
||||
_GSreadFIFO2 GSreadFIFO2;
|
||||
|
||||
_GSkeyEvent GSkeyEvent;
|
||||
_GSchangeSaveState GSchangeSaveState;
|
||||
_GSmakeSnapshot GSmakeSnapshot;
|
||||
|
@ -665,7 +595,6 @@ _GSfreeze GSfreeze;
|
|||
_GSconfigure GSconfigure;
|
||||
_GStest GStest;
|
||||
_GSabout GSabout;
|
||||
|
||||
// PAD1
|
||||
_PADinit PAD1init;
|
||||
_PADopen PAD1open;
|
||||
|
@ -675,12 +604,10 @@ _PADkeyEvent PAD1keyEvent;
|
|||
_PADstartPoll PAD1startPoll;
|
||||
_PADpoll PAD1poll;
|
||||
_PADquery PAD1query;
|
||||
|
||||
_PADgsDriverInfo PAD1gsDriverInfo;
|
||||
_PADconfigure PAD1configure;
|
||||
_PADtest PAD1test;
|
||||
_PADabout PAD1about;
|
||||
|
||||
// PAD2
|
||||
_PADinit PAD2init;
|
||||
_PADopen PAD2open;
|
||||
|
@ -690,12 +617,10 @@ _PADkeyEvent PAD2keyEvent;
|
|||
_PADstartPoll PAD2startPoll;
|
||||
_PADpoll PAD2poll;
|
||||
_PADquery PAD2query;
|
||||
|
||||
_PADgsDriverInfo PAD2gsDriverInfo;
|
||||
_PADconfigure PAD2configure;
|
||||
_PADtest PAD2test;
|
||||
_PADabout PAD2about;
|
||||
|
||||
// SIO[2]
|
||||
_SIOinit SIOinit[2][9];
|
||||
_SIOopen SIOopen[2][9];
|
||||
|
@ -725,13 +650,11 @@ _SPU2interruptDMA7 SPU2interruptDMA7;
|
|||
_SPU2ReadMemAddr SPU2ReadMemAddr;
|
||||
_SPU2WriteMemAddr SPU2WriteMemAddr;
|
||||
_SPU2irqCallback SPU2irqCallback;
|
||||
|
||||
_SPU2async SPU2async;
|
||||
_SPU2freeze SPU2freeze;
|
||||
_SPU2configure SPU2configure;
|
||||
_SPU2test SPU2test;
|
||||
_SPU2about SPU2about;
|
||||
|
||||
// CDVD
|
||||
_CDVDinit CDVDinit;
|
||||
_CDVDopen CDVDopen;
|
||||
|
@ -747,12 +670,10 @@ _CDVDgetDiskType CDVDgetDiskType;
|
|||
_CDVDgetTrayStatus CDVDgetTrayStatus;
|
||||
_CDVDctrlTrayOpen CDVDctrlTrayOpen;
|
||||
_CDVDctrlTrayClose CDVDctrlTrayClose;
|
||||
|
||||
_CDVDconfigure CDVDconfigure;
|
||||
_CDVDtest CDVDtest;
|
||||
_CDVDabout CDVDabout;
|
||||
_CDVDnewDiskCB CDVDnewDiskCB;
|
||||
|
||||
// DEV9
|
||||
_DEV9init DEV9init;
|
||||
_DEV9open DEV9open;
|
||||
|
@ -768,12 +689,10 @@ _DEV9readDMA8Mem DEV9readDMA8Mem;
|
|||
_DEV9writeDMA8Mem DEV9writeDMA8Mem;
|
||||
_DEV9irqCallback DEV9irqCallback;
|
||||
_DEV9irqHandler DEV9irqHandler;
|
||||
|
||||
_DEV9configure DEV9configure;
|
||||
_DEV9freeze DEV9freeze;
|
||||
_DEV9test DEV9test;
|
||||
_DEV9about DEV9about;
|
||||
|
||||
// USB
|
||||
_USBinit USBinit;
|
||||
_USBopen USBopen;
|
||||
|
@ -793,7 +712,6 @@ _USBconfigure USBconfigure;
|
|||
_USBfreeze USBfreeze;
|
||||
_USBtest USBtest;
|
||||
_USBabout USBabout;
|
||||
|
||||
// FW
|
||||
_FWinit FWinit;
|
||||
_FWopen FWopen;
|
||||
|
@ -802,11 +720,9 @@ _FWshutdown FWshutdown;
|
|||
_FWread32 FWread32;
|
||||
_FWwrite32 FWwrite32;
|
||||
_FWirqCallback FWirqCallback;
|
||||
|
||||
_FWconfigure FWconfigure;
|
||||
_FWfreeze FWfreeze;
|
||||
_FWtest FWtest;
|
||||
_FWabout FWabout;
|
||||
#endif
|
||||
|
||||
#endif /* __PS2EDEFS_H__ */
|
||||
|
|
|
@ -11,65 +11,52 @@
|
|||
|
||||
// Basic types
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
typedef __int8 s8;
|
||||
typedef __int16 s16;
|
||||
typedef __int32 s32;
|
||||
typedef __int64 s64;
|
||||
|
||||
typedef unsigned __int8 u8;
|
||||
typedef unsigned __int16 u16;
|
||||
typedef unsigned __int32 u32;
|
||||
typedef unsigned __int64 u64;
|
||||
|
||||
#if defined(__x86_64__)
|
||||
typedef u64 uptr;
|
||||
#else
|
||||
typedef u32 uptr;
|
||||
#endif
|
||||
|
||||
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
|
||||
|
||||
#else
|
||||
|
||||
typedef char s8;
|
||||
typedef short s16;
|
||||
typedef int s32;
|
||||
typedef long long s64;
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#if defined(__x86_64__)
|
||||
typedef u64 uptr;
|
||||
#else
|
||||
typedef u32 uptr;
|
||||
#endif
|
||||
|
||||
#ifdef __LINUX__
|
||||
typedef union _LARGE_INTEGER
|
||||
{
|
||||
long long QuadPart;
|
||||
} LARGE_INTEGER;
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
|
||||
#else
|
||||
#define PCSX2_ALIGNED16(x) x __attribute((aligned(16)))
|
||||
#endif
|
||||
|
||||
#ifndef __forceinline
|
||||
#define __forceinline inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int size;
|
||||
s8 *data;
|
||||
} freezeData;
|
||||
|
||||
#endif /* __PS2ETYPES_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,88 +1,44 @@
|
|||
/* CD.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CD_H
|
||||
|
||||
#define CD_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // DWORD
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern DWORD cdblocksize;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitCDInfo();
|
||||
|
||||
extern s32 CDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 CDgetBufferOffset();
|
||||
|
||||
extern s32 CDreadSubQ();
|
||||
|
||||
extern s32 CDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 CDgetDiskType();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CD_H */
|
||||
|
||||
/* CD.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CD_H
|
||||
#define CD_H
|
||||
|
||||
|
||||
#include <windows.h> // DWORD
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
extern DWORD cdblocksize;
|
||||
|
||||
|
||||
extern void InitCDInfo();
|
||||
extern s32 CDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
extern s32 CDgetBufferOffset();
|
||||
extern s32 CDreadSubQ();
|
||||
extern s32 CDgetTN(cdvdTN *cdvdtn);
|
||||
extern s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
extern s32 CDgetDiskType();
|
||||
|
||||
|
||||
#endif /* CD_H */
|
||||
|
|
|
@ -17,11 +17,8 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h> // BOOL, CALLBACK, APIENTRY
|
||||
#include <windef.h> // NULL
|
||||
|
||||
#define CDVDdefs
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
@ -37,534 +34,508 @@
|
|||
#include "conversionbox.h" // Initialize conversionboxwindow
|
||||
#include "devicebox.h" // Initialize deviceboxwindow
|
||||
#include "CDVDiso.h"
|
||||
|
||||
|
||||
struct IsoFile *isofile;
|
||||
char isobuffer[2448];
|
||||
char isocdcheck[2048];
|
||||
int isomode;
|
||||
int deviceopencount;
|
||||
|
||||
HINSTANCE progmodule;
|
||||
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule,
|
||||
DWORD param,
|
||||
LPVOID reserved) {
|
||||
|
||||
|
||||
switch(param) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
progmodule = hModule;
|
||||
// mainboxwindow = NULL;
|
||||
// progressboxwindow = NULL;
|
||||
// conversionboxwindow = NULL;
|
||||
// deviceboxwindow = NULL;
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
// CDVDshutdown();
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- What does the OS want with us?
|
||||
|
||||
return(FALSE); // Wasn't on list? Wasn't handled.
|
||||
LPVOID reserved)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
progmodule = hModule;
|
||||
// mainboxwindow = NULL;
|
||||
// progressboxwindow = NULL;
|
||||
// conversionboxwindow = NULL;
|
||||
// deviceboxwindow = NULL;
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
// CDVDshutdown();
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
return(TRUE);
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- What does the OS want with us?
|
||||
return(FALSE); // Wasn't on list? Wasn't handled.
|
||||
} // END DllMain()
|
||||
|
||||
|
||||
char* CALLBACK PS2EgetLibName() {
|
||||
return(libname);
|
||||
char* CALLBACK PS2EgetLibName()
|
||||
{
|
||||
return(libname);
|
||||
} // END PS2EgetLibName()
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibType() {
|
||||
return(PS2E_LT_CDVD);
|
||||
u32 CALLBACK PS2EgetLibType()
|
||||
{
|
||||
return(PS2E_LT_CDVD);
|
||||
} // END PS2getLibType()
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
|
||||
return((version << 16) | (revision << 8) | build);
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type)
|
||||
{
|
||||
return((version << 16) | (revision << 8) | build);
|
||||
} // END PS2EgetLibVersion2()
|
||||
|
||||
s32 CALLBACK CDVDinit()
|
||||
{
|
||||
int i;
|
||||
InitLog();
|
||||
if (OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
s32 CALLBACK CDVDinit() {
|
||||
int i;
|
||||
|
||||
InitLog();
|
||||
if(OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf();
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
deviceopencount = 0;
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
mainboxwindow = NULL;
|
||||
progressboxwindow = NULL;
|
||||
conversionboxwindow = NULL;
|
||||
deviceboxwindow = NULL;
|
||||
|
||||
InitConf();
|
||||
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
deviceopencount = 0;
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
|
||||
mainboxwindow = NULL;
|
||||
progressboxwindow = NULL;
|
||||
conversionboxwindow = NULL;
|
||||
deviceboxwindow = NULL;
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
} // END CDVDinit()
|
||||
|
||||
|
||||
void CALLBACK CDVDshutdown() {
|
||||
void CALLBACK CDVDshutdown()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
isofile = IsoFileClose(isofile);
|
||||
|
||||
// Close Windows as well? (Just in case)
|
||||
|
||||
CloseLog();
|
||||
isofile = IsoFileClose(isofile);
|
||||
// Close Windows as well? (Just in case)
|
||||
CloseLog();
|
||||
} // END CDVDshutdown()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename) {
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename)
|
||||
{
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
|
||||
if( pTitleFilename != NULL ) strcpy(conf.isoname, pTitleFilename);
|
||||
|
||||
if((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.startconfigure == 1) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0))) {
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if(isofile == NULL) {
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
if (pTitleFilename != NULL) strcpy(conf.isoname, pTitleFilename);
|
||||
if ((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.startconfigure == 1) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0)))
|
||||
{
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if(retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if(retval != 0) return(-1);
|
||||
|
||||
if(deviceopencount > 0) {
|
||||
i = 0;
|
||||
while((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if(i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
|
||||
return(0);
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDopen()
|
||||
|
||||
|
||||
void CALLBACK CDVDclose() {
|
||||
void CALLBACK CDVDclose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) {
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while ((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn))
|
||||
{
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Loop through tracks searching for lsn track
|
||||
i--;
|
||||
subq->ctrl = 4;
|
||||
subq->mode = 1;
|
||||
subq->trackNum = HEXTOBCD(i);
|
||||
subq->trackIndex = HEXTOBCD(i);
|
||||
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn)) {
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Loop through tracks searching for lsn track
|
||||
i--;
|
||||
LBAtoMSF(lsn - tracklsn, temptime);
|
||||
subq->trackM = HEXTOBCD(temptime[0]);
|
||||
subq->trackS = HEXTOBCD(temptime[1]);
|
||||
subq->trackF = HEXTOBCD(temptime[2]);
|
||||
|
||||
subq->ctrl = 4;
|
||||
subq->mode = 1;
|
||||
subq->trackNum = HEXTOBCD(i);
|
||||
subq->trackIndex = HEXTOBCD(i);
|
||||
|
||||
LBAtoMSF(lsn - tracklsn, temptime);
|
||||
subq->trackM = HEXTOBCD(temptime[0]);
|
||||
subq->trackS = HEXTOBCD(temptime[1]);
|
||||
subq->trackF = HEXTOBCD(temptime[2]);
|
||||
|
||||
subq->pad = 0;
|
||||
|
||||
// lba_to_msf(lsn + (2*75), &min, &sec, &frm);
|
||||
LBAtoMSF(lsn, temptime);
|
||||
subq->discM = HEXTOBCD(temptime[0]);
|
||||
subq->discS = HEXTOBCD(temptime[1]);
|
||||
subq->discF = HEXTOBCD(temptime[2]);
|
||||
subq->pad = 0;
|
||||
|
||||
return(0);
|
||||
// lba_to_msf(lsn + (2*75), &min, &sec, &frm);
|
||||
LBAtoMSF(lsn, temptime);
|
||||
subq->discM = HEXTOBCD(temptime[0]);
|
||||
subq->discS = HEXTOBCD(temptime[1]);
|
||||
subq->discF = HEXTOBCD(temptime[2]);
|
||||
return(0);
|
||||
} // END CDVDreadSubQ()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) {
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer)
|
||||
{
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTN()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
} else {
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
|
||||
return(0);
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTN()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer) {
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer)
|
||||
{
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
actualtrack = track;
|
||||
if(actualtrack == 0xaa) actualtrack = 0;
|
||||
|
||||
if((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV)) {
|
||||
if (actualtrack <= 1) {
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
} else {
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} else {
|
||||
if (actualtrack == 0) {
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} else {
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
|
||||
return(0);
|
||||
actualtrack = track;
|
||||
if (actualtrack == 0xaa) actualtrack = 0;
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
if (actualtrack <= 1)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actualtrack == 0)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTD()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc) {
|
||||
int i;
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc)
|
||||
{
|
||||
int i;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
for(i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
for (i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) {
|
||||
int retval;
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if(retval != 0) {
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if(retval != 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
|
||||
isomode = mode;
|
||||
return(0);
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
isomode = mode;
|
||||
return(0);
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer() {
|
||||
int offset;
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer()
|
||||
{
|
||||
int offset;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(NULL);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(NULL);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
offset = 0;
|
||||
switch(isomode) {
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
|
||||
if(offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
|
||||
return(isobuffer + offset);
|
||||
if (isofile == NULL) return(NULL);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(NULL);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
offset = 0;
|
||||
switch (isomode)
|
||||
{
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
if (offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
return(isobuffer + offset);
|
||||
} // END CDVDgetBuffer()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetDiskType() {
|
||||
s32 CALLBACK CDVDgetDiskType()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
// PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
// PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if(deviceopencount > 0) {
|
||||
deviceopencount--;
|
||||
if(deviceopencount > 0) return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
if (isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
return(isofile->cdvdtype);
|
||||
return(isofile->cdvdtype);
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTrayStatus() {
|
||||
s32 CALLBACK CDVDgetTrayStatus()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
// PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
// PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if(isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if(deviceopencount > 30) {
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
if (isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if (deviceopencount > 30)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
} // END CDVDgetTrayStatus()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayOpen() {
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
s32 CALLBACK CDVDctrlTrayOpen()
|
||||
{
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// CDVDclose();
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
|
||||
// CDVDopen();
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
if((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0))) {
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
deviceopencount = 0; // Temp line!
|
||||
// NOTE: What happened to repetitive polling when disc not in drive?
|
||||
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if(isofile == NULL) {
|
||||
// CDVDclose();
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
// CDVDopen();
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
if ((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0)))
|
||||
{
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
deviceopencount = 0; // Temp line!
|
||||
// NOTE: What happened to repetitive polling when disc not in drive?
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if(retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if(retval != 0) return(-1);
|
||||
|
||||
if(deviceopencount > 0) {
|
||||
i = 0;
|
||||
while((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if(i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
|
||||
for(i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
|
||||
return(0);
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose() {
|
||||
s32 CALLBACK CDVDctrlTrayClose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(0);
|
||||
return(0);
|
||||
} // END CDVDctrlTrayClose()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDtest() {
|
||||
s32 CALLBACK CDVDtest()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// InitConf(); // Shouldn't need this. Doesn't CDVDInit() get called first?
|
||||
LoadConf();
|
||||
// InitConf(); // Shouldn't need this. Doesn't CDVDInit() get called first?
|
||||
LoadConf();
|
||||
|
||||
if(conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if(IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
if (conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if (IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
} // END CDVDtest()
|
||||
|
||||
|
||||
void CALLBACK CDVDconfigure() {
|
||||
HWND lastwindow;
|
||||
|
||||
lastwindow = GetActiveWindow();
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
lastwindow = NULL;
|
||||
return;
|
||||
void CALLBACK CDVDconfigure()
|
||||
{
|
||||
HWND lastwindow;
|
||||
lastwindow = GetActiveWindow();
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
lastwindow = NULL;
|
||||
return;
|
||||
} // END CDVDconfigure()
|
||||
|
||||
|
||||
BOOL CALLBACK AboutCallback(HWND window, UINT msg, WPARAM param, LPARAM param2) {
|
||||
switch(msg) {
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(param)) {
|
||||
case IDC_0104: // "Ok" Button
|
||||
EndDialog(window, FALSE);
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- Which Windows Message Command?
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog(window, FALSE);
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
|
||||
return(FALSE); // Not a recognisable message. Pass it back to the OS.
|
||||
BOOL CALLBACK AboutCallback(HWND window, UINT msg, WPARAM param, LPARAM param2)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(param))
|
||||
{
|
||||
case IDC_0104: // "Ok" Button
|
||||
EndDialog(window, FALSE);
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- Which Windows Message Command?
|
||||
case WM_CLOSE:
|
||||
EndDialog(window, FALSE);
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
return(FALSE); // Not a recognisable message. Pass it back to the OS.
|
||||
} // END AboutCallback()
|
||||
|
||||
void CALLBACK CDVDabout() {
|
||||
HWND lastwindow;
|
||||
|
||||
lastwindow = GetActiveWindow();
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0100),
|
||||
lastwindow,
|
||||
(DLGPROC)AboutCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
return;
|
||||
void CALLBACK CDVDabout()
|
||||
{
|
||||
HWND lastwindow;
|
||||
lastwindow = GetActiveWindow();
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0100),
|
||||
lastwindow,
|
||||
(DLGPROC)AboutCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
return;
|
||||
} // END CDVDabout()
|
||||
|
|
|
@ -1,72 +1,31 @@
|
|||
/* CDVDiso.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CDVDISO_H
|
||||
|
||||
#define CDVDISO_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HINSTANCE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HINSTANCE progmodule;
|
||||
|
||||
extern char isobuffer[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CDVDISO_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,74 +1,33 @@
|
|||
/* DVD.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef DVD_H
|
||||
|
||||
#define DVD_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitDVDInfo();
|
||||
|
||||
extern s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DVDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DVDgetDiskType();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* DVD_H */
|
||||
|
||||
|
|
|
@ -1,506 +1,233 @@
|
|||
/* actualfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int IsActualFile(const char *filename) {
|
||||
|
||||
DWORD retval;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
int IsActualFile(const char *filename)
|
||||
{
|
||||
DWORD retval;
|
||||
if (filename == NULL) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = GetFileAttributes(filename);
|
||||
|
||||
if(retval == INVALID_FILE_ATTRIBUTES) return(-1); // Name doesn't exist.
|
||||
|
||||
if((retval & FILE_ATTRIBUTE_DIRECTORY) != 0) return(-2);
|
||||
|
||||
|
||||
|
||||
return(0); // Yep, that's a file.
|
||||
|
||||
retval = GetFileAttributes(filename);
|
||||
if (retval == INVALID_FILE_ATTRIBUTES) return(-1); // Name doesn't exist.
|
||||
if ((retval & FILE_ATTRIBUTE_DIRECTORY) != 0) return(-2);
|
||||
return(0); // Yep, that's a file.
|
||||
} // END IsActualFile()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileDelete(const char *filename) {
|
||||
|
||||
void ActualFileDelete(const char *filename)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
DeleteFile(filename);
|
||||
|
||||
DeleteFile(filename);
|
||||
} // END ActualFileDelete()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname) {
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s->%s)", origname, newname);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s->%s)", origname, newname);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
MoveFile(origname, newname);
|
||||
|
||||
return;
|
||||
|
||||
MoveFile(origname, newname);
|
||||
return;
|
||||
} // END ActualFileRename()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename) {
|
||||
|
||||
HANDLE newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(NULL);
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename)
|
||||
{
|
||||
HANDLE newhandle;
|
||||
if (filename == NULL) return(NULL);
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
|
||||
GENERIC_READ,
|
||||
|
||||
FILE_SHARE_READ,
|
||||
|
||||
NULL,
|
||||
|
||||
OPEN_EXISTING,
|
||||
|
||||
FILE_FLAG_RANDOM_ACCESS,
|
||||
|
||||
NULL);
|
||||
|
||||
if(newhandle == INVALID_HANDLE_VALUE) {
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS,
|
||||
NULL);
|
||||
if (newhandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(NULL);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
return(NULL);
|
||||
} // ENDIF- Error? Abort
|
||||
return(newhandle);
|
||||
} // END ActualFileOpenForRead()
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle)
|
||||
{
|
||||
int retval;
|
||||
BY_HANDLE_FILE_INFORMATION info;
|
||||
off64_t retsize;
|
||||
|
||||
|
||||
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle) {
|
||||
|
||||
int retval;
|
||||
|
||||
BY_HANDLE_FILE_INFORMATION info;
|
||||
|
||||
off64_t retsize;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
|
||||
|
||||
if (handle == NULL) return(-1);
|
||||
if (handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSize()");
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSize()");
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
retval = GetFileInformationByHandle(handle, &info);
|
||||
if (retval == 0) return(-1); // Handle doesn't exist...
|
||||
|
||||
|
||||
|
||||
retval = GetFileInformationByHandle(handle, &info);
|
||||
|
||||
if(retval == 0) return(-1); // Handle doesn't exist...
|
||||
|
||||
|
||||
|
||||
retsize = info.nFileSizeHigh;
|
||||
|
||||
retsize *= 0x10000;
|
||||
|
||||
retsize *= 0x10000;
|
||||
|
||||
retsize += info.nFileSizeLow;
|
||||
|
||||
return(retsize);
|
||||
|
||||
retsize = info.nFileSizeHigh;
|
||||
retsize *= 0x10000;
|
||||
retsize *= 0x10000;
|
||||
retsize += info.nFileSizeLow;
|
||||
return(retsize);
|
||||
} // END ActualFileSize()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position) {
|
||||
|
||||
// int retval;
|
||||
|
||||
LARGE_INTEGER realpos;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(position < 0) return(-1);
|
||||
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position)
|
||||
{
|
||||
// int retval;
|
||||
LARGE_INTEGER realpos;
|
||||
DWORD errcode;
|
||||
if (handle == NULL) return(-1);
|
||||
if (handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
if (position < 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%llu)", position);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%llu)", position);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
realpos.QuadPart = position;
|
||||
|
||||
realpos.QuadPart = position;
|
||||
////// WinXP code for seek
|
||||
|
||||
// retval = SetFilePointerEx(handle,
|
||||
|
||||
// realpos,
|
||||
|
||||
// NULL,
|
||||
|
||||
// FILE_BEGIN);
|
||||
|
||||
// if(retval == 0) {
|
||||
|
||||
|
||||
|
||||
////// Win98 code for seek
|
||||
|
||||
realpos.LowPart = SetFilePointer(handle,
|
||||
|
||||
realpos.LowPart,
|
||||
|
||||
&realpos.HighPart,
|
||||
|
||||
FILE_BEGIN);
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
if((realpos.LowPart == 0xFFFFFFFF) && (errcode != NO_ERROR)) {
|
||||
|
||||
|
||||
|
||||
realpos.LowPart = SetFilePointer(handle,
|
||||
realpos.LowPart,
|
||||
&realpos.HighPart,
|
||||
FILE_BEGIN);
|
||||
errcode = GetLastError();
|
||||
if ((realpos.LowPart == 0xFFFFFFFF) && (errcode != NO_ERROR))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error on seek (%llu)", position);
|
||||
|
||||
PrintError("CDVDiso file", errcode);
|
||||
|
||||
PrintLog("CDVDiso file: Error on seek (%llu)", position);
|
||||
PrintError("CDVDiso file", errcode);
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
return(0);
|
||||
} // END ActualFileSeek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
DWORD bytesread;
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer)
|
||||
{
|
||||
int retval;
|
||||
DWORD bytesread;
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
DWORD errcode;
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
if (handle == NULL) return(-1);
|
||||
if (handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
if (bytes < 1) return(-1);
|
||||
if (buffer == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = ReadFile(handle, buffer, bytes, &bytesread, NULL);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
retval = ReadFile(handle, buffer, bytes, &bytesread, NULL);
|
||||
if (retval == 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
PrintLog("CDVDiso file: Error reading from file");
|
||||
|
||||
PrintError("CDVDiso file", errcode);
|
||||
|
||||
errcode = GetLastError();
|
||||
PrintLog("CDVDiso file: Error reading from file");
|
||||
PrintError("CDVDiso file", errcode);
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
if(bytesread < bytes) {
|
||||
|
||||
return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
if (bytesread < bytes)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Short Block! Only read %i out of %i bytes", bytesread, bytes);
|
||||
|
||||
PrintLog("CDVDiso file: Short Block! Only read %i out of %i bytes", bytesread, bytes);
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(bytesread); // Send back how many bytes read
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
return(bytesread); // Send back how many bytes read
|
||||
} // END ActualFileRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle) {
|
||||
|
||||
if(handle == NULL) return;
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return;
|
||||
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle)
|
||||
{
|
||||
if (handle == NULL) return;
|
||||
if (handle == INVALID_HANDLE_VALUE) return;
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
CloseHandle(handle);
|
||||
|
||||
return;
|
||||
|
||||
CloseHandle(handle);
|
||||
return;
|
||||
} // END ActualFileClose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename) {
|
||||
|
||||
HANDLE newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(NULL);
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename)
|
||||
{
|
||||
HANDLE newhandle;
|
||||
if (filename == NULL) return(NULL);
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
|
||||
GENERIC_WRITE,
|
||||
|
||||
0,
|
||||
|
||||
NULL,
|
||||
|
||||
CREATE_ALWAYS,
|
||||
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
|
||||
NULL);
|
||||
|
||||
if(newhandle == INVALID_HANDLE_VALUE) {
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
NULL);
|
||||
if (newhandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(NULL);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
return(NULL);
|
||||
} // ENDIF- Error? Abort
|
||||
return(newhandle);
|
||||
} // END ActualFileOpenForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer)
|
||||
{
|
||||
int retval;
|
||||
DWORD byteswritten;
|
||||
if (handle == NULL) return(-1);
|
||||
if (handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
if (bytes < 1) return(-1);
|
||||
if (buffer == NULL) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = WriteFile(handle, buffer, bytes, &byteswritten, NULL);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
retval = WriteFile(handle, buffer, bytes, &byteswritten, NULL);
|
||||
if (retval == 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
// return(-1);
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(byteswritten); // Send back how many bytes written
|
||||
|
||||
return(byteswritten); // Send back how many bytes written
|
||||
} // END ActualFileWrite()
|
||||
|
||||
|
|
|
@ -1,104 +1,45 @@
|
|||
/* actualfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ACTUALFILE_H
|
||||
|
||||
#define ACTUALFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define ACTUALHANDLE HANDLE
|
||||
|
||||
#define ACTUALHANDLENULL NULL
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
// #define VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int IsActualFile(const char *filename);
|
||||
|
||||
extern void ActualFileDelete(const char *filename);
|
||||
|
||||
extern void ActualFileRename(const char *origname, const char *newname);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForRead(const char *filename);
|
||||
|
||||
extern off64_t ActualFileSize(ACTUALHANDLE handle);
|
||||
|
||||
extern int ActualFileSeek(ACTUALHANDLE handle, off64_t position);
|
||||
|
||||
extern int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
extern void ActualFileClose(ACTUALHANDLE handle);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForWrite(const char *filename);
|
||||
|
||||
extern int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ACTUALFILE_H */
|
||||
|
||||
|
|
|
@ -1,390 +1,217 @@
|
|||
/* conf.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <stdlib.h> // getenv()
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <sys/stat.h> // mkdir(), stat()
|
||||
|
||||
#include <sys/types.h> // mkdir(), stat(), fork()
|
||||
|
||||
#include <unistd.h> // stat(), fork(), execlp()
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // CreateProcess()
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "../PS2Edefs.h"
|
||||
|
||||
#include "../PS2Etypes.h" // u8
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "../ini.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char *confnames[] = { "IsoFile", "Device", "OpenOnStart", "OpenOnRestart", NULL };
|
||||
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
|
||||
const char defaulthome[] = "inis";
|
||||
|
||||
const char defaultdirectory[] = "HideMe.PS2E";
|
||||
|
||||
const char defaultfile[] = "CDVDisoEFP.ini";
|
||||
|
||||
|
||||
|
||||
char confdirname[256];
|
||||
|
||||
char conffilename[256];
|
||||
|
||||
|
||||
|
||||
CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitConf() {
|
||||
|
||||
DWORD retval;
|
||||
|
||||
int i;
|
||||
|
||||
int pos;
|
||||
|
||||
char *envptr;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
conf.isoname[0] = 0; // Empty the iso name
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 255) && defaultdevice[i] != 0) {
|
||||
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
|
||||
|
||||
// Locating directory and file positions
|
||||
|
||||
pos = 0;
|
||||
|
||||
envptr = NULL;
|
||||
|
||||
// envptr = getenv("HOME");
|
||||
|
||||
if(envptr == NULL) {
|
||||
|
||||
// = <Default Home>
|
||||
|
||||
retval = GetCurrentDirectory(253, confdirname);
|
||||
|
||||
if(retval > 0) {
|
||||
|
||||
pos = retval;
|
||||
|
||||
} else {
|
||||
|
||||
pos = 2;
|
||||
|
||||
confdirname[0] = '.';
|
||||
|
||||
confdirname[1] = '\\';
|
||||
|
||||
} // ENDIF- Did we retrieve a directory reference?
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while(i < pos) {
|
||||
|
||||
conffilename[i] = confdirname[i];
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- Copying dir info (so far) into file info
|
||||
|
||||
|
||||
|
||||
if(confdirname[pos-1] != '\\') {
|
||||
|
||||
confdirname[pos] = '\\';
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaulthome[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaulthome[i];
|
||||
|
||||
conffilename[pos] = defaulthome[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- putting an offset where to store ini data
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// = <Env Home>/<Default Directory>
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (*(envptr + i) != 0)) {
|
||||
|
||||
confdirname[pos] = *(envptr + i);
|
||||
|
||||
conffilename[pos] = *(envptr + i);
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying home directory info in
|
||||
|
||||
|
||||
|
||||
if(confdirname[pos-1] != '\\') {
|
||||
|
||||
confdirname[pos] = '\\';
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultdirectory[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
|
||||
|
||||
// += /<Config File Name>
|
||||
|
||||
if(conffilename[pos-1] != '\\') {
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultfile[i] != 0)) {
|
||||
|
||||
conffilename[pos] = defaultfile[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
|
||||
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: Directory: %s", confdirname);
|
||||
|
||||
PrintLog("CDVD config: File: %s", conffilename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
} // END InitConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void LoadConf() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: LoadConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
sprintf(conf.isoname, "[Put an Image File here]");
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
sprintf(conf.devicename, "D:");
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnStart", &conf.startconfigure);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
conf.startconfigure = 0; // FALSE
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnRestart", &conf.restartconfigure);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
} // END LoadConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SaveConf() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: SaveConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
mkdir(confdirname);
|
||||
|
||||
|
||||
|
||||
INISaveString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnStart", conf.startconfigure);
|
||||
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnRestart", conf.restartconfigure);
|
||||
|
||||
} // END SaveConf()
|
||||
|
||||
/* conf.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <stdlib.h> // getenv()
|
||||
#include <string.h> // strerror()
|
||||
#include <sys/stat.h> // mkdir(), stat()
|
||||
#include <sys/types.h> // mkdir(), stat(), fork()
|
||||
#include <unistd.h> // stat(), fork(), execlp()
|
||||
|
||||
#include <windows.h> // CreateProcess()
|
||||
|
||||
// #define CDVDdefs
|
||||
// #include "../PS2Edefs.h"
|
||||
#include "../PS2Etypes.h" // u8
|
||||
#include "logfile.h"
|
||||
#include "../ini.h"
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
const char *confnames[] = { "IsoFile", "Device", "OpenOnStart", "OpenOnRestart", NULL };
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
const char defaulthome[] = "inis";
|
||||
const char defaultdirectory[] = "HideMe.PS2E";
|
||||
const char defaultfile[] = "CDVDisoEFP.ini";
|
||||
|
||||
char confdirname[256];
|
||||
char conffilename[256];
|
||||
|
||||
CDVDconf conf;
|
||||
|
||||
|
||||
void InitConf()
|
||||
{
|
||||
DWORD retval;
|
||||
int i;
|
||||
int pos;
|
||||
char *envptr;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
conf.isoname[0] = 0; // Empty the iso name
|
||||
|
||||
i = 0;
|
||||
while ((i < 255) && defaultdevice[i] != 0)
|
||||
{
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
i++;
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
// Locating directory and file positions
|
||||
pos = 0;
|
||||
envptr = NULL;
|
||||
// envptr = getenv("HOME");
|
||||
if (envptr == NULL)
|
||||
{
|
||||
// = <Default Home>
|
||||
retval = GetCurrentDirectory(253, confdirname);
|
||||
if (retval > 0)
|
||||
{
|
||||
pos = retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = 2;
|
||||
confdirname[0] = '.';
|
||||
confdirname[1] = '\\';
|
||||
} // ENDIF- Did we retrieve a directory reference?
|
||||
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
{
|
||||
conffilename[i] = confdirname[i];
|
||||
i++;
|
||||
} // ENDWHILE- Copying dir info (so far) into file info
|
||||
|
||||
if (confdirname[pos-1] != '\\')
|
||||
{
|
||||
confdirname[pos] = '\\';
|
||||
conffilename[pos] = '\\';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaulthome[i] != 0))
|
||||
{
|
||||
confdirname[pos] = defaulthome[i];
|
||||
conffilename[pos] = defaulthome[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // ENDWHILE- putting an offset where to store ini data
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// = <Env Home>/<Default Directory>
|
||||
i = 0;
|
||||
while ((pos < 253) && (*(envptr + i) != 0))
|
||||
{
|
||||
confdirname[pos] = *(envptr + i);
|
||||
conffilename[pos] = *(envptr + i);
|
||||
pos++;
|
||||
i++;
|
||||
} // ENDWHILE- copying home directory info in
|
||||
|
||||
if (confdirname[pos-1] != '\\')
|
||||
{
|
||||
confdirname[pos] = '\\';
|
||||
conffilename[pos] = '\\';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaultdirectory[i] != 0))
|
||||
{
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
// += /<Config File Name>
|
||||
if (conffilename[pos-1] != '\\')
|
||||
{
|
||||
conffilename[pos] = '\\';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while ((pos < 253) && (defaultfile[i] != 0))
|
||||
{
|
||||
conffilename[pos] = defaultfile[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: Directory: %s", confdirname);
|
||||
PrintLog("CDVD config: File: %s", conffilename);
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
} // END InitConf()
|
||||
|
||||
|
||||
void LoadConf()
|
||||
{
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: LoadConf()");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.isoname, "[Put an Image File here]");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.devicename, "D:");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnStart", &conf.startconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.startconfigure = 0; // FALSE
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnRestart", &conf.restartconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
} // END LoadConf()
|
||||
|
||||
|
||||
void SaveConf()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: SaveConf()");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
mkdir(confdirname);
|
||||
|
||||
INISaveString(conffilename, "Settings", "IsoFile", conf.isoname);
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnStart", conf.startconfigure);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnRestart", conf.restartconfigure);
|
||||
} // END SaveConf()
|
||||
|
|
|
@ -1,108 +1,47 @@
|
|||
/* conf.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef CONF_H
|
||||
|
||||
#define CONF_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_FUNCTION_CONF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Data
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
u8 isoname[256];
|
||||
|
||||
u8 devicename[256];
|
||||
|
||||
unsigned int startconfigure;
|
||||
|
||||
unsigned int restartconfigure;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 isoname[256];
|
||||
u8 devicename[256];
|
||||
unsigned int startconfigure;
|
||||
unsigned int restartconfigure;
|
||||
} CDVDconf;
|
||||
|
||||
extern CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_DEVICE "K:\\"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
|
||||
|
||||
extern void InitConf();
|
||||
|
||||
extern void LoadConf();
|
||||
|
||||
extern void SaveConf();
|
||||
|
||||
|
||||
|
||||
extern void ExecCfg(char *arg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,80 +1,35 @@
|
|||
/* conversionbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CONVERSIONBOX_H
|
||||
|
||||
#define CONVERSIONBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HWND
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HWND conversionboxwindow;
|
||||
|
||||
|
||||
|
||||
extern void ConversionBoxDestroy();
|
||||
|
||||
extern void ConversionBoxRefocus();
|
||||
|
||||
extern void ConversionBoxDisplay();
|
||||
|
||||
extern BOOL CALLBACK ConversionBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
|
||||
LPARAM param2);
|
||||
|
||||
|
||||
|
||||
|
||||
UINT msg,
|
||||
WPARAM param,
|
||||
LPARAM param2);
|
||||
|
||||
#endif /* CONVERSIONBOX_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,128 +1,55 @@
|
|||
/* device.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DEVICE_H__
|
||||
|
||||
#define __DEVICE_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // BOOL, DWORD
|
||||
|
||||
|
||||
|
||||
#include <time.h> // time_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
// #define VERBOSE_WARNING_DEVICE
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HANDLE devicehandle;
|
||||
|
||||
extern OVERLAPPED waitevent;
|
||||
|
||||
|
||||
|
||||
extern time_t lasttime;
|
||||
|
||||
extern s32 traystatus;
|
||||
|
||||
extern s32 disctype;
|
||||
|
||||
extern char tocbuffer[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void DeviceInit();
|
||||
|
||||
extern void InitDisc();
|
||||
|
||||
extern s32 DiscInserted();
|
||||
|
||||
extern DWORD FinishCommand(BOOL boolresult);
|
||||
|
||||
|
||||
|
||||
extern s32 DeviceOpen();
|
||||
|
||||
extern void DeviceClose();
|
||||
|
||||
extern s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DeviceBufferOffset();
|
||||
|
||||
extern s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DeviceGetDiskType();
|
||||
|
||||
extern s32 DeviceTrayStatus();
|
||||
|
||||
extern s32 DeviceTrayOpen();
|
||||
|
||||
extern s32 DeviceTrayClose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DEVICE_H__ */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,82 +1,36 @@
|
|||
/* devicebox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef DEVICEBOX_H
|
||||
|
||||
#define DEVICEBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HWND
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HWND deviceboxwindow;
|
||||
|
||||
|
||||
|
||||
extern void DeviceBoxDestroy();
|
||||
|
||||
// extern void DeviceBoxUnfocus();
|
||||
|
||||
extern void DeviceBoxRefocus();
|
||||
|
||||
extern void DeviceBoxDisplay();
|
||||
|
||||
extern BOOL CALLBACK DeviceBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
|
||||
LPARAM param2);
|
||||
|
||||
|
||||
|
||||
|
||||
UINT msg,
|
||||
WPARAM param,
|
||||
LPARAM param2);
|
||||
|
||||
#endif /* DEVICEBOX_H */
|
||||
|
||||
|
|
|
@ -1,238 +1,126 @@
|
|||
/* logfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// #include <fcntl.h> // open()
|
||||
|
||||
// #include <io.h> // mkdir()
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // vsprintf()
|
||||
|
||||
#include <stdarg.h> // va_start(), va_end(), vsprintf()
|
||||
|
||||
// #include <sys/stat.h> // open()
|
||||
|
||||
// #include <sys/types.h> // open()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HANDLE logfile;
|
||||
|
||||
char logfiletemp[2048];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
CreateDirectory("logs", NULL);
|
||||
|
||||
|
||||
|
||||
DeleteFile("logs\\CDVDlog.txt");
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END InitLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int OpenLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
logfile = CreateFile("logs\\CDVDlog.txt",
|
||||
|
||||
GENERIC_WRITE,
|
||||
|
||||
0,
|
||||
|
||||
NULL,
|
||||
|
||||
CREATE_ALWAYS,
|
||||
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
|
||||
NULL);
|
||||
|
||||
if(logfile == INVALID_HANDLE_VALUE) {
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Failed to open? Say so.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END OpenLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CloseLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
if(logfile != NULL) {
|
||||
|
||||
CloseHandle(logfile);
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END CloseLog()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void PrintLog(const char *fmt, ...) {
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
va_list list;
|
||||
|
||||
int len;
|
||||
|
||||
|
||||
|
||||
if(logfile == NULL) return; // Log file not open... yet.
|
||||
|
||||
|
||||
|
||||
va_start(list, fmt);
|
||||
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
|
||||
|
||||
len = 0;
|
||||
|
||||
while((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
|
||||
|
||||
|
||||
WriteFile(logfile, logfiletemp, len, &byteswritten, NULL);
|
||||
|
||||
WriteFile(logfile, "\r\n", 2, &byteswritten, NULL);
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END PrintLog()
|
||||
|
||||
|
||||
|
||||
void PrintError(const char *header, DWORD errcode) {
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
TCHAR errmsg[256];
|
||||
|
||||
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 80,
|
||||
|
||||
NULL,
|
||||
|
||||
errcode,
|
||||
|
||||
0,
|
||||
|
||||
errmsg,
|
||||
|
||||
256,
|
||||
|
||||
NULL);
|
||||
|
||||
PrintLog("%s: (%u) %s", header, errcode, errmsg);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
} // END PrintError()
|
||||
|
||||
/* logfile.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// #include <fcntl.h> // open()
|
||||
// #include <io.h> // mkdir()
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // vsprintf()
|
||||
#include <stdarg.h> // va_start(), va_end(), vsprintf()
|
||||
// #include <sys/stat.h> // open()
|
||||
// #include <sys/types.h> // open()
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
|
||||
HANDLE logfile;
|
||||
char logfiletemp[2048];
|
||||
|
||||
|
||||
void InitLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
CreateDirectory("logs", NULL);
|
||||
|
||||
DeleteFile("logs\\CDVDlog.txt");
|
||||
logfile = NULL;
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
} // END InitLog();
|
||||
|
||||
|
||||
int OpenLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
logfile = CreateFile("logs\\CDVDlog.txt",
|
||||
GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
NULL);
|
||||
if (logfile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
logfile = NULL;
|
||||
return(-1);
|
||||
} // ENDIF- Failed to open? Say so.
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
return(0);
|
||||
} // END OpenLog();
|
||||
|
||||
|
||||
void CloseLog()
|
||||
{
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
if (logfile != NULL)
|
||||
{
|
||||
CloseHandle(logfile);
|
||||
logfile = NULL;
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
} // END CloseLog()
|
||||
|
||||
|
||||
void PrintLog(const char *fmt, ...)
|
||||
{
|
||||
DWORD byteswritten;
|
||||
|
||||
// Token comment line
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
va_list list;
|
||||
int len;
|
||||
|
||||
if (logfile == NULL) return; // Log file not open... yet.
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
len = 0;
|
||||
while ((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
if ((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
if ((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
|
||||
WriteFile(logfile, logfiletemp, len, &byteswritten, NULL);
|
||||
WriteFile(logfile, "\r\n", 2, &byteswritten, NULL);
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
} // END PrintLog()
|
||||
|
||||
void PrintError(const char *header, DWORD errcode)
|
||||
{
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
TCHAR errmsg[256];
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 80,
|
||||
NULL,
|
||||
errcode,
|
||||
0,
|
||||
errmsg,
|
||||
256,
|
||||
NULL);
|
||||
PrintLog("%s: (%u) %s", header, errcode, errmsg);
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
} // END PrintError()
|
||||
|
|
|
@ -1,78 +1,34 @@
|
|||
/* logfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef LOGFILE_H
|
||||
|
||||
#define LOGFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // Just for DWORD
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_LOGFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitLog();
|
||||
|
||||
extern int OpenLog();
|
||||
|
||||
extern void CloseLog();
|
||||
|
||||
extern void PrintLog(const char *format, ...);
|
||||
|
||||
extern void PrintError(const char *header, DWORD errcode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LOGFILE_H */
|
||||
|
||||
|
|
|
@ -15,15 +15,11 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h> // Button_
|
||||
#include <windef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <string.h> // strcpy()
|
||||
|
||||
#include "conf.h"
|
||||
#include "isofile.h"
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
|
@ -37,273 +33,264 @@
|
|||
#include "CDVDiso.h" // progmodule
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
const char fileselection[] = "\Disc Image Files (*.bin,*.img,*.iso,*.nrg)\0*.bin;*.img;*.iso;*.nrg\0\All Files (*.*)\0*.*\0\\0\0";
|
||||
|
||||
|
||||
HWND mainboxwindow;
|
||||
int mainboxstop;
|
||||
|
||||
|
||||
void MainBoxDestroy() {
|
||||
if(progressboxwindow != NULL) {
|
||||
ProgressBoxDestroy();
|
||||
} // ENDIF- Do we have a Progress Window still?
|
||||
|
||||
if(mainboxwindow != NULL) {
|
||||
EndDialog(mainboxwindow, FALSE);
|
||||
mainboxwindow = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
void MainBoxDestroy()
|
||||
{
|
||||
if (progressboxwindow != NULL)
|
||||
{
|
||||
ProgressBoxDestroy();
|
||||
} // ENDIF- Do we have a Progress Window still?
|
||||
if (mainboxwindow != NULL)
|
||||
{
|
||||
EndDialog(mainboxwindow, FALSE);
|
||||
mainboxwindow = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
|
||||
void MainBoxUnfocus() {
|
||||
// EnableWindow(?)
|
||||
// gtk_widget_set_sensitive(mainbox.file, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.selectbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.devbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.convbutton, FALSE);
|
||||
ShowWindow(mainboxwindow, SW_HIDE);
|
||||
void MainBoxUnfocus()
|
||||
{
|
||||
// EnableWindow(?)
|
||||
// gtk_widget_set_sensitive(mainbox.file, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.selectbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.devbutton, FALSE);
|
||||
// gtk_widget_set_sensitive(mainbox.convbutton, FALSE);
|
||||
ShowWindow(mainboxwindow, SW_HIDE);
|
||||
} // END MainBoxUnfocus()
|
||||
void MainBoxFileEvent()
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, templine, 256);
|
||||
returnval = IsIsoFile(templine);
|
||||
if (returnval == -1)
|
||||
{
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: ---");
|
||||
return;
|
||||
} // ENDIF- Not a name of any sort?
|
||||
if (returnval == -2)
|
||||
{
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a file");
|
||||
return;
|
||||
} // ENDIF- Not a regular file?
|
||||
if (returnval == -3)
|
||||
{
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a valid image file");
|
||||
return;
|
||||
} // ENDIF- Not an Image file?
|
||||
if (returnval == -4)
|
||||
{
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Missing Table File (will rebuild)");
|
||||
return;
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
void MainBoxFileEvent() {
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, templine, 256);
|
||||
returnval = IsIsoFile(templine);
|
||||
if(returnval == -1) {
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: ---");
|
||||
return;
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if(returnval == -2) {
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a file");
|
||||
return;
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if(returnval == -3) {
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a valid image file");
|
||||
return;
|
||||
} // ENDIF- Not an Image file?
|
||||
|
||||
if(returnval == -4) {
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Missing Table File (will rebuild)");
|
||||
return;
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
tempfile = IsoFileOpenForRead(templine);
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return;
|
||||
tempfile = IsoFileOpenForRead(templine);
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
SetDlgItemText(mainboxwindow, IDC_0204, templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return;
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
|
||||
void MainBoxRefocus() {
|
||||
MainBoxFileEvent();
|
||||
|
||||
// gtk_widget_set_sensitive(mainbox.file, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
|
||||
// gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
|
||||
// ShowWindow(mainboxwindow, SW_RESTORE); // and/or, SW_SHOW? SW_SHOWNORMAL?
|
||||
ShowWindow(mainboxwindow, SW_SHOW);
|
||||
SetActiveWindow(mainboxwindow);
|
||||
void MainBoxRefocus()
|
||||
{
|
||||
MainBoxFileEvent();
|
||||
// gtk_widget_set_sensitive(mainbox.file, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
|
||||
// gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
|
||||
// gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
|
||||
// ShowWindow(mainboxwindow, SW_RESTORE); // and/or, SW_SHOW? SW_SHOWNORMAL?
|
||||
ShowWindow(mainboxwindow, SW_SHOW);
|
||||
SetActiveWindow(mainboxwindow);
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
|
||||
void MainBoxCancelEvent() {
|
||||
mainboxstop = 1; // Halt all long processess...
|
||||
|
||||
MainBoxDestroy();
|
||||
return;
|
||||
void MainBoxCancelEvent()
|
||||
{
|
||||
mainboxstop = 1; // Halt all long processess...
|
||||
MainBoxDestroy();
|
||||
return;
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
void MainBoxOKEvent()
|
||||
{
|
||||
char tempisoname[256];
|
||||
MainBoxUnfocus();
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, tempisoname, 256);
|
||||
if (*(tempisoname) != 0)
|
||||
{
|
||||
if (IsIsoFile(tempisoname) == -4)
|
||||
{
|
||||
IsoTableRebuild(tempisoname);
|
||||
MainBoxRefocus();
|
||||
return;
|
||||
} // ENDIF- Do we need to rebuild an image file's index before using it?
|
||||
if (IsIsoFile(tempisoname) < 0)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBox(mainboxwindow,
|
||||
"Not a Valid Image File.",
|
||||
"CDVDisoEFP Message",
|
||||
MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
|
||||
return;
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
} // ENDIF- Do we have a name to check out?
|
||||
strcpy(conf.isoname, tempisoname);
|
||||
if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0209)) == BST_UNCHECKED)
|
||||
{
|
||||
conf.startconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.startconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this checkbox unchecked?
|
||||
if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0210)) == BST_UNCHECKED)
|
||||
{
|
||||
conf.restartconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this checkbox unchecked?
|
||||
SaveConf();
|
||||
|
||||
void MainBoxOKEvent() {
|
||||
char tempisoname[256];
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, tempisoname, 256);
|
||||
if(*(tempisoname) != 0) {
|
||||
if(IsIsoFile(tempisoname) == -4) {
|
||||
IsoTableRebuild(tempisoname);
|
||||
MainBoxRefocus();
|
||||
return;
|
||||
} // ENDIF- Do we need to rebuild an image file's index before using it?
|
||||
|
||||
if(IsIsoFile(tempisoname) < 0) {
|
||||
MainBoxRefocus();
|
||||
MessageBox(mainboxwindow,
|
||||
"Not a Valid Image File.",
|
||||
"CDVDisoEFP Message",
|
||||
MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
|
||||
return;
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
} // ENDIF- Do we have a name to check out?
|
||||
|
||||
strcpy(conf.isoname, tempisoname);
|
||||
if(Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0209)) == BST_UNCHECKED) {
|
||||
conf.startconfigure = 0; // FALSE
|
||||
} else {
|
||||
conf.startconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this checkbox unchecked?
|
||||
if(Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0210)) == BST_UNCHECKED) {
|
||||
conf.restartconfigure = 0; // FALSE
|
||||
} else {
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this checkbox unchecked?
|
||||
SaveConf();
|
||||
|
||||
MainBoxCancelEvent();
|
||||
return;
|
||||
MainBoxCancelEvent();
|
||||
return;
|
||||
} // END MainBoxOKEvent()
|
||||
|
||||
|
||||
void MainBoxBrowseEvent() {
|
||||
OPENFILENAME filebox;
|
||||
char newfilename[256];
|
||||
BOOL returnbool;
|
||||
|
||||
filebox.lStructSize = sizeof(filebox);
|
||||
filebox.hwndOwner = mainboxwindow;
|
||||
filebox.hInstance = NULL;
|
||||
filebox.lpstrFilter = fileselection;
|
||||
filebox.lpstrCustomFilter = NULL;
|
||||
filebox.nFilterIndex = 0;
|
||||
filebox.lpstrFile = newfilename;
|
||||
filebox.nMaxFile = 256;
|
||||
filebox.lpstrFileTitle = NULL;
|
||||
filebox.nMaxFileTitle = 0;
|
||||
filebox.lpstrInitialDir = NULL;
|
||||
filebox.lpstrTitle = NULL;
|
||||
filebox.Flags = OFN_FILEMUSTEXIST
|
||||
| OFN_NOCHANGEDIR
|
||||
| OFN_HIDEREADONLY;
|
||||
filebox.nFileOffset = 0;
|
||||
filebox.nFileExtension = 0;
|
||||
filebox.lpstrDefExt = NULL;
|
||||
filebox.lCustData = 0;
|
||||
filebox.lpfnHook = NULL;
|
||||
filebox.lpTemplateName = NULL;
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, newfilename, 256);
|
||||
returnbool = GetOpenFileName(&filebox);
|
||||
if(returnbool != FALSE) {
|
||||
SetDlgItemText(mainboxwindow, IDC_0202, newfilename);
|
||||
} // ENDIF- User actually selected a name? Save it.
|
||||
|
||||
return;
|
||||
void MainBoxBrowseEvent()
|
||||
{
|
||||
OPENFILENAME filebox;
|
||||
char newfilename[256];
|
||||
BOOL returnbool;
|
||||
filebox.lStructSize = sizeof(filebox);
|
||||
filebox.hwndOwner = mainboxwindow;
|
||||
filebox.hInstance = NULL;
|
||||
filebox.lpstrFilter = fileselection;
|
||||
filebox.lpstrCustomFilter = NULL;
|
||||
filebox.nFilterIndex = 0;
|
||||
filebox.lpstrFile = newfilename;
|
||||
filebox.nMaxFile = 256;
|
||||
filebox.lpstrFileTitle = NULL;
|
||||
filebox.nMaxFileTitle = 0;
|
||||
filebox.lpstrInitialDir = NULL;
|
||||
filebox.lpstrTitle = NULL;
|
||||
filebox.Flags = OFN_FILEMUSTEXIST
|
||||
| OFN_NOCHANGEDIR
|
||||
| OFN_HIDEREADONLY;
|
||||
filebox.nFileOffset = 0;
|
||||
filebox.nFileExtension = 0;
|
||||
filebox.lpstrDefExt = NULL;
|
||||
filebox.lCustData = 0;
|
||||
filebox.lpfnHook = NULL;
|
||||
filebox.lpTemplateName = NULL;
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, newfilename, 256);
|
||||
returnbool = GetOpenFileName(&filebox);
|
||||
if (returnbool != FALSE)
|
||||
{
|
||||
SetDlgItemText(mainboxwindow, IDC_0202, newfilename);
|
||||
} // ENDIF- User actually selected a name? Save it.
|
||||
return;
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
|
||||
void MainBoxDeviceEvent() {
|
||||
MainBoxUnfocus();
|
||||
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0300),
|
||||
mainboxwindow,
|
||||
(DLGPROC)DeviceBoxCallback);
|
||||
return;
|
||||
void MainBoxDeviceEvent()
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0300),
|
||||
mainboxwindow,
|
||||
(DLGPROC)DeviceBoxCallback);
|
||||
return;
|
||||
} // END MainBoxBrowseEvent()
|
||||
void MainBoxConversionEvent()
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
void MainBoxConversionEvent() {
|
||||
MainBoxUnfocus();
|
||||
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0400),
|
||||
mainboxwindow,
|
||||
(DLGPROC)ConversionBoxCallback);
|
||||
return;
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0400),
|
||||
mainboxwindow,
|
||||
(DLGPROC)ConversionBoxCallback);
|
||||
return;
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
|
||||
void MainBoxDisplay() {
|
||||
LoadConf();
|
||||
|
||||
// Adjust window position?
|
||||
|
||||
// We held off setting the name until now... so description would show.
|
||||
SetDlgItemText(mainboxwindow, IDC_0202, conf.isoname);
|
||||
if(conf.startconfigure == 0) {
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_UNCHECKED);
|
||||
} else {
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_CHECKED);
|
||||
} // ENDIF- Do we need to uncheck this box?
|
||||
if(conf.restartconfigure == 0) {
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_UNCHECKED);
|
||||
} else {
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_CHECKED);
|
||||
} // ENDIF- Do we need to uncheck this box?
|
||||
|
||||
// First Time - Show the window
|
||||
ShowWindow(mainboxwindow, SW_SHOWNORMAL);
|
||||
void MainBoxDisplay()
|
||||
{
|
||||
LoadConf();
|
||||
// Adjust window position?
|
||||
// We held off setting the name until now... so description would show.
|
||||
SetDlgItemText(mainboxwindow, IDC_0202, conf.isoname);
|
||||
if (conf.startconfigure == 0)
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_UNCHECKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_CHECKED);
|
||||
} // ENDIF- Do we need to uncheck this box?
|
||||
if (conf.restartconfigure == 0)
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_UNCHECKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_CHECKED);
|
||||
} // ENDIF- Do we need to uncheck this box?
|
||||
// First Time - Show the window
|
||||
ShowWindow(mainboxwindow, SW_SHOWNORMAL);
|
||||
} // END MainBoxDisplay()
|
||||
|
||||
|
||||
BOOL CALLBACK MainBoxCallback(HWND window,
|
||||
UINT msg,
|
||||
WPARAM param,
|
||||
LPARAM param2) {
|
||||
switch(msg) {
|
||||
case WM_INITDIALOG:
|
||||
mainboxwindow = window;
|
||||
MainBoxDisplay(); // In this case, final touches to this window.
|
||||
ProgressBoxDisplay(); // Create the Progress Box at this time.
|
||||
return(FALSE); // And let Windows display this window.
|
||||
break;
|
||||
LPARAM param2)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
mainboxwindow = window;
|
||||
MainBoxDisplay(); // In this case, final touches to this window.
|
||||
ProgressBoxDisplay(); // Create the Progress Box at this time.
|
||||
return(FALSE); // And let Windows display this window.
|
||||
break;
|
||||
case WM_CLOSE: // The "X" in the upper right corner was hit.
|
||||
MainBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
// Do we wish to capture 'ENTER/RETURN' and/or 'ESC' here?
|
||||
switch (LOWORD(param))
|
||||
{
|
||||
case IDC_0202: // Filename Edit Box
|
||||
MainBoxFileEvent(); // Describe the File's type...
|
||||
return(FALSE); // Let Windows handle the actual 'edit' processing...
|
||||
break;
|
||||
case IDC_0203: // "Browse" Button
|
||||
MainBoxBrowseEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
case IDC_0205: // "Ok" Button
|
||||
MainBoxOKEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
case IDC_0206: // "Get from Disc" Button
|
||||
MainBoxDeviceEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case WM_CLOSE: // The "X" in the upper right corner was hit.
|
||||
MainBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
// Do we wish to capture 'ENTER/RETURN' and/or 'ESC' here?
|
||||
|
||||
switch(LOWORD(param)) {
|
||||
case IDC_0202: // Filename Edit Box
|
||||
MainBoxFileEvent(); // Describe the File's type...
|
||||
return(FALSE); // Let Windows handle the actual 'edit' processing...
|
||||
break;
|
||||
|
||||
case IDC_0203: // "Browse" Button
|
||||
MainBoxBrowseEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case IDC_0205: // "Ok" Button
|
||||
MainBoxOKEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case IDC_0206: // "Get from Disc" Button
|
||||
MainBoxDeviceEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case IDC_0207: // "Convert" Button
|
||||
MainBoxConversionEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
case IDC_0208: // "Cancel" Button
|
||||
MainBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- Which object got the message?
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
|
||||
return(FALSE); // Not a recognized message? Tell Windows to handle it.
|
||||
case IDC_0207: // "Convert" Button
|
||||
MainBoxConversionEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
case IDC_0208: // "Cancel" Button
|
||||
MainBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- Which object got the message?
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
return(FALSE); // Not a recognized message? Tell Windows to handle it.
|
||||
} // END MainBoxEventLoop()
|
||||
|
|
|
@ -1,86 +1,37 @@
|
|||
/* mainbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef MAINBOX_H
|
||||
|
||||
#define MAINBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HWND
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern const char fileselection[];
|
||||
|
||||
|
||||
|
||||
extern HWND mainboxwindow;
|
||||
|
||||
extern int mainboxstop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void MainBoxRefocus();
|
||||
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
extern BOOL CALLBACK MainBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
|
||||
LPARAM param2);
|
||||
|
||||
|
||||
|
||||
|
||||
UINT msg,
|
||||
WPARAM param,
|
||||
LPARAM param2);
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
||||
|
|
|
@ -1,340 +1,165 @@
|
|||
/* progressbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <windowsx.h> // Enable_Button()
|
||||
|
||||
#include <windef.h> // NULL
|
||||
|
||||
#include <commctrl.h> // PBM_...
|
||||
|
||||
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcat()
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#include "CDVDiso.h" // progmodule
|
||||
|
||||
#include "screens.h"
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HWND progressboxwindow;
|
||||
|
||||
HWND progressboxbar;
|
||||
|
||||
int progressboxstop;
|
||||
|
||||
|
||||
|
||||
off64_t progressboxmax;
|
||||
|
||||
off64_t progressboxlastpct;
|
||||
|
||||
char progressboxline[256];
|
||||
|
||||
char progressboxmaxchar[16];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxDestroy() {
|
||||
|
||||
if(progressboxwindow != NULL) {
|
||||
|
||||
DestroyWindow(progressboxwindow);
|
||||
|
||||
progressboxwindow = NULL;
|
||||
|
||||
progressboxbar = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Progress Window still?
|
||||
|
||||
return;
|
||||
|
||||
void ProgressBoxDestroy()
|
||||
{
|
||||
if (progressboxwindow != NULL)
|
||||
{
|
||||
DestroyWindow(progressboxwindow);
|
||||
progressboxwindow = NULL;
|
||||
progressboxbar = NULL;
|
||||
} // ENDIF- Do we have a Progress Window still?
|
||||
return;
|
||||
} // END ProgressBoxDestroy()
|
||||
|
||||
void ProgressBoxStart(char *description, off64_t maximum)
|
||||
{
|
||||
SetDlgItemText(progressboxwindow, IDC_0501, description);
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxStart(char *description, off64_t maximum) {
|
||||
|
||||
SetDlgItemText(progressboxwindow, IDC_0501, description);
|
||||
|
||||
|
||||
|
||||
progressboxmax = maximum;
|
||||
|
||||
sprintf(progressboxmaxchar, "%llu", maximum);
|
||||
|
||||
progressboxlastpct = 100;
|
||||
|
||||
progressboxstop = 0;
|
||||
|
||||
|
||||
|
||||
ProgressBoxTick(0);
|
||||
|
||||
ShowWindow(progressboxwindow, SW_SHOW);
|
||||
|
||||
SetForegroundWindow(progressboxwindow);
|
||||
|
||||
return;
|
||||
|
||||
progressboxmax = maximum;
|
||||
sprintf(progressboxmaxchar, "%llu", maximum);
|
||||
progressboxlastpct = 100;
|
||||
progressboxstop = 0;
|
||||
ProgressBoxTick(0);
|
||||
ShowWindow(progressboxwindow, SW_SHOW);
|
||||
SetForegroundWindow(progressboxwindow);
|
||||
return;
|
||||
} // END ProgressBoxStart()
|
||||
|
||||
void ProgressBoxTick(off64_t current)
|
||||
{
|
||||
off64_t thispct;
|
||||
MSG msg;
|
||||
BOOL returnbool;
|
||||
sprintf(progressboxline, "%llu of ", current);
|
||||
strcat(progressboxline, progressboxmaxchar);
|
||||
SetDlgItemText(progressboxwindow, IDC_0503, progressboxline);
|
||||
if (progressboxmax >= 30000)
|
||||
{
|
||||
SendMessage(progressboxbar, PBM_SETPOS, current / (progressboxmax / 30000), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(progressboxbar, PBM_SETPOS, (current * 30000) / progressboxmax, 0);
|
||||
} // ENDIF- Our maximum # over 30000? (Avoiding divide-by-zero error)
|
||||
if (progressboxmax >= 100)
|
||||
{
|
||||
thispct = current / (progressboxmax / 100);
|
||||
if (thispct != progressboxlastpct)
|
||||
{
|
||||
sprintf(progressboxline, "%llu%% CDVDisoEFP Progress", thispct);
|
||||
SetWindowText(progressboxwindow, progressboxline);
|
||||
progressboxlastpct = thispct;
|
||||
} // ENDIF- Change in percentage? (Avoiding title flicker)
|
||||
} // ENDIF- Our maximum # over 100? (Avoiding divide-by-zero error)
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxTick(off64_t current) {
|
||||
|
||||
off64_t thispct;
|
||||
|
||||
MSG msg;
|
||||
|
||||
BOOL returnbool;
|
||||
|
||||
|
||||
|
||||
sprintf(progressboxline, "%llu of ", current);
|
||||
|
||||
strcat(progressboxline, progressboxmaxchar);
|
||||
|
||||
SetDlgItemText(progressboxwindow, IDC_0503, progressboxline);
|
||||
|
||||
|
||||
|
||||
if(progressboxmax >= 30000 ) {
|
||||
|
||||
SendMessage(progressboxbar, PBM_SETPOS, current / (progressboxmax / 30000), 0);
|
||||
|
||||
} else {
|
||||
|
||||
SendMessage(progressboxbar, PBM_SETPOS, (current * 30000) / progressboxmax, 0);
|
||||
|
||||
} // ENDIF- Our maximum # over 30000? (Avoiding divide-by-zero error)
|
||||
|
||||
|
||||
|
||||
if(progressboxmax >= 100) {
|
||||
|
||||
thispct = current / ( progressboxmax / 100 );
|
||||
|
||||
if(thispct != progressboxlastpct) {
|
||||
|
||||
sprintf(progressboxline, "%llu%% CDVDisoEFP Progress", thispct);
|
||||
|
||||
SetWindowText(progressboxwindow, progressboxline);
|
||||
|
||||
progressboxlastpct = thispct;
|
||||
|
||||
} // ENDIF- Change in percentage? (Avoiding title flicker)
|
||||
|
||||
} // ENDIF- Our maximum # over 100? (Avoiding divide-by-zero error)
|
||||
|
||||
|
||||
|
||||
returnbool = PeekMessage(&msg, progressboxwindow, 0, 0, PM_REMOVE);
|
||||
|
||||
while(returnbool != FALSE) {
|
||||
|
||||
TranslateMessage(&msg);
|
||||
|
||||
DispatchMessage(&msg);
|
||||
|
||||
returnbool = PeekMessage(&msg, progressboxwindow, 0, 0, PM_REMOVE);
|
||||
|
||||
} // ENDWHILE- Updating the progress window display as needed
|
||||
|
||||
return;
|
||||
|
||||
returnbool = PeekMessage(&msg, progressboxwindow, 0, 0, PM_REMOVE);
|
||||
while (returnbool != FALSE)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
returnbool = PeekMessage(&msg, progressboxwindow, 0, 0, PM_REMOVE);
|
||||
} // ENDWHILE- Updating the progress window display as needed
|
||||
return;
|
||||
} // END ProgressBoxTick()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxStop() {
|
||||
|
||||
ShowWindow(progressboxwindow, SW_HIDE);
|
||||
|
||||
SetWindowText(progressboxwindow, "CDVDisoEFP Progress");
|
||||
|
||||
return;
|
||||
|
||||
void ProgressBoxStop()
|
||||
{
|
||||
ShowWindow(progressboxwindow, SW_HIDE);
|
||||
SetWindowText(progressboxwindow, "CDVDisoEFP Progress");
|
||||
return;
|
||||
} // END ProgressBoxStop()
|
||||
|
||||
void ProgressBoxCancelEvent()
|
||||
{
|
||||
progressboxstop = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxCancelEvent() {
|
||||
|
||||
progressboxstop = 1;
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
return;
|
||||
} // END ProgressBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CALLBACK ProgressBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
LPARAM param2)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return(TRUE);
|
||||
break;
|
||||
case WM_CLOSE: // The "X" in the upper right corner is hit.
|
||||
ProgressBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
|
||||
LPARAM param2) {
|
||||
|
||||
switch(msg) {
|
||||
|
||||
case WM_INITDIALOG:
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case WM_CLOSE: // The "X" in the upper right corner is hit.
|
||||
|
||||
ProgressBoxCancelEvent();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
switch(LOWORD(param)) {
|
||||
|
||||
case IDC_0504:
|
||||
|
||||
ProgressBoxCancelEvent();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH param- Which item got the message?
|
||||
|
||||
|
||||
|
||||
// Hmm. Custom control? (for WM_GETFONT and WM_SETFONT msgs?)
|
||||
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
|
||||
|
||||
|
||||
return(FALSE); // Not a recognized message? Tell Windows to handle it.
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(param))
|
||||
{
|
||||
case IDC_0504:
|
||||
ProgressBoxCancelEvent();
|
||||
return(TRUE);
|
||||
break;
|
||||
} // ENDSWITCH param- Which item got the message?
|
||||
|
||||
// Hmm. Custom control? (for WM_GETFONT and WM_SETFONT msgs?)
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
return(FALSE); // Not a recognized message? Tell Windows to handle it.
|
||||
} // ENDIF ProgressBoxCallback()
|
||||
|
||||
void ProgressBoxDisplay()
|
||||
{
|
||||
// ? progressload
|
||||
LPARAM range;
|
||||
InitCommonControls();
|
||||
// progressload.
|
||||
// progressload. = ICC_PROGRESS_CLASS
|
||||
// InitCommonControlsEx(&progressload);
|
||||
|
||||
|
||||
|
||||
|
||||
void ProgressBoxDisplay() {
|
||||
|
||||
// ? progressload
|
||||
|
||||
LPARAM range;
|
||||
|
||||
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
// progressload.
|
||||
|
||||
// progressload. = ICC_PROGRESS_CLASS
|
||||
|
||||
// InitCommonControlsEx(&progressload);
|
||||
|
||||
|
||||
|
||||
progressboxwindow = CreateDialog(progmodule,
|
||||
|
||||
MAKEINTRESOURCE(DLG_0500),
|
||||
|
||||
mainboxwindow,
|
||||
|
||||
(DLGPROC) ProgressBoxCallback);
|
||||
|
||||
|
||||
|
||||
progressboxbar = GetDlgItem(progressboxwindow, IDC_0502);
|
||||
|
||||
range = MAKELPARAM(0, 30000); // Widen the range for granularity
|
||||
|
||||
SendMessage(progressboxbar, PBM_SETRANGE, 0, range);
|
||||
|
||||
|
||||
|
||||
ShowWindow(progressboxwindow, SW_SHOWNORMAL);
|
||||
|
||||
ShowWindow(progressboxwindow, SW_HIDE);
|
||||
|
||||
return;
|
||||
|
||||
progressboxwindow = CreateDialog(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0500),
|
||||
mainboxwindow,
|
||||
(DLGPROC) ProgressBoxCallback);
|
||||
progressboxbar = GetDlgItem(progressboxwindow, IDC_0502);
|
||||
range = MAKELPARAM(0, 30000); // Widen the range for granularity
|
||||
SendMessage(progressboxbar, PBM_SETRANGE, 0, range);
|
||||
ShowWindow(progressboxwindow, SW_SHOWNORMAL);
|
||||
ShowWindow(progressboxwindow, SW_HIDE);
|
||||
return;
|
||||
} // END ProgressBoxDisplay()
|
||||
|
||||
|
|
|
@ -1,76 +1,38 @@
|
|||
/* progressbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef PROGRESSBOX_H
|
||||
|
||||
#define PROGRESSBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern const char *compressnames[];
|
||||
|
||||
|
||||
|
||||
extern HWND progressboxwindow;
|
||||
|
||||
extern int progressboxstop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void ProgressBoxStart(char *description, off64_t maximum);
|
||||
|
||||
extern void ProgressBoxTick(off64_t current);
|
||||
|
@ -82,8 +44,5 @@ extern void ProgressBoxDestroy();
|
|||
extern void ProgressBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
||||
|
|
|
@ -1,74 +1,37 @@
|
|||
/* Weditres generated include file. Do NOT edit */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define DLG_0100 100
|
||||
|
||||
#define IDC_0104 104
|
||||
|
||||
#define DLG_0200 200
|
||||
|
||||
#define IDC_0202 202
|
||||
|
||||
#define IDC_0203 203
|
||||
|
||||
#define IDC_0204 204
|
||||
|
||||
#define IDC_0205 205
|
||||
|
||||
#define IDC_0206 206
|
||||
|
||||
#define IDC_0207 207
|
||||
|
||||
#define IDC_0208 208
|
||||
|
||||
#define IDC_0209 209
|
||||
|
||||
#define IDC_0210 210
|
||||
|
||||
#define DLG_0300 300
|
||||
|
||||
#define IDC_0302 302
|
||||
|
||||
#define IDC_0303 303
|
||||
|
||||
#define IDC_0305 305
|
||||
|
||||
#define IDC_0306 306
|
||||
|
||||
#define IDC_0307 307
|
||||
|
||||
#define IDC_0309 309
|
||||
|
||||
#define IDC_0311 311
|
||||
|
||||
#define IDC_0312 312
|
||||
|
||||
#define IDC_0313 313
|
||||
|
||||
#define DLG_0400 400
|
||||
|
||||
#define IDC_0402 402
|
||||
|
||||
#define IDC_0403 403
|
||||
|
||||
#define IDC_0404 404
|
||||
|
||||
#define IDC_0406 406
|
||||
|
||||
#define IDC_0408 408
|
||||
|
||||
#define IDC_0409 409
|
||||
|
||||
#define IDC_0410 410
|
||||
|
||||
#define DLG_0500 500
|
||||
|
||||
#define IDC_0501 501
|
||||
|
||||
#define IDC_0502 502
|
||||
|
||||
#define IDC_0503 503
|
||||
|
||||
#define IDC_0504 504
|
||||
|
||||
|
|
|
@ -1,374 +1,199 @@
|
|||
/* tablerebuild.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <stdlib.h> // malloc()
|
||||
|
||||
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
#include "progressbox.h"
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "multifile.h"
|
||||
|
||||
#include "isocompress.h" // CompressClose()
|
||||
|
||||
#include "gzipv1.h"
|
||||
|
||||
#include "gzipv2.h"
|
||||
|
||||
#include "bzip2v2.h"
|
||||
|
||||
#include "bzip2v3.h"
|
||||
|
||||
#include "actualfile.h" // ACTUALHANDLENULL
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void IsoTableRebuild(const char *filename) {
|
||||
|
||||
struct IsoFile *datafile;
|
||||
|
||||
struct IsoFile *tablefile;
|
||||
|
||||
int retval;
|
||||
|
||||
char tempblock[65536];
|
||||
|
||||
int stop;
|
||||
|
||||
|
||||
|
||||
struct TableData table;
|
||||
|
||||
|
||||
|
||||
datafile = IsoFileOpenForRead(filename);
|
||||
|
||||
|
||||
|
||||
// Note: This is the start of the "Multifile" process. It's commented
|
||||
|
||||
// out so at least we can rebuild 1 part of a multifile at a time.
|
||||
|
||||
// IsoNameStripExt(datafile);
|
||||
|
||||
// IsoNameStripMulti(datafile);
|
||||
|
||||
|
||||
|
||||
// Prep tablefile to hold ONLY a table (no data)
|
||||
|
||||
tablefile = (struct IsoFile *) malloc(sizeof(struct IsoFile));
|
||||
|
||||
if(tablefile == NULL) {
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Failed to allocate? Abort.
|
||||
|
||||
|
||||
|
||||
tablefile->sectorpos = 0;
|
||||
|
||||
tablefile->openforread = 0;
|
||||
|
||||
tablefile->filebytepos = 0;
|
||||
|
||||
tablefile->filebytesize = 0;
|
||||
|
||||
tablefile->filesectorpos = 0;
|
||||
|
||||
tablefile->filesectorsize = 0;
|
||||
|
||||
tablefile->handle = ACTUALHANDLENULL;
|
||||
|
||||
|
||||
|
||||
tablefile->namepos = 0;
|
||||
|
||||
while((tablefile->namepos < 255) &&
|
||||
|
||||
(*(filename + tablefile->namepos) != 0)) {
|
||||
|
||||
tablefile->name[tablefile->namepos] = *(filename + tablefile->namepos);
|
||||
|
||||
tablefile->namepos++;
|
||||
|
||||
} // ENDWHILE- Copying file name into tablefile
|
||||
|
||||
tablefile->name[tablefile->namepos] = 0; // And 0-terminate.
|
||||
|
||||
|
||||
|
||||
tablefile->imageheader = datafile->imageheader;
|
||||
|
||||
tablefile->blocksize = datafile->blocksize;
|
||||
|
||||
tablefile->blockoffset = datafile->blockoffset;
|
||||
|
||||
tablefile->cdvdtype = 0; // Not important right now.
|
||||
|
||||
|
||||
|
||||
tablefile->compress = datafile->compress;
|
||||
|
||||
tablefile->compresspos = datafile->compresspos;
|
||||
|
||||
tablefile->numsectors = datafile->numsectors;
|
||||
|
||||
tablefile->tabledata = NULL;
|
||||
|
||||
|
||||
|
||||
switch(tablefile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3OpenTableForWrite(tablefile);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Which table are we writing out?
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Failed to open table file? Abort
|
||||
|
||||
|
||||
|
||||
sprintf(tempblock, "Rebuilding table for %s", datafile->name);
|
||||
|
||||
ProgressBoxStart(tempblock, datafile->filebytesize);
|
||||
|
||||
|
||||
|
||||
stop = 0;
|
||||
|
||||
mainboxstop = 0;
|
||||
|
||||
progressboxstop = 0;
|
||||
|
||||
while((stop == 0) && (datafile->filebytepos < datafile->filebytesize)) {
|
||||
|
||||
switch(datafile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3Read(datafile, 0, tempblock);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Scanning for the next complete compressed block
|
||||
|
||||
|
||||
|
||||
if(retval <= 0) {
|
||||
|
||||
#ifdef FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
PrintLog("CDVDiso rebuild: failed to decompress - data corrupt");
|
||||
|
||||
#endif /* FUNCTION_WARNING_TABLEREBUILD */
|
||||
|
||||
stop = 1;
|
||||
|
||||
} else {
|
||||
|
||||
table.offset = datafile->filebytepos - retval;
|
||||
|
||||
table.size = retval;
|
||||
|
||||
switch(tablefile->compress) {
|
||||
|
||||
case 1:
|
||||
|
||||
retval = GZipV1WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
retval = GZipV2WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
retval = BZip2V2WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
retval = BZip2V3WriteTable(tablefile, table);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
retval = -1;
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH compress- Writing out the relavent table facts
|
||||
|
||||
if(retval < 0) stop = 1;
|
||||
|
||||
} // ENDIF- Do we have a valid record to write an entry for?
|
||||
|
||||
|
||||
|
||||
ProgressBoxTick(datafile->filebytepos);
|
||||
|
||||
|
||||
|
||||
if(mainboxstop != 0) stop = 2;
|
||||
|
||||
if(progressboxstop != 0) stop = 2;
|
||||
|
||||
} // ENDWHILE- Read in the data file and writing a table, 1 block at a time
|
||||
|
||||
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
|
||||
|
||||
CompressClose(tablefile); // Guarentee the table is flushed and closed.
|
||||
|
||||
if(stop != 0) {
|
||||
|
||||
ActualFileDelete(tablefile->tablename);
|
||||
|
||||
} // ENDIF- Aborted or trouble? Delete the table file
|
||||
|
||||
tablefile = IsoFileClose(tablefile);
|
||||
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
} // END IsoTableRebuild()
|
||||
|
||||
/* tablerebuild.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <stdlib.h> // malloc()
|
||||
|
||||
#include "mainbox.h"
|
||||
#include "progressbox.h"
|
||||
#include "isofile.h"
|
||||
#include "multifile.h"
|
||||
#include "isocompress.h" // CompressClose()
|
||||
#include "gzipv1.h"
|
||||
#include "gzipv2.h"
|
||||
#include "bzip2v2.h"
|
||||
#include "bzip2v3.h"
|
||||
#include "actualfile.h" // ACTUALHANDLENULL
|
||||
|
||||
|
||||
void IsoTableRebuild(const char *filename)
|
||||
{
|
||||
struct IsoFile *datafile;
|
||||
struct IsoFile *tablefile;
|
||||
int retval;
|
||||
char tempblock[65536];
|
||||
int stop;
|
||||
|
||||
struct TableData table;
|
||||
|
||||
datafile = IsoFileOpenForRead(filename);
|
||||
|
||||
// Note: This is the start of the "Multifile" process. It's commented
|
||||
// out so at least we can rebuild 1 part of a multifile at a time.
|
||||
// IsoNameStripExt(datafile);
|
||||
// IsoNameStripMulti(datafile);
|
||||
|
||||
// Prep tablefile to hold ONLY a table (no data)
|
||||
tablefile = (struct IsoFile *) malloc(sizeof(struct IsoFile));
|
||||
if (tablefile == NULL)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to allocate? Abort.
|
||||
|
||||
tablefile->sectorpos = 0;
|
||||
tablefile->openforread = 0;
|
||||
tablefile->filebytepos = 0;
|
||||
tablefile->filebytesize = 0;
|
||||
tablefile->filesectorpos = 0;
|
||||
tablefile->filesectorsize = 0;
|
||||
tablefile->handle = ACTUALHANDLENULL;
|
||||
|
||||
tablefile->namepos = 0;
|
||||
while ((tablefile->namepos < 255) &&
|
||||
(*(filename + tablefile->namepos) != 0))
|
||||
{
|
||||
tablefile->name[tablefile->namepos] = *(filename + tablefile->namepos);
|
||||
tablefile->namepos++;
|
||||
} // ENDWHILE- Copying file name into tablefile
|
||||
tablefile->name[tablefile->namepos] = 0; // And 0-terminate.
|
||||
|
||||
tablefile->imageheader = datafile->imageheader;
|
||||
tablefile->blocksize = datafile->blocksize;
|
||||
tablefile->blockoffset = datafile->blockoffset;
|
||||
tablefile->cdvdtype = 0; // Not important right now.
|
||||
|
||||
tablefile->compress = datafile->compress;
|
||||
tablefile->compresspos = datafile->compresspos;
|
||||
tablefile->numsectors = datafile->numsectors;
|
||||
tablefile->tabledata = NULL;
|
||||
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3OpenTableForWrite(tablefile);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Which table are we writing out?
|
||||
if (retval < 0)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to open table file? Abort
|
||||
|
||||
sprintf(tempblock, "Rebuilding table for %s", datafile->name);
|
||||
ProgressBoxStart(tempblock, datafile->filebytesize);
|
||||
|
||||
stop = 0;
|
||||
mainboxstop = 0;
|
||||
progressboxstop = 0;
|
||||
while ((stop == 0) && (datafile->filebytepos < datafile->filebytesize))
|
||||
{
|
||||
switch (datafile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3Read(datafile, 0, tempblock);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Scanning for the next complete compressed block
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
#ifdef FUNCTION_WARNING_TABLEREBUILD
|
||||
PrintLog("CDVDiso rebuild: failed to decompress - data corrupt");
|
||||
#endif /* FUNCTION_WARNING_TABLEREBUILD */
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
table.offset = datafile->filebytepos - retval;
|
||||
table.size = retval;
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1WriteTable(tablefile, table);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3WriteTable(tablefile, table);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Writing out the relavent table facts
|
||||
if (retval < 0) stop = 1;
|
||||
} // ENDIF- Do we have a valid record to write an entry for?
|
||||
|
||||
ProgressBoxTick(datafile->filebytepos);
|
||||
|
||||
if (mainboxstop != 0) stop = 2;
|
||||
if (progressboxstop != 0) stop = 2;
|
||||
} // ENDWHILE- Read in the data file and writing a table, 1 block at a time
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
CompressClose(tablefile); // Guarentee the table is flushed and closed.
|
||||
if (stop != 0)
|
||||
{
|
||||
ActualFileDelete(tablefile->tablename);
|
||||
} // ENDIF- Aborted or trouble? Delete the table file
|
||||
tablefile = IsoFileClose(tablefile);
|
||||
datafile = IsoFileClose(datafile);
|
||||
|
||||
return;
|
||||
} // END IsoTableRebuild()
|
||||
|
|
|
@ -1,64 +1,28 @@
|
|||
/* tablerebuild.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef TABLEREBUILD_H
|
||||
|
||||
#define TABLEREBUILD_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void IsoTableRebuild(const char *filename);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* TABLEREBUILD_H */
|
||||
|
||||
|
|
|
@ -1,612 +1,308 @@
|
|||
/* blockv2.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdlib.h> // malloc()
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#include "zlib/zlib.h"
|
||||
|
||||
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "isofile.h" // IsoFile
|
||||
|
||||
#include "isocompress.h" // TableData, TableMap
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
#include "blockv2.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
struct BlockV2Header {
|
||||
|
||||
char id[4];
|
||||
|
||||
unsigned int blocksize;
|
||||
|
||||
unsigned int numblocks;
|
||||
|
||||
unsigned int blockoffset;
|
||||
|
||||
struct BlockV2Header
|
||||
{
|
||||
char id[4];
|
||||
unsigned int blocksize;
|
||||
unsigned int numblocks;
|
||||
unsigned int blockoffset;
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2OpenTableForRead(struct IsoFile *isofile) {
|
||||
|
||||
int i;
|
||||
|
||||
int j;
|
||||
|
||||
off64_t offset;
|
||||
|
||||
int tableoffset;
|
||||
|
||||
int retval;
|
||||
|
||||
union TableMap tablemap;
|
||||
|
||||
|
||||
int BlockV2OpenTableForRead(struct IsoFile *isofile)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
off64_t offset;
|
||||
int tableoffset;
|
||||
int retval;
|
||||
union TableMap tablemap;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: OpenTableForRead()");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: OpenTableForRead()");
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
|
||||
|
||||
|
||||
// We pre-read the WHOLE offset table.
|
||||
|
||||
isofile->tabledata = (char *) malloc(isofile->filesectorsize * sizeof(struct TableData));
|
||||
|
||||
if(isofile->tabledata == NULL) {
|
||||
|
||||
// We pre-read the WHOLE offset table.
|
||||
isofile->tabledata = (char *) malloc(isofile->filesectorsize * sizeof(struct TableData));
|
||||
if (isofile->tabledata == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't allocate internal table!");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't allocate internal table!");
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Could not get enough memory to hold table data
|
||||
|
||||
|
||||
|
||||
offset = sizeof(struct BlockV2Header);
|
||||
|
||||
tableoffset = 0;
|
||||
|
||||
for(i = 0; i < isofile->filesectorsize; i++) {
|
||||
|
||||
retval = BlockV2Seek(isofile, offset);
|
||||
|
||||
if(retval != 0) {
|
||||
|
||||
return(-1);
|
||||
} // ENDIF- Could not get enough memory to hold table data
|
||||
offset = sizeof(struct BlockV2Header);
|
||||
tableoffset = 0;
|
||||
for (i = 0; i < isofile->filesectorsize; i++)
|
||||
{
|
||||
retval = BlockV2Seek(isofile, offset);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Failed to find sector %i!", i);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Failed to find sector %i!", i);
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding a lsn id? Fail.
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble finding a lsn id? Fail.
|
||||
|
||||
|
||||
|
||||
retval = ActualFileRead(isofile->handle,
|
||||
|
||||
sizeof(int),
|
||||
|
||||
(char *) &j);
|
||||
|
||||
if(retval != sizeof(int)) {
|
||||
|
||||
retval = ActualFileRead(isofile->handle,
|
||||
sizeof(int),
|
||||
(char *) & j);
|
||||
if (retval != sizeof(int))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Failed to read in sector %i!", i);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Failed to read in sector %i!", i);
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading in a lsn id? Table damaged... fail.
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble reading in a lsn id? Table damaged... fail.
|
||||
|
||||
|
||||
|
||||
tablemap.table.offset = ConvertEndianUInt(j); // Actually, a lsn.
|
||||
|
||||
for(j = 0; j < sizeof(struct TableData); j++)
|
||||
|
||||
*(isofile->tabledata + tableoffset + j) = tablemap.ch[j];
|
||||
|
||||
offset += isofile->blocksize + 4;
|
||||
|
||||
tableoffset += sizeof(struct TableData);
|
||||
|
||||
} // NEXT i- reading in the sizes, and making offset as I go.
|
||||
|
||||
|
||||
|
||||
isofile->tablehandle = ACTUALHANDLENULL;
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
tablemap.table.offset = ConvertEndianUInt(j); // Actually, a lsn.
|
||||
for (j = 0; j < sizeof(struct TableData); j++)
|
||||
*(isofile->tabledata + tableoffset + j) = tablemap.ch[j];
|
||||
offset += isofile->blocksize + 4;
|
||||
tableoffset += sizeof(struct TableData);
|
||||
} // NEXT i- reading in the sizes, and making offset as I go.
|
||||
isofile->tablehandle = ACTUALHANDLENULL;
|
||||
return(0);
|
||||
} // END BlockV2OpenTableForRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2SeekTable(struct IsoFile *isofile, off64_t sector) {
|
||||
|
||||
int i;
|
||||
|
||||
int tableoffset;
|
||||
|
||||
union TableMap tablemap;
|
||||
|
||||
off64_t filesectorstart;
|
||||
|
||||
|
||||
|
||||
int BlockV2SeekTable(struct IsoFile *isofile, off64_t sector)
|
||||
{
|
||||
int i;
|
||||
int tableoffset;
|
||||
union TableMap tablemap;
|
||||
off64_t filesectorstart;
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: SeekTable(%lli)", sector);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: SeekTable(%lli)", sector);
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
if ((isofile->filesectorpos >= 0) &&
|
||||
(isofile->filesectorpos < isofile->filesectorsize))
|
||||
{
|
||||
tableoffset = isofile->filesectorpos * sizeof(struct TableData);
|
||||
for (i = 0; i < sizeof(struct TableData); i++)
|
||||
tablemap.ch[i] = *(isofile->tabledata + tableoffset + i);
|
||||
if (sector == tablemap.table.offset)
|
||||
{
|
||||
return(0);
|
||||
} // ENDIF- Are we already pointing at the right sector?
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->filesectorpos = 0;
|
||||
tablemap.table.offset = -1;
|
||||
} // ENDIF- Is the file sector pointer within table limits?
|
||||
filesectorstart = isofile->filesectorpos;
|
||||
isofile->filesectorpos++;
|
||||
if (isofile->filesectorpos >= isofile->filesectorsize)
|
||||
isofile->filesectorpos = 0;
|
||||
while ((isofile->filesectorpos != filesectorstart) &&
|
||||
(tablemap.table.offset != sector))
|
||||
{
|
||||
tableoffset = isofile->filesectorpos * sizeof(struct TableData);
|
||||
for (i = 0; i < sizeof(struct TableData); i++)
|
||||
tablemap.ch[i] = *(isofile->tabledata + tableoffset + i);
|
||||
if (tablemap.table.offset != sector)
|
||||
{
|
||||
isofile->filesectorpos++;
|
||||
if (isofile->filesectorpos >= isofile->filesectorsize)
|
||||
isofile->filesectorpos = 0;
|
||||
} // ENDIF- Still didn't find it? move to next sector.
|
||||
} // ENDWHILE- Scanning through whole sector list (starting at current pos)
|
||||
|
||||
if (isofile->filesectorpos == filesectorstart)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Did we loop through the whole file... and not find this sector?
|
||||
|
||||
if((isofile->filesectorpos >= 0) &&
|
||||
|
||||
(isofile->filesectorpos < isofile->filesectorsize)) {
|
||||
|
||||
tableoffset = isofile->filesectorpos * sizeof(struct TableData);
|
||||
|
||||
for(i = 0; i < sizeof(struct TableData); i++)
|
||||
|
||||
tablemap.ch[i] = *(isofile->tabledata + tableoffset + i);
|
||||
|
||||
if(sector == tablemap.table.offset) {
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDIF- Are we already pointing at the right sector?
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
tablemap.table.offset = -1;
|
||||
|
||||
} // ENDIF- Is the file sector pointer within table limits?
|
||||
|
||||
|
||||
|
||||
filesectorstart = isofile->filesectorpos;
|
||||
|
||||
isofile->filesectorpos++;
|
||||
|
||||
if(isofile->filesectorpos >= isofile->filesectorsize)
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
while((isofile->filesectorpos != filesectorstart) &&
|
||||
|
||||
(tablemap.table.offset != sector)) {
|
||||
|
||||
tableoffset = isofile->filesectorpos * sizeof(struct TableData);
|
||||
|
||||
for(i = 0; i < sizeof(struct TableData); i++)
|
||||
|
||||
tablemap.ch[i] = *(isofile->tabledata + tableoffset + i);
|
||||
|
||||
|
||||
|
||||
if(tablemap.table.offset != sector) {
|
||||
|
||||
isofile->filesectorpos++;
|
||||
|
||||
if(isofile->filesectorpos >= isofile->filesectorsize)
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
} // ENDIF- Still didn't find it? move to next sector.
|
||||
|
||||
} // ENDWHILE- Scanning through whole sector list (starting at current pos)
|
||||
|
||||
|
||||
|
||||
if(isofile->filesectorpos == filesectorstart) {
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Did we loop through the whole file... and not find this sector?
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
return(0);
|
||||
} // END BlockV2SeekTable()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2ReadTable(struct IsoFile *isofile, struct TableData *table) {
|
||||
|
||||
int BlockV2ReadTable(struct IsoFile *isofile, struct TableData *table)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: ReadTable()");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: ReadTable()");
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
|
||||
|
||||
|
||||
table->offset = sizeof(int) + isofile->blocksize;
|
||||
|
||||
table->offset *= isofile->filesectorpos;
|
||||
|
||||
table->offset += sizeof(struct BlockV2Header) + 4;
|
||||
|
||||
table->size = isofile->blocksize;
|
||||
|
||||
isofile->filesectorpos++;
|
||||
|
||||
return(0);
|
||||
|
||||
table->offset = sizeof(int) + isofile->blocksize;
|
||||
table->offset *= isofile->filesectorpos;
|
||||
table->offset += sizeof(struct BlockV2Header) + 4;
|
||||
table->size = isofile->blocksize;
|
||||
isofile->filesectorpos++;
|
||||
return(0);
|
||||
} // END BlockV2ReadTable()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2OpenTableForWrite(struct IsoFile *isofile) {
|
||||
|
||||
return(-1);
|
||||
|
||||
int BlockV2OpenTableForWrite(struct IsoFile *isofile)
|
||||
{
|
||||
return(-1);
|
||||
} // END BlockV2OpenTableForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2WriteTable(struct IsoFile *isofile, struct TableData table) {
|
||||
|
||||
return(-1);
|
||||
|
||||
int BlockV2WriteTable(struct IsoFile *isofile, struct TableData table)
|
||||
{
|
||||
return(-1);
|
||||
} // END BlockV2WriteTable()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2OpenForRead(struct IsoFile *isofile) {
|
||||
|
||||
int retval;
|
||||
|
||||
struct BlockV2Header header;
|
||||
|
||||
|
||||
int BlockV2OpenForRead(struct IsoFile *isofile)
|
||||
{
|
||||
int retval;
|
||||
struct BlockV2Header header;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: OpenForRead()");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: OpenForRead()");
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
if (isofile->handle == ACTUALHANDLENULL)
|
||||
{
|
||||
return(-1);
|
||||
} // ENDIF- Couldn't open data file? Fail.
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
|
||||
if(isofile->handle == ACTUALHANDLENULL) {
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't open data file? Fail.
|
||||
|
||||
|
||||
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
|
||||
|
||||
isofile->imageheader = 0;
|
||||
|
||||
isofile->numsectors = 1; // Sectors per block
|
||||
|
||||
|
||||
|
||||
retval = ActualFileRead(isofile->handle,
|
||||
|
||||
sizeof(struct BlockV2Header),
|
||||
|
||||
(char *) &header);
|
||||
|
||||
if(retval != sizeof(struct BlockV2Header)) {
|
||||
|
||||
isofile->imageheader = 0;
|
||||
isofile->numsectors = 1; // Sectors per block
|
||||
retval = ActualFileRead(isofile->handle,
|
||||
sizeof(struct BlockV2Header),
|
||||
(char *) & header);
|
||||
if (retval != sizeof(struct BlockV2Header))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't read header!");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't read header!");
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF Could not read the first sector? Fail.
|
||||
isofile->filebytepos += retval;
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF Could not read the first sector? Fail.
|
||||
|
||||
isofile->filebytepos += retval;
|
||||
|
||||
|
||||
|
||||
if((header.id[0] != 'B') ||
|
||||
|
||||
(header.id[1] != 'D') ||
|
||||
|
||||
(header.id[2] != 'V') ||
|
||||
|
||||
(header.id[3] != '2')) {
|
||||
|
||||
if ((header.id[0] != 'B') ||
|
||||
(header.id[1] != 'D') ||
|
||||
(header.id[2] != 'V') ||
|
||||
(header.id[3] != '2'))
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Not a block dump v2 header!");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Not a block dump v2 header!");
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- ID for this compression type doesn't match?
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- ID for this compression type doesn't match?
|
||||
|
||||
|
||||
|
||||
isofile->blocksize = ConvertEndianUInt(header.blocksize);
|
||||
|
||||
// isofile->filesectorsize = ConvertEndianUInt(header.numblocks);
|
||||
|
||||
isofile->blockoffset = ConvertEndianUInt(header.blockoffset);
|
||||
|
||||
isofile->filesectorsize = isofile->filebytesize;
|
||||
|
||||
isofile->filesectorsize -= 16;
|
||||
|
||||
isofile->filesectorsize /= (isofile->blocksize + sizeof(int));
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
return(0);
|
||||
|
||||
isofile->blocksize = ConvertEndianUInt(header.blocksize);
|
||||
// isofile->filesectorsize = ConvertEndianUInt(header.numblocks);
|
||||
isofile->blockoffset = ConvertEndianUInt(header.blockoffset);
|
||||
isofile->filesectorsize = isofile->filebytesize;
|
||||
isofile->filesectorsize -= 16;
|
||||
isofile->filesectorsize /= (isofile->blocksize + sizeof(int));
|
||||
isofile->filesectorpos = 0;
|
||||
return(0);
|
||||
} // END BlockV2OpenForRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2Seek(struct IsoFile *isofile, off64_t position) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
int BlockV2Seek(struct IsoFile *isofile, off64_t position)
|
||||
{
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Seek(%lli)", position);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Seek(%lli)", position);
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
|
||||
|
||||
|
||||
retval = ActualFileSeek(isofile->handle, position);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
retval = ActualFileSeek(isofile->handle, position);
|
||||
if (retval < 0)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't find the start of the block!");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Couldn't find the start of the block!");
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
return(-1);
|
||||
} // ENDIF- Couldn't find the data entry? Fail.
|
||||
isofile->filebytepos = position;
|
||||
return(0);
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't find the data entry? Fail.
|
||||
|
||||
isofile->filebytepos = position;
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
|
||||
return(-1); // Fail. (Due to lack of ambition?)
|
||||
|
||||
return(-1); // Fail. (Due to lack of ambition?)
|
||||
} // END BlockV2Seek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2Read(struct IsoFile *isofile, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
int BlockV2Read(struct IsoFile *isofile, int bytes, char *buffer)
|
||||
{
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Read(%i)", bytes);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Read(%i)", bytes);
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
|
||||
|
||||
|
||||
retval = ActualFileRead(isofile->handle, isofile->blocksize, buffer);
|
||||
|
||||
if(retval > 0) isofile->filebytepos += retval;
|
||||
|
||||
if(retval != isofile->blocksize) {
|
||||
|
||||
retval = ActualFileRead(isofile->handle, isofile->blocksize, buffer);
|
||||
if (retval > 0) isofile->filebytepos += retval;
|
||||
if (retval != isofile->blocksize)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Cannot read bytes! Returned: (%i)", retval);
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Cannot read bytes! Returned: (%i)", retval);
|
||||
#endif /* VERBOSE_WARNING_BLOCKV2 */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading compressed sector? Abort.
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble reading compressed sector? Abort.
|
||||
|
||||
|
||||
|
||||
return(isofile->blocksize);
|
||||
|
||||
return(isofile->blocksize);
|
||||
} // END BlockV2Read()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2OpenForWrite(struct IsoFile *isofile) {
|
||||
|
||||
return(-1);
|
||||
|
||||
int BlockV2OpenForWrite(struct IsoFile *isofile)
|
||||
{
|
||||
return(-1);
|
||||
} // END BlockV2OpenForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int BlockV2Write(struct IsoFile *isofile, char *buffer) {
|
||||
|
||||
return(-1);
|
||||
|
||||
int BlockV2Write(struct IsoFile *isofile, char *buffer)
|
||||
{
|
||||
return(-1);
|
||||
} // END BlockV2Write()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void BlockV2Close(struct IsoFile *isofile) {
|
||||
|
||||
void BlockV2Close(struct IsoFile *isofile)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Close()");
|
||||
|
||||
PrintLog("CDVDiso BlockV2: Close()");
|
||||
#endif /* VERBOSE_FUNCTION_BLOCKV2 */
|
||||
if (isofile->handle != ACTUALHANDLENULL)
|
||||
{
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
} // ENDIF- Is there a data file open? Close it.
|
||||
|
||||
|
||||
|
||||
if(isofile->handle != ACTUALHANDLENULL) {
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
} // ENDIF- Is there a data file open? Close it.
|
||||
|
||||
|
||||
|
||||
if(isofile->tabledata != NULL) {
|
||||
|
||||
free(isofile->tabledata);
|
||||
|
||||
isofile->tabledata = NULL;
|
||||
|
||||
} // ENDIF- Do we have a read-in table to clear out?
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
if (isofile->tabledata != NULL)
|
||||
{
|
||||
free(isofile->tabledata);
|
||||
isofile->tabledata = NULL;
|
||||
} // ENDIF- Do we have a read-in table to clear out?
|
||||
return;
|
||||
} // END BlockV2Close()
|
||||
|
||||
|
|
|
@ -1,104 +1,46 @@
|
|||
/* blockv2.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BLOCKV2_H
|
||||
|
||||
#define BLOCKV2_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_BLOCKV2
|
||||
|
||||
// #define VERBOSE_WARNING_BLOCKV2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int BlockV2OpenTableForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BlockV2SeekTable(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BlockV2ReadTable(struct IsoFile *isofile, struct TableData *table);
|
||||
|
||||
|
||||
|
||||
extern int BlockV2OpenTableForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BlockV2WriteTable(struct IsoFile *isofile, struct TableData table);
|
||||
|
||||
|
||||
|
||||
extern int BlockV2OpenForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BlockV2Seek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BlockV2Read(struct IsoFile *isofile, int bytes, char *buffer);
|
||||
|
||||
extern void BlockV2Close(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int BlockV2OpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BlockV2Write(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* BLOCKV2_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +1,46 @@
|
|||
/* bzip2v2.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BZIP2V2_H
|
||||
|
||||
#define BZIP2V2_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_BZIP2V2
|
||||
|
||||
// #define VERBOSE_WARNING_BZIP2V2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int BZip2V2OpenTableForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V2SeekTable(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BZip2V2ReadTable(struct IsoFile *isofile, struct TableData *table);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V2OpenTableForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V2WriteTable(struct IsoFile *isofile, struct TableData table);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V2OpenForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V2Seek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BZip2V2Read(struct IsoFile *isofile, int bytes, char *buffer);
|
||||
|
||||
extern void BZip2V2Close(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V2OpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V2Write(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* BZIP2V2_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +1,46 @@
|
|||
/* bzip2v3.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BZIP2V3_H
|
||||
|
||||
#define BZIP2V3_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_BZIP2V3
|
||||
|
||||
// #define VERBOSE_WARNING_BZIP2V3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int BZip2V3OpenTableForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V3SeekTable(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BZip2V3ReadTable(struct IsoFile *isofile, struct TableData *table);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V3OpenTableForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V3WriteTable(struct IsoFile *isofile, struct TableData table);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V3OpenForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V3Seek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int BZip2V3Read(struct IsoFile *isofile, int bytes, char *buffer);
|
||||
|
||||
extern void BZip2V3Close(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int BZip2V3OpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int BZip2V3Write(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* BZIP2V3_H */
|
||||
|
||||
|
|
|
@ -17,102 +17,95 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
|
||||
off64_t ConvertEndianOffset(off64_t number) {
|
||||
off64_t ConvertEndianOffset(off64_t number)
|
||||
{
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
union {
|
||||
off64_t n;
|
||||
char c[sizeof(off64_t)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
|
||||
oldnumber.n = number;
|
||||
for(i = 0; i < sizeof(off64_t); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(off64_t) - 1 - i];
|
||||
return(newnumber.n);
|
||||
union
|
||||
{
|
||||
off64_t n;
|
||||
char c[sizeof(off64_t)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
oldnumber.n = number;
|
||||
for (i = 0; i < sizeof(off64_t); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(off64_t) - 1 - i];
|
||||
return(newnumber.n);
|
||||
#else
|
||||
return(number);
|
||||
return(number);
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
} // END ConvertEndianOffset()
|
||||
|
||||
|
||||
unsigned int ConvertEndianUInt(unsigned int number) {
|
||||
unsigned int ConvertEndianUInt(unsigned int number)
|
||||
{
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
union {
|
||||
unsigned int n;
|
||||
char c[sizeof(unsigned int)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
union
|
||||
{
|
||||
unsigned int n;
|
||||
char c[sizeof(unsigned int)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
|
||||
oldnumber.n = number;
|
||||
for(i = 0; i < sizeof(unsigned int); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned int) - 1 - i];
|
||||
return(newnumber.n);
|
||||
oldnumber.n = number;
|
||||
for (i = 0; i < sizeof(unsigned int); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned int) - 1 - i];
|
||||
return(newnumber.n);
|
||||
#else
|
||||
return(number);
|
||||
return(number);
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
} // END ConvertEndianUInt()
|
||||
|
||||
|
||||
unsigned short ConvertEndianUShort(unsigned short number) {
|
||||
unsigned short ConvertEndianUShort(unsigned short number)
|
||||
{
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
union {
|
||||
unsigned short n;
|
||||
char c[sizeof(unsigned short)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
|
||||
oldnumber.n = number;
|
||||
for(i = 0; i < sizeof(unsigned short); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned short) - 1 - i];
|
||||
return(newnumber.n);
|
||||
union
|
||||
{
|
||||
unsigned short n;
|
||||
char c[sizeof(unsigned short)];
|
||||
} oldnumber, newnumber;
|
||||
int i;
|
||||
oldnumber.n = number;
|
||||
for (i = 0; i < sizeof(unsigned short); i++)
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned short) - 1 - i];
|
||||
return(newnumber.n);
|
||||
#else
|
||||
return(number);
|
||||
return(number);
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
} // END ConvertEndianUShort()
|
||||
|
||||
|
||||
// Note: deposits M/S/F data in buffer[0]/[1]/[2] respectively.
|
||||
void LBAtoMSF(unsigned long lsn, char *buffer) {
|
||||
unsigned long templsn;
|
||||
void LBAtoMSF(unsigned long lsn, char *buffer)
|
||||
{
|
||||
unsigned long templsn;
|
||||
|
||||
if(lsn >= 0xFFFFFFFF - 150) {
|
||||
*(buffer + 2) = 75-1;
|
||||
*(buffer + 1) = 60-1;
|
||||
*(buffer) = 100-1;
|
||||
} // ENDIF- Out of range?
|
||||
if (lsn >= 0xFFFFFFFF - 150)
|
||||
{
|
||||
*(buffer + 2) = 75 - 1;
|
||||
*(buffer + 1) = 60 - 1;
|
||||
*(buffer) = 100 - 1;
|
||||
} // ENDIF- Out of range?
|
||||
|
||||
templsn = lsn;
|
||||
templsn += 150; // 2 second offset (75 Frames * 2 Seconds)
|
||||
*(buffer + 2) = templsn % 75; // Remainder in frames
|
||||
templsn -= *(buffer + 2);
|
||||
templsn /= 75;
|
||||
*(buffer + 1) = templsn % 60; // Remainder in seconds
|
||||
templsn -= *(buffer + 1);
|
||||
templsn /= 60;
|
||||
*(buffer) = templsn; // Leftover quotient in minutes
|
||||
templsn = lsn;
|
||||
templsn += 150; // 2 second offset (75 Frames * 2 Seconds)
|
||||
*(buffer + 2) = templsn % 75; // Remainder in frames
|
||||
templsn -= *(buffer + 2);
|
||||
templsn /= 75;
|
||||
*(buffer + 1) = templsn % 60; // Remainder in seconds
|
||||
templsn -= *(buffer + 1);
|
||||
templsn /= 60;
|
||||
*(buffer) = templsn; // Leftover quotient in minutes
|
||||
} // END LBAtoMSF()
|
||||
|
||||
|
||||
unsigned long MSFtoLBA(char *buffer) {
|
||||
unsigned long templsn;
|
||||
|
||||
if(buffer == NULL) return(0xFFFFFFFF);
|
||||
|
||||
templsn = *(buffer); // Minutes
|
||||
templsn *= 60;
|
||||
templsn += *(buffer + 1); // Seconds
|
||||
templsn *= 75;
|
||||
templsn += *(buffer + 2); // Frames
|
||||
if(templsn < 150) return(0xFFFFFFFF);
|
||||
templsn -= 150; // Offset
|
||||
|
||||
return(templsn);
|
||||
unsigned long MSFtoLBA(char *buffer)
|
||||
{
|
||||
unsigned long templsn;
|
||||
if (buffer == NULL) return(0xFFFFFFFF);
|
||||
templsn = *(buffer); // Minutes
|
||||
templsn *= 60;
|
||||
templsn += *(buffer + 1); // Seconds
|
||||
templsn *= 75;
|
||||
templsn += *(buffer + 2); // Frames
|
||||
if (templsn < 150) return(0xFFFFFFFF);
|
||||
templsn -= 150; // Offset
|
||||
return(templsn);
|
||||
} // END MSFtoLBA()
|
||||
|
|
|
@ -17,12 +17,9 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CONVERT_H
|
||||
#define CONVERT_H
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
#include "PS2Etypes.h"
|
||||
#ifdef __linux__
|
||||
|
@ -31,19 +28,15 @@
|
|||
#define CONVERTLITTLEENDIAN
|
||||
#endif /* __BYTE_ORDER */
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CONVERTLITTLEENDIAN
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define HEXTOBCD(i) (((i)/10*16) + ((i)%10))
|
||||
#define BCDTOHEX(i) (((i)/16*10) + ((i)%16))
|
||||
|
||||
|
||||
extern off64_t ConvertEndianOffset(off64_t number);
|
||||
extern unsigned int ConvertEndianUInt(unsigned int number);
|
||||
extern unsigned short ConvertEndianUShort(unsigned short number);
|
||||
|
||||
extern void LBAtoMSF(unsigned long lsn, char *buffer);
|
||||
extern unsigned long MSFtoLBA(char *buffer);
|
||||
|
||||
|
|
|
@ -1,118 +1,60 @@
|
|||
/* ecma119.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "ecma119.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char ECMA119VolumeIDstdid[] = "CD001\0";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ValidateECMA119PrimaryVolume(struct ECMA119PrimaryVolume *volume) {
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
if(volume == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
// Volume ID
|
||||
|
||||
if(volume->id.voltype != 1) return(-1); // Incorrect volume type
|
||||
|
||||
if(volume->id.version != 1) return(-1); // Not a Standard Version?
|
||||
|
||||
i = 0;
|
||||
|
||||
while((ECMA119VolumeIDstdid[i] != 0) &&
|
||||
|
||||
(ECMA119VolumeIDstdid[i] == volume->id.stdid[i])) i++;
|
||||
|
||||
if(ECMA119VolumeIDstdid[i] != 0) return(-1); // "CD001" did not match?
|
||||
|
||||
|
||||
|
||||
// Looks like numblocksle might give us maximum sector count...
|
||||
|
||||
// Looks like blocksizele can be compared to blocksize stored in isofile...
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END ValidateECMA119PrimaryVolume()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Not sure the Partition Volume will be much help...
|
||||
|
||||
/* ecma119.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// #ifndef __LINUX__
|
||||
// #ifdef __linux__
|
||||
// #define __LINUX__
|
||||
// #endif /* __linux__ */
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
// #define CDVDdefs
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
#include "ecma119.h"
|
||||
|
||||
|
||||
const char ECMA119VolumeIDstdid[] = "CD001\0";
|
||||
|
||||
|
||||
int ValidateECMA119PrimaryVolume(struct ECMA119PrimaryVolume *volume)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (volume == NULL) return(-1);
|
||||
|
||||
// Volume ID
|
||||
if (volume->id.voltype != 1) return(-1); // Incorrect volume type
|
||||
if (volume->id.version != 1) return(-1); // Not a Standard Version?
|
||||
i = 0;
|
||||
while ((ECMA119VolumeIDstdid[i] != 0) &&
|
||||
(ECMA119VolumeIDstdid[i] == volume->id.stdid[i])) i++;
|
||||
if (ECMA119VolumeIDstdid[i] != 0) return(-1); // "CD001" did not match?
|
||||
|
||||
// Looks like numblocksle might give us maximum sector count...
|
||||
// Looks like blocksizele can be compared to blocksize stored in isofile...
|
||||
|
||||
return(0);
|
||||
} // END ValidateECMA119PrimaryVolume()
|
||||
|
||||
|
||||
// Not sure the Partition Volume will be much help...
|
||||
|
|
|
@ -1,468 +1,217 @@
|
|||
/* ecma119.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ECMA119_H
|
||||
|
||||
#define ECMA119_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ECMA119 was sent to ISO to be fast-tracked into ISO 9660
|
||||
|
||||
// ECMA119 can be found at http://www.ecma.ch, somewhere.
|
||||
|
||||
|
||||
|
||||
// Throughout these definitions, number pairs in both big-endian and
|
||||
|
||||
// little-endian varieties are stored next to each other. To separate
|
||||
|
||||
// the pairs a 'le' suffix has been attached to little-endian numbers, and
|
||||
|
||||
// a 'be' suffix to big-endian ones.
|
||||
|
||||
|
||||
|
||||
// All 'unused' entries should be set to (or tested for) 0x00.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
struct ECMA119ASCIITime {
|
||||
|
||||
char year[4];
|
||||
|
||||
char month[2];
|
||||
|
||||
char day[2];
|
||||
|
||||
char hour[2];
|
||||
|
||||
char min[2];
|
||||
|
||||
char sec[2];
|
||||
|
||||
char hundredthsec[2];
|
||||
|
||||
char offsetgmt; // 15 min intervals, from -48 to +52
|
||||
|
||||
struct ECMA119ASCIITime
|
||||
{
|
||||
char year[4];
|
||||
char month[2];
|
||||
char day[2];
|
||||
char hour[2];
|
||||
char min[2];
|
||||
char sec[2];
|
||||
char hundredthsec[2];
|
||||
char offsetgmt; // 15 min intervals, from -48 to +52
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
struct ECMA119DateTime {
|
||||
|
||||
unsigned char year; // 1900+year, that is.
|
||||
|
||||
unsigned char month;
|
||||
|
||||
unsigned char day;
|
||||
|
||||
unsigned char hour;
|
||||
|
||||
unsigned char minute;
|
||||
|
||||
unsigned char sec;
|
||||
|
||||
signed char offsetgmt; // In 15 min intervals, from -48 to +52
|
||||
|
||||
struct ECMA119DateTime
|
||||
{
|
||||
unsigned char year; // 1900+year, that is.
|
||||
unsigned char month;
|
||||
unsigned char day;
|
||||
unsigned char hour;
|
||||
unsigned char minute;
|
||||
unsigned char sec;
|
||||
signed char offsetgmt; // In 15 min intervals, from -48 to +52
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
struct ECMA119DirectoryRecord
|
||||
{
|
||||
unsigned char reclen; // Length of this record
|
||||
unsigned char attlen; // Extended Attribute Record Length
|
||||
|
||||
unsigned long externlocle; // Location of Extent
|
||||
unsigned long externlocbe;
|
||||
struct ECMA119DateTime recorded; // Recording Date and Time
|
||||
unsigned char flags; // File Flags
|
||||
unsigned char interleave; // Interleave Gap Size
|
||||
|
||||
struct ECMA119DirectoryRecord {
|
||||
|
||||
unsigned char reclen; // Length of this record
|
||||
|
||||
unsigned char attlen; // Extended Attribute Record Length
|
||||
|
||||
|
||||
|
||||
unsigned long externlocle; // Location of Extent
|
||||
|
||||
unsigned long externlocbe;
|
||||
|
||||
|
||||
|
||||
struct ECMA119DateTime recorded; // Recording Date and Time
|
||||
|
||||
|
||||
|
||||
unsigned char flags; // File Flags
|
||||
|
||||
unsigned char interleave; // Interleave Gap Size
|
||||
|
||||
|
||||
|
||||
unsigned short seqnole; // Volume Sequence No.
|
||||
|
||||
unsigned short seqnobe;
|
||||
|
||||
|
||||
|
||||
unsigned short idlen;
|
||||
|
||||
char id[223];
|
||||
|
||||
// Note: sometimes a OS uses the end of this record for it's own use.
|
||||
|
||||
unsigned short seqnole; // Volume Sequence No.
|
||||
unsigned short seqnobe;
|
||||
unsigned short idlen;
|
||||
char id[223];
|
||||
// Note: sometimes a OS uses the end of this record for it's own use.
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
struct ECMA119RootDirectoryRecord
|
||||
{
|
||||
unsigned char reclen; // Length of this record
|
||||
unsigned char attlen; // Extended Attribute Record Length
|
||||
|
||||
unsigned long externlocle; // Location of Extent
|
||||
unsigned long externlocbe;
|
||||
struct ECMA119DateTime recorded; // Recording Date and Time
|
||||
unsigned char flags; // File Flags
|
||||
unsigned char interleave; // Interleave Gap Size
|
||||
|
||||
struct ECMA119RootDirectoryRecord {
|
||||
|
||||
unsigned char reclen; // Length of this record
|
||||
|
||||
unsigned char attlen; // Extended Attribute Record Length
|
||||
|
||||
|
||||
|
||||
unsigned long externlocle; // Location of Extent
|
||||
|
||||
unsigned long externlocbe;
|
||||
|
||||
|
||||
|
||||
struct ECMA119DateTime recorded; // Recording Date and Time
|
||||
|
||||
|
||||
|
||||
unsigned char flags; // File Flags
|
||||
|
||||
unsigned char interleave; // Interleave Gap Size
|
||||
|
||||
|
||||
|
||||
unsigned short seqnole; // Volume Sequence No.
|
||||
|
||||
unsigned short seqnobe;
|
||||
|
||||
|
||||
|
||||
unsigned short idlen;
|
||||
|
||||
char id[1]; // Probably for the '.' (But I'm just guessing :)
|
||||
|
||||
unsigned short seqnole; // Volume Sequence No.
|
||||
unsigned short seqnobe;
|
||||
unsigned short idlen;
|
||||
char id[1]; // Probably for the '.' (But I'm just guessing :)
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
struct ECMA119VolumeID
|
||||
{
|
||||
unsigned char voltype;
|
||||
// 0 = Boot Record
|
||||
// 1 = Primary Volume Descriptor (PrimaryVolume below)
|
||||
// 2 = Supplementary Volume Descriptor
|
||||
// 3 = Partition Descriptor (PartitionVolume below)
|
||||
// 4 - 254 Reserved
|
||||
// 255 = End-of-Descriptor-Set
|
||||
|
||||
char stdid[5]; // Standard Identifier. Always "CD001"
|
||||
|
||||
|
||||
struct ECMA119VolumeID {
|
||||
|
||||
unsigned char voltype;
|
||||
|
||||
// 0 = Boot Record
|
||||
|
||||
// 1 = Primary Volume Descriptor (PrimaryVolume below)
|
||||
|
||||
// 2 = Supplementary Volume Descriptor
|
||||
|
||||
// 3 = Partition Descriptor (PartitionVolume below)
|
||||
|
||||
// 4 - 254 Reserved
|
||||
|
||||
// 255 = End-of-Descriptor-Set
|
||||
|
||||
|
||||
|
||||
char stdid[5]; // Standard Identifier. Always "CD001"
|
||||
|
||||
|
||||
|
||||
unsigned char version;
|
||||
|
||||
unsigned char version;
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
struct ECMA119PrimaryVolume
|
||||
{
|
||||
struct ECMA119VolumeID id;
|
||||
// id.voltype should be 1 (for this type of volume)
|
||||
// id.version should be 1 (standard)
|
||||
|
||||
char unused1;
|
||||
|
||||
char systemid[32];
|
||||
char volumeid[32];
|
||||
char unused2[8];
|
||||
unsigned long numblocksle; // Total logical blocks. (on Media? or just
|
||||
unsigned long numblocksbe; // in volume?)
|
||||
|
||||
struct ECMA119PrimaryVolume {
|
||||
char unused3[32];
|
||||
|
||||
struct ECMA119VolumeID id;
|
||||
unsigned short volumesetsizele; // Volume Set size of the volume. (?)
|
||||
unsigned short volumesetsizebe;
|
||||
unsigned short ordinalle; // Count of which descriptor this is in the Volume
|
||||
unsigned short ordinalbe; // set.
|
||||
|
||||
// id.voltype should be 1 (for this type of volume)
|
||||
unsigned short blocksizele; // Size of a Logical Block
|
||||
unsigned short blocksizebe;
|
||||
unsigned long pathtablesizele; // Path Table Size
|
||||
unsigned long pathtablesizebe;
|
||||
|
||||
// id.version should be 1 (standard)
|
||||
unsigned long typelpathtablelocation; // (le) Location of a Type L Path Table
|
||||
|
||||
unsigned long typelopttablelocation; // (le) Location of an Optional Type L
|
||||
|
||||
unsigned long typempathtablelocation; // (be) Location of a Type M Path Table
|
||||
|
||||
char unused1;
|
||||
unsigned long typemopttablelocation; // (be) Location of an Optional Type M
|
||||
|
||||
struct ECMA119RootDirectoryRecord root;
|
||||
|
||||
char volumesetid[128]; // Volume Set ID
|
||||
|
||||
char systemid[32];
|
||||
char publisher[128]; // Publisher
|
||||
|
||||
char volumeid[32];
|
||||
char datapreparer[128]; // Data Preparer
|
||||
|
||||
char application[128]; // Application ID
|
||||
|
||||
char copyrightfile[37]; // Copyright File Identifier
|
||||
|
||||
char unused2[8];
|
||||
char abstractfile[37]; // Abstract File Identifier
|
||||
|
||||
char bibliograchicfile[37]; // Bibliographic File Identifier
|
||||
|
||||
struct ECMA119ASCIITime volcreatedate; // Date Created
|
||||
struct ECMA119ASCIITime volmodifydate; // Last Date Modified
|
||||
struct ECMA119ASCIITime volexpiredate; // Date data expires
|
||||
struct ECMA119ASCIITime voleffectivedata; // Date data becomes accurate (effective)
|
||||
unsigned char filestructversion; // File Structure Version
|
||||
// Should be 1 = Standard
|
||||
|
||||
unsigned long numblocksle; // Total logical blocks. (on Media? or just
|
||||
char unused4;
|
||||
|
||||
unsigned long numblocksbe; // in volume?)
|
||||
|
||||
|
||||
|
||||
char unused3[32];
|
||||
|
||||
|
||||
|
||||
unsigned short volumesetsizele; // Volume Set size of the volume. (?)
|
||||
|
||||
unsigned short volumesetsizebe;
|
||||
|
||||
|
||||
|
||||
unsigned short ordinalle; // Count of which descriptor this is in the Volume
|
||||
|
||||
unsigned short ordinalbe; // set.
|
||||
|
||||
|
||||
|
||||
unsigned short blocksizele; // Size of a Logical Block
|
||||
|
||||
unsigned short blocksizebe;
|
||||
|
||||
|
||||
|
||||
unsigned long pathtablesizele; // Path Table Size
|
||||
|
||||
unsigned long pathtablesizebe;
|
||||
|
||||
|
||||
|
||||
unsigned long typelpathtablelocation; // (le) Location of a Type L Path Table
|
||||
|
||||
|
||||
|
||||
unsigned long typelopttablelocation; // (le) Location of an Optional Type L
|
||||
|
||||
|
||||
|
||||
unsigned long typempathtablelocation; // (be) Location of a Type M Path Table
|
||||
|
||||
|
||||
|
||||
unsigned long typemopttablelocation; // (be) Location of an Optional Type M
|
||||
|
||||
|
||||
|
||||
struct ECMA119RootDirectoryRecord root;
|
||||
|
||||
|
||||
|
||||
char volumesetid[128]; // Volume Set ID
|
||||
|
||||
|
||||
|
||||
char publisher[128]; // Publisher
|
||||
|
||||
|
||||
|
||||
char datapreparer[128]; // Data Preparer
|
||||
|
||||
|
||||
|
||||
char application[128]; // Application ID
|
||||
|
||||
|
||||
|
||||
char copyrightfile[37]; // Copyright File Identifier
|
||||
|
||||
|
||||
|
||||
char abstractfile[37]; // Abstract File Identifier
|
||||
|
||||
|
||||
|
||||
char bibliograchicfile[37]; // Bibliographic File Identifier
|
||||
|
||||
|
||||
|
||||
struct ECMA119ASCIITime volcreatedate; // Date Created
|
||||
|
||||
struct ECMA119ASCIITime volmodifydate; // Last Date Modified
|
||||
|
||||
struct ECMA119ASCIITime volexpiredate; // Date data expires
|
||||
|
||||
struct ECMA119ASCIITime voleffectivedata; // Date data becomes accurate (effective)
|
||||
|
||||
|
||||
|
||||
unsigned char filestructversion; // File Structure Version
|
||||
|
||||
// Should be 1 = Standard
|
||||
|
||||
|
||||
|
||||
char unused4;
|
||||
|
||||
|
||||
|
||||
char applicationuse[512]; // For use by an application
|
||||
|
||||
|
||||
|
||||
char unused5[653]; // Rounds this out to 2048 bytes...
|
||||
char applicationuse[512]; // For use by an application
|
||||
|
||||
char unused5[653]; // Rounds this out to 2048 bytes...
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
// struct ECMA119PartitionVolume {
|
||||
|
||||
// struct ECMA119VolumeID id;
|
||||
|
||||
// #ifdef _WIN32
|
||||
|
||||
// };
|
||||
|
||||
// #else
|
||||
|
||||
// } __attribute__ ((packed));
|
||||
|
||||
// #endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int ValidateECMA119PrimaryVolume(struct ECMA119PrimaryVolume *volume);
|
||||
|
||||
// extern int ValidateECMA119PartitionVolume(struct ECMA119PartitionVolume volume);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ECMA119_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +1,46 @@
|
|||
/* gzipv1.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef GZIPV1_H
|
||||
|
||||
#define GZIPV1_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_GZIPV1
|
||||
|
||||
// #define VERBOSE_WARNING_GZIPV1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int GZipV1OpenTableForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV1SeekTable(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int GZipV1ReadTable(struct IsoFile *isofile, struct TableData *table);
|
||||
|
||||
|
||||
|
||||
extern int GZipV1OpenTableForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV1WriteTable(struct IsoFile *isofile, struct TableData table);
|
||||
|
||||
|
||||
|
||||
extern int GZipV1OpenForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV1Seek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int GZipV1Read(struct IsoFile *isofile, int bytes, char *buffer);
|
||||
|
||||
extern void GZipV1Close(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int GZipV1OpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV1Write(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* GZIPV1_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +1,46 @@
|
|||
/* gzipv2.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef GZIPV2_H
|
||||
|
||||
#define GZIPV2_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_GZIPV2
|
||||
|
||||
// #define VERBOSE_WARNING_GZIPV2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int GZipV2OpenTableForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV2SeekTable(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int GZipV2ReadTable(struct IsoFile *isofile, struct TableData *table);
|
||||
|
||||
|
||||
|
||||
extern int GZipV2OpenTableForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV2WriteTable(struct IsoFile *isofile, struct TableData table);
|
||||
|
||||
|
||||
|
||||
extern int GZipV2OpenForRead(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV2Seek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int GZipV2Read(struct IsoFile *isofile, int bytes, char *buffer);
|
||||
|
||||
extern void GZipV2Close(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int GZipV2OpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int GZipV2Write(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* GZIPV2_H */
|
||||
|
||||
|
|
|
@ -1,306 +1,154 @@
|
|||
/* imagetype.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
#include "imagetype.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Based (mostly) off of florin's CDVDbin detection code, twice removed
|
||||
|
||||
// with some additions from the <linux/cdrom.h> header.
|
||||
|
||||
struct ImageTypes imagedata[] = {
|
||||
|
||||
{ "ISO 2048", 2048, 0, 0, 0 },
|
||||
|
||||
{ "YellowBook 2064", 2064, 0, 16, 1 },
|
||||
|
||||
{ "RAW 2064", 2064, 0, 0, 2 },
|
||||
|
||||
{ "GreenBook 2072", 2072, 0, 24, 3 },
|
||||
|
||||
{ "RAW 2072", 2072, 0, 0, 4 },
|
||||
|
||||
{ "RAW 2324", 2324, 0, 0, 5 },
|
||||
|
||||
{ "RAW 2328", 2328, 0, 0, 6 },
|
||||
|
||||
{ "RAW 2336", 2336, 0, 0, 7 },
|
||||
|
||||
{ "GreenBook 2352", 2352, 0, 24, 8 },
|
||||
|
||||
{ "YellowBook 2352", 2352, 0, 16, 9 },
|
||||
|
||||
{ "RedBook 2352", 2352, 0, 0, 10 },
|
||||
|
||||
{ "RAWQ 2448", 2448, 0, 0, 11 },
|
||||
|
||||
|
||||
|
||||
{ "NERO ISO 2048", 2048, 150*2048, 0, 0 },
|
||||
|
||||
{ "NERO GreenBook 2352", 2352, 150*2352, 24, 8 },
|
||||
|
||||
{ "NERO YellowBook 2352", 2352, 150*2352, 16, 9 },
|
||||
|
||||
{ "NERO RedBook 2352", 2352, 150*2352, 0, 10 },
|
||||
|
||||
{ "NERO RAWQ 2448", 2448, 150*2448, 0, 11 },
|
||||
|
||||
|
||||
|
||||
{ "Alt ISO 2048", 2048, 8, 0, 0 },
|
||||
|
||||
{ "Alt RAW 2336", 2336, 8, 0, 7 },
|
||||
|
||||
{ "Alt GreenBook 2352", 2352, 8, 24, 8 },
|
||||
|
||||
{ "Alt YellowBook 2352", 2352, 8, 16, 9 },
|
||||
|
||||
{ "Alt RedBook 2352", 2352, 8, 0, 10 },
|
||||
|
||||
{ "Alt RAWQ 2448", 2448, 8, 0, 11 },
|
||||
|
||||
{ NULL, 0, 0, 0, 0 }
|
||||
|
||||
struct ImageTypes imagedata[] =
|
||||
{
|
||||
{ "ISO 2048", 2048, 0, 0, 0 },
|
||||
{ "YellowBook 2064", 2064, 0, 16, 1 },
|
||||
{ "RAW 2064", 2064, 0, 0, 2 },
|
||||
{ "GreenBook 2072", 2072, 0, 24, 3 },
|
||||
{ "RAW 2072", 2072, 0, 0, 4 },
|
||||
{ "RAW 2324", 2324, 0, 0, 5 },
|
||||
{ "RAW 2328", 2328, 0, 0, 6 },
|
||||
{ "RAW 2336", 2336, 0, 0, 7 },
|
||||
{ "GreenBook 2352", 2352, 0, 24, 8 },
|
||||
{ "YellowBook 2352", 2352, 0, 16, 9 },
|
||||
{ "RedBook 2352", 2352, 0, 0, 10 },
|
||||
{ "RAWQ 2448", 2448, 0, 0, 11 },
|
||||
{ "NERO ISO 2048", 2048, 150*2048, 0, 0 },
|
||||
{ "NERO GreenBook 2352", 2352, 150*2352, 24, 8 },
|
||||
{ "NERO YellowBook 2352", 2352, 150*2352, 16, 9 },
|
||||
{ "NERO RedBook 2352", 2352, 150*2352, 0, 10 },
|
||||
{ "NERO RAWQ 2448", 2448, 150*2448, 0, 11 },
|
||||
{ "Alt ISO 2048", 2048, 8, 0, 0 },
|
||||
{ "Alt RAW 2336", 2336, 8, 0, 7 },
|
||||
{ "Alt GreenBook 2352", 2352, 8, 24, 8 },
|
||||
{ "Alt YellowBook 2352", 2352, 8, 16, 9 },
|
||||
{ "Alt RedBook 2352", 2352, 8, 0, 10 },
|
||||
{ "Alt RAWQ 2448", 2448, 8, 0, 11 },
|
||||
{ NULL, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define REDBOOK2352 10
|
||||
|
||||
void GetImageType(struct IsoFile *isofile, int imagetype)
|
||||
{
|
||||
int temptype;
|
||||
int i;
|
||||
|
||||
temptype = imagetype;
|
||||
if ((temptype < 0) || (temptype > 22)) temptype = REDBOOK2352;
|
||||
i = 0;
|
||||
while ((i < 40) && (*(imagedata[temptype].name + i) != 0))
|
||||
{
|
||||
isofile->imagename[i] = *(imagedata[temptype].name + i);
|
||||
i++;
|
||||
} // ENDWHILE- filling in the image name
|
||||
isofile->imagename[i] = 0; // And 0-terminate.
|
||||
|
||||
|
||||
|
||||
void GetImageType(struct IsoFile *isofile, int imagetype) {
|
||||
|
||||
int temptype;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
temptype = imagetype;
|
||||
|
||||
if((temptype < 0) || (temptype > 22)) temptype = REDBOOK2352;
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 40) && (*(imagedata[temptype].name + i) != 0)) {
|
||||
|
||||
isofile->imagename[i] = *(imagedata[temptype].name + i);
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- filling in the image name
|
||||
|
||||
isofile->imagename[i] = 0; // And 0-terminate.
|
||||
|
||||
|
||||
|
||||
isofile->blocksize = imagedata[temptype].blocksize;
|
||||
|
||||
isofile->imageheader = imagedata[temptype].fileoffset;
|
||||
|
||||
isofile->blockoffset = imagedata[temptype].dataoffset;
|
||||
|
||||
isofile->blocksize = imagedata[temptype].blocksize;
|
||||
isofile->imageheader = imagedata[temptype].fileoffset;
|
||||
isofile->blockoffset = imagedata[temptype].dataoffset;
|
||||
} // END GetImageType()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int GetImageTypeConvertTo(int imagetype) {
|
||||
|
||||
return(imagedata[imagetype].conversiontype);
|
||||
|
||||
int GetImageTypeConvertTo(int imagetype)
|
||||
{
|
||||
return(imagedata[imagetype].conversiontype);
|
||||
} // END GetImageTypeConvertTo()
|
||||
|
||||
int DetectImageType(struct IsoFile *isofile)
|
||||
{
|
||||
char comparestr[] = "CD001";
|
||||
int newtype;
|
||||
off64_t targetpos;
|
||||
char teststr[2448];
|
||||
int dataoffset;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
|
||||
int DetectImageType(struct IsoFile *isofile) {
|
||||
|
||||
char comparestr[] = "CD001";
|
||||
|
||||
int newtype;
|
||||
|
||||
off64_t targetpos;
|
||||
|
||||
char teststr[2448];
|
||||
|
||||
int dataoffset;
|
||||
|
||||
int i;
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
newtype = 0;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
IsoFileSeek(isofile, 16);
|
||||
|
||||
IsoFileRead(isofile, teststr);
|
||||
|
||||
|
||||
|
||||
while(imagedata[newtype].name != NULL) {
|
||||
|
||||
if((isofile->blocksize == imagedata[newtype].blocksize) &&
|
||||
|
||||
(isofile->imageheader == imagedata[newtype].fileoffset)) {
|
||||
|
||||
dataoffset = imagedata[newtype].dataoffset + 1;
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 5) && (teststr[dataoffset + i] == comparestr[i])) i++;
|
||||
|
||||
if(i == 5) {
|
||||
|
||||
GetImageType(isofile, newtype);
|
||||
|
||||
return(newtype);
|
||||
|
||||
} // ENDIF- Did we find a match?
|
||||
|
||||
} // ENDIF- Do these pieces match the compression storage pieces?
|
||||
|
||||
newtype++;
|
||||
|
||||
} // ENDWHILE- looking for the image type that fits the stats
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
while(imagedata[newtype].name != NULL) {
|
||||
|
||||
targetpos = (16 * imagedata[newtype].blocksize)
|
||||
|
||||
+ imagedata[newtype].fileoffset
|
||||
|
||||
+ imagedata[newtype].dataoffset
|
||||
|
||||
+ 1; // Moves to start of string
|
||||
|
||||
retval = ActualFileSeek(isofile->handle, targetpos);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
retval = ActualFileRead(isofile->handle, 5, teststr);
|
||||
|
||||
if(retval == 5) {
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 5) && (teststr[i] == comparestr[i])) i++;
|
||||
|
||||
if(i == 5) {
|
||||
|
||||
ActualFileSeek(isofile->handle, isofile->imageheader);
|
||||
|
||||
GetImageType(isofile, newtype);
|
||||
|
||||
return(newtype);
|
||||
|
||||
} // ENDIF- Did we find a match?
|
||||
|
||||
} // ENDIF- Could we read in the test string? Cool! Test it.
|
||||
|
||||
} // ENDIF- Could actually get to this point?
|
||||
|
||||
newtype++;
|
||||
|
||||
} // ENDWHILE- looking for the directory header string "CD001"
|
||||
|
||||
ActualFileSeek(isofile->handle, isofile->imageheader);
|
||||
|
||||
} // ENDIF- Do we match type to compression stats? (Or search against raw data?)
|
||||
|
||||
|
||||
|
||||
GetImageType(isofile, REDBOOK2352);
|
||||
|
||||
return(REDBOOK2352); // Couldn't find it? Guess it's RAW 2352, then. (Audio CD?)
|
||||
|
||||
newtype = 0;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
IsoFileSeek(isofile, 16);
|
||||
IsoFileRead(isofile, teststr);
|
||||
while (imagedata[newtype].name != NULL)
|
||||
{
|
||||
if ((isofile->blocksize == imagedata[newtype].blocksize) &&
|
||||
(isofile->imageheader == imagedata[newtype].fileoffset))
|
||||
{
|
||||
dataoffset = imagedata[newtype].dataoffset + 1;
|
||||
i = 0;
|
||||
while ((i < 5) && (teststr[dataoffset + i] == comparestr[i])) i++;
|
||||
if (i == 5)
|
||||
{
|
||||
GetImageType(isofile, newtype);
|
||||
return(newtype);
|
||||
} // ENDIF- Did we find a match?
|
||||
} // ENDIF- Do these pieces match the compression storage pieces?
|
||||
newtype++;
|
||||
} // ENDWHILE- looking for the image type that fits the stats
|
||||
}
|
||||
else
|
||||
{
|
||||
while (imagedata[newtype].name != NULL)
|
||||
{
|
||||
targetpos = (16 * imagedata[newtype].blocksize)
|
||||
+ imagedata[newtype].fileoffset
|
||||
+ imagedata[newtype].dataoffset
|
||||
+ 1; // Moves to start of string
|
||||
retval = ActualFileSeek(isofile->handle, targetpos);
|
||||
if (retval == 0)
|
||||
{
|
||||
retval = ActualFileRead(isofile->handle, 5, teststr);
|
||||
if (retval == 5)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 5) && (teststr[i] == comparestr[i])) i++;
|
||||
if (i == 5)
|
||||
{
|
||||
ActualFileSeek(isofile->handle, isofile->imageheader);
|
||||
GetImageType(isofile, newtype);
|
||||
return(newtype);
|
||||
} // ENDIF- Did we find a match?
|
||||
} // ENDIF- Could we read in the test string? Cool! Test it.
|
||||
} // ENDIF- Could actually get to this point?
|
||||
newtype++;
|
||||
} // ENDWHILE- looking for the directory header string "CD001"
|
||||
ActualFileSeek(isofile->handle, isofile->imageheader);
|
||||
} // ENDIF- Do we match type to compression stats? (Or search against raw data?)
|
||||
GetImageType(isofile, REDBOOK2352);
|
||||
return(REDBOOK2352); // Couldn't find it? Guess it's RAW 2352, then. (Audio CD?)
|
||||
} // END ImageDetect()
|
||||
|
||||
|
|
|
@ -1,112 +1,51 @@
|
|||
/* imagetype.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef IMAGETYPE_H
|
||||
|
||||
#define IMAGETYPE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ImageTypes {
|
||||
|
||||
char *name;
|
||||
|
||||
off64_t blocksize;
|
||||
|
||||
off64_t fileoffset;
|
||||
|
||||
int dataoffset;
|
||||
|
||||
int conversiontype; // For conversionbox to write a new file as.
|
||||
|
||||
struct ImageTypes
|
||||
{
|
||||
char *name;
|
||||
off64_t blocksize;
|
||||
off64_t fileoffset;
|
||||
int dataoffset;
|
||||
int conversiontype; // For conversionbox to write a new file as.
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Note: Worked around since a failure occurred with MSVCRT.DLL. It couldn't
|
||||
|
||||
// printf a char string inside an array of structures. Don't know why.
|
||||
|
||||
// extern struct ImageTypes imagedata[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void GetImageType(struct IsoFile *isofile, int imagetype);
|
||||
|
||||
extern int GetImageTypeConvertTo(int imagetype);
|
||||
|
||||
extern int DetectImageType(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* IMAGETYPE_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,128 +1,64 @@
|
|||
/* ini.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef INI_H
|
||||
|
||||
#define INI_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// File format:
|
||||
|
||||
// [section]
|
||||
|
||||
// keyword=value
|
||||
|
||||
|
||||
|
||||
// file - Name of the INI file
|
||||
|
||||
// section - Section within the file
|
||||
|
||||
// keyword - Identifier for a value
|
||||
|
||||
// value - value to store with a keyword in a section in the file
|
||||
|
||||
// buffer - place to retrieve the value of a keyword
|
||||
|
||||
|
||||
|
||||
// return values: 0 = success, -1 = failure
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_INI
|
||||
|
||||
|
||||
|
||||
#define INIMAXLEN 255
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int INISaveString(char *file, char *section, char *keyword, char *value);
|
||||
|
||||
extern int INILoadString(char *file, char *section, char *keyword, char *buffer);
|
||||
|
||||
|
||||
|
||||
extern int INISaveUInt(char *file, char *section, char *keyword, unsigned int value);
|
||||
|
||||
extern int INILoadUInt(char *file, char *section, char *keyword, unsigned int *buffer);
|
||||
|
||||
|
||||
|
||||
// NULL in the keyword below removes the whole section.
|
||||
|
||||
extern int INIRemove(char *file, char *section, char *keyword);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INI_H */
|
||||
|
||||
/* ini.h
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INI_H
|
||||
#define INI_H
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
// #ifdef __linux__
|
||||
// #define __LINUX__
|
||||
// #endif /* __linux__ */
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
// #define CDVDdefs
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
// File format:
|
||||
// [section]
|
||||
// keyword=value
|
||||
|
||||
// file - Name of the INI file
|
||||
// section - Section within the file
|
||||
// keyword - Identifier for a value
|
||||
// value - value to store with a keyword in a section in the file
|
||||
// buffer - place to retrieve the value of a keyword
|
||||
|
||||
// return values: 0 = success, -1 = failure
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_INI
|
||||
|
||||
#define INIMAXLEN 255
|
||||
|
||||
|
||||
extern int INISaveString(char *file, char *section, char *keyword, char *value);
|
||||
extern int INILoadString(char *file, char *section, char *keyword, char *buffer);
|
||||
|
||||
extern int INISaveUInt(char *file, char *section, char *keyword, unsigned int value);
|
||||
extern int INILoadUInt(char *file, char *section, char *keyword, unsigned int *buffer);
|
||||
|
||||
// NULL in the keyword below removes the whole section.
|
||||
extern int INIRemove(char *file, char *section, char *keyword);
|
||||
|
||||
|
||||
#endif /* INI_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,158 +1,70 @@
|
|||
/* isocompress.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ISOCOMPRESS_H
|
||||
|
||||
#define ISOCOMPRESS_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ISOCOMPRESS
|
||||
|
||||
// #define VERBOSE_WARNING_ISOCOMPRESS
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct CompressExt {
|
||||
|
||||
const char *name;
|
||||
|
||||
int method;
|
||||
|
||||
struct CompressExt
|
||||
{
|
||||
const char *name;
|
||||
int method;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
struct TableData {
|
||||
|
||||
off64_t offset;
|
||||
|
||||
unsigned short size;
|
||||
|
||||
struct TableData
|
||||
{
|
||||
off64_t offset;
|
||||
unsigned short size;
|
||||
#ifdef _WIN32
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
union TableMap {
|
||||
|
||||
struct TableData table;
|
||||
|
||||
char ch[sizeof(struct TableData)];
|
||||
|
||||
union TableMap
|
||||
{
|
||||
struct TableData table;
|
||||
char ch[sizeof(struct TableData)];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern const char *compressnames[];
|
||||
|
||||
extern const char *compressdesc[];
|
||||
|
||||
|
||||
|
||||
extern struct CompressExt compressext[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int IsoNameStripCompress(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
// 0 = success, -1 = Failure w/data, -2 = Failure w/table
|
||||
|
||||
extern int CompressOpenForRead(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int CompressSeek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int CompressRead(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
extern void CompressClose(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int CompressOpenForWrite(struct IsoFile *isofile);
|
||||
|
||||
extern int CompressWrite(struct IsoFile *isofile, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ISOCOMPRESS_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,246 +1,108 @@
|
|||
/* isofile.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ISOFILE_H
|
||||
|
||||
#define ISOFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ISOFILE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
struct IsoFile
|
||||
{
|
||||
// *** Primary Data area
|
||||
char name[256];
|
||||
int namepos; // Used for detection of components within name
|
||||
ACTUALHANDLE handle;
|
||||
off64_t sectorpos; // Overall.
|
||||
// blocks (char [2352]) provided by users
|
||||
// *** Derived Stats from Primary Data
|
||||
int openforread; // 1 = Yes, 0 = No
|
||||
off64_t filebytesize;
|
||||
off64_t filebytepos;
|
||||
off64_t filesectorsize;
|
||||
off64_t filesectorpos;
|
||||
int cdvdtype; // for GetDiskType call
|
||||
char toc[2048]; // for GetTOC call
|
||||
|
||||
// From imagetype.h
|
||||
int imagetype;
|
||||
char imagename[40];
|
||||
off64_t imageheader; // Header bytes in every file...
|
||||
off64_t blocksize; // sized to add quickly to other off64_t counters
|
||||
int blockoffset; // Where to place data in block
|
||||
// from isocompress.h
|
||||
int compress; // Compression Method used (0 = none, 1...)
|
||||
int compresspos; // Start pos of ".Z", ".BZ", etc...
|
||||
char tablename[256];
|
||||
ACTUALHANDLE tablehandle;
|
||||
char compblock[65536]; // Temporary storage of uncompressed sectors.
|
||||
off64_t compsector; // First sector of the compblock[]
|
||||
off64_t numsectors; // Number of sectors in a compression block
|
||||
char *tabledata; // Table holding area
|
||||
// From multifile.h
|
||||
int multi; // 0 = Single File, 1 = Multiple Files
|
||||
int multipos; // Position of Multi # ('0'-'9')
|
||||
off64_t multisectorend[10]; // Ending sector of each file...
|
||||
off64_t multioffset; // To help with seek calls. Sector offset.
|
||||
int multistart; // Starting file number (0-1)
|
||||
int multiend; // Ending file number (?-9)
|
||||
int multinow; // Current open file number
|
||||
|
||||
|
||||
|
||||
struct IsoFile {
|
||||
|
||||
// *** Primary Data area
|
||||
|
||||
char name[256];
|
||||
|
||||
int namepos; // Used for detection of components within name
|
||||
|
||||
ACTUALHANDLE handle;
|
||||
|
||||
off64_t sectorpos; // Overall.
|
||||
|
||||
// blocks (char [2352]) provided by users
|
||||
|
||||
|
||||
|
||||
// *** Derived Stats from Primary Data
|
||||
|
||||
int openforread; // 1 = Yes, 0 = No
|
||||
|
||||
off64_t filebytesize;
|
||||
|
||||
off64_t filebytepos;
|
||||
|
||||
off64_t filesectorsize;
|
||||
|
||||
off64_t filesectorpos;
|
||||
|
||||
int cdvdtype; // for GetDiskType call
|
||||
|
||||
char toc[2048]; // for GetTOC call
|
||||
|
||||
|
||||
|
||||
// From imagetype.h
|
||||
|
||||
int imagetype;
|
||||
|
||||
char imagename[40];
|
||||
|
||||
off64_t imageheader; // Header bytes in every file...
|
||||
|
||||
off64_t blocksize; // sized to add quickly to other off64_t counters
|
||||
|
||||
int blockoffset; // Where to place data in block
|
||||
|
||||
|
||||
|
||||
// from isocompress.h
|
||||
|
||||
int compress; // Compression Method used (0 = none, 1...)
|
||||
|
||||
int compresspos; // Start pos of ".Z", ".BZ", etc...
|
||||
|
||||
char tablename[256];
|
||||
|
||||
ACTUALHANDLE tablehandle;
|
||||
|
||||
char compblock[65536]; // Temporary storage of uncompressed sectors.
|
||||
|
||||
off64_t compsector; // First sector of the compblock[]
|
||||
|
||||
off64_t numsectors; // Number of sectors in a compression block
|
||||
|
||||
char *tabledata; // Table holding area
|
||||
|
||||
|
||||
|
||||
// From multifile.h
|
||||
|
||||
int multi; // 0 = Single File, 1 = Multiple Files
|
||||
|
||||
int multipos; // Position of Multi # ('0'-'9')
|
||||
|
||||
off64_t multisectorend[10]; // Ending sector of each file...
|
||||
|
||||
off64_t multioffset; // To help with seek calls. Sector offset.
|
||||
|
||||
int multistart; // Starting file number (0-1)
|
||||
|
||||
int multiend; // Ending file number (?-9)
|
||||
|
||||
int multinow; // Current open file number
|
||||
|
||||
|
||||
|
||||
// *** (Specific) Compression Data area
|
||||
|
||||
// *** (Specific) Compression Data area
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Read-only section
|
||||
|
||||
// IsoFiles opened for read are treated as random-access files
|
||||
|
||||
|
||||
|
||||
extern int IsIsoFile(const char *filename);
|
||||
|
||||
// Returns an image type (positive or zero) or an error (negative)
|
||||
|
||||
|
||||
|
||||
extern struct IsoFile *IsoFileOpenForRead(const char *filename);
|
||||
|
||||
// Will seek blocksize and compression method on it's own.
|
||||
|
||||
|
||||
|
||||
extern int IsoFileSeek(struct IsoFile *file, off64_t sector);
|
||||
|
||||
// Sector, not byte.
|
||||
|
||||
|
||||
|
||||
extern int IsoFileRead(struct IsoFile *file, char *block);
|
||||
|
||||
// Buffers should be at least of "blocksize" size. 2352 bytes, please.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Write-only section
|
||||
|
||||
// IsoFiles opened for write are treated as sequential files (still written
|
||||
|
||||
// out a block at a time, though, to be read in later as random-access)
|
||||
|
||||
// No plans are made to make writes random-access at this time.
|
||||
|
||||
|
||||
|
||||
extern struct IsoFile *IsoFileOpenForWrite(const char *filename,
|
||||
|
||||
int imagetype,
|
||||
|
||||
int multi,
|
||||
|
||||
int compress);
|
||||
|
||||
|
||||
int imagetype,
|
||||
int multi,
|
||||
int compress);
|
||||
|
||||
extern int IsoFileWrite(struct IsoFile *file, char *block);
|
||||
|
||||
// Uncompressed buffers, please.
|
||||
|
||||
// Will compress with this call (if it's necessary.)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Calls used for all Isofiles
|
||||
|
||||
|
||||
|
||||
extern struct IsoFile *IsoFileClose(struct IsoFile *file);
|
||||
|
||||
// Use return variable to NULL the file pointer.
|
||||
|
||||
// Ex: lastfile = IsoFileClose(lastfile);
|
||||
|
||||
|
||||
|
||||
extern struct IsoFile *IsoFileCloseAndDelete(struct IsoFile *file);
|
||||
|
||||
// For failure to finish writing out a file(set).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ISOFILE_H */
|
||||
|
||||
|
|
|
@ -1,578 +1,325 @@
|
|||
/* multifile.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
#include "isocompress.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
#include "multifile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define FILESIZELIMIT 2000000000
|
||||
|
||||
char *multinames[] =
|
||||
{
|
||||
"",
|
||||
"Multiple ",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
char *multinames[] = {
|
||||
|
||||
"",
|
||||
|
||||
"Multiple ",
|
||||
|
||||
NULL };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void IsoNameStripMulti(struct IsoFile *isofile) {
|
||||
|
||||
isofile->multi = 0;
|
||||
|
||||
if(isofile->namepos < 2) return; // Not enough digits
|
||||
|
||||
if(isofile->name[isofile->namepos - 1] < '0') return; // Ex: -I0[0]
|
||||
|
||||
if(isofile->name[isofile->namepos - 1] > '1') return; // Ex: -I0[1]
|
||||
|
||||
if(isofile->name[isofile->namepos - 2] != '0') return; // Ex: -I[0]0
|
||||
|
||||
|
||||
|
||||
isofile->multi = 1;
|
||||
|
||||
isofile->multipos = isofile->namepos - 1;
|
||||
|
||||
isofile->namepos -= 2;
|
||||
|
||||
isofile->multistart = isofile->name[isofile->multipos] - '0';
|
||||
|
||||
isofile->multiend = isofile->multistart;
|
||||
|
||||
isofile->multinow = isofile->multistart;
|
||||
|
||||
isofile->multisectorend[0] = 0; // Sometimes the file name starts with '1'
|
||||
|
||||
isofile->multisectorend[isofile->multistart] = isofile->filesectorsize;
|
||||
|
||||
isofile->multioffset = 0;
|
||||
|
||||
|
||||
|
||||
if(isofile->namepos < 1) return;
|
||||
|
||||
if(isofile->name[isofile->namepos - 1] != 'I') return; // Ex: -[I]00
|
||||
|
||||
isofile->namepos--;
|
||||
|
||||
|
||||
|
||||
if(isofile->namepos < 2) return; // Filename doesn't start with '-'
|
||||
|
||||
if(isofile->name[isofile->namepos - 1] != '-') return; // Ex: [-]I00
|
||||
|
||||
isofile->namepos--;
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
void IsoNameStripMulti(struct IsoFile *isofile)
|
||||
{
|
||||
isofile->multi = 0;
|
||||
if (isofile->namepos < 2) return; // Not enough digits
|
||||
if (isofile->name[isofile->namepos - 1] < '0') return; // Ex: -I0[0]
|
||||
if (isofile->name[isofile->namepos - 1] > '1') return; // Ex: -I0[1]
|
||||
if (isofile->name[isofile->namepos - 2] != '0') return; // Ex: -I[0]0
|
||||
isofile->multi = 1;
|
||||
isofile->multipos = isofile->namepos - 1;
|
||||
isofile->namepos -= 2;
|
||||
isofile->multistart = isofile->name[isofile->multipos] - '0';
|
||||
isofile->multiend = isofile->multistart;
|
||||
isofile->multinow = isofile->multistart;
|
||||
isofile->multisectorend[0] = 0; // Sometimes the file name starts with '1'
|
||||
isofile->multisectorend[isofile->multistart] = isofile->filesectorsize;
|
||||
isofile->multioffset = 0;
|
||||
if (isofile->namepos < 1) return;
|
||||
if (isofile->name[isofile->namepos - 1] != 'I') return; // Ex: -[I]00
|
||||
isofile->namepos--;
|
||||
if (isofile->namepos < 2) return; // Filename doesn't start with '-'
|
||||
if (isofile->name[isofile->namepos - 1] != '-') return; // Ex: [-]I00
|
||||
isofile->namepos--;
|
||||
return;
|
||||
} // END IsoNameStripMulti()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int MultiFileSeek(struct IsoFile *isofile, off64_t sector) {
|
||||
|
||||
int multinext;
|
||||
|
||||
int retval;
|
||||
|
||||
off64_t tempfilesector;
|
||||
|
||||
|
||||
int MultiFileSeek(struct IsoFile *isofile, off64_t sector)
|
||||
{
|
||||
int multinext;
|
||||
int retval;
|
||||
off64_t tempfilesector;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_MULTIFILE
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileSeek(%llu)", sector);
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileSeek(%llu)", sector);
|
||||
#endif /* VERBOSE_FUNCTION_MULTIFILE */
|
||||
|
||||
|
||||
|
||||
multinext = isofile->multinow;
|
||||
|
||||
|
||||
|
||||
// Do we need to back up a file or so?
|
||||
|
||||
while((multinext > isofile->multistart) &&
|
||||
|
||||
(sector < isofile->multisectorend[multinext - 1])) multinext--;
|
||||
|
||||
|
||||
|
||||
// Do we need to go forward a file or two (that we know about?)
|
||||
|
||||
while((multinext < isofile->multiend) &&
|
||||
|
||||
(sector >= isofile->multisectorend[multinext])) multinext++;
|
||||
|
||||
|
||||
|
||||
// Do we need to go forward a file or two (that we *don't* know about?)
|
||||
|
||||
while((multinext < 9) &&
|
||||
|
||||
(sector >= isofile->multisectorend[multinext])) {
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
CompressClose(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
|
||||
|
||||
multinext++;
|
||||
|
||||
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
retval = CompressOpenForRead(isofile);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
|
||||
retval = 0;
|
||||
|
||||
if(isofile->handle == ACTUALHANDLENULL) {
|
||||
|
||||
retval = -1;
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
} // ENDIF- Failed to open the file raw?
|
||||
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
|
||||
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
CompressClose(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
|
||||
|
||||
multinext--;
|
||||
|
||||
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
CompressOpenForRead(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
|
||||
|
||||
|
||||
isofile->multinow = multinext;
|
||||
|
||||
if(isofile->multinow == 0) {
|
||||
|
||||
isofile->multioffset = 0;
|
||||
|
||||
} else {
|
||||
|
||||
isofile->multioffset = isofile->multisectorend[isofile->multinow - 1];
|
||||
|
||||
} // ENDIF- At the start of the list? Offset 0.
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Failed to open next in series? Revert and abort.
|
||||
|
||||
|
||||
|
||||
isofile->multinow = multinext;
|
||||
|
||||
isofile->multiend = multinext;
|
||||
|
||||
isofile->multioffset = isofile->multisectorend[multinext - 1];
|
||||
|
||||
isofile->multisectorend[multinext] = isofile->multisectorend[multinext - 1]
|
||||
|
||||
+ isofile->filesectorsize;
|
||||
|
||||
multinext = isofile->multinow;
|
||||
|
||||
// Do we need to back up a file or so?
|
||||
while ((multinext > isofile->multistart) &&
|
||||
(sector < isofile->multisectorend[multinext - 1])) multinext--;
|
||||
|
||||
// Do we need to go forward a file or two (that we know about?)
|
||||
while ((multinext < isofile->multiend) &&
|
||||
(sector >= isofile->multisectorend[multinext])) multinext++;
|
||||
|
||||
// Do we need to go forward a file or two (that we *don't* know about?)
|
||||
while ((multinext < 9) &&
|
||||
(sector >= isofile->multisectorend[multinext]))
|
||||
{
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressClose(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
multinext++;
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
retval = CompressOpenForRead(isofile);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
retval = 0;
|
||||
if (isofile->handle == ACTUALHANDLENULL)
|
||||
{
|
||||
retval = -1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
isofile->filebytepos = 0;
|
||||
isofile->filesectorpos = 0;
|
||||
} // ENDIF- Failed to open the file raw?
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressClose(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
multinext--;
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressOpenForRead(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
isofile->filebytepos = 0;
|
||||
isofile->filesectorpos = 0;
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
isofile->multinow = multinext;
|
||||
if (isofile->multinow == 0)
|
||||
{
|
||||
isofile->multioffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->multioffset = isofile->multisectorend[isofile->multinow - 1];
|
||||
} // ENDIF- At the start of the list? Offset 0.
|
||||
return(-1);
|
||||
} // ENDIF- Failed to open next in series? Revert and abort.
|
||||
|
||||
isofile->multinow = multinext;
|
||||
isofile->multiend = multinext;
|
||||
isofile->multioffset = isofile->multisectorend[multinext - 1];
|
||||
isofile->multisectorend[multinext] = isofile->multisectorend[multinext - 1]
|
||||
+ isofile->filesectorsize;
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVD multifile: File %i opened, %llu sectors found (%llu sectors total)",
|
||||
|
||||
multinext,
|
||||
|
||||
isofile->filesectorsize,
|
||||
|
||||
isofile->multisectorend[multinext]);
|
||||
|
||||
PrintLog("CDVD multifile: File %i opened, %llu sectors found (%llu sectors total)",
|
||||
multinext,
|
||||
isofile->filesectorsize,
|
||||
isofile->multisectorend[multinext]);
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
} // ENDWHILE- searching through new files for a high enough end-mark
|
||||
|
||||
|
||||
|
||||
if(multinext != isofile->multinow) {
|
||||
|
||||
} // ENDWHILE- searching through new files for a high enough end-mark
|
||||
if (multinext != isofile->multinow)
|
||||
{
|
||||
#ifdef VERBOSE_WARNING_MULTIFILE
|
||||
|
||||
PrintLog("CDVD multifile: Changing to File %i", multinext);
|
||||
|
||||
PrintLog("CDVD multifile: Changing to File %i", multinext);
|
||||
#endif /* VERBOSE_WARNING_MULTIFILE */
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressClose(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressOpenForRead(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
if (isofile->handle == ACTUALHANDLENULL) return(-1); // Couldn't re-open?
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
isofile->filebytepos = 0;
|
||||
isofile->filesectorpos = 0;
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
|
||||
CompressClose(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + multinext;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
CompressOpenForRead(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
isofile->handle = ActualFileOpenForRead(isofile->name);
|
||||
|
||||
if(isofile->handle == ACTUALHANDLENULL) return(-1); // Couldn't re-open?
|
||||
|
||||
isofile->filebytesize = ActualFileSize(isofile->handle);
|
||||
|
||||
isofile->filesectorsize = isofile->filebytesize / isofile->blocksize;
|
||||
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
} // ENDIF- Compressed or non-compressed? What a question.
|
||||
|
||||
|
||||
|
||||
isofile->multinow = multinext;
|
||||
|
||||
if(multinext == 0) {
|
||||
|
||||
isofile->multioffset = 0;
|
||||
|
||||
} else {
|
||||
|
||||
isofile->multioffset = isofile->multisectorend[multinext - 1];
|
||||
|
||||
} // ENDIF- At the start of the list? Offset 0.
|
||||
|
||||
} // ENDIF- Not looking at the same file? Change to the new one.
|
||||
|
||||
|
||||
|
||||
tempfilesector = sector - isofile->multioffset;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
return(CompressSeek(isofile, tempfilesector));
|
||||
|
||||
} else {
|
||||
|
||||
retval = ActualFileSeek(isofile->handle,
|
||||
|
||||
(tempfilesector * isofile->blocksize)
|
||||
|
||||
+ isofile->imageheader);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
isofile->filesectorpos = sector;
|
||||
|
||||
isofile->filebytepos = (sector * isofile->blocksize)
|
||||
|
||||
+ isofile->imageheader;
|
||||
|
||||
} // ENDIF- Sucessful? Adjust internals
|
||||
|
||||
return(retval);
|
||||
|
||||
} // ENDIF- Seek a position in a compressed file?
|
||||
isofile->multinow = multinext;
|
||||
if (multinext == 0)
|
||||
{
|
||||
isofile->multioffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->multioffset = isofile->multisectorend[multinext - 1];
|
||||
} // ENDIF- At the start of the list? Offset 0.
|
||||
} // ENDIF- Not looking at the same file? Change to the new one.
|
||||
|
||||
tempfilesector = sector - isofile->multioffset;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
return(CompressSeek(isofile, tempfilesector));
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = ActualFileSeek(isofile->handle,
|
||||
(tempfilesector * isofile->blocksize)
|
||||
+ isofile->imageheader);
|
||||
if (retval == 0)
|
||||
{
|
||||
isofile->filesectorpos = sector;
|
||||
isofile->filebytepos = (sector * isofile->blocksize)
|
||||
+ isofile->imageheader;
|
||||
} // ENDIF- Sucessful? Adjust internals
|
||||
return(retval);
|
||||
} // ENDIF- Seek a position in a compressed file?
|
||||
} // END MultiFileSeek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int MultiFileRead(struct IsoFile *isofile, char *block) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
int MultiFileRead(struct IsoFile *isofile, char *block)
|
||||
{
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_MULTIFILE
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileRead()");
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileRead()");
|
||||
#endif /* VERBOSE_FUNCTION_MULTIFILE */
|
||||
|
||||
|
||||
|
||||
if(isofile->filesectorpos >= isofile->filesectorsize)
|
||||
|
||||
MultiFileSeek(isofile, isofile->sectorpos);
|
||||
|
||||
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
return(CompressRead(isofile, block));
|
||||
|
||||
} else {
|
||||
|
||||
retval = ActualFileRead(isofile->handle, isofile->blocksize, block);
|
||||
|
||||
if(retval > 0) isofile->filebytepos += retval;
|
||||
|
||||
if(retval == isofile->blocksize) isofile->filesectorpos++;
|
||||
|
||||
return(retval);
|
||||
|
||||
} // ENDIF- Read a compressed sector?
|
||||
|
||||
if (isofile->filesectorpos >= isofile->filesectorsize)
|
||||
MultiFileSeek(isofile, isofile->sectorpos);
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
return(CompressRead(isofile, block));
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = ActualFileRead(isofile->handle, isofile->blocksize, block);
|
||||
if (retval > 0) isofile->filebytepos += retval;
|
||||
if (retval == isofile->blocksize) isofile->filesectorpos++;
|
||||
return(retval);
|
||||
} // ENDIF- Read a compressed sector?
|
||||
} // END MultiFileRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int MultiFileWrite(struct IsoFile *isofile, char *block) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
int MultiFileWrite(struct IsoFile *isofile, char *block)
|
||||
{
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_MULTIFILE
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileWrite()");
|
||||
|
||||
PrintLog("CDVD multifile: MultiFileWrite()");
|
||||
#endif /* VERBOSE_FUNCTION_MULTIFILE */
|
||||
if (isofile->filebytesize + isofile->blocksize > FILESIZELIMIT)
|
||||
{
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
CompressClose(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActualFileClose(isofile->handle);
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
if (isofile->multinow == 9) return(-1); // Over 10 files? Overflow!
|
||||
|
||||
|
||||
|
||||
if(isofile->filebytesize + isofile->blocksize > FILESIZELIMIT) {
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
CompressClose(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
ActualFileClose(isofile->handle);
|
||||
|
||||
isofile->handle = ACTUALHANDLENULL;
|
||||
|
||||
} // ENDIF- Close a compressed file? (or an uncompressed one?)
|
||||
|
||||
if(isofile->multinow == 9) return(-1); // Over 10 files? Overflow!
|
||||
|
||||
|
||||
|
||||
isofile->multioffset += isofile->filesectorsize;
|
||||
|
||||
isofile->multinow++;
|
||||
|
||||
isofile->multiend++;
|
||||
|
||||
isofile->multioffset += isofile->filesectorsize;
|
||||
isofile->multinow++;
|
||||
isofile->multiend++;
|
||||
#ifdef VERBOSE_WARNING_MULTIFILE
|
||||
|
||||
PrintLog("CDVD multifile: Changing to File %i", isofile->multinow);
|
||||
|
||||
PrintLog("CDVD multifile: Changing to File %i", isofile->multinow);
|
||||
#endif /* VERBOSE_WARNING_MULTIFILE */
|
||||
|
||||
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + isofile->multinow;
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
retval = CompressOpenForWrite(isofile);
|
||||
|
||||
} else {
|
||||
|
||||
isofile->handle = ActualFileOpenForWrite(isofile->name);
|
||||
|
||||
if(isofile->handle == ACTUALHANDLENULL) {
|
||||
|
||||
retval = -1;
|
||||
|
||||
} else {
|
||||
|
||||
retval = 0;
|
||||
|
||||
isofile->filebytesize = 0;
|
||||
|
||||
isofile->filesectorsize = 0;
|
||||
|
||||
isofile->filebytepos = 0;
|
||||
|
||||
isofile->filesectorpos = 0;
|
||||
|
||||
} // ENDIF- Trouble opening next file?
|
||||
|
||||
} // ENDIF- Opening the next compressed file? (Or uncompressed?)
|
||||
|
||||
if(retval < 0) return(-1); // Couldn't open another file? Abort.
|
||||
|
||||
} // ENDIF- Hit the size limit? Move on to next file...
|
||||
|
||||
|
||||
|
||||
if(isofile->compress > 0) {
|
||||
|
||||
return(CompressWrite(isofile, block));
|
||||
|
||||
} else {
|
||||
|
||||
retval = ActualFileWrite(isofile->handle, isofile->blocksize, block);
|
||||
|
||||
if(retval > 0) isofile->filebytepos += retval;
|
||||
|
||||
if(retval == isofile->blocksize) isofile->filesectorpos++;
|
||||
|
||||
return(retval);
|
||||
|
||||
} // ENDIF- Write a compressed sector?
|
||||
|
||||
isofile->name[isofile->multipos] = '0' + isofile->multinow;
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
retval = CompressOpenForWrite(isofile);
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->handle = ActualFileOpenForWrite(isofile->name);
|
||||
if (isofile->handle == ACTUALHANDLENULL)
|
||||
{
|
||||
retval = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = 0;
|
||||
isofile->filebytesize = 0;
|
||||
isofile->filesectorsize = 0;
|
||||
isofile->filebytepos = 0;
|
||||
isofile->filesectorpos = 0;
|
||||
} // ENDIF- Trouble opening next file?
|
||||
} // ENDIF- Opening the next compressed file? (Or uncompressed?)
|
||||
if (retval < 0) return(-1); // Couldn't open another file? Abort.
|
||||
} // ENDIF- Hit the size limit? Move on to next file...
|
||||
if (isofile->compress > 0)
|
||||
{
|
||||
return(CompressWrite(isofile, block));
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = ActualFileWrite(isofile->handle, isofile->blocksize, block);
|
||||
if (retval > 0) isofile->filebytepos += retval;
|
||||
if (retval == isofile->blocksize) isofile->filesectorpos++;
|
||||
return(retval);
|
||||
} // ENDIF- Write a compressed sector?
|
||||
} // END MultiFileWrite()
|
||||
|
||||
|
|
|
@ -1,106 +1,45 @@
|
|||
/* multifile.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef MULTIFILE_H
|
||||
|
||||
#define MULTIFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
|
||||
// #ifdef __linux__
|
||||
|
||||
// #define __LINUX__
|
||||
|
||||
// #endif /* __linux__ */
|
||||
|
||||
// #endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_MULTIFILE
|
||||
|
||||
// #define VERBOSE_WARNING_MULTIFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern char *multinames[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void IsoNameStripMulti(struct IsoFile *isofile);
|
||||
|
||||
|
||||
|
||||
extern int MultiFileSeek(struct IsoFile *isofile, off64_t sector);
|
||||
|
||||
extern int MultiFileRead(struct IsoFile *isofile, char *block);
|
||||
|
||||
|
||||
|
||||
extern int MultiFileWrite(struct IsoFile *isofile, char *block);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* MULTIFILE_H */
|
||||
|
||||
|
|
|
@ -17,342 +17,330 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
#ifndef __LINUX__
|
||||
#ifdef __linux__
|
||||
#define __LINUX__
|
||||
#endif /* __linux__ */
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#include "logfile.h"
|
||||
#include "convert.h"
|
||||
#include "isofile.h"
|
||||
#include "actualfile.h"
|
||||
|
||||
#include "toc.h"
|
||||
|
||||
|
||||
// PCSX2's .toc file format:
|
||||
// 1 unsigned char - CDVD_TYPE_????
|
||||
// 1 tocTN
|
||||
// As many tocTDs as it takes.
|
||||
|
||||
extern void IsoInitTOC(struct IsoFile *isofile)
|
||||
{
|
||||
int i;
|
||||
off64_t sectorsize;
|
||||
|
||||
extern void IsoInitTOC(struct IsoFile *isofile) {
|
||||
int i;
|
||||
off64_t sectorsize;
|
||||
|
||||
if(isofile == NULL) return;
|
||||
if (isofile == NULL) return;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: IsoInitTOC()");
|
||||
PrintLog("CDVDiso TOC: IsoInitTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
|
||||
if(isofile->multi > 0) {
|
||||
sectorsize = isofile->multisectorend[isofile->multiend];
|
||||
} else {
|
||||
sectorsize = isofile->filesectorsize;
|
||||
} // ENDIF- Establish largest sector from multifile? (or single file?)
|
||||
if (isofile->multi > 0)
|
||||
{
|
||||
sectorsize = isofile->multisectorend[isofile->multiend];
|
||||
}
|
||||
else
|
||||
{
|
||||
sectorsize = isofile->filesectorsize;
|
||||
} // ENDIF- Establish largest sector from multifile? (or single file?)
|
||||
|
||||
for(i = 0; i < 2048; i++) isofile->toc[i] = 0;
|
||||
switch(isofile->cdvdtype) {
|
||||
case CDVD_TYPE_DVDV:
|
||||
case CDVD_TYPE_PS2DVD:
|
||||
if((isofile->filesectorsize > (2048*1024)) ||
|
||||
(isofile->multi > 0)) {
|
||||
isofile->toc[0] = 0x24; // Dual-Sided DVD (?)
|
||||
isofile->toc[4] = 0x41;
|
||||
isofile->toc[5] = 0x95;
|
||||
} else {
|
||||
isofile->toc[0] = 0x04; // Single-Sided DVD (?)
|
||||
isofile->toc[4] = 0x86;
|
||||
isofile->toc[5] = 0x72;
|
||||
} // ENDIF- Too many sectors for a single-layered disc?
|
||||
for (i = 0; i < 2048; i++) isofile->toc[i] = 0;
|
||||
switch (isofile->cdvdtype)
|
||||
{
|
||||
case CDVD_TYPE_DVDV:
|
||||
case CDVD_TYPE_PS2DVD:
|
||||
if ((isofile->filesectorsize > (2048*1024)) ||
|
||||
(isofile->multi > 0))
|
||||
{
|
||||
isofile->toc[0] = 0x24; // Dual-Sided DVD (?)
|
||||
isofile->toc[4] = 0x41;
|
||||
isofile->toc[5] = 0x95;
|
||||
}
|
||||
else
|
||||
{
|
||||
isofile->toc[0] = 0x04; // Single-Sided DVD (?)
|
||||
isofile->toc[4] = 0x86;
|
||||
isofile->toc[5] = 0x72;
|
||||
} // ENDIF- Too many sectors for a single-layered disc?
|
||||
isofile->toc[1] = 0x02;
|
||||
isofile->toc[2] = 0xF2;
|
||||
isofile->toc[3] = 0x00;
|
||||
isofile->toc[16] = 0x00;
|
||||
isofile->toc[17] = 0x03;
|
||||
isofile->toc[18] = 0x00;
|
||||
isofile->toc[19] = 0x00;
|
||||
return; // DVD's don't have tracks. Might track multisession later...
|
||||
break;
|
||||
|
||||
isofile->toc[1] = 0x02;
|
||||
isofile->toc[2] = 0xF2;
|
||||
isofile->toc[3] = 0x00;
|
||||
|
||||
isofile->toc[16] = 0x00;
|
||||
isofile->toc[17] = 0x03;
|
||||
isofile->toc[18] = 0x00;
|
||||
isofile->toc[19] = 0x00;
|
||||
return; // DVD's don't have tracks. Might track multisession later...
|
||||
break;
|
||||
|
||||
case CDVD_TYPE_PS2CD:
|
||||
case CDVD_TYPE_PSCD:
|
||||
isofile->toc[0] = 0x41;
|
||||
break;
|
||||
case CDVD_TYPE_CDDA:
|
||||
isofile->toc[0] = 0x01;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // ENDSWITCH isofile->cdvdtype - Which TOC for which type?
|
||||
|
||||
// CD Details here... (tracks and stuff)
|
||||
isofile->toc[2] = 0xA0;
|
||||
isofile->toc[7] = 0x01; // Starting Track No.
|
||||
isofile->toc[12] = 0xA1;
|
||||
isofile->toc[17] = 0x01; // Ending Track No.
|
||||
|
||||
isofile->toc[22] = 0xA2;
|
||||
LBAtoMSF(sectorsize, &isofile->toc[27]);
|
||||
isofile->toc[27] = HEXTOBCD(isofile->toc[27]);
|
||||
isofile->toc[28] = HEXTOBCD(isofile->toc[28]);
|
||||
isofile->toc[29] = HEXTOBCD(isofile->toc[29]);
|
||||
|
||||
isofile->toc[40] = 0x02; // YellowBook? Data Mode?
|
||||
isofile->toc[42] = 0x01; // Track No.
|
||||
LBAtoMSF(0, &isofile->toc[47]);
|
||||
isofile->toc[47] = HEXTOBCD(isofile->toc[47]);
|
||||
isofile->toc[48] = HEXTOBCD(isofile->toc[48]);
|
||||
isofile->toc[49] = HEXTOBCD(isofile->toc[49]);
|
||||
case CDVD_TYPE_PS2CD:
|
||||
case CDVD_TYPE_PSCD:
|
||||
isofile->toc[0] = 0x41;
|
||||
break;
|
||||
case CDVD_TYPE_CDDA:
|
||||
isofile->toc[0] = 0x01;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // ENDSWITCH isofile->cdvdtype - Which TOC for which type?
|
||||
// CD Details here... (tracks and stuff)
|
||||
isofile->toc[2] = 0xA0;
|
||||
isofile->toc[7] = 0x01; // Starting Track No.
|
||||
isofile->toc[12] = 0xA1;
|
||||
isofile->toc[17] = 0x01; // Ending Track No.
|
||||
isofile->toc[22] = 0xA2;
|
||||
LBAtoMSF(sectorsize, &isofile->toc[27]);
|
||||
isofile->toc[27] = HEXTOBCD(isofile->toc[27]);
|
||||
isofile->toc[28] = HEXTOBCD(isofile->toc[28]);
|
||||
isofile->toc[29] = HEXTOBCD(isofile->toc[29]);
|
||||
isofile->toc[40] = 0x02; // YellowBook? Data Mode?
|
||||
isofile->toc[42] = 0x01; // Track No.
|
||||
LBAtoMSF(0, &isofile->toc[47]);
|
||||
isofile->toc[47] = HEXTOBCD(isofile->toc[47]);
|
||||
isofile->toc[48] = HEXTOBCD(isofile->toc[48]);
|
||||
isofile->toc[49] = HEXTOBCD(isofile->toc[49]);
|
||||
} // END IsoInitTOC()
|
||||
|
||||
|
||||
extern void IsoAddTNToTOC(struct IsoFile *isofile, struct tocTN toctn) {
|
||||
if(isofile == NULL) return;
|
||||
|
||||
extern void IsoAddTNToTOC(struct IsoFile *isofile, struct tocTN toctn)
|
||||
{
|
||||
if (isofile == NULL) return;
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: IsoAddTNToTOC()");
|
||||
PrintLog("CDVDiso TOC: IsoAddTNToTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
|
||||
isofile->toc[7] = HEXTOBCD(toctn.strack);
|
||||
isofile->toc[17] = HEXTOBCD(toctn.etrack);
|
||||
return;
|
||||
isofile->toc[7] = HEXTOBCD(toctn.strack);
|
||||
isofile->toc[17] = HEXTOBCD(toctn.etrack);
|
||||
return;
|
||||
} // END IsoAddTNToTOC()
|
||||
|
||||
|
||||
extern void IsoAddTDToTOC(struct IsoFile *isofile,
|
||||
unsigned char track,
|
||||
struct tocTD toctd) {
|
||||
int temptrack;
|
||||
int position;
|
||||
|
||||
unsigned char track,
|
||||
struct tocTD toctd)
|
||||
{
|
||||
int temptrack;
|
||||
int position;
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: IsoAddTNToTOC(%u)", track);
|
||||
PrintLog("CDVDiso TOC: IsoAddTNToTOC(%u)", track);
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
|
||||
if(isofile == NULL) return;
|
||||
|
||||
temptrack = track;
|
||||
if(temptrack == 0xAA) temptrack = 0;
|
||||
if(temptrack > 99) return; // Only up to 99 tracks allowed.
|
||||
|
||||
if(temptrack == 0) {
|
||||
LBAtoMSF(toctd.lsn, &isofile->toc[27]);
|
||||
isofile->toc[27] = HEXTOBCD(isofile->toc[27]);
|
||||
isofile->toc[28] = HEXTOBCD(isofile->toc[28]);
|
||||
isofile->toc[29] = HEXTOBCD(isofile->toc[29]);
|
||||
|
||||
} else {
|
||||
position = temptrack * 10;
|
||||
position += 30;
|
||||
isofile->toc[position] = toctd.type;
|
||||
isofile->toc[position + 2] = HEXTOBCD(temptrack);
|
||||
LBAtoMSF(toctd.lsn, &isofile->toc[position + 7]);
|
||||
isofile->toc[position + 7] = HEXTOBCD(isofile->toc[position + 7]);
|
||||
isofile->toc[position + 8] = HEXTOBCD(isofile->toc[position + 8]);
|
||||
isofile->toc[position + 9] = HEXTOBCD(isofile->toc[position + 9]);
|
||||
} // ENDIF- Is this a lead-out? (or an actual track?)
|
||||
if (isofile == NULL) return;
|
||||
temptrack = track;
|
||||
if (temptrack == 0xAA) temptrack = 0;
|
||||
if (temptrack > 99) return; // Only up to 99 tracks allowed.
|
||||
if (temptrack == 0)
|
||||
{
|
||||
LBAtoMSF(toctd.lsn, &isofile->toc[27]);
|
||||
isofile->toc[27] = HEXTOBCD(isofile->toc[27]);
|
||||
isofile->toc[28] = HEXTOBCD(isofile->toc[28]);
|
||||
isofile->toc[29] = HEXTOBCD(isofile->toc[29]);
|
||||
}
|
||||
else
|
||||
{
|
||||
position = temptrack * 10;
|
||||
position += 30;
|
||||
isofile->toc[position] = toctd.type;
|
||||
isofile->toc[position + 2] = HEXTOBCD(temptrack);
|
||||
LBAtoMSF(toctd.lsn, &isofile->toc[position + 7]);
|
||||
isofile->toc[position + 7] = HEXTOBCD(isofile->toc[position + 7]);
|
||||
isofile->toc[position + 8] = HEXTOBCD(isofile->toc[position + 8]);
|
||||
isofile->toc[position + 9] = HEXTOBCD(isofile->toc[position + 9]);
|
||||
} // ENDIF- Is this a lead-out? (or an actual track?)
|
||||
} // END IsoAddTDToTOC()
|
||||
extern int IsoLoadTOC(struct IsoFile *isofile)
|
||||
{
|
||||
char tocext[] = ".toc\0";
|
||||
char tocheader[5];
|
||||
ACTUALHANDLE tochandle;
|
||||
char tocname[256];
|
||||
int i;
|
||||
int j;
|
||||
int retval;
|
||||
unsigned char cdvdtype;
|
||||
struct tocTN toctn;
|
||||
struct tocTD toctd;
|
||||
if (isofile == NULL) return(-1);
|
||||
i = 0;
|
||||
while ((i < 256) && (isofile->name[i] != 0))
|
||||
{
|
||||
tocname[i] = isofile->name[i];
|
||||
i++;
|
||||
} // ENDWHILE- Copying the data name to the toc name
|
||||
j = 0;
|
||||
while ((i < 256) && (tocext[j] != 0))
|
||||
{
|
||||
tocname[i] = tocext[j];
|
||||
i++;
|
||||
j++;
|
||||
} // ENDWHILE- Append ".toc" to end of name
|
||||
tocname[i] = 0; // And 0-terminate
|
||||
tochandle = ActualFileOpenForRead(tocname);
|
||||
if (tochandle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
|
||||
extern int IsoLoadTOC(struct IsoFile *isofile) {
|
||||
char tocext[] = ".toc\0";
|
||||
char tocheader[5];
|
||||
ACTUALHANDLE tochandle;
|
||||
char tocname[256];
|
||||
int i;
|
||||
int j;
|
||||
int retval;
|
||||
unsigned char cdvdtype;
|
||||
struct tocTN toctn;
|
||||
struct tocTD toctd;
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
|
||||
i = 0;
|
||||
while((i < 256) && (isofile->name[i] != 0)) {
|
||||
tocname[i] = isofile->name[i];
|
||||
i++;
|
||||
} // ENDWHILE- Copying the data name to the toc name
|
||||
j = 0;
|
||||
while((i < 256) && (tocext[j] != 0)) {
|
||||
tocname[i] = tocext[j];
|
||||
i++;
|
||||
j++;
|
||||
} // ENDWHILE- Append ".toc" to end of name
|
||||
tocname[i] = 0; // And 0-terminate
|
||||
|
||||
tochandle = ActualFileOpenForRead(tocname);
|
||||
if(tochandle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
retval = ActualFileRead(tochandle, 4, tocheader);
|
||||
if(retval < 4) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
|
||||
if((tocheader[0] != 'T') ||
|
||||
(tocheader[1] != 'O') ||
|
||||
(tocheader[2] != 'C') ||
|
||||
(tocheader[3] != '1')) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Not a 'toc' file after all?
|
||||
|
||||
retval = ActualFileRead(tochandle, 4, tocheader);
|
||||
if (retval < 4)
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
if ((tocheader[0] != 'T') ||
|
||||
(tocheader[1] != 'O') ||
|
||||
(tocheader[2] != 'C') ||
|
||||
(tocheader[3] != '1'))
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Not a 'toc' file after all?
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: IsoLoadTOC(%s)", tocname);
|
||||
PrintLog("CDVDiso TOC: IsoLoadTOC(%s)", tocname);
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
retval = ActualFileRead(tochandle, 1, (char *) & cdvdtype);
|
||||
if (retval < 1)
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
isofile->cdvdtype = cdvdtype;
|
||||
IsoInitTOC(isofile);
|
||||
|
||||
retval = ActualFileRead(tochandle, 1, (char *) &cdvdtype);
|
||||
if(retval < 1) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
if ((cdvdtype != CDVD_TYPE_PS2DVD) && (cdvdtype != CDVD_TYPE_DVDV))
|
||||
{
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTN), (char *) & toctn);
|
||||
if (retval < sizeof(struct tocTN))
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
|
||||
isofile->cdvdtype = cdvdtype;
|
||||
IsoInitTOC(isofile);
|
||||
|
||||
if((cdvdtype != CDVD_TYPE_PS2DVD) && (cdvdtype != CDVD_TYPE_DVDV)) {
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTN), (char *) &toctn);
|
||||
if(retval < sizeof(struct tocTN)) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
|
||||
if((toctn.strack > 99) || (toctn.etrack > 99)) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Track numbers out of range?
|
||||
if ((toctn.strack > 99) || (toctn.etrack > 99))
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Track numbers out of range?
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: Start Track %u End Track %u",
|
||||
toctn.strack, toctn.etrack);
|
||||
PrintLog("CDVDiso TOC: Start Track %u End Track %u",
|
||||
toctn.strack, toctn.etrack);
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
IsoAddTNToTOC(isofile, toctn);
|
||||
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
if(retval < sizeof(struct tocTD)) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
|
||||
if(toctd.type != 0) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Track numbers out of range?
|
||||
IsoAddTNToTOC(isofile, toctn);
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTD), (char *) & toctd);
|
||||
if (retval < sizeof(struct tocTD))
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
if (toctd.type != 0)
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Track numbers out of range?
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: Total Sectors: %lu", toctd.lsn);
|
||||
PrintLog("CDVDiso TOC: Total Sectors: %lu", toctd.lsn);
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
IsoAddTDToTOC(isofile, 0xAA, toctd);
|
||||
|
||||
for(i = toctn.strack; i <= toctn.etrack; i++) {
|
||||
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
if(retval < sizeof(struct tocTD)) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
IsoAddTDToTOC(isofile, 0xAA, toctd);
|
||||
for (i = toctn.strack; i <= toctn.etrack; i++)
|
||||
{
|
||||
retval = ActualFileRead(tochandle, sizeof(struct tocTD), (char *) & toctd);
|
||||
if (retval < sizeof(struct tocTD))
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the 'toc' file?
|
||||
#ifdef VERBOSE_FUNCTION_TOC
|
||||
PrintLog("CDVDiso TOC: Track %u Type %u Sector Start: %lu",
|
||||
i, toctd.type, toctd.lsn);
|
||||
PrintLog("CDVDiso TOC: Track %u Type %u Sector Start: %lu",
|
||||
i, toctd.type, toctd.lsn);
|
||||
#endif /* VERBOSE_FUNCTION_TOC */
|
||||
IsoAddTDToTOC(isofile, i, toctd);
|
||||
} // NEXT i- read in each track
|
||||
} // ENDIF- Not a DVD? (Then read in CD track data)
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
|
||||
return(0);
|
||||
IsoAddTDToTOC(isofile, i, toctd);
|
||||
} // NEXT i- read in each track
|
||||
} // ENDIF- Not a DVD? (Then read in CD track data)
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(0);
|
||||
} // END IsoLoadTOC()
|
||||
|
||||
extern int IsoSaveTOC(struct IsoFile *isofile)
|
||||
{
|
||||
char tocext[] = ".toc\0";
|
||||
char tocheader[] = "TOC1\0";
|
||||
ACTUALHANDLE tochandle;
|
||||
char tocname[256];
|
||||
int i;
|
||||
int j;
|
||||
int retval;
|
||||
unsigned char cdvdtype;
|
||||
struct tocTN toctn;
|
||||
struct tocTD toctd;
|
||||
char temptime[3];
|
||||
if (isofile == NULL) return(-1);
|
||||
i = 0;
|
||||
while ((i < 256) && (isofile->name[i] != 0))
|
||||
{
|
||||
tocname[i] = isofile->name[i];
|
||||
i++;
|
||||
} // ENDWHILE- Copying the data name to the toc name
|
||||
j = 0;
|
||||
while ((i < 256) && (tocext[j] != 0))
|
||||
{
|
||||
tocname[i] = tocext[j];
|
||||
i++;
|
||||
j++;
|
||||
} // ENDWHILE- Append ".toc" to end of name
|
||||
tocname[i] = 0; // And 0-terminate
|
||||
|
||||
extern int IsoSaveTOC(struct IsoFile *isofile) {
|
||||
char tocext[] = ".toc\0";
|
||||
char tocheader[] = "TOC1\0";
|
||||
ACTUALHANDLE tochandle;
|
||||
char tocname[256];
|
||||
int i;
|
||||
int j;
|
||||
int retval;
|
||||
unsigned char cdvdtype;
|
||||
struct tocTN toctn;
|
||||
struct tocTD toctd;
|
||||
char temptime[3];
|
||||
ActualFileDelete(tocname);
|
||||
tochandle = ActualFileOpenForWrite(tocname);
|
||||
if (tochandle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
if(isofile == NULL) return(-1);
|
||||
retval = ActualFileWrite(tochandle, 4, tocheader);
|
||||
if (retval < 4)
|
||||
{
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
ActualFileDelete(tocname);
|
||||
return(-1);
|
||||
} // ENDIF- Trouble writing to the 'toc' file?
|
||||
|
||||
i = 0;
|
||||
while((i < 256) && (isofile->name[i] != 0)) {
|
||||
tocname[i] = isofile->name[i];
|
||||
i++;
|
||||
} // ENDWHILE- Copying the data name to the toc name
|
||||
j = 0;
|
||||
while((i < 256) && (tocext[j] != 0)) {
|
||||
tocname[i] = tocext[j];
|
||||
i++;
|
||||
j++;
|
||||
} // ENDWHILE- Append ".toc" to end of name
|
||||
tocname[i] = 0; // And 0-terminate
|
||||
|
||||
ActualFileDelete(tocname);
|
||||
tochandle = ActualFileOpenForWrite(tocname);
|
||||
if(tochandle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
retval = ActualFileWrite(tochandle, 4, tocheader);
|
||||
if(retval < 4) {
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
ActualFileDelete(tocname);
|
||||
return(-1);
|
||||
} // ENDIF- Trouble writing to the 'toc' file?
|
||||
|
||||
cdvdtype = isofile->cdvdtype;
|
||||
ActualFileWrite(tochandle, 1, (char *) &cdvdtype);
|
||||
|
||||
if((cdvdtype != CDVD_TYPE_PS2DVD) && (cdvdtype != CDVD_TYPE_DVDV)) {
|
||||
toctn.strack = BCDTOHEX(isofile->toc[7]);
|
||||
toctn.etrack = BCDTOHEX(isofile->toc[17]);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTN), (char *) &toctn);
|
||||
|
||||
// Leadout Data
|
||||
toctd.type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
toctd.lsn = MSFtoLBA(temptime);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
|
||||
for(i = toctn.strack; i <= toctn.etrack; i++) {
|
||||
j = i * 10 + 30;
|
||||
toctd.type = isofile->toc[j];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[j + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[j + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[j + 9]);
|
||||
toctd.lsn = MSFtoLBA(temptime);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
} // NEXT i- write out each track
|
||||
} // ENDIF- Not a DVD? (Then output CD track data)
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
|
||||
return(0);
|
||||
cdvdtype = isofile->cdvdtype;
|
||||
ActualFileWrite(tochandle, 1, (char *) &cdvdtype);
|
||||
if ((cdvdtype != CDVD_TYPE_PS2DVD) && (cdvdtype != CDVD_TYPE_DVDV))
|
||||
{
|
||||
toctn.strack = BCDTOHEX(isofile->toc[7]);
|
||||
toctn.etrack = BCDTOHEX(isofile->toc[17]);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTN), (char *) &toctn);
|
||||
// Leadout Data
|
||||
toctd.type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
toctd.lsn = MSFtoLBA(temptime);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
for (i = toctn.strack; i <= toctn.etrack; i++)
|
||||
{
|
||||
j = i * 10 + 30;
|
||||
toctd.type = isofile->toc[j];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[j + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[j + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[j + 9]);
|
||||
toctd.lsn = MSFtoLBA(temptime);
|
||||
ActualFileWrite(tochandle, sizeof(struct tocTD), (char *) &toctd);
|
||||
} // NEXT i- write out each track
|
||||
} // ENDIF- Not a DVD? (Then output CD track data)
|
||||
ActualFileClose(tochandle);
|
||||
tochandle = ACTUALHANDLENULL;
|
||||
return(0);
|
||||
} // END IsoSaveTOC()
|
||||
|
|
|
@ -17,12 +17,9 @@
|
|||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TOC_H
|
||||
#define TOC_H
|
||||
|
||||
|
||||
// #ifndef __LINUX__
|
||||
// #ifdef __linux__
|
||||
// #define __LINUX__
|
||||
|
@ -31,54 +28,46 @@
|
|||
|
||||
// #define CDVDdefs
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
#include "isofile.h"
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_TOC
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack(1)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
struct tocTD {
|
||||
unsigned long lsn;
|
||||
unsigned char type;
|
||||
struct tocTD
|
||||
{
|
||||
unsigned long lsn;
|
||||
unsigned char type;
|
||||
#ifdef _WIN32
|
||||
};
|
||||
#else
|
||||
} __attribute__ ((packed));
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
struct tocTN {
|
||||
unsigned char strack;
|
||||
unsigned char etrack;
|
||||
struct tocTN
|
||||
{
|
||||
unsigned char strack;
|
||||
unsigned char etrack;
|
||||
#ifdef _WIN32
|
||||
};
|
||||
#else
|
||||
} __attribute__ ((packed));
|
||||
} __attribute__((packed));
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack()
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
// PCSX2's .toc file format:
|
||||
// 1 unsigned char - CDVD_TYPE_????
|
||||
// 1 tocTN
|
||||
// As many tocTDs as it takes.
|
||||
|
||||
|
||||
extern void IsoInitTOC(struct IsoFile *isofile);
|
||||
extern void IsoAddTNToTOC(struct IsoFile *isofile, struct tocTN toctn);
|
||||
extern void IsoAddTDToTOC(struct IsoFile *isofile,
|
||||
unsigned char track,
|
||||
struct tocTD toctd);
|
||||
|
||||
unsigned char track,
|
||||
struct tocTD toctd);
|
||||
extern int IsoLoadTOC(struct IsoFile *isofile);
|
||||
extern int IsoSaveTOC(struct IsoFile *isofile);
|
||||
|
||||
|
||||
#endif /* TOC_H */
|
||||
|
|
|
@ -1,72 +1,36 @@
|
|||
/* version.c
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#define __LINUX__
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char *libname = "EFP Iso CDVD Driver";
|
||||
|
||||
|
||||
|
||||
const unsigned char version = PS2E_CDVD_VERSION;
|
||||
|
||||
const unsigned char revision = 0;
|
||||
|
||||
const unsigned char build = 6;
|
||||
|
||||
/* version.c
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
#ifdef __linux__
|
||||
#define __LINUX__
|
||||
#endif /* __linux__ */
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
char *libname = "EFP Iso CDVD Driver";
|
||||
|
||||
const unsigned char version = PS2E_CDVD_VERSION;
|
||||
const unsigned char revision = 0;
|
||||
const unsigned char build = 6;
|
||||
|
|
|
@ -1,86 +1,39 @@
|
|||
/* version.h
|
||||
|
||||
* Copyright (C) 2002-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef VERSION_H
|
||||
|
||||
#define VERSION_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#define __LINUX__
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#endif /* No __LINUX__ */
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern char *libname;
|
||||
|
||||
|
||||
|
||||
extern const unsigned char version;
|
||||
|
||||
extern const unsigned char revision;
|
||||
|
||||
extern const unsigned char build;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* VERSION_H */
|
||||
|
||||
|
|
Loading…
Reference in New Issue