source: Daodan/src/patches/Patches.c@ 894

Last change on this file since 894 was 894, checked in by alloc, 11 years ago

Daodan 3.5: Fix displaying screens larger than screen res

File size: 19.9 KB
Line 
1#include <windows.h>
2
3#include "../Daodan.h"
4#include "../Daodan_BSL.h"
5#include "../Daodan_Cheater.h"
6#include "../Daodan_Config.h"
7#include "../Daodan_GL.h"
8#include "../Daodan_Patch.h"
9#include "../Daodan_Persistence.h"
10#include "../Daodan_Utility.h"
11#include "../Daodan_Win32.h"
12#include "../flatline/Flatline_BSL.h"
13#include "../flatline/Flatline_Hooks.h"
14#include "../Oni.h"
15//#include "Objt.h"
16
17typedef int (__cdecl *CHINESEPROC)(DWORD ThreadId);
18
19// Hooked WMrSlider_SetRange() in ONiOGU_Options_InitDialog. Disables a gamma
20// slider in windowed mode.
21static void ONICALL DD_ONiOGU_GammaSlider_SetRange(WMtWindow* window, int min_value, int max_value)
22{
23 WMrWindow_SetEnabled(window, M3gResolutionSwitch && opt_gamma);
24 WMrSlider_SetRange(window, min_value, max_value);
25}
26
27void ONICALL DD_M3rDraw_BigBitmap(M3tTextureMap_Big* inBigBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha) /* 0 - M3cMaxAlpha */
28{
29 UUtUns16 x;
30 UUtUns16 y;
31
32 for (y = 0; y < inBigBitmap->num_y; y++)
33 {
34 for (x = 0; x < inBigBitmap->num_x; x++)
35 {
36 UUtUns16 index;
37 void* texture; // M3tTextureMap
38 UUtUns16 width;
39 UUtUns16 height;
40 UUtInt16 temp;
41 UUtInt32 x_times_maxwidth;
42 UUtInt32 y_times_maxheight;
43
44 index = x + (y * inBigBitmap->num_x);
45 texture = inBigBitmap->textures[index];
46
47 x_times_maxwidth = x * 256;
48 y_times_maxheight = y * 256;
49
50 // Cast to Unsigned to get the 16 bit int representation and then to signed to get the actual value. Doing it in one step gives wrong results (at least with gcc)
51 dest_point.x = (UUtInt16)((UUtUns16)inDestPoint->x) + x_times_maxwidth;
52 dest_point.y = (UUtInt16)((UUtUns16)inDestPoint->y) + y_times_maxheight;
53 dest_point.z = inDestPoint->z;
54 dest_point.invW = inDestPoint->invW;
55
56 temp = (UUtInt16) ( ((UUtInt32)inWidth - x_times_maxwidth) > 0 ? ((UUtInt32)inWidth - x_times_maxwidth) : 0);
57 width = 256 < (UUtUns16)temp ? 256 : temp;
58 temp = (UUtInt16) ( ((UUtInt32)inHeight - y_times_maxheight) > 0 ? ((UUtInt32)inHeight - y_times_maxheight) : 0);
59 height = 256 < (UUtUns16)temp ? 256 : temp;
60
61 M3rDraw_Bitmap(texture, &dest_point, width, height, inShade, inAlpha);
62 }
63 }
64}
65
66
67void ONICALL DDrShowResumeButton(WMtWindow* window, int visibility)
68{
69 if (visibility)
70 WMrWindow_SetLocation(window, 150, 350);
71 WMrWindow_SetVisible(window, visibility);
72}
73
74
75/* Options always visible patch */
76void ONICALL DDrShowOptionsButton(WMtWindow* window, int visibility)
77{
78 WMrWindow_SetVisible(window, 1);
79}
80
81void ONICALL DDrGame_Init()
82{
83 if (opt_usedaodanbsl)
84 SLrDaodan_Initialize();
85 if (patch_flatline)
86 SLrFlatline_Initialize();
87}
88
89
90//this was broken
91FILE** _UUgError_WarningFile = (FILE**)0x005711B4;
92FILE *__fastcall DDrPrintWarning(int filename, int linenumber, unsigned __int16 errornum, int message)
93{
94
95 FILE *v4; // eax@1
96 FILE *result; // eax@4
97 char v6[512]; // [sp+0h] [bp-100h]@1
98 FILE* UUgError_WarningFile = *_UUgError_WarningFile;
99
100 if (filename && message && (strlen((const char*)filename)+strlen((const char*)message))<420) {
101 sprintf(
102 v6,
103 "Error %x reported from File: %s, Line: %d (message follows) \r\n%s",
104 errornum,
105 (const char*)filename,
106 linenumber,
107 (const char*)message);
108
109 if ( UUgError_WarningFile
110 || (UUgError_WarningFile = oni_fopen("debugger.txt", "wb"), UUgError_WarningFile ) )
111 {
112 oni_fprintf(UUgError_WarningFile, "%s\r\n", v6);
113 oni_fflush(UUgError_WarningFile);
114 }
115 }
116 //oni_fprintf(stdout, v6);
117 //sprintf(&v6, "%s", message);
118 *_UUgError_WarningFile = UUgError_WarningFile;
119 result = UUgError_WarningFile;
120 return result;
121}
122
123
124int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output)
125{
126 //flags = (1 << 10);
127 type = 1;
128 //DDrPatch_Byte( 0x005EB83C + 3, 0xff );
129 DDrPatch_Int32((int*)(OniExe + 0x001EB83C), 0xFF000000 );
130 return M3rTextureMap_New(width, height, type, allocated, flags, name, output);
131}
132
133short DD_Patch_DebugNameShadeHack( Character* Char )
134{
135 return TSrContext_SetShade(*(void**)(OniExe + 0x001EB844), ONrCharacter_GetHealthShade( Char->Health, Char->MaxHealth ));
136 //return TSrContext_SetShade(*(void**)0x005EB844, 0xFFFFFFFF);
137}
138
139
140// Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the
141// Windows key but has the possible side effect of allowing the screensaver
142// to enable itself in-game.
143void DD_Patch_AltTab()
144{
145 // 0xC3 = ret, so makes those functions just have a "ret" instruction at their start
146 DDrPatch_Byte ((char*)UUrPlatform_Initialize, 0xC3);
147 DDrPatch_Byte ((char*)UUrPlatform_Terminate, 0xC3);
148}
149
150// Textures using ARGB8888 can be used
151void DD_Patch_ARGB8888()
152{
153 DDrPatch_Byte ((char*)(OniExe + 0x00135af0), 0x07);
154 DDrPatch_Byte ((char*)(OniExe + 0x00135af4), 0x0B);
155}
156
157// Fix BinkBufferInit() call in BKrMovie_Play() to use GDI (DIB) blitting
158// instead of DirectDraw; patch ONiRunGame to use the same method to play
159// outro (ie., BKrMovie_Play() instead of ONrMovie_Play_Hardware() as the
160// latter has problems on WINE).
161void DD_Patch_BinkPlay()
162{
163 // push BINKBUFFERAUTO -> push BINKBUFFERDIBSECTION.
164 DDrPatch_Byte((void*)(OniExe + 0x0008829b + 1), 0x02);
165 // call ONrMovie_Play_Hardware -> call ONrMovie_Play
166 DDrPatch_MakeCall((void*)(OniExe + 0x000d496f), ONrMovie_Play);
167}
168
169// Enables d_regen (unfinished) and prevents fly-in portraits from being
170// stretched when playing in widescreen resolutions.
171void DD_Patch_BSL()
172{
173 //Calculating the value of the needed offset is much more reliable when the compiler does it for you.
174
175 //TODO: fix moonshadow.
176 Character * Chr = 0;
177 int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF;
178 const unsigned char regen_patch[] =
179 {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat -> NOOP
180 0x90, 0x90, // test al, al -> NOOP
181 0x90, 0x90, // jz short loc_51BB98 -> NOOP
182 0x8B, 0x86, (char)NoPath, 0x01, 0x00, 0x00, // mov eax, [esi+Character.field_1E8]
183 // -> mov eax, [esi+Character.RegenHax]
184 0x85, 0xC0, // test eax, eax
185 0x74, 0x21 // jnz 0x21 -> jz 0x21
186 };
187 DDrPatch_Const((char*)(OniExe + 0x0011BB64), regen_patch);
188
189 // Patches for existing BSL functions
190 SLrDaodan_Patch();
191}
192
193// Adds new cheat codes if cheattable is also enabled
194void DD_Patch_Cheater()
195{
196 DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater);
197 DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590);
198#if 1
199 DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames);
200#endif
201 DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
202}
203
204// Cheats always enabled
205void DD_Patch_CheatsEnabled()
206{
207 DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame);
208}
209
210// Use Daodan's own cheattable
211void DD_Patch_CheatTable()
212{
213 DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name);
214 DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on);
215}
216
217// Load chinese font DLL if available
218void DD_Patch_Chinese()
219{
220 if (GetFileAttributes("xfhsm_oni.dll") != INVALID_FILE_ATTRIBUTES)
221 {
222 HMODULE dll;
223 DWORD err;
224
225 DDrStartupMessage("Daodan: Loading chinese DLL");
226 dll = LoadLibrary("xfhsm_oni.dll");
227 err = GetLastError();
228 if( dll )
229 {
230 void* proc = GetProcAddress( dll, "InstallHook" );
231 if(proc)
232 {
233 ((CHINESEPROC)proc)(GetCurrentThreadId());
234 }
235 } else {
236 char msg[100];
237 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL);
238 DDrStartupMessage("Daodan: Loading DLL failed with error %i: %s", err, msg);
239 }
240 }
241}
242
243// Limit cursor to Oni's window
244void DD_Patch_ClipCursor()
245{
246 // LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook.
247 DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set);
248
249 // LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook.
250 DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set);
251
252 // LIrTermiante: replace LIrPlatform_Terminate call with our hook.
253 DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate);
254}
255
256// Disables weapon cooldown exploit
257void DD_Patch_CooldownTimer()
258{
259 const unsigned char cooldown_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
260 DDrPatch_Const ((char*)(OniExe + 0x0011a825), cooldown_patch);
261}
262
263// Daodan device mode enumeration function
264void DD_Patch_DaodanDisplayEnum()
265{
266 DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)DD_GLrEnumerateDisplayModes);
267}
268
269// Adds new BSL functions
270void DD_Patch_DaodanInit()
271{
272 DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init);
273}
274
275// Forced DirectInput (for Windows NT)
276void DD_Patch_DirectInput()
277{
278 DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
279}
280
281// Disable Oni's command line parser so it doesn't interfere with ours
282void DD_Patch_DisableCmdLine()
283{
284 DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0xc3c03366);
285}
286
287// Enable flatline multiplayer code
288void DD_Patch_Flatline()
289{
290 DDrPatch_MakeCall((void*)(OniExe + 0x000E17F6), FLrHook_Lasers );
291
292 //Flatline related stuff
293 DDrPatch_MakeCall((void*)(OniExe + 0x000FBCEA), DDrText_Hook);
294
295 DDrPatch_Int32((int*)(OniExe + 0x000B24D2), (unsigned int)FLrSpawnHack);
296
297 DDrPatch_NOOP((char*)(OniExe + 0x000C26CB), 6);
298
299 DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen);
300 DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate);
301}
302
303// Font texture cache doubled
304void DD_Patch_FontTextureCache()
305{
306 DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20);
307 DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40);
308}
309
310// Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own)
311void DD_Patch_GetCmdLine()
312{
313 DDrPatch_NOOP ((char*)(OniExe + 0x000d3280), 51);
314}
315
316// Allow HD screens with resolution < 1024*768
317void DD_Patch_HDScreens_LowRes()
318{
319 DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap);
320}
321
322// Hackish fix for Konoko not kicking guns
323// Don't use this, it breaks stairs.
324void DD_Patch_KickGuns()
325{
326 const unsigned char kickgun_patch[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0xC7, 0x05, 0x1C, 0xC9, 0x5E, 0x00, 0x70, 0xB8, 0x43, 0x00, 0xC7, 0x05, 0x20, 0xC9, 0x5E, 0x00, 0x20, 0xBE, 0x43 };
327 DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch);
328}
329
330// Disable loading the vtuneapi.dll
331void DD_Patch_KillVTune()
332{
333 DDrPatch_Byte ((char*)(OniExe + 0x00026340), 0xC3);
334}
335
336// Now supports textures up to 512x512
337void DD_Patch_LargeTextures()
338{
339 DDrPatch_Byte ((char*)(OniExe + 0x00005251), 0x10);
340}
341
342// Non-"_Final" levels are now valid
343void DD_Patch_LevelPlugins()
344{
345 DDrPatch_Byte ((char*)(OniExe + 0x000206a8), 0x01);
346}
347
348// Weapon on ground shown with name and magazine contents
349void DD_Patch_NewWeap()
350{
351 //Makes it always say "Received weapon_name."
352 //Needs check for loc_4DFC66
353 //DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2);
354
355 //Adds Weapon name and ammo meter to pickup autoprompt
356 DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9);
357 DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5);
358 DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message);
359
360 //Moves location of colors
361 //DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors );
362 //DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors );
363}
364
365// Disable Multi-byte character awareness patch (multiple language support)
366void DD_Patch_NoMultiByte()
367{
368 DDrPatch_Byte ((char*)(OniExe + 0x0002d8f8), 0xeb);
369 DDrPatch_Byte ((char*)(OniExe + 0x0002d9ad), 0xeb);
370 DDrPatch_Byte ((char*)(OniExe + 0x0002dbe2), 0xeb);
371 DDrPatch_Byte ((char*)(OniExe + 0x0002dec3), 0xeb);
372 DDrPatch_Byte ((char*)(OniExe + 0x0002e2ab), 0xeb);
373 DDrPatch_Byte ((char*)(OniExe + 0x0002e2c4), 0xeb);
374 DDrPatch_Byte ((char*)(OniExe + 0x0002e379), 0xeb);
375 DDrPatch_Byte ((char*)(OniExe + 0x0002e48c), 0xeb);
376 DDrPatch_Byte ((char*)(OniExe + 0x0002e4d0), 0xeb);
377 DDrPatch_Byte ((char*)(OniExe + 0x0002e4f4), 0xeb);
378 DDrPatch_Byte ((char*)(OniExe + 0x0002e646), 0xeb);
379 DDrPatch_Byte ((char*)(OniExe + 0x0002e695), 0xeb);
380 DDrPatch_Byte ((char*)(OniExe + 0x0002e944), 0xeb);
381 DDrPatch_Byte ((char*)(OniExe + 0x0002e95d), 0xeb);
382 DDrPatch_Byte ((char*)(OniExe + 0x0002e98e), 0xeb);
383 DDrPatch_Byte ((char*)(OniExe + 0x0002e9dc), 0xeb);
384}
385
386// Fix options not visible in main menu when a game was started
387void DD_Patch_OptionsVisible()
388{
389 DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton);
390 DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton);
391}
392
393// Unlocks particle action disabling/enabling bits for all events. (Will be
394// controlled by a command line switch when I figure out how to do that without
395// Win32 hacks.)
396void DD_Patch_ParticleDisableBit()
397{
398 DDrPatch_Int16 ((short*)(OniExe + 0x001b184), 0x9090);
399}
400
401// Pathfinding grid cache size x8
402void DD_Patch_PathFinding()
403{
404 const unsigned char pathfinding[2] = {0x90 , 0xE9 };
405 DDrPatch_Byte ((char*)(OniExe + 0x0010b03b), 0x20);
406 DDrPatch_Byte ((char*)(OniExe + 0x0010b04c), 0x20);
407
408 //other stuff
409 DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding);
410}
411
412// Projectile awareness fixed
413void DD_Patch_ProjAware()
414{
415 DDrPatch_Byte ((char*)(OniExe + 0x0009c07c), 0x6c);
416 DDrPatch_Byte ((char*)(OniExe + 0x0009c080), 0x70);
417 DDrPatch_Byte ((char*)(OniExe + 0x0009c084), 0x74);
418 DDrPatch_Byte ((char*)(OniExe + 0x0009c110), 0x6c);
419}
420
421// Safe startup message printer
422void DD_Patch_SafePrintf()
423{
424 DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage);
425}
426
427// Show all (also enemies') lasersights
428void DD_Patch_ShowAllLasersights()
429{
430 DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 );
431}
432
433// Experiment with allowing enemies to be thrown over railings
434void DD_Patch_Throwtest()
435{
436 const unsigned char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
437 DDrPatch_Const((char*)(OniExe + 0x000dc190), throwtest_patch);
438}
439
440// DaodanGL with windowed mode support
441void DD_Patch_UseDaodanGL()
442{
443 // LIrPlatform_Mode_Set: GetWindowRect -> GetClientRect.
444 DDrPatch_NOOP((char*) OniExe + 0x00002dd6, 6);
445 DDrPatch_MakeCall((char*) OniExe + 0x00002dd6, (void*) GetClientRect);
446
447 // UUrWindow_GetSize: GetWindowRect -> GetClientRect.
448 DDrPatch_NOOP((char*) OniExe + 0x0002651c, 6);
449 DDrPatch_MakeCall((char*) OniExe + 0x0002651c, (void*) GetClientRect);
450
451 // LIrPlatform_PollInputForAction: fix GetCursorPos call to return client coordinates.
452 DDrPatch_NOOP((char*) OniExe + 0x000032cc, 6);
453 DDrPatch_MakeCall((char*) OniExe + 0x000032cc, (void*) DD_GetCursorPos);
454
455 // LIrPlatform_InputEvent_GetMouse: fix GetCursorPos call to return client coordinates.
456 DDrPatch_NOOP((char*) OniExe + 0x00002cc2, 6);
457 DDrPatch_MakeCall((char*) OniExe + 0x00002cc2, (void*) DD_GetCursorPos);
458
459 // LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
460 DDrPatch_NOOP((char*) OniExe + 0x000032b7, 6);
461 DDrPatch_MakeCall((char*) OniExe + 0x000032b7, (void*) DD_SetCursorPos);
462
463 // LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
464 DDrPatch_NOOP((char*) OniExe + 0x00003349, 6);
465 DDrPatch_MakeCall((char*) OniExe + 0x00003349, (void*) DD_SetCursorPos);
466
467 // Replace ONrPlatformInitialize.
468 DDrPatch_MakeJump((void*) ONrPlatform_Initialize, (void*) DD_ONrPlatform_Initialize);
469
470 // Replace gl_platform_initialize.
471 DDrPatch_MakeJump((void*) gl_platform_initialize, (void*) DD_GLrPlatform_Initialize);
472
473 // Replace gl_platform_dispose.
474 DDrPatch_MakeJump((void *) gl_platform_dispose, (void*) DD_GLrPlatform_Dispose);
475}
476
477// Performance patch
478void DD_Patch_UseGetTickCount()
479{
480 DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High);
481 DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency);
482 DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths);
483}
484
485// Adds working function for existing BSL command wp_fadetime, sets fade time to 4800
486void DD_Patch_WpFadetime()
487{
488 // Makes wp_fadetime actually have a function
489 const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
490 DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch);
491 DDrPatch_Byte ((char*)(OniExe + 0x0011a560), 0x31);
492
493 // Sets the fadetime to 4800 by default
494 DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 0x12c0);
495}
496
497// Disable gamma slider in options in windowed mode
498void DD_Patch_GammaSlider()
499{
500 DDrPatch_MakeCall((void*)(OniExe + 0x000d262c), (void*)DD_ONiOGU_GammaSlider_SetRange);
501}
502
503// Fix the warning print method
504void DD_Patch_PrintWarning()
505{
506 DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning);
507}
508
509//Fix crappy ai2_shownames
510void DD_Patch_ShowNames()
511{
512 //Set distance above head to 4.0
513 DDrPatch_Int32((int*)(OniExe + 0x0008C998), 0x005296C8);
514 //texture height
515 DDrPatch_Byte((char*)(OniExe + 0x0008C9DF), 0x3F );
516 //texture width
517 DDrPatch_NOOP((char*)(OniExe + 0x0008C9CA), 6 );
518
519/*
520// Crashes game.
521 //Set the text color to whatever we like ;)
522 DDrPatch_NOOP((char*)(OniExe + 0x0008C898), 6 );
523 DDrPatch_Byte((char*)(OniExe + 0x0008C898), 0x8B );
524 DDrPatch_Byte((char*)(OniExe + 0x0008C899), 0xCE );
525
526 DDrPatch_MakeCall((void*)(OniExe + 0x0008C8A3), DD_Patch_DebugNameShadeHack);
527
528 //Make the background black for additive blending
529 DDrPatch_MakeCall((void*)(OniExe + 0x0008C802), DD_Patch_DebugNameTextureInit );
530*/
531}
532
533/*
534void DD_Patch_ShowTriggerVolumes()
535{
536 DDrPatch_Int32((int*)(OniExe + 0x000cc9bb+4), (uint32_t)DD_OBJiTriggerVolume_Draw);
537}
538
539void DD_Patch_ShowFlags()
540{
541 DDrPatch_Int32((int*)(OniExe + 0x000c4ed4+4), (uint32_t)DD_OBJiFlag_Draw);
542}
543*/
544
545bool DD_Patch_Init()
546{
547 DDrStartupMessage("Daodan: Patching engine");
548
549 if (patch_alttab)
550 DD_Patch_AltTab();
551
552 if (patch_argb8888)
553 DD_Patch_ARGB8888();
554
555 if (patch_binkplay)
556 DD_Patch_BinkPlay();
557
558 if (patch_bsl)
559 DD_Patch_BSL();
560
561 if (patch_cheater)
562 DD_Patch_Cheater();
563
564 if (patch_cheatsenabled)
565 DD_Patch_CheatsEnabled();
566
567 if (patch_cheattable)
568 DD_Patch_CheatTable();
569
570 if (patch_chinese)
571 DD_Patch_Chinese();
572
573 if (patch_clipcursor)
574 DD_Patch_ClipCursor();
575
576 if (patch_cooldowntimer)
577 DD_Patch_CooldownTimer();
578
579 if (patch_daodandisplayenum)
580 DD_Patch_DaodanDisplayEnum();
581
582 if (patch_directinput)
583 DD_Patch_DirectInput();
584
585 if (patch_disablecmdline)
586 DD_Patch_DisableCmdLine();
587
588 if (patch_fonttexturecache)
589 DD_Patch_FontTextureCache();
590
591 if (patch_getcmdline)
592 DD_Patch_GetCmdLine();
593
594 if (patch_hdscreens_lowres)
595 DD_Patch_HDScreens_LowRes();
596
597 if (patch_kickguns)
598 DD_Patch_KickGuns();
599
600 //if (patch_killvtune)
601 // DD_Patch_KillVTune();
602
603 if (patch_largetextures)
604 DD_Patch_LargeTextures();
605
606 if (patch_levelplugins)
607 DD_Patch_LevelPlugins();
608
609 if (patch_newweapon)
610 DD_Patch_NewWeap();
611
612 if (patch_nomultibyte)
613 DD_Patch_NoMultiByte();
614
615 if(patch_optionsvisible)
616 DD_Patch_OptionsVisible();
617
618 if (patch_particledisablebit)
619 DD_Patch_ParticleDisableBit();
620
621 if (patch_pathfinding)
622 DD_Patch_PathFinding();
623
624 if (patch_projaware)
625 DD_Patch_ProjAware();
626
627 if (patch_safeprintf)
628 DD_Patch_SafePrintf();
629
630 if (patch_showalllasersights)
631 DD_Patch_ShowAllLasersights();
632
633 if (patch_throwtest)
634 DD_Patch_Throwtest();
635
636 if (patch_usedaodangl)
637 DD_Patch_UseDaodanGL();
638
639 if (patch_usegettickcount)
640 DD_Patch_UseGetTickCount();
641
642 if (patch_wpfadetime)
643 DD_Patch_WpFadetime();
644
645
646 DD_Patch_DaodanInit();
647
648 DD_Patch_GammaSlider();
649
650 DD_Patch_PrintWarning();
651
652
653 DD_Patch_ShowNames();
654/*
655 DD_Patch_ShowTriggerVolumes();
656 DD_Patch_ShowFlags();
657*/
658 if (patch_flatline)
659 DD_Patch_Flatline();
660
661 return true;
662}
663
Note: See TracBrowser for help on using the repository browser.