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 447 by rossy, Tue Jul 21 03:33:07 2009 UTC vs.
Revision 465 by rossy, Sat Oct 17 08:47:09 2009 UTC

# Line 38 | Line 38 | bool patch_particledisablebit = false;
38   bool patch_multibyte = false;
39   bool patch_cheattable = true;
40   bool patch_argb8888 = true;
41 + bool patch_killvtune = true;
42  
43   bool patch_safeprintf = true;
44   bool patch_daodandisplayenum = true;
# Line 47 | Line 48 | bool patch_usedaodangl = false;
48   bool patch_windowhack = true;
49   bool patch_daodaninit = true;
50   bool patch_bsl = true;
51 + bool patch_cheater = true;
52  
53   bool opt_usedaodanbsl = true;
54  
# Line 160 | Line 162 | bool DDrPatch_Init()
162                  DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on);
163          }
164          
165 +        // ARGB8888 textures
166          if (patch_argb8888)
167          {
168                  DDrPatch_Byte  (OniExe + 0x00135af0, 0x07);
169                  DDrPatch_Byte  (OniExe + 0x00135af4, 0x0B);
170          }
171          
172 +        // Disable loading the vtuneapi.dll
173 +        if (patch_killvtune)
174 +                DDrPatch_Byte  (OniExe + 0x00026340, 0xC3);
175 +        
176          return true;
177   }
178  
# Line 194 | Line 201 | bool DDrIniCallback(char* section, bool
201          {
202                  case s_options:
203                          if (!stricmp(name, "usedaodanbsl"))
204 <                                opt_usedaodanbsl = !stricmp(value, "true");
204 >                                opt_usedaodanbsl = !stricmp(inifile_cleanstr(value), "true");
205                          break;
206                  case s_patch:
207                          if (!stricmp(name, "fonttexturecache"))
208 <                                patch_fonttexturecache = !stricmp(value, "true");
208 >                                patch_fonttexturecache = !stricmp(inifile_cleanstr(value), "true");
209                          else if (!stricmp(name, "largetextures"))
210 <                                patch_largetextures = !stricmp(value, "true");
210 >                                patch_largetextures = !stricmp(inifile_cleanstr(value), "true");
211                          else if (!stricmp(name, "levelplugins"))
212 <                                patch_levelplugins = !stricmp(value, "true");
212 >                                patch_levelplugins = !stricmp(inifile_cleanstr(value), "true");
213                          else if (!stricmp(name, "pathfinding"))
214 <                                patch_pathfinding = !stricmp(value, "true");
214 >                                patch_pathfinding = !stricmp(inifile_cleanstr(value), "true");
215                          else if (!stricmp(name, "projaware"))
216 <                                patch_projaware = !stricmp(value, "true");
216 >                                patch_projaware = !stricmp(inifile_cleanstr(value), "true");
217                          else if (!stricmp(name, "directinput"))
218 <                                patch_directinput = !stricmp(value, "true");
218 >                                patch_directinput = !stricmp(inifile_cleanstr(value), "true");
219                          else if (!stricmp(name, "wpfadetime"))
220 <                                patch_wpfadetime = !stricmp(value, "true");
220 >                                patch_wpfadetime = !stricmp(inifile_cleanstr(value), "true");
221                          else if (!stricmp(name, "kickguns"))
222 <                                patch_kickguns = !stricmp(value, "true");
222 >                                patch_kickguns = !stricmp(inifile_cleanstr(value), "true");
223                          else if (!stricmp(name, "cooldowntimer"))
224 <                                patch_cooldowntimer = !stricmp(value, "true");
224 >                                patch_cooldowntimer = !stricmp(inifile_cleanstr(value), "true");
225                          else if (!stricmp(name, "throwtest"))
226 <                                patch_throwtest = !stricmp(value, "true");
226 >                                patch_throwtest = !stricmp(inifile_cleanstr(value), "true");
227                          else if (!stricmp(name, "alttab"))
228 <                                patch_alttab = !stricmp(value, "true");
228 >                                patch_alttab = !stricmp(inifile_cleanstr(value), "true");
229                          else if (!stricmp(name, "particledisablebit"))
230 <                                patch_particledisablebit = !stricmp(value, "true");
230 >                                patch_particledisablebit = !stricmp(inifile_cleanstr(value), "true");
231                          else if (!stricmp(name, "multibyte"))
232 <                                patch_multibyte = !stricmp(value, "true");
232 >                                patch_multibyte = !stricmp(inifile_cleanstr(value), "true");
233                          else if (!stricmp(name, "cheattable"))
234 <                                patch_cheattable = !stricmp(value, "true");
234 >                                patch_cheattable = !stricmp(inifile_cleanstr(value), "true");
235                          else if (!stricmp(name, "argb8888"))
236 <                                patch_argb8888 = !stricmp(value, "true");
236 >                                patch_argb8888 = !stricmp(inifile_cleanstr(value), "true");
237 >                        else if (!stricmp(name, "killvtune"))
238 >                                patch_killvtune = !stricmp(inifile_cleanstr(value), "true");
239                          else if (!stricmp(name, "safeprintf"))
240 <                                patch_safeprintf = !stricmp(value, "true");
240 >                                patch_safeprintf = !stricmp(inifile_cleanstr(value), "true");
241                          else if (!stricmp(name, "daodandisplayenum"))
242 <                                patch_daodandisplayenum = !stricmp(value, "true");
242 >                                patch_daodandisplayenum = !stricmp(inifile_cleanstr(value), "true");
243                          else if (!stricmp(name, "usegettickcount"))
244 <                                patch_usegettickcount = !stricmp(value, "true");
244 >                                patch_usegettickcount = !stricmp(inifile_cleanstr(value), "true");
245                          else if (!stricmp(name, "cheatsenabled"))
246 <                                patch_cheatsenabled = !stricmp(value, "true");
246 >                                patch_cheatsenabled = !stricmp(inifile_cleanstr(value), "true");
247                          else if (!stricmp(name, "usedaodangl"))
248 <                                patch_usedaodangl = !stricmp(value, "true");
248 >                                patch_usedaodangl = !stricmp(inifile_cleanstr(value), "true");
249                          else if (!stricmp(name, "windowhack"))
250 <                                patch_windowhack = !stricmp(value, "true");
250 >                                patch_windowhack = !stricmp(inifile_cleanstr(value), "true");
251                          else if (!stricmp(name, "daodaninit"))
252 <                                patch_daodaninit = !stricmp(value, "true");
252 >                                patch_daodaninit = !stricmp(inifile_cleanstr(value), "true");
253                          else if (!stricmp(name, "bsl"))
254 <                                patch_bsl = !stricmp(value, "true");
254 >                                patch_bsl = !stricmp(inifile_cleanstr(value), "true");
255 >                        else if (!stricmp(name, "cheater"))
256 >                                patch_cheater = !stricmp(inifile_cleanstr(value), "true");
257                          else
258                                  DDrStartupMessage("unrecognised patch \"%s\"", name);
259                          break;
249                case s_bsl:
250                        
251                        break;
260                  case s_language:
261                          if (!stricmp(name, "savepoint"))
262                          {
# Line 308 | Line 316 | bool DDrIniCallback(char* section, bool
316                          {
317                                  char* str = strdup(value);
318                                  DDr_CheatTable[11].message_on = str;
319 <                                DDr_CheatTable[cheat_devmodex].message_on = str;
319 >                                DDr_CheatTable[cheat_x].message_on = str;
320                          }
321                          else if (!stricmp(name, "devmode_off"))
322                          {
323                                  char* str = strdup(value);
324                                  DDr_CheatTable[11].message_off = str;
325 <                                DDr_CheatTable[cheat_devmodex].message_off = str;
325 >                                DDr_CheatTable[cheat_x].message_off = str;
326                          }
327                          else if (!stricmp(name, "reservoirdogs_on"))
328                                  DDr_CheatTable[12].message_on = strdup(value);
# Line 357 | Line 365 | bool DDrIniCallback(char* section, bool
365                          else
366                                  DDrStartupMessage("unrecognised language item \"%s\"", name);
367                          break;
368 +                case s_bsl:
369                  default:
370                          break;
371          }
# Line 433 | Line 442 | void __cdecl DDrMain(int argc, char* arg
442          if (patch_bsl)
443                  SLrDaodan_Patch();
444          
445 +        if (patch_cheater)
446 +        {
447 +                DDrPatch_MakeCall(OniExe + 0x000f618f, DDrCheater);
448 +                DDrPatch_Int16(OniExe + 0x000deb45, 0x5590);
449 +                DDrPatch_MakeCall(OniExe + 0x000deb47, FallingFrames);
450 +                DDrPatch_MakeJump(OniExe + 0x0010f021, DDrCheater_LevelLoad);
451 +        }
452 +        
453          init_daodan_gl();
454          
455          ONiMain(argc, argv);
456   }
457 <
457 > /*
458 > void DDrWrongExe()
459 > {
460 >        switch (MessageBox(NULL, "This version of the Daodan DLL is incompatible with your Oni.exe.\n"
461 >                "Click OK for more information. To continue using Oni without the patch, replace the downloaded binkw32.dll with the original.", "Daodan", MB_OKCANCEL | MB_ICONERROR))
462 >        {
463 >                case IDOK:
464 >                        {
465 >                                STARTUPINFO si;
466 >                                PROCESS_INFORMATION pi;
467 >                                FillMemory(&si, 0, sizeof(si));
468 >                                FillMemory(&pi, 0, sizeof(pi));
469 >                                si.cb = sizeof(si);
470 >                                if (!CreateProcess(NULL, "cmd /c \"start http://wiki.oni2.net/Daodan_DLL\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
471 >                                        MessageBox(NULL, "", "", 0);
472 >                                CloseHandle(pi.hProcess);
473 >                                CloseHandle(pi.hThread);
474 >                        }
475 >                default:
476 >                        ExitProcess(0);
477 >        }
478 > }
479 > */
480   BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
481   {
482          switch (fdwReason)
# Line 446 | Line 485 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,
485                          DDrDLLModule = hinstDLL;
486                          DDrONiModule = GetModuleHandle(NULL);
487                          
488 <                        DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain);
489 <                        
488 >                        if (*(uint32_t*)((void*)OniExe + 0x0011acd0) == 0x09d36852)
489 >                                DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain);
490 >                        else
491 >                                ExitProcess(0);
492                          break;
493          }
494          return TRUE;

Diff Legend

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