| 1 |
+ |
#include <windows.h> |
| 2 |
|
#include <string.h> |
| 3 |
|
|
| 4 |
|
#include "Daodan.h" |
| 12 |
|
#include "Daodan_WindowHack.h" |
| 13 |
|
|
| 14 |
|
#include "Oni.h" |
| 14 |
– |
#include "Oni_Persistence.h" |
| 15 |
|
|
| 16 |
< |
#include "BFW_Utility.h" |
| 16 |
> |
#include "Oni_GL.h" |
| 17 |
> |
#include "Daodan_GL.h" |
| 18 |
|
|
| 19 |
< |
#include "oni_gl.h" |
| 19 |
< |
#include "daodan_gl.h" |
| 20 |
< |
|
| 21 |
< |
#include "inifile.h" |
| 19 |
> |
#include "Inifile_Reader.h" |
| 20 |
|
|
| 21 |
|
HMODULE DDrDLLModule; |
| 22 |
|
HMODULE DDrONiModule; |
| 39 |
|
bool patch_killvtune = true; |
| 40 |
|
bool patch_getcmdline = true; |
| 41 |
|
bool patch_disablecmdline = true; |
| 42 |
+ |
bool patch_optionsvisible = true; |
| 43 |
|
|
| 44 |
|
bool patch_safeprintf = true; |
| 45 |
|
bool patch_daodandisplayenum = true; |
| 53 |
|
bool patch_newweapon = true; |
| 54 |
|
bool opt_usedaodanbsl = true; |
| 55 |
|
bool opt_border = true; |
| 57 |
– |
bool opt_shadow = false; |
| 56 |
|
bool opt_topmost = false; |
| 57 |
|
|
| 58 |
|
typedef int (__cdecl *CHINESEPROC)(DWORD WINAPI); |
| 59 |
|
bool patch_chinese = false; |
| 60 |
+ |
|
| 61 |
+ |
|
| 62 |
+ |
|
| 63 |
+ |
void ONICALL DDrShowResumeButton(int window, int visibility) |
| 64 |
+ |
{ |
| 65 |
+ |
if (visibility) |
| 66 |
+ |
WMrWindow_SetLocation(window, 150, 350); |
| 67 |
+ |
WMrWindow_SetVisible(window, visibility); |
| 68 |
+ |
} |
| 69 |
+ |
|
| 70 |
+ |
|
| 71 |
+ |
/* Options always visible patch */ |
| 72 |
+ |
void ONICALL DDrShowOptionsButton(int window, int visibility) |
| 73 |
+ |
{ |
| 74 |
+ |
WMrWindow_SetVisible(window, 1); |
| 75 |
+ |
} |
| 76 |
+ |
|
| 77 |
+ |
|
| 78 |
+ |
|
| 79 |
|
bool DDrPatch_Init() |
| 80 |
|
{ |
| 81 |
|
DDrStartupMessage("patching engine"); |
| 160 |
|
// 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. |
| 161 |
|
if (patch_alttab) |
| 162 |
|
{ |
| 163 |
+ |
// 0xC3 = ret, so makes those functions just have a "ret" instruction at their start |
| 164 |
|
DDrPatch_Byte ((char*)UUrPlatform_Initialize, 0xC3); |
| 165 |
|
DDrPatch_Byte ((char*)UUrPlatform_Terminate, 0xC3); |
| 166 |
|
} |
| 299 |
|
|
| 300 |
|
//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen); |
| 301 |
|
//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate); |
| 302 |
+ |
|
| 303 |
+ |
|
| 304 |
+ |
// Fix options not visible in main menu when a game was started |
| 305 |
+ |
if(patch_optionsvisible) |
| 306 |
+ |
{ |
| 307 |
+ |
DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton); |
| 308 |
+ |
DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton); |
| 309 |
+ |
} |
| 310 |
+ |
|
| 311 |
|
return true; |
| 312 |
|
} |
| 313 |
|
|
| 314 |
+ |
|
| 315 |
|
enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; |
| 316 |
|
|
| 317 |
|
bool DDrIniCallback(char* section, bool newsection, char* name, char* value) |
| 340 |
|
opt_usedaodanbsl = !_stricmp(inifile_cleanstr(value), "true"); |
| 341 |
|
else if (!_stricmp(name, "border")) |
| 342 |
|
opt_border = !_stricmp(inifile_cleanstr(value), "true"); |
| 315 |
– |
else if (!_stricmp(name, "shadow")) |
| 316 |
– |
opt_shadow = !_stricmp(inifile_cleanstr(value), "true"); |
| 343 |
|
else if (!_stricmp(name, "topmost")) |
| 344 |
|
opt_topmost = !_stricmp(inifile_cleanstr(value), "true"); |
| 345 |
|
else if (!_stricmp(name, "multibyte")) |
| 356 |
|
opt_sound = !_stricmp(inifile_cleanstr(value), "true"); |
| 357 |
|
else if (!_stricmp(name, "switch")) |
| 358 |
|
M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true"); |
| 333 |
– |
//else if (!_stricmp(name, "devmode")) |
| 334 |
– |
//turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true"); |
| 359 |
|
else |
| 360 |
|
DDrStartupMessage("unrecognised option \"%s\"", name); |
| 361 |
|
break; |
| 416 |
|
patch_cheater = !_stricmp(inifile_cleanstr(value), "true"); |
| 417 |
|
else if (!_stricmp(name, "newweap")) |
| 418 |
|
patch_newweapon = !_stricmp(inifile_cleanstr(value), "true"); |
| 419 |
+ |
else if (!_stricmp(name, "optionsvisible")) |
| 420 |
+ |
patch_optionsvisible = !_stricmp(inifile_cleanstr(value), "true"); |
| 421 |
|
else |
| 422 |
|
DDrStartupMessage("unrecognised patch \"%s\"", name); |
| 423 |
|
break; |
| 614 |
|
|
| 615 |
|
DDrStartupMessage("daodan attached!"); |
| 616 |
|
|
| 617 |
+ |
// Tell Oni to not load non levelX_final-files by default: |
| 618 |
|
opt_ignore_private_data = false; |
| 619 |
+ |
|
| 620 |
+ |
// Enable sound by default: |
| 621 |
|
opt_sound = true; |
| 622 |
|
|
| 623 |
|
DDrConfig(); |
| 708 |
|
DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad); |
| 709 |
|
} |
| 710 |
|
|
| 682 |
– |
//DDrPatch_MakeJump((void*)(OniExe + 0x000378c0, (void*)DDrException); |
| 711 |
|
DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning); |
| 684 |
– |
//init_daodan_gl(); |
| 712 |
|
|
| 713 |
|
ONiMain(argc, argv); |
| 714 |
|
} |