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 677 by alloc, Sat Mar 2 23:46:33 2013 UTC vs.
Revision 690 by alloc, Wed Mar 6 18:33:15 2013 UTC

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

Diff Legend

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