ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan.c
(Generate patch)

Comparing Daodan/src/Daodan.c (file contents):
Revision 347 by rossy, Tue Jun 9 12:42:24 2009 UTC vs.
Revision 426 by rossy, Thu Jul 16 01:24:07 2009 UTC

# Line 7 | Line 7
7   #include "Daodan_Cheater.h"
8   #include "Daodan_Persistence.h"
9  
10 + #include "Daodan_WindowHack.h"
11 +
12   #include "Oni.h"
13   #include "Oni_Persistence.h"
14  
# Line 22 | Line 24 | HMODULE DDrONiModule;
24  
25   bool patch_fonttexturecache = true;
26   bool patch_largetextures = true;
27 + bool patch_levelplugins = true;
28   bool patch_pathfinding = true;
29   bool patch_projaware = true;
30 + bool patch_directinput = true;
31   bool patch_wpfadetime = true;
32   bool patch_kickguns = false;
33   bool patch_cooldowntimer = true;
34   bool patch_throwtest = false;
35   bool patch_alttab = true;
36   bool patch_particledisablebit = false;
37 < bool patch_multibyte = true;
37 > bool patch_multibyte = false;
38   bool patch_cheattable = true;
39 + bool patch_argb8888 = true;
40  
41   bool patch_safeprintf = true;
42   bool patch_daodandisplayenum = true;
43   bool patch_usegettickcount = true;
44 + bool patch_cheatsenabled = true;
45   bool patch_usedaodangl = false;
46 + bool patch_windowhack = true;
47  
48   bool DDrPatch_Init()
49   {
# Line 54 | Line 61 | bool DDrPatch_Init()
61                  DDrPatch_Byte  (OniExe + 0x00005251, 0x10);
62          
63          // Non-"_Final" levels are now valid
64 <        DDrPatch_Byte  (OniExe + 0x000206a8, 0x01);
64 >        if (patch_levelplugins)
65 >                DDrPatch_Byte  (OniExe + 0x000206a8, 0x01);
66          
67          // Pathfinding grid cache size x8
68          if (patch_pathfinding)
# Line 73 | Line 81 | bool DDrPatch_Init()
81          }
82          
83          // Forced DirectInput (for Windows NT)
84 <        DDrPatch_Byte  (OniExe + 0x00002e6d, 0xeb);
84 >        if (patch_directinput)
85 >                DDrPatch_Byte  (OniExe + 0x00002e6d, 0xeb);
86          
87          if (patch_wpfadetime)
88          {
# Line 119 | Line 128 | bool DDrPatch_Init()
128                  DDrPatch_Int16 (OniExe + 0x001b184, 0x9090);
129          
130          // Multi-byte patch (multiple language support)
131 <        if (patch_multibyte)
131 >        if (!patch_multibyte)
132          {
133                  DDrPatch_Byte  (OniExe + 0x0002d8f8, 0xeb);
134                  DDrPatch_Byte  (OniExe + 0x0002d9ad, 0xeb);
# Line 146 | Line 155 | bool DDrPatch_Init()
155                  DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on);
156          }
157          
158 +        if (patch_argb8888)
159 +        {
160 +                DDrPatch_Byte  (OniExe + 0x00135af0, 0x07);
161 +                DDrPatch_Byte  (OniExe + 0x00135af4, 0x0B);
162 +        }
163 +        
164          return true;
165   }
166  
# Line 173 | Line 188 | bool DDrIniCallback(char* section, bool
188                                  patch_fonttexturecache = !stricmp(value, "true");
189                          else if (!stricmp(name, "largetextures"))
190                                  patch_largetextures = !stricmp(value, "true");
191 +                        else if (!stricmp(name, "levelplugins"))
192 +                                patch_levelplugins = !stricmp(value, "true");
193                          else if (!stricmp(name, "pathfinding"))
194                                  patch_pathfinding = !stricmp(value, "true");
195                          else if (!stricmp(name, "projaware"))
196                                  patch_projaware = !stricmp(value, "true");
197 +                        else if (!stricmp(name, "directinput"))
198 +                                patch_directinput = !stricmp(value, "true");
199                          else if (!stricmp(name, "wpfadetime"))
200                                  patch_wpfadetime = !stricmp(value, "true");
201                          else if (!stricmp(name, "kickguns"))
# Line 193 | Line 212 | bool DDrIniCallback(char* section, bool
212                                  patch_multibyte = !stricmp(value, "true");
213                          else if (!stricmp(name, "cheattable"))
214                                  patch_cheattable = !stricmp(value, "true");
215 +                        else if (!stricmp(name, "argb8888"))
216 +                                patch_argb8888 = !stricmp(value, "true");
217                          else if (!stricmp(name, "safeprintf"))
218                                  patch_safeprintf = !stricmp(value, "true");
219                          else if (!stricmp(name, "daodandisplayenum"))
220                                  patch_daodandisplayenum = !stricmp(value, "true");
221                          else if (!stricmp(name, "usegettickcount"))
222                                  patch_usegettickcount = !stricmp(value, "true");
223 +                        else if (!stricmp(name, "cheatsenabled"))
224 +                                patch_cheatsenabled = !stricmp(value, "true");
225                          else if (!stricmp(name, "usedaodangl"))
226                                  patch_usedaodangl = !stricmp(value, "true");
227 +                        else if (!stricmp(name, "windowhack"))
228 +                                patch_windowhack = !stricmp(value, "true");
229                          else
230                                  DDrStartupMessage("unrecognised patch \"%s\"", name);
231                          break;
# Line 221 | Line 246 | bool DDrIniCallback(char* section, bool
246                                  DDrPatch_StrDup(OniExe + 0x0010fb6e, value);
247                          else if (!stricmp(name, "blam"))
248                                  DDrPatch_StrDup(OniExe + 0x0010fb73, value);
249 +                        else if (!stricmp(name, "shapeshifter_on"))
250 +                                DDr_CheatTable[0].message_on = strdup(value);
251 +                        else if (!stricmp(name, "shapeshifter_off"))
252 +                                DDr_CheatTable[0].message_off = strdup(value);
253 +                        else if (!stricmp(name, "liveforever_on"))
254 +                                DDr_CheatTable[1].message_on = strdup(value);
255 +                        else if (!stricmp(name, "liveforever_off"))
256 +                                DDr_CheatTable[1].message_off = strdup(value);
257 +                        else if (!stricmp(name, "touchofdeath_on"))
258 +                                DDr_CheatTable[2].message_on = strdup(value);
259 +                        else if (!stricmp(name, "touchofdeath_off"))
260 +                                DDr_CheatTable[2].message_off = strdup(value);
261 +                        else if (!stricmp(name, "canttouchthis_on"))
262 +                                DDr_CheatTable[3].message_on = strdup(value);
263 +                        else if (!stricmp(name, "canttouchthis_off"))
264 +                                DDr_CheatTable[3].message_off = strdup(value);
265 +                        else if (!stricmp(name, "fatloot_on"))
266 +                                DDr_CheatTable[4].message_on = strdup(value);
267 +                        else if (!stricmp(name, "glassworld_on"))
268 +                                DDr_CheatTable[5].message_on = strdup(value);
269 +                        else if (!stricmp(name, "glassworld_off"))
270 +                                DDr_CheatTable[5].message_off = strdup(value);
271 +                        else if (!stricmp(name, "winlevel_on"))
272 +                                DDr_CheatTable[6].message_on = strdup(value);
273 +                        else if (!stricmp(name, "loselevel_on"))
274 +                                DDr_CheatTable[7].message_on = strdup(value);
275 +                        else if (!stricmp(name, "bighead_on"))
276 +                                DDr_CheatTable[8].message_on = strdup(value);
277 +                        else if (!stricmp(name, "bighead_off"))
278 +                                DDr_CheatTable[8].message_off = strdup(value);
279 +                        else if (!stricmp(name, "minime_on"))
280 +                                DDr_CheatTable[9].message_on = strdup(value);
281 +                        else if (!stricmp(name, "minime_off"))
282 +                                DDr_CheatTable[9].message_off = strdup(value);
283 +                        else if (!stricmp(name, "superammo_on"))
284 +                                DDr_CheatTable[10].message_on = strdup(value);
285 +                        else if (!stricmp(name, "superammo_off"))
286 +                                DDr_CheatTable[10].message_off = strdup(value);
287 +                        else if (!stricmp(name, "devmode_on"))
288 +                        {
289 +                                char* str = strdup(value);
290 +                                DDr_CheatTable[11].message_on = str;
291 +                                DDr_CheatTable[cheat_devmodex].message_on = str;
292 +                        }
293 +                        else if (!stricmp(name, "devmode_off"))
294 +                        {
295 +                                char* str = strdup(value);
296 +                                DDr_CheatTable[11].message_off = str;
297 +                                DDr_CheatTable[cheat_devmodex].message_off = str;
298 +                        }
299 +                        else if (!stricmp(name, "reservoirdogs_on"))
300 +                                DDr_CheatTable[12].message_on = strdup(value);
301 +                        else if (!stricmp(name, "reservoirdogs_off"))
302 +                                DDr_CheatTable[12].message_off = strdup(value);
303 +                        else if (!stricmp(name, "roughjustice_on"))
304 +                                DDr_CheatTable[13].message_on = strdup(value);
305 +                        else if (!stricmp(name, "roughjustice_off"))
306 +                                DDr_CheatTable[13].message_off = strdup(value);
307 +                        else if (!stricmp(name, "chenille_on"))
308 +                                DDr_CheatTable[14].message_on = strdup(value);
309 +                        else if (!stricmp(name, "chenille_off"))
310 +                                DDr_CheatTable[14].message_off = strdup(value);
311 +                        else if (!stricmp(name, "behemoth_on"))
312 +                                DDr_CheatTable[15].message_on = strdup(value);
313 +                        else if (!stricmp(name, "behemoth_off"))
314 +                                DDr_CheatTable[15].message_off = strdup(value);
315 +                        else if (!stricmp(name, "elderrune_on"))
316 +                                DDr_CheatTable[16].message_on = strdup(value);
317 +                        else if (!stricmp(name, "elderrune_off"))
318 +                                DDr_CheatTable[16].message_off = strdup(value);
319 +                        else if (!stricmp(name, "moonshadow_on"))
320 +                                DDr_CheatTable[17].message_on = strdup(value);
321 +                        else if (!stricmp(name, "moonshadow_off"))
322 +                                DDr_CheatTable[17].message_off = strdup(value);
323 +                        else if (!stricmp(name, "munitionfrenzy_on"))
324 +                                DDr_CheatTable[18].message_on = strdup(value);
325 +                        else if (!stricmp(name, "fistsoflegend_on"))
326 +                                DDr_CheatTable[19].message_on = strdup(value);
327 +                        else if (!stricmp(name, "fistsoflegend_off"))
328 +                                DDr_CheatTable[19].message_off = strdup(value);
329 +                        else if (!stricmp(name, "killmequick_on"))
330 +                                DDr_CheatTable[20].message_on = strdup(value);
331 +                        else if (!stricmp(name, "killmequick_off"))
332 +                                DDr_CheatTable[20].message_off = strdup(value);
333 +                        else if (!stricmp(name, "carousel_on"))
334 +                                DDr_CheatTable[21].message_on = strdup(value);
335 +                        else if (!stricmp(name, "carousel_off"))
336 +                                DDr_CheatTable[21].message_off = strdup(value);
337                          else
338                                  DDrStartupMessage("unrecognised language item \"%s\"", name);
339                          break;
# Line 273 | Line 386 | void __cdecl DDrMain(int argc, char* arg
386          }
387          
388          // Cheats always enabled
389 <        DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
389 >        if (patch_cheatsenabled)
390 >                DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
391          
392          // Windowed mode
393          if (patch_usedaodangl)
# Line 282 | Line 396 | void __cdecl DDrMain(int argc, char* arg
396                  DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
397          }
398          
399 +        // Hacked windowed mode (for when daodangl isn't working properly)
400 +        if (patch_windowhack)
401 +                DDrWindowHack_Install();
402 +        
403          init_daodan_gl();
404          
405          ONiMain(argc, argv);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)