/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/plugins/CDVDpeops/CheckDiskType.c
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/plugins/CDVDpeops/CheckDiskType.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (10 years, 8 months ago) by william
File MIME type: text/plain
File size: 916 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1
2 #include <stdio.h>
3 #include "CDVDlib.h"
4 #include "CDVDiso.h"
5 #include "CDVDisodrv.h"
6
7 int CheckDiskType(int baseType){
8 int f;
9 char buffer[256];//if a file is longer...it should be shorter :D
10 char *pos;
11 static struct TocEntry tocEntry;
12
13 CDVDFS_init();
14
15 // check if the file exists
16 if (CDVD_findfile("SYSTEM.CNF;1", &tocEntry) != TRUE){
17 if (CDVD_findfile("VIDEO_TS/VIDEO_TS.IFO;1", &tocEntry) != TRUE)
18 if (CDVD_findfile("PSX.EXE;1", &tocEntry) != TRUE)
19 return CDVD_TYPE_ILLEGAL;
20 else
21 return CDVD_TYPE_PSCD;
22 else
23 return CDVD_TYPE_DVDV;
24 }
25
26 f=CDVDFS_open("SYSTEM.CNF;1", 1);
27 CDVDFS_read(f, buffer, 256);
28 CDVDFS_close(f);
29
30 buffer[tocEntry.fileSize]='\0';
31
32 pos=strstr(buffer, "BOOT2");
33 if (pos==NULL){
34 pos=strstr(buffer, "BOOT");
35 if (pos==NULL) {
36 return CDVD_TYPE_ILLEGAL;
37 }
38 return CDVD_TYPE_PSCD;
39 }
40 return (baseType==CDVD_TYPE_DETCTCD)?CDVD_TYPE_PS2CD:CDVD_TYPE_PS2DVD;
41 }

  ViewVC Help
Powered by ViewVC 1.1.22