/[pcsx2_0.9.7]/trunk/plugins/CDVDpeops/toc.c
ViewVC logotype

Contents of /trunk/plugins/CDVDpeops/toc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 3241 byte(s)
committing r3113 initial commit again...
1 /***************************************************************************
2 toc.c - description
3 -------------------
4 begin : Sun Nov 16 2003
5 copyright : (C) 2003 by Pete Bernert
6 email : BlackDove@addcom.de
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. See also the license.txt file for *
15 * additional informations. *
16 * *
17 ***************************************************************************/
18
19 //*************************************************************************//
20 // History of changes:
21 //
22 // 2003/11/16 - Pete
23 // - generic cleanup for the Peops release
24 //
25 //*************************************************************************//
26
27 /////////////////////////////////////////////////////////
28
29 #include "stdafx.h"
30 #define _IN_TOC
31 #include "externals.h"
32
33 /////////////////////////////////////////////////////////
34
35 TOC sTOC;
36
37 /////////////////////////////////////////////////////////
38 // read toc
39
40
41 void ReadTOC(void)
42 {
43 unsigned char xbuffer[4];DWORD dwStatus;
44
45 LockGenCDAccess();
46
47 memset(&(sTOC),0,sizeof(sTOC)); // init toc infos
48
49 dwStatus=GetSCSITOC((LPTOC)&sTOC); // get toc by scsi... may change that for ioctrl in xp/2k?
50
51 UnlockGenCDAccess();
52
53 if(dwStatus!=SS_COMP) return;
54
55 #ifdef DBGOUT
56 auxprintf("TOC Last %d, max %08x,%08x\n",sTOC.cLastTrack,sTOC.tracks[sTOC.cLastTrack].lAddr,reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr));
57 #endif
58 // re-order it to psemu pro standards
59 addr2time(reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr),xbuffer);
60
61 #ifdef DBGOUT
62 auxprintf("TOC %d, %d, %d, %d\n",
63 xbuffer[0],xbuffer[1],xbuffer[2],xbuffer[3] );
64 #endif
65
66 xbuffer[0]=itob(xbuffer[0]);
67 xbuffer[1]=itob(xbuffer[1]);
68 xbuffer[2]=itob(xbuffer[2]);
69 xbuffer[3]=itob(xbuffer[3]);
70 lMaxAddr=time2addrB(xbuffer); // get max data adr
71 }
72
73 /////////////////////////////////////////////////////////
74 // get the highest address of first (=data) track
75
76 unsigned long GetLastTrack1Addr(void)
77 {
78 unsigned char xbuffer[4];DWORD dwStatus;
79 unsigned long lmax;
80 TOC xTOC;
81
82 LockGenCDAccess();
83
84 memset(&(xTOC),0,sizeof(xTOC));
85
86 dwStatus=GetSCSITOC((LPTOC)&xTOC);
87
88 UnlockGenCDAccess();
89
90 if(dwStatus!=SS_COMP) return 0;
91
92 addr2time(reOrder(xTOC.tracks[1].lAddr),xbuffer);
93
94 xbuffer[0]=itob(xbuffer[0]);
95 xbuffer[1]=itob(xbuffer[1]);
96 xbuffer[2]=itob(xbuffer[2]);
97 xbuffer[3]=itob(xbuffer[3]);
98
99 lmax=time2addrB(xbuffer);
100 if(lmax<150) return 0;
101
102 return lmax-150;
103 }
104
105 /////////////////////////////////////////////////////////

  ViewVC Help
Powered by ViewVC 1.1.22