/[pcsx2_0.9.7]/trunk/pcsx2/windows/cheats/browser.cpp
ViewVC logotype

Contents of /trunk/pcsx2/windows/cheats/browser.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File size: 30119 byte(s)
re-commit (had local access denied errors when committing)
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 "../Win32.h"
18
19 #include "../cheatscpp.h"
20
21 #include "PS2Edefs.h"
22 #include "Memory.h"
23 #include "Elfheader.h"
24 #include "cheats.h"
25 #include "../../patch.h"
26
27 HWND hWndBrowser;
28
29
30 /// ADDED CODE ///
31 void CreateListBox(HWND hWnd)
32 {
33 // Setting the ListView style
34 LRESULT lStyle = SendMessage(GetDlgItem(hWnd,IDC_PATCHES), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
35 SendMessage(GetDlgItem(hWnd,IDC_PATCHES), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, lStyle | LVS_EX_FULLROWSELECT);
36
37 // Adding colummns to the ListView
38 LVCOLUMN cols[7]={
39 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,70,"Address",0,0,0},
40 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,35,"CPU",1,0,0},
41 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,70,"Data",2,0,0},
42 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,50,"Enabled",3,0,0},
43 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,45,"Group",4,0,0},
44 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,80,"PlaceToPatch",5,0,0},
45 {LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM,0,50,"Type",6,0,0}
46 };
47
48 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),0,&cols[0]);
49 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),1,&cols[1]);
50 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),2,&cols[2]);
51 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),3,&cols[3]);
52 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),4,&cols[4]);
53 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),5,&cols[5]);
54 ListView_InsertColumn(GetDlgItem(hWnd,IDC_PATCHES),6,&cols[6]);
55 }
56
57 void RefreshListBox(HWND hWnd)
58 {
59 // First delete all items
60 ListView_DeleteAllItems(GetDlgItem(hWnd,IDC_PATCHES));
61
62 char Address[100], CPU[100], Data[100], Enabled[100], Group[100], PlaceToPatch[100], Type[100];
63
64 LVITEM item[7]={
65 {LVIF_TEXT|LVIF_STATE,0,0,0,0,Address,0,0,0,0},
66 {LVIF_TEXT|LVIF_STATE,0,1,0,0,CPU,0,0,0,0},
67 {LVIF_TEXT|LVIF_STATE,0,2,0,0,Data,0,0,0,0},
68 {LVIF_TEXT|LVIF_STATE,0,3,0,0,Enabled,0,0,0,0},
69 {LVIF_TEXT|LVIF_STATE,0,4,0,0,Group,0,0,0,0},
70 {LVIF_TEXT|LVIF_STATE,0,5,0,0,PlaceToPatch,0,0,0,0},
71 {LVIF_TEXT|LVIF_STATE,0,6,0,0,Type,0,0,0,0}
72 };
73
74 char datatype[4][10]={"byte", "short", "word", "double"};
75 char cpucore[2][10]={"EE", "IOP"};
76
77 // Adding items
78 for (int i = patchnumber-1; i >= 0; i--)
79 {
80 sprintf(Address, "0x%.8x", patch[i].addr);
81 sprintf(CPU, "%s", cpucore[patch[i].cpu-1]);
82 sprintf(Data, "0x%.8x", patch[i].data);
83 sprintf(Enabled, "%s", patch[i].enabled?"Yes":"No");
84 sprintf(Group, "%d", patch[i].group);
85 sprintf(PlaceToPatch, "%d", patch[i].placetopatch);
86 sprintf(Type, "%s", datatype[patch[i].type-1]);
87
88 ListView_InsertItem(GetDlgItem(hWnd,IDC_PATCHES),&item[0]);
89 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[1]);
90 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[2]);
91 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[3]);
92 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[4]);
93 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[5]);
94 ListView_SetItem(GetDlgItem(hWnd,IDC_PATCHES),&item[6]);
95 }
96 }
97
98
99 // Decryption code for GS2v3-4/GS5 from maxconvert 0.71
100 unsigned char gsv3_bseeds1[256] = {
101 0x6E, 0x3C, 0x01, 0x30, 0x45, 0xDA, 0xA1, 0x77, 0x6A, 0x41, 0xFC, 0xC6, 0x00, 0xEA, 0x2F, 0x23,
102 0xD9, 0x6F, 0x79, 0x39, 0x7E, 0xCC, 0x9A, 0x4E, 0x1E, 0xF4, 0xA7, 0x3D, 0x05, 0x75, 0xD0, 0x36,
103 0x9E, 0x8D, 0xF8, 0x8B, 0x96, 0x7A, 0xBF, 0x49, 0x62, 0x4F, 0x2A, 0xB8, 0xAF, 0x60, 0x80, 0x0D,
104 0x99, 0x89, 0xA9, 0xED, 0xB6, 0xD5, 0x7B, 0x54, 0x56, 0x65, 0x5C, 0xB3, 0xD3, 0x11, 0xDF, 0x27,
105 0x10, 0x71, 0x91, 0x3E, 0x25, 0x52, 0x46, 0x15, 0x3A, 0x31, 0x51, 0x81, 0xC5, 0xB1, 0xBE, 0x43,
106 0x95, 0x7C, 0x83, 0x53, 0x38, 0x88, 0x21, 0x4C, 0x9B, 0x7F, 0x90, 0xB9, 0xDB, 0x55, 0x33, 0xB7,
107 0xAD, 0x61, 0xD8, 0xE1, 0xE4, 0x20, 0xDC, 0x5F, 0xA4, 0x67, 0x26, 0x97, 0x2E, 0xAC, 0x7D, 0x24,
108 0xBD, 0x22, 0x04, 0x6C, 0xC0, 0x73, 0xE0, 0x32, 0x0C, 0xA3, 0xEE, 0x2B, 0xA0, 0x8A, 0x5B, 0xF3,
109 0xA6, 0xD1, 0x68, 0x8E, 0xAE, 0xC7, 0x9C, 0x82, 0xB4, 0xF9, 0xF6, 0xC4, 0x1B, 0xAB, 0x57, 0xCE,
110 0xEF, 0x69, 0xF7, 0x74, 0xFF, 0xA2, 0x6D, 0xF5, 0xB2, 0x0A, 0x37, 0x1F, 0xEC, 0x06, 0x5D, 0x0F,
111 0xB0, 0x08, 0xD7, 0xE3, 0x85, 0x58, 0x1A, 0x9F, 0x1D, 0x84, 0xE9, 0xEB, 0x0E, 0x66, 0x64, 0x40,
112 0x4A, 0x44, 0x35, 0x92, 0x3B, 0x86, 0xF0, 0xF2, 0xAA, 0x47, 0xCB, 0x02, 0xB5, 0xDD, 0xD2, 0x13,
113 0x16, 0x07, 0xC2, 0xE5, 0x17, 0xA5, 0x5E, 0xCA, 0xD6, 0xC9, 0x87, 0x2D, 0xC1, 0xCD, 0x76, 0x50,
114 0x1C, 0xE2, 0x8F, 0x29, 0xD4, 0xDE, 0xA8, 0xE7, 0x14, 0xFB, 0xC3, 0xE6, 0xFD, 0x5A, 0x48, 0xCF,
115 0x98, 0x42, 0x63, 0x4D, 0xBB, 0xE8, 0x70, 0xF1, 0x12, 0x78, 0x0B, 0xFA, 0xBA, 0x18, 0x93, 0x9D,
116 0x6B, 0x28, 0x2C, 0x09, 0x59, 0xFE, 0xC8, 0x34, 0x03, 0x94, 0x72, 0x8C, 0x3F, 0x4B, 0x19, 0xBC
117 };
118
119 unsigned char gsv3_bseeds2[25] = { 0x12, 0x18, 0x07, 0x0A, 0x17, 0x16, 0x10, 0x00,
120 0x05, 0x0D, 0x04, 0x02, 0x09, 0x08, 0x0E, 0x0F, 0x13, 0x11, 0x01, 0x15,
121 0x03, 0x06, 0x0C, 0x0B, 0x14
122 };
123
124 unsigned char gsv3_bseeds3[64] = {0x1D, 0x01, 0x33, 0x0B, 0x23, 0x22, 0x2C, 0x24,
125 0x0E, 0x2A, 0x2D, 0x0F, 0x2B, 0x20, 0x08, 0x34, 0x17, 0x1B, 0x36, 0x0C,
126 0x12, 0x1F, 0x35, 0x27, 0x0A, 0x31, 0x11, 0x05, 0x1E, 0x32, 0x14, 0x02,
127 0x21, 0x03, 0x04, 0x0D, 0x09, 0x16, 0x2E, 0x1A, 0x26, 0x25, 0x2F, 0x07,
128 0x1C, 0x29, 0x18, 0x30, 0x10, 0x15, 0x13, 0x19, 0x06, 0x38, 0x28, 0x00,
129 0x37, 0x48, 0x48, 0x7F, 0x45, 0x45, 0x45, 0x7F
130 };
131
132 unsigned char gsv3_bseeds4[64] = { 0x10, 0x01, 0x18, 0x3C, 0x33, 0x29, 0x00, 0x06,
133 0x07, 0x02, 0x04, 0x13, 0x0B, 0x28, 0x15, 0x08, 0x1F, 0x3E, 0x0C, 0x05,
134 0x11, 0x1D, 0x1E, 0x27, 0x1A, 0x17, 0x38, 0x23, 0x2D, 0x37, 0x03, 0x2C,
135 0x2A, 0x1B, 0x22, 0x39, 0x25, 0x14, 0x24, 0x34, 0x20, 0x2F, 0x36, 0x3F,
136 0x3A, 0x0E, 0x0F, 0x2B, 0x32, 0x31, 0x21, 0x12, 0x26, 0x35, 0x30, 0x3B,
137 0x09, 0x19, 0x16, 0x0D, 0x0A, 0x2E, 0x3D, 0x1C
138 };
139
140 unsigned short gsv3_hseeds[4] = { 0x6C27, 0x1D38, 0x7FE1, 0x0000};
141
142 unsigned char gsv3_bseeds101[256] = {
143 0x0C, 0x02, 0xBB, 0xF8, 0x72, 0x1C, 0x9D, 0xC1, 0xA1, 0xF3, 0x99, 0xEA, 0x78, 0x2F, 0xAC, 0x9F,
144 0x40, 0x3D, 0xE8, 0xBF, 0xD8, 0x47, 0xC0, 0xC4, 0xED, 0xFE, 0xA6, 0x8C, 0xD0, 0xA8, 0x18, 0x9B,
145 0x65, 0x56, 0x71, 0x0F, 0x6F, 0x44, 0x6A, 0x3F, 0xF1, 0xD3, 0x2A, 0x7B, 0xF2, 0xCB, 0x6C, 0x0E,
146 0x03, 0x49, 0x77, 0x5E, 0xF7, 0xB2, 0x1F, 0x9A, 0x54, 0x13, 0x48, 0xB4, 0x01, 0x1B, 0x43, 0xFC,
147 0xAF, 0x09, 0xE1, 0x4F, 0xB1, 0x04, 0x46, 0xB9, 0xDE, 0x27, 0xB0, 0xFD, 0x57, 0xE3, 0x17, 0x29,
148 0xCF, 0x4A, 0x45, 0x53, 0x37, 0x5D, 0x38, 0x8E, 0xA5, 0xF4, 0xDD, 0x7E, 0x3A, 0x9E, 0xC6, 0x67,
149 0x2D, 0x61, 0x28, 0xE2, 0xAE, 0x39, 0xAD, 0x69, 0x82, 0x91, 0x08, 0xF0, 0x73, 0x96, 0x00, 0x11,
150 0xE6, 0x41, 0xFA, 0x75, 0x93, 0x1D, 0xCE, 0x07, 0xE9, 0x12, 0x25, 0x36, 0x51, 0x6E, 0x14, 0x59,
151 0x2E, 0x4B, 0x87, 0x52, 0xA9, 0xA4, 0xB5, 0xCA, 0x55, 0x31, 0x7D, 0x23, 0xFB, 0x21, 0x83, 0xD2,
152 0x5A, 0x42, 0xB3, 0xEE, 0xF9, 0x50, 0x24, 0x6B, 0xE0, 0x30, 0x16, 0x58, 0x86, 0xEF, 0x20, 0xA7,
153 0x7C, 0x06, 0x95, 0x79, 0x68, 0xC5, 0x80, 0x1A, 0xD6, 0x32, 0xB8, 0x8D, 0x6D, 0x60, 0x84, 0x2C,
154 0xA0, 0x4D, 0x98, 0x3B, 0x88, 0xBC, 0x34, 0x5F, 0x2B, 0x5B, 0xEC, 0xE4, 0xFF, 0x70, 0x4E, 0x26,
155 0x74, 0xCC, 0xC2, 0xDA, 0x8B, 0x4C, 0x0B, 0x85, 0xF6, 0xC9, 0xC7, 0xBA, 0x15, 0xCD, 0x8F, 0xDF,
156 0x1E, 0x81, 0xBE, 0x3C, 0xD4, 0x35, 0xC8, 0xA2, 0x62, 0x10, 0x05, 0x5C, 0x66, 0xBD, 0xD5, 0x3E,
157 0x76, 0x63, 0xD1, 0xA3, 0x64, 0xC3, 0xDB, 0xD7, 0xE5, 0xAA, 0x0D, 0xAB, 0x9C, 0x33, 0x7A, 0x90,
158 0xB6, 0xE7, 0xB7, 0x7F, 0x19, 0x97, 0x8A, 0x92, 0x22, 0x89, 0xEB, 0xD9, 0x0A, 0xDC, 0xF5, 0x94
159 };
160
161
162 u8 DecryptGS2v3(u32* address, u32* value, u8 ctrl)
163 {
164 u32 command = *address & 0xFE000000;
165 u32 tmp = 0, tmp2 = 0, mask = 0, i = 0;
166 u8 bmask[4], flag;
167 u8 encFlag = (*address >> 25) & 0x7;
168
169 if(ctrl > 0)
170 {
171 switch(ctrl)
172 {
173 case 2:
174 {
175 *address ^= (gsv3_hseeds[1] << 2);
176 *value ^= (gsv3_hseeds[1] << 13);
177 for(i = 0; i < 0x40; i++)
178 {
179 if(i < 32)
180 {
181 flag = (*value >> i) & 1;
182 }
183 else
184 {
185 flag = (*address >> (i - 32)) & 1;
186 }
187
188 if(flag > 0)
189 {
190 if(gsv3_bseeds4[i] < 32)
191 {
192 tmp2 |= (1 << gsv3_bseeds4[i]);
193 }
194 else
195 {
196 tmp |= (1 << (gsv3_bseeds4[i] - 32));
197 }
198 }
199 }
200
201 *address = tmp ^ (gsv3_hseeds[2] << 3);
202 *value = tmp2 ^ gsv3_hseeds[2];
203 break;
204 }
205
206 case 4:
207 {
208 tmp = *address ^ (gsv3_hseeds[1] << 3);
209 bmask[0] = gsv3_bseeds1[(tmp >> 24) & 0xFF];
210 bmask[1] = gsv3_bseeds1[(tmp >> 16) & 0xFF];
211 bmask[2] = gsv3_bseeds1[(tmp >> 8) & 0xFF];
212 bmask[3] = gsv3_bseeds1[tmp & 0xFF];
213 tmp = (bmask[0] << 24) | (bmask[1] << 16) | (bmask[2] << 8) | bmask[3];
214 *address = tmp ^ (gsv3_hseeds[2] << 16);
215
216 tmp = *value ^ (gsv3_hseeds[1] << 9);
217 bmask[0] = gsv3_bseeds1[(tmp >> 24) & 0xFF];
218 bmask[1] = gsv3_bseeds1[(tmp >> 16) & 0xFF];
219 bmask[2] = gsv3_bseeds1[(tmp >> 8) & 0xFF];
220 bmask[3] = gsv3_bseeds1[tmp & 0xFF];
221 tmp = (bmask[0] << 24) | (bmask[1] << 16) | (bmask[2] << 8) | bmask[3];
222 *value = tmp ^ (gsv3_hseeds[2] << 5);
223 break;
224 }
225 }
226 return 0;
227 }
228
229 if(command >= 0x30000000 && command <= 0x6FFFFFFF)
230 {
231 if(encFlag == 1 || encFlag == 2)
232 {
233 ctrl = 2;
234 }
235 else if (encFlag == 3 || encFlag == 4)
236 {
237 ctrl = 4;
238 }
239 }
240
241 switch(encFlag)
242 {
243 case 0:
244 {
245 break;
246 }
247
248 case 1:
249 {
250 tmp = *address & 0x01FFFFFF;
251 tmp = tmp ^ (gsv3_hseeds[1] << 8);
252 mask = 0;
253 for(i = 0; i < 25; i++)
254 {
255 mask |= ((tmp & (1 << i)) >> i) << gsv3_bseeds2[i];
256 }
257 tmp = mask ^ gsv3_hseeds[2];
258 tmp |= command;
259 *address = tmp & 0xF1FFFFFF;
260 break;
261 }
262
263 case 2:
264 {
265 if(encFlag == 2)
266 {
267 tmp = *address & 0x01FFFFFF;
268 *address = tmp ^ (gsv3_hseeds[1] << 1);
269 *value ^= (gsv3_hseeds[1] << 16);
270 tmp = 0;
271 tmp2 = 0;
272 for(i = 0; i < 0x39; i++)
273 {
274 if(i < 32)
275 {
276 flag = (*value >> i) & 1;
277 }
278 else
279 {
280 flag = (*address >> (i - 32)) & 1;
281 }
282
283 if(flag > 0)
284 {
285 if(gsv3_bseeds3[i] < 32)
286 {
287 tmp2 |= (1 << gsv3_bseeds3[i]);
288 }
289 else
290 {
291 tmp |= (1 << (gsv3_bseeds3[i] - 32));
292 }
293 }
294 }
295 *address = ((tmp ^ (gsv3_hseeds[2] << 8)) | command) & 0xF1FFFFFF;
296 *value = tmp2 ^ gsv3_hseeds[2];
297 }
298 break;
299 }
300
301 case 3:
302 {
303 tmp = *address ^ (gsv3_hseeds[1] << 8);
304 bmask[0] = gsv3_bseeds1[(tmp >> 8) & 0xFF];
305 bmask[1] = gsv3_bseeds1[(tmp & 0xFF)];
306 tmp = (tmp & 0xFFFF0000) ;
307 tmp |= (bmask[0] ^ (bmask[1] << 8)) ;
308 tmp ^= (gsv3_hseeds[2] << 4);
309 *address = tmp & 0xF1FFFFFF;
310 break;
311 }
312
313 case 4:
314 {
315 tmp = *address ^ (gsv3_hseeds[1] << 8);
316 bmask[0] = gsv3_bseeds1[(tmp >> 8) & 0xFF];
317 bmask[1] = gsv3_bseeds1[(tmp & 0xFF)];
318 tmp = (tmp & 0xFFFF0000) ;
319 tmp |= (bmask[1] | (bmask[0] << 8)) ;
320 tmp ^= (gsv3_hseeds[2] << 4);
321 tmp2 = *address ^ (gsv3_hseeds[1] << 3);
322 *address = tmp & 0xF1FFFFFF;
323 tmp = *value ^ (gsv3_hseeds[1] << 9);
324 bmask[0] = gsv3_bseeds1[(tmp >> 24) & 0xFF];
325 bmask[1] = gsv3_bseeds1[(tmp >> 16) & 0xFF];
326 bmask[2] = gsv3_bseeds1[(tmp >> 8) & 0xFF];
327 bmask[3] = gsv3_bseeds1[tmp & 0xFF];
328 tmp = (bmask[0] << 24) | (bmask[1] << 16) | (bmask[2] << 8) | bmask[3];
329 *value = tmp ^ (gsv3_hseeds[2] << 5);
330 break;
331 }
332
333 case 5:
334 case 6:
335 case 7:
336 default:
337 break;
338 }
339
340 return ctrl;
341
342 }
343
344 struct Cheat
345 {
346 unsigned int address, value;
347 };
348
349 int ParseCheats(char *cur, std::vector<Cheat> &Cheats, HWND hWnd)
350 {
351 // Parse the text and put the cheats to the vector
352 while(*cur!=NULL){
353 Cheat C;
354
355 // if there is endline advance 2 chars
356 if(*cur==0x0d && *(cur+1)==0x0a)
357 cur+=2;
358 // check if new start is null
359 if(*cur==NULL)
360 break;
361
362 // get address and value and insert in the vector
363 int ret = sscanf(cur, "%X %X", &C.address, &C.value);
364 if(ret != 2)
365 {
366 MessageBox(hWnd,"Code conversion is probably wrong.","Error",0);
367 return 0;
368 }
369 Cheats.insert(Cheats.end(), C);
370 cur+=17;
371 }
372 return 1;
373 }
374
375
376 // Callback for the GameShark2 v3-4 cheat dialog
377 BOOL CALLBACK AddGS(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
378 {
379 int wmId,wmEvent;
380 static HWND hParent;
381
382 switch(uMsg)
383 {
384
385 case WM_PAINT:
386 return FALSE;
387 case WM_INITDIALOG:
388 hParent=(HWND)lParam;
389 break;
390 case WM_COMMAND:
391 wmId = LOWORD(wParam);
392 wmEvent = HIWORD(wParam);
393 // Parse the menu selections:
394 switch (wmId)
395 {
396 case IDCANCEL:
397 EndDialog(hWnd,1);
398 break;
399
400 case IDC_CONVERT: // Convert the code
401 {
402 std::vector<Cheat> Cheats;
403 char chepa[256];
404
405 // Set ready text to false
406 SetWindowText(GetDlgItem(hWnd,IDC_READY), "0");
407
408 // Get the text from the edit control and load it
409 GetWindowText(GetDlgItem(hWnd,IDC_ADDR),chepa,256);
410
411 // Parsing the cheats
412 ParseCheats(chepa, Cheats, hWnd);
413
414 int control = 0;
415 *chepa=0;
416 // Decrypt multiline code
417 for(unsigned int i=0;i<Cheats.size();i++)
418 {
419 control = DecryptGS2v3(&Cheats[i].address, &Cheats[i].value, control);
420
421 // Add decrypted code to final string
422 char temp[128];
423 sprintf(temp, "%.8X %.8X", Cheats[i].address, Cheats[i].value);
424 strcat(chepa, temp);
425 strcat(chepa, "\x0d\x0a");
426 }
427
428 // Set output textbox with decoded lines
429 SetWindowText(GetDlgItem(hWnd,IDC_CONVERTEDCODE),chepa);
430 SetWindowText(GetDlgItem(hWnd,IDC_READY), "1");
431 break;
432
433 }
434
435
436 case IDOK: // Add the code
437 {
438 std::vector<Cheat> Cheats;
439 char ready[2], chepa[256];
440
441 // Check if we are ready to add first
442 GetWindowText(GetDlgItem(hWnd,IDC_READY),ready,2);
443 if(ready[0] == '0')
444 {
445 MessageBox(hWnd, "First convert the code.", "Error", 0);
446 break;
447 }
448
449 // Get the text from the edit control and load it
450 GetWindowText(GetDlgItem(hWnd,IDC_CONVERTEDCODE),chepa,256);
451
452 // Parsing the cheats
453 int ret = ParseCheats(chepa, Cheats, hWnd);
454
455 if(ret == 1)
456 {
457 // Adding cheats
458 for(unsigned int i=0;i<Cheats.size();i++)
459 AddPatch(1,1, Cheats[i].address, 3, Cheats[i].value);
460
461 RefreshListBox(hParent);
462
463 // Close the dialog
464 EndDialog(hWnd,1);
465 }
466 else
467 {
468 MessageBox(hWnd, "Error adding cheats.", "Error", 0);
469 }
470
471 break;
472 }
473
474
475 default:
476 return FALSE;
477 }
478 break;
479 default:
480 return FALSE;
481 }
482
483 return TRUE;
484 }
485
486
487
488 // Callback for the RAW cheat dialog
489 BOOL CALLBACK AddRAW(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
490 {
491 int wmId,wmEvent;
492 static HWND hParent;
493
494 switch(uMsg)
495 {
496
497 case WM_PAINT:
498 return FALSE;
499 case WM_INITDIALOG:
500 hParent=(HWND)lParam;
501 break;
502 case WM_COMMAND:
503 wmId = LOWORD(wParam);
504 wmEvent = HIWORD(wParam);
505 // Parse the menu selections:
506 switch (wmId)
507 {
508 case IDCANCEL:
509 EndDialog(hWnd,1);
510 break;
511
512 case IDOK: // Add the code
513 {
514 std::vector<Cheat> Cheats;
515 char chepa[256];
516
517 // Get the text from the edit control and load it
518 GetWindowText(GetDlgItem(hWnd,IDC_ADDR),chepa,256);
519
520 if(strlen(chepa) == 0)
521 {
522 MessageBox(hWnd, "Add some cheats.", "Error", 0);
523 break;
524 }
525
526 // Parsing the cheats
527 int ret = ParseCheats(chepa, Cheats, hWnd);
528
529 if(ret == 1)
530 {
531 // Adding cheats
532 for(unsigned int i=0;i<Cheats.size();i++)
533 AddPatch(1,1, Cheats[i].address, 3, Cheats[i].value);
534
535 RefreshListBox(hParent);
536
537 // Close the dialog
538 EndDialog(hWnd,1);
539 }
540 else
541 {
542 MessageBox(hWnd, "Error adding cheats.", "Error", 0);
543 }
544
545 break;
546 }
547
548
549 default:
550 return FALSE;
551 }
552 break;
553 default:
554 return FALSE;
555 }
556
557 return TRUE;
558 }
559
560
561 // Reads patch data from Edit/Add patch dialog
562 int ReadPatch(HWND hWnd, IniPatch &temp)
563 {
564 char chepa[256];
565 int ret;
566
567 // Address
568 GetWindowText(GetDlgItem(hWnd, IDC_ADDRESS), chepa, 256);
569 ret = sscanf(chepa, "0x%X", &temp.addr);
570 if(ret != 1)
571 {
572 MessageBox(hWnd, "Incorrect Address.\nCorrect format is: 0x1234ABCD.", "Error", 0);
573 return 0;
574 }
575
576 // Data
577 GetWindowText(GetDlgItem(hWnd, IDC_DATA), chepa, 256);
578 ret = sscanf(chepa, "0x%X", &temp.data);
579 if(ret != 1)
580 {
581 MessageBox(hWnd, "Incorrect Data.\nCorrect format is: 0x1234ABCD.", "Error", 0);
582 return 0;
583 }
584
585 // Group
586 GetWindowText(GetDlgItem(hWnd, IDC_GROUP), chepa, 256);
587 ret = sscanf(chepa, "%d", &temp.group);
588 if(ret != 1)
589 {
590 MessageBox(hWnd, "Incorrect group.\n", "Error", 0);
591 return 0;
592 }
593
594 // CPU
595 temp.cpu = (patch_cpu_type)(SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_GETCURSEL, 0, 0) + 1);
596 if(temp.cpu < 1)
597 {
598 MessageBox(hWnd, "CPU is not selected.", "Error", 0);
599 return 0;
600 }
601
602 // Enabled
603 temp.enabled = SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_GETCURSEL, 0, 0);
604 if(temp.cpu < 0)
605 {
606 MessageBox(hWnd, "Enabled is not selected.", "Error", 0);
607 return 0;
608 }
609
610 // PlaceToPatch
611 temp.placetopatch = SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_GETCURSEL, 0, 0);
612 if(temp.placetopatch < 0)
613 {
614 MessageBox(hWnd, "PlaceToPatch is not selected.", "Error", 0);
615 return 0;
616 }
617
618 // Type
619 temp.type = (patch_data_type)(SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_GETCURSEL, 0, 0) + 1);
620 if(temp.type < 1)
621 {
622 MessageBox(hWnd, "Type is not selected.", "Error", 0);
623 return 0;
624 }
625
626 return 1;
627 }
628
629 // Callback for Add Patch
630 BOOL CALLBACK AddPatchProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
631 {
632 int wmId,wmEvent;
633 static HWND hParent;
634
635 switch(uMsg)
636 {
637
638 case WM_PAINT:
639 return FALSE;
640 case WM_INITDIALOG:
641 hParent=(HWND)lParam;
642
643 // Window title
644 SetWindowText(hWnd, "Add Patch");
645
646 // Address
647 SetWindowText(GetDlgItem(hWnd, IDC_ADDRESS), "0x00000000");
648
649 // Data
650 SetWindowText(GetDlgItem(hWnd, IDC_DATA), "0x00000000");
651
652 // Group
653 SetWindowText(GetDlgItem(hWnd, IDC_GROUP), "0");
654
655 // Cpu ComboBox
656 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_ADDSTRING, 0, (LPARAM)"EE");
657 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_ADDSTRING, 0, (LPARAM)"IOP");
658 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_SETCURSEL, (WPARAM)0, 0);
659
660 // Enabled ComboBox
661 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_ADDSTRING, 0, (LPARAM)"No");
662 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_ADDSTRING, 0, (LPARAM)"Yes");
663 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_SETCURSEL, (WPARAM)0, 0);
664
665 // PlaceToPatch ComboBox
666 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_ADDSTRING, 0, (LPARAM)"0");
667 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_ADDSTRING, 0, (LPARAM)"1");
668 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_SETCURSEL, (WPARAM)0, 0);
669
670 // Type ComboBox
671 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"byte");
672 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"short");
673 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"word");
674 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"double");
675 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_SETCURSEL, (WPARAM)0, 0);
676
677 // Spin Control
678 SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_GROUP), 0);
679 SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)(0-0x80000000), (LPARAM)0x7FFFFFFF);
680
681 break;
682 case WM_COMMAND:
683 wmId = LOWORD(wParam);
684 wmEvent = HIWORD(wParam);
685 // Parse the menu selections:
686 switch (wmId)
687 {
688 case IDCANCEL:
689 EndDialog(hWnd,1);
690 break;
691
692 case IDC_SAVE: // Add the code
693 {
694 IniPatch temp;
695
696 if(ReadPatch(hWnd, temp) == 0)
697 break;
698
699 // Add new patch, refresh and exit
700 memcpy((void *)&patch[patchnumber], (void *)&temp, sizeof(IniPatch));
701 patchnumber++;
702 RefreshListBox(hParent);
703 EndDialog(hWnd,1);
704 break;
705 }
706
707
708 default:
709 return FALSE;
710 }
711 break;
712 default:
713 return FALSE;
714 }
715
716 return TRUE;
717 }
718
719
720 // Callback for Edit Patch
721 BOOL CALLBACK EditPatch(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
722 {
723 int wmId,wmEvent;
724 static HWND hParent;
725 static int selected;
726 char chepa[256];
727
728 switch(uMsg)
729 {
730
731 case WM_PAINT:
732 return FALSE;
733 case WM_INITDIALOG:
734 {
735 hParent=(HWND)lParam;
736
737 // Find the selected patch
738 UINT mresults = ListView_GetItemCount(GetDlgItem(hParent, IDC_PATCHES));
739
740 unsigned int i;
741 for(i=0;i<mresults;i++)
742 {
743 UINT state = ListView_GetItemState(GetDlgItem(hParent,IDC_PATCHES), i, LVIS_SELECTED);
744 if(state==LVIS_SELECTED)
745 {
746 selected = i;
747 // Fill data on gui controls from the patch
748
749 // Address
750 sprintf(chepa, "0x%.8X", patch[i].addr);
751 SetWindowText(GetDlgItem(hWnd, IDC_ADDRESS), chepa);
752
753 // Data
754 sprintf(chepa, "0x%.8X", patch[i].data);
755 SetWindowText(GetDlgItem(hWnd, IDC_DATA), chepa);
756
757 // Group
758 sprintf(chepa, "%d", patch[i].group);
759 SetWindowText(GetDlgItem(hWnd, IDC_GROUP), chepa);
760
761 // Cpu ComboBox
762 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_ADDSTRING, 0, (LPARAM)"EE");
763 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_ADDSTRING, 0, (LPARAM)"IOP");
764 if(patch[i].cpu == 1)
765 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_SETCURSEL, (WPARAM)0, 0);
766 else
767 SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_SETCURSEL, (WPARAM)1, 0);
768
769 // Enabled ComboBox
770 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_ADDSTRING, 0, (LPARAM)"No");
771 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_ADDSTRING, 0, (LPARAM)"Yes");
772 SendMessage(GetDlgItem(hWnd, IDC_ENABLED), CB_SETCURSEL, (WPARAM)patch[i].enabled, 0);
773
774 // PlaceToPatch ComboBox
775 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_ADDSTRING, 0, (LPARAM)"0");
776 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_ADDSTRING, 0, (LPARAM)"1");
777 SendMessage(GetDlgItem(hWnd, IDC_PLACETOPATCH), CB_SETCURSEL, (WPARAM)patch[i].placetopatch, 0);
778
779 // Type ComboBox
780 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"byte");
781 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"short");
782 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"word");
783 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_ADDSTRING, 0, (LPARAM)"double");
784 SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_SETCURSEL, (WPARAM)patch[i].type-1, 0);
785
786 // Spin Control
787 SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_GROUP), 0);
788 SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)(0-0x80000000), (LPARAM)0x7FFFFFFF);
789 break;
790 }
791 }
792
793 // If nothing is selected close the window
794 if(i == mresults)
795 EndDialog(hWnd,1);
796
797 break;
798 }
799 case WM_COMMAND:
800 wmId = LOWORD(wParam);
801 wmEvent = HIWORD(wParam);
802 // Parse the menu selections:
803 switch (wmId)
804 {
805 case IDCANCEL:
806 EndDialog(hWnd,1);
807 break;
808
809 case IDC_SAVE: // Add the code
810 {
811 IniPatch temp;
812
813 if(ReadPatch(hWnd, temp) == 0)
814 break;
815
816 // Copying temporal patch to selected patch, refreshing parent's listbox and exit
817 memcpy((void *)&patch[selected], (void *)&temp, sizeof(IniPatch));
818 RefreshListBox(hParent);
819 EndDialog(hWnd,1);
820 break;
821 }
822
823
824 default:
825 return FALSE;
826 }
827 break;
828 default:
829 return FALSE;
830 }
831
832 return TRUE;
833 }
834
835
836 BOOL CALLBACK pnachWriterProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
837 {
838 int wmId,wmEvent;
839 static HWND hParent;
840 char chepa[256];
841
842 switch(uMsg)
843 {
844
845 case WM_PAINT:
846 return FALSE;
847 case WM_INITDIALOG:
848 hParent=(HWND)lParam;
849
850 // CRC
851 sprintf(chepa, "%.8x", ElfCRC);
852 SetWindowText(GetDlgItem(hWnd, IDC_CRC), chepa);
853
854 // try to load value
855 if(ElfCRC != 0){}
856
857 // Comment
858 SetWindowText(GetDlgItem(hWnd, IDC_COMMENT), "Insert comment.");
859
860 // Gametitle
861 SetWindowText(GetDlgItem(hWnd, IDC_GAMETITLE), "Insert Game Title.");
862
863 // ZeroGS
864 SetWindowText(GetDlgItem(hWnd, IDC_ZEROGS), "00000000");
865
866 // Round mode 1
867 SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_ADDSTRING, 0, (LPARAM)"NEAR");
868 SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_ADDSTRING, 0, (LPARAM)"DOWN");
869 SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_ADDSTRING, 0, (LPARAM)"UP");
870 SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_ADDSTRING, 0, (LPARAM)"CHOP");
871 SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_SETCURSEL, (WPARAM)0, 0);
872
873 // Round mode 2
874 SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_ADDSTRING, 0, (LPARAM)"NEAR");
875 SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_ADDSTRING, 0, (LPARAM)"DOWN");
876 SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_ADDSTRING, 0, (LPARAM)"UP");
877 SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_ADDSTRING, 0, (LPARAM)"CHOP");
878 SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_SETCURSEL, (WPARAM)3, 0);
879
880
881
882 break;
883 case WM_COMMAND:
884 wmId = LOWORD(wParam);
885 wmEvent = HIWORD(wParam);
886 // Parse the menu selections:
887 switch (wmId)
888 {
889 case IDCANCEL:
890 EndDialog(hWnd,1);
891 break;
892
893 case IDC_SAVE: // Add the code
894 {
895 char filename[1024];
896
897 // Obtain the crc, build the path and open the file
898 GetWindowText(GetDlgItem(hWnd,IDC_CRC),chepa,256);
899 strcpy(filename, "./patches/");
900 strcat(filename, chepa);
901 strcat(filename, ".pnach");
902 FILE *fp = fopen(filename, "w");
903
904 // comment
905 GetWindowText(GetDlgItem(hWnd,IDC_COMMENT),chepa,256);
906 fprintf(fp, "comment=%s\n", chepa);
907
908 // gametitle
909 GetWindowText(GetDlgItem(hWnd,IDC_GAMETITLE),chepa,256);
910 fprintf(fp, "gametitle=%s\n", chepa);
911
912 // zerogs
913 GetWindowText(GetDlgItem(hWnd,IDC_ZEROGS),chepa,256);
914 int zgs;
915 sscanf(chepa, "%x", &zgs);
916 if(zgs != 0)
917 {
918 fprintf(fp, "zerogs=%s\n", chepa);
919 }
920
921 // round mode
922 int round1, round2;
923 round1 = SendMessage(GetDlgItem(hWnd, IDC_ROUND1), CB_GETCURSEL, 0, 0);
924 round2 = SendMessage(GetDlgItem(hWnd, IDC_ROUND2), CB_GETCURSEL, 0, 0);
925 if(round1 != 0 || round2 !=3) // if not default roundings write it
926 {
927 char r1[10], r2[10];
928 GetWindowText(GetDlgItem(hWnd, IDC_ROUND1), r1, 10);
929 GetWindowText(GetDlgItem(hWnd, IDC_ROUND2), r2, 10);
930 fprintf(fp, "roundmode=%s,%s\n", r1, r2);
931 }
932
933 // fastmemory
934 UINT s = IsDlgButtonChecked(hWnd, IDC_FASTMEMORY);
935 if(s == 1)
936 {
937 fprintf(fp, "fastmemory\n");
938 }
939
940 // path3hack
941 s = IsDlgButtonChecked(hWnd, IDC_PATH3HACK);
942 if(s == 1)
943 {
944 fprintf(fp, "path3hack\n");
945 }
946
947 // vunanmode
948 s = IsDlgButtonChecked(hWnd, IDC_VUNANMODE);
949 if(s == 1)
950 {
951 fprintf(fp, "vunanmode\n");
952 }
953
954 // write patches
955 for(int i=0;i<patchnumber;i++)
956 {
957 char cpucore[10], type[10];
958 switch(patch[i].cpu)
959 {
960 case 1:
961 strcpy(cpucore, "EE");
962 break;
963 case 2:
964 strcpy(cpucore, "IOP");
965 break;
966 }
967
968 switch(patch[i].type)
969 {
970 case 1:
971 strcpy(type, "byte");
972 break;
973 case 2:
974 strcpy(type, "short");
975 break;
976 case 3:
977 strcpy(type, "word");
978 break;
979 case 4:
980 strcpy(type, "double");
981 break;
982 }
983 //patch=placetopatch,cpucore,address,type,data
984 fprintf(fp, "patch=%d,%s,%.8x,%s,%.8x\n", patch[i].placetopatch, cpucore, patch[i].addr, type, patch[i].data);
985 }
986
987 fclose(fp);
988
989 EndDialog(hWnd,1);
990 break;
991 }
992
993
994 default:
995 return FALSE;
996 }
997 break;
998 default:
999 return FALSE;
1000 }
1001
1002 return TRUE;
1003 }
1004
1005
1006
1007 BOOL CALLBACK BrowserProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
1008 {
1009 int wmId,wmEvent;
1010
1011 switch(uMsg)
1012 {
1013
1014 case WM_PAINT:
1015 return FALSE;
1016
1017 case WM_INITDIALOG:
1018
1019 CreateListBox(hWnd);
1020 RefreshListBox(hWnd);
1021
1022 break;
1023
1024 case WM_COMMAND:
1025 wmId = LOWORD(wParam);
1026 wmEvent = HIWORD(wParam);
1027 // Parse the menu selections:
1028 switch (wmId)
1029 {
1030 case IDCANCEL:
1031 EndDialog(hWnd,1);
1032 break;
1033
1034 case IDOK:
1035 EndDialog(hWnd,1);
1036 break;
1037
1038 case IDC_ENABLEBUTTON:
1039 {
1040 UINT mresults = ListView_GetItemCount(GetDlgItem(hWnd, IDC_PATCHES));
1041 for(unsigned int i=0;i<mresults;i++)
1042 {
1043 UINT state = ListView_GetItemState(GetDlgItem(hWnd,IDC_PATCHES), i, LVIS_SELECTED);
1044 if(state==LVIS_SELECTED)
1045 {
1046 patch[i].enabled = !patch[i].enabled;
1047 }
1048 }
1049 RefreshListBox(hWnd);
1050 break;
1051 }
1052
1053 case IDC_ADDGS:
1054 {
1055 INT_PTR retret=DialogBoxParam(0,MAKEINTRESOURCE(IDD_ADDGS),hWnd,(DLGPROC)AddGS,(LPARAM)hWnd);
1056 break;
1057 }
1058
1059 case IDC_EDITPATCH:
1060 {
1061 INT_PTR retret=DialogBoxParam(0,MAKEINTRESOURCE(IDD_EDITPATCH),hWnd,(DLGPROC)EditPatch,(LPARAM)hWnd);
1062 break;
1063 }
1064
1065 case IDC_ADDPATCH:
1066 {
1067 INT_PTR retret=DialogBoxParam(0,MAKEINTRESOURCE(IDD_EDITPATCH),hWnd,(DLGPROC)AddPatchProc,(LPARAM)hWnd);
1068 break;
1069 }
1070
1071 case IDC_ADDRAW:
1072 {
1073 INT_PTR retret=DialogBoxParam(0,MAKEINTRESOURCE(IDD_ADDRAW),hWnd,(DLGPROC)AddRAW,(LPARAM)hWnd);
1074 break;
1075 }
1076
1077 case IDC_PNACHWRITER:
1078 {
1079 INT_PTR retret=DialogBoxParam(0,MAKEINTRESOURCE(IDD_PNACHWRITER),hWnd,(DLGPROC)pnachWriterProc,(LPARAM)hWnd);
1080 break;
1081 }
1082
1083 case IDC_SKIPMPEG:
1084 {
1085 u8 *p = eeMem->Main;
1086 u8 *d = p + Ps2MemSize::MainRam;
1087 d -= 16;
1088 u32 *u;
1089
1090 while(p<d)
1091 {
1092 u = (u32 *)p;
1093 //if( (u[0] == 0x4000838c) && (u[1] == 0x0800e003) && (u[2] == 0x0000628c) )
1094 if( (u[0] == 0x8c830040) && (u[1] == 0x03e00008) && (u[2] == 0x8c620000) )
1095 {
1096 AddPatch(1,1, (int)(p+8-eeMem->Main), 3, 0x24020001);
1097 MessageBox(hWnd, "Patch Found.", "Patch", 0);
1098 RefreshListBox(hWnd);
1099 return FALSE;
1100 }
1101
1102 p++;
1103 }
1104 MessageBox(hWnd, "Patch not found.", "Patch", 0);
1105 break;
1106 }
1107
1108 default:
1109 return FALSE;
1110 }
1111 break;
1112 default:
1113 return FALSE;
1114 }
1115 return TRUE;
1116 }
1117
1118 void ShowCheats(HINSTANCE hInstance, HWND hParent)
1119 {
1120 INT_PTR ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_CHEATS),hParent,(DLGPROC)BrowserProc,1);
1121 }

  ViewVC Help
Powered by ViewVC 1.1.22