| 6 |
|
#include "Daodan_Win32.h" |
| 7 |
|
#include "Daodan_Cheater.h" |
| 8 |
|
#include "Daodan_Persistence.h" |
| 9 |
+ |
#include "Daodan_BSL.h" |
| 10 |
+ |
#include "Daodan_Console.h" |
| 11 |
+ |
|
| 12 |
+ |
#include "Daodan_WindowHack.h" |
| 13 |
|
|
| 14 |
|
#include "Oni.h" |
| 15 |
|
#include "Oni_Persistence.h" |
| 26 |
|
|
| 27 |
|
bool patch_fonttexturecache = true; |
| 28 |
|
bool patch_largetextures = true; |
| 29 |
+ |
bool patch_levelplugins = true; |
| 30 |
|
bool patch_pathfinding = true; |
| 31 |
|
bool patch_projaware = true; |
| 32 |
+ |
bool patch_directinput = true; |
| 33 |
|
bool patch_wpfadetime = true; |
| 34 |
|
bool patch_kickguns = false; |
| 35 |
|
bool patch_cooldowntimer = true; |
| 36 |
|
bool patch_throwtest = false; |
| 37 |
|
bool patch_alttab = true; |
| 38 |
|
bool patch_particledisablebit = false; |
| 39 |
< |
bool patch_multibyte = true; |
| 39 |
> |
bool patch_multibyte = false; |
| 40 |
|
bool patch_cheattable = true; |
| 41 |
+ |
bool patch_argb8888 = true; |
| 42 |
+ |
bool patch_killvtune = true; |
| 43 |
+ |
bool patch_getcmdline = true; |
| 44 |
+ |
bool patch_disablecmdline = true; |
| 45 |
|
|
| 46 |
|
bool patch_safeprintf = true; |
| 47 |
|
bool patch_daodandisplayenum = true; |
| 48 |
|
bool patch_usegettickcount = true; |
| 49 |
< |
bool patch_usedaodangl = false; |
| 49 |
> |
bool patch_cheatsenabled = true; |
| 50 |
> |
bool patch_usedaodangl = true; |
| 51 |
> |
bool patch_windowhack = false; |
| 52 |
> |
bool patch_daodaninit = true; |
| 53 |
> |
bool patch_bsl = true; |
| 54 |
> |
bool patch_cheater = true; |
| 55 |
> |
|
| 56 |
> |
// bool patch_newweapon = true; |
| 57 |
> |
|
| 58 |
> |
bool opt_usedaodanbsl = true; |
| 59 |
> |
bool opt_border = true; |
| 60 |
> |
bool opt_shadow = false; |
| 61 |
> |
bool opt_topmost = false; |
| 62 |
|
|
| 63 |
|
bool DDrPatch_Init() |
| 64 |
|
{ |
| 76 |
|
DDrPatch_Byte (OniExe + 0x00005251, 0x10); |
| 77 |
|
|
| 78 |
|
// Non-"_Final" levels are now valid |
| 79 |
< |
DDrPatch_Byte (OniExe + 0x000206a8, 0x01); |
| 79 |
> |
if (patch_levelplugins) |
| 80 |
> |
DDrPatch_Byte (OniExe + 0x000206a8, 0x01); |
| 81 |
|
|
| 82 |
|
// Pathfinding grid cache size x8 |
| 83 |
|
if (patch_pathfinding) |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
// Forced DirectInput (for Windows NT) |
| 99 |
< |
DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); |
| 99 |
> |
if (patch_directinput) |
| 100 |
> |
DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); |
| 101 |
|
|
| 102 |
|
if (patch_wpfadetime) |
| 103 |
|
{ |
| 143 |
|
DDrPatch_Int16 (OniExe + 0x001b184, 0x9090); |
| 144 |
|
|
| 145 |
|
// Multi-byte patch (multiple language support) |
| 146 |
< |
if (patch_multibyte) |
| 146 |
> |
if (!patch_multibyte) |
| 147 |
|
{ |
| 148 |
|
DDrPatch_Byte (OniExe + 0x0002d8f8, 0xeb); |
| 149 |
|
DDrPatch_Byte (OniExe + 0x0002d9ad, 0xeb); |
| 170 |
|
DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
+ |
// ARGB8888 textures |
| 174 |
+ |
if (patch_argb8888) |
| 175 |
+ |
{ |
| 176 |
+ |
DDrPatch_Byte (OniExe + 0x00135af0, 0x07); |
| 177 |
+ |
DDrPatch_Byte (OniExe + 0x00135af4, 0x0B); |
| 178 |
+ |
} |
| 179 |
+ |
|
| 180 |
+ |
//Test newweap patch |
| 181 |
+ |
// if (patch_newweapon) { |
| 182 |
+ |
|
| 183 |
+ |
//Makes it always say "Recieved weapon_name." |
| 184 |
+ |
//Needs check for loc_4DFC66 |
| 185 |
+ |
DDrPatch_NOOP( OniExe + 0x000E4DF8,2); |
| 186 |
+ |
|
| 187 |
+ |
//Adds Weapon name and ammo meter to pickup autoprompt |
| 188 |
+ |
DDrPatch_NOOP( OniExe + 0x000FAC73, 9); |
| 189 |
+ |
DDrPatch_NOOP( OniExe + 0x000FAC80, 5); |
| 190 |
+ |
DDrPatch_MakeCall( OniExe + 0xFAC85, DDrWeapon2Message); |
| 191 |
+ |
|
| 192 |
+ |
//Moves location of colors |
| 193 |
+ |
DDrPatch_Int32( OniExe + 0x0002E3D5, (int)&DDrDSayColors[0].Char ); |
| 194 |
+ |
DDrPatch_Int32( OniExe + 0x0002E3DA, (int)&DDrDSayColors[0].Char ); |
| 195 |
+ |
// } |
| 196 |
+ |
|
| 197 |
+ |
// Disable loading the vtuneapi.dll |
| 198 |
+ |
if (patch_killvtune) |
| 199 |
+ |
DDrPatch_Byte (OniExe + 0x00026340, 0xC3); |
| 200 |
+ |
|
| 201 |
+ |
// Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own) |
| 202 |
+ |
if (patch_getcmdline) |
| 203 |
+ |
DDrPatch_NOOP (OniExe + 0x000d3280, 51); |
| 204 |
+ |
|
| 205 |
+ |
// Disable Oni's command line parser so it doesn't interfere with ours |
| 206 |
+ |
if (patch_disablecmdline) |
| 207 |
+ |
DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366); |
| 208 |
+ |
|
| 209 |
|
return true; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
< |
enum {s_unknown, s_patch, s_language} ini_section; |
| 212 |
> |
enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; |
| 213 |
|
|
| 214 |
|
bool DDrIniCallback(char* section, bool newsection, char* name, char* value) |
| 215 |
|
{ |
| 216 |
|
if (newsection) |
| 217 |
|
{ |
| 218 |
< |
if (!stricmp(section, "patch")) |
| 218 |
> |
if (!stricmp(section, "options")) |
| 219 |
> |
ini_section = s_options; |
| 220 |
> |
else if (!stricmp(section, "patch")) |
| 221 |
|
ini_section = s_patch; |
| 222 |
+ |
else if (!stricmp(section, "bsl")) |
| 223 |
+ |
ini_section = s_bsl; |
| 224 |
|
else if (!stricmp(section, "language")) |
| 225 |
|
ini_section = s_language; |
| 226 |
|
else |
| 227 |
|
{ |
| 228 |
|
ini_section = s_unknown; |
| 229 |
< |
DDrStartupMessage("unrecognised ini section \"%s\"", section); |
| 229 |
> |
DDrStartupMessage("unrecognised section \"%s\"", section); |
| 230 |
|
} |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
switch (ini_section) |
| 234 |
|
{ |
| 235 |
+ |
case s_options: |
| 236 |
+ |
if (!stricmp(name, "usedaodanbsl")) |
| 237 |
+ |
opt_usedaodanbsl = !stricmp(inifile_cleanstr(value), "true"); |
| 238 |
+ |
else if (!stricmp(name, "border")) |
| 239 |
+ |
opt_border = !stricmp(inifile_cleanstr(value), "true"); |
| 240 |
+ |
else if (!stricmp(name, "shadow")) |
| 241 |
+ |
opt_shadow = !stricmp(inifile_cleanstr(value), "true"); |
| 242 |
+ |
else if (!stricmp(name, "topmost")) |
| 243 |
+ |
opt_topmost = !stricmp(inifile_cleanstr(value), "true"); |
| 244 |
+ |
else if (!stricmp(name, "multibyte")) |
| 245 |
+ |
patch_multibyte = !stricmp(inifile_cleanstr(value), "true"); |
| 246 |
+ |
else if (!stricmp(name, "debug")) |
| 247 |
+ |
AKgDebug_DebugMaps = !stricmp(inifile_cleanstr(value), "true"); |
| 248 |
+ |
else if (!stricmp(name, "debugfiles")) |
| 249 |
+ |
BFgDebugFileEnable = !stricmp(inifile_cleanstr(value), "true"); |
| 250 |
+ |
else if (!stricmp(name, "findsounds")) |
| 251 |
+ |
SSgSearchOnDisk = !stricmp(inifile_cleanstr(value), "true"); |
| 252 |
+ |
else if (!stricmp(name, "ignore_private_data")) |
| 253 |
+ |
opt_ignore_private_data = !stricmp(inifile_cleanstr(value), "true"); |
| 254 |
+ |
else if (!stricmp(name, "sound")) |
| 255 |
+ |
opt_sound = !stricmp(inifile_cleanstr(value), "true"); |
| 256 |
+ |
else if (!stricmp(name, "switch")) |
| 257 |
+ |
M3gResolutionSwitch = !stricmp(inifile_cleanstr(value), "true"); |
| 258 |
+ |
else |
| 259 |
+ |
DDrStartupMessage("unrecognised option \"%s\"", name); |
| 260 |
+ |
break; |
| 261 |
|
case s_patch: |
| 262 |
|
if (!stricmp(name, "fonttexturecache")) |
| 263 |
< |
patch_fonttexturecache = !stricmp(value, "true"); |
| 263 |
> |
patch_fonttexturecache = !stricmp(inifile_cleanstr(value), "true"); |
| 264 |
|
else if (!stricmp(name, "largetextures")) |
| 265 |
< |
patch_largetextures = !stricmp(value, "true"); |
| 265 |
> |
patch_largetextures = !stricmp(inifile_cleanstr(value), "true"); |
| 266 |
> |
else if (!stricmp(name, "levelplugins")) |
| 267 |
> |
patch_levelplugins = !stricmp(inifile_cleanstr(value), "true"); |
| 268 |
|
else if (!stricmp(name, "pathfinding")) |
| 269 |
< |
patch_pathfinding = !stricmp(value, "true"); |
| 269 |
> |
patch_pathfinding = !stricmp(inifile_cleanstr(value), "true"); |
| 270 |
|
else if (!stricmp(name, "projaware")) |
| 271 |
< |
patch_projaware = !stricmp(value, "true"); |
| 271 |
> |
patch_projaware = !stricmp(inifile_cleanstr(value), "true"); |
| 272 |
> |
else if (!stricmp(name, "directinput")) |
| 273 |
> |
patch_directinput = !stricmp(inifile_cleanstr(value), "true"); |
| 274 |
|
else if (!stricmp(name, "wpfadetime")) |
| 275 |
< |
patch_wpfadetime = !stricmp(value, "true"); |
| 275 |
> |
patch_wpfadetime = !stricmp(inifile_cleanstr(value), "true"); |
| 276 |
|
else if (!stricmp(name, "kickguns")) |
| 277 |
< |
patch_kickguns = !stricmp(value, "true"); |
| 277 |
> |
patch_kickguns = !stricmp(inifile_cleanstr(value), "true"); |
| 278 |
|
else if (!stricmp(name, "cooldowntimer")) |
| 279 |
< |
patch_cooldowntimer = !stricmp(value, "true"); |
| 279 |
> |
patch_cooldowntimer = !stricmp(inifile_cleanstr(value), "true"); |
| 280 |
|
else if (!stricmp(name, "throwtest")) |
| 281 |
< |
patch_throwtest = !stricmp(value, "true"); |
| 281 |
> |
patch_throwtest = !stricmp(inifile_cleanstr(value), "true"); |
| 282 |
|
else if (!stricmp(name, "alttab")) |
| 283 |
< |
patch_alttab = !stricmp(value, "true"); |
| 283 |
> |
patch_alttab = !stricmp(inifile_cleanstr(value), "true"); |
| 284 |
|
else if (!stricmp(name, "particledisablebit")) |
| 285 |
< |
patch_particledisablebit = !stricmp(value, "true"); |
| 285 |
> |
patch_particledisablebit = !stricmp(inifile_cleanstr(value), "true"); |
| 286 |
|
else if (!stricmp(name, "multibyte")) |
| 287 |
< |
patch_multibyte = !stricmp(value, "true"); |
| 287 |
> |
patch_multibyte = !stricmp(inifile_cleanstr(value), "true"); |
| 288 |
|
else if (!stricmp(name, "cheattable")) |
| 289 |
< |
patch_cheattable = !stricmp(value, "true"); |
| 289 |
> |
patch_cheattable = !stricmp(inifile_cleanstr(value), "true"); |
| 290 |
> |
else if (!stricmp(name, "argb8888")) |
| 291 |
> |
patch_argb8888 = !stricmp(inifile_cleanstr(value), "true"); |
| 292 |
> |
else if (!stricmp(name, "killvtune")) |
| 293 |
> |
patch_killvtune = !stricmp(inifile_cleanstr(value), "true"); |
| 294 |
> |
else if (!stricmp(name, "getcmdline")) |
| 295 |
> |
patch_getcmdline = !stricmp(inifile_cleanstr(value), "true"); |
| 296 |
> |
else if (!stricmp(name, "disablecmdline")) |
| 297 |
> |
patch_disablecmdline = !stricmp(inifile_cleanstr(value), "true"); |
| 298 |
|
else if (!stricmp(name, "safeprintf")) |
| 299 |
< |
patch_safeprintf = !stricmp(value, "true"); |
| 299 |
> |
patch_safeprintf = !stricmp(inifile_cleanstr(value), "true"); |
| 300 |
|
else if (!stricmp(name, "daodandisplayenum")) |
| 301 |
< |
patch_daodandisplayenum = !stricmp(value, "true"); |
| 301 |
> |
patch_daodandisplayenum = !stricmp(inifile_cleanstr(value), "true"); |
| 302 |
|
else if (!stricmp(name, "usegettickcount")) |
| 303 |
< |
patch_usegettickcount = !stricmp(value, "true"); |
| 303 |
> |
patch_usegettickcount = !stricmp(inifile_cleanstr(value), "true"); |
| 304 |
> |
else if (!stricmp(name, "cheatsenabled")) |
| 305 |
> |
patch_cheatsenabled = !stricmp(inifile_cleanstr(value), "true"); |
| 306 |
|
else if (!stricmp(name, "usedaodangl")) |
| 307 |
< |
patch_usedaodangl = !stricmp(value, "true"); |
| 307 |
> |
patch_usedaodangl = !stricmp(inifile_cleanstr(value), "true"); |
| 308 |
> |
else if (!stricmp(name, "windowhack")) |
| 309 |
> |
patch_windowhack = !stricmp(inifile_cleanstr(value), "true"); |
| 310 |
> |
else if (!stricmp(name, "daodaninit")) |
| 311 |
> |
patch_daodaninit = !stricmp(inifile_cleanstr(value), "true"); |
| 312 |
> |
else if (!stricmp(name, "bsl")) |
| 313 |
> |
patch_bsl = !stricmp(inifile_cleanstr(value), "true"); |
| 314 |
> |
else if (!stricmp(name, "cheater")) |
| 315 |
> |
patch_cheater = !stricmp(inifile_cleanstr(value), "true"); |
| 316 |
|
else |
| 317 |
|
DDrStartupMessage("unrecognised patch \"%s\"", name); |
| 318 |
|
break; |
| 333 |
|
DDrPatch_StrDup(OniExe + 0x0010fb6e, value); |
| 334 |
|
else if (!stricmp(name, "blam")) |
| 335 |
|
DDrPatch_StrDup(OniExe + 0x0010fb73, value); |
| 336 |
+ |
else if (!stricmp(name, "shapeshifter_on")) |
| 337 |
+ |
DDr_CheatTable[0].message_on = strdup(value); |
| 338 |
+ |
else if (!stricmp(name, "shapeshifter_off")) |
| 339 |
+ |
DDr_CheatTable[0].message_off = strdup(value); |
| 340 |
+ |
else if (!stricmp(name, "liveforever_on")) |
| 341 |
+ |
DDr_CheatTable[1].message_on = strdup(value); |
| 342 |
+ |
else if (!stricmp(name, "liveforever_off")) |
| 343 |
+ |
DDr_CheatTable[1].message_off = strdup(value); |
| 344 |
+ |
else if (!stricmp(name, "touchofdeath_on")) |
| 345 |
+ |
DDr_CheatTable[2].message_on = strdup(value); |
| 346 |
+ |
else if (!stricmp(name, "touchofdeath_off")) |
| 347 |
+ |
DDr_CheatTable[2].message_off = strdup(value); |
| 348 |
+ |
else if (!stricmp(name, "canttouchthis_on")) |
| 349 |
+ |
DDr_CheatTable[3].message_on = strdup(value); |
| 350 |
+ |
else if (!stricmp(name, "canttouchthis_off")) |
| 351 |
+ |
DDr_CheatTable[3].message_off = strdup(value); |
| 352 |
+ |
else if (!stricmp(name, "fatloot_on")) |
| 353 |
+ |
DDr_CheatTable[4].message_on = strdup(value); |
| 354 |
+ |
else if (!stricmp(name, "glassworld_on")) |
| 355 |
+ |
DDr_CheatTable[5].message_on = strdup(value); |
| 356 |
+ |
else if (!stricmp(name, "glassworld_off")) |
| 357 |
+ |
DDr_CheatTable[5].message_off = strdup(value); |
| 358 |
+ |
else if (!stricmp(name, "winlevel_on")) |
| 359 |
+ |
DDr_CheatTable[6].message_on = strdup(value); |
| 360 |
+ |
else if (!stricmp(name, "loselevel_on")) |
| 361 |
+ |
DDr_CheatTable[7].message_on = strdup(value); |
| 362 |
+ |
else if (!stricmp(name, "bighead_on")) |
| 363 |
+ |
DDr_CheatTable[8].message_on = strdup(value); |
| 364 |
+ |
else if (!stricmp(name, "bighead_off")) |
| 365 |
+ |
DDr_CheatTable[8].message_off = strdup(value); |
| 366 |
+ |
else if (!stricmp(name, "minime_on")) |
| 367 |
+ |
DDr_CheatTable[9].message_on = strdup(value); |
| 368 |
+ |
else if (!stricmp(name, "minime_off")) |
| 369 |
+ |
DDr_CheatTable[9].message_off = strdup(value); |
| 370 |
+ |
else if (!stricmp(name, "superammo_on")) |
| 371 |
+ |
DDr_CheatTable[10].message_on = strdup(value); |
| 372 |
+ |
else if (!stricmp(name, "superammo_off")) |
| 373 |
+ |
DDr_CheatTable[10].message_off = strdup(value); |
| 374 |
+ |
else if (!stricmp(name, "devmode_on")) |
| 375 |
+ |
{ |
| 376 |
+ |
char* str = strdup(value); |
| 377 |
+ |
DDr_CheatTable[11].message_on = str; |
| 378 |
+ |
DDr_CheatTable[cheat_x].message_on = str; |
| 379 |
+ |
} |
| 380 |
+ |
else if (!stricmp(name, "devmode_off")) |
| 381 |
+ |
{ |
| 382 |
+ |
char* str = strdup(value); |
| 383 |
+ |
DDr_CheatTable[11].message_off = str; |
| 384 |
+ |
DDr_CheatTable[cheat_x].message_off = str; |
| 385 |
+ |
} |
| 386 |
+ |
else if (!stricmp(name, "reservoirdogs_on")) |
| 387 |
+ |
DDr_CheatTable[12].message_on = strdup(value); |
| 388 |
+ |
else if (!stricmp(name, "reservoirdogs_off")) |
| 389 |
+ |
DDr_CheatTable[12].message_off = strdup(value); |
| 390 |
+ |
else if (!stricmp(name, "roughjustice_on")) |
| 391 |
+ |
DDr_CheatTable[13].message_on = strdup(value); |
| 392 |
+ |
else if (!stricmp(name, "roughjustice_off")) |
| 393 |
+ |
DDr_CheatTable[13].message_off = strdup(value); |
| 394 |
+ |
else if (!stricmp(name, "chenille_on")) |
| 395 |
+ |
DDr_CheatTable[14].message_on = strdup(value); |
| 396 |
+ |
else if (!stricmp(name, "chenille_off")) |
| 397 |
+ |
DDr_CheatTable[14].message_off = strdup(value); |
| 398 |
+ |
else if (!stricmp(name, "behemoth_on")) |
| 399 |
+ |
DDr_CheatTable[15].message_on = strdup(value); |
| 400 |
+ |
else if (!stricmp(name, "behemoth_off")) |
| 401 |
+ |
DDr_CheatTable[15].message_off = strdup(value); |
| 402 |
+ |
else if (!stricmp(name, "elderrune_on")) |
| 403 |
+ |
DDr_CheatTable[16].message_on = strdup(value); |
| 404 |
+ |
else if (!stricmp(name, "elderrune_off")) |
| 405 |
+ |
DDr_CheatTable[16].message_off = strdup(value); |
| 406 |
+ |
else if (!stricmp(name, "moonshadow_on")) |
| 407 |
+ |
DDr_CheatTable[17].message_on = strdup(value); |
| 408 |
+ |
else if (!stricmp(name, "moonshadow_off")) |
| 409 |
+ |
DDr_CheatTable[17].message_off = strdup(value); |
| 410 |
+ |
else if (!stricmp(name, "munitionfrenzy_on")) |
| 411 |
+ |
DDr_CheatTable[18].message_on = strdup(value); |
| 412 |
+ |
else if (!stricmp(name, "fistsoflegend_on")) |
| 413 |
+ |
DDr_CheatTable[19].message_on = strdup(value); |
| 414 |
+ |
else if (!stricmp(name, "fistsoflegend_off")) |
| 415 |
+ |
DDr_CheatTable[19].message_off = strdup(value); |
| 416 |
+ |
else if (!stricmp(name, "killmequick_on")) |
| 417 |
+ |
DDr_CheatTable[20].message_on = strdup(value); |
| 418 |
+ |
else if (!stricmp(name, "killmequick_off")) |
| 419 |
+ |
DDr_CheatTable[20].message_off = strdup(value); |
| 420 |
+ |
else if (!stricmp(name, "carousel_on")) |
| 421 |
+ |
DDr_CheatTable[21].message_on = strdup(value); |
| 422 |
+ |
else if (!stricmp(name, "carousel_off")) |
| 423 |
+ |
DDr_CheatTable[21].message_off = strdup(value); |
| 424 |
|
else |
| 425 |
|
DDrStartupMessage("unrecognised language item \"%s\"", name); |
| 426 |
|
break; |
| 427 |
+ |
case s_bsl: |
| 428 |
|
default: |
| 429 |
|
break; |
| 430 |
|
} |
| 451 |
|
DDrStartupMessage("finished parsing"); |
| 452 |
|
} |
| 453 |
|
|
| 454 |
+ |
void ONICALL DDrGame_Init() |
| 455 |
+ |
{ |
| 456 |
+ |
if (opt_usedaodanbsl) |
| 457 |
+ |
SLrDaodan_Initalize(); |
| 458 |
+ |
} |
| 459 |
+ |
|
| 460 |
|
void __cdecl DDrMain(int argc, char* argv[]) |
| 461 |
|
{ |
| 462 |
|
DDrStartupMessage("daodan attached!"); |
| 463 |
+ |
|
| 464 |
+ |
opt_ignore_private_data = false; |
| 465 |
+ |
opt_sound = true; |
| 466 |
+ |
|
| 467 |
|
DDrConfig(); |
| 468 |
+ |
DDrStartupMessage("parsing command line..."); |
| 469 |
+ |
int i; |
| 470 |
+ |
char* section; |
| 471 |
+ |
char* option; |
| 472 |
+ |
bool falseoption; |
| 473 |
+ |
for (i = 1; i < argc; i ++) |
| 474 |
+ |
{ |
| 475 |
+ |
if (argv[i][0] == '-') |
| 476 |
+ |
{ |
| 477 |
+ |
section = argv[i] + 1; |
| 478 |
+ |
if ((option = strchr(argv[i], '.'))) |
| 479 |
+ |
{ |
| 480 |
+ |
*option = '\0'; |
| 481 |
+ |
falseoption = (option[1] == 'n' || option[1] == 'N') && (option[2] = 'o' || option[2] == 'O'); |
| 482 |
+ |
if (i < (argc - 1) && argv[i + 1][0] != '-') |
| 483 |
+ |
DDrIniCallback(section, true, option + 1, argv[++i]); |
| 484 |
+ |
else |
| 485 |
+ |
DDrIniCallback(section, true, option + (falseoption ? 3 : 1), (falseoption ? "false" : "true")); |
| 486 |
+ |
*option = '.'; |
| 487 |
+ |
} |
| 488 |
+ |
else |
| 489 |
+ |
{ |
| 490 |
+ |
falseoption = (section[0] == 'n' || section[0] == 'N') && (section[1] = 'o' || section[1] == 'O'); |
| 491 |
+ |
ini_section = s_options; |
| 492 |
+ |
if (i < (argc - 1) && argv[i + 1][0] != '-') |
| 493 |
+ |
DDrIniCallback(NULL, false, section, argv[++i]); |
| 494 |
+ |
else |
| 495 |
+ |
DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), (falseoption ? "false" : "true")); |
| 496 |
+ |
} |
| 497 |
+ |
} |
| 498 |
+ |
else |
| 499 |
+ |
{ |
| 500 |
+ |
DDrStartupMessage("parse error \"%s\"", argv[i]); |
| 501 |
+ |
break; |
| 502 |
+ |
} |
| 503 |
+ |
} |
| 504 |
+ |
DDrStartupMessage("finished parsing"); |
| 505 |
|
DDrPatch_Init(); |
| 506 |
|
|
| 507 |
|
// Safe startup message printer |
| 521 |
|
} |
| 522 |
|
|
| 523 |
|
// Cheats always enabled |
| 524 |
< |
DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); |
| 524 |
> |
if (patch_cheatsenabled) |
| 525 |
> |
DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); |
| 526 |
|
|
| 527 |
|
// Windowed mode |
| 528 |
|
if (patch_usedaodangl) |
| 531 |
|
DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); |
| 532 |
|
} |
| 533 |
|
|
| 534 |
+ |
// Hacked windowed mode (for when daodangl isn't working properly) |
| 535 |
+ |
if (patch_windowhack) |
| 536 |
+ |
DDrWindowHack_Install(); |
| 537 |
+ |
|
| 538 |
+ |
if (patch_daodaninit) |
| 539 |
+ |
DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init); |
| 540 |
+ |
|
| 541 |
+ |
// Patches for existing BSL functions |
| 542 |
+ |
if (patch_bsl) |
| 543 |
+ |
SLrDaodan_Patch(); |
| 544 |
+ |
|
| 545 |
+ |
if (patch_cheater) |
| 546 |
+ |
{ |
| 547 |
+ |
DDrPatch_MakeCall(OniExe + 0x000f618f, DDrCheater); |
| 548 |
+ |
DDrPatch_Int16(OniExe + 0x000deb45, 0x5590); |
| 549 |
+ |
DDrPatch_MakeCall(OniExe + 0x000deb47, FallingFrames); |
| 550 |
+ |
DDrPatch_MakeJump(OniExe + 0x0010f021, DDrCheater_LevelLoad); |
| 551 |
+ |
} |
| 552 |
+ |
|
| 553 |
|
init_daodan_gl(); |
| 554 |
|
|
| 555 |
|
ONiMain(argc, argv); |
| 556 |
|
} |
| 557 |
< |
|
| 557 |
> |
/* |
| 558 |
> |
void DDrWrongExe() |
| 559 |
> |
{ |
| 560 |
> |
switch (MessageBox(NULL, "This version of the Daodan DLL is incompatible with your Oni.exe.\n" |
| 561 |
> |
"Click OK for more information. To continue using Oni without the patch, replace the downloaded binkw32.dll with the original.", "Daodan", MB_OKCANCEL | MB_ICONERROR)) |
| 562 |
> |
{ |
| 563 |
> |
case IDOK: |
| 564 |
> |
{ |
| 565 |
> |
STARTUPINFO si; |
| 566 |
> |
PROCESS_INFORMATION pi; |
| 567 |
> |
FillMemory(&si, 0, sizeof(si)); |
| 568 |
> |
FillMemory(&pi, 0, sizeof(pi)); |
| 569 |
> |
si.cb = sizeof(si); |
| 570 |
> |
if (!CreateProcess(NULL, "cmd /c \"start http://wiki.oni2.net/Daodan_DLL\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) |
| 571 |
> |
MessageBox(NULL, "", "", 0); |
| 572 |
> |
CloseHandle(pi.hProcess); |
| 573 |
> |
CloseHandle(pi.hThread); |
| 574 |
> |
} |
| 575 |
> |
default: |
| 576 |
> |
ExitProcess(0); |
| 577 |
> |
} |
| 578 |
> |
} |
| 579 |
> |
*/ |
| 580 |
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) |
| 581 |
|
{ |
| 582 |
|
switch (fdwReason) |
| 585 |
|
DDrDLLModule = hinstDLL; |
| 586 |
|
DDrONiModule = GetModuleHandle(NULL); |
| 587 |
|
|
| 588 |
< |
DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain); |
| 589 |
< |
|
| 588 |
> |
if (*(uint32_t*)((void*)OniExe + 0x0011acd0) == 0x09d36852) |
| 589 |
> |
DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain); |
| 590 |
> |
else |
| 591 |
> |
ExitProcess(0); |
| 592 |
|
break; |
| 593 |
|
} |
| 594 |
|
return TRUE; |