mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
chore: make DALAMUD_WAIT_DEBUGGER actually freeze process
This commit is contained in:
parent
f40b52968b
commit
3cf47f7ec4
1 changed files with 29 additions and 30 deletions
|
|
@ -4,6 +4,25 @@
|
|||
|
||||
HMODULE g_hModule;
|
||||
|
||||
bool check_env_var(std::string name)
|
||||
{
|
||||
size_t required_size;
|
||||
getenv_s(&required_size, nullptr, 0, name.c_str());
|
||||
if (required_size > 0)
|
||||
{
|
||||
if (char* is_no_veh = static_cast<char*>(malloc(required_size * sizeof(char))))
|
||||
{
|
||||
getenv_s(&required_size, is_no_veh, required_size, name.c_str());
|
||||
auto result = _stricmp(is_no_veh, "true");
|
||||
free(is_no_veh);
|
||||
if (result == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_running_on_linux()
|
||||
{
|
||||
size_t required_size;
|
||||
|
|
@ -32,40 +51,12 @@ bool is_running_on_linux()
|
|||
|
||||
bool is_veh_enabled()
|
||||
{
|
||||
size_t required_size;
|
||||
getenv_s(&required_size, nullptr, 0, "DALAMUD_IS_VEH");
|
||||
if (required_size > 0)
|
||||
{
|
||||
if (char* is_no_veh = static_cast<char*>(malloc(required_size * sizeof(char))))
|
||||
{
|
||||
getenv_s(&required_size, is_no_veh, required_size, "DALAMUD_IS_VEH");
|
||||
auto result = _stricmp(is_no_veh, "true");
|
||||
free(is_no_veh);
|
||||
if (result == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return check_env_var("DALAMUD_IS_VEH");
|
||||
}
|
||||
|
||||
bool is_full_dumps()
|
||||
{
|
||||
size_t required_size;
|
||||
getenv_s(&required_size, nullptr, 0, "DALAMUD_IS_VEH_FULL");
|
||||
if (required_size > 0)
|
||||
{
|
||||
if (char* is_no_veh = static_cast<char*>(malloc(required_size * sizeof(char))))
|
||||
{
|
||||
getenv_s(&required_size, is_no_veh, required_size, "DALAMUD_IS_VEH_FULL");
|
||||
auto result = _stricmp(is_no_veh, "true");
|
||||
free(is_no_veh);
|
||||
if (result == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return check_env_var("DALAMUD_IS_VEH_FULL");
|
||||
}
|
||||
|
||||
DllExport DWORD WINAPI Initialize(LPVOID lpParam)
|
||||
|
|
@ -76,6 +67,14 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam)
|
|||
|
||||
printf("Dalamud.Boot Injectable, (c) 2021 XIVLauncher Contributors\nBuilt at: %s@%s\n\n", __DATE__, __TIME__);
|
||||
|
||||
if (check_env_var("DALAMUD_WAIT_DEBUGGER"))
|
||||
{
|
||||
printf("Waiting for debugger to attach...\n");
|
||||
while (!IsDebuggerPresent())
|
||||
Sleep(100);
|
||||
printf("Debugger attached.\n");
|
||||
}
|
||||
|
||||
wchar_t _module_path[MAX_PATH];
|
||||
GetModuleFileNameW(g_hModule, _module_path, sizeof _module_path / 2);
|
||||
std::filesystem::path fs_module_path(_module_path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue