/[pcsx2_0.9.7]/trunk/pcsx2/RDebug/deci2_dcmp.cpp
ViewVC logotype

Contents of /trunk/pcsx2/RDebug/deci2_dcmp.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 5 months ago) by william
File size: 2682 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 #include "PrecompiledHeader.h"
18
19 #include "Common.h"
20 #include "deci2.h"
21
22 struct DECI2_DCMP_HEADER{
23 DECI2_HEADER h; //+00
24 u8 type, //+08
25 code; //+09
26 u16 _pad; //+0A
27 }; //=0C
28
29 struct DECI2_DCMP_CONNECT{
30 u8 result, //+00
31 _pad[3];//+01
32 u64 EEboot, //+04
33 IOPboot;//+0C
34 }; //=14
35
36 struct DECI2_DCMP_ECHO{
37 u16 identifier, //+00
38 sequence; //+02
39 u8 data[32]; //+04
40 }; //=24
41
42 void D2_DCMP(const u8 *inbuffer, u8 *outbuffer, char *message){
43 DECI2_DCMP_HEADER *in=(DECI2_DCMP_HEADER*)inbuffer,
44 *out=(DECI2_DCMP_HEADER*)outbuffer;
45 u8 *data=(u8*)in+sizeof(DECI2_DCMP_HEADER);
46
47 //DECI2_DCMP_CONNECT *connect=(DECI2_DCMP_CONNECT*)data;
48 //DECI2_DCMP_ECHO *echo =(DECI2_DCMP_ECHO*)data;
49
50 memcpy(outbuffer, inbuffer, 128*1024);//BUFFERSIZE
51 out->h.length=sizeof(DECI2_DCMP_HEADER);
52 /* switch(in->type){
53 case 0:
54 sprintf(message, " [DCMP] type=CONNECT code=%s EEboot=0x%I64X IOP=0x%I64X",
55 in->code==0?"CONNECT":"DISCONNECT", connect->EEboot, connect->IOPboot);
56 data=(u8*)out+sizeof(DECI2_DCMP_HEADER);
57 connect=(DECI2_DCMP_CONNECT*)data;
58 connect->result=0;
59 break;
60 case 1:
61 sprintf(message, " [DCMP] type=ECHO id=%X seq=%X", echo->identifier, echo->sequence);
62 exchangeSD(&out->h);
63 break;
64 // not implemented, not needed?
65 default:
66 sprintf(message, " [DCMP] type=%d[unknown]", in->type);
67 }*/
68 out->code++;
69 }
70
71 void sendDCMP(u16 protocol, u8 source, u8 destination, u8 type, u8 code, char *data, int size){
72 static u8 tmp[100];
73 ((DECI2_DCMP_HEADER*)tmp)->h.length =sizeof(DECI2_DCMP_HEADER)+size;
74 ((DECI2_DCMP_HEADER*)tmp)->h._pad =0;
75 ((DECI2_DCMP_HEADER*)tmp)->h.protocol =protocol;
76 ((DECI2_DCMP_HEADER*)tmp)->h.source =source;
77 ((DECI2_DCMP_HEADER*)tmp)->h.destination=destination;
78 ((DECI2_DCMP_HEADER*)tmp)->type =type;
79 ((DECI2_DCMP_HEADER*)tmp)->code =code;
80 ((DECI2_DCMP_HEADER*)tmp)->_pad =0;
81 memcpy(&tmp[sizeof(DECI2_DCMP_HEADER)], data, size);
82 writeData(tmp);
83 }

  ViewVC Help
Powered by ViewVC 1.1.22