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

Contents of /trunk/pcsx2/RDebug/deci2_iloadp.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: 3562 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 "IopCommon.h"
20 #include "IopBios2.h"
21 #include "deci2.h"
22
23 struct DECI2_ILOADP_HEADER{
24 DECI2_HEADER h; //+00
25 u8 code, //+08 cmd
26 action, //+09
27 result, //+0A
28 stamp; //+0B
29 u32 moduleId; //+0C
30 }; //=10
31
32 struct DECI2_ILOADP_INFO{
33 u16 version, //+00
34 flags; //+02
35 u32 module_address, //+04
36 text_size, //+08
37 data_size, //+0C
38 bss_size, //+10
39 _pad[3]; //+14
40 };
41
42 void writeInfo(DECI2_ILOADP_INFO *info,
43 u16 version, u16 flags, u32 module_address,
44 u32 text_size, u32 data_size, u32 bss_size){
45 info->version =version;
46 info->flags =flags;
47 info->module_address=module_address;
48 info->text_size =text_size;
49 info->data_size =data_size;
50 info->bss_size =bss_size;
51 info->_pad[0]=info->_pad[1]=info->_pad[2]=0;
52 }
53
54 void D2_ILOADP(const u8 *inbuffer, u8 *outbuffer, char *message){
55 DECI2_ILOADP_HEADER *in=(DECI2_ILOADP_HEADER*)inbuffer,
56 *out=(DECI2_ILOADP_HEADER*)outbuffer;
57 u8 *data=(u8*)in+sizeof(DECI2_ILOADP_HEADER);
58 const irxImageInfo *iii;
59 static char line[1024];
60
61 memcpy(outbuffer, inbuffer, 128*1024);//BUFFERSIZE
62 out->h.length=sizeof(DECI2_ILOADP_HEADER);
63 out->code++;
64 out->result=0; //ok
65 exchangeSD((DECI2_HEADER*)out);
66 switch(in->code){
67 case 0:
68 sprintf(line, "code=START action=%d stamp=%d moduleId=0x%X", in->action, in->stamp, in->moduleId);
69 break;
70 case 2:
71 sprintf(line, "code=REMOVE action=%d stamp=%d moduleId=0x%X", in->action, in->stamp, in->moduleId);
72 break;
73 case 4:
74 sprintf(line, "code=LIST action=%d stamp=%d moduleId=0x%X", in->action, in->stamp, in->moduleId);
75 data=(u8*)out+sizeof(DECI2_ILOADP_HEADER);
76 for (iii=iopVirtMemR<irxImageInfo>(0x800); iii; iii=iii->next?iopVirtMemR<irxImageInfo>(iii->next):0, data+=4)
77 *(u32*)data=iii->index;
78
79 out->h.length=data-(u8*)out;
80 break;
81 case 6:
82 sprintf(line, "code=INFO action=%d stamp=%d moduleId=0x%X", in->action, in->stamp, in->moduleId);
83 data=(u8*)out+sizeof(DECI2_ILOADP_HEADER);
84 for(iii=iopVirtMemR<irxImageInfo>(0x800); iii; iii=iii->next?iopVirtMemR<irxImageInfo>(iii->next):0)
85 if (iii->index==in->moduleId){
86 writeInfo((DECI2_ILOADP_INFO*)data,
87 iii->version, iii->flags, iii->vaddr, iii->text_size, iii->data_size, iii->bss_size);
88 data+=sizeof(DECI2_ILOADP_INFO);
89 strcpy((char*)data, iopVirtMemR<char>(iii->name));
90 data+=strlen(iopVirtMemR<char>(iii->name))+4;
91 data=(u8*)((int)data & 0xFFFFFFFC);
92 break;
93
94 }
95 out->h.length=data-(u8*)out;
96 break;
97 case 8:
98 sprintf(line, "code=WATCH action=%d stamp=%d moduleId=0x%X", in->action, in->stamp, in->moduleId);
99 break;
100 default:
101 sprintf(line, "code=%d[unknown]", in->code);
102 }
103 sprintf(message, "[ILOADP %c->%c/%04X] %s", in->h.source, in->h.destination, in->h.length, line);
104 writeData(outbuffer);
105 }

  ViewVC Help
Powered by ViewVC 1.1.22