| 7 |
|
#include "Daodan_Cheater.h" |
| 8 |
|
#include "Daodan_Persistence.h" |
| 9 |
|
|
| 10 |
+ |
#include "Daodan_WindowHack.h" |
| 11 |
+ |
|
| 12 |
|
#include "Oni.h" |
| 13 |
|
#include "Oni_Persistence.h" |
| 14 |
|
|
| 24 |
|
|
| 25 |
|
bool patch_fonttexturecache = true; |
| 26 |
|
bool patch_largetextures = true; |
| 27 |
+ |
bool patch_levelplugins = true; |
| 28 |
|
bool patch_pathfinding = true; |
| 29 |
|
bool patch_projaware = true; |
| 30 |
+ |
bool patch_directinput = true; |
| 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; |
| 37 |
> |
bool patch_multibyte = false; |
| 38 |
|
bool patch_cheattable = true; |
| 39 |
|
|
| 40 |
|
bool patch_safeprintf = true; |
| 41 |
|
bool patch_daodandisplayenum = true; |
| 42 |
|
bool patch_usegettickcount = true; |
| 43 |
+ |
bool patch_cheatsenabled = true; |
| 44 |
|
bool patch_usedaodangl = false; |
| 45 |
+ |
bool patch_windowhack = true; |
| 46 |
|
|
| 47 |
|
bool DDrPatch_Init() |
| 48 |
|
{ |
| 60 |
|
DDrPatch_Byte (OniExe + 0x00005251, 0x10); |
| 61 |
|
|
| 62 |
|
// Non-"_Final" levels are now valid |
| 63 |
< |
DDrPatch_Byte (OniExe + 0x000206a8, 0x01); |
| 63 |
> |
if (patch_levelplugins) |
| 64 |
> |
DDrPatch_Byte (OniExe + 0x000206a8, 0x01); |
| 65 |
|
|
| 66 |
|
// Pathfinding grid cache size x8 |
| 67 |
|
if (patch_pathfinding) |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
// Forced DirectInput (for Windows NT) |
| 83 |
< |
DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); |
| 83 |
> |
if (patch_directinput) |
| 84 |
> |
DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); |
| 85 |
|
|
| 86 |
|
if (patch_wpfadetime) |
| 87 |
|
{ |
| 127 |
|
DDrPatch_Int16 (OniExe + 0x001b184, 0x9090); |
| 128 |
|
|
| 129 |
|
// Multi-byte patch (multiple language support) |
| 130 |
< |
if (patch_multibyte) |
| 130 |
> |
if (!patch_multibyte) |
| 131 |
|
{ |
| 132 |
|
DDrPatch_Byte (OniExe + 0x0002d8f8, 0xeb); |
| 133 |
|
DDrPatch_Byte (OniExe + 0x0002d9ad, 0xeb); |
| 181 |
|
patch_fonttexturecache = !stricmp(value, "true"); |
| 182 |
|
else if (!stricmp(name, "largetextures")) |
| 183 |
|
patch_largetextures = !stricmp(value, "true"); |
| 184 |
+ |
else if (!stricmp(name, "levelplugins")) |
| 185 |
+ |
patch_levelplugins = !stricmp(value, "true"); |
| 186 |
|
else if (!stricmp(name, "pathfinding")) |
| 187 |
|
patch_pathfinding = !stricmp(value, "true"); |
| 188 |
|
else if (!stricmp(name, "projaware")) |
| 189 |
|
patch_projaware = !stricmp(value, "true"); |
| 190 |
+ |
else if (!stricmp(name, "directinput")) |
| 191 |
+ |
patch_directinput = !stricmp(value, "true"); |
| 192 |
|
else if (!stricmp(name, "wpfadetime")) |
| 193 |
|
patch_wpfadetime = !stricmp(value, "true"); |
| 194 |
|
else if (!stricmp(name, "kickguns")) |
| 211 |
|
patch_daodandisplayenum = !stricmp(value, "true"); |
| 212 |
|
else if (!stricmp(name, "usegettickcount")) |
| 213 |
|
patch_usegettickcount = !stricmp(value, "true"); |
| 214 |
+ |
else if (!stricmp(name, "cheatsenabled")) |
| 215 |
+ |
patch_cheatsenabled = !stricmp(value, "true"); |
| 216 |
|
else if (!stricmp(name, "usedaodangl")) |
| 217 |
|
patch_usedaodangl = !stricmp(value, "true"); |
| 218 |
+ |
else if (!stricmp(name, "windowhack")) |
| 219 |
+ |
patch_windowhack = !stricmp(value, "true"); |
| 220 |
|
else |
| 221 |
|
DDrStartupMessage("unrecognised patch \"%s\"", name); |
| 222 |
|
break; |
| 237 |
|
DDrPatch_StrDup(OniExe + 0x0010fb6e, value); |
| 238 |
|
else if (!stricmp(name, "blam")) |
| 239 |
|
DDrPatch_StrDup(OniExe + 0x0010fb73, value); |
| 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")) |
| 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); |
| 328 |
|
else |
| 329 |
|
DDrStartupMessage("unrecognised language item \"%s\"", name); |
| 330 |
|
break; |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
// Cheats always enabled |
| 380 |
< |
DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); |
| 380 |
> |
if (patch_cheatsenabled) |
| 381 |
> |
DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); |
| 382 |
|
|
| 383 |
|
// Windowed mode |
| 384 |
|
if (patch_usedaodangl) |
| 387 |
|
DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); |
| 388 |
|
} |
| 389 |
|
|
| 390 |
+ |
// Hacked windowed mode (for when daodangl isn't working properly) |
| 391 |
+ |
if (patch_windowhack) |
| 392 |
+ |
DDrWindowHack_Install(); |
| 393 |
+ |
|
| 394 |
|
init_daodan_gl(); |
| 395 |
|
|
| 396 |
|
ONiMain(argc, argv); |