| 86 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 |  | bool DDrPatch_Init() | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 88 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 89 | < | DDrStartupMessage("patching engine"); | 
 
 
 
 
 
 
 
 
 | 89 | > | DDrStartupMessage("Daodan: Patching engine"); | 
 
 
 
 
 
 
 
 
 
 
 | 90 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 91 |  | // Font texture cache doubled | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 92 |  | if (patch_fonttexturecache) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 262 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 263 |  | if(patch_chinese) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 264 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 265 | < | HMODULE dll; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 266 | < | DWORD err; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 267 | < |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 268 | < | DDrStartupMessage("Loading chinese DLL"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 269 | < | dll = LoadLibrary("xfhsm_oni.dll"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 270 | < | err = GetLastError(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 271 | < | if( dll ) | 
 
 
 
 
 
 
 
 
 | 265 | > | if (GetFileAttributes("xfhsm_oni.dll") != INVALID_FILE_ATTRIBUTES) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 266 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 267 | < | void* proc = GetProcAddress( dll, "InstallHook" ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 268 | < | if(proc) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 267 | > | HMODULE dll; | 
 
 
 
 
 | 268 | > | DWORD err; | 
 
 
 
 
 | 269 | > |  | 
 
 
 
 
 | 270 | > | DDrStartupMessage("Daodan: Loading chinese DLL"); | 
 
 
 
 
 | 271 | > | dll = LoadLibrary("xfhsm_oni.dll"); | 
 
 
 
 
 | 272 | > | err = GetLastError(); | 
 
 
 
 
 | 273 | > | if( dll ) | 
 
 
 
 
 
 
 
 
 
 
 | 274 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 275 | < | ((CHINESEPROC)proc)(GetCurrentThreadId()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 275 | > | void* proc = GetProcAddress( dll, "InstallHook" ); | 
 
 
 
 
 | 276 | > | if(proc) | 
 
 
 
 
 | 277 | > | { | 
 
 
 
 
 | 278 | > | ((CHINESEPROC)proc)(GetCurrentThreadId()); | 
 
 
 
 
 | 279 | > | } | 
 
 
 
 
 | 280 | > | } else { | 
 
 
 
 
 | 281 | > | char msg[100]; | 
 
 
 
 
 | 282 | > | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL); | 
 
 
 
 
 | 283 | > | DDrStartupMessage("Daodan: Loading DLL failed with error %i: %s", err, msg); | 
 
 
 
 
 
 
 
 
 
 
 | 284 |  | } | 
 
 
 
 
 
 
 
 
 | 278 | – | } else { | 
 
 
 
 
 
 
 
 
 | 279 | – | char msg[100]; | 
 
 
 
 
 
 
 
 
 | 280 | – | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL); | 
 
 
 
 
 
 
 
 
 | 281 | – | DDrStartupMessage(" - Module loading failed with error %i: %s", err, msg); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 285 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 286 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 287 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 366 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 367 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 368 |  | ini_section = s_unknown; | 
 
 
 
 
 
 
 
 
 
 
 | 369 | < | DDrStartupMessage("unrecognised section \"%s\"", section); | 
 
 
 
 
 
 
 
 
 | 369 | > | DDrStartupMessage("Daodan: Unrecognised ini section \"%s\"", section); | 
 
 
 
 
 
 
 
 
 
 
 | 370 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 371 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 372 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 396 |  | else if (!_stricmp(name, "gamma")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 397 |  | opt_gamma = !_stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 |  | else | 
 
 
 
 
 
 
 
 
 
 
 | 399 | < | DDrStartupMessage("unrecognised option \"%s\"", name); | 
 
 
 
 
 
 
 
 
 | 399 | > | DDrStartupMessage("Daodan: Unrecognised ini option \"%s\"", name); | 
 
 
 
 
 
 
 
 
 
 
 | 400 |  | break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 401 |  | case s_patch: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 402 |  | if (!_stricmp(name, "fonttexturecache")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 460 |  | else if (!_stricmp(name, "binkplay")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 461 |  | patch_binkplay = !_stricmp(inifile_cleanstr(value), "true"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 462 |  | else | 
 
 
 
 
 
 
 
 
 
 
 | 463 | < | DDrStartupMessage("unrecognised patch \"%s\"", name); | 
 
 
 
 
 
 
 
 
 | 463 | > | DDrStartupMessage("Daodan: Unrecognised ini patch \"%s\"", name); | 
 
 
 
 
 
 
 
 
 
 
 | 464 |  | break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 465 |  | case s_language: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 466 |  | if (!_stricmp(name, "chinese")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 570 |  | else if (!_stricmp(name, "carousel_off")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 571 |  | DDr_CheatTable[21].message_off = _strdup(value); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 572 |  | else | 
 
 
 
 
 
 
 
 
 
 
 | 573 | < | DDrStartupMessage("unrecognised language item \"%s\"", name); | 
 
 
 
 
 
 
 
 
 | 573 | > | DDrStartupMessage("Daodan: Unrecognised ini language item \"%s\"", name); | 
 
 
 
 
 
 
 
 
 
 
 | 574 |  | break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 575 |  | case s_bsl: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 576 |  | default: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 586 |  | if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 587 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 588 |  | FILE* fp; | 
 
 
 
 
 
 
 
 
 
 
 | 589 | < | DDrStartupMessage("daodan.ini doesn't exist, creating"); | 
 
 
 
 
 
 
 
 
 | 589 | > | DDrStartupMessage("Daodan: daodan.ini doesn't exist, creating"); | 
 
 
 
 
 
 
 
 
 
 
 | 590 |  | fp = fopen("daodan.ini", "w"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 591 |  | if (fp) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 592 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 595 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 596 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 597 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 598 | < | DDrStartupMessage("parsing daodan.ini..."); | 
 
 
 
 
 
 
 
 
 | 598 | > | DDrStartupMessage("Daodan: Parsing daodan.ini..."); | 
 
 
 
 
 
 
 
 
 
 
 | 599 |  | if (!inifile_read("daodan.ini", DDrIniCallback)) | 
 
 
 
 
 
 
 
 
 
 
 | 600 | < | DDrStartupMessage("error reading daodan.ini, check your syntax!"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 601 | < | DDrStartupMessage("finished parsing"); | 
 
 
 
 
 
 
 
 
 | 600 | > | DDrStartupMessage("Daodan: Error reading daodan.ini, check your syntax!"); | 
 
 
 
 
 | 601 | > | DDrStartupMessage("Daodan: Finished parsing"); | 
 
 
 
 
 
 
 
 
 
 
 | 602 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 603 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 604 |  | void ONICALL DDrGame_Init() | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 653 |  | char* option; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 654 |  | bool falseoption; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 655 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 656 | < | DDrStartupMessage("daodan attached!"); | 
 
 
 
 
 
 
 
 
 | 656 | > | DDrStartupMessage("Daodan: Daodan attached!"); | 
 
 
 
 
 
 
 
 
 
 
 | 657 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 658 |  | // Tell Oni to not load non levelX_final-files by default: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 659 |  | opt_ignore_private_data = false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 662 |  | opt_sound = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 663 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 664 |  | DDrConfig(); | 
 
 
 
 
 
 
 
 
 
 
 | 665 | < | DDrStartupMessage("parsing command line..."); | 
 
 
 
 
 
 
 
 
 | 665 | > | DDrStartupMessage("Daodan: Parsing command line..."); | 
 
 
 
 
 
 
 
 
 
 
 | 666 |  | for (i = 1; i < argc; i ++) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 667 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 668 |  | if (argv[i][0] == '-') | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 690 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 691 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 692 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 693 | < | DDrStartupMessage("parse error \"%s\"", argv[i]); | 
 
 
 
 
 
 
 
 
 | 693 | > | DDrStartupMessage("Daodan: Parse error \"%s\"", argv[i]); | 
 
 
 
 
 
 
 
 
 
 
 | 694 |  | break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 695 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 696 |  | } | 
 
 
 
 
 
 
 
 
 
 
 | 697 | < | DDrStartupMessage("finished parsing"); | 
 
 
 
 
 
 
 
 
 | 697 | > | DDrStartupMessage("Daodan: Finished parsing"); | 
 
 
 
 
 
 
 
 
 
 
 | 698 |  | DDrPatch_Init(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 699 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 700 |  | // Safe startup message printer |