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 445 by rossy, Sun Jul 19 11:03:44 2009 UTC

# Line 6 | Line 6
6   #include "Daodan_Win32.h"
7   #include "Daodan_Cheater.h"
8   #include "Daodan_Persistence.h"
9 + #include "Daodan_BSL.h"
10 +
11 + #include "Daodan_WindowHack.h"
12  
13   #include "Oni.h"
14   #include "Oni_Persistence.h"
# Line 22 | Line 25 | HMODULE DDrONiModule;
25  
26   bool patch_fonttexturecache = true;
27   bool patch_largetextures = true;
28 + bool patch_levelplugins = true;
29   bool patch_pathfinding = true;
30   bool patch_projaware = true;
31 + bool patch_directinput = true;
32   bool patch_wpfadetime = true;
33   bool patch_kickguns = false;
34   bool patch_cooldowntimer = true;
35   bool patch_throwtest = false;
36   bool patch_alttab = true;
37   bool patch_particledisablebit = false;
38 < bool patch_multibyte = true;
38 > bool patch_multibyte = false;
39   bool patch_cheattable = true;
40 + bool patch_argb8888 = true;
41  
42   bool patch_safeprintf = true;
43   bool patch_daodandisplayenum = true;
44   bool patch_usegettickcount = true;
45 + bool patch_cheatsenabled = true;
46   bool patch_usedaodangl = false;
47 + bool patch_windowhack = true;
48 + bool patch_daodaninit = true;
49 +
50 + bool opt_usedaodanbsl = true;
51  
52   bool DDrPatch_Init()
53   {
# Line 54 | Line 65 | bool DDrPatch_Init()
65                  DDrPatch_Byte  (OniExe + 0x00005251, 0x10);
66          
67          // Non-"_Final" levels are now valid
68 <        DDrPatch_Byte  (OniExe + 0x000206a8, 0x01);
68 >        if (patch_levelplugins)
69 >                DDrPatch_Byte  (OniExe + 0x000206a8, 0x01);
70          
71          // Pathfinding grid cache size x8
72          if (patch_pathfinding)
# Line 73 | Line 85 | bool DDrPatch_Init()
85          }
86          
87          // Forced DirectInput (for Windows NT)
88 <        DDrPatch_Byte  (OniExe + 0x00002e6d, 0xeb);
88 >        if (patch_directinput)
89 >                DDrPatch_Byte  (OniExe + 0x00002e6d, 0xeb);
90          
91          if (patch_wpfadetime)
92          {
# Line 119 | Line 132 | bool DDrPatch_Init()
132                  DDrPatch_Int16 (OniExe + 0x001b184, 0x9090);
133          
134          // Multi-byte patch (multiple language support)
135 <        if (patch_multibyte)
135 >        if (!patch_multibyte)
136          {
137                  DDrPatch_Byte  (OniExe + 0x0002d8f8, 0xeb);
138                  DDrPatch_Byte  (OniExe + 0x0002d9ad, 0xeb);
# Line 146 | Line 159 | bool DDrPatch_Init()
159                  DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on);
160          }
161          
162 +        if (patch_argb8888)
163 +        {
164 +                DDrPatch_Byte  (OniExe + 0x00135af0, 0x07);
165 +                DDrPatch_Byte  (OniExe + 0x00135af4, 0x0B);
166 +        }
167 +        
168          return true;
169   }
170  
171 < enum {s_unknown, s_patch, s_language} ini_section;
171 > enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section;
172  
173   bool DDrIniCallback(char* section, bool newsection, char* name, char* value)
174   {
175          if (newsection)
176          {
177 <                if (!stricmp(section, "patch"))
177 >                if (!stricmp(section, "options"))
178 >                        ini_section = s_options;
179 >                else if (!stricmp(section, "patch"))
180                          ini_section = s_patch;
181 +                else if (!stricmp(section, "bsl"))
182 +                        ini_section = s_bsl;
183                  else if (!stricmp(section, "language"))
184                          ini_section = s_language;
185                  else
# Line 168 | Line 191 | bool DDrIniCallback(char* section, bool
191          
192          switch (ini_section)
193          {
194 +                case s_options:
195 +                        if (!stricmp(name, "usedaodanbsl"))
196 +                                opt_usedaodanbsl = !stricmp(value, "true");
197 +                        break;
198                  case s_patch:
199                          if (!stricmp(name, "fonttexturecache"))
200                                  patch_fonttexturecache = !stricmp(value, "true");
201                          else if (!stricmp(name, "largetextures"))
202                                  patch_largetextures = !stricmp(value, "true");
203 +                        else if (!stricmp(name, "levelplugins"))
204 +                                patch_levelplugins = !stricmp(value, "true");
205                          else if (!stricmp(name, "pathfinding"))
206                                  patch_pathfinding = !stricmp(value, "true");
207                          else if (!stricmp(name, "projaware"))
208                                  patch_projaware = !stricmp(value, "true");
209 +                        else if (!stricmp(name, "directinput"))
210 +                                patch_directinput = !stricmp(value, "true");
211                          else if (!stricmp(name, "wpfadetime"))
212                                  patch_wpfadetime = !stricmp(value, "true");
213                          else if (!stricmp(name, "kickguns"))
# Line 193 | Line 224 | bool DDrIniCallback(char* section, bool
224                                  patch_multibyte = !stricmp(value, "true");
225                          else if (!stricmp(name, "cheattable"))
226                                  patch_cheattable = !stricmp(value, "true");
227 +                        else if (!stricmp(name, "argb8888"))
228 +                                patch_argb8888 = !stricmp(value, "true");
229                          else if (!stricmp(name, "safeprintf"))
230                                  patch_safeprintf = !stricmp(value, "true");
231                          else if (!stricmp(name, "daodandisplayenum"))
232                                  patch_daodandisplayenum = !stricmp(value, "true");
233                          else if (!stricmp(name, "usegettickcount"))
234                                  patch_usegettickcount = !stricmp(value, "true");
235 +                        else if (!stricmp(name, "cheatsenabled"))
236 +                                patch_cheatsenabled = !stricmp(value, "true");
237                          else if (!stricmp(name, "usedaodangl"))
238                                  patch_usedaodangl = !stricmp(value, "true");
239 +                        else if (!stricmp(name, "windowhack"))
240 +                                patch_windowhack = !stricmp(value, "true");
241 +                        else if (!stricmp(name, "daodaninit"))
242 +                                patch_daodaninit = !stricmp(value, "true");
243                          else
244                                  DDrStartupMessage("unrecognised patch \"%s\"", name);
245                          break;
246 +                case s_bsl:
247 +                        
248 +                        break;
249                  case s_language:
250                          if (!stricmp(name, "savepoint"))
251                          {
# Line 221 | Line 263 | bool DDrIniCallback(char* section, bool
263                                  DDrPatch_StrDup(OniExe + 0x0010fb6e, value);
264                          else if (!stricmp(name, "blam"))
265                                  DDrPatch_StrDup(OniExe + 0x0010fb73, value);
266 +                        else if (!stricmp(name, "shapeshifter_on"))
267 +                                DDr_CheatTable[0].message_on = strdup(value);
268 +                        else if (!stricmp(name, "shapeshifter_off"))
269 +                                DDr_CheatTable[0].message_off = strdup(value);
270 +                        else if (!stricmp(name, "liveforever_on"))
271 +                                DDr_CheatTable[1].message_on = strdup(value);
272 +                        else if (!stricmp(name, "liveforever_off"))
273 +                                DDr_CheatTable[1].message_off = strdup(value);
274 +                        else if (!stricmp(name, "touchofdeath_on"))
275 +                                DDr_CheatTable[2].message_on = strdup(value);
276 +                        else if (!stricmp(name, "touchofdeath_off"))
277 +                                DDr_CheatTable[2].message_off = strdup(value);
278 +                        else if (!stricmp(name, "canttouchthis_on"))
279 +                                DDr_CheatTable[3].message_on = strdup(value);
280 +                        else if (!stricmp(name, "canttouchthis_off"))
281 +                                DDr_CheatTable[3].message_off = strdup(value);
282 +                        else if (!stricmp(name, "fatloot_on"))
283 +                                DDr_CheatTable[4].message_on = strdup(value);
284 +                        else if (!stricmp(name, "glassworld_on"))
285 +                                DDr_CheatTable[5].message_on = strdup(value);
286 +                        else if (!stricmp(name, "glassworld_off"))
287 +                                DDr_CheatTable[5].message_off = strdup(value);
288 +                        else if (!stricmp(name, "winlevel_on"))
289 +                                DDr_CheatTable[6].message_on = strdup(value);
290 +                        else if (!stricmp(name, "loselevel_on"))
291 +                                DDr_CheatTable[7].message_on = strdup(value);
292 +                        else if (!stricmp(name, "bighead_on"))
293 +                                DDr_CheatTable[8].message_on = strdup(value);
294 +                        else if (!stricmp(name, "bighead_off"))
295 +                                DDr_CheatTable[8].message_off = strdup(value);
296 +                        else if (!stricmp(name, "minime_on"))
297 +                                DDr_CheatTable[9].message_on = strdup(value);
298 +                        else if (!stricmp(name, "minime_off"))
299 +                                DDr_CheatTable[9].message_off = strdup(value);
300 +                        else if (!stricmp(name, "superammo_on"))
301 +                                DDr_CheatTable[10].message_on = strdup(value);
302 +                        else if (!stricmp(name, "superammo_off"))
303 +                                DDr_CheatTable[10].message_off = strdup(value);
304 +                        else if (!stricmp(name, "devmode_on"))
305 +                        {
306 +                                char* str = strdup(value);
307 +                                DDr_CheatTable[11].message_on = str;
308 +                                DDr_CheatTable[cheat_devmodex].message_on = str;
309 +                        }
310 +                        else if (!stricmp(name, "devmode_off"))
311 +                        {
312 +                                char* str = strdup(value);
313 +                                DDr_CheatTable[11].message_off = str;
314 +                                DDr_CheatTable[cheat_devmodex].message_off = str;
315 +                        }
316 +                        else if (!stricmp(name, "reservoirdogs_on"))
317 +                                DDr_CheatTable[12].message_on = strdup(value);
318 +                        else if (!stricmp(name, "reservoirdogs_off"))
319 +                                DDr_CheatTable[12].message_off = strdup(value);
320 +                        else if (!stricmp(name, "roughjustice_on"))
321 +                                DDr_CheatTable[13].message_on = strdup(value);
322 +                        else if (!stricmp(name, "roughjustice_off"))
323 +                                DDr_CheatTable[13].message_off = strdup(value);
324 +                        else if (!stricmp(name, "chenille_on"))
325 +                                DDr_CheatTable[14].message_on = strdup(value);
326 +                        else if (!stricmp(name, "chenille_off"))
327 +                                DDr_CheatTable[14].message_off = strdup(value);
328 +                        else if (!stricmp(name, "behemoth_on"))
329 +                                DDr_CheatTable[15].message_on = strdup(value);
330 +                        else if (!stricmp(name, "behemoth_off"))
331 +                                DDr_CheatTable[15].message_off = strdup(value);
332 +                        else if (!stricmp(name, "elderrune_on"))
333 +                                DDr_CheatTable[16].message_on = strdup(value);
334 +                        else if (!stricmp(name, "elderrune_off"))
335 +                                DDr_CheatTable[16].message_off = strdup(value);
336 +                        else if (!stricmp(name, "moonshadow_on"))
337 +                                DDr_CheatTable[17].message_on = strdup(value);
338 +                        else if (!stricmp(name, "moonshadow_off"))
339 +                                DDr_CheatTable[17].message_off = strdup(value);
340 +                        else if (!stricmp(name, "munitionfrenzy_on"))
341 +                                DDr_CheatTable[18].message_on = strdup(value);
342 +                        else if (!stricmp(name, "fistsoflegend_on"))
343 +                                DDr_CheatTable[19].message_on = strdup(value);
344 +                        else if (!stricmp(name, "fistsoflegend_off"))
345 +                                DDr_CheatTable[19].message_off = strdup(value);
346 +                        else if (!stricmp(name, "killmequick_on"))
347 +                                DDr_CheatTable[20].message_on = strdup(value);
348 +                        else if (!stricmp(name, "killmequick_off"))
349 +                                DDr_CheatTable[20].message_off = strdup(value);
350 +                        else if (!stricmp(name, "carousel_on"))
351 +                                DDr_CheatTable[21].message_on = strdup(value);
352 +                        else if (!stricmp(name, "carousel_off"))
353 +                                DDr_CheatTable[21].message_off = strdup(value);
354                          else
355                                  DDrStartupMessage("unrecognised language item \"%s\"", name);
356                          break;
# Line 250 | Line 380 | void DDrConfig()
380          DDrStartupMessage("finished parsing");
381   }
382  
383 + void ONICALL DDrGame_Init()
384 + {
385 +        if (opt_usedaodanbsl)
386 +                SLrDaodan_Initalize();
387 + }
388 +
389   void __cdecl DDrMain(int argc, char* argv[])
390   {
391          DDrStartupMessage("daodan attached!");
# Line 273 | Line 409 | void __cdecl DDrMain(int argc, char* arg
409          }
410          
411          // Cheats always enabled
412 <        DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
412 >        if (patch_cheatsenabled)
413 >                DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
414          
415          // Windowed mode
416          if (patch_usedaodangl)
# Line 282 | Line 419 | void __cdecl DDrMain(int argc, char* arg
419                  DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
420          }
421          
422 +        // Hacked windowed mode (for when daodangl isn't working properly)
423 +        if (patch_windowhack)
424 +                DDrWindowHack_Install();
425 +        
426 +        if (patch_daodaninit)
427 +                DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init);
428 +        
429          init_daodan_gl();
430          
431          ONiMain(argc, argv);

Diff Legend

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