/[pcsx2_0.9.7]/trunk/pcsx2/CDVD/CDVD.h
ViewVC logotype

Contents of /trunk/pcsx2/CDVD/CDVD.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years, 5 months ago) by william
File MIME type: text/plain
File size: 3195 byte(s)
committing r3113 initial commit again...
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16
17 #pragma once
18
19
20 #include "IopCommon.h"
21 #include "CDVD/CDVDaccess.h"
22
23 #define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
24 #define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
25
26 static __forceinline s32 msf_to_lsn(u8 *Time)
27 {
28 u32 lsn;
29
30 lsn = Time[2];
31 lsn +=(Time[1] - 2) * 75;
32 lsn += Time[0] * 75 * 60;
33 return lsn;
34 }
35
36 static __forceinline s32 msf_to_lba(u8 m, u8 s, u8 f)
37 {
38 u32 lsn;
39 lsn = f;
40 lsn += (s - 2) * 75;
41 lsn += m * 75 * 60;
42 return lsn;
43 }
44
45 static __forceinline void lsn_to_msf(u8 *Time, s32 lsn)
46 {
47 u8 m, s, f;
48
49 lsn += 150;
50 m = lsn / 4500; // minuten
51 lsn = lsn - m * 4500; // minuten rest
52 s = lsn / 75; // sekunden
53 f = lsn - (s * 75); // sekunden rest
54 Time[0] = itob(m);
55 Time[1] = itob(s);
56 Time[2] = itob(f);
57 }
58
59 static __forceinline void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
60 {
61 lba += 150;
62 *m = lba / (60 * 75);
63 *s = (lba / 75) % 60;
64 *f = lba % 75;
65 }
66
67 struct cdvdRTC {
68 u8 status;
69 u8 second;
70 u8 minute;
71 u8 hour;
72 u8 pad;
73 u8 day;
74 u8 month;
75 u8 year;
76 };
77
78 struct cdvdStruct {
79 u8 nCommand;
80 u8 Ready;
81 u8 Error;
82 u8 PwOff;
83 u8 Status;
84 u8 Type;
85 u8 sCommand;
86 u8 sDataIn;
87 u8 sDataOut;
88 u8 HowTo;
89
90 u8 Param[32];
91 u8 Result[32];
92
93 u8 ParamC;
94 u8 ParamP;
95 u8 ResultC;
96 u8 ResultP;
97
98 u8 CBlockIndex;
99 u8 COffset;
100 u8 CReadWrite;
101 u8 CNumBlocks;
102
103 int RTCcount;
104 cdvdRTC RTC;
105
106 u32 Sector;
107 int nSectors;
108 int Readed; // change to bool. --arcum42
109 int Reading; // same here.
110 int ReadMode;
111 int BlockSize; // Total bytes transfered at 1x speed
112 int Speed;
113 int RetryCnt;
114 int RetryCntP;
115 int RErr;
116 int SpindlCtrl;
117
118 u8 Key[16];
119 u8 KeyXor;
120 u8 decSet;
121
122 u8 mg_buffer[65536];
123 int mg_size;
124 int mg_maxsize;
125 int mg_datatype;//0-data(encrypted); 1-header
126 u8 mg_kbit[16];//last BIT key 'seen'
127 u8 mg_kcon[16];//last content key 'seen'
128
129 u8 Action; // the currently scheduled emulated action
130 u32 SeekToSector; // Holds the destination sector during seek operations.
131 u32 ReadTime; // Avg. time to read one block of data (in Iop cycles)
132 bool Spinning; // indicates if the Cdvd is spinning or needs a spinup delay
133 };
134
135
136 extern void cdvdReset();
137 extern void cdvdVsync();
138 extern void cdvdActionInterrupt();
139 extern void cdvdReadInterrupt();
140
141 // We really should not have a function with the exact same name as a callback except for case!
142 extern void cdvdNewDiskCB();
143 extern u8 cdvdRead(u8 key);
144 extern void cdvdWrite(u8 key, u8 rt);
145
146 extern void cdvdReloadElfInfo(wxString elfoverride = wxEmptyString);
147
148 extern wxString DiscID;

  ViewVC Help
Powered by ViewVC 1.1.22