--- Daodan/src/Daodan.c 2013/03/04 15:52:19 689 +++ Daodan/src/Daodan.c 2013/03/07 22:38:21 693 @@ -1,3 +1,4 @@ +#include #include #include "Daodan.h" @@ -11,14 +12,11 @@ #include "Daodan_WindowHack.h" #include "Oni.h" -#include "Oni_Persistence.h" -#include "BFW_Utility.h" +#include "Oni_GL.h" +#include "Daodan_GL.h" -#include "oni_gl.h" -#include "daodan_gl.h" - -#include "inifile.h" +#include "Inifile_Reader.h" HMODULE DDrDLLModule; HMODULE DDrONiModule; @@ -41,6 +39,7 @@ bool patch_argb8888 = true; bool patch_killvtune = true; bool patch_getcmdline = true; bool patch_disablecmdline = true; +bool patch_optionsvisible = true; bool patch_safeprintf = true; bool patch_daodandisplayenum = true; @@ -54,11 +53,29 @@ bool patch_cheater = true; bool patch_newweapon = true; bool opt_usedaodanbsl = true; bool opt_border = true; -bool opt_shadow = false; bool opt_topmost = false; typedef int (__cdecl *CHINESEPROC)(DWORD WINAPI); bool patch_chinese = false; + + + +void ONICALL DDrShowResumeButton(int window, int visibility) +{ + if (visibility) + WMrWindow_SetLocation(window, 150, 350); + WMrWindow_SetVisible(window, visibility); +} + + +/* Options always visible patch */ +void ONICALL DDrShowOptionsButton(int window, int visibility) +{ + WMrWindow_SetVisible(window, 1); +} + + + bool DDrPatch_Init() { DDrStartupMessage("patching engine"); @@ -143,6 +160,7 @@ bool DDrPatch_Init() // 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. if (patch_alttab) { + // 0xC3 = ret, so makes those functions just have a "ret" instruction at their start DDrPatch_Byte ((char*)UUrPlatform_Initialize, 0xC3); DDrPatch_Byte ((char*)UUrPlatform_Terminate, 0xC3); } @@ -281,9 +299,19 @@ bool DDrPatch_Init() //FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen); //FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate); + + + // Fix options not visible in main menu when a game was started + if(patch_optionsvisible) + { + DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton); + DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton); + } + return true; } + enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; bool DDrIniCallback(char* section, bool newsection, char* name, char* value) @@ -312,8 +340,6 @@ bool DDrIniCallback(char* section, bool opt_usedaodanbsl = !_stricmp(inifile_cleanstr(value), "true"); else if (!_stricmp(name, "border")) opt_border = !_stricmp(inifile_cleanstr(value), "true"); - else if (!_stricmp(name, "shadow")) - opt_shadow = !_stricmp(inifile_cleanstr(value), "true"); else if (!_stricmp(name, "topmost")) opt_topmost = !_stricmp(inifile_cleanstr(value), "true"); else if (!_stricmp(name, "multibyte")) @@ -330,8 +356,6 @@ bool DDrIniCallback(char* section, bool opt_sound = !_stricmp(inifile_cleanstr(value), "true"); else if (!_stricmp(name, "switch")) M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true"); - //else if (!_stricmp(name, "devmode")) - //turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true"); else DDrStartupMessage("unrecognised option \"%s\"", name); break; @@ -392,6 +416,8 @@ bool DDrIniCallback(char* section, bool patch_cheater = !_stricmp(inifile_cleanstr(value), "true"); else if (!_stricmp(name, "newweap")) patch_newweapon = !_stricmp(inifile_cleanstr(value), "true"); + else if (!_stricmp(name, "optionsvisible")) + patch_optionsvisible = !_stricmp(inifile_cleanstr(value), "true"); else DDrStartupMessage("unrecognised patch \"%s\"", name); break; @@ -588,7 +614,10 @@ void __cdecl DDrMain(int argc, char* arg DDrStartupMessage("daodan attached!"); + // Tell Oni to not load non levelX_final-files by default: opt_ignore_private_data = false; + + // Enable sound by default: opt_sound = true; DDrConfig(); @@ -679,9 +708,7 @@ void __cdecl DDrMain(int argc, char* arg DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad); } - //DDrPatch_MakeJump((void*)(OniExe + 0x000378c0, (void*)DDrException); DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning); - //init_daodan_gl(); ONiMain(argc, argv); }