| 39 |  | bool patch_cheattable = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 40 |  | bool patch_argb8888 = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 41 |  | bool patch_killvtune = true; | 
 
 
 
 
 
 
 
 | 42 | + | bool patch_getcmdline = true; | 
 
 
 
 
 
 
 
 | 43 | + | bool patch_disablecmdline = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 44 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 45 |  | bool patch_safeprintf = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 46 |  | bool patch_daodandisplayenum = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 175 |  | if (patch_killvtune) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 176 |  | DDrPatch_Byte  (OniExe + 0x00026340, 0xC3); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 177 |  |  | 
 
 
 
 
 
 
 
 | 178 | + | // Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own) | 
 
 
 
 
 
 
 
 | 179 | + | if (patch_getcmdline) | 
 
 
 
 
 
 
 
 | 180 | + | DDrPatch_NOOP  (OniExe + 0x000d3280, 51); | 
 
 
 
 
 
 
 
 | 181 | + |  | 
 
 
 
 
 
 
 
 | 182 | + | // Disable Oni's command line parser so it doesn't interfere with ours | 
 
 
 
 
 
 
 
 | 183 | + | if (patch_disablecmdline) | 
 
 
 
 
 
 
 
 | 184 | + | DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366); | 
 
 
 
 
 
 
 
 | 185 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 186 |  | return true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 187 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 188 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 203 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 204 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 205 |  | ini_section = s_unknown; | 
 
 
 
 
 
 
 
 
 
 
 | 206 | < | DDrStartupMessage("unrecognised ini section \"%s\"", section); | 
 
 
 
 
 
 
 
 
 | 206 | > | DDrStartupMessage("unrecognised section \"%s\"", section); | 
 
 
 
 
 
 
 
 
 
 
 | 207 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 208 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 209 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 212 |  | case s_options: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 213 |  | if (!stricmp(name, "usedaodanbsl")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 214 |  | opt_usedaodanbsl = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 215 | + | else if (!stricmp(name, "debug")) | 
 
 
 
 
 
 
 
 | 216 | + | AKgDebug_DebugMaps = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 217 | + | else if (!stricmp(name, "debugfiles")) | 
 
 
 
 
 
 
 
 | 218 | + | BFgDebugFileEnable = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 219 | + | else if (!stricmp(name, "findsounds")) | 
 
 
 
 
 
 
 
 | 220 | + | SSgSearchOnDisk = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 221 | + | else if (!stricmp(name, "ignore_private_data")) | 
 
 
 
 
 
 
 
 | 222 | + | opt_ignore_private_data = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 223 | + | else if (!stricmp(name, "sound")) | 
 
 
 
 
 
 
 
 | 224 | + | opt_sound = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 225 | + | else if (!stricmp(name, "switch")) | 
 
 
 
 
 
 
 
 | 226 | + | M3gResolutionSwitch = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 227 | + | else | 
 
 
 
 
 
 
 
 | 228 | + | DDrStartupMessage("unrecognised option \"%s\"", name); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 229 |  | break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 230 |  | case s_patch: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 231 |  | if (!stricmp(name, "fonttexturecache")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 260 |  | patch_argb8888 = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 261 |  | else if (!stricmp(name, "killvtune")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 262 |  | patch_killvtune = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 263 | + | else if (!stricmp(name, "getcmdline")) | 
 
 
 
 
 
 
 
 | 264 | + | patch_getcmdline = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 | 265 | + | else if (!stricmp(name, "disablecmdline")) | 
 
 
 
 
 
 
 
 | 266 | + | patch_disablecmdline = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 267 |  | else if (!stricmp(name, "safeprintf")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 268 |  | patch_safeprintf = !stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 269 |  | else if (!stricmp(name, "daodandisplayenum")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 429 |  | void __cdecl DDrMain(int argc, char* argv[]) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 430 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 431 |  | DDrStartupMessage("daodan attached!"); | 
 
 
 
 
 
 
 
 | 432 | + |  | 
 
 
 
 
 
 
 
 | 433 | + | opt_ignore_private_data = false; | 
 
 
 
 
 
 
 
 | 434 | + | opt_sound = true; | 
 
 
 
 
 
 
 
 | 435 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 436 |  | DDrConfig(); | 
 
 
 
 
 
 
 
 | 437 | + | DDrStartupMessage("parsing command line..."); | 
 
 
 
 
 
 
 
 | 438 | + | int i; | 
 
 
 
 
 
 
 
 | 439 | + | char* section; | 
 
 
 
 
 
 
 
 | 440 | + | char* option; | 
 
 
 
 
 
 
 
 | 441 | + | bool falseoption; | 
 
 
 
 
 
 
 
 | 442 | + | for (i = 1; i < argc; i ++) | 
 
 
 
 
 
 
 
 | 443 | + | { | 
 
 
 
 
 
 
 
 | 444 | + | if (argv[i][0] == '-') | 
 
 
 
 
 
 
 
 | 445 | + | { | 
 
 
 
 
 
 
 
 | 446 | + | section = argv[i] + 1; | 
 
 
 
 
 
 
 
 | 447 | + | if ((option = strchr(argv[i], '.'))) | 
 
 
 
 
 
 
 
 | 448 | + | { | 
 
 
 
 
 
 
 
 | 449 | + | *option = '\0'; | 
 
 
 
 
 
 
 
 | 450 | + | falseoption = (option[1] == 'n' || option[1] == 'N') && (option[2] = 'o' || option[2] == 'O'); | 
 
 
 
 
 
 
 
 | 451 | + | if (i < (argc - 1) && argv[i + 1][0] != '-') | 
 
 
 
 
 
 
 
 | 452 | + | DDrIniCallback(section, true, option + (falseoption ? 3 : 1), argv[++i]); | 
 
 
 
 
 
 
 
 | 453 | + | else | 
 
 
 
 
 
 
 
 | 454 | + | DDrIniCallback(section, true, option + (falseoption ? 3 : 1), (falseoption ? "false" : "true")); | 
 
 
 
 
 
 
 
 | 455 | + | *option = '.'; | 
 
 
 
 
 
 
 
 | 456 | + | } | 
 
 
 
 
 
 
 
 | 457 | + | else | 
 
 
 
 
 
 
 
 | 458 | + | { | 
 
 
 
 
 
 
 
 | 459 | + | falseoption = (section[0] == 'n' || section[0] == 'N') && (section[1] = 'o' || section[1] == 'O'); | 
 
 
 
 
 
 
 
 | 460 | + | ini_section = s_options; | 
 
 
 
 
 
 
 
 | 461 | + | if (i < (argc - 1) && argv[i + 1][0] != '-') | 
 
 
 
 
 
 
 
 | 462 | + | DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), argv[++i]); | 
 
 
 
 
 
 
 
 | 463 | + | else | 
 
 
 
 
 
 
 
 | 464 | + | DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), (falseoption ? "false" : "true")); | 
 
 
 
 
 
 
 
 | 465 | + | } | 
 
 
 
 
 
 
 
 | 466 | + | } | 
 
 
 
 
 
 
 
 | 467 | + | else | 
 
 
 
 
 
 
 
 | 468 | + | { | 
 
 
 
 
 
 
 
 | 469 | + | DDrStartupMessage("parse error \"%s\"", argv[i]); | 
 
 
 
 
 
 
 
 | 470 | + | break; | 
 
 
 
 
 
 
 
 | 471 | + | } | 
 
 
 
 
 
 
 
 | 472 | + | } | 
 
 
 
 
 
 
 
 | 473 | + | DDrStartupMessage("finished parsing"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 474 |  | DDrPatch_Init(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 475 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 476 |  | // Safe startup message printer |