feat: DALAMUD_HAVE_VEH env var, disable by default

This commit is contained in:
goaaats 2021-12-23 16:11:46 +01:00
parent 1cc8cd9fa9
commit 97cf742819
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -38,20 +38,20 @@ bool is_running_on_linux()
bool is_veh_enabled() bool is_veh_enabled()
{ {
size_t required_size; size_t required_size;
getenv_s(&required_size, nullptr, 0, "DALAMUD_NO_VEH"); getenv_s(&required_size, nullptr, 0, "DALAMUD_HAVE_VEH");
if (required_size > 0) if (required_size > 0)
{ {
if (char* is_no_veh = static_cast<char*>(malloc(required_size * sizeof(char)))) if (char* is_no_veh = static_cast<char*>(malloc(required_size * sizeof(char))))
{ {
getenv_s(&required_size, is_no_veh, required_size, "DALAMUD_NO_VEH"); getenv_s(&required_size, is_no_veh, required_size, "DALAMUD_HAVE_VEH");
auto result = _stricmp(is_no_veh, "true"); auto result = _stricmp(is_no_veh, "true");
free(is_no_veh); free(is_no_veh);
if (result == 0) if (result == 0)
return false; return true;
} }
} }
return true; return false;
} }
DllExport DWORD WINAPI Initialize(LPVOID lpParam) DllExport DWORD WINAPI Initialize(LPVOID lpParam)
@ -93,16 +93,20 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam)
// ============================== VEH ======================================== // // ============================== VEH ======================================== //
printf("Initializing VEH... "); printf("Initializing VEH... ");
if(is_running_on_linux() || !is_veh_enabled()) if(is_running_on_linux())
{ {
printf("VEH was disabled manually!\n"); printf("VEH was disabled, running on linux\n");
} }
else else if (is_veh_enabled())
{ {
if (veh::add_handler()) if (veh::add_handler())
printf("Done!\n"); printf("Done!\n");
else printf("Failed!\n"); else printf("Failed!\n");
} }
else
{
printf("VEH was disabled manually\n");
}
// =========================================================================== // // =========================================================================== //