[346] | 1 | #include <string.h>
|
---|
| 2 |
|
---|
[272] | 3 | #include "Daodan.h"
|
---|
| 4 | #include "Daodan_Patch.h"
|
---|
| 5 | #include "Daodan_Utility.h"
|
---|
[323] | 6 | #include "Daodan_Win32.h"
|
---|
[339] | 7 | #include "Daodan_Cheater.h"
|
---|
| 8 | #include "Daodan_Persistence.h"
|
---|
[272] | 9 |
|
---|
[349] | 10 | #include "Daodan_WindowHack.h"
|
---|
| 11 |
|
---|
[273] | 12 | #include "Oni.h"
|
---|
[339] | 13 | #include "Oni_Persistence.h"
|
---|
| 14 |
|
---|
[272] | 15 | #include "BFW_Utility.h"
|
---|
| 16 |
|
---|
[297] | 17 | #include "oni_gl.h"
|
---|
| 18 | #include "daodan_gl.h"
|
---|
| 19 |
|
---|
[346] | 20 | #include "inifile.h"
|
---|
| 21 |
|
---|
[272] | 22 | HMODULE DDrDLLModule;
|
---|
| 23 | HMODULE DDrONiModule;
|
---|
| 24 |
|
---|
[347] | 25 | bool patch_fonttexturecache = true;
|
---|
| 26 | bool patch_largetextures = true;
|
---|
[349] | 27 | bool patch_levelplugins = true;
|
---|
[347] | 28 | bool patch_pathfinding = true;
|
---|
| 29 | bool patch_projaware = true;
|
---|
[348] | 30 | bool patch_directinput = true;
|
---|
[347] | 31 | bool patch_wpfadetime = true;
|
---|
| 32 | bool patch_kickguns = false;
|
---|
| 33 | bool patch_cooldowntimer = true;
|
---|
| 34 | bool patch_throwtest = false;
|
---|
| 35 | bool patch_alttab = true;
|
---|
| 36 | bool patch_particledisablebit = false;
|
---|
| 37 | bool patch_multibyte = true;
|
---|
| 38 | bool patch_cheattable = true;
|
---|
| 39 |
|
---|
| 40 | bool patch_safeprintf = true;
|
---|
| 41 | bool patch_daodandisplayenum = true;
|
---|
| 42 | bool patch_usegettickcount = true;
|
---|
[348] | 43 | bool patch_cheatsenabled = true;
|
---|
[347] | 44 | bool patch_usedaodangl = false;
|
---|
[349] | 45 | bool patch_windowhack = true;
|
---|
[347] | 46 |
|
---|
[272] | 47 | bool DDrPatch_Init()
|
---|
| 48 | {
|
---|
[346] | 49 | DDrStartupMessage("patching engine");
|
---|
[342] | 50 |
|
---|
[272] | 51 | // Font texture cache doubled
|
---|
[347] | 52 | if (patch_fonttexturecache)
|
---|
| 53 | {
|
---|
| 54 | DDrPatch_Byte (OniExe + 0x00020ea7, 0x20);
|
---|
| 55 | DDrPatch_Byte (OniExe + 0x00020f4a, 0x40);
|
---|
| 56 | }
|
---|
[272] | 57 |
|
---|
| 58 | // Now supports textures up to 512x512
|
---|
[347] | 59 | if (patch_largetextures)
|
---|
| 60 | DDrPatch_Byte (OniExe + 0x00005251, 0x10);
|
---|
[272] | 61 |
|
---|
| 62 | // Non-"_Final" levels are now valid
|
---|
[348] | 63 | if (patch_levelplugins)
|
---|
| 64 | DDrPatch_Byte (OniExe + 0x000206a8, 0x01);
|
---|
[272] | 65 |
|
---|
| 66 | // Pathfinding grid cache size x8
|
---|
[347] | 67 | if (patch_pathfinding)
|
---|
| 68 | {
|
---|
| 69 | DDrPatch_Byte (OniExe + 0x0010b03b, 0x20);
|
---|
| 70 | DDrPatch_Byte (OniExe + 0x0010b04c, 0x20);
|
---|
| 71 | }
|
---|
[272] | 72 |
|
---|
| 73 | // Projectile awareness fixed
|
---|
[347] | 74 | if (patch_projaware)
|
---|
| 75 | {
|
---|
| 76 | DDrPatch_Byte (OniExe + 0x0009c07c, 0x6c);
|
---|
| 77 | DDrPatch_Byte (OniExe + 0x0009c080, 0x70);
|
---|
| 78 | DDrPatch_Byte (OniExe + 0x0009c084, 0x74);
|
---|
| 79 | DDrPatch_Byte (OniExe + 0x0009c110, 0x6c);
|
---|
| 80 | }
|
---|
[272] | 81 |
|
---|
| 82 | // Forced DirectInput (for Windows NT)
|
---|
[348] | 83 | if (patch_directinput)
|
---|
| 84 | DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb);
|
---|
[272] | 85 |
|
---|
[347] | 86 | if (patch_wpfadetime)
|
---|
| 87 | {
|
---|
| 88 | // Makes wp_fadetime actually have a function
|
---|
| 89 | const char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
|
---|
| 90 | DDrPatch_Const (OniExe + 0x0011a889, fadetime_patch);
|
---|
| 91 | DDrPatch_Byte (OniExe + 0x0011a560, 0x31);
|
---|
| 92 |
|
---|
| 93 | // Sets the fadetime to 4800 by default
|
---|
| 94 | DDrPatch_Int16 (OniExe + 0x0011ab0e, 0x12c0);
|
---|
| 95 | }
|
---|
[272] | 96 |
|
---|
| 97 |
|
---|
| 98 | // Hackish fix for Konoko not kicking guns
|
---|
[347] | 99 | if (patch_kickguns)
|
---|
| 100 | {
|
---|
| 101 | 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 };
|
---|
| 102 | DDrPatch_Const (OniExe + 0x000dc420, kickgun_patch);
|
---|
| 103 | }
|
---|
[272] | 104 |
|
---|
| 105 | // Cooldown timer exploit fix ^_^
|
---|
[347] | 106 | if (patch_cooldowntimer)
|
---|
| 107 | {
|
---|
| 108 | 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 };
|
---|
| 109 | DDrPatch_Const (OniExe + 0x0011a825, cooldown_patch);
|
---|
| 110 | }
|
---|
[272] | 111 |
|
---|
[347] | 112 | if (patch_throwtest)
|
---|
| 113 | {
|
---|
| 114 | const char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
---|
| 115 | DDrPatch_Const(OniExe + 0x000dc190, throwtest_patch);
|
---|
| 116 | }
|
---|
[272] | 117 |
|
---|
[322] | 118 | // 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.
|
---|
[347] | 119 | if (patch_alttab)
|
---|
| 120 | {
|
---|
| 121 | DDrPatch_Byte ((void*)UUrPlatform_Initialize, 0xC3);
|
---|
| 122 | DDrPatch_Byte ((void*)UUrPlatform_Terminate, 0xC3);
|
---|
| 123 | }
|
---|
[322] | 124 |
|
---|
| 125 | // 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.)
|
---|
[347] | 126 | if (patch_particledisablebit)
|
---|
| 127 | DDrPatch_Int16 (OniExe + 0x001b184, 0x9090);
|
---|
[322] | 128 |
|
---|
[329] | 129 | // Multi-byte patch (multiple language support)
|
---|
[347] | 130 | if (patch_multibyte)
|
---|
| 131 | {
|
---|
| 132 | DDrPatch_Byte (OniExe + 0x0002d8f8, 0xeb);
|
---|
| 133 | DDrPatch_Byte (OniExe + 0x0002d9ad, 0xeb);
|
---|
| 134 | DDrPatch_Byte (OniExe + 0x0002dbe2, 0xeb);
|
---|
| 135 | DDrPatch_Byte (OniExe + 0x0002dec3, 0xeb);
|
---|
| 136 | DDrPatch_Byte (OniExe + 0x0002e2ab, 0xeb);
|
---|
| 137 | DDrPatch_Byte (OniExe + 0x0002e2c4, 0xeb);
|
---|
| 138 | DDrPatch_Byte (OniExe + 0x0002e379, 0xeb);
|
---|
| 139 | DDrPatch_Byte (OniExe + 0x0002e48c, 0xeb);
|
---|
| 140 | DDrPatch_Byte (OniExe + 0x0002e4d0, 0xeb);
|
---|
| 141 | DDrPatch_Byte (OniExe + 0x0002e4f4, 0xeb);
|
---|
| 142 | DDrPatch_Byte (OniExe + 0x0002e646, 0xeb);
|
---|
| 143 | DDrPatch_Byte (OniExe + 0x0002e695, 0xeb);
|
---|
| 144 | DDrPatch_Byte (OniExe + 0x0002e944, 0xeb);
|
---|
| 145 | DDrPatch_Byte (OniExe + 0x0002e95d, 0xeb);
|
---|
| 146 | DDrPatch_Byte (OniExe + 0x0002e98e, 0xeb);
|
---|
| 147 | DDrPatch_Byte (OniExe + 0x0002e9dc, 0xeb);
|
---|
| 148 | }
|
---|
[329] | 149 |
|
---|
[339] | 150 | // Cheat table patch
|
---|
[347] | 151 | if (patch_cheattable)
|
---|
| 152 | {
|
---|
| 153 | DDrPatch_Int32 (OniExe + 0x000f616b, (int)&DDr_CheatTable[0].name);
|
---|
| 154 | DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on);
|
---|
| 155 | }
|
---|
[339] | 156 |
|
---|
[272] | 157 | return true;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
[347] | 160 | enum {s_unknown, s_patch, s_language} ini_section;
|
---|
[346] | 161 |
|
---|
| 162 | bool DDrIniCallback(char* section, bool newsection, char* name, char* value)
|
---|
| 163 | {
|
---|
| 164 | if (newsection)
|
---|
| 165 | {
|
---|
[347] | 166 | if (!stricmp(section, "patch"))
|
---|
| 167 | ini_section = s_patch;
|
---|
| 168 | else if (!stricmp(section, "language"))
|
---|
[346] | 169 | ini_section = s_language;
|
---|
| 170 | else
|
---|
| 171 | {
|
---|
| 172 | ini_section = s_unknown;
|
---|
| 173 | DDrStartupMessage("unrecognised ini section \"%s\"", section);
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | switch (ini_section)
|
---|
| 178 | {
|
---|
[347] | 179 | case s_patch:
|
---|
| 180 | if (!stricmp(name, "fonttexturecache"))
|
---|
| 181 | patch_fonttexturecache = !stricmp(value, "true");
|
---|
| 182 | else if (!stricmp(name, "largetextures"))
|
---|
| 183 | patch_largetextures = !stricmp(value, "true");
|
---|
[349] | 184 | else if (!stricmp(name, "levelplugins"))
|
---|
| 185 | patch_levelplugins = !stricmp(value, "true");
|
---|
[347] | 186 | else if (!stricmp(name, "pathfinding"))
|
---|
| 187 | patch_pathfinding = !stricmp(value, "true");
|
---|
| 188 | else if (!stricmp(name, "projaware"))
|
---|
| 189 | patch_projaware = !stricmp(value, "true");
|
---|
[348] | 190 | else if (!stricmp(name, "directinput"))
|
---|
| 191 | patch_directinput = !stricmp(value, "true");
|
---|
[347] | 192 | else if (!stricmp(name, "wpfadetime"))
|
---|
| 193 | patch_wpfadetime = !stricmp(value, "true");
|
---|
| 194 | else if (!stricmp(name, "kickguns"))
|
---|
| 195 | patch_kickguns = !stricmp(value, "true");
|
---|
| 196 | else if (!stricmp(name, "cooldowntimer"))
|
---|
| 197 | patch_cooldowntimer = !stricmp(value, "true");
|
---|
| 198 | else if (!stricmp(name, "throwtest"))
|
---|
| 199 | patch_throwtest = !stricmp(value, "true");
|
---|
| 200 | else if (!stricmp(name, "alttab"))
|
---|
| 201 | patch_alttab = !stricmp(value, "true");
|
---|
| 202 | else if (!stricmp(name, "particledisablebit"))
|
---|
| 203 | patch_particledisablebit = !stricmp(value, "true");
|
---|
| 204 | else if (!stricmp(name, "multibyte"))
|
---|
| 205 | patch_multibyte = !stricmp(value, "true");
|
---|
| 206 | else if (!stricmp(name, "cheattable"))
|
---|
| 207 | patch_cheattable = !stricmp(value, "true");
|
---|
| 208 | else if (!stricmp(name, "safeprintf"))
|
---|
| 209 | patch_safeprintf = !stricmp(value, "true");
|
---|
| 210 | else if (!stricmp(name, "daodandisplayenum"))
|
---|
| 211 | patch_daodandisplayenum = !stricmp(value, "true");
|
---|
| 212 | else if (!stricmp(name, "usegettickcount"))
|
---|
| 213 | patch_usegettickcount = !stricmp(value, "true");
|
---|
[348] | 214 | else if (!stricmp(name, "cheatsenabled"))
|
---|
| 215 | patch_cheatsenabled = !stricmp(value, "true");
|
---|
[347] | 216 | else if (!stricmp(name, "usedaodangl"))
|
---|
| 217 | patch_usedaodangl = !stricmp(value, "true");
|
---|
[349] | 218 | else if (!stricmp(name, "windowhack"))
|
---|
| 219 | patch_windowhack = !stricmp(value, "true");
|
---|
[347] | 220 | else
|
---|
| 221 | DDrStartupMessage("unrecognised patch \"%s\"", name);
|
---|
| 222 | break;
|
---|
[346] | 223 | case s_language:
|
---|
| 224 | if (!stricmp(name, "savepoint"))
|
---|
| 225 | {
|
---|
[347] | 226 | char* str = strdup(value);
|
---|
| 227 | DDrPatch_Int32(OniExe + 0x000fd730, (int)str);
|
---|
| 228 | DDrPatch_Int32(OniExe + 0x000fd738, (int)str);
|
---|
[346] | 229 | }
|
---|
| 230 | else if (!stricmp(name, "syndicatewarehouse"))
|
---|
| 231 | {
|
---|
[347] | 232 | char* str = strdup(value);
|
---|
| 233 | DDrPatch_Int32(OniExe + 0x000fd71a, (int)str);
|
---|
| 234 | DDrPatch_Int32(OniExe + 0x0010ef75, (int)str);
|
---|
[346] | 235 | }
|
---|
[347] | 236 | else if (!stricmp(name, "damn"))
|
---|
| 237 | DDrPatch_StrDup(OniExe + 0x0010fb6e, value);
|
---|
[346] | 238 | else if (!stricmp(name, "blam"))
|
---|
| 239 | DDrPatch_StrDup(OniExe + 0x0010fb73, value);
|
---|
[348] | 240 | else if (!stricmp(name, "shapeshifter_on"))
|
---|
| 241 | DDr_CheatTable[0].message_on = strdup(value);
|
---|
| 242 | else if (!stricmp(name, "shapeshifter_off"))
|
---|
| 243 | DDr_CheatTable[0].message_off = strdup(value);
|
---|
| 244 | else if (!stricmp(name, "liveforever_on"))
|
---|
| 245 | DDr_CheatTable[1].message_on = strdup(value);
|
---|
| 246 | else if (!stricmp(name, "liveforever_off"))
|
---|
| 247 | DDr_CheatTable[1].message_off = strdup(value);
|
---|
| 248 | else if (!stricmp(name, "touchofdeath_on"))
|
---|
| 249 | DDr_CheatTable[2].message_on = strdup(value);
|
---|
| 250 | else if (!stricmp(name, "touchofdeath_off"))
|
---|
| 251 | DDr_CheatTable[2].message_off = strdup(value);
|
---|
| 252 | else if (!stricmp(name, "canttouchthis_on"))
|
---|
| 253 | DDr_CheatTable[3].message_on = strdup(value);
|
---|
| 254 | else if (!stricmp(name, "canttouchthis_off"))
|
---|
| 255 | DDr_CheatTable[3].message_off = strdup(value);
|
---|
| 256 | else if (!stricmp(name, "fatloot_on"))
|
---|
[349] | 257 | DDr_CheatTable[4].message_on = strdup(value);
|
---|
| 258 | else if (!stricmp(name, "glassworld_on"))
|
---|
| 259 | DDr_CheatTable[5].message_on = strdup(value);
|
---|
| 260 | else if (!stricmp(name, "glassworld_off"))
|
---|
| 261 | DDr_CheatTable[5].message_off = strdup(value);
|
---|
| 262 | else if (!stricmp(name, "winlevel_on"))
|
---|
| 263 | DDr_CheatTable[6].message_on = strdup(value);
|
---|
| 264 | else if (!stricmp(name, "loselevel_on"))
|
---|
| 265 | DDr_CheatTable[7].message_on = strdup(value);
|
---|
| 266 | else if (!stricmp(name, "bighead_on"))
|
---|
| 267 | DDr_CheatTable[8].message_on = strdup(value);
|
---|
| 268 | else if (!stricmp(name, "bighead_off"))
|
---|
| 269 | DDr_CheatTable[8].message_off = strdup(value);
|
---|
| 270 | else if (!stricmp(name, "minime_on"))
|
---|
| 271 | DDr_CheatTable[9].message_on = strdup(value);
|
---|
| 272 | else if (!stricmp(name, "minime_off"))
|
---|
| 273 | DDr_CheatTable[9].message_off = strdup(value);
|
---|
| 274 | else if (!stricmp(name, "superammo_on"))
|
---|
| 275 | DDr_CheatTable[10].message_on = strdup(value);
|
---|
| 276 | else if (!stricmp(name, "superammo_off"))
|
---|
| 277 | DDr_CheatTable[10].message_off = strdup(value);
|
---|
| 278 | else if (!stricmp(name, "devmode_on"))
|
---|
| 279 | {
|
---|
| 280 | char* str = strdup(value);
|
---|
| 281 | DDr_CheatTable[11].message_on = str;
|
---|
| 282 | DDr_CheatTable[cheat_devmodex].message_on = str;
|
---|
| 283 | }
|
---|
| 284 | else if (!stricmp(name, "devmode_off"))
|
---|
| 285 | {
|
---|
| 286 | char* str = strdup(value);
|
---|
| 287 | DDr_CheatTable[11].message_off = str;
|
---|
| 288 | DDr_CheatTable[cheat_devmodex].message_off = str;
|
---|
| 289 | }
|
---|
| 290 | else if (!stricmp(name, "reservoirdogs_on"))
|
---|
| 291 | DDr_CheatTable[12].message_on = strdup(value);
|
---|
| 292 | else if (!stricmp(name, "reservoirdogs_off"))
|
---|
| 293 | DDr_CheatTable[12].message_off = strdup(value);
|
---|
| 294 | else if (!stricmp(name, "roughjustice_on"))
|
---|
| 295 | DDr_CheatTable[13].message_on = strdup(value);
|
---|
| 296 | else if (!stricmp(name, "roughjustice_off"))
|
---|
| 297 | DDr_CheatTable[13].message_off = strdup(value);
|
---|
| 298 | else if (!stricmp(name, "chenille_on"))
|
---|
| 299 | DDr_CheatTable[14].message_on = strdup(value);
|
---|
| 300 | else if (!stricmp(name, "chenille_off"))
|
---|
| 301 | DDr_CheatTable[14].message_off = strdup(value);
|
---|
| 302 | else if (!stricmp(name, "behemoth_on"))
|
---|
| 303 | DDr_CheatTable[15].message_on = strdup(value);
|
---|
| 304 | else if (!stricmp(name, "behemoth_off"))
|
---|
| 305 | DDr_CheatTable[15].message_off = strdup(value);
|
---|
| 306 | else if (!stricmp(name, "elderrune_on"))
|
---|
| 307 | DDr_CheatTable[16].message_on = strdup(value);
|
---|
| 308 | else if (!stricmp(name, "elderrune_off"))
|
---|
| 309 | DDr_CheatTable[16].message_off = strdup(value);
|
---|
| 310 | else if (!stricmp(name, "moonshadow_on"))
|
---|
| 311 | DDr_CheatTable[17].message_on = strdup(value);
|
---|
| 312 | else if (!stricmp(name, "moonshadow_off"))
|
---|
| 313 | DDr_CheatTable[17].message_off = strdup(value);
|
---|
| 314 | else if (!stricmp(name, "munitionfrenzy_on"))
|
---|
| 315 | DDr_CheatTable[18].message_on = strdup(value);
|
---|
| 316 | else if (!stricmp(name, "fistsoflegend_on"))
|
---|
| 317 | DDr_CheatTable[19].message_on = strdup(value);
|
---|
| 318 | else if (!stricmp(name, "fistsoflegend_off"))
|
---|
| 319 | DDr_CheatTable[19].message_off = strdup(value);
|
---|
| 320 | else if (!stricmp(name, "killmequick_on"))
|
---|
| 321 | DDr_CheatTable[20].message_on = strdup(value);
|
---|
| 322 | else if (!stricmp(name, "killmequick_off"))
|
---|
| 323 | DDr_CheatTable[20].message_off = strdup(value);
|
---|
| 324 | else if (!stricmp(name, "carousel_on"))
|
---|
| 325 | DDr_CheatTable[21].message_on = strdup(value);
|
---|
| 326 | else if (!stricmp(name, "carousel_off"))
|
---|
| 327 | DDr_CheatTable[21].message_off = strdup(value);
|
---|
[346] | 328 | else
|
---|
| 329 | DDrStartupMessage("unrecognised language item \"%s\"", name);
|
---|
| 330 | break;
|
---|
| 331 | default:
|
---|
| 332 | break;
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | return true;
|
---|
| 336 | }
|
---|
| 337 |
|
---|
| 338 | void DDrConfig()
|
---|
| 339 | {
|
---|
| 340 | if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES)
|
---|
| 341 | {
|
---|
| 342 | DDrStartupMessage("daodan.ini doesn't exist, creating");
|
---|
| 343 | FILE* fp = fopen("daodan.ini", "w");
|
---|
| 344 | if (fp)
|
---|
| 345 | {
|
---|
| 346 | fputs("[Options]\n", fp);
|
---|
| 347 | fclose(fp);
|
---|
| 348 | }
|
---|
| 349 | }
|
---|
| 350 |
|
---|
| 351 | DDrStartupMessage("parsing daodan.ini...");
|
---|
| 352 | if (!inifile_read("daodan.ini", DDrIniCallback))
|
---|
| 353 | DDrStartupMessage("error reading daodan.ini, check your syntax!");
|
---|
| 354 | DDrStartupMessage("finished parsing");
|
---|
| 355 | }
|
---|
| 356 |
|
---|
[274] | 357 | void __cdecl DDrMain(int argc, char* argv[])
|
---|
[273] | 358 | {
|
---|
[346] | 359 | DDrStartupMessage("daodan attached!");
|
---|
| 360 | DDrConfig();
|
---|
[273] | 361 | DDrPatch_Init();
|
---|
| 362 |
|
---|
| 363 | // Safe startup message printer
|
---|
[347] | 364 | if (patch_safeprintf)
|
---|
| 365 | DDrPatch_MakeJump(UUrStartupMessage, DDrStartupMessage);
|
---|
[273] | 366 |
|
---|
[297] | 367 | // Daodan device mode enumeration function
|
---|
[347] | 368 | if (patch_daodandisplayenum)
|
---|
| 369 | DDrPatch_MakeJump(gl_enumerate_valid_display_modes, daodan_enumerate_valid_display_modes);
|
---|
[297] | 370 |
|
---|
| 371 | // Performance patch
|
---|
[347] | 372 | if (patch_usegettickcount)
|
---|
| 373 | {
|
---|
| 374 | DDrPatch_MakeJump(UUrMachineTime_High, DDrMachineTime_High);
|
---|
| 375 | DDrPatch_MakeJump(UUrMachineTime_High_Frequency, DDrMachineTime_High_Frequency);
|
---|
| 376 | DDrPatch_MakeJump(UUrMachineTime_Sixtieths, DDrMachineTime_Sixtieths);
|
---|
| 377 | }
|
---|
[275] | 378 |
|
---|
[339] | 379 | // Cheats always enabled
|
---|
[348] | 380 | if (patch_cheatsenabled)
|
---|
| 381 | DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
|
---|
[339] | 382 |
|
---|
[323] | 383 | // Windowed mode
|
---|
[347] | 384 | if (patch_usedaodangl)
|
---|
| 385 | {
|
---|
| 386 | DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize);
|
---|
| 387 | DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
|
---|
| 388 | }
|
---|
[323] | 389 |
|
---|
[349] | 390 | // Hacked windowed mode (for when daodangl isn't working properly)
|
---|
| 391 | if (patch_windowhack)
|
---|
| 392 | DDrWindowHack_Install();
|
---|
| 393 |
|
---|
[340] | 394 | init_daodan_gl();
|
---|
[326] | 395 |
|
---|
[273] | 396 | ONiMain(argc, argv);
|
---|
| 397 | }
|
---|
| 398 |
|
---|
[272] | 399 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
---|
| 400 | {
|
---|
| 401 | switch (fdwReason)
|
---|
| 402 | {
|
---|
| 403 | case DLL_PROCESS_ATTACH:
|
---|
| 404 | DDrDLLModule = hinstDLL;
|
---|
| 405 | DDrONiModule = GetModuleHandle(NULL);
|
---|
| 406 |
|
---|
[274] | 407 | DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain);
|
---|
[273] | 408 |
|
---|
[272] | 409 | break;
|
---|
| 410 | }
|
---|
| 411 | return TRUE;
|
---|
| 412 | }
|
---|