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 348 by rossy, Wed Jun 10 12:04:27 2009 UTC vs.
Revision 439 by rossy, Fri Jul 17 08:34:48 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;
25 bool patch_pathfinding = 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;
# Line 32 | Line 35 | 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 124 | 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 151 | 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_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, "language"))
182                          ini_section = s_language;
# Line 173 | Line 189 | bool DDrIniCallback(char* section, bool
189          
190          switch (ini_section)
191          {
192 +                case s_options:
193 +                        if (!stricmp(name, "usedaodanbsl"))
194 +                                opt_usedaodanbsl = !stricmp(value, "true");
195 +                        break;
196                  case s_patch:
197                          if (!stricmp(name, "fonttexturecache"))
198                                  patch_fonttexturecache = !stricmp(value, "true");
199                          else if (!stricmp(name, "largetextures"))
200                                  patch_largetextures = !stricmp(value, "true");
201 +                        else if (!stricmp(name, "levelplugins"))
202 +                                patch_levelplugins = !stricmp(value, "true");
203                          else if (!stricmp(name, "pathfinding"))
204                                  patch_pathfinding = !stricmp(value, "true");
205                          else if (!stricmp(name, "projaware"))
206                                  patch_projaware = !stricmp(value, "true");
185                        else if (!stricmp(name, "levelplugins"))
186                                patch_levelplugins = !stricmp(value, "true");
207                          else if (!stricmp(name, "directinput"))
208                                  patch_directinput = !stricmp(value, "true");
209                          else if (!stricmp(name, "wpfadetime"))
# Line 202 | Line 222 | bool DDrIniCallback(char* section, bool
222                                  patch_multibyte = !stricmp(value, "true");
223                          else if (!stricmp(name, "cheattable"))
224                                  patch_cheattable = !stricmp(value, "true");
225 +                        else if (!stricmp(name, "argb8888"))
226 +                                patch_argb8888 = !stricmp(value, "true");
227                          else if (!stricmp(name, "safeprintf"))
228                                  patch_safeprintf = !stricmp(value, "true");
229                          else if (!stricmp(name, "daodandisplayenum"))
# Line 212 | Line 234 | bool DDrIniCallback(char* section, bool
234                                  patch_cheatsenabled = !stricmp(value, "true");
235                          else if (!stricmp(name, "usedaodangl"))
236                                  patch_usedaodangl = !stricmp(value, "true");
237 +                        else if (!stricmp(name, "windowhack"))
238 +                                patch_windowhack = !stricmp(value, "true");
239 +                        else if (!stricmp(name, "daodaninit"))
240 +                                patch_daodaninit = !stricmp(value, "true");
241                          else
242                                  DDrStartupMessage("unrecognised patch \"%s\"", name);
243                          break;
# Line 249 | Line 275 | bool DDrIniCallback(char* section, bool
275                          else if (!stricmp(name, "canttouchthis_off"))
276                                  DDr_CheatTable[3].message_off = strdup(value);
277                          else if (!stricmp(name, "fatloot_on"))
278 <                                DDr_CheatTable[4].message_off = strdup(value);
278 >                                DDr_CheatTable[4].message_on = strdup(value);
279 >                        else if (!stricmp(name, "glassworld_on"))
280 >                                DDr_CheatTable[5].message_on = strdup(value);
281 >                        else if (!stricmp(name, "glassworld_off"))
282 >                                DDr_CheatTable[5].message_off = strdup(value);
283 >                        else if (!stricmp(name, "winlevel_on"))
284 >                                DDr_CheatTable[6].message_on = strdup(value);
285 >                        else if (!stricmp(name, "loselevel_on"))
286 >                                DDr_CheatTable[7].message_on = strdup(value);
287 >                        else if (!stricmp(name, "bighead_on"))
288 >                                DDr_CheatTable[8].message_on = strdup(value);
289 >                        else if (!stricmp(name, "bighead_off"))
290 >                                DDr_CheatTable[8].message_off = strdup(value);
291 >                        else if (!stricmp(name, "minime_on"))
292 >                                DDr_CheatTable[9].message_on = strdup(value);
293 >                        else if (!stricmp(name, "minime_off"))
294 >                                DDr_CheatTable[9].message_off = strdup(value);
295 >                        else if (!stricmp(name, "superammo_on"))
296 >                                DDr_CheatTable[10].message_on = strdup(value);
297 >                        else if (!stricmp(name, "superammo_off"))
298 >                                DDr_CheatTable[10].message_off = strdup(value);
299 >                        else if (!stricmp(name, "devmode_on"))
300 >                        {
301 >                                char* str = strdup(value);
302 >                                DDr_CheatTable[11].message_on = str;
303 >                                DDr_CheatTable[cheat_devmodex].message_on = str;
304 >                        }
305 >                        else if (!stricmp(name, "devmode_off"))
306 >                        {
307 >                                char* str = strdup(value);
308 >                                DDr_CheatTable[11].message_off = str;
309 >                                DDr_CheatTable[cheat_devmodex].message_off = str;
310 >                        }
311 >                        else if (!stricmp(name, "reservoirdogs_on"))
312 >                                DDr_CheatTable[12].message_on = strdup(value);
313 >                        else if (!stricmp(name, "reservoirdogs_off"))
314 >                                DDr_CheatTable[12].message_off = strdup(value);
315 >                        else if (!stricmp(name, "roughjustice_on"))
316 >                                DDr_CheatTable[13].message_on = strdup(value);
317 >                        else if (!stricmp(name, "roughjustice_off"))
318 >                                DDr_CheatTable[13].message_off = strdup(value);
319 >                        else if (!stricmp(name, "chenille_on"))
320 >                                DDr_CheatTable[14].message_on = strdup(value);
321 >                        else if (!stricmp(name, "chenille_off"))
322 >                                DDr_CheatTable[14].message_off = strdup(value);
323 >                        else if (!stricmp(name, "behemoth_on"))
324 >                                DDr_CheatTable[15].message_on = strdup(value);
325 >                        else if (!stricmp(name, "behemoth_off"))
326 >                                DDr_CheatTable[15].message_off = strdup(value);
327 >                        else if (!stricmp(name, "elderrune_on"))
328 >                                DDr_CheatTable[16].message_on = strdup(value);
329 >                        else if (!stricmp(name, "elderrune_off"))
330 >                                DDr_CheatTable[16].message_off = strdup(value);
331 >                        else if (!stricmp(name, "moonshadow_on"))
332 >                                DDr_CheatTable[17].message_on = strdup(value);
333 >                        else if (!stricmp(name, "moonshadow_off"))
334 >                                DDr_CheatTable[17].message_off = strdup(value);
335 >                        else if (!stricmp(name, "munitionfrenzy_on"))
336 >                                DDr_CheatTable[18].message_on = strdup(value);
337 >                        else if (!stricmp(name, "fistsoflegend_on"))
338 >                                DDr_CheatTable[19].message_on = strdup(value);
339 >                        else if (!stricmp(name, "fistsoflegend_off"))
340 >                                DDr_CheatTable[19].message_off = strdup(value);
341 >                        else if (!stricmp(name, "killmequick_on"))
342 >                                DDr_CheatTable[20].message_on = strdup(value);
343 >                        else if (!stricmp(name, "killmequick_off"))
344 >                                DDr_CheatTable[20].message_off = strdup(value);
345 >                        else if (!stricmp(name, "carousel_on"))
346 >                                DDr_CheatTable[21].message_on = strdup(value);
347 >                        else if (!stricmp(name, "carousel_off"))
348 >                                DDr_CheatTable[21].message_off = strdup(value);
349                          else
350                                  DDrStartupMessage("unrecognised language item \"%s\"", name);
351                          break;
# Line 279 | Line 375 | void DDrConfig()
375          DDrStartupMessage("finished parsing");
376   }
377  
378 + void ONICALL DDrGame_Init()
379 + {
380 +        if (opt_usedaodanbsl)
381 +                SLrDaodan_Initalize();
382 + }
383 +
384   void __cdecl DDrMain(int argc, char* argv[])
385   {
386          DDrStartupMessage("daodan attached!");
# Line 312 | Line 414 | void __cdecl DDrMain(int argc, char* arg
414                  DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
415          }
416          
417 +        // Hacked windowed mode (for when daodangl isn't working properly)
418 +        if (patch_windowhack)
419 +                DDrWindowHack_Install();
420 +        
421 +        if (patch_daodaninit)
422 +                DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init);
423 +        
424          init_daodan_gl();
425          
426          ONiMain(argc, argv);

Diff Legend

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