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 681 by alloc, Sun Mar 3 04:37:58 2013 UTC vs.
Revision 692 by alloc, Thu Mar 7 17:26:13 2013 UTC

# Line 1 | Line 1
1 + #include <windows.h>
2   #include <string.h>
3  
4   #include "Daodan.h"
# Line 11 | Line 12
12   #include "Daodan_WindowHack.h"
13  
14   #include "Oni.h"
14 #include "Oni_Persistence.h"
15  
16 < #include "BFW_Utility.h"
16 > #include "Oni_GL.h"
17 > #include "Daodan_GL.h"
18  
19 < #include "oni_gl.h"
19 < #include "daodan_gl.h"
20 <
21 < #include "inifile.h"
19 > #include "Inifile_Reader.h"
20  
21   HMODULE DDrDLLModule;
22   HMODULE DDrONiModule;
# Line 54 | Line 52 | bool patch_cheater = true;
52   bool patch_newweapon = true;
53   bool opt_usedaodanbsl = true;
54   bool opt_border = true;
57 bool opt_shadow = false;
55   bool opt_topmost = false;
56  
57   typedef int (__cdecl *CHINESEPROC)(DWORD WINAPI);
# Line 66 | Line 63 | bool DDrPatch_Init()
63          // Font texture cache doubled
64          if (patch_fonttexturecache)
65          {
66 <                DDrPatch_Byte(OniExe + 0x00020ea7, 0x20);
67 <                DDrPatch_Byte(OniExe + 0x00020f4a, 0x40);
66 >                DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20);
67 >                DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40);
68          }
69          
70          // Now supports textures up to 512x512
71          if (patch_largetextures)
72 <                DDrPatch_Byte  (OniExe + 0x00005251, 0x10);
72 >                DDrPatch_Byte  ((char*)(OniExe + 0x00005251), 0x10);
73          
74          // Non-"_Final" levels are now valid
75          if (patch_levelplugins)
76 <                DDrPatch_Byte  (OniExe + 0x000206a8, 0x01);
76 >                DDrPatch_Byte  ((char*)(OniExe + 0x000206a8), 0x01);
77          
78          // Pathfinding grid cache size x8
79          if (patch_pathfinding)
80          {
81 <                const char pathfinding[2] = {0x90 , 0xE9 };
82 <                DDrPatch_Byte  (OniExe + 0x0010b03b, 0x20);
83 <                DDrPatch_Byte  (OniExe + 0x0010b04c, 0x20);
81 >                const unsigned char pathfinding[2] = {0x90 , 0xE9 };
82 >                DDrPatch_Byte  ((char*)(OniExe + 0x0010b03b), 0x20);
83 >                DDrPatch_Byte  ((char*)(OniExe + 0x0010b04c), 0x20);
84  
85                  //other stuff
86 <                DDrPatch_Const(0x440789, pathfinding);
86 >                DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding);
87          }
88          
89          // Projectile awareness fixed
90          if (patch_projaware)
91          {
92 <                DDrPatch_Byte  (OniExe + 0x0009c07c, 0x6c);
93 <                DDrPatch_Byte  (OniExe + 0x0009c080, 0x70);
94 <                DDrPatch_Byte  (OniExe + 0x0009c084, 0x74);
95 <                DDrPatch_Byte  (OniExe + 0x0009c110, 0x6c);
92 >                DDrPatch_Byte  ((char*)(OniExe + 0x0009c07c), 0x6c);
93 >                DDrPatch_Byte  ((char*)(OniExe + 0x0009c080), 0x70);
94 >                DDrPatch_Byte  ((char*)(OniExe + 0x0009c084), 0x74);
95 >                DDrPatch_Byte  ((char*)(OniExe + 0x0009c110), 0x6c);
96          }
97          
98          // Forced DirectInput (for Windows NT)
99          if (patch_directinput)
100 <                DDrPatch_Byte  (OniExe + 0x00002e6d, 0xeb);
100 >                DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
101  
102          if (patch_wpfadetime)
103          {
104                  // Makes wp_fadetime actually have a function
105 <                const char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
106 <                DDrPatch_Const (OniExe + 0x0011a889, fadetime_patch);
107 <                DDrPatch_Byte  (OniExe + 0x0011a560, 0x31);
105 >                const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
106 >                DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch);
107 >                DDrPatch_Byte  ((char*)(OniExe + 0x0011a560), 0x31);
108                  
109                  // Sets the fadetime to 4800 by default
110 <                DDrPatch_Int16 ((OniExe + 0x0011ab0e), 0x12c0);
110 >                DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 0x12c0);
111          }
112          
113          // FIXME: add switches
# Line 123 | Line 120 | bool DDrPatch_Init()
120          // Don't use this, it breaks stairs.
121          if (patch_kickguns)
122          {
123 <                const 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 };
124 <                DDrPatch_Const (OniExe + 0x000dc420, kickgun_patch);
123 >                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 };
124 >                DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch);
125          }
126          
127          // Cooldown timer exploit fix ^_^
128          if (patch_cooldowntimer)
129          {
130 <                const 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 };
131 <                DDrPatch_Const (OniExe + 0x0011a825, cooldown_patch);
130 >                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 };
131 >                DDrPatch_Const ((char*)(OniExe + 0x0011a825), cooldown_patch);
132          }
133          
134          if (patch_throwtest)
135          {
136 <                const char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
137 <                DDrPatch_Const(OniExe + 0x000dc190, throwtest_patch);
136 >                const unsigned char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
137 >                DDrPatch_Const((char*)(OniExe + 0x000dc190), throwtest_patch);
138          }
139          
140          // Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the Windows key but has the possible side effect of allowing the screensaver to enable itself in-game.
141          if (patch_alttab)
142          {
143 <                DDrPatch_Byte  ((void*)UUrPlatform_Initialize, 0xC3);
144 <                DDrPatch_Byte  ((void*)UUrPlatform_Terminate, 0xC3);
143 >                // 0xC3 = ret, so makes those functions just have a "ret" instruction at their start
144 >                DDrPatch_Byte  ((char*)UUrPlatform_Initialize, 0xC3);
145 >                DDrPatch_Byte  ((char*)UUrPlatform_Terminate, 0xC3);
146          }
147          
148          // Unlocks particle action disabling/enabling bits for all events. (Will be controlled by a command line switch when I figure out how to do that without Win32 hacks.)
149          if (patch_particledisablebit)
150 <                DDrPatch_Int16 (OniExe + 0x001b184, 0x9090);
150 >                DDrPatch_Int16 ((short*)(OniExe + 0x001b184), 0x9090);
151          
152          // Multi-byte patch (multiple language support)
153          if (!patch_multibyte)
154          {
155 <                DDrPatch_Byte  (OniExe + 0x0002d8f8, 0xeb);
156 <                DDrPatch_Byte  (OniExe + 0x0002d9ad, 0xeb);
157 <                DDrPatch_Byte  (OniExe + 0x0002dbe2, 0xeb);
158 <                DDrPatch_Byte  (OniExe + 0x0002dec3, 0xeb);
159 <                DDrPatch_Byte  (OniExe + 0x0002e2ab, 0xeb);
160 <                DDrPatch_Byte  (OniExe + 0x0002e2c4, 0xeb);
161 <                DDrPatch_Byte  (OniExe + 0x0002e379, 0xeb);
162 <                DDrPatch_Byte  (OniExe + 0x0002e48c, 0xeb);
163 <                DDrPatch_Byte  (OniExe + 0x0002e4d0, 0xeb);
164 <                DDrPatch_Byte  (OniExe + 0x0002e4f4, 0xeb);
165 <                DDrPatch_Byte  (OniExe + 0x0002e646, 0xeb);
166 <                DDrPatch_Byte  (OniExe + 0x0002e695, 0xeb);
167 <                DDrPatch_Byte  (OniExe + 0x0002e944, 0xeb);
168 <                DDrPatch_Byte  (OniExe + 0x0002e95d, 0xeb);
169 <                DDrPatch_Byte  (OniExe + 0x0002e98e, 0xeb);
170 <                DDrPatch_Byte  (OniExe + 0x0002e9dc, 0xeb);
155 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002d8f8), 0xeb);
156 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002d9ad), 0xeb);
157 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002dbe2), 0xeb);
158 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002dec3), 0xeb);
159 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e2ab), 0xeb);
160 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e2c4), 0xeb);
161 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e379), 0xeb);
162 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e48c), 0xeb);
163 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e4d0), 0xeb);
164 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e4f4), 0xeb);
165 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e646), 0xeb);
166 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e695), 0xeb);
167 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e944), 0xeb);
168 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e95d), 0xeb);
169 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e98e), 0xeb);
170 >                DDrPatch_Byte  ((char*)(OniExe + 0x0002e9dc), 0xeb);
171          }
172          
173          // Cheat table patch
174          if (patch_cheattable)
175          {
176 <                DDrPatch_Int32 (0x004f616b, (int)&DDr_CheatTable[0].name);
177 <                DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on);
176 >                DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name);
177 >                DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on);
178          }
179          
180          // ARGB8888 textures
181          if (patch_argb8888)
182          {
183 <                DDrPatch_Byte  (OniExe + 0x00135af0, 0x07);
184 <                DDrPatch_Byte  (OniExe + 0x00135af4, 0x0B);
183 >                DDrPatch_Byte  ((char*)(OniExe + 0x00135af0), 0x07);
184 >                DDrPatch_Byte  ((char*)(OniExe + 0x00135af4), 0x0B);
185          }
186  
187          //Test newweap patch
# Line 191 | Line 189 | bool DDrPatch_Init()
189                  
190                  //Makes it always say "Recieved weapon_name."
191                  //Needs check for loc_4DFC66
192 <                //DDrPatch_NOOP( OniExe + 0x000E4DF8,2);
192 >                //DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2);
193  
194                  //Adds Weapon name and ammo meter to pickup autoprompt
195 <                DDrPatch_NOOP( OniExe + 0x000FAC73, 9);
196 <                DDrPatch_NOOP( OniExe + 0x000FAC80, 5);
197 <                DDrPatch_MakeCall( OniExe + 0xFAC85, DDrWeapon2Message);
195 >                DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9);
196 >                DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5);
197 >                DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message);
198                  
199                  //Moves location of colors
200 <                //DDrPatch_Int32( 0x0042E3D5, (int)&DDrDSayColors );
201 <                //DDrPatch_Int32( 0x0042E3DA, (int)&DDrDSayColors );
200 >                //DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors );
201 >                //DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors );
202          }
203          
204          // Disable loading the vtuneapi.dll
205          //if (patch_killvtune)
206 <                //DDrPatch_Byte  (OniExe + 0x00026340, 0xC3);
206 >                //DDrPatch_Byte  ((char*)(OniExe + 0x00026340), 0xC3);
207          
208          // Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own)
209          if (patch_getcmdline)
210 <                DDrPatch_NOOP  (OniExe + 0x000d3280, 51);
210 >                DDrPatch_NOOP  ((char*)(OniExe + 0x000d3280), 51);
211          
212          // Disable Oni's command line parser so it doesn't interfere with ours
213          if (patch_disablecmdline)
214 <                DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366);
214 >                DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0xc3c03366);
215          
216          if (patch_bsl)
217          {
# Line 222 | Line 220 | bool DDrPatch_Init()
220                  //TODO: fix moonshadow.
221                  Character * Chr = 0;
222                  int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF;
223 <                const char regen_patch[] =
223 >                const unsigned char regen_patch[] =
224                  {0x90, 0x90, 0x90, 0x90, 0x90,                          // mov    al, _WPgRegenerationCheat     -> NOOP
225                  0x90, 0x90,                                                                     // test   al, al                                        -> NOOP
226                  0x90, 0x90,                                                                     // jz     short loc_51BB98                      -> NOOP
# Line 231 | Line 229 | bool DDrPatch_Init()
229                  0x85, 0xC0,                                                                     // test eax, eax
230                  0x74, 0x21                                                                      // jnz 0x21 -> jz 0x21
231                  };      
232 <                DDrPatch_Const(0x0051BB64, regen_patch);
232 >                DDrPatch_Const((char*)(OniExe + 0x0011BB64), regen_patch);
233          }
234          
235          if(patch_chinese)
# Line 251 | Line 249 | bool DDrPatch_Init()
249          if(1)
250          {
251                  //Set distance above head to 4.0
252 <                DDrPatch_Int32(0x0048C998, 0x005296C8);
252 >                DDrPatch_Int32((int*)(OniExe + 0x0008C998), 0x005296C8);
253                  //texture height
254 <                DDrPatch_Byte( 0x0048C9DF, 0x3F );
254 >                DDrPatch_Byte((char*)(OniExe + 0x0008C9DF), 0x3F );
255                  //texture       width
256 <                DDrPatch_NOOP( (char*)0x0048C9CA, 6 );
256 >                DDrPatch_NOOP((char*)(OniExe + 0x0008C9CA), 6 );
257                  //Set the text color to whatever we like ;)
258 <                DDrPatch_NOOP( 0x0048C898, 6 );
259 <                DDrPatch_Byte( 0x0048C898, 0x8B );
260 <                DDrPatch_Byte( 0x0048C899, 0xCE );
261 < //FLATLINE?             DDrPatch_MakeCall( 0x0048C8A3, FLrHook_DebugNameShadeHack);
258 >                DDrPatch_NOOP((char*)(OniExe + 0x0008C898), 6 );
259 >                DDrPatch_Byte((char*)(OniExe + 0x0008C898), 0x8B );
260 >                DDrPatch_Byte((char*)(OniExe + 0x0008C899), 0xCE );
261 > //FLATLINE?             DDrPatch_MakeCall((void*)(OniExe + 0x0008C8A3), FLrHook_DebugNameShadeHack);
262                  
263                  //Make the background black for additive blending
264 < //FLATLINE?             DDrPatch_MakeCall( 0x0048C802, FLrHook_DebugNameTextureInit );
264 > //FLATLINE?             DDrPatch_MakeCall((void*)(OniExe + 0x0008C802), FLrHook_DebugNameTextureInit );
265          }
266  
267          if(1)
268          {
269 <                //DDrPatch_NOOP( 0x004E1957, 6 );
270 <                //DDrPatch_MakeCall( 0x004E17F6, FLrHook_Lasers );
269 >                //DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 );
270 >                //DDrPatch_MakeCall((void*)(OniExe + 0x000E17F6), FLrHook_Lasers );
271          }
272  
273          //Flatline related stuff
274 < //      DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook);
274 > //      DDrPatch_MakeCall((void*)(OniExe + 0x000FBCEA), DDrText_Hook);
275          
276 < //FLATLINE?     DDrPatch_Int32( 0x004B24D2, FLrSpawnHack);
276 > //FLATLINE?     DDrPatch_Int32((int*)(OniExe + 0x000B24D2), FLrSpawnHack);
277  
278 < //FLATLINE?     DDrPatch_NOOP(0x004C26CB, 6);
278 > //FLATLINE?     DDrPatch_NOOP((char*)(OniExe + 0x000C26CB), 6);
279  
280 < //FLATLINE?     DDrPatch_MakeCall( 0x004C26CB, FLrHook_DoorOpen);
281 < //FLATLINE?     DDrPatch_MakeCall( 0x004EE3CF, FLrHook_ConsoleActivate);
280 > //FLATLINE?     DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen);
281 > //FLATLINE?     DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate);
282          return true;
283   }
284  
# Line 312 | Line 310 | bool DDrIniCallback(char* section, bool
310                                  opt_usedaodanbsl = !_stricmp(inifile_cleanstr(value), "true");
311                          else if (!_stricmp(name, "border"))
312                                  opt_border = !_stricmp(inifile_cleanstr(value), "true");
315                        else if (!_stricmp(name, "shadow"))
316                                opt_shadow = !_stricmp(inifile_cleanstr(value), "true");
313                          else if (!_stricmp(name, "topmost"))
314                                  opt_topmost = !_stricmp(inifile_cleanstr(value), "true");
315                          else if (!_stricmp(name, "multibyte"))
# Line 330 | Line 326 | bool DDrIniCallback(char* section, bool
326                                  opt_sound = !_stricmp(inifile_cleanstr(value), "true");
327                          else if (!_stricmp(name, "switch"))
328                                  M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true");
333                        //else if (!_stricmp(name, "devmode"))
334                                //turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true");
329                          else
330                                  DDrStartupMessage("unrecognised option \"%s\"", name);
331                          break;
# Line 401 | Line 395 | bool DDrIniCallback(char* section, bool
395                          else if (!_stricmp(name, "savepoint"))
396                          {
397                                  char* str = _strdup(value);
398 <                                DDrPatch_Int32(OniExe + 0x000fd730, (int)str);
399 <                                DDrPatch_Int32(OniExe + 0x000fd738, (int)str);
398 >                                DDrPatch_Int32((int*)(OniExe + 0x000fd730), (int)str);
399 >                                DDrPatch_Int32((int*)(OniExe + 0x000fd738), (int)str);
400                          }
401                          else if (!_stricmp(name, "syndicatewarehouse"))
402                          {
403                                  char* str = _strdup(value);
404 <                                DDrPatch_Int32(OniExe + 0x000fd71a, (int)str);
405 <                                DDrPatch_Int32(OniExe + 0x0010ef75, (int)str);
404 >                                DDrPatch_Int32((int*)(OniExe + 0x000fd71a), (int)str);
405 >                                DDrPatch_Int32((int*)(OniExe + 0x0010ef75), (int)str);
406                          }
407                          else if (!_stricmp(name, "damn"))
408 <                                DDrPatch__strdup(OniExe + 0x0010fb6e, value);
408 >                                DDrPatch__strdup((int*)(OniExe + 0x0010fb6e), value);
409                          else if (!_stricmp(name, "blam"))
410 <                                DDrPatch__strdup(OniExe + 0x0010fb73, value);
410 >                                DDrPatch__strdup((int*)(OniExe + 0x0010fb73), value);
411                          else if (!_stricmp(name, "shapeshifter_on"))
412                                  DDr_CheatTable[0].message_on = _strdup(value);
413                          else if (!_stricmp(name, "shapeshifter_off"))
# Line 556 | Line 550 | FILE *__fastcall DDrPrintWarning(int fil
550          char v6[512]; // [sp+0h] [bp-100h]@1
551          FILE* UUgError_WarningFile = *_UUgError_WarningFile;
552  
553 <        if (filename && message && (strlen(filename)+strlen(message))<420) {
553 >        if (filename && message && (strlen((const char*)filename)+strlen((const char*)message))<420) {
554                  sprintf(
555                          v6,
556                          "Error %x reported from File: %s, Line: %d (message follows) \r\n%s",
557                          errornum,
558 <                        filename,
558 >                        (const char*)filename,
559                          linenumber,
560 <                        message);
560 >                        (const char*)message);
561  
562                  if ( UUgError_WarningFile
563                          || (UUgError_WarningFile = oni_fopen("debugger.txt", "wb"), UUgError_WarningFile ) )
# Line 588 | Line 582 | void __cdecl DDrMain(int argc, char* arg
582  
583          DDrStartupMessage("daodan attached!");
584          
585 +        // Tell Oni to not load non levelX_final-files by default:
586          opt_ignore_private_data = false;
587 +
588 +        // Enable sound by default:
589          opt_sound = true;
590          
591          DDrConfig();
# Line 629 | Line 626 | void __cdecl DDrMain(int argc, char* arg
626          
627          // Safe startup message printer
628          if (patch_safeprintf)
629 <                DDrPatch_MakeJump(UUrStartupMessage, DDrStartupMessage);
629 >                DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage);
630          
631          // Daodan device mode enumeration function
632          if (patch_daodandisplayenum)
633 <                DDrPatch_MakeJump(gl_enumerate_valid_display_modes, daodan_enumerate_valid_display_modes);
633 >                DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)daodan_enumerate_valid_display_modes);
634          
635          // Performance patch
636          if (patch_usegettickcount)
637          {
638 <                DDrPatch_MakeJump(UUrMachineTime_High, DDrMachineTime_High);
639 <                DDrPatch_MakeJump(UUrMachineTime_High_Frequency, DDrMachineTime_High_Frequency);
640 <                DDrPatch_MakeJump(UUrMachineTime_Sixtieths, DDrMachineTime_Sixtieths);
638 >                DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High);
639 >                DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency);
640 >                DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths);
641          }
642  
643          // Cheats always enabled
644          if (patch_cheatsenabled)
645 <                DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
645 >                DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame);
646  
647          // Windowed mode
648          if (patch_usedaodangl)
649          {
650 <        DDrPatch_NOOP((char*)0x004032B7, 6);
651 <        DDrPatch_MakeCall((char*)0x004032B7, LIiP_SetCursorPosHook);
650 >                DDrPatch_NOOP((char*)(OniExe + 0x000032B7), 6);
651 >                DDrPatch_MakeCall((void*)(OniExe + 0x000032B7), (void*)LIiP_SetCursorPosHook);
652          
653 <        DDrPatch_NOOP((char*)0x00403349, 6);
654 <        DDrPatch_MakeCall((char*)0x00403349, LIiP_SetCursorPosHook);
655 <                DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize);
656 <                DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
653 >                DDrPatch_NOOP((char*)(OniExe + 0x00003349), 6);
654 >                DDrPatch_MakeCall((void*)(OniExe + 0x00003349), (void*)LIiP_SetCursorPosHook);
655 >                DDrPatch_MakeJump((void*)ONrPlatform_Initialize, (void*)DDrPlatform_Initialize);
656 >                DDrPatch_MakeJump((void*)gl_platform_initialize, (void*)daodangl_platform_initialize);
657          }
658          // Hacked windowed mode (for when daodangl isn't working properly)
659          else if (patch_windowhack)
660                  DDrWindowHack_Install();
661          
662          if (patch_daodaninit)
663 <                DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init);
663 >                DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init);
664          
665          // Patches for existing BSL functions
666          if (patch_bsl)
# Line 671 | Line 668 | void __cdecl DDrMain(int argc, char* arg
668                  
669          if (patch_cheater)
670          {
671 <                DDrPatch_MakeCall(OniExe + 0x000f618f, DDrCheater);
672 <                DDrPatch_Int16(OniExe + 0x000deb45, 0x5590);
671 >                DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater);
672 >                DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590);
673   #if 1
674 <                DDrPatch_MakeCall(OniExe + 0x000deb47, FallingFrames);
674 >                DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames);
675   #endif
676 <                DDrPatch_MakeJump(OniExe + 0x0010f021, DDrCheater_LevelLoad);
676 >                DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
677          }
678  
679 <        //DDrPatch_MakeJump(0x004378c0, DDrException);
683 <        DDrPatch_MakeJump(0x004245A0, DDrPrintWarning);
684 <        //init_daodan_gl();
679 >        DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning);
680          
681          ONiMain(argc, argv);
682   }
# Line 717 | Line 712 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,
712                          DDrONiModule = GetModuleHandle(NULL);
713                          
714                          if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852)
715 <                                DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain);
715 >                                DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain);
716                          else
717                                  ExitProcess(0);
718                          break;

Diff Legend

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