diff --git a/source-code/data/plugins/config.ini b/source-code/data/plugins/config.ini index 450e866..0ad7755 100644 --- a/source-code/data/plugins/config.ini +++ b/source-code/data/plugins/config.ini @@ -21,6 +21,8 @@ OpenGL_Patch_A=0 OpenGL_Patch_B=0 # Command line arguments Command_Line= +# Launches divahook.bat intead of diva.exe. +Use_divahook_bat=0 [Patches] #Enable or disable mouse cursor diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index afe9e44..8d3702f 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -33,6 +33,9 @@ wstring DirPath() { wstring DIVA_EXECUTABLE_STRING = ExePath(); LPCWSTR DIVA_EXECUTABLE = DIVA_EXECUTABLE_STRING.c_str(); +wstring DIVA_DIRPATH_STRING = DirPath(); +LPCWSTR DIVA_DIRPATH = DIVA_DIRPATH_STRING.c_str(); + wstring DIVA_EXECUTABLE_LAUNCH_STRING = DIVA_EXECUTABLE_STRING + L" --launch"; LPWSTR DIVA_EXECUTABLE_LAUNCH = const_cast(DIVA_EXECUTABLE_LAUNCH_STRING.c_str()); @@ -205,10 +208,11 @@ ConfigOptionBase* optionsArray[] = { new BooleanOption(L"opengl_patch_b", LAUNCHER_SECTION, CONFIG_FILE, L"OpenGL Patch B", L"Ignores some OpenGL-related errors. Don't use both patches at the same time unless you're know what you're doing.", L"", false), new OptionMetaSpacer(8), - new BooleanOption(L"custom_patches", PATCHES_SECTION, CONFIG_FILE, L"Enable custom patches", L"Enable all custom patches.", true, false), + new BooleanOption(L"custom_patches", PATCHES_SECTION, CONFIG_FILE, L"Enable custom patches", L"Enables all custom patches.", true, false), new BooleanOption(L"no_gpu_dialog", LAUNCHER_SECTION, CONFIG_FILE, L"Disable GPU Warning", L"Disables the warning dialog for unsupported GPUs.", L"", false), //new BooleanOption(L"ignore_exe_checksum", PATCHES_SECTION, CONFIG_FILE, L"Ignore exe checksum", L"Use at your own risk.", false, false), new StringOption(L"command_line", LAUNCHER_SECTION, CONFIG_FILE, L"Command Line:", L"Allows setting command line parameters for the game when using the launcher.\nDisabling the launcher will bypass this.", L"", false), + new BooleanOption(L"use_divahook_bat", LAUNCHER_SECTION, CONFIG_FILE, L"Use divahook.bat", L"Launches divahook.bat intead of diva.exe.", L"", false), }; ConfigOptionBase* playerdataArray[] = { diff --git a/source-code/source/plugins/Launcher/ui.h b/source-code/source/plugins/Launcher/ui.h index 6832dca..85af197 100644 --- a/source-code/source/plugins/Launcher/ui.h +++ b/source-code/source/plugins/Launcher/ui.h @@ -671,13 +671,23 @@ private: System::Void Button_Launch_Click(System::Object^ sender, System::EventA SaveSettings(); - // read the command line here so it'll be up to date even if the user changed it - WCHAR stringBuf[256]; - GetPrivateProfileStringW(LAUNCHER_SECTION, L"command_line", L"", stringBuf, 256, CONFIG_FILE); - - DIVA_EXECUTABLE_LAUNCH_STRING += L" " + wstring(stringBuf); - DIVA_EXECUTABLE_LAUNCH = const_cast(DIVA_EXECUTABLE_LAUNCH_STRING.c_str()); + if(GetPrivateProfileIntW(LAUNCHER_SECTION, L"use_divahook_bat", FALSE, CONFIG_FILE)) + { + DIVA_EXECUTABLE = NULL; + wstring DIVA_EXECUTABLE_LAUNCH_STRING = L"cmd.exe /C \""; + DIVA_EXECUTABLE_LAUNCH_STRING.append(DIVA_DIRPATH); + DIVA_EXECUTABLE_LAUNCH_STRING.append(L"\\divahook.bat\""); + DIVA_EXECUTABLE_LAUNCH = const_cast(DIVA_EXECUTABLE_LAUNCH_STRING.c_str()); + } + else + { + // read the command line here so it'll be up to date even if the user changed it + WCHAR stringBuf[256]; + GetPrivateProfileStringW(LAUNCHER_SECTION, L"command_line", L"", stringBuf, 256, CONFIG_FILE); + DIVA_EXECUTABLE_LAUNCH_STRING += L" " + wstring(stringBuf); + DIVA_EXECUTABLE_LAUNCH = const_cast(DIVA_EXECUTABLE_LAUNCH_STRING.c_str()); + } STARTUPINFOW si; PROCESS_INFORMATION pi;